UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

41 lines • 3.01 kB
/** * Who started a turn, for the remote approval-mode rule (senpi#6342: a turn follows the permission setting of the machine * it runs on, and no origin outlives the turn it started): * - `local`: this machine's own input, or input from a device the forwarder stated is the same account; * - `delegated`: input from a device the forwarder did not state is the same account, or the one run such a device's * record started; * - `engine`: a turn no client record started (an extension's message, a goal or loop turn, restored input). * A steer joins the running turn (`join`) and never changes its origin. */ export type TurnOrigin = "local" | "delegated" | "engine"; export type InputTurnMark = TurnOrigin | "join"; export type ConnectionOrigin = "local" | "delegated"; /** The mark an input gets where it is created: explicit for client records, `local` for the TUI, else `engine`. */ export declare function inputTurnMark(input: { readonly mode?: "steer" | "followUp"; readonly connectionOrigin?: ConnectionOrigin; readonly source?: string; }): InputTurnMark; export declare function markInputTurnOrigin(message: object, mark: InputTurnMark, personStarted?: boolean): void; /** Carries `from`'s origin mark onto `to`, a copy of the same input: a copy without it would open or join a turn unmarked. */ export declare function copyInputTurnMark(from: object, to: object): void; /** Whether a message carries an origin mark: a user message always opens a turn's origin, any other only when marked. */ export declare function hasInputTurnMark(message: object): boolean; /** Runs `handle`, and every async task it starts, as the record `origin` describes. */ export declare function runInRecordScope<T>(origin: ConnectionOrigin, handle: () => Promise<T>): Promise<T>; /** Whether the work being created belongs to an open cross-account record's own handling. */ export declare function recordIsDelegated(): boolean; /** * A run starts as engine work, or as delegated work when a cross-account record's own handling starts it; a retry keeps * the turn it continues. The user message that opens a turn sets its origin, a steer keeps it. */ export declare function noteRunStart(sessionManager: object): void; /** The next retry or recovery run repeats this turn; its start consumes the continuation mark. */ export declare function noteTurnContinuation(sessionManager: object): void; export declare function endTurnContinuation(sessionManager: object): void; export declare function noteUserMessageStart(sessionManager: object, message: object): void; /** A person's admitted message owns this identity; only an explicit continuation preserves it across run starts. */ export declare function currentPersonTurn(sessionManager: object): object | undefined; /** Whether the deciding turn counts as delegated-origin: a cross-account device started this turn or this run. */ export declare function decidingTurnIsDelegated(sessionManager: object): boolean; //# sourceMappingURL=turn-origin.d.ts.map