@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
43 lines • 2.18 kB
TypeScript
import { type AssistantMessage, type AssistantProgress } from "@earendil-works/pi-ai";
import type { SeededJsonMessageUpdateEvent } from "../json-event.ts";
import { type ActiveBlock } from "./compact-active-block.ts";
import { type CompactSeededDraft, type SeededFields } from "./compact-seeded-draft.ts";
import type { FrozenBlock } from "./compact-text-view.ts";
type PublicBlock = AssistantMessage["content"][number];
export type SeededBlockEvent = Extract<SeededJsonMessageUpdateEvent["assistantMessageEvent"], {
contentIndex: number;
}> | AssistantProgress;
export interface SeededBlock {
readonly type: PublicBlock["type"];
readonly fields: SeededFields;
readonly body: ActiveBlock;
readonly signature: ActiveBlock;
/** `initial`: a slot from a message start's content, taken over by that index's own block start. */
readonly phase: "initial" | "open" | "ended";
readonly parsedThrough: number;
}
type Frontier = {
readonly coveredCodeUnits: number;
readonly nextOffset: number;
readonly rawArgumentPrefix?: string;
readonly parsedThrough?: number;
};
export declare function seedBlock(draft: CompactSeededDraft, block: PublicBlock, frontier?: Frontier): SeededBlock;
/** Validation and candidate ownership precede the session owner's single publication. */
export declare function foldSeededBlock(draft: CompactSeededDraft, old: SeededBlock | undefined, event: SeededBlockEvent): SeededBlock;
declare function frozenSeededBlock(block: SeededBlock): {
type: "providerNative" | "text" | "thinking" | "toolCall";
fields: Readonly<Record<string, import("./compact-values.ts").ValueRef>>;
phase: "ended" | "initial" | "open";
parsedThrough: number;
signature: {
root: number;
tailRoot: number;
};
};
export type FrozenSeededBlock = ReturnType<typeof frozenSeededBlock>;
/** The published component row of one active block, seeded or legacy. */
export declare function frozenBlock(contentIndex: number, block: ActiveBlock): FrozenBlock;
export declare function seededBlockLeaves(block: FrozenSeededBlock): readonly number[];
export {};
//# sourceMappingURL=compact-seeded-block.d.ts.map