@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
63 lines • 2.74 kB
TypeScript
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
import type { BeforeAgentStartEventResult, ExtensionAPI, ExtensionContext } from "../../types.ts";
export interface AgentCheckpoint {
activeTools?: string[];
thinkingLevel?: ThinkingLevel | null;
modelId?: string | undefined;
agentName?: string | null;
timestamp?: number;
model?: {
provider: string;
modelId: string;
};
}
interface LegacyCaptureInput {
agentName?: string;
model?: {
provider: string;
modelId: string;
};
activeTools?: string[];
}
interface AppendEntryTarget {
appendEntry<T = unknown>(customType: string, data?: T): void;
}
interface LegacyCheckpointSource {
persistedCheckpoints?: AgentCheckpoint[];
appendCalls?: Array<{
customType: string;
data: unknown;
}>;
}
export declare function captureAgentCheckpoint(pi: ExtensionAPI, ctx: ExtensionContext): AgentCheckpoint;
export declare function captureAgentCheckpoint(input: LegacyCaptureInput): AgentCheckpoint;
export declare function persistCheckpoint(pi: ExtensionAPI, checkpoint: AgentCheckpoint): void;
export declare function persistCheckpoint(checkpoint: AgentCheckpoint, pi: AppendEntryTarget): void;
export declare function getLatestCheckpoint(ctx: ExtensionContext): AgentCheckpoint | null;
export declare function getLatestCheckpoint(source: LegacyCheckpointSource): AgentCheckpoint | undefined;
/**
* One-shot delivery state for the checkpoint restoration directive.
*
* Before 2026-08-01 the directive was appended to the system prompt on every
* request inside the 60s checkpoint window; it now rides the hidden post-compact
* restoration message exactly once per checkpoint. See changes.md.
*/
export interface RestorationDirectiveState {
deliveredCheckpointTimestamp: number | null;
}
export declare function createRestorationDirectiveState(): RestorationDirectiveState;
/**
* Attach the restoration directive to the one-shot post-compact message, once
* per checkpoint. Returns the pending message unchanged when the checkpoint is
* stale or its directive was already delivered.
*/
export declare function attachRestorationDirective(state: RestorationDirectiveState, checkpoint: AgentCheckpoint | null, message: BeforeAgentStartEventResult["message"] | undefined): BeforeAgentStartEventResult["message"] | undefined;
export declare function injectRestorationDirective(systemPrompt: string, checkpoint: AgentCheckpoint): string;
export declare function injectRestorationDirective(checkpoint?: AgentCheckpoint, fallback?: {
model?: {
provider: string;
modelId: string;
};
}): string;
export {};
//# sourceMappingURL=checkpoint-state.d.ts.map