@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
38 lines • 2.53 kB
TypeScript
import type { AgentMessage } from "@earendil-works/pi-agent-core";
import type { ExtensionAPI, ExtensionContext } from "../../types.ts";
import { type GoalContinuationInput, type GoalContinuationVerdict } from "./continuation.ts";
import type { Goal } from "./types.ts";
type ContinuingGoalContinuationVerdict = Extract<GoalContinuationVerdict, {
kind: "continue";
}>;
export declare const GOAL_STALE_STOP_NOTICE = "Goal auto-continuation stopped because progress is stale. Send a message or run /goal resume to continue.";
type GoalContinuationDeliveryOptions = {
readonly input: Omit<GoalContinuationInput, "goal">;
readonly content: (verdict: ContinuingGoalContinuationVerdict) => string;
readonly markContinuationPending: () => void;
};
/**
* Mirrors codex `maybe_prompt_resume_paused_goal_after_resume`
* (codex-rs/tui/src/app/thread_goal_actions.rs), which prompts on resume for every
* stopped-but-unfinished status. senpi is budget-free, so codex's `UsageLimited`
* has no counterpart here and the stopped set is `paused | blocked`.
*/
export declare function isResumeOfStoppedGoal(ctx: ExtensionContext, sessionStartReason: string, goal: Goal | null): goal is Goal;
/** Evaluates and delivers a continuation only after all guardrail checks admit it. */
export declare function admitAndQueueGoalContinuation(pi: ExtensionAPI, ctx: ExtensionContext, goal: Goal, options: GoalContinuationDeliveryOptions): Promise<Goal | null>;
export declare function buildCurrentGoalContinuationSignature(ctx: ExtensionContext, goal: Goal, lastAssistantText: string): string;
export declare function lastAssistantText(messages: readonly AgentMessage[]): string;
export declare function isLastTurnStuckOnContextOverflow(ctx: ExtensionContext, lastAssistant: Extract<AgentMessage, {
role: "assistant";
}> | undefined): boolean;
/**
* senpi#3015: the stop claim and the session entries are two separate writes, so a crash
* between them leaves the claim without its entries. On session start the claim still
* stands, so re-append the missing entries once from the payload the claim captured.
* A claim whose entries already landed is left alone; a claim recorded before the
* payload existed cannot be rebuilt and is left alone too.
*/
export declare function recoverMissingGoalContinuationStop(pi: ExtensionAPI, ctx: ExtensionContext, goal: Goal): Promise<void>;
export declare function queueHiddenGoalPrompt(pi: ExtensionAPI, content: string): void;
export {};
//# sourceMappingURL=lifecycle-helpers.d.ts.map