import type { Database } from "./database.js"; import * as schema from "./schema.js"; /** Clear a terminal unchanged-input continuation fence after newer goal truth. */ export declare const SESSION_GOAL_SUPPRESSION_CLEARED: { readonly continuationSuppressedTurnId: null; }; /** The pause reason written when a per-goal or deployment continuation ceiling is reached. */ export declare const SESSION_GOAL_CAP_PAUSED_REASON = "max_auto_continuations"; /** * Column reset applied when a goal re-arms: a fresh continuation epoch starts * with zero consecutive no-input continuations and no pointer to a * pre-pause continuation turn. */ export declare const SESSION_GOAL_CONTINUATION_EPOCH_RESET: { readonly autoContinuations: 0; readonly noProgressStreak: 0; readonly lastContinuationTurnId: null; readonly versionAtLastContinuation: null; }; export type SessionGoalAutoResumeCause = { /** The system-update kind that arrived, or `human_prompt` for a Send/Steer. */ kind: string; updateId?: string; turnId?: string; }; export type SessionGoalAutoResumedByExternalInput = { goal: typeof schema.sessionGoals.$inferSelect; /** `goal.resumed` payload the caller appends at its next session sequence. */ payload: { goalId: string; text: string; successCriteria?: string; version: number; objectiveRevision: number; mutationPolicy: string; actor: "system"; reason: "external_input"; cause: SessionGoalAutoResumeCause; }; }; /** * Resume a goal that the continuation ceiling paused, because new external * input arrived. The ceiling (`max_auto_continuations`) is pacing for * consecutive no-input continuations, never user intent: a `user_pause`, * `api`, `agent`, or `limits` pause is deliberately left alone and is never * resumed here. Every producer of external input calls this: child results, * scheduled occurrences, and media results (`addSessionSystemUpdate*`), Agent * messages (`sendAgentMessageInTransaction`), Agent Steer * (`steerAgentSessionInTransaction`), and human/API Send/Steer * (`submitHumanPromptInTransaction`). * * Lock contract: the caller already holds the canonical event-write prefix * and the session row (`FOR NO KEY UPDATE`); this helper then takes the goal * row `FOR UPDATE`, the same order every goal tool uses. It mutates only the * goal head and returns the `goal.resumed` payload; the caller must append * that event at its next session sequence inside the SAME transaction so the * goal mutation and its timeline fact remain one session-sequenced commit. * Returns null when the session has no goal or its pause is not the ceiling. */ export declare function autoResumeGoalPausedByCapInTransaction(tx: Database, input: { workspaceId: string; sessionId: string; cause: SessionGoalAutoResumeCause; now: Date; }): Promise;