import type { SessionEvent } from "@opengeni/contracts"; import type { Database } from "./database.js"; export declare const TOOL_RESULT_TYPE_BY_CALL_TYPE: Readonly>; export declare function historyCallId(item: Record): string | null; export declare function historyItemType(item: Record): string | null; /** * Person-facing projection of a call whose command was proven never sent. The * call's model-visible result is written separately into history. */ export declare const NOT_STARTED_TOOL_CALL_EVENT_TEXT = "The command was not started because the sandbox was not ready. Nothing ran, so it is safe to run again."; /** * Model-visible result for a function call whose command was proven never * dispatched. Unlike an interrupted call, nothing ran, so the model may run it * again without inspecting state first. */ export declare const NOT_STARTED_TOOL_CALL_RESULT_TEXT = "The command was not started because the sandbox was not ready. Nothing ran, so it is safe to run it again."; /** Person-facing not-started copy when the workspace machine was changing. */ export declare const WORKSPACE_MACHINE_NOT_STARTED_TOOL_CALL_EVENT_TEXT = "The command was not started because the workspace machine was not ready. Nothing ran, so it is safe to run again."; /** Model-visible not-started result when the workspace machine was changing. */ export declare const WORKSPACE_MACHINE_NOT_STARTED_TOOL_CALL_RESULT_TEXT = "The command was not started because the workspace machine was not ready. Nothing ran, so it is safe to run it again."; /** The person-facing and model-visible not-started copy for a recovery reason. */ export declare function notStartedToolCallTexts(reason: string | undefined): { event: string; result: string; }; /** Provider-valid result for a function call proven never started. */ export declare function notStartedToolCallResult(input: { callId: string; callItem: Record; /** The recovery reason, which picks the copy (see notStartedToolCallTexts). */ reason?: string; }): Record; /** Provider-valid result for a started call whose durable outcome is unknown. */ export declare function interruptedToolCallResult(input: { callType: string; callId: string; callItem: Record; reason: string; }): Record | null; export type ClosePendingSessionToolCallsInput = { accountId: string; workspaceId: string; sessionId: string; turnId: string; reason: string; sequence: number; now: Date; turnAssociation?: "current" | null; preserveInterruptionRows?: boolean; /** * Function calls with call-scoped proof that their command was never * dispatched. Without a durable result they settle as not started (replay * safe) instead of outcome unknown. */ notStartedCallIds?: readonly string[]; }; /** Same terminal fence for model and programmatic calls. Started effects remain unknown. */ export declare function settleInterruptedCodemodeCallsInTransaction(tx: Database, input: Pick): Promise; /** * A completed turn owns no live tool call. Consume every receipt of this turn * whose owning attempt has settled (closed, and either quiesced or never * interrupted), so the receipt cannot outlive its turn and later read as * unresolved work (tenancy quiescence, Retry preview, native-origin recovery). * Paired calls are already model-visible and projected; an unpaired call of a * completed turn (for example a hosted approval request the model moved past) * can never be resumed, because only failed/cancelled/superseded settlement or * an approval resume of a nonterminal turn reads these rows. This deletes * ledger rows only: history and events are untouched. The predicate matches * migration 0673. Runs under the settlement's session/turn locks and * workspace tenancy fence, after the completing attempt has been closed. */ export declare function consumeSettledPendingToolCallsForCompletedTurnInTransaction(tx: Database, input: { workspaceId: string; sessionId: string; turnId: string; }): Promise; /** * Close raw tool calls for a logical turn while its owning session/turn locks * are held. Recoverable transitions preserve interruption rows because those * rows are the exact open-suffix resume authority for a replacement attempt; * ordinary in-flight rows still receive durable outcome-unknown settlement. * Terminal and superseding transitions close every row. Durable results win; * repeated settlement is an exact no-op after the selected ledger rows are * deleted. */ export declare function closePendingSessionToolCallsInTransaction(tx: Database, input: ClosePendingSessionToolCallsInput): Promise<{ sequence: number; events: SessionEvent[]; closed: number; interrupted: number; }>;