/** Authoritative model default identity for one agent target. */ interface AgentActivityComposerModelConfiguration { agentTargetId: string; defaultModel: string | null; fingerprint: string; source: "model-plan" | "provider-native"; } interface AgentActivitySessionCapabilities { imageInput: boolean; modelImageInputRequired: boolean; modelPlanBinding: boolean; skills: boolean; compact: boolean; tokenUsage: boolean; rateLimits: boolean; planMode: boolean; interrupt: boolean; modelSwitch: boolean; activeTurnGuidance: boolean; browserUse: boolean; computerUse: boolean; goalPause: boolean; planImplementation: boolean; permissionModeChangeDuringTurn: boolean; permissionModeChangeDeferred: boolean; review: boolean; resumeRunningTurn: boolean; } interface AgentActivityComposerSettingOption { value: string; label: string; description?: string; consumptionMultiplier?: string; supportsImageInput?: boolean; /** True when the entry mirrors the requested/current selection, not the provider catalog. */ requested?: boolean; } interface AgentActivityComposerCommandOption { name: string; description?: string; inputHint?: string; } interface AgentActivityComposerSkillOption { name: string; trigger: string; invocation?: "promptItem" | "textTrigger"; sourceKind: "project" | "personal" | "bundled" | "plugin" | "system" | "tutti-injected" | "connector"; description?: string; pluginName?: string; path?: string; kind?: "skill" | "connector"; } interface AgentActivityComposerCapabilityOption { id: string; kind: "skill" | "plugin" | "connector" | "mcpServer" | "mcpTool"; name: string; label: string; status: "available" | "disabled" | "authRequired" | "setupRequired" | "unsupported"; invocation: "promptItem" | "textTrigger" | "none"; description?: string; iconUrl?: string; installedAtUnixMs?: number; source?: string; pluginName?: string; serverName?: string; toolName?: string; trigger?: string; path?: string; } interface AgentActivityComposerPermissionModeOption { id: string; label?: string; description?: string; semantic?: string; } interface AgentActivityComposerPermissionConfig { configurable: boolean; defaultValue?: string | null; modes: AgentActivityComposerPermissionModeOption[]; } interface AgentActivityComposerSettings { codexSaverMode?: boolean | null; rtkSaverMode?: boolean | null; model?: string | null; reasoningEffort?: string | null; speed?: string | null; planMode?: boolean | null; permissionModeId?: string | null; } type AgentActivitySlashCommandEffect = "submitImmediate" | "showReviewPicker" | "activateGoalMode" | "togglePlanMode" | "showStatus" | "toggleSpeed"; interface AgentActivitySlashCommandPolicy { fallbackCommands: readonly string[]; commandCatalogAuthoritative?: boolean; commandEffects: readonly { command: string; effect: AgentActivitySlashCommandEffect; }[]; } interface AgentActivityComposerBehavior { collapseModelOptionsToLatest: boolean; modelOptionsAuthoritative: boolean; refreshModelOptionsAfterSettings: boolean; prewarmDraftSession: boolean; planModeExclusiveWithPermissionMode: boolean; } interface AgentActivityComposerOptions { codexSaverModeSupported?: boolean; rtkSaverModeSupported?: boolean; provider: string; /** Typed capabilities available before a session exists. */ capabilities: AgentActivitySessionCapabilities | null; models: AgentActivityComposerSettingOption[]; reasoningEfforts: AgentActivityComposerSettingOption[]; reasoningOptionsByModel?: Record; /** Orthogonal speed tiers (e.g. standard/fast); empty when unsupported. */ speeds: AgentActivityComposerSettingOption[]; /** Mirrors tuttid modelConfig.configurable; false when absent. */ modelConfigurable?: boolean; /** * Provider-resolved runtime model. This remains separate from the selected * model so an inherited `default` choice stays inherited. */ effectiveModel?: string | null; /** Mirrors tuttid reasoningConfig.configurable; false when absent. */ reasoningConfigurable?: boolean; /** Mirrors tuttid speedConfig.configurable; false when absent. */ speedConfigurable?: boolean; /** Effective pre-session settings paired with this options snapshot. */ effectiveSettings?: AgentActivityComposerSettings | null; permissionConfig?: AgentActivityComposerPermissionConfig | null; draftAgentSessionId?: string | null; modelOptionsLoading?: boolean; skills: AgentActivityComposerSkillOption[]; /** Commands advertised by the live provider session and reusable after event replay gaps. */ commands?: readonly AgentActivityComposerCommandOption[]; capabilityCatalog?: AgentActivityComposerCapabilityOption[]; behavior: AgentActivityComposerBehavior; slashCommandPolicy?: AgentActivitySlashCommandPolicy | null; /** Credential-free model-plan identity projected from daemon runtime context. */ modelPlan?: { id: string; name: string; protocol?: string | null; } | null; /** Authoritative model default identity for the selected agent target. */ modelConfiguration?: AgentActivityComposerModelConfiguration | null; loadedAtUnixMs: number; } interface AgentActivityLoadComposerOptionsInput { /** * Agent target id — the daemon-facing identity of the composer target. * activity-core treats it as an opaque targetKey. This field name reflects * that to the daemon it is an agent target id. Optional at the adapter * boundary to mirror the daemon's optional request field; the engine command * port always supplies a non-empty value. */ agentTargetId?: string | null; agentSessionId?: string | null; workspaceId: string; provider: string; section?: "full" | "core" | "capabilities" | "connectors"; /** Wait only when the user explicitly opens the model picker. */ waitForFreshModelCatalog?: boolean; cwd?: string | null; settings?: AgentActivityComposerSettings | null; signal?: AbortSignal; } type AgentActivityComposerOptionsLoadStatus = "loading" | "ready" | "error"; type AgentActivityGoalControlAction = "pause" | "resume" | "clear" | "set"; interface AgentActivityInitialGoalControl { action: AgentActivityGoalControlAction; objective?: string; } interface AgentActivityGoalControlInput { workspaceId: string; agentSessionId: string; action: AgentActivityGoalControlAction; clientSubmitId?: string; objective?: string; signal?: AbortSignal; } interface AgentActivityMessageSemantics { userVisibleAssistantResponse?: boolean; turnSettling?: boolean; noticeCommand?: "compact" | "review" | "undo" | "goal"; noticeCommandStatus?: "running" | "completed" | "failed" | "canceled"; } interface AgentActivityMessageBase { workspaceId?: string; agentSessionId: string; messageId: string; version: number; turnId: string | null; role: string; kind: string; status?: string | null; semantics?: AgentActivityMessageSemantics; payload: Record; occurredAtUnixMs: number; createdAtUnixMs?: number; startedAtUnixMs?: number; completedAtUnixMs?: number; } interface AgentActivityDurableMessage extends AgentActivityMessageBase { sequence: number; } interface AgentActivityTransientMessage extends AgentActivityMessageBase { sequence?: undefined; } type AgentActivityMessage = AgentActivityDurableMessage | AgentActivityTransientMessage; interface AgentActivityMessageDeltaEvent { workspaceId: string; agentSessionId: string; eventType: "message_delta"; data: { workspaceId: string; agentSessionId: string; messageId: string; turnId: string; role: string; kind: string; occurredAtUnixMs: number; content?: { operation: "append_text"; text: string; } | { operation: "set"; value: unknown; }; toolOutput?: { operation: "set"; text: string; } | { operation: "append_text"; text: string; offsetBytes: number; }; payloadSet?: Readonly>; payloadUnset?: readonly string[]; status?: string; semantics?: AgentActivityMessageSemantics; startedAtUnixMs?: number; completedAtUnixMs?: number; }; } /** * Authoritative coverage for the durable message window currently held by the * engine. Message versions are mutable change cursors, so neither the minimum * version nor a gap in versions can prove that older messages exist. */ interface AgentActivitySessionMessageWindow { hasOlderMessages: boolean; oldestLoadedVersion: number | null; } type AgentActivityRailPlacement = { version: 1; kind: "conversations"; sectionKey: "conversations"; projectPath?: never; } | { version: 1; kind: "project"; projectPath: string; sectionKey: string; }; interface AgentActivityCapabilityReference { capability: "tutti"; source: "slash_command"; } type AgentActivityTuttiModeActivationStatus = "active" | "inactive"; type AgentActivityTuttiModeActivationSource = "slash_command" | "badge_remove"; interface AgentActivityTuttiModeActivationRevision { activationId: string; revision: number; status: AgentActivityTuttiModeActivationStatus; source: AgentActivityTuttiModeActivationSource; /** * Outcome-quality preference. Optional while legacy revision producers are * supported; consumers fall back to orchestrationIntensity. */ effect?: number; /** * Completion-speed preference. Optional while legacy revision producers are * supported; consumers use the balanced default when absent. */ speed?: number; /** * Legacy single-axis alias of effect. * * @deprecated Use effect and speed. */ orchestrationIntensity: number; createdAtUnixMs: number; } interface AgentActivityTuttiModeActivation { id: string; workspaceId: string; agentSessionId: string; status: AgentActivityTuttiModeActivationStatus; currentRevision: AgentActivityTuttiModeActivationRevision; createdAtUnixMs: number; updatedAtUnixMs: number; } interface AgentActivityInitialTuttiModeActivation { status: "active"; source: "slash_command"; effect?: number | null; speed?: number | null; /** * Legacy single-axis alias of effect. Ignored when effect is present. * * @deprecated Use effect and speed. */ orchestrationIntensity?: number | null; } interface AgentActivityUpdateTuttiModeActivationInput { workspaceId: string; agentSessionId: string; status: AgentActivityTuttiModeActivationStatus; source: AgentActivityTuttiModeActivationSource; effect?: number | null; speed?: number | null; /** * Legacy single-axis alias of effect. Ignored when effect is present. * * @deprecated Use effect and speed. */ orchestrationIntensity?: number | null; expectedRevision?: number | null; signal?: AbortSignal; } interface AgentActivityUpdateTuttiModeActivationResult { activation: AgentActivityTuttiModeActivation; changed: boolean; } type AgentActivityCollaborationMode = "consult" | "fork" | "delegate" | "handoff"; type AgentActivityCollaborationTriggerSource = "user" | "agent" | "policy"; type AgentActivityCollaborationStatus = "running" | "completed" | "failed" | "canceled"; type AgentActivityCollaborationAdoption = "pending" | "adopted" | "rejected" | "not_applicable"; interface AgentActivityCollaborationUsage { inputTokens: number; outputTokens: number; } /** * One recorded collaboration run (model consult, fork, delegate, or handoff) * as returned by the host collaboration-run APIs. Timeline rendering reads the * durable "collaboration" message projection instead; this shape is the * command result contract. */ interface AgentActivityCollaborationRun { id: string; workspaceId: string; mode: AgentActivityCollaborationMode | (string & {}); triggerSource: AgentActivityCollaborationTriggerSource | (string & {}); triggerReason?: string | null; sourceSessionId?: string | null; targetSessionId?: string | null; targetAgentTargetId?: string | null; modelPlanId?: string | null; model?: string | null; contextScope?: string | null; resultText?: string | null; failureReason?: string | null; status: AgentActivityCollaborationStatus | (string & {}); adoption: AgentActivityCollaborationAdoption | (string & {}); usage?: AgentActivityCollaborationUsage | null; durationMs?: number | null; startedAtUnixMs?: number | null; completedAtUnixMs?: number | null; } interface AgentActivitySetCollaborationAdoptionInput { workspaceId: string; agentSessionId: string; runId: string; adoption: Exclude; signal?: AbortSignal; } interface AgentActivityModelPlanModel { id: string; name: string; } /** Credential-free summary of one workspace model access plan. */ interface AgentActivityModelPlanSummary { id: string; name: string; protocol: string; enabled: boolean; status: string; models: AgentActivityModelPlanModel[]; defaultModel?: string | null; } type AgentActivitySessionKind = "root" | "child"; interface AgentActivitySessionLifecycleCapabilities { fork: boolean; forkThroughTurn: boolean; } interface AgentActivitySessionForkLineage { sourceAgentSessionId: string; sourceTurnId: string; targetTurnId: string; operationId: string; forkedAtUnixMs: number; } interface AgentActivitySessionIsolation { mode: "worktree"; worktreeId?: string; worktreePath: string; branch: string; baseCommit: string; } interface AgentActivitySession { workspaceId: string; agentSessionId: string; kind: AgentActivitySessionKind; rootAgentSessionId: string | null; rootTurnId: string | null; parentAgentSessionId: string | null; parentTurnId: string | null; parentToolCallId: string | null; agentTargetId: string | null; provider: string; providerSessionId: string | null; userId?: string; model?: string | null; noProject?: boolean | null; cwd: string; isolation?: AgentActivitySessionIsolation | null; /** Backend-owned conversation-rail membership; absent for non-rail runtimes. */ railSectionKey?: string; title: string; activeTurnId: string | null; activeTurn: AgentActivityTurn | null; latestTurn: AgentActivityTurn | null; latestTurnInteractions: readonly AgentActivityInteraction[]; pendingInteractions: readonly AgentActivityInteraction[]; settings: AgentActivitySessionSettings; permissionConfig: AgentActivitySessionPermissionConfig; capabilities: AgentActivitySessionCapabilities | null; lifecycleCapabilities: AgentActivitySessionLifecycleCapabilities; /** * True only when lifecycle capabilities came from an authoritative Session * detail projection. Lightweight rail/list projections intentionally leave * provider-backed lifecycle capabilities unresolved. */ lifecycleCapabilitiesProjected?: boolean; forkedFrom: AgentActivitySessionForkLineage | null; usage: AgentActivitySessionUsage | null; goal: AgentActivitySessionGoal | null; /** * Optional host-owned projection of the durable Goal synchronization state. * Absence means the host cannot prove operation progress; it is not an idle, * failed, or synced assertion. */ goalSyncState?: AgentActivitySessionGoalSyncState | null; /** * Read projection of the independent daemon-owned TuttiModeActivation. * The session does not own this lifecycle; activity-core normalizes it into * its dedicated activation slice. */ tuttiModeActivation: AgentActivityTuttiModeActivation | null; imported: boolean; visible: boolean; resumable: boolean; /** Latest accepted durable message change cursor. */ messageVersion: number; lastEventUnixMs: number; startedAtUnixMs: number; endedAtUnixMs: number | null; pinnedAtUnixMs: number | null; createdAtUnixMs: number; updatedAtUnixMs: number; } type AgentActivityActivationMode = "new" | "existing"; type AgentActivityActivationStatus = "attached" | "already_attached" | "failed"; interface AgentActivityActivateSessionResult { session: AgentActivitySession; activation: { mode: AgentActivityActivationMode; status: AgentActivityActivationStatus; }; error?: { code: string; message: string; debugMessage?: string; }; } interface AgentActivitySessionList { sessions: AgentActivitySession[]; presences?: AgentActivityPresence[]; } interface AgentActivityRenameSessionInput { workspaceId: string; agentSessionId: string; title: string; signal?: AbortSignal; } interface AgentActivityPresence { id: string | number; workspaceId: string; provider: string; status: string; userId?: string | null; } interface AgentActivityMessagePage { messages: AgentActivityDurableMessage[]; hasMore: boolean; latestVersion: number; } type AgentActivityMessageOrder = "asc" | "desc"; interface AgentActivitySnapshot { workspaceId: string; sessions: AgentActivitySession[]; presences: AgentActivityPresence[]; sessionMessagesById: Record; sessionMessageWindowsById?: Record; /** Composer options keyed by the opaque, verbatim loadComposerOptions targetKey. */ composerOptionsByTargetKey?: Record; /** Request lifecycle for composer options, keyed by the same opaque target. */ composerOptionsLoadStatusByTargetKey?: Record; } type AgentActivitySnapshotListener = (snapshot: AgentActivitySnapshot) => void; type AgentActivityUpdatedEvent = AgentActivityRuntimeActivityUpdatedEvent | AgentActivitySessionReconcileRequiredEvent | AgentActivitySessionDeletedEvent | AgentActivitySessionRestoredEvent | AgentActivitySessionAuditEvent | AgentActivityMessageDeltaEvent | AgentActivityMessageUpdatedEvent | AgentActivityTurnUpdatedEvent | AgentActivityInteractionUpdatedEvent; interface AgentActivityRuntimeActivityUpdatedEvent { workspaceId: string; agentSessionId: string; eventType: "runtime_activity_update"; data: { workspaceId: string; agentSessionId: string; eventType: "runtime_activity_update"; state: "idle" | "running"; occurredAtUnixMs: number; }; } interface AgentActivitySessionReconcileRequiredEvent { workspaceId: string; agentSessionId: string; eventType: "session_reconcile_required"; data: { workspaceId: string; agentSessionId: string; agentTargetId?: string; eventType: "session_reconcile_required"; lastEventUnixMs: number; }; } interface AgentActivitySessionDeletedEvent { workspaceId: string; agentSessionId: string; eventType: "session_deleted"; data: { workspaceId: string; agentSessionId: string; eventType: "session_deleted"; deletedAtUnixMs: number; }; } interface AgentActivitySessionRestoredEvent { workspaceId: string; agentSessionId: string; eventType: "session_restored"; data: { workspaceId: string; agentSessionId: string; eventType: "session_restored"; restoredAtUnixMs: number; }; } interface AgentActivityMessageUpdatedEvent { workspaceId: string; agentSessionId: string; eventType: "message_update"; data: { workspaceId: string; agentSessionId: string; eventType: "message_update"; latestVersion: number; acceptedCount: number; messages: readonly AgentActivityEventMessage[]; }; } interface AgentActivitySessionAuditEvent { workspaceId: string; agentSessionId: string; eventType: "session_audit"; data: { workspaceId: string; agentSessionId: string; eventType: "session_audit"; audit: { auditId: string; role: string; payload: Record; occurredAtUnixMs: number; version: number; }; }; } interface AgentActivityEventMessage { agentSessionId: string; kind: string; messageId: string; payload: Record; role: string; version: number; turnId: string | null; status?: string; sequence: number; occurredAtUnixMs: number; startedAtUnixMs?: number; completedAtUnixMs?: number; createdAtUnixMs?: number; updatedAtUnixMs?: number; } interface AgentActivityTurnUpdatedEvent { workspaceId: string; agentSessionId: string; eventType: "turn_update"; data: { workspaceId: string; agentSessionId: string; eventType: "turn_update"; occurredAtUnixMs: number; activeTurnId: string | null; turn: AgentActivityEventTurn; }; } interface AgentActivityEventTurn { turnId: string; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; phase: AgentActivityTurnPhase; origin: AgentActivityTurnOrigin; sourceGoalOperationId?: string | null; sourceGoalRevision?: number | null; sourceGoalRepairEpoch?: number | null; outcome: AgentActivityTurnOutcome | null; error: Record | null; fileChanges: unknown; completedCommand: Record | null; startedAtUnixMs: number; settledAtUnixMs: number | null; updatedAtUnixMs: number; } interface AgentActivityInteractionUpdatedEvent { workspaceId: string; agentSessionId: string; eventType: "interaction_update"; data: { workspaceId: string; agentSessionId: string; eventType: "interaction_update"; occurredAtUnixMs: number; interaction: AgentActivityInteraction; }; } type AgentActivitySessionEventEnvelope = Extract; interface AgentActivityUpdatedApplyResult { applied: boolean; messages: AgentActivityMessage[]; session: AgentActivitySession | null; } interface AgentActivityCreateSessionInput { clientSubmitId: string; workspaceId: string; agentSessionId?: string | null; agentTargetId: string; cwd?: string | null; isolation?: AgentActivitySessionIsolation["mode"] | null; noProject?: boolean | null; capabilityRefs?: readonly AgentActivityCapabilityReference[] | null; initialGoalControl?: AgentActivityInitialGoalControl | null; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation | null; railPlacement?: AgentActivityRailPlacement; initialContent?: AgentPromptContentBlock[] | null; /** 仅展示用的首轮文本(bundle 折叠成一个 chip);initialContent 仍带展开后的文件。 */ initialDisplayPrompt?: string | null; submitDiagnostics?: AgentActivitySubmitDiagnostics; browserUse?: boolean | null; codexSaverMode?: boolean | null; rtkSaverMode?: boolean | null; model?: string | null; modelExplicit?: boolean; planMode?: boolean | null; permissionModeId?: string | null; reasoningEffort?: string | null; reasoningEffortExplicit?: boolean; speed?: string | null; title?: string | null; visible?: boolean | null; signal?: AbortSignal; } interface AgentActivitySendInput { clientSubmitId: string; workspaceId: string; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[] | null; content: AgentPromptContentBlock[]; /** 仅展示用文本(bundle 折叠成一个 chip);content 仍带展开后的文件。 */ displayPrompt?: string | null; guidance?: boolean; /** Exact canonical active Turn targeted by guidance. */ targetTurnId?: string | null; submitDiagnostics?: AgentActivitySubmitDiagnostics; signal?: AbortSignal; } interface AgentActivitySubmitSettingsPatch { browserUse?: boolean; computerUse?: boolean; } interface AgentActivitySubmitDiagnostics { submittedAtUnixMs?: number; blockCount?: number; hasImage?: boolean; promptLength?: number; queued?: boolean; source?: string; uiMode?: "os" | "agent"; } type AgentActivitySendInputResult = { /** Optional for compatibility with adapters predating the discriminator. */ kind?: "turn"; session: AgentActivitySession; turnId: string; turn: AgentActivityTurn; } | { kind: "goalControl"; session: AgentActivitySession; goal?: AgentActivitySessionGoal | null; }; interface AgentPromptContentBlock { type: "text" | "image" | "file" | "skill" | "mention" | "connector"; text?: string; mimeType?: "image/png" | "image/jpeg" | "image/webp" | string; data?: string; url?: string; attachmentId?: string; name?: string; path?: string; connectorKey?: string; uri?: string; hostPath?: string; uploadStatus?: string; assetId?: string; kind?: string; sizeBytes?: number; } interface AgentActivityGoalControlResult { session: AgentActivitySession; goal?: AgentActivitySessionGoal | null; operationId?: string | null; state?: AgentActivitySessionGoalState | null; } interface AgentActivitySubmitInteractiveInput { workspaceId: string; agentSessionId: string; requestId: string; turnId: string; action?: string | null; optionId?: string | null; payload?: Record | null; signal?: AbortSignal; } interface AgentActivitySubmitInteractiveResult { session: AgentActivitySession; } interface AgentActivityDeleteSessionInput { workspaceId: string; agentSessionId: string; signal?: AbortSignal; } interface AgentActivityDeleteSessionResult { cleanupFailed: boolean; removed: boolean; } interface AgentActivityDeleteSessionsInput { workspaceId: string; agentSessionIds: readonly string[]; signal?: AbortSignal; } interface AgentActivityDeleteSessionsResult { cleanupFailedSessionIds: string[]; removedMessages: number; removedSessionIds: string[]; removedSessions: number; } interface AgentActivitySetSessionPinnedInput { workspaceId: string; agentSessionId: string; pinned: boolean; signal?: AbortSignal; } type AgentActivityNeedsAttentionKind = "permission" | "question" | "constraint" | "other"; interface AgentActivityNeedsAttentionItem { id: string; workspaceId: string; agentSessionId: string; provider: string; title: string; cwd: string; kind: AgentActivityNeedsAttentionKind; summary: string; occurredAtUnixMs: number; } type AgentActivityTurnPhase = "submitted" | "running" | "waiting" | "settling" | "settled"; type AgentActivityTurnOutcome = "completed" | "failed" | "canceled" | "interrupted"; type AgentActivityProviderForkBindingState = "bound" | "recovery_required" | "unavailable"; /** * Durable provenance assigned when the Turn is created. Historical Turns must * remain `legacy_unknown`; clients must never infer an origin from later state. */ type AgentActivityTurnOrigin = "user_prompt" | "goal_arm" | "goal_continuation" | "provider_initiated" | "legacy_unknown"; interface AgentActivityCompletedCommand { kind: "compact" | "review" | "undo" | "goal"; status: "completed" | "failed" | "canceled"; } interface AgentActivityTurn { agentSessionId: string; /** Whether the exact provider Turn binding is already durably persisted. */ providerForkBindingAvailable?: boolean; /** Distinguishes a bound Turn from one that may enter on-demand recovery. */ providerForkBindingState?: AgentActivityProviderForkBindingState; /** Audit-only capability provenance for the turn; never current mode state. */ capabilityRefs?: readonly AgentActivityCapabilityReference[]; completedCommand?: AgentActivityCompletedCommand | null; error?: { code?: string; message: string; detail?: string; } | null; fileChanges?: Record | null; outcome?: AgentActivityTurnOutcome | null; origin: AgentActivityTurnOrigin; phase: AgentActivityTurnPhase; sourceGoalOperationId?: string | null; sourceGoalRevision?: number | null; sourceGoalRepairEpoch?: number | null; settledAtUnixMs?: number | null; startedAtUnixMs: number; turnId: string; updatedAtUnixMs: number; } interface AgentActivityInteraction { agentSessionId: string; createdAtUnixMs: number; input?: Record | null; kind: "approval" | "question" | "plan"; metadata?: Record | null; output?: Record | null; requestId: string; status: "pending" | "answered" | "superseded"; toolName?: string | null; turnId: string; updatedAtUnixMs: number; } type AgentActivitySessionSettings = { codexSaverMode?: boolean | null; rtkSaverMode?: boolean | null; model?: string | null; permissionModeId?: string | null; planMode?: boolean | null; browserUse?: boolean | null; computerUse?: boolean | null; reasoningEffort?: string | null; speed?: string | null; }; type AgentActivityPermissionModeSemantic = "ask-before-write" | "accept-edits" | "locked-down" | "auto" | "full-access" | "unconfigurable"; interface AgentActivitySessionPermissionModeOption { id: string; label: string; description?: string; semantic: AgentActivityPermissionModeSemantic; } interface AgentActivitySessionPermissionConfig { configurable: boolean; defaultValue?: string; modes: AgentActivitySessionPermissionModeOption[]; } interface AgentActivitySessionGoal { objective: string; status: "active" | "paused" | "blocked" | "usageLimited" | "budgetLimited" | "complete"; reason?: string; startedAtUnixMs?: number; iterations?: number; durationMs?: number; tokens?: number; } type AgentActivitySessionGoalSyncStatus = "pending" | "applying" | "synced" | "diverged" | "unknown" | "failed"; interface AgentActivitySessionGoalSyncState { revision: number; syncStatus: AgentActivitySessionGoalSyncStatus; pendingOperationId: string | null; /** Optional for mixed-version hosts; true is authoritative Host evidence. */ executionPending?: boolean; } interface AgentActivitySessionGoalState { desired?: AgentActivitySessionGoal | null; observed?: AgentActivitySessionGoal | null; revision: number; tombstoned: boolean; syncStatus: AgentActivitySessionGoalSyncStatus; pendingOperationId?: string | null; lastEvidence: Readonly>; lastError?: string; observedAtUnixMs?: number | null; updatedAtUnixMs: number; } interface AgentActivitySessionUsage { contextWindow: { usedTokens: number; totalTokens: number; } | null; quotas: { quotaType: string; percentRemaining: number; resetsAtUnixMs: number | null; }[]; } interface AgentActivityTurnCancelResponse { cancel: { canceled: boolean; reason: "cancel_requested" | "turn_canceled" | "already_settled" | "not_found"; }; turn?: AgentActivityTurn; } interface AgentActivityCancelTurnInput { agentSessionId: string; signal?: AbortSignal; turnId: string; workspaceId: string; } declare function providerForkBindingAllowsAttempt(turn: Pick): boolean; interface AgentActivityForkSessionThroughTurnInput { workspaceId: string; sourceAgentSessionId: string; targetAgentSessionId: string; requestId: string; turnId: string; signal?: AbortSignal; } type AgentActivityForkSessionOperationStatus = "accepted" | "committed" | "failed" | "unknown"; interface AgentActivityForkSessionResult { operationId: string; requestId: string; sourceAgentSessionId: string; targetAgentSessionId: string; turnId: string; status: AgentActivityForkSessionOperationStatus; session: AgentActivitySession | null; error: string | null; } interface AgentActivityAdapter { listSessions(input: { workspaceId: string; signal?: AbortSignal; }): Promise; listSessionMessages(input: { workspaceId: string; agentSessionId: string; afterVersion?: number; beforeVersion?: number; limit?: number; order?: AgentActivityMessageOrder; signal?: AbortSignal; }): Promise; loadComposerOptions(input: AgentActivityLoadComposerOptionsInput): Promise; createSession(input: AgentActivityCreateSessionInput): Promise; sendInput(input: AgentActivitySendInput): Promise; updateTuttiModeActivation(input: AgentActivityUpdateTuttiModeActivationInput): Promise; goalControl(input: AgentActivityGoalControlInput): Promise; submitInteractive(input: AgentActivitySubmitInteractiveInput): Promise; deleteSession(input: AgentActivityDeleteSessionInput): Promise; deleteSessions(input: AgentActivityDeleteSessionsInput): Promise; renameSession(input: AgentActivityRenameSessionInput): Promise; setSessionPinned(input: AgentActivitySetSessionPinnedInput): Promise; forkSession(input: AgentActivityForkSessionThroughTurnInput): Promise; } declare const AGENT_ACTIVITY_LIVE_PROTOCOL_REVISION: "sha256:8474280d7426e57b"; /** * Parses the provider-neutral text surface for a direct Goal command. * Structured-content callers must first prove that their submission contains * exactly one text block; presentation-only display text is not semantic input. */ declare function parseAgentActivityGoalControlText(text: string): AgentActivityInitialGoalControl | null; type AgentActivityLiveEvent = AgentActivityMessageDeltaEvent | AgentActivityTurnUpdatedEvent | AgentActivityInteractionUpdatedEvent | AgentActivitySessionAuditEvent; type AgentActivityDisplayStatus = "working" | "waiting" | "idle" | "completed" | "canceled" | "failed"; declare function normalizeAgentActivityCapabilityReferences(references: readonly AgentActivityCapabilityReference[] | null | undefined): readonly AgentActivityCapabilityReference[]; type RequiredSessionInputFields = "activeTurnId" | "agentSessionId" | "cwd" | "latestTurnInteractions" | "pendingInteractions" | "provider" | "title" | "workspaceId"; type AgentActivitySessionInput = Pick & Partial>; declare function normalizeAgentActivitySession(source: AgentActivitySessionInput & { provider: Provider; providerSessionId: string; }): AgentActivitySession & { provider: Provider; providerSessionId: string; }; declare function normalizeAgentActivitySession(source: AgentActivitySessionInput): AgentActivitySession; declare const AGENT_CAPABILITY_KEYS: readonly ["imageInput", "modelImageInputRequired", "modelSwitch", "modelPlanBinding", "skills", "compact", "tokenUsage", "rateLimits", "planMode", "interrupt", "activeTurnGuidance", "browserUse", "computerUse", "goalPause", "planImplementation", "permissionModeChangeDuringTurn", "permissionModeChangeDeferred", "review", "resumeRunningTurn"]; type AgentCapabilityKey = (typeof AGENT_CAPABILITY_KEYS)[number]; interface AgentActivityCapabilityInput { composerOptions?: AgentActivityComposerOptions | null; sessionCapabilities?: Partial> | null; } declare function resolveAgentActivityCapability(key: AgentCapabilityKey, input: AgentActivityCapabilityInput): boolean | null; declare function hasAgentCapability(capabilities: Partial> | null | undefined, key: AgentCapabilityKey): boolean; /** * Projects the canonical capability id list carried by session metadata into * the closed AgentActivity capability record consumed by AgentGUI. */ declare function agentActivitySessionCapabilitiesFromIds(capabilities: readonly string[]): AgentActivitySessionCapabilities; type ComposerOptionsSection = "core" | "capabilities" | "connectors"; /** * Per-target load bookkeeping. Replaces the former imperative cache * coordinator: `loadingSignature` deduplicates in-flight loads, `settledSignature` * decides whether a cached result still satisfies a request, and * `inFlightCommandId` guards against a superseded load settling late. */ interface ComposerOptionsEntry { status: AgentActivityComposerOptionsLoadStatus; provider: string; loadingSignature: string | null; settledSignature: string | null; loadVersion: number; inFlightCommandId: string | null; } interface ComposerOptionsState { optionsByTargetKey: Readonly>; entriesByTargetKey: Readonly>; sectionOptionsByTargetKey: Readonly>>>>; sectionEntriesByTargetKey: Readonly>>>>; } interface ComposerOptionsLoadRequestedIntent { type: "composerOptions/loadRequested"; commandId: string; agentSessionId?: string | null; targetKey: string; provider: string; workspaceId: string; cwd?: string | null; settings?: AgentActivityComposerSettings | null; force?: boolean; waitForFreshModelCatalog?: boolean; section?: ComposerOptionsSection; } interface ComposerOptionsInvalidatedIntent { type: "composerOptions/invalidated"; providers?: readonly string[]; sections?: readonly ComposerOptionsSection[]; targetKeys?: readonly string[]; } type ComposerOptionsIntent = ComposerOptionsLoadRequestedIntent | ComposerOptionsInvalidatedIntent; interface ComposerOptionsLoadCommand { type: "composerOptions/load"; commandId: string; agentSessionId?: string | null; correlationId: string; targetKey: string; provider: string; workspaceId: string; cwd?: string | null; settings?: AgentActivityComposerSettings | null; section?: ComposerOptionsSection; waitForFreshModelCatalog?: boolean; } type ComposerOptionsCommand = ComposerOptionsLoadCommand; interface EngineQueuedPrompt { capabilityRefs?: readonly AgentActivityCapabilityReference[]; clientSubmitId?: string; content: readonly AgentPromptContentBlock[]; createdAtUnixMs: number; displayPrompt?: string; guidance?: boolean; id: string; requiredSettingsPatch?: Readonly; submitDiagnostics?: Readonly; /** Exact canonical active Turn targeted by a native guidance send. */ targetTurnId?: string; runtimeContent?: readonly AgentPromptContentBlock[]; visibleInQueue?: boolean; } type PromptQueueSuspendReason = "user_stop"; interface PromptQueueInFlightCommand { commandId: string; /** Set when the command was dispatched as an active-turn steer. */ guidance?: true; kind: "send"; promptId: string; runtimeContent?: readonly AgentPromptContentBlock[]; stage?: "preparingSettings" | "sending"; } interface PromptQueuePendingSendNow { awaitingTurnExpiresAtUnixMs: number; cancelCommandId: string; promptId: string; targetTurnId: string; timeoutMs: number; } interface PromptQueueRecord { agentSessionId: string; deliveryBarrierTurnId: string | null; failedPromptId: string | null; failureMessage: string | null; inFlight: PromptQueueInFlightCommand | null; /** Omitted by snapshots produced before deferred send-now admission existed. */ pendingSendNowByPromptId?: Readonly>; prompts: readonly EngineQueuedPrompt[]; sendNextPromptId: string | null; suspendReason: PromptQueueSuspendReason | null; uncertainDelivery: PromptQueueInFlightCommand | null; workspaceId: string; } interface PromptQueueState { nextCommandSequence: number; recordsBySessionId: Readonly>; } interface PromptQueueEnqueuedIntent { type: "queue/enqueued"; agentSessionId: string; prompt: EngineQueuedPrompt; workspaceId: string; } interface PromptQueueRemovedIntent { type: "queue/removed"; agentSessionId: string; promptId: string; } interface PromptQueueSendNowRequestedIntent { type: "queue/sendNowRequested"; agentSessionId: string; cancelCommandId: string; promptId: string; /** Exact active Turn observed when this deferred intent was admitted. */ targetTurnId?: string; awaitingTurnExpiresAtUnixMs: number; timeoutMs: number; } interface PromptQueueSuspendedIntent { type: "queue/suspended"; agentSessionId: string; reason: PromptQueueSuspendReason; } interface PromptQueueResumedIntent { type: "queue/resumed"; agentSessionId: string; } interface PromptQueueSessionCleanedIntent { type: "queue/sessionCleaned"; agentSessionId: string; } type PromptQueueIntent = PromptQueueEnqueuedIntent | PromptQueueSendNowRequestedIntent | PromptQueueRemovedIntent | PromptQueueResumedIntent | PromptQueueSessionCleanedIntent | PromptQueueSuspendedIntent; interface PromptQueueSendCommand { type: "queue/sendPrompt"; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; commandId: string; clientSubmitId: string; correlationId?: string; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; guidance?: boolean; submitDiagnostics?: Readonly; /** Exact canonical active Turn targeted by a native guidance send. */ targetTurnId?: string; promptId: string; requiredSettingsPatch?: Readonly; timeoutMs?: number; workspaceId: string; } type PendingActivationStatus = "requested" | "confirmed" | "canceled" | "uncertain" | "failed"; type PendingActivationCommandOutcome = "pending" | "succeeded" | "failed" | "timed_out" | "invalid_result" | "canceled"; type PendingActivationSnapshotOutcome = "not_observed" | "session_missing" | "workspace_mismatch" | "stale_for_new" | "matched"; type PendingActivationLastObservedStage = "requested" | "command_settled" | "snapshot_observed" | "confirmed" | "stale_command_result" | "expired" | "canceled"; /** True while an activation may still yield, or already yielded, a session. */ declare function isPendingActivationViable(activation: { status: PendingActivationStatus; } | null | undefined): boolean; interface PendingActivationIntentRecordBase { agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; cwd: string; commandOutcome: PendingActivationCommandOutcome; commandSettledAtUnixMs: number | null; errorCode: string | null; errorMessage: string | null; expiresAtUnixMs: number; initialPromptRetracted: boolean; initialTurnExpected: boolean; lastObservedStage: PendingActivationLastObservedStage; initialGoalControl?: Readonly; isolation?: "worktree"; modelExplicit?: boolean; railSectionKey?: string; railPlacement?: AgentActivityRailPlacement; reasoningEffortExplicit?: boolean; submitDiagnostics?: Readonly; pendingSettingsPatch?: Readonly>; settingsUpdateStatus?: "failed" | "inFlight" | "unknown"; requestedAtUnixMs: number; requestId: string; settings?: AgentActivitySessionSettings; status: PendingActivationStatus; snapshotObservedAtUnixMs: number | null; snapshotOutcome: PendingActivationSnapshotOutcome; title: string | null; workspaceId: string; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation; tuttiModeDraftKey?: string; } type PendingActivationIntentRecord = (PendingActivationIntentRecordBase & { agentTargetId: string; clientSubmitId: string; mode: "new"; optimisticTitle?: string; }) | (PendingActivationIntentRecordBase & { agentTargetId: string | null; clientSubmitId: null; mode: "existing"; optimisticTitle?: never; }); type PendingSubmitStatus = "requested" | "accepted" | "confirmed" | "uncertain" | "failed"; type PendingSubmitSource = Readonly<{ kind: "plan-feedback"; requestId: string; turnId: string; }>; interface PendingSubmitIntentRecord { acceptedSessionVersion: number | null; agentSessionId: string; clientSubmitId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; errorCode: string | null; errorMessage: string | null; errorReason: string | null; expiresAtUnixMs: number; submitDiagnostics?: Readonly; requestedAtUnixMs: number; source?: PendingSubmitSource; status: PendingSubmitStatus; turnId: string | null; workspaceId: string; } interface PendingIntentsState { activationsByRequestId: Readonly>; inactiveSessionIds: Readonly>; submitsByClientSubmitId: Readonly>; } interface SessionActivationRequestedIntentBase { type: "activation/requested"; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; content?: readonly AgentPromptContentBlock[]; cwd?: string; expiresAtUnixMs: number; initialTurnExpected?: boolean; initialGoalControl?: Readonly; isolation?: "worktree"; modelExplicit?: boolean; railSectionKey?: string; railPlacement?: AgentActivityRailPlacement; reasoningEffortExplicit?: boolean; initialDisplayPrompt?: string; runtimeContent?: readonly AgentPromptContentBlock[]; submitDiagnostics?: Readonly; requestedAtUnixMs: number; requestId: string; settings?: AgentActivitySessionSettings; title?: string; visible?: boolean; workspaceId: string; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation; tuttiModeDraftKey?: string; } type SessionActivationRequestedIntent = (SessionActivationRequestedIntentBase & { agentTargetId: string; clientSubmitId: string; mode: "new"; optimisticTitle?: string; }) | (SessionActivationRequestedIntentBase & { agentTargetId?: string | null; clientSubmitId?: never; mode: "existing"; optimisticTitle?: never; }); interface SessionActivationDismissedIntent { type: "activation/dismissed"; requestId: string; } interface SessionActivationSettingsPatchedIntent { type: "activation/settingsPatched"; agentSessionId: string; settings: Readonly>; } interface SessionActivationFailureRecordedIntent { type: "activation/failureRecorded"; agentSessionId: string; errorCode?: string | null; errorMessage: string; occurredAtUnixMs: number; requestId: string; workspaceId: string; } interface SessionActivationFailureClearedIntent { type: "activation/failureCleared"; agentSessionId: string; } interface SessionUnactivationRequestedIntent { type: "activation/unactivateRequested"; agentSessionId: string; commandId: string; workspaceId: string; } interface SessionActivateCommandBase { type: "session/activate"; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; commandId: string; correlationId: string; cwd?: string; initialContent?: readonly AgentPromptContentBlock[]; initialDisplayPrompt?: string; initialGoalControl?: Readonly; isolation?: "worktree"; modelExplicit?: boolean; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation; railPlacement?: AgentActivityRailPlacement; reasoningEffortExplicit?: boolean; submitDiagnostics?: Readonly; settings?: AgentActivitySessionSettings; timeoutMs?: number; title?: string; visible?: boolean; workspaceId: string; } type SessionActivateCommand = (SessionActivateCommandBase & { agentTargetId: string; clientSubmitId: string; mode: "new"; }) | (SessionActivateCommandBase & { agentTargetId?: string | null; clientSubmitId?: never; mode: "existing"; }); interface SessionUnactivateCommand { type: "session/unactivate"; agentSessionId: string; commandId: string; workspaceId: string; } interface SessionUpdateSettingsCommand { type: "session/updateSettings"; agentSessionId: string; commandId: string; correlationId: string; settings: Readonly>; workspaceId: string; } interface SubmitRequestedIntent { type: "submit/requested"; agentSessionId: string; clientSubmitId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; expiresAtUnixMs: number; submitDiagnostics?: Readonly; requestedAtUnixMs: number; requiredSettingsPatch?: Readonly; routing?: "auto" | "immediate" | "send_now"; targetTurnId?: string; runtimeContent?: readonly AgentPromptContentBlock[]; workspaceId: string; } interface SubmitDismissedIntent { type: "submit/dismissed"; clientSubmitId: string; } interface SubmitCanceledIntent { type: "submit/canceled"; agentSessionId: string; clientSubmitId: string; } interface ActivityMessagesReceivedIntent { type: "message/snapshotReceived"; messages: readonly AgentActivityMessage[]; sessionMessageWindows?: readonly (AgentActivitySessionMessageWindow & { agentSessionId: string; })[]; workspaceId?: string; } type PendingIntentsIntent = ActivityMessagesReceivedIntent | SessionActivationDismissedIntent | SessionActivationSettingsPatchedIntent | SessionActivationFailureClearedIntent | SessionActivationFailureRecordedIntent | SessionActivationRequestedIntent | SessionUnactivationRequestedIntent | SubmitCanceledIntent | SubmitDismissedIntent | SubmitRequestedIntent; type AgentActivityEditRetryRecoveryState = "prepared" | "rolling_back" | "resend_pending" | "recovery_required" | "completed"; type AgentActivityEditRetryRecoveryAction = "reconcile" | "retry_replacement"; type AgentActivityEditRetryReasonCode = "provider_unsupported" | "turn_not_found" | "turn_not_latest" | "turn_not_settled" | "history_revision_conflict" | "operation_conflict" | "recovery_required" | "provider_outcome_unknown" | "replacement_not_proven_absent"; interface AgentActivityEditRetryAvailability { supported: boolean; eligible: boolean; turnId?: string; historyRevision: number; recoveryState: AgentActivityEditRetryRecoveryState; operationId?: string; availableActions: readonly AgentActivityEditRetryRecoveryAction[]; reasonCode?: AgentActivityEditRetryReasonCode; } interface AgentActivityEditRetryResult { operationId: string; state: AgentActivityEditRetryRecoveryState; retractedTurnId: string; replacementTurnId?: string; historyRevision: number; reasonCode?: AgentActivityEditRetryReasonCode; } interface AgentActivityEditRetryInput { agentSessionId: string; clientOperationId: string; editedText: string; expectedHistoryRevision: number; signal?: AbortSignal; turnId: string; workspaceId: string; } interface AgentActivityRecoverEditRetryInput { action: AgentActivityEditRetryRecoveryAction; agentSessionId: string; operationId: string; signal?: AbortSignal; workspaceId: string; } type EditRetryOperationStatus = "failed" | "idle" | "pending" | "reconciling" | "succeeded"; interface EditRetryOperationRecord { clientOperationId: string | null; commandId: string | null; errorCode: string | null; errorMessage: string | null; requestKey: string | null; result: AgentActivityEditRetryResult | null; status: EditRetryOperationStatus; workspaceId: string | null; } interface EditRetryState { availabilityBySessionId: Readonly>; nextCommandSequence: number; operationBySessionId: Readonly>; } interface EditRetryAvailabilityReceivedIntent { type: "editRetry/availabilityReceived"; agentSessionId: string; availability: AgentActivityEditRetryAvailability; workspaceId: string; } interface EditRetryRequestedIntent { type: "editRetry/requested"; agentSessionId: string; editedText: string; turnId: string; workspaceId: string; } interface EditRetryRecoveryRequestedIntent { type: "editRetry/recoveryRequested"; action: AgentActivityEditRetryRecoveryAction; agentSessionId: string; workspaceId: string; } type EditRetryIntent = EditRetryAvailabilityReceivedIntent | EditRetryRecoveryRequestedIntent | EditRetryRequestedIntent; interface TurnEditRetryCommand { type: "turn/editRetry"; agentSessionId: string; clientOperationId: string; commandId: string; editedText: string; expectedHistoryRevision: number; timeoutMs?: number; turnId: string; workspaceId: string; } interface TurnRecoverEditRetryCommand { type: "turn/recoverEditRetry"; action: AgentActivityEditRetryRecoveryAction; agentSessionId: string; commandId: string; operationId: string; timeoutMs?: number; workspaceId: string; } type EditRetryCommand = TurnEditRetryCommand | TurnRecoverEditRetryCommand; type SessionCancelStatus = "idle" | "awaitingTurn" | "requested" | "accepted" | "unknown" | "failed"; interface SessionCancelState { commandId: string | null; errorCode: string | null; errorMessage: string | null; expiryId: string | null; requestedSessionVersion: number | null; requestedWorkspaceId: string | null; targetClientSubmitId: string | null; turnId: string | null; status: SessionCancelStatus; } interface SessionOperationState { runtimeAvailability: SessionRuntimeAvailability; runtimeActivity: SessionRuntimeActivity; runtimeActivityOccurredAtUnixMs: number; cancel: SessionCancelState; operationError: string | null; settingsUpdate: SessionSettingsUpdateState; } type SessionRuntimeActivity = "idle" | "running"; /** * Host-projected, session-scoped availability for commands that must reach the * session runtime. This is intentionally separate from the canonical Session: * transport reachability, exact-target Agent capabilities, and shared access * are ephemeral and may differ between Sessions sharing one workspace engine. */ type SessionRuntimeAvailability = { state: "available"; } | { state: "blocked"; reason: "agent_capability_checking" | "agent_capability_unavailable" | "transport_reconnecting" | "transport_unavailable"; } | { state: "blocked"; reason: "agent_sharing_revoked"; ownerLabel: string; }; type SessionSettingsUpdateStatus = "idle" | "inFlight" | "waitingForPromptSend" | "waitingForRuntime" | "failed" | "unknown"; interface SessionSettingsUpdateState { commandId: string | null; errorCode: string | null; errorMessage: string | null; queuedCommandId: string | null; queuedRequests: readonly { commandId: string; kind: "activation" | "promptPrecondition" | "user"; settings: Readonly>; timeoutMs?: number; }[]; queuedSettings: Readonly> | null; requestKind: "activation" | "promptPrecondition" | "user" | null; settings: Readonly> | null; status: SessionSettingsUpdateStatus; timeoutMs: number | null; } type InteractionResponseStatus = "responding" | "failed" | "unknown"; interface InteractionResponseState { action: string | null; agentSessionId: string; commandId: string; errorCode: string | null; errorMessage: string | null; optionId: string | null; payload: Readonly> | null; requestId: string; retry?: boolean; status: InteractionResponseStatus; turnId: string; workspaceId: string; } type CanonicalAgentSession = Omit & { activeTurnId: string | null; }; interface SessionLifecycleState { deletedSessionIds: Readonly>; interactionsById: Readonly>; interactionResponsesById: Readonly>; operationBySessionId: Readonly>; sessionsById: Readonly>; turnsById: Readonly>; } interface SessionSnapshotReceivedIntent { type: "session/snapshotReceived"; sessions: readonly AgentActivitySessionInput[]; observedAtUnixMs?: number; /** Session ids filtered at the Engine identity boundary for wrong scope. */ workspaceMismatchSessionIds?: readonly string[]; } interface SessionUpsertedIntent { type: "session/upserted"; session: AgentActivitySessionInput; observedAtUnixMs?: number; } type CanonicalSessionMetadataPatch = Partial>; interface SessionMetadataPatchedIntent { type: "session/metadataPatched"; agentSessionId: string; patch: CanonicalSessionMetadataPatch; } interface TurnUpsertedIntent { type: "turn/upserted"; /** * Whether this upsert is a live observation capable of creating attention. * Historical detail hydration uses false while preserving the same * canonical lifecycle write. Omission remains compatible with older hosts * and is treated as a live observation. */ live?: boolean; /** * Internal replay of an already accepted live completion after reconcile * supplied Session identity. It may create attention even though canonical * state already contains the settled Turn. */ replayAcceptedLiveCompletion?: true; turn: AgentActivityTurn; } /** * One authoritative realtime Turn projection. The Turn and the Session's * active-turn reference are one wire fact and must enter the Engine atomically. */ interface TurnProjectionReceivedIntent { type: "turn/projectionReceived"; activeTurnId: string | null; /** * The host has already fenced transport identity and ordering, so settlement * of this immutable Turn may absorb a temporary projection from another * version domain even when its wall-clock timestamp is lower. */ hostFencedSameTurnSettlement?: true; turn: AgentActivityTurn; workspaceId: string; } interface SessionHistoryAuthoritativeSnapshotReceivedIntent { type: "session/historyAuthoritativeSnapshotReceived"; agentSessionId: string; childSessions: readonly AgentActivitySessionInput[]; editRetry?: AgentActivityEditRetryAvailability; historyRevision: number; messages: readonly AgentActivityDurableMessage[]; session: AgentActivitySessionInput; liveTurnId?: string; sessionMessageWindows?: readonly (AgentActivitySessionMessageWindow & { agentSessionId: string; })[]; turns: readonly AgentActivityTurn[]; workspaceId: string; } interface InteractionUpsertedIntent { type: "interaction/upserted"; interaction: AgentActivityInteraction; } interface InteractionResponseRequestedIntent { type: "interaction/responseRequested"; action?: string; agentSessionId: string; commandId: string; optionId?: string; payload?: Readonly>; requestId: string; turnId: string; retry?: boolean; timeoutMs?: number; workspaceId: string; } interface SessionRemovedIntent { type: "session/removed"; agentSessionId: string; } interface SessionRestoredIntent { type: "session/restored"; agentSessionId: string; } interface SessionErrorRecordedIntent { type: "session/errorRecorded"; agentSessionId: string; errorMessage: string; } interface SessionErrorClearedIntent { type: "session/errorCleared"; agentSessionId: string; } interface SessionCancelRequestedIntent { type: "session/cancelRequested"; agentSessionId: string; commandId: string; awaitingTurnExpiresAtUnixMs: number; clientSubmitId?: string; timeoutMs?: number; workspaceId: string; } interface SessionStopRequestedIntent { type: "session/stopRequested"; agentSessionId: string; commandId: string; awaitingTurnExpiresAtUnixMs: number; clientSubmitId?: string; timeoutMs?: number; workspaceId: string; } interface SessionCancelAbandonedIntent { type: "session/cancelAbandoned"; agentSessionId: string; } interface SessionSettingsUpdateRequestedIntent { type: "session/settingsUpdateRequested"; agentSessionId: string; commandId: string; settings: Readonly>; retry?: boolean; timeoutMs?: number; workspaceId: string; } interface SessionSettingsPreconditionRequestedIntent { type: "session/settingsPreconditionRequested"; agentSessionId: string; commandId: string; settings: Readonly>; timeoutMs?: number; workspaceId: string; } interface SessionSettingsActivationRequestedIntent { type: "session/settingsActivationRequested"; agentSessionId: string; commandId: string; settings: Readonly>; timeoutMs?: number; workspaceId: string; } interface SessionSettingsQueueResumeRequestedIntent { type: "session/settingsQueueResumeRequested"; agentSessionId: string; settingsCommandId: string; } interface SessionRuntimeAvailabilityChangedIntent { type: "session/runtimeAvailabilityChanged"; agentSessionId: string; availability: SessionRuntimeAvailability; } interface SessionRuntimeActivityChangedIntent { type: "session/runtimeActivityChanged"; agentSessionId: string; state: SessionRuntimeActivity; /** Zero clears the disconnected transport's transient observation and fence. */ occurredAtUnixMs: number; } type SessionLifecycleIntent = InteractionUpsertedIntent | InteractionResponseRequestedIntent | SessionCancelAbandonedIntent | SessionCancelRequestedIntent | SessionErrorClearedIntent | SessionErrorRecordedIntent | SessionHistoryAuthoritativeSnapshotReceivedIntent | SessionMetadataPatchedIntent | SessionRemovedIntent | SessionRestoredIntent | SessionRuntimeActivityChangedIntent | SessionRuntimeAvailabilityChangedIntent | SessionSettingsActivationRequestedIntent | SessionSettingsPreconditionRequestedIntent | SessionSettingsQueueResumeRequestedIntent | SessionSettingsUpdateRequestedIntent | SessionSnapshotReceivedIntent | SessionStopRequestedIntent | SessionUpsertedIntent | TurnProjectionReceivedIntent | TurnUpsertedIntent; interface TurnCancelCommand { type: "turn/cancel"; commandId: string; workspaceId: string; agentSessionId: string; turnId: string; timeoutMs?: number; } interface InteractionRespondCommand { type: "interaction/respond"; action?: string; agentSessionId: string; commandId: string; correlationId: string; optionId?: string; payload?: Readonly>; requestId: string; turnId: string; timeoutMs?: number; workspaceId: string; } type SessionReconcileScope = "messages" | "state" | "state_and_messages"; /** * Host-neutral projection-qualified detail aggregate consumed by reconcile * flows. Transport adapters preserve projection authority so Core can use an * unprojected discovery snapshot for cursors without applying its capability * values as canonical state. */ interface AgentActivitySessionDetailSnapshot { projection: "authoritative" | "message_hydration"; lifecycleCapabilitiesProjected: boolean; session: AgentActivitySession; childSessions: readonly AgentActivitySession[]; editRetry?: AgentActivityEditRetryAvailability; turns: readonly AgentActivityTurn[]; } interface SessionReconcileRecord { agentSessionId: string; appliedHistoryRevision: number | null; authoritativeMessagesRequired: boolean; errorCode: string | null; errorMessage: string | null; inFlightCommandId: string | null; inFlightLive: boolean; inFlightScope: SessionReconcileScope | null; messageRefreshScheduled: boolean; messagesHydrated: boolean; pendingLive: boolean; pendingMessages: boolean; pendingMessagesImmediate: boolean; pendingState: boolean; requiredHistoryRevision: number | null; workspaceId: string; } interface SessionReconcileState { nextCommandSequence: number; recordsBySessionId: Readonly>; } interface SessionReconcileRequestedIntent { type: "session/reconcileRequested"; agentSessionId: string; live?: boolean; authoritativeMessages?: boolean; needsMessages: boolean; needsState: boolean; requiredHistoryRevision?: number; workspaceId: string; } interface SessionHistoryRevisionObservedIntent { type: "session/historyRevisionObserved"; agentSessionId: string; historyRevision: number; workspaceId: string; } interface SessionActivityObservedIntent { type: "session/activityObserved"; agentSessionId: string; eventType: string; hasCachedSession: boolean; hasInlineMessages: boolean; inlineApplied: boolean; terminalTurn?: boolean; workspaceId: string; } interface SessionDetailSnapshotReceivedIntent { type: "session/detailSnapshotReceived"; childSessions: readonly AgentActivitySessionInput[]; editRetry?: AgentActivityEditRetryAvailability; live?: boolean; messages?: readonly AgentActivityDurableMessage[]; session: AgentActivitySessionInput; observedAtUnixMs?: number; sessionMessageWindows?: readonly (AgentActivitySessionMessageWindow & { agentSessionId: string; })[]; turns: readonly AgentActivityTurn[]; workspaceId: string; } type SessionReconcileIntent = SessionActivityObservedIntent | SessionDetailSnapshotReceivedIntent | SessionHistoryRevisionObservedIntent | SessionReconcileRequestedIntent; interface SessionReconcileCommand { type: "session/reconcile"; agentSessionId: string; authoritativeMessages?: boolean; commandId: string; live: boolean; requiredHistoryRevision?: number; scope: SessionReconcileScope; timeoutMs?: number; workspaceId: string; } type AttentionCompletionKind = "completed" | "failed"; type AttentionObservationProvenance = "historical" | "live"; type AttentionReadStateProvenance = "durable" | "historical" | "live"; interface AttentionReadRecord { completionKey: string; /** Compatibility projection: every stored attention record is unread. */ isUnread: boolean; kind: AttentionCompletionKind; markedUnreadByUser: boolean; /** Whether this completion has live/manual rather than historical provenance. */ observationProvenance: AttentionObservationProvenance; /** * Compatibility projection. Historical reads no longer create records, so * this field no longer participates in read/unread decisions. */ readStateProvenance?: AttentionReadStateProvenance; } interface AttentionReadPartition { lastError: string | null; recordsBySessionId: Readonly>; workspaceId: string | null; writeDirty: boolean; writeInFlightCommandId: string | null; writeRevision: number; hydrated: { completedReadIds: readonly string[]; completedUnreadIds: readonly string[]; failedReadIds: readonly string[]; failedUnreadIds: readonly string[]; } | null; } interface AttentionReadState { partitionsByUserId: Readonly>; } type AttentionReadIntent = { type: "attention/hydrateRequested"; commandId: string; userId: string; workspaceId: string; } | { type: "attention/read"; userId: string; agentSessionId: string; } | { type: "attention/unreadRequested"; userId: string; agentSessionId: string; } | { type: "attention/persistRetryRequested"; userId: string; } | { type: "attention/readStateHydrated"; userId: string; completed: { readIds: readonly string[]; unreadIds: readonly string[]; }; failed: { readIds: readonly string[]; unreadIds: readonly string[]; }; }; interface AttentionReadStateReadCommand { type: "attention/readState/read"; commandId: string; correlationId: string; userId: string; workspaceId: string; } interface AttentionReadStateWriteCommand { type: "attention/readState/write"; commandId: string; correlationId: string; userId: string; workspaceId: string; completed: { readIds: readonly string[]; unreadIds: readonly string[]; }; failed: { readIds: readonly string[]; unreadIds: readonly string[]; }; } type AttentionReadCommand = AttentionReadStateReadCommand | AttentionReadStateWriteCommand; type PlanDecisionStatus = "requested" | "failed" | "unknown"; type PlanDecisionPromptKind = "plan-implementation"; type PlanDecisionAction = "implement"; interface PlanDecisionRecord { action: PlanDecisionAction; agentSessionId: string; commandId: string; errorCode: string | null; errorMessage: string | null; idempotencyKey: string; operationId: string | null; payload: Readonly> | null; promptKind: PlanDecisionPromptKind; requestId: string; status: PlanDecisionStatus; turnId: string; workspaceId: string; } interface PlanDecisionState { byId: Readonly>; dismissedByTurnKey: Readonly>; } interface PlanDecisionRequestedIntent { type: "plan/decisionRequested"; action: PlanDecisionAction; agentSessionId: string; commandId: string; idempotencyKey: string; payload?: Readonly>; promptKind: PlanDecisionPromptKind; requestId: string; retry?: boolean; timeoutMs?: number; turnId: string; workspaceId: string; } interface PlanFeedbackRequestedIntent { type: "plan/feedbackRequested"; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; clientSubmitId: string; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; expiresAtUnixMs: number; requestedAtUnixMs: number; requestId: string; runtimeContent?: readonly AgentPromptContentBlock[]; turnId: string; workspaceId: string; } interface PlanSkippedIntent { type: "plan/skipped"; agentSessionId: string; requestId: string; turnId: string; workspaceId: string; } type PlanDecisionIntent = PlanDecisionRequestedIntent | PlanFeedbackRequestedIntent | PlanSkippedIntent; interface PlanSubmitDecisionCommand { type: "plan/submitDecision"; action: PlanDecisionAction; agentSessionId: string; commandId: string; correlationId: string; idempotencyKey: string; payload?: Readonly>; promptKind: PlanDecisionPromptKind; requestId: string; timeoutMs?: number; turnId: string; workspaceId: string; } interface PlanDecisionOperation { agentSessionId: string; error?: string | null; idempotencyKey: string; operationId: string; requestId: string; result?: string | null; status: "prepared" | "leased" | "completed" | "failed"; turnId: string; workspaceId: string; } interface PlanSubmitDecisionResult { operation: PlanDecisionOperation; } interface AgentSessionAvailableCommand { description?: string; inputHint?: string; name: string; } interface SessionCommandsState { bySessionId: Readonly>; } interface SessionAvailableCommandsReceivedIntent { type: "session/availableCommandsReceived"; agentSessionId: string; commands: readonly unknown[]; workspaceId: string; } type SessionCommandsIntent = SessionAvailableCommandsReceivedIntent; interface SessionMessagesState { messagesBySessionId: Readonly>; windowsBySessionId: Readonly>>; } type SessionMutationStatus = "inFlight" | "succeeded" | "failed" | "unknown"; interface SessionDeleteMutationResult { cleanupFailedSessionIds: readonly string[]; removedMessages: number; removedSessionIds: readonly string[]; removedSessions: number; } type SessionForkObservationAckStatus = "idle" | "pending" | "inFlight" | "acknowledged"; type SessionMutationRecord = { agentSessionIds: readonly string[]; commandId: string; deleteResult: SessionDeleteMutationResult | null; errorCode: string | null; errorMessage: string | null; kind: "delete"; mutationId: string; status: SessionMutationStatus; workspaceId: string; } | { agentSessionIds: readonly [string]; commandId: string; errorCode: string | null; errorMessage: string | null; kind: "pin"; mutationId: string; pinned: boolean; status: SessionMutationStatus; workspaceId: string; } | { agentSessionIds: readonly [string]; commandId: string; errorCode: string | null; errorMessage: string | null; kind: "rename"; mutationId: string; status: SessionMutationStatus; title: string; workspaceId: string; } | { agentSessionIds: readonly [string]; ackCommandId: string | null; ackErrorMessage: string | null; ackRetryAttempt: number; ackRetryExpiryId: string | null; ackStatus: SessionForkObservationAckStatus; commandId: string; errorCode: string | null; errorMessage: string | null; kind: "forkThroughTurn"; mutationId: string; operationId: string | null; requestId: string; status: SessionMutationStatus; targetAgentSessionId: string; turnId: string; workspaceId: string; }; type SessionForkThroughTurnMutationRecord = Extract; interface SessionMutationsState { byMutationId: Readonly>; } interface SessionPinRequestedIntent { type: "session/pinRequested"; agentSessionId: string; mutationId: string; pinned: boolean; timeoutMs?: number; workspaceId: string; } interface SessionRenameRequestedIntent { type: "session/renameRequested"; agentSessionId: string; mutationId: string; title: string; timeoutMs?: number; workspaceId: string; } interface SessionsDeleteRequestedIntent { type: "sessions/deleteRequested"; agentSessionIds: readonly string[]; mutationId: string; timeoutMs?: number; workspaceId: string; } interface SessionForkThroughTurnRequestedIntent { type: "session/forkThroughTurnRequested"; workspaceId: string; sourceAgentSessionId: string; targetAgentSessionId: string; requestId: string; turnId: string; timeoutMs?: number; } type SessionMutationsIntent = SessionForkThroughTurnRequestedIntent | SessionPinRequestedIntent | SessionRenameRequestedIntent | SessionsDeleteRequestedIntent; interface SessionSetPinnedCommand { type: "session/setPinned"; agentSessionId: string; commandId: string; correlationId: string; pinned: boolean; timeoutMs?: number; workspaceId: string; } interface SessionRenameCommand { type: "session/rename"; agentSessionId: string; commandId: string; correlationId: string; title: string; timeoutMs?: number; workspaceId: string; } interface SessionsDeleteCommand { type: "sessions/delete"; agentSessionIds: readonly string[]; commandId: string; correlationId: string; timeoutMs?: number; workspaceId: string; } interface SessionForkThroughTurnCommand { type: "session/forkThroughTurn"; commandId: string; correlationId: string; workspaceId: string; sourceAgentSessionId: string; targetAgentSessionId: string; requestId: string; turnId: string; timeoutMs?: number; } interface SessionAcknowledgeForkObservedCommand { type: "session/ackForkObserved"; commandId: string; correlationId: string; operationId: string; timeoutMs: number; workspaceId: string; } type SessionMutationCommand = SessionAcknowledgeForkObservedCommand | SessionForkThroughTurnCommand | SessionRenameCommand | SessionSetPinnedCommand | SessionsDeleteCommand; interface TuttiModeDraftIntentRecord { active: true; draftKey: string; occurredAtUnixMs: number; /** null = 未选择,交给 daemon 默认值。 */ effect?: number | null; speed?: number | null; /** @deprecated Use effect and speed. */ orchestrationIntensity: number | null; source: "slash_command"; } interface TuttiModePendingCreateRecord { agentSessionId: string; draftKey: string; initialActivation: AgentActivityInitialTuttiModeActivation; reconcileCommandId: string | null; requestId: string; workspaceId: string; } type TuttiModeActivationUpdateStatus = "inFlight" | "failed" | "uncertain"; interface TuttiModeActivationUpdateRecord { agentSessionId: string; commandId: string; errorCode: string | null; errorMessage: string | null; expectedRevision: number | null; effect?: number | null; speed?: number | null; /** @deprecated Use effect and speed. */ orchestrationIntensity: number | null; reconcileCommandId: string | null; requestedAtUnixMs: number; source: AgentActivityTuttiModeActivationSource; status: AgentActivityTuttiModeActivationStatus; updateStatus: TuttiModeActivationUpdateStatus; workspaceId: string; } interface TuttiModeActivationState { activationsBySessionId: Readonly>; draftsByKey: Readonly>; pendingCreatesBySessionId: Readonly>; updatesBySessionId: Readonly>; } interface TuttiModeDraftSetIntent { type: "tuttiMode/draftSet"; active: boolean; draftKey: string; occurredAtUnixMs: number; effect?: number | null; speed?: number | null; /** @deprecated Use effect and speed. */ orchestrationIntensity?: number | null; } interface TuttiModeActivationUpdateRequestedIntent { type: "tuttiMode/updateRequested"; agentSessionId: string; commandId: string; effect?: number | null; speed?: number | null; /** @deprecated Use effect and speed. */ orchestrationIntensity?: number | null; requestedAtUnixMs: number; source: AgentActivityTuttiModeActivationSource; status: AgentActivityTuttiModeActivationStatus; workspaceId: string; } type TuttiModeActivationIntent = TuttiModeDraftSetIntent | TuttiModeActivationUpdateRequestedIntent; interface TuttiModeActivationUpdateCommand { type: "tuttiMode/update"; agentSessionId: string; commandId: string; expectedRevision?: number; effect?: number; speed?: number; /** @deprecated Use effect and speed. */ orchestrationIntensity?: number; source: AgentActivityTuttiModeActivationSource; status: AgentActivityTuttiModeActivationStatus; timeoutMs?: number; workspaceId: string; } type TuttiModeActivationCommand = TuttiModeActivationUpdateCommand; type SessionGoalControlStatus = "pending" | "accepted" | "succeeded" | "failed" | "unknown"; interface SessionGoalControlOperation { action: AgentActivityGoalControlAction; agentSessionId: string; clientSubmitId: string; commandId: string; errorCode: string | null; errorMessage: string | null; errorReason: string | null; objective?: string; operationId: string | null; optimisticGoal: AgentActivitySessionGoal | null; requestedAtUnixMs: number; resultState: AgentActivitySessionGoalState | null; status: SessionGoalControlStatus; workspaceId: string; } type SessionGoalControlPresentationStatus = SessionGoalControlStatus | "idle" | "pending_create"; interface SessionGoalControlPresentation { agentSessionId: string | null; goal: AgentActivitySessionGoal | null; optimistic: boolean; status: SessionGoalControlPresentationStatus; } interface SessionGoalControlSettlement { action: SessionGoalControlOperation["action"]; agentSessionId: string; clientSubmitId: string; errorCode: string | null; errorMessage: string | null; errorReason: string | null; status: Exclude; } /** * Host-observable Goal state. The reducer's operation ledger deliberately * stays behind the Engine module seam. Both maps are sparse: callers use the * selectors for the default idle presentation when a Session has no Goal, * Goal operation, or Goal-bearing activation. */ interface SessionGoalControlPublicState { presentationsBySessionId: Readonly>; settlementsBySessionId: Readonly>; } interface SessionGoalControlRequestedIntent { action: AgentActivityGoalControlAction; agentSessionId: string; clientSubmitId: string; commandId: string; objective?: string; requestedAtUnixMs: number; timeoutMs: number; type: "goal/controlRequested"; workspaceId: string; } type SessionGoalControlIntent = SessionGoalControlRequestedIntent; interface SessionGoalControlCommand extends EngineExternalCommandBase { action: AgentActivityGoalControlAction; agentSessionId: string; clientSubmitId: string; correlationId: string; objective?: string; type: "goal/control"; workspaceId: string; } interface AgentSessionGoalControlEffectInput { action: AgentActivityGoalControlAction; agentSessionId: string; clientSubmitId: string; objective?: string; workspaceId: string; } interface AgentSessionControlGoalInput { action: AgentActivityGoalControlAction; agentSessionId: string; clientSubmitId: string; objective?: string; } /** * Admission reports the identity the Engine actually used. An exact retry of * an outcome-unknown mutation keeps its original Host idempotency identity. */ interface AgentSessionControlGoalAdmission { accepted: boolean; clientSubmitId: string; } /** * Engine instances are identified by the workspace plus origin pair. Origin * distinguishes runtimes feeding the same workspace (for example a local * tuttid runtime versus an external shared-room runtime), and is a first-class * identity rather than a patch field. Hosts create one engine per pair and * inject it explicitly; module-level singletons are forbidden. */ interface AgentSessionEngineIdentity { origin: string; workspaceId: string; } declare const AGENT_SESSION_ENGINE_LOCAL_ORIGIN = "WORKSPACE_AGENT_SESSION_ORIGIN_RUNTIME"; type EngineConnectionStatus = "connected" | "disconnected" | "unknown"; interface EngineConnectionChangedIntent { type: "engine/connectionChanged"; status: EngineConnectionStatus; workspaceId?: string; } interface WorkspaceReconcileRequestedIntent { type: "workspace/reconcileRequested"; workspaceId: string; retry?: boolean; } /** Requests a command-port round trip; exercises the executor feedback loop. */ interface EngineProbeRequestedIntent { type: "engine/probeRequested"; probeId: string; timeoutMs?: number; } /** Asks the host clock to deliver an expiry intent at the given deadline. */ interface EngineExpiryRequestedIntent { type: "engine/expiryRequested"; expiryId: string; dueAtUnixMs: number; } interface EngineExpiryCancelRequestedIntent { type: "engine/expiryCancelRequested"; expiryId: string; } type EngineCommandOutcome = "failed" | "succeeded" | "timedOut"; /** * Describes the runtime result contract used by one command execution. * Manually dispatched results may omit this field and retain opaque * acknowledgement semantics. */ type EngineCommandResultContract = "activation-v1" | "goal-control-v1" | "opaque"; /** * Every command execution settles back into the loop as this intent, so * failure and timeout handling are explicit reducer transitions instead of * executor-side improvisation. */ interface EngineCommandResultIntent { type: "engine/commandResult"; commandId: string; commandType: EngineExternalCommand["type"]; correlationId?: string; outcome: EngineCommandOutcome; settledAtUnixMs?: number; resultContract?: EngineCommandResultContract; value?: unknown; errorCode?: string; errorReason?: string; errorMessage?: string; } /** * Delivered by the expiry clock when a scheduled deadline elapses. Reducers * never read the wall clock or set timers; tests dispatch this directly. */ interface EngineIntentExpiredIntent { type: "engine/intentExpired"; expiryId: string; dueAtUnixMs: number; } /** * Host-dispatchable and host-observable Engine input. Reducer-only * continuations belong to the private root-reducer contract. */ type EngineIntent = AttentionReadIntent | EngineCommandResultIntent | EngineConnectionChangedIntent | EngineExpiryCancelRequestedIntent | EngineExpiryRequestedIntent | EngineIntentExpiredIntent | EngineProbeRequestedIntent | WorkspaceReconcileRequestedIntent | PendingIntentsIntent | PlanDecisionIntent | PromptQueueIntent | SessionReconcileIntent | SessionMutationsIntent | SessionCommandsIntent | SessionLifecycleIntent | SessionGoalControlIntent | ComposerOptionsIntent | EditRetryIntent | TuttiModeActivationIntent; interface EngineScheduleExpiryCommand { type: "engine/scheduleExpiry"; expiryId: string; dueAtUnixMs: number; } /** * Schedules an expiry relative to command application time. This keeps * reducer-owned retry backoff pure: reducers describe a delay while the * Engine clock resolves the absolute deadline. */ interface EngineScheduleExpiryAfterCommand { type: "engine/scheduleExpiryAfter"; expiryId: string; delayMs: number; } interface EngineCancelExpiryCommand { type: "engine/cancelExpiry"; expiryId: string; } /** Cancels one in-flight external command without coupling reducers to I/O. */ interface EngineAbortExternalCommand { type: "engine/abortExternalCommand"; reason: string; targetCommandId: string; } interface EngineExternalCommandBase { commandId: string; timeoutMs?: number; } /** Round-trip health probe; domain slices add real runtime commands here. */ interface EngineProbeCommand extends EngineExternalCommandBase { type: "engine/probe"; } interface EngineReconcileWorkspaceCommand extends EngineExternalCommandBase { type: "engine/reconcileWorkspace"; workspaceId: string; } type EngineExpiryCommand = EngineCancelExpiryCommand | EngineScheduleExpiryAfterCommand | EngineScheduleExpiryCommand; type EngineInternalCommand = EngineAbortExternalCommand | EngineExpiryCommand; type EngineExternalCommand = AttentionReadCommand | EngineProbeCommand | EngineReconcileWorkspaceCommand | InteractionRespondCommand | PlanSubmitDecisionCommand | PromptQueueSendCommand | SessionActivateCommand | SessionUpdateSettingsCommand | SessionUnactivateCommand | SessionReconcileCommand | SessionMutationCommand | SessionGoalControlCommand | TurnCancelCommand | ComposerOptionsCommand | EditRetryCommand | TuttiModeActivationCommand; type AgentSessionEffectCommand = Extract | InteractionRespondCommand | PromptQueueSendCommand | SessionActivateCommand | SessionGoalControlCommand | SessionUpdateSettingsCommand | TurnCancelCommand; type EngineExtensionCommand = Exclude; type EngineCommand = EngineExternalCommand | EngineInternalCommand; interface EngineRuntimeCommandResultRecord { commandId: string; errorMessage?: string; outcome: EngineCommandOutcome; } /** Engine self state: the minimal skeleton domain driving interleaving tests. */ interface EngineRuntimeState { connection: EngineConnectionStatus; lastCommandResult: EngineRuntimeCommandResultRecord | null; lastExpiredIntentId: string | null; processedIntentCount: number; workspaceReconcile: { commandId: string | null; errorCode: string | null; errorMessage: string | null; status: "idle" | "loading" | "ready" | "failed" | "unknown"; }; } /** * State shared by public snapshots and the private reducer root. Selectors * that do not read Goal Control use this shape so the private Goal ledger does * not have to masquerade as public state. */ interface AgentSessionEngineStateBase { attentionReadState: AttentionReadState; editRetry: EditRetryState; engineRuntime: EngineRuntimeState; pendingIntents: PendingIntentsState; planDecisions: PlanDecisionState; promptQueue: PromptQueueState; sessionReconcile: SessionReconcileState; sessionMutations: SessionMutationsState; sessionCommands: SessionCommandsState; sessionLifecycle: SessionLifecycleState; sessionMessages: SessionMessagesState; composerOptions: ComposerOptionsState; tuttiModeActivation: TuttiModeActivationState; } /** * Host-observable Engine snapshot. Reducer execution ledgers are deliberately * omitted from this public state contract. */ interface AgentSessionEngineState extends AgentSessionEngineStateBase { goalControl: SessionGoalControlPublicState; } interface EngineReducerResult { commands: readonly EngineCommand[]; followUpIntents?: readonly EngineIntent[]; state: TState; } /** * Domain reducers are pure: no timers, no clocks, no I/O. Timing enters as * expiry intents; side effects leave as command descriptions. */ type EngineDomainReducer = (state: TState, intent: EngineIntent) => EngineReducerResult; interface EngineScheduledTask { cancel(): void; } interface EngineScheduler { schedule(delayMs: number, task: () => void): EngineScheduledTask; } interface EngineClock { nowUnixMs(): number; } interface EngineEffectOptions { commandId: string; origin: "engine"; signal?: AbortSignal; } interface AgentSessionActivateEffectInputBase { activationId: string; agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; cwd?: string; initialContent?: AgentPromptContentBlock[]; initialDisplayPrompt?: string; isolation?: "worktree"; modelExplicit?: boolean; railPlacement?: AgentActivityRailPlacement; reasoningEffortExplicit?: boolean; settings?: AgentActivitySessionSettings; submitDiagnostics?: Readonly; title?: string; visible?: boolean; workspaceId: string; } /** * Host-neutral activation request. Engine commands stay private orchestration * details; hosts implement lifecycle capabilities in domain terms. */ type AgentSessionActivateEffectInput = (AgentSessionActivateEffectInputBase & { agentTargetId: string; clientSubmitId: string; initialGoalControl?: Readonly; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation; mode: "new"; }) | (AgentSessionActivateEffectInputBase & { agentTargetId?: string | null; clientSubmitId?: never; mode: "existing"; }); /** * Authoritative activation payload returned by preferred typed hosts. * Existing-session activation carries the complete detail aggregate so the * Engine, rather than the host effect, applies Session/Turn state. */ type AgentSessionActivateEffectResult = { activation: { mode: "new"; status: "attached"; }; session: AgentActivitySession; } | { activation: { mode: "existing"; status: "already_attached"; }; detail: AgentActivitySessionDetailSnapshot; session: AgentActivitySession; }; interface AgentSessionEffectPort { activateSession(input: AgentSessionActivateEffectInput, options: EngineEffectOptions): Promise; cancelTurn(input: AgentActivityCancelTurnInput, options: EngineEffectOptions): Promise; controlGoal?(input: AgentSessionGoalControlEffectInput, options?: EngineEffectOptions): Promise; deleteSessions(input: Omit, options?: EngineEffectOptions): Promise; respondToInteraction(input: AgentActivitySubmitInteractiveInput, options: EngineEffectOptions): Promise; renameSession(input: Omit, options?: EngineEffectOptions): Promise<{ session: AgentActivitySession; }>; sendInput(input: AgentActivitySendInput, options: EngineEffectOptions): Promise; setSessionPinned(input: Omit, options?: EngineEffectOptions): Promise<{ session: AgentActivitySession; }>; updateSessionSettings(input: { agentSessionId: string; commandId: string; correlationId: string; settings: AgentActivitySessionSettings; workspaceId: string; }, options: EngineEffectOptions): Promise; } /** The Engine owns lifecycle projection; hosts execute product extensions. */ interface EngineTypedCommandPort { effects: AgentSessionEffectPort; execute(command: EngineExtensionCommand, options?: EngineEffectOptions): Promise; observe?(command: EngineExternalCommand): void; executePlanDecision?(command: PlanSubmitDecisionCommand, options?: EngineEffectOptions): Promise; kind: "typed"; } interface EngineDispatchOptions { /** * Coalesce this intent with other batched intents inside the frame window * (high-frequency streaming events). Non-batched dispatches flush pending * batched intents first so cross-intent ordering is preserved. */ batch?: boolean; } type AgentSessionEngineListener = (state: AgentSessionEngineState) => void; type AgentSessionEngineIntentObserver = (intent: EngineIntent) => void; interface AgentSessionLoadComposerOptionsInput { agentSessionId?: string | null; cwd?: string | null; force?: boolean; waitForFreshModelCatalog?: boolean; provider: string; section?: ComposerOptionsSection; settings?: AgentActivityComposerSettings | null; signal?: AbortSignal; targetKey: string; } interface AgentSessionUpdateSettingsInput { agentSessionId: string; settings: AgentActivitySessionSettings; } interface AgentSessionSubmitInteractionResponseInput { action?: string; agentSessionId: string; optionId?: string; payload?: Readonly>; requestId: string; turnId: string; } interface AgentSessionActivationInputBase { agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; cwd?: string; initialContent?: readonly AgentPromptContentBlock[]; initialDisplayPrompt?: string; isolation?: "worktree"; modelExplicit?: boolean; initialTurnExpected?: boolean; railPlacement?: AgentActivityRailPlacement; reasoningEffortExplicit?: boolean; railSectionKey?: string; requestId: string; runtimeContent?: readonly AgentPromptContentBlock[]; settings?: AgentActivitySessionSettings; submitDiagnostics?: Readonly; title?: string; visible?: boolean; } type AgentSessionActivationInput = (AgentSessionActivationInputBase & { agentTargetId: string; clientSubmitId: string; initialGoalControl?: Readonly; initialTuttiModeActivation?: AgentActivityInitialTuttiModeActivation; mode: "new"; optimisticTitle?: string; tuttiModeDraftKey?: string; }) | (AgentSessionActivationInputBase & { agentTargetId?: string | null; clientSubmitId?: never; initialGoalControl?: never; initialTuttiModeActivation?: never; mode: "existing"; optimisticTitle?: never; tuttiModeDraftKey?: never; }); interface AgentSessionSubmitPromptInput { agentSessionId: string; capabilityRefs?: readonly AgentActivityCapabilityReference[]; clientSubmitId: string; content: readonly AgentPromptContentBlock[]; displayPrompt?: string; requiredSettingsPatch?: Readonly; routing?: "auto" | "immediate" | "send_now"; /** Exact canonical active Turn targeted when routing as guidance. */ targetTurnId?: string; runtimeContent?: readonly AgentPromptContentBlock[]; submitDiagnostics?: Readonly; } interface AgentSessionSubmitPromptResult { accepted: boolean; queued: boolean; } interface AgentSessionStopInput { agentSessionId: string; /** Identity of the pending submit to stop while its Turn is being admitted. */ clientSubmitId?: string; } interface AgentSessionEngine { readonly identity: AgentSessionEngineIdentity; activateSession(input: AgentSessionActivationInput): boolean; controlGoal(input: AgentSessionControlGoalInput): AgentSessionControlGoalAdmission; deleteSessions(input: Omit & { signal?: AbortSignal; }): Promise; dispatch(intent: EngineIntent, options?: EngineDispatchOptions): void; dispose(): void; getSnapshot(): AgentSessionEngineState; loadComposerOptions(input: AgentSessionLoadComposerOptionsInput): Promise; renameSession(input: Omit & { signal?: AbortSignal; }): Promise; setSessionPinned(input: Omit & { signal?: AbortSignal; }): Promise; submitInteractionResponse(input: AgentSessionSubmitInteractionResponseInput): boolean; submitPrompt(input: AgentSessionSubmitPromptInput): AgentSessionSubmitPromptResult; stopSession(input: AgentSessionStopInput): void; subscribe(listener: AgentSessionEngineListener): () => void; updateSessionSettings(input: AgentSessionUpdateSettingsInput): void; } /** * Builds the legacy runtime snapshot shape as a memoized projection of the * canonical workspace engine. The projector must be retained per engine so * external-store consumers receive the same object while engine state is * unchanged. */ declare function createAgentActivitySnapshotProjector(workspaceId: string): (state: AgentSessionEngineStateBase) => AgentActivitySnapshot; declare function createEmptyAgentActivitySnapshot(workspaceId: string): AgentActivitySnapshot; declare function mergeAgentActivityMessages(currentMessages: readonly T[], incomingMessages: readonly T[]): T[]; declare function compareAgentActivityMessages(left: AgentActivityMessage, right: AgentActivityMessage): number; declare function latestAgentActivityMessageVersion(messages: readonly AgentActivityMessage[]): number; declare function cloneAgentActivityMessage(message: T): T; /** * Parse the inline `messages` array carried by a realtime `message_update` * event into canonical {@link AgentActivityMessage} values. This is the only * inline delta the bridge may apply without a follow-up pull: message snapshots * are versioned and self-describing, so after the bridge verifies cursor * continuity, the engine's version-guarded message reducer can fold them * (including alias-bucket collapse) on its own. Turn and interaction deltas take * the authoritative reconcile path instead, so their session-level effects * (activeTurnId, pending-interaction pruning) come from a full session fetch * rather than being reconstructed here. */ declare function parseInlineActivityMessages(event: AgentActivityUpdatedEvent): AgentActivityMessage[]; interface AgentActivityMessagePageLike { messages: readonly T[]; hasMore?: boolean; latestVersion?: number; } interface LoadAllAgentSessionMessagesInput { listPage: (afterVersion: number) => Promise>; afterVersion?: number; maxPages?: number; shouldAbort?: () => boolean; onPage?: (messages: readonly T[]) => void; } interface LoadAllAgentSessionMessagesResult { messages: T[]; aborted: boolean; } /** * Projects the server-owned boundary of a newest-to-oldest page. The boundary * must come from `hasMore`; message versions are mutable change cursors and * cannot answer whether an older row exists. */ declare function agentActivitySessionMessageWindowFromDescendingPage(page: AgentActivityMessagePageLike): AgentActivitySessionMessageWindow; declare function loadAllAgentSessionMessages(input: LoadAllAgentSessionMessagesInput): Promise>; declare function selectCanonicalAgentActivitySessions(snapshot: Pick): readonly AgentActivitySession[]; declare function selectRootAgentActivitySessions(snapshot: Pick): readonly AgentActivitySession[]; declare function selectNeedsAttentionCount(snapshot: AgentActivitySnapshot): number; declare function normalizeAgentActivityDisplayStatus(status: string | null | undefined, options?: { activeTurnPhase?: string | null; latestTurnOutcome?: string | null; latestTurnPhase?: string | null; needsAttention?: boolean; }): AgentActivityDisplayStatus; declare function selectNeedsAttentionItems(snapshot: AgentActivitySnapshot): AgentActivityNeedsAttentionItem[]; interface AgentActivityUsage { usedTokens: number | null; totalTokens: number | null; percentUsed: number | null; quotas: AgentActivityQuota[]; } interface AgentActivityQuota { quotaType: "session" | "weekly" | "monthly" | "daily" | "model" | "cost"; percentRemaining?: number; resetsAtUnixMs?: number; resetText?: string; dollarRemaining?: number; modelName?: string; } interface AgentActivityUsageInput { sessionUsage?: AgentActivitySessionUsage | null; } declare function resolveAgentActivityUsage(input: AgentActivityUsageInput): AgentActivityUsage | null; interface AgentActivityWorkspaceReconcileKey { agentSessionId?: string; workspaceId: string; } interface AgentActivityWorkspaceEventResult { accepted: boolean; eventType: AgentActivityUpdatedEvent["eventType"]; inlineApplied: boolean; inlineGap: { cachedVersion: number; firstUnseenVersion: number | null; latestIncomingVersion: number; } | null; inlineMessages: readonly AgentActivityMessage[]; optimisticMessage: AgentActivityMessage | null; reason: "applied" | "deleted" | "restored" | "identity_mismatch" | "invalid_delta" | "invalid_turn" | "tombstoned"; } type AgentActivityWorkspaceEventInput = Exclude | { agentSessionId: string; data: unknown; eventType: "message_delta"; workspaceId: string; }; interface AgentActivityWorkspaceEventCoordinator { eventStreamConnectionChanged(input: { prioritySessionIds?: readonly string[]; status: EngineConnectionStatus; }): void; dispose(): void; ingestEvent(event: AgentActivityWorkspaceEventInput, options?: AgentActivityWorkspaceEventIngestOptions): AgentActivityWorkspaceEventResult; isSessionDeleted(agentSessionId: string): boolean; project(canonical: AgentActivitySnapshot): AgentActivitySnapshot; reconcileDiscontinuity(input: { fallbackSessionIds?: readonly string[]; reconcileKeys: readonly AgentActivityWorkspaceReconcileKey[]; }): void; reconcileMessages(agentSessionId: string, canonicalMessages?: readonly AgentActivityMessage[]): void; reconcileAuthoritativeHistory(agentSessionId: string, canonicalMessages: readonly AgentActivityMessage[], effectiveTurns: readonly AgentActivityTurn[]): void; removeSession(agentSessionId: string): boolean; subscribe(listener: () => void): () => void; } interface AgentActivityWorkspaceEventIngestOptions { /** * Use only after the host has fenced transport identity and ordering. It * makes settlement absorbing for the same immutable Turn across otherwise * incomparable source version domains. */ hostFencedSameTurnSettlement?: true; } interface CreateAgentActivityWorkspaceEventCoordinatorInput { engine: AgentSessionEngine; notificationBatchDelayMs?: number; notificationScheduler: EngineScheduler; readCanonicalSnapshot: () => AgentActivitySnapshot; workspaceId: string; } /** * Owns the host-neutral stateful event/reconcile workflow for one workspace. * * Desktop WebSocket and Mobile DeviceLink adapters normalize transport * deliveries before calling this module. It owns optimistic message state, * authoritative inline application, deletion tombstones, discontinuity * reconciliation, and reconnect hydration. Platform adapters retain socket * lifecycle, diagnostics, analytics, and presentation invalidation. */ declare function createAgentActivityWorkspaceEventCoordinator({ engine, notificationBatchDelayMs, notificationScheduler, readCanonicalSnapshot, workspaceId }: CreateAgentActivityWorkspaceEventCoordinatorInput): AgentActivityWorkspaceEventCoordinator; interface AgentActivityEphemeralConversationIdentity { workspaceId: string; agentSessionId: string; sourceAgentSessionId: string; } interface AgentActivityEphemeralConversationSeed extends AgentActivityEphemeralConversationIdentity { provider: string; cwd?: string | null; title?: string | null; occurredAtUnixMs?: number; } interface AgentActivityEphemeralTurnPatch { turnId: string; activeTurnId?: string | null; phase?: string | null; outcome?: string | null; origin?: string | null; error?: AgentActivityTurn["error"]; fileChanges?: Record | null; startedAtUnixMs?: number | null; completedAtUnixMs?: number | null; updatedAtUnixMs?: number | null; } interface AgentActivityEphemeralInteractionPatch { requestId: string; turnId: string; kind: "approval" | "plan" | "question"; status: string; toolName?: string | null; input?: Record | null; metadata?: Record | null; output?: Record | null; occurredAtUnixMs?: number | null; } interface AgentActivityEphemeralStatePatch { provider?: string | null; cwd?: string | null; title?: string | null; lifecycleStatus?: string | null; currentPhase?: string | null; activeTurnId?: string | null; turn?: AgentActivityEphemeralTurnPatch | null; interaction?: AgentActivityEphemeralInteractionPatch | null; occurredAtUnixMs?: number | null; } type AgentActivityEphemeralConversationChange = { kind: "message_delta"; data: AgentActivityMessageDeltaEvent["data"]; } | { kind: "message_update"; message: AgentActivityMessage; } | { kind: "state_patch"; patch: AgentActivityEphemeralStatePatch; } | { kind: "noop"; }; interface AgentActivityEphemeralConversationEvent extends AgentActivityEphemeralConversationIdentity { sequence: number; change: AgentActivityEphemeralConversationChange; } type AgentActivityEphemeralConversationExpiryReason = "identity_mismatch" | "sequence_gap" | "terminal_session"; interface AgentActivityEphemeralConversationProjection { identity: AgentActivityEphemeralConversationIdentity; sequence: number; expired: boolean; expiryReason: AgentActivityEphemeralConversationExpiryReason | null; activitySnapshot: AgentActivitySnapshot; sessionTurns: readonly AgentActivityTurn[]; interactions: readonly AgentActivityInteraction[]; } interface AgentActivityEphemeralConversationApplyResult { applied: boolean; expired: boolean; reason?: AgentActivityEphemeralConversationExpiryReason; } interface AgentActivityEphemeralConversationProjector { apply(event: AgentActivityEphemeralConversationEvent): AgentActivityEphemeralConversationApplyResult; beginTurn(input: { turnId: string; content: string; displayPrompt?: string | null; occurredAtUnixMs?: number; }): void; failTurn(input: { turnId: string; occurredAtUnixMs?: number; message?: string | null; }): void; getSnapshot(): AgentActivityEphemeralConversationProjection; } declare function createAgentActivityEphemeralConversationProjector(seed: AgentActivityEphemeralConversationSeed): AgentActivityEphemeralConversationProjector; type AgentActivityChildMessageHydration = "requested_session" | "session_hierarchy"; interface AgentActivitySessionReconcilePort { getSessionDetail(input: { agentSessionId: string; projection: "authoritative" | "message_hydration"; signal?: AbortSignal; workspaceId: string; }): Promise; listSessionMessages: AgentActivityAdapter["listSessionMessages"]; } type AgentActivitySessionReconcileResult = { affectedSessionIds: readonly string[]; appliedMessages: readonly AgentActivityDurableMessage[]; session: AgentActivitySession | null; status: "applied"; } | { reason: "session_deleted"; status: "skipped"; }; interface AgentActivitySessionReconcileExecutor { execute(command: SessionReconcileCommand, options?: { signal?: AbortSignal; }): Promise; } type AgentActivitySessionReconcileTrace = { agentSessionId: string; detail?: AgentActivitySessionDetailSnapshot; phase: "discovery" | "final" | "state"; status: "requested" | "resolved"; type: "detail"; } | { afterVersion: number; agentSessionId: string; latestVersion?: number; messageCount?: number; messageVersion: number; requestedAgentSessionId: string; scope: "combined" | "messages"; status: "requested" | "resolved" | "skipped"; type: "messages"; } | { detail: AgentActivitySessionDetailSnapshot; scope: "state" | "state_and_messages"; status: "applied" | "applying"; type: "detailApply"; }; interface CreateAgentActivitySessionReconcileExecutorInput { childMessageHydration: AgentActivityChildMessageHydration; engine: Pick; isAvailable?(): boolean; isSessionDeleted(agentSessionId: string): boolean; onTrace?(event: AgentActivitySessionReconcileTrace): void; port: AgentActivitySessionReconcilePort; reconcileAuthoritativeHistory(agentSessionId: string, canonicalMessages: readonly AgentActivityDurableMessage[], effectiveTurns: readonly AgentActivityTurn[]): void; reconcileOptimisticMessages(agentSessionId: string): void; workspaceId: string; } declare function createAgentActivitySessionReconcileExecutor(input: CreateAgentActivitySessionReconcileExecutorInput): AgentActivitySessionReconcileExecutor; type EngineDiagnosticEvent = { type: "commandResultAfterDispose"; commandId: string; } | { type: "commandResultAfterTimeout"; commandId: string; } | { type: "intentDroppedAfterDispose"; intentType: EngineIntent["type"]; } | { type: "intentDroppedForIdentityMismatch"; intentType: EngineIntent["type"]; } | { type: "intentObserverError"; error: unknown; intentType: EngineIntent["type"]; } | { type: "listenerError"; error: unknown; }; type EngineDiagnosticSink = (event: EngineDiagnosticEvent) => void; /** * Frame window for coalescing high-frequency intents (streaming message * updates). Migrated from the desktop activity service's 33ms event batching; * the engine owns this timing once event wiring moves over in later slices. */ declare const ENGINE_INTENT_BATCH_DELAY_MS = 33; interface CreateAgentSessionEngineInput { batchDelayMs?: number; clock: EngineClock; commandPort: EngineTypedCommandPort; diagnosticSink?: EngineDiagnosticSink; identity: AgentSessionEngineIdentity; intentObserver?: AgentSessionEngineIntentObserver; scheduler: EngineScheduler; } declare function createAgentSessionEngine({ batchDelayMs, clock, commandPort, diagnosticSink, identity, intentObserver, scheduler }: CreateAgentSessionEngineInput): AgentSessionEngine; declare function selectSessionGoalControlSettlement(state: AgentSessionEngineState, agentSessionId: string | null | undefined): SessionGoalControlSettlement | null; declare function selectSessionGoalControlPresentation(state: AgentSessionEngineState, agentSessionId: string | null | undefined): SessionGoalControlPresentation; declare function sessionGoalControlPresentationsEqual(left: SessionGoalControlPresentation, right: SessionGoalControlPresentation): boolean; declare function selectWorkspaceReconcileState(state: AgentSessionEngineStateBase): { commandId: string | null; errorCode: string | null; errorMessage: string | null; status: "idle" | "loading" | "ready" | "failed" | "unknown"; }; interface EditRetryPresentationRecord { availability: AgentActivityEditRetryAvailability | null; operation: EditRetryOperationRecord; } declare function selectEditRetryPresentation(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): EditRetryPresentationRecord; declare function selectEditRetryAvailabilityIsNewer(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, incoming: AgentActivityEditRetryAvailability): boolean; declare function editRetryPresentationRecordsEqual(left: EditRetryPresentationRecord, right: EditRetryPresentationRecord): boolean; declare function dispatchEditRetry(engine: AgentSessionEngine, input: { agentSessionId: string; editedText: string; turnId: string; workspaceId: string; }): Promise; declare function dispatchEditRetryRecovery(engine: AgentSessionEngine, input: { action: AgentActivityEditRetryRecoveryAction; agentSessionId: string; workspaceId: string; }): Promise; interface DispatchSessionForkThroughTurnInput { sourceAgentSessionId: string; timeoutMs?: number; turnId: string; workspaceId: string; } /** * Engine-owned through-Turn Fork facade. A React surface identifies only the * canonical boundary; the facade allocates a mutation identity or reuses the * Engine record's stable mutation key for that boundary. The durable provider * identity may differ after recovery and remains owned by that record. A * confirmed failure permits a genuinely new provider attempt. */ declare function dispatchSessionForkThroughTurn(engine: AgentSessionEngine, input: DispatchSessionForkThroughTurnInput): Promise; interface SessionForkThroughTurnMutationSelectorInput { sourceAgentSessionId: string; turnId: string; workspaceId: string; } interface SessionForkThroughTurnPendingSelectorInput { sourceAgentSessionId: string | null | undefined; workspaceId: string; } declare function selectSessionMutation(state: AgentSessionEngineStateBase, mutationId: string): SessionMutationRecord | null; declare function selectSessionMutations(state: AgentSessionEngineStateBase): SessionMutationRecord[]; /** * Returns the newest retryable mutation for one exact through-Turn boundary. * Succeeded records normally do not capture a later explicit Fork of the same * boundary. The exception is a committed fork whose observation ACK is still * coordinating with the Store: it retains its durable request/target identity * until that barrier is acknowledged. */ declare function selectSessionForkThroughTurnMutation(state: AgentSessionEngineStateBase, input: SessionForkThroughTurnMutationSelectorInput): SessionForkThroughTurnMutationRecord | null; declare function selectPendingSessionForkThroughTurnIds(state: AgentSessionEngineStateBase, input: SessionForkThroughTurnPendingSelectorInput): string[]; interface TuttiModeActivationPresentation { activation: AgentActivityTuttiModeActivation | null; active: boolean; errorCode: string | null; errorMessage: string | null; effect?: number; speed?: number; /** @deprecated Use effect and speed. */ orchestrationIntensity: number; updateStatus: "idle" | "pending_create" | "updating" | "failed" | "uncertain"; } interface ResolvedTuttiModeActivationPresentation extends TuttiModeActivationPresentation { effect: number; speed: number; } declare function selectTuttiModeDraftIsActive(state: AgentSessionEngineStateBase, draftKey: string): boolean; declare function selectTuttiModeDraftPreferences(state: AgentSessionEngineStateBase, draftKey: string): { effect: number | null; speed: number | null; }; /** * @deprecated Use selectTuttiModeDraftPreferences. */ declare function selectTuttiModeDraftOrchestrationIntensity(state: AgentSessionEngineStateBase, draftKey: string): number | null; declare function selectTuttiModeActivationPresentation(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, draftKey: string): ResolvedTuttiModeActivationPresentation; declare function tuttiModeActivationPresentationsEqual(left: TuttiModeActivationPresentation, right: TuttiModeActivationPresentation): boolean; declare function selectSessionAttention(state: AgentSessionEngineStateBase, userId: string | null | undefined, agentSessionId: string | null | undefined): AttentionReadRecord | null; declare function selectAttentionReadState(state: AgentSessionEngineStateBase, userId: string | null | undefined): AttentionReadPartition; declare function selectSessionMessagesById(state: AgentSessionEngineStateBase): Readonly>; declare function selectSessionMessages(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly AgentActivityMessage[]; declare function selectSessionMessageWindow(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): Readonly | null; interface AgentSessionFamilySnapshot { childSessions: readonly AgentActivitySession[]; messagesBySessionId: Readonly>; pendingInteractions: readonly AgentActivityInteraction[]; rootSession: AgentActivitySession | null; } /** * Creates a Session-family projection for one mounted consumer. * * Workspace engines notify every subscriber after a drain. This selector keeps * the previous result when only another root Session changed, so one streaming * conversation cannot force unrelated AgentGUI surfaces to render. */ declare function createAgentSessionFamilySnapshotSelector(rootAgentSessionId: string | null | undefined): (state: AgentSessionEngineStateBase) => AgentSessionFamilySnapshot; declare function selectComposerOptions(state: AgentSessionEngineStateBase, targetKey: string | null | undefined): AgentActivityComposerOptions | null; declare function selectComposerOptionsLoadStatus(state: AgentSessionEngineStateBase, targetKey: string | null | undefined): AgentActivityComposerOptionsLoadStatus | undefined; declare function selectComposerOptionsSectionLoadStatus(state: AgentSessionEngineStateBase, targetKey: string | null | undefined, section: ComposerOptionsSection): AgentActivityComposerOptionsLoadStatus | undefined; interface CanonicalSubmitAvailability { reason?: "active_turn" | "agent_capability_checking" | "agent_capability_unavailable" | "agent_sharing_revoked" | "waiting" | "transport_reconnecting" | "transport_unavailable"; state: "available" | "blocked" | "missing"; } interface WorkspaceAgentConsumerSession { activeTurn: AgentActivityTurn | null; displayStatus: AgentActivityDisplayStatus; latestTurn: AgentActivityTurn | null; pendingInteractions: readonly AgentActivityInteraction[]; session: CanonicalAgentSession; } interface WorkspaceAgentConsumerCounts { canceled: number; completed: number; failed: number; idle: number; waiting: number; working: number; } interface EngineSubmitAvailability { reason?: Exclude; state: "available" | "blocked"; } /** * A failed new-session activation is only a missing session when the * canonical session entity is absent. The runtime may be unavailable while * the session remains a durable, selectable conversation. */ type FailedNewActivationResolution = "not-applicable" | "preserve" | "rollback"; declare function selectFailedNewActivationResolution(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, options?: { selectionSource?: "activation" | "user-selection"; }): FailedNewActivationResolution; /** * Session selection may reload after a failed or canceled activation. Only an * activation whose delivery is still pending/uncertain must wait for an * authoritative result before starting detail hydration. */ declare function selectEngineSessionCanReload(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineSessionRuntimeAvailability(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionRuntimeAvailability | null; declare function selectEngineSessionRuntimeActivity(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionRuntimeActivity; declare function selectEngineSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): CanonicalAgentSession | null; declare function selectEngineSessionDeleted(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineTurnsForSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly AgentActivityTurn[]; declare function selectEngineActiveTurn(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): AgentActivityTurn | null; declare function selectEngineTurn(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, turnId: string | null | undefined): AgentActivityTurn | null; declare function selectEngineInteraction(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, turnId: string | null | undefined, requestId: string | null | undefined): AgentActivityInteraction | null; declare function selectEngineInteractionResponse(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, turnId: string | null | undefined, requestId: string | null | undefined): InteractionResponseState | null; declare function selectEngineSessionIsRespondingToInteraction(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineSessionSettingsUpdate(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionSettingsUpdateState | null; declare function selectEngineGoalControl(state: AgentSessionEngineState, agentSessionId: string | null | undefined): SessionGoalControlPresentation | null; declare function selectEngineInteractionResponseError(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): string | null; declare function selectEngineLatestTurn(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): AgentActivityTurn | null; declare function selectEngineInteractionsForSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly AgentActivityInteraction[]; declare function selectEnginePendingInteractions(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly AgentActivityInteraction[]; declare function selectEngineSubmitAvailability(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): EngineSubmitAvailability | null; declare function selectEngineCancelPending(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineCancelState(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionCancelState | null; declare function selectEngineSessionOperation(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionOperationState | null; declare function selectEngineHasPendingInteractions(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; /** * Returns only failures from session-scoped commands. Canonical Turn failures * belong to the owning Turn and must not be promoted into session chrome. */ declare function selectEngineSessionOperationError(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): string | null; declare function selectWorkspaceAgentConsumerSessions(state: AgentSessionEngineStateBase): readonly WorkspaceAgentConsumerSession[]; declare function selectRootAgentSessionIdsWithPendingInteractions(state: AgentSessionEngineStateBase): readonly string[]; declare function selectWorkspaceAgentRootConversationSessions(state: AgentSessionEngineStateBase): readonly WorkspaceAgentConsumerSession[]; declare function selectWorkspaceAgentConsumerSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): WorkspaceAgentConsumerSession | null; declare function selectWorkspaceAgentConsumerCounts(state: AgentSessionEngineStateBase): WorkspaceAgentConsumerCounts; declare function selectEngineSessionReconcile(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): SessionReconcileRecord | null; interface AuthoritativeHistoryRequirement { appliedHistoryRevision: number | null; minimumHistoryRevision: number; needsAuthoritativeMessages: boolean; } declare function selectEngineAuthoritativeHistoryRequirement(state: AgentSessionEngineStateBase, input: { agentSessionId: string; forceAuthoritativeMessages?: boolean; observedHistoryRevision: number; requestedHistoryRevision?: number; }): AuthoritativeHistoryRequirement; declare function selectEngineSessionDetailHydrated(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineSessionStateHydrated(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectEngineSessionDetailLoading(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function canonicalTurnKey(agentSessionId: string, turnId: string): string; declare function canonicalInteractionKey(agentSessionId: string, turnId: string, requestId: string): string; declare function selectPlanDecisionForTurn(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, turnId: string | null | undefined): PlanDecisionRecord | null; declare function selectPlanTurnDismissed(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, turnId: string | null | undefined): boolean; declare function selectEngineAvailableCommands(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly AgentSessionAvailableCommand[]; declare function selectEnginePromptQueue(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): PromptQueueRecord | null; /** * Mirrors the visible-queue admission decision in enqueueSubmit: true when an * ordinary auto submit would remain in the composer queue instead of draining * into an immediate send. */ declare function selectEngineSubmitWouldBeVisibleInQueue(state: AgentSessionEngineState, agentSessionId: string | null | undefined): boolean; declare function selectEngineQueuedPrompts(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly EngineQueuedPrompt[]; declare function selectEngineHasQueuedPrompts(state: AgentSessionEngineStateBase): boolean; declare function selectEngineQueuedPrompt(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, promptId: string | null | undefined): EngineQueuedPrompt | null; declare function selectEnginePromptQueueError(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): string | null; declare function selectEngineHasVisibleQueuedSubmit(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined, clientSubmitId: string | null | undefined): boolean; declare function selectPendingActivations(state: AgentSessionEngineStateBase): readonly PendingActivationIntentRecord[]; declare function selectPendingActivationByRequestId(state: AgentSessionEngineStateBase, requestId: string | null | undefined): PendingActivationIntentRecord | null; declare function selectPendingSubmits(state: AgentSessionEngineStateBase): readonly PendingSubmitIntentRecord[]; interface SessionActivationPresentation { errorCode: string | null; errorMessage: string | null; requestId: string | null; status: "inactive" | "activating" | "active" | "failed"; } declare function selectPendingSubmitsForSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): readonly PendingSubmitIntentRecord[]; declare function selectPendingPlanFeedbackSubmit(state: Pick, agentSessionId: string | null | undefined, turnId: string | null | undefined, requestId: string | null | undefined): PendingSubmitIntentRecord | null; declare function pendingSubmitRecordListsEqual(left: readonly PendingSubmitIntentRecord[], right: readonly PendingSubmitIntentRecord[]): boolean; declare function selectSessionIsSubmitting(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectSessionHasUnconfirmedSubmit(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectLatestPendingSubmitForSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): PendingSubmitIntentRecord | null; /** * Whether an implicit Session stop can target a pending prompt admission. * Consumers use this presentation-safe fact instead of duplicating submit and * canonical Turn correlation rules. */ declare function selectSessionHasPendingSubmitStopTarget(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): boolean; declare function selectLatestActivationForSession(state: AgentSessionEngineStateBase, agentSessionId: string | null | undefined): PendingActivationIntentRecord | null; declare function selectSessionActivationPresentations(state: AgentSessionEngineStateBase): Readonly>; declare function sessionActivationPresentationMapsEqual(left: Readonly>, right: Readonly>): boolean; interface WorkspaceAgentSessionProjectionInput { activeTurn: AgentActivityTurn | null; latestTurn: AgentActivityTurn | null; pendingInteractions: readonly AgentActivityInteraction[]; } type WorkspaceAgentSessionDerivedStatus = "working" | "waiting" | "completed" | "failed" | "canceled" | "unknown"; declare function workspaceAgentSessionStatus(session: Pick): WorkspaceAgentSessionDerivedStatus; export { AGENT_ACTIVITY_LIVE_PROTOCOL_REVISION, AGENT_CAPABILITY_KEYS, AGENT_SESSION_ENGINE_LOCAL_ORIGIN, type ActivityMessagesReceivedIntent, type AgentActivityActivateSessionResult, type AgentActivityActivationMode, type AgentActivityActivationStatus, type AgentActivityAdapter, type AgentActivityCancelTurnInput, type AgentActivityCapabilityInput, type AgentActivityCapabilityReference, type AgentActivityChildMessageHydration, type AgentActivityCollaborationAdoption, type AgentActivityCollaborationMode, type AgentActivityCollaborationRun, type AgentActivityCollaborationStatus, type AgentActivityCollaborationTriggerSource, type AgentActivityCollaborationUsage, type AgentActivityCompletedCommand, type AgentActivityComposerBehavior, type AgentActivityComposerCapabilityOption, type AgentActivityComposerModelConfiguration, type AgentActivityComposerOptions, type AgentActivityComposerOptionsLoadStatus, type AgentActivityComposerPermissionConfig, type AgentActivityComposerPermissionModeOption, type AgentActivityComposerSettingOption, type AgentActivityComposerSettings, type AgentActivityComposerSkillOption, type AgentActivityCreateSessionInput, type AgentActivityDeleteSessionInput, type AgentActivityDeleteSessionResult, type AgentActivityDeleteSessionsInput, type AgentActivityDeleteSessionsResult, type AgentActivityDisplayStatus, type AgentActivityDurableMessage, type AgentActivityEditRetryAvailability, type AgentActivityEditRetryInput, type AgentActivityEditRetryReasonCode, type AgentActivityEditRetryRecoveryAction, type AgentActivityEditRetryRecoveryState, type AgentActivityEditRetryResult, type AgentActivityEphemeralConversationApplyResult, type AgentActivityEphemeralConversationChange, type AgentActivityEphemeralConversationEvent, type AgentActivityEphemeralConversationExpiryReason, type AgentActivityEphemeralConversationIdentity, type AgentActivityEphemeralConversationProjection, type AgentActivityEphemeralConversationProjector, type AgentActivityEphemeralConversationSeed, type AgentActivityEphemeralInteractionPatch, type AgentActivityEphemeralStatePatch, type AgentActivityEphemeralTurnPatch, type AgentActivityForkSessionOperationStatus, type AgentActivityForkSessionResult, type AgentActivityForkSessionThroughTurnInput, type AgentActivityGoalControlAction, type AgentActivityGoalControlInput, type AgentActivityGoalControlResult, type AgentActivityInitialGoalControl, type AgentActivityInitialTuttiModeActivation, type AgentActivityInteraction, type AgentActivityLiveEvent, type AgentActivityLoadComposerOptionsInput, type AgentActivityMessage, type AgentActivityMessageDeltaEvent, type AgentActivityMessageOrder, type AgentActivityMessagePage, type AgentActivityMessagePageLike, type AgentActivityMessageSemantics, type AgentActivityModelPlanModel, type AgentActivityModelPlanSummary, type AgentActivityNeedsAttentionItem, type AgentActivityNeedsAttentionKind, type AgentActivityPresence, type AgentActivityRailPlacement, type AgentActivityRecoverEditRetryInput, type AgentActivityRenameSessionInput, type AgentActivitySendInput, type AgentActivitySendInputResult, type AgentActivitySession, type AgentActivitySessionCapabilities, type AgentActivitySessionDetailSnapshot, type AgentActivitySessionEventEnvelope, type AgentActivitySessionForkLineage, type AgentActivitySessionGoal, type AgentActivitySessionGoalState, type AgentActivitySessionGoalSyncState, type AgentActivitySessionGoalSyncStatus, type AgentActivitySessionInput, type AgentActivitySessionIsolation, type AgentActivitySessionKind, type AgentActivitySessionList, type AgentActivitySessionMessageWindow, type AgentActivitySessionPermissionConfig, type AgentActivitySessionReconcileExecutor, type AgentActivitySessionReconcilePort, type AgentActivitySessionReconcileResult, type AgentActivitySessionReconcileTrace, type AgentActivitySessionSettings, type AgentActivitySessionUsage, type AgentActivitySetCollaborationAdoptionInput, type AgentActivitySetSessionPinnedInput, type AgentActivitySlashCommandEffect, type AgentActivitySlashCommandPolicy, type AgentActivitySnapshot, type AgentActivitySnapshotListener, type AgentActivitySubmitDiagnostics, type AgentActivitySubmitInteractiveInput, type AgentActivitySubmitInteractiveResult, type AgentActivitySubmitSettingsPatch, type AgentActivityTransientMessage, type AgentActivityTurn, type AgentActivityTurnCancelResponse, type AgentActivityTurnOrigin, type AgentActivityTuttiModeActivation, type AgentActivityTuttiModeActivationRevision, type AgentActivityTuttiModeActivationSource, type AgentActivityTuttiModeActivationStatus, type AgentActivityUpdateTuttiModeActivationInput, type AgentActivityUpdateTuttiModeActivationResult, type AgentActivityUpdatedApplyResult, type AgentActivityUpdatedEvent, type AgentActivityUsage, type AgentActivityUsageInput, type AgentActivityWorkspaceEventIngestOptions, type AgentActivityWorkspaceEventInput, type AgentCapabilityKey, type AgentPromptContentBlock, type AgentSessionActivateEffectInput, type AgentSessionActivateEffectResult, type AgentSessionAvailableCommand, type AgentSessionControlGoalAdmission, type AgentSessionControlGoalInput, type AgentSessionEffectPort, type AgentSessionEngine, type AgentSessionEngineIdentity, type AgentSessionEngineListener, type AgentSessionEngineState, type AgentSessionFamilySnapshot, type AgentSessionGoalControlEffectInput, type AttentionCompletionKind, type AttentionObservationProvenance, type AttentionReadCommand, type AttentionReadIntent, type AttentionReadRecord, type AttentionReadState, type AttentionReadStateProvenance, type AuthoritativeHistoryRequirement, type CanonicalAgentSession, type ComposerOptionsCommand, type ComposerOptionsIntent, type ComposerOptionsSection, type ComposerOptionsState, type CreateAgentActivitySessionReconcileExecutorInput, type CreateAgentSessionEngineInput, type DispatchSessionForkThroughTurnInput, ENGINE_INTENT_BATCH_DELAY_MS, type EditRetryCommand, type EditRetryIntent, type EditRetryOperationRecord, type EditRetryOperationStatus, type EditRetryPresentationRecord, type EditRetryState, type EngineClock, type EngineCommand, type EngineCommandOutcome, type EngineConnectionStatus, type EngineDiagnosticEvent, type EngineDiagnosticSink, type EngineDispatchOptions, type EngineDomainReducer, type EngineEffectOptions, type EngineExtensionCommand, type EngineExternalCommand, type EngineIntent, type EngineInternalCommand, type EngineQueuedPrompt, type EngineReducerResult, type EngineRuntimeState, type EngineScheduledTask, type EngineScheduler, type EngineTypedCommandPort, type FailedNewActivationResolution, type InteractionRespondCommand, type InteractionResponseState, type InteractionResponseStatus, type LoadAllAgentSessionMessagesInput, type LoadAllAgentSessionMessagesResult, type PendingActivationCommandOutcome, type PendingActivationIntentRecord, type PendingActivationLastObservedStage, type PendingActivationSnapshotOutcome, type PendingActivationStatus, type PendingIntentsIntent, type PendingIntentsState, type PendingSubmitIntentRecord, type PendingSubmitSource, type PendingSubmitStatus, type PlanDecisionIntent, type PlanDecisionOperation, type PlanDecisionRecord, type PlanDecisionState, type PlanDecisionStatus, type PlanSubmitDecisionCommand, type PlanSubmitDecisionResult, type PromptQueueInFlightCommand, type PromptQueueRecord, type PromptQueueSendCommand, type PromptQueueState, type PromptQueueSuspendReason, type ResolvedTuttiModeActivationPresentation, type SessionAcknowledgeForkObservedCommand, type SessionActivateCommand, type SessionActivationDismissedIntent, type SessionActivationFailureClearedIntent, type SessionActivationFailureRecordedIntent, type SessionActivationPresentation, type SessionActivationRequestedIntent, type SessionActivationSettingsPatchedIntent, type SessionActivityObservedIntent, type SessionCancelState, type SessionCancelStatus, type SessionCommandsIntent, type SessionCommandsState, type SessionDeleteMutationResult, type SessionDetailSnapshotReceivedIntent, type SessionForkObservationAckStatus, type SessionForkThroughTurnCommand, type SessionForkThroughTurnMutationRecord, type SessionForkThroughTurnMutationSelectorInput, type SessionForkThroughTurnPendingSelectorInput, type SessionForkThroughTurnRequestedIntent, type SessionGoalControlPresentation, type SessionGoalControlPresentationStatus, type SessionGoalControlSettlement, type SessionLifecycleState, type SessionMessagesState, type SessionMutationCommand, type SessionMutationRecord, type SessionMutationStatus, type SessionMutationsIntent, type SessionMutationsState, type SessionOperationState, type SessionPinRequestedIntent, type SessionReconcileCommand, type SessionReconcileIntent, type SessionReconcileRecord, type SessionReconcileRequestedIntent, type SessionReconcileScope, type SessionReconcileState, type SessionRuntimeActivity, type SessionRuntimeAvailability, type SessionSetPinnedCommand, type SessionSettingsUpdateState, type SessionSettingsUpdateStatus, type SessionUnactivateCommand, type SessionUnactivationRequestedIntent, type SessionsDeleteCommand, type SessionsDeleteRequestedIntent, type SubmitCanceledIntent, type SubmitDismissedIntent, type SubmitRequestedIntent, type TurnCancelCommand, type TurnEditRetryCommand, type TurnRecoverEditRetryCommand, type TuttiModeActivationCommand, type TuttiModeActivationIntent, type TuttiModeActivationPresentation, type TuttiModeActivationState, type TuttiModeActivationUpdateCommand, type WorkspaceAgentConsumerCounts, type WorkspaceAgentConsumerSession, agentActivitySessionCapabilitiesFromIds, agentActivitySessionMessageWindowFromDescendingPage, canonicalInteractionKey, canonicalTurnKey, cloneAgentActivityMessage, compareAgentActivityMessages, createAgentActivityEphemeralConversationProjector, createAgentActivitySessionReconcileExecutor, createAgentActivitySnapshotProjector, createAgentActivityWorkspaceEventCoordinator, createAgentSessionEngine, createAgentSessionFamilySnapshotSelector, createEmptyAgentActivitySnapshot, dispatchEditRetry, dispatchEditRetryRecovery, dispatchSessionForkThroughTurn, editRetryPresentationRecordsEqual, hasAgentCapability, isPendingActivationViable, latestAgentActivityMessageVersion, loadAllAgentSessionMessages, mergeAgentActivityMessages, normalizeAgentActivityCapabilityReferences, normalizeAgentActivityDisplayStatus, normalizeAgentActivitySession, parseAgentActivityGoalControlText, parseInlineActivityMessages, pendingSubmitRecordListsEqual, providerForkBindingAllowsAttempt, resolveAgentActivityCapability, resolveAgentActivityUsage, selectAttentionReadState, selectCanonicalAgentActivitySessions, selectComposerOptions, selectComposerOptionsLoadStatus, selectComposerOptionsSectionLoadStatus, selectEditRetryAvailabilityIsNewer, selectEditRetryPresentation, selectEngineActiveTurn, selectEngineAuthoritativeHistoryRequirement, selectEngineAvailableCommands, selectEngineCancelPending, selectEngineCancelState, selectEngineGoalControl, selectEngineHasPendingInteractions, selectEngineHasQueuedPrompts, selectEngineHasVisibleQueuedSubmit, selectEngineInteraction, selectEngineInteractionResponse, selectEngineInteractionResponseError, selectEngineInteractionsForSession, selectEngineLatestTurn, selectEnginePendingInteractions, selectEnginePromptQueue, selectEnginePromptQueueError, selectEngineQueuedPrompt, selectEngineQueuedPrompts, selectEngineSession, selectEngineSessionCanReload, selectEngineSessionDeleted, selectEngineSessionDetailHydrated, selectEngineSessionDetailLoading, selectEngineSessionIsRespondingToInteraction, selectEngineSessionOperation, selectEngineSessionOperationError, selectEngineSessionReconcile, selectEngineSessionRuntimeActivity, selectEngineSessionRuntimeAvailability, selectEngineSessionSettingsUpdate, selectEngineSessionStateHydrated, selectEngineSubmitAvailability, selectEngineSubmitWouldBeVisibleInQueue, selectEngineTurn, selectEngineTurnsForSession, selectFailedNewActivationResolution, selectLatestActivationForSession, selectLatestPendingSubmitForSession, selectNeedsAttentionCount, selectNeedsAttentionItems, selectPendingActivationByRequestId, selectPendingActivations, selectPendingPlanFeedbackSubmit, selectPendingSessionForkThroughTurnIds, selectPendingSubmits, selectPendingSubmitsForSession, selectPlanDecisionForTurn, selectPlanTurnDismissed, selectRootAgentActivitySessions, selectRootAgentSessionIdsWithPendingInteractions, selectSessionActivationPresentations, selectSessionAttention, selectSessionForkThroughTurnMutation, selectSessionGoalControlPresentation, selectSessionGoalControlSettlement, selectSessionHasPendingSubmitStopTarget, selectSessionHasUnconfirmedSubmit, selectSessionIsSubmitting, selectSessionMessageWindow, selectSessionMessages, selectSessionMessagesById, selectSessionMutation, selectSessionMutations, selectTuttiModeActivationPresentation, selectTuttiModeDraftIsActive, selectTuttiModeDraftOrchestrationIntensity, selectTuttiModeDraftPreferences, selectWorkspaceAgentConsumerCounts, selectWorkspaceAgentConsumerSession, selectWorkspaceAgentConsumerSessions, selectWorkspaceAgentRootConversationSessions, selectWorkspaceReconcileState, sessionActivationPresentationMapsEqual, sessionGoalControlPresentationsEqual, tuttiModeActivationPresentationsEqual, workspaceAgentSessionStatus };