@gajae-code/coding-agent 0.11.10 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +86 -2
  2. package/dist/types/cli/read-cli.d.ts +1 -0
  3. package/dist/types/cli.d.ts +8 -1
  4. package/dist/types/commands/deep-interview.d.ts +9 -0
  5. package/dist/types/commands/harness.d.ts +22 -0
  6. package/dist/types/commands/read.d.ts +6 -0
  7. package/dist/types/config/model-profile-activation.d.ts +1 -0
  8. package/dist/types/config/model-profile-contract.d.ts +2 -0
  9. package/dist/types/config/model-registry.d.ts +4 -0
  10. package/dist/types/config/provider-auth-health.d.ts +14 -0
  11. package/dist/types/config/provider-ranking.d.ts +59 -0
  12. package/dist/types/config/settings-schema.d.ts +86 -3
  13. package/dist/types/config/settings.d.ts +3 -0
  14. package/dist/types/extensibility/extensions/types.d.ts +43 -2
  15. package/dist/types/extensibility/shared-events.d.ts +6 -0
  16. package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +5 -12
  17. package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +17 -32
  18. package/dist/types/gjc-runtime/deep-interview-stage.d.ts +37 -0
  19. package/dist/types/gjc-runtime/deep-interview-state.d.ts +4 -135
  20. package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
  21. package/dist/types/gjc-runtime/linux-proc.d.ts +22 -14
  22. package/dist/types/gjc-runtime/memory-guard-owner-claims.d.ts +47 -0
  23. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +112 -1
  24. package/dist/types/gjc-runtime/state-runtime.d.ts +3 -1
  25. package/dist/types/gjc-runtime/state-writer.d.ts +5 -46
  26. package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
  27. package/dist/types/gjc-runtime/team-runtime.d.ts +2 -1
  28. package/dist/types/gjc-runtime/team-store.d.ts +12 -0
  29. package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +92 -0
  30. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +7 -0
  31. package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +8 -0
  32. package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -5
  33. package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
  34. package/dist/types/main.d.ts +1 -1
  35. package/dist/types/memories/index.d.ts +2 -0
  36. package/dist/types/modes/acp/acp-agent.d.ts +22 -9
  37. package/dist/types/modes/components/assistant-message.d.ts +3 -1
  38. package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
  39. package/dist/types/modes/components/queue-pane.d.ts +8 -0
  40. package/dist/types/modes/components/queued-message-selector.d.ts +6 -0
  41. package/dist/types/modes/components/read-tool-group.d.ts +4 -4
  42. package/dist/types/modes/components/session-observer-overlay.d.ts +4 -0
  43. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  44. package/dist/types/modes/components/tool-execution.d.ts +8 -0
  45. package/dist/types/modes/components/welcome.d.ts +1 -0
  46. package/dist/types/modes/controllers/event-controller.d.ts +3 -0
  47. package/dist/types/modes/interactive-mode.d.ts +7 -1
  48. package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
  49. package/dist/types/modes/types.d.ts +2 -0
  50. package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
  51. package/dist/types/runtime/memory-domain.d.ts +9 -0
  52. package/dist/types/runtime/memory-guard-contract.d.ts +71 -0
  53. package/dist/types/runtime/memory-guard.d.ts +39 -0
  54. package/dist/types/runtime/memory-limit.d.ts +11 -0
  55. package/dist/types/runtime-mcp/manager.d.ts +8 -0
  56. package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
  57. package/dist/types/sdk/acp/final-text.d.ts +19 -0
  58. package/dist/types/sdk/acp/mcp.d.ts +23 -0
  59. package/dist/types/sdk/broker/lifecycle.d.ts +7 -0
  60. package/dist/types/sdk/bus/chat-daemon-control.d.ts +2 -1
  61. package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
  62. package/dist/types/sdk/bus/index.d.ts +18 -2
  63. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +37 -0
  64. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +2 -1
  65. package/dist/types/sdk/bus/rate-limit-pool.d.ts +2 -0
  66. package/dist/types/sdk/bus/reconciliation-store.d.ts +65 -0
  67. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -4
  68. package/dist/types/sdk/bus/telegram-daemon.d.ts +23 -3
  69. package/dist/types/sdk/host/control/operations.d.ts +2 -1
  70. package/dist/types/sdk/host/host.d.ts +2 -0
  71. package/dist/types/sdk/host/query/handlers.d.ts +5 -0
  72. package/dist/types/sdk/lifecycle-session.d.ts +10 -1
  73. package/dist/types/sdk/startup-capability.d.ts +6 -0
  74. package/dist/types/session/agent-session.d.ts +51 -19
  75. package/dist/types/session/fallback-chain-controller.d.ts +18 -2
  76. package/dist/types/session/internal/managed-session-scope.d.ts +27 -0
  77. package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
  78. package/dist/types/session/session-manager.d.ts +59 -13
  79. package/dist/types/session/streaming-output.d.ts +60 -5
  80. package/dist/types/skill-state/active-state.d.ts +0 -4
  81. package/dist/types/skill-state/workflow-hud.d.ts +3 -0
  82. package/dist/types/task/executor.d.ts +6 -0
  83. package/dist/types/task/types.d.ts +36 -0
  84. package/dist/types/task/ultragoal-redteam-activation.d.ts +33 -0
  85. package/dist/types/tools/browser/launch.d.ts +7 -0
  86. package/dist/types/tools/fetch.d.ts +17 -1
  87. package/dist/types/tools/output-meta.d.ts +21 -1
  88. package/dist/types/tools/read-internals.d.ts +12 -0
  89. package/dist/types/tools/read.d.ts +45 -1
  90. package/dist/types/tools/resource-gc.d.ts +23 -0
  91. package/dist/types/tools/tool-result.d.ts +7 -1
  92. package/package.json +9 -13
  93. package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
  94. package/scripts/capture-sticky-viewport-showcase.ts +292 -0
  95. package/scripts/generate-sdk-operation-inventory.ts +4 -0
  96. package/scripts/run-test-manifest.ts +6 -4
  97. package/scripts/verify-gjc-sdk-canonicalization.ts +122 -18
  98. package/scripts/verify-sticky-viewport-showcase.ts +611 -0
  99. package/src/capability/index.ts +8 -0
  100. package/src/cli/args.ts +14 -8
  101. package/src/cli/fast-help.ts +1 -1
  102. package/src/cli/read-cli.ts +2 -1
  103. package/src/cli.ts +49 -2
  104. package/src/commands/deep-interview.ts +29 -9
  105. package/src/commands/harness.ts +35 -12
  106. package/src/commands/read.ts +11 -2
  107. package/src/commands/sdk.ts +91 -7
  108. package/src/commands/team.ts +1 -1
  109. package/src/config/model-profile-activation.ts +1 -0
  110. package/src/config/model-profile-contract.ts +13 -0
  111. package/src/config/model-profiles.ts +24 -0
  112. package/src/config/model-registry.ts +21 -2
  113. package/src/config/provider-auth-health.ts +42 -0
  114. package/src/config/provider-ranking.ts +119 -0
  115. package/src/config/settings-schema.ts +84 -3
  116. package/src/config/settings.ts +254 -108
  117. package/src/defaults/gjc/skills/deep-interview/SKILL.md +229 -82
  118. package/src/defaults/gjc/skills/ralplan/SKILL.md +78 -26
  119. package/src/defaults/gjc/skills/team/SKILL.md +1 -1
  120. package/src/defaults/gjc/skills/ultragoal/SKILL.md +26 -16
  121. package/src/eval/py/executor.ts +7 -2
  122. package/src/extensibility/extensions/runner.ts +4 -0
  123. package/src/extensibility/extensions/types.ts +42 -4
  124. package/src/extensibility/shared-events.ts +5 -0
  125. package/src/gjc-runtime/deep-interview-ambiguity.ts +47 -68
  126. package/src/gjc-runtime/deep-interview-recorder.ts +227 -310
  127. package/src/gjc-runtime/deep-interview-runtime.ts +109 -270
  128. package/src/gjc-runtime/deep-interview-stage.ts +1016 -0
  129. package/src/gjc-runtime/deep-interview-state.ts +12 -921
  130. package/src/gjc-runtime/gc-render.ts +1 -0
  131. package/src/gjc-runtime/gc-runtime.ts +11 -1
  132. package/src/gjc-runtime/linux-proc.ts +70 -36
  133. package/src/gjc-runtime/memory-guard-owner-claims.ts +389 -0
  134. package/src/gjc-runtime/ralplan-runtime.ts +979 -71
  135. package/src/gjc-runtime/state-runtime.ts +50 -12
  136. package/src/gjc-runtime/state-writer.ts +70 -222
  137. package/src/gjc-runtime/team-launch.ts +34 -5
  138. package/src/gjc-runtime/team-runtime.ts +970 -33
  139. package/src/gjc-runtime/team-store.ts +32 -0
  140. package/src/gjc-runtime/team-worker-memory-guard.ts +363 -0
  141. package/src/gjc-runtime/team-workers.ts +1 -0
  142. package/src/gjc-runtime/tmux-owner-isolation.ts +18 -0
  143. package/src/gjc-runtime/ultragoal-receipt-freshness.ts +20 -0
  144. package/src/gjc-runtime/ultragoal-runtime.ts +13 -7
  145. package/src/gjc-runtime/workflow-manifest.generated.json +97 -350
  146. package/src/gjc-runtime/workflow-manifest.ts +34 -179
  147. package/src/hooks/native-skill-hook.ts +17 -4
  148. package/src/hooks/skill-state.ts +1 -23
  149. package/src/internal-urls/docs-index.generated.ts +10 -11
  150. package/src/internal-urls/local-protocol.ts +23 -4
  151. package/src/internal-urls/local-root-gc.ts +127 -0
  152. package/src/main.ts +9 -5
  153. package/src/memories/index.ts +10 -0
  154. package/src/modes/DESIGN.md +47 -0
  155. package/src/modes/acp/acp-agent.ts +597 -67
  156. package/src/modes/acp/acp-event-mapper.ts +106 -12
  157. package/src/modes/acp/acp-mode.ts +39 -3
  158. package/src/modes/components/assistant-message.ts +123 -22
  159. package/src/modes/components/irc-sidebar.ts +176 -62
  160. package/src/modes/components/model-selector.ts +76 -5
  161. package/src/modes/components/notifications-settings-editor.ts +1 -1
  162. package/src/modes/components/oauth-selector.ts +42 -12
  163. package/src/modes/components/queue-pane.ts +55 -9
  164. package/src/modes/components/queued-message-selector.ts +53 -10
  165. package/src/modes/components/read-tool-group.ts +82 -14
  166. package/src/modes/components/session-observer-overlay.ts +187 -32
  167. package/src/modes/components/settings-selector.ts +60 -18
  168. package/src/modes/components/tool-execution.ts +138 -27
  169. package/src/modes/components/tool-status-header.ts +1 -4
  170. package/src/modes/components/welcome.ts +18 -3
  171. package/src/modes/controllers/command-controller.ts +4 -0
  172. package/src/modes/controllers/event-controller.ts +109 -27
  173. package/src/modes/controllers/extension-ui-controller.ts +23 -12
  174. package/src/modes/controllers/input-controller.ts +62 -6
  175. package/src/modes/controllers/selector-controller.ts +83 -37
  176. package/src/modes/interactive-mode.ts +127 -29
  177. package/src/modes/irc-observation-ledger.ts +71 -15
  178. package/src/modes/runtime-init.ts +20 -2
  179. package/src/modes/types.ts +2 -0
  180. package/src/modes/utils/ui-helpers.ts +94 -1
  181. package/src/prompts/agents/architect.md +9 -1
  182. package/src/prompts/agents/critic.md +9 -0
  183. package/src/prompts/agents/executor.md +1 -1
  184. package/src/prompts/system/system-prompt.md +0 -1
  185. package/src/prompts/tools/read.md +4 -2
  186. package/src/runtime/memory-domain.ts +66 -0
  187. package/src/runtime/memory-guard-contract.ts +73 -0
  188. package/src/runtime/memory-guard.ts +292 -0
  189. package/src/runtime/memory-limit.ts +50 -0
  190. package/src/runtime-mcp/manager.ts +26 -6
  191. package/src/runtime-mcp/smithery-auth.ts +17 -2
  192. package/src/runtime-mcp/smithery-connect.ts +11 -1
  193. package/src/sdk/acp/adapter.ts +8 -1
  194. package/src/sdk/acp/final-text.ts +40 -0
  195. package/src/sdk/acp/mcp.ts +26 -0
  196. package/src/sdk/broker/lifecycle.ts +107 -7
  197. package/src/sdk/bus/chat-daemon-cli.ts +2 -2
  198. package/src/sdk/bus/chat-daemon-control.ts +4 -3
  199. package/src/sdk/bus/config.ts +1 -1
  200. package/src/sdk/bus/control-drain-lease.ts +104 -0
  201. package/src/sdk/bus/index.ts +503 -60
  202. package/src/sdk/bus/kind-aware-reconciliation.ts +242 -0
  203. package/src/sdk/bus/prompt-reconciliation.ts +2 -1
  204. package/src/sdk/bus/rate-limit-pool.ts +8 -0
  205. package/src/sdk/bus/reconciliation-store.ts +224 -0
  206. package/src/sdk/bus/telegram-daemon-contract.ts +6 -4
  207. package/src/sdk/bus/telegram-daemon.ts +531 -53
  208. package/src/sdk/host/control/dispatch.ts +7 -1
  209. package/src/sdk/host/control/operations.ts +2 -1
  210. package/src/sdk/host/host.ts +25 -3
  211. package/src/sdk/host/query/handlers.ts +55 -0
  212. package/src/sdk/lifecycle-session.ts +19 -3
  213. package/src/sdk/mcp/server.ts +46 -18
  214. package/src/sdk/protocol/operation-inventory.generated.json +76 -0
  215. package/src/sdk/protocol/operation-registry.ts +8 -2
  216. package/src/sdk/session.ts +25 -2
  217. package/src/sdk/startup-capability.ts +6 -0
  218. package/src/session/agent-session.ts +720 -190
  219. package/src/session/fallback-chain-controller.ts +47 -8
  220. package/src/session/internal/managed-session-scope.ts +40 -10
  221. package/src/session/internal/native-publish-outcome.ts +8 -3
  222. package/src/session/memory-guard-checkpoint-participant.ts +131 -0
  223. package/src/session/session-manager.ts +1372 -42
  224. package/src/session/streaming-output.ts +262 -43
  225. package/src/setup/provider-onboarding.ts +19 -4
  226. package/src/skill-state/active-state.ts +0 -10
  227. package/src/skill-state/workflow-hud.ts +25 -2
  228. package/src/skill-state/workflow-mutation-guard.ts +65 -7
  229. package/src/task/executor.ts +11 -3
  230. package/src/task/index.ts +2 -0
  231. package/src/task/types.ts +22 -11
  232. package/src/task/ultragoal-redteam-activation.ts +75 -0
  233. package/src/tools/ask.ts +89 -69
  234. package/src/tools/browser/launch.ts +41 -6
  235. package/src/tools/fetch.ts +114 -23
  236. package/src/tools/output-meta.ts +176 -9
  237. package/src/tools/path-utils.ts +5 -1
  238. package/src/tools/read-internals.ts +44 -0
  239. package/src/tools/read.ts +1542 -310
  240. package/src/tools/resource-gc.ts +665 -125
  241. package/src/tools/tool-result.ts +14 -1
  242. package/src/web/search/providers/codex.ts +1 -1
  243. package/src/workflow/workflow-intent-diff.ts +4 -1
  244. package/dist/types/gjc-runtime/deep-interview-draft.d.ts +0 -8
  245. package/dist/types/gjc-runtime/deep-interview-payload.d.ts +0 -41
  246. package/dist/types/gjc-runtime/deep-interview-repair.d.ts +0 -17
  247. package/src/gjc-runtime/deep-interview-draft.ts +0 -843
  248. package/src/gjc-runtime/deep-interview-payload.ts +0 -262
  249. package/src/gjc-runtime/deep-interview-repair.ts +0 -1674
@@ -80,9 +80,11 @@ import type { TtsrManager } from "../export/ttsr";
80
80
  import type { LoadedCustomCommand } from "../extensibility/custom-commands";
81
81
  import type { CustomTool } from "../extensibility/custom-tools/types";
82
82
  import type { ExtensionRunner } from "../extensibility/extensions";
83
- import type { CompactOptions, ContextUsage } from "../extensibility/extensions/types";
83
+ import type { CompactOptions, ContextUsage, ExtensionTranscriptEntry } from "../extensibility/extensions/types";
84
+ import type { SessionSwitchEvent } from "../extensibility/shared-events";
84
85
  import { type Skill, type SkillWarning } from "../extensibility/skills";
85
86
  import { type FileSlashCommand } from "../extensibility/slash-commands";
87
+ import { type MemoryGuardClaimsLease } from "../gjc-runtime/memory-guard-owner-claims";
86
88
  import { GoalRuntime } from "../goals/runtime";
87
89
  import type { Goal, GoalModeState } from "../goals/state";
88
90
  import type { HindsightSessionState } from "../hindsight/state";
@@ -101,8 +103,9 @@ import { type DefaultModelSelectionResult } from "./default-model-selection";
101
103
  export { DefaultModelSelectionRecoveryError } from "./default-model-selection";
102
104
  import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "./client-bridge";
103
105
  import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
106
+ import type { MemoryGuardRestoreResult } from "./memory-guard-checkpoint-participant";
104
107
  import { type CustomMessage } from "./messages";
105
- import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManager, SessionManagerCloseOutcome } from "./session-manager";
108
+ import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManager, SessionManagerCloseOutcome } from "./session-manager";
106
109
  import { ToolChoiceQueue } from "./tool-choice-queue";
107
110
  import { YieldQueue } from "./yield-queue";
108
111
  /** Session-specific events that extend the core AgentEvent */
@@ -314,6 +317,24 @@ export interface AgentSessionConfig {
314
317
  /** Optional provider-facing cache identity, distinct from logical session identity. */
315
318
  providerCacheSessionId?: string;
316
319
  }
320
+ export interface AgentSessionMemoryGuardRestoreInput extends Omit<AgentSessionConfig, "sessionManager" | "recoveryHydrationContext"> {
321
+ staged: Extract<MemoryGuardRestoreResult, {
322
+ kind: "staged";
323
+ }>;
324
+ claimsLease: MemoryGuardClaimsLease;
325
+ claimsStateDir: string;
326
+ }
327
+ export interface AgentMemoryGuardPromotionFence extends RecoveryHydrationPromotionFence {
328
+ readonly claimsLease: MemoryGuardClaimsLease;
329
+ }
330
+ export type AgentMemoryGuardRestoreResult = {
331
+ kind: "staged";
332
+ session: AgentSession;
333
+ promotionFence: AgentMemoryGuardPromotionFence;
334
+ } | {
335
+ kind: "blocked";
336
+ reason: "transcript-mismatch" | "hydration-context-mismatch" | "claim-mismatch" | "agent-messages-mismatch";
337
+ };
317
338
  type MidRunMaintenanceLifecycle = Parameters<NonNullable<AgentLoopConfig["maintainContext"]>>[1];
318
339
  /** Options for AgentSession.prompt() */
319
340
  export interface PromptOptions {
@@ -336,8 +357,21 @@ export interface PromptOptions {
336
357
  /**
337
358
  * Invoked after all prompt preflight checks pass and immediately before agent execution begins.
338
359
  * Cancellation before this callback rejects the prompt.
360
+ * Prefer `onPreflightAcceptCommit` for async durable acceptance (#3031/#3032).
339
361
  */
340
362
  onPreflightAccepted?: () => void;
363
+ /**
364
+ * Awaitable durable-accept fence. Called after preflight and before queue mutation
365
+ * or `#promptAgentWithIdleRetry`. SDK bus installs a closure that fsyncs acceptance.
366
+ */
367
+ onPreflightAcceptCommit?: () => void | Promise<void>;
368
+ /** Skill-only: prepared metadata before the durable fence (path/lineCount/cleanedArgs). */
369
+ onSkillPrepared?: (meta: {
370
+ name: string;
371
+ path: string;
372
+ lineCount?: number;
373
+ cleanedArgs?: string;
374
+ }) => void;
341
375
  }
342
376
  /** Result from a handoff operation. */
343
377
  export interface HandoffResult {
@@ -755,13 +789,16 @@ export declare class AgentSession {
755
789
  /** All messages including custom types like BashExecutionMessage */
756
790
  get messages(): AgentMessage[];
757
791
  get transcriptPromptGeneration(): number;
792
+ static restoreFromMemoryGuardCheckpoint(input: AgentSessionMemoryGuardRestoreInput): Promise<AgentMemoryGuardRestoreResult>;
758
793
  /** The immutable recovery authority, present only before external ownership promotion. */
759
794
  get recoveryHydrationContext(): RecoveryHydrationContext | undefined;
760
795
  /** Enables normal session mutations after the owner has published its durable fence and writer lease. */
761
- promoteRecoveryHydrationAfterOwnershipReadyFence(fence: RecoveryHydrationPromotionFence): Promise<void>;
796
+ promoteRecoveryHydrationAfterOwnershipReadyFence(fence: AgentMemoryGuardPromotionFence): Promise<void>;
762
797
  /** Main startup calls this exactly once, after a strict open returned `kind: "opened"`. */
763
798
  continuePersistedHistory(): Promise<void>;
764
799
  buildDisplaySessionContext(): SessionContext;
800
+ /** Build display context from an unpublished successor without changing active session state. @internal */
801
+ buildPreparedDisplaySessionContext(prepared: PreparedNewSession): SessionContext;
765
802
  /** Convert session messages using the same pre-LLM pipeline as the active session. */
766
803
  convertMessagesToLlm(messages: AgentMessage[], signal?: AbortSignal): Promise<Message[]>;
767
804
  /** Apply session-level stream hooks to a direct side request. */
@@ -785,7 +822,7 @@ export declare class AgentSession {
785
822
  /** Live SDK configuration values exposed through the session query surface. */
786
823
  getSdkConfigItems(): Record<string, string>;
787
824
  setPlanModeState(state: PlanModeState | undefined): void;
788
- invokeSkill(name: string, args?: string): Promise<{
825
+ invokeSkill(name: string, args?: string, options?: Pick<PromptOptions, "onPreflightAccepted" | "onPreflightAcceptCommit" | "onSkillPrepared">): Promise<{
789
826
  name: string;
790
827
  path: string;
791
828
  args?: string;
@@ -793,13 +830,7 @@ export declare class AgentSession {
793
830
  }>;
794
831
  setSdkPlanMode(on: boolean): Promise<PlanModeState | undefined>;
795
832
  operateGoal(op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string): Promise<unknown>;
796
- getTranscript(): Array<{
797
- id: string;
798
- role: string;
799
- textSummary: string;
800
- ts: string;
801
- body: string;
802
- }>;
833
+ getTranscript(): ExtensionTranscriptEntry[];
803
834
  getTranscriptBody(entryId: string): string | undefined;
804
835
  getGoalModeState(): GoalModeState | undefined;
805
836
  setGoalModeState(state: GoalModeState | undefined): void;
@@ -846,7 +877,7 @@ export declare class AgentSession {
846
877
  * @throws Error if no model selected or no API key available (when not streaming)
847
878
  */
848
879
  prompt(text: string, options?: PromptOptions): Promise<void>;
849
- promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy">): Promise<void>;
880
+ promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "onPreflightAccepted" | "onPreflightAcceptCommit">): Promise<void>;
850
881
  /**
851
882
  * Queue a steering message to interrupt the agent mid-run.
852
883
  */
@@ -886,6 +917,7 @@ export declare class AgentSession {
886
917
  sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
887
918
  deliverAs?: "steer" | "followUp";
888
919
  onPreflightAccepted?: () => void;
920
+ onPreflightAcceptCommit?: () => void | Promise<void>;
889
921
  }): Promise<void>;
890
922
  /**
891
923
  * Clear queued messages and return them.
@@ -988,6 +1020,8 @@ export declare class AgentSession {
988
1020
  }): Promise<void>;
989
1021
  setActiveModelProfile(name: string | undefined): void;
990
1022
  getActiveModelProfile(): string | undefined;
1023
+ /** Activate a complete model profile through a nonvisual session control. */
1024
+ activateModelProfileForControl(profileName: string): Promise<boolean>;
991
1025
  /** Return the persisted configured fallback selectors for a model role. */
992
1026
  getConfiguredModelChain(role: string): readonly string[] | undefined;
993
1027
  /** Persist the configured fallback selectors for a model role. */
@@ -1067,20 +1101,16 @@ export declare class AgentSession {
1067
1101
  * Get all available models with valid API keys.
1068
1102
  */
1069
1103
  getAvailableModels(): Model[];
1070
- /**
1071
- * Set thinking level.
1072
- * Saves the effective metadata-clamped level to the session, and to settings when requested.
1073
- */
1074
1104
  setThinkingLevel(level: ThinkingLevel | undefined, persist?: boolean): void;
1075
1105
  /**
1076
- * Set thinking level from a control surface. Global changes are durable or rolled back.
1106
+ * Set thinking level from a control surface. Global changes commit before affecting live state.
1077
1107
  */
1078
1108
  setThinkingLevelForControl(level: ThinkingLevel, persist: boolean): Promise<void>;
1079
1109
  getThinkingScopeForControl(): "session" | "global config";
1080
1110
  getThinkingVisibility(): "visible" | "hidden";
1081
1111
  setThinkingVisibility(visibility: "visible" | "hidden", persist?: boolean): void;
1082
1112
  /**
1083
- * Set thinking visibility from a control surface. Global changes are durable or rolled back.
1113
+ * Set thinking visibility from a control surface. Global changes commit before affecting live state.
1084
1114
  */
1085
1115
  setThinkingVisibilityForControl(visibility: "visible" | "hidden", persist: boolean): Promise<void>;
1086
1116
  /**
@@ -1318,7 +1348,9 @@ export declare class AgentSession {
1318
1348
  * Listeners are preserved and will continue receiving events.
1319
1349
  * @returns true if switch completed, false if cancelled by hook
1320
1350
  */
1321
- switchSession(sessionPath: string): Promise<boolean>;
1351
+ switchSession(sessionPath: string, options?: {
1352
+ transition?: SessionSwitchEvent["transition"];
1353
+ }): Promise<boolean>;
1322
1354
  /**
1323
1355
  * Create a branch from a specific entry.
1324
1356
  * Emits before_branch/branch session events to hooks.
@@ -47,8 +47,9 @@ export declare class FallbackChainController {
47
47
  onAttemptFailure(triggerClass: FallbackTriggerClass, reason: string): FallbackFailureResult;
48
48
  advance(): boolean;
49
49
  /**
50
- * Restore the entry that just advanced when credential rotation permits a retry.
51
- * The chain-wide budget and failure history remain charged.
50
+ * Restore the entry that just advanced for one attempt with a rotated credential.
51
+ * Each non-terminal entry may be restored once, so credential rotation remains
52
+ * bounded and cannot consume the attempts reserved for downstream entries.
52
53
  */
53
54
  restorePreviousEntryForRetry(): boolean;
54
55
  isExhausted(): boolean;
@@ -56,5 +57,20 @@ export declare class FallbackChainController {
56
57
  resetSticky(): void;
57
58
  }
58
59
  export declare function cappedExponentialWithFullJitter(baseDelayMs: number, maxDelayMs: number, attemptK: number, random?: () => number): number;
60
+ /**
61
+ * Legacy auto-compaction retry delay.
62
+ *
63
+ * Deliberately the mirror image of `effectiveFallbackDelay`: this path recovers
64
+ * Retry-After by regex over provider error prose (`#parseRetryAfterMsFromError`),
65
+ * so it follows the documented legacy rule — `retry.maxDelayMs` caps every
66
+ * legacy session retry delay, including provider retry-after hints. Managed
67
+ * fallback stays uncapped because it retries within its own per-entry budget;
68
+ * compaction has no such budget, so the final candidate would otherwise sleep
69
+ * for the full server-suggested duration.
70
+ *
71
+ * `maxDelayMs <= 0` means "no cap", matching `cappedExponentialWithFullJitter`.
72
+ * A missing, NaN, or infinite hint collapses to "no usable hint".
73
+ */
74
+ export declare function compactionRetryDelay(baseDelayMs: number, maxDelayMs: number, attempt: number, retryAfterMs: number | undefined): number;
59
75
  /** Retry-After is intentionally uncapped. */
60
76
  export declare function effectiveFallbackDelay(baseDelayMs: number, maxDelayMs: number, attemptK: number, retryAfterMs: number | undefined, random?: () => number): number;
@@ -121,12 +121,39 @@ export declare function ensureManagedScope(scope: ManagedScope, policy?: Managed
121
121
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
122
122
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
123
123
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
124
+ type DetachedArtifactRoot = {
125
+ originalPath: string;
126
+ detachedPath: string;
127
+ identity: {
128
+ dev: bigint;
129
+ ino: bigint;
130
+ size: bigint;
131
+ mtimeNs: bigint;
132
+ };
133
+ tree: NativeDirectoryTreeSnapshot;
134
+ };
124
135
  export declare function matchesMigrationArtifactRoot(pathname: string, identity: {
125
136
  dev: bigint;
126
137
  ino: bigint;
127
138
  size: bigint;
128
139
  mtimeNs: bigint;
129
140
  }, expectedTree: NativeDirectoryTreeSnapshot, platform?: NodeJS.Platform): boolean;
141
+ type SourceArtifactCleanup = {
142
+ state: "cleanup_pending";
143
+ role: "exchange_placeholder";
144
+ retainedPath: string;
145
+ identity: DetachedArtifactRoot["identity"];
146
+ tree: NativeDirectoryTreeSnapshot;
147
+ };
148
+ export declare function cleanupAuthorityMatches(cleanup: SourceArtifactCleanup, parent: string, platform?: NodeJS.Platform): boolean;
149
+ export declare function detachArtifactRootForMigration(plan: DetachedArtifactRoot, platform?: NodeJS.Platform): {
150
+ detached: DetachedArtifactRoot;
151
+ detachOutcome: "clean";
152
+ } | {
153
+ detached: DetachedArtifactRoot;
154
+ detachOutcome: "cleanup_pending";
155
+ cleanup: SourceArtifactCleanup;
156
+ };
130
157
  export declare function restorePreparedArtifactRoot(scope: ManagedScope, source: ManagedCandidate, lock?: ManagedStorageLock): void;
131
158
  /** Resume tombstoned cleanup under its original operation lease without restoring retired candidates. */
132
159
  export declare function reconcileManagedTombstones(scope: ManagedScope, expectedCandidate?: ManagedCandidate): Promise<void>;
@@ -0,0 +1,69 @@
1
+ import type { RecoveryFsRoot } from "@gajae-code/natives";
2
+ import type { RecoveryHydrationContext, ResumeSessionIdentity, SessionDestinationInput, SessionManager, SessionManagerCheckpointRevisionStrings, StrictSessionOpenFailure } from "./session-manager";
3
+ export interface MemoryGuardTranscriptDescriptorV1 {
4
+ bytes: string;
5
+ relative_path: string;
6
+ sha256: string;
7
+ }
8
+ export interface MemoryGuardCheckpointBlobAuthorityV1 {
9
+ kind: "checkpoint_blob_tree_v1";
10
+ manifest_relative_path: string;
11
+ manifest_sha256: string;
12
+ root_relative_path: string;
13
+ }
14
+ export interface MemoryGuardCheckpointBlobManifestEntryV1 {
15
+ bytes: string;
16
+ relative_path: string;
17
+ sha256: string;
18
+ }
19
+ export interface MemoryGuardCheckpointBlobManifestV1 {
20
+ entries: MemoryGuardCheckpointBlobManifestEntryV1[];
21
+ schema_version: 1;
22
+ }
23
+ export interface MemoryGuardSessionManagerCheckpointV1 {
24
+ blob_authority: MemoryGuardCheckpointBlobAuthorityV1;
25
+ revisions: SessionManagerCheckpointRevisionStrings;
26
+ schema_version: 1;
27
+ session_id: string;
28
+ session_name: string | null;
29
+ transcript: MemoryGuardTranscriptDescriptorV1;
30
+ }
31
+ export interface MemoryGuardParticipantDescriptorV1 {
32
+ ordinal: number;
33
+ checkpoint: MemoryGuardCheckpointBlobAuthorityV1;
34
+ revisions: SessionManagerCheckpointRevisionStrings;
35
+ session_id: string;
36
+ session_name: string | null;
37
+ transcript: MemoryGuardTranscriptDescriptorV1;
38
+ }
39
+ export interface MemoryGuardParticipantIngressLease {
40
+ readonly token: symbol;
41
+ release(): void;
42
+ }
43
+ export interface MemoryGuardCreateCheckpointInput {
44
+ ingressLease: MemoryGuardParticipantIngressLease;
45
+ checkpointRoot: string;
46
+ }
47
+ export type MemoryGuardRestoreBlockedReason = StrictSessionOpenFailure["reason"] | "checkpoint-mismatch" | "participant-mismatch" | "transcript-mismatch" | "blob-manifest-mismatch" | "blob-missing" | "blob-hash-mismatch" | "blob-authority-mismatch" | "destination-unavailable";
48
+ export interface MemoryGuardRestoreInput {
49
+ incidentAuthority: RecoveryFsRoot;
50
+ participant: MemoryGuardParticipantDescriptorV1;
51
+ checkpoint: MemoryGuardSessionManagerCheckpointV1;
52
+ destination: SessionDestinationInput;
53
+ }
54
+ export type MemoryGuardRestoreResult = {
55
+ kind: "staged";
56
+ manager: SessionManager;
57
+ hydrationContext: RecoveryHydrationContext;
58
+ transcriptIdentity: ResumeSessionIdentity;
59
+ cleanup: () => Promise<void>;
60
+ } | {
61
+ kind: "blocked";
62
+ reason: MemoryGuardRestoreBlockedReason;
63
+ };
64
+ export declare function memoryGuardCanonicalJson(value: unknown): string;
65
+ export declare function memoryGuardSha256Hex(value: Uint8Array | string): string;
66
+ export declare function isMemoryGuardDecimalString(value: unknown): value is string;
67
+ export declare function isMemoryGuardSha256Hex(value: unknown): value is string;
68
+ export declare function isMemoryGuardRelativePath(value: unknown): value is string;
69
+ export declare function hasOnlyKeys(value: Record<string, unknown>, allowed: readonly string[]): boolean;
@@ -8,6 +8,7 @@ import { ArtifactManager } from "./artifacts";
8
8
  import { type BlobPutResult, BlobStore } from "./blob-store";
9
9
  import { type ManagedMigrationPolicy } from "./internal/managed-session-scope";
10
10
  import { type ManagedDirectoryRoot, ManagedSessionDescendantStore } from "./internal/managed-session-storage";
11
+ import { type MemoryGuardCreateCheckpointInput, type MemoryGuardParticipantIngressLease, type MemoryGuardRestoreInput, type MemoryGuardRestoreResult, type MemoryGuardSessionManagerCheckpointV1 } from "./memory-guard-checkpoint-participant";
11
12
  import { type BashExecutionMessage, type CustomMessage, type FileMentionMessage, type HookMessage, type PythonExecutionMessage } from "./messages";
12
13
  import { type SessionManagerReadAccess, sessionManagerReadCapability } from "./session-manager-internal";
13
14
  import type { ManagedSessionSecurityContext, SessionStorage, SessionStorageStat, VerifiedSessionDeleteResult, VerifiedSessionDeleteTarget } from "./session-storage";
@@ -27,6 +28,13 @@ export interface NewSessionOptions {
27
28
  /** Skip flushing the current session and delete it instead of saving. */
28
29
  drop?: boolean;
29
30
  }
31
+ /** Internal successor prepared without changing the manager's visible identity. */
32
+ export interface PreparedNewSession {
33
+ readonly sessionId: string;
34
+ readonly sessionFile: string | undefined;
35
+ readonly artifactsDir: string | null;
36
+ readonly managedLegacyLocalMigrationSource: ManagedLegacyLocalMigrationSource | null;
37
+ }
30
38
  export interface SessionEntryBase {
31
39
  type: string;
32
40
  id: string;
@@ -252,6 +260,21 @@ export type DefaultModelSelectionStage = {
252
260
  readonly tempPath: string | undefined;
253
261
  readonly persistsToExistingFile: boolean;
254
262
  };
263
+ export interface SessionManagerRevisionSnapshot {
264
+ entry: number;
265
+ leaf: number;
266
+ headerExport: number;
267
+ label: number;
268
+ replayMetadata: number;
269
+ }
270
+ export interface SessionManagerCheckpointRevisionStrings {
271
+ entry: string;
272
+ leaf: string;
273
+ headerExport: string;
274
+ label: string;
275
+ replayMetadata: string;
276
+ }
277
+ export declare function toSessionManagerCheckpointRevisionStrings(snapshot: SessionManagerRevisionSnapshot): SessionManagerCheckpointRevisionStrings;
255
278
  export type DefaultModelSelectionPromotion = {
256
279
  readonly kind: "promoted";
257
280
  } | {
@@ -534,6 +557,10 @@ export declare function residentBlobSentinelForTests(kind: ResidentBlobKind, ref
534
557
  export declare function materializeResidentEntriesForPersistenceForTests<T>(entries: T[], textStore: BlobStore, imageStore?: BlobStore): T[];
535
558
  /** Get recent sessions for display in welcome screen */
536
559
  export declare function getRecentSessions(sessionDir: string, limit?: number, storage?: SessionStorage): Promise<RecentSessionInfo[]>;
560
+ export declare function getRecentSessionDisplay(sessions: readonly SessionInfo[], limit?: number): Array<{
561
+ name: string;
562
+ timeAgo: string;
563
+ }>;
537
564
  /**
538
565
  * Manages conversation sessions as append-only trees stored in JSONL files.
539
566
  *
@@ -582,13 +609,7 @@ export declare class SessionManager {
582
609
  * revision contract). Tests assert the invalidation mapping through this;
583
610
  * future export/label-view caches key off their respective domains.
584
611
  */
585
- revisionSnapshot(): {
586
- entry: number;
587
- leaf: number;
588
- headerExport: number;
589
- label: number;
590
- replayMetadata: number;
591
- };
612
+ revisionSnapshot(): SessionManagerRevisionSnapshot;
592
613
  /** Puts a binary blob into the blob store and returns the blob reference */
593
614
  putBlob(data: Buffer): Promise<BlobPutResult>;
594
615
  captureState(): SessionManagerStateSnapshot;
@@ -597,6 +618,33 @@ export declare class SessionManager {
597
618
  setSessionFile(sessionFile: string): Promise<void>;
598
619
  /** Start a new session. Closes any existing writer first. */
599
620
  newSession(options?: NewSessionOptions): Promise<string | undefined>;
621
+ /**
622
+ * Allocate a fresh successor without publishing it through the manager's public
623
+ * getters. The returned authority is deliberately immutable so readiness work
624
+ * can resolve local:// against the successor while the predecessor stays live.
625
+ * @internal
626
+ */
627
+ prepareNewSession(options?: NewSessionOptions): Promise<PreparedNewSession>;
628
+ /** Append a model selection to an unpublished successor. @internal */
629
+ appendPreparedModelChange(prepared: PreparedNewSession, model: string): string;
630
+ /** Append a thinking-level selection to an unpublished successor. @internal */
631
+ appendPreparedThinkingLevelChange(prepared: PreparedNewSession, thinkingLevel?: string): string;
632
+ /** Append a service-tier selection to an unpublished successor. @internal */
633
+ appendPreparedServiceTierChange(prepared: PreparedNewSession, serviceTier: ServiceTier | null): string;
634
+ /** Append a displayable custom message to an unpublished successor. @internal */
635
+ appendPreparedCustomMessageEntry<T = unknown>(prepared: PreparedNewSession, customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details?: T, attribution?: MessageAttribution): string;
636
+ /** Persist an unpublished successor without adopting it. @internal */
637
+ ensurePreparedNewSessionOnDisk(prepared: PreparedNewSession): Promise<void>;
638
+ /** Build context from an unpublished successor without reading active manager state. @internal */
639
+ buildPreparedNewSessionContext(prepared: PreparedNewSession): SessionContext;
640
+ /** Prepare a forked successor without publishing it through public manager state. @internal */
641
+ prepareFork(): Promise<PreparedNewSession | undefined>;
642
+ /** Prepare a path-only branch successor without publishing it through public manager state. @internal */
643
+ prepareBranchedSession(leafId: string): Promise<PreparedNewSession>;
644
+ /** Publish a prepared successor synchronously after all readiness awaits succeed. @internal */
645
+ commitPreparedNewSession(prepared: PreparedNewSession): void;
646
+ /** Exact-discard only an uncommitted successor prepared by this manager. @internal */
647
+ discardPreparedNewSession(prepared: PreparedNewSession): Promise<void>;
600
648
  /** Tombstone and exact-delete managed transcripts, detaching the active transcript first. */
601
649
  dropSession(sessionPath: string): Promise<void>;
602
650
  /**
@@ -657,6 +705,8 @@ export declare class SessionManager {
657
705
  listForResumePickerReadOnly(): Promise<SessionInfo[]>;
658
706
  getSessionId(): string;
659
707
  getSessionFile(): string | undefined;
708
+ acquireMemoryGuardParticipantIngressLease(): MemoryGuardParticipantIngressLease;
709
+ createMemoryGuardCheckpoint(input: MemoryGuardCreateCheckpointInput): Promise<MemoryGuardSessionManagerCheckpointV1>;
660
710
  /**
661
711
  * Returns the session artifacts directory path (session file path without .jsonl).
662
712
  * Returns null when the session is not persisted to a file.
@@ -713,11 +763,6 @@ export declare class SessionManager {
713
763
  /** The source that set the session name: "user" (manual /rename or RPC) or "auto" (generated title). */
714
764
  get titleSource(): "auto" | "user" | undefined;
715
765
  getSessionName(): string | undefined;
716
- /**
717
- * Set the session display name.
718
- * @param source - "user" for explicit renames (/rename command, RPC); "auto" for generated titles.
719
- * Auto-generated titles are silently ignored when the user has already set a name.
720
- */
721
766
  setSessionName(name: string, source?: "auto" | "user"): Promise<boolean>;
722
767
  _persist(entry: SessionEntry): void;
723
768
  /** Append a configured fallback chain as child of current leaf, then advance leaf. Returns entry id. */
@@ -937,7 +982,7 @@ export declare class SessionManager {
937
982
  * legacy sibling directories.
938
983
  */
939
984
  static listForResumePickerReadOnly(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionInfo[]>;
940
- /** Tombstone and exact-delete a default-managed candidate. */
985
+ /** Delete an authorized managed or project-local picker candidate. */
941
986
  static deleteManagedCandidate(sessionPath: string): Promise<void>;
942
987
  /** Capture exact source content for a strict fork without granting write ownership. */
943
988
  static captureTranscriptStrict(filePath: string, storage?: SessionStorage): StrictSessionCaptureResult;
@@ -947,6 +992,7 @@ export declare class SessionManager {
947
992
  * persistence; destination history always comes from the captured bytes.
948
993
  */
949
994
  static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, destinationInput?: SessionDestinationInput, _migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionForkResult>;
995
+ static restoreMemoryGuardCheckpoint(input: MemoryGuardRestoreInput): Promise<MemoryGuardRestoreResult>;
950
996
  /** Inspect a selected session without acquiring write-capable ownership. */
951
997
  static inspectSessionTailReadOnly(filePath: string, storage?: SessionStorage): Promise<ResumeTailInspection>;
952
998
  /**
@@ -83,7 +83,10 @@ export interface TruncationResult {
83
83
  elidedLines?: number;
84
84
  lastLinePartial?: boolean;
85
85
  firstLineExceedsLimit?: boolean;
86
+ lastLineExceedsLimit?: boolean;
86
87
  }
88
+ /** Direction vocabulary used by callers that select which end of content to retain. */
89
+ export type TruncationDirection = "head" | "last" | "both";
87
90
  export interface TruncationOptions {
88
91
  /** Maximum number of lines (default: 3000) */
89
92
  maxLines?: number;
@@ -99,6 +102,8 @@ export interface TruncationOptions {
99
102
  * window receives `maxLines - maxHeadLines`. Default `floor(maxLines/2)`.
100
103
  */
101
104
  maxHeadLines?: number;
105
+ /** Direction to dispatch through truncateContent (head, last, or both). */
106
+ direction?: TruncationDirection;
102
107
  }
103
108
  /** Result from byte-level truncation helpers. */
104
109
  export interface ByteTruncationResult {
@@ -155,14 +160,64 @@ export declare function truncateTail(content: string, options?: TruncationOption
155
160
  */
156
161
  export declare function formatMiddleElisionMarker(elidedLines: number, elidedBytes: number): string;
157
162
  /**
158
- * Truncate content keeping a head window and a tail window, eliding the middle.
163
+ * A retained source segment returned by {@link truncateMiddleWindows}.
164
+ * Line coordinates are 1-indexed and inclusive.
165
+ */
166
+ export type ReadSegment = {
167
+ kind: "lines";
168
+ content: string;
169
+ lines: number;
170
+ bytes: number;
171
+ origin: {
172
+ startLine: number;
173
+ endLine: number;
174
+ };
175
+ lastLinePartial: false;
176
+ } | {
177
+ kind: "partial-line";
178
+ content: string;
179
+ lines: 1;
180
+ bytes: number;
181
+ origin: {
182
+ startLine: number;
183
+ endLine: number;
184
+ };
185
+ sourceLineBytes: number;
186
+ lastLinePartial: true;
187
+ };
188
+ /** The actual windows retained by middle truncation. */
189
+ export interface ReadWindow {
190
+ kind: "full" | "head-only" | "tail-only" | "middle";
191
+ head?: ReadSegment;
192
+ tail?: ReadSegment;
193
+ overlap: "disjoint" | "adjacent" | "overlapping";
194
+ elidedLines: number;
195
+ elidedBytes: number;
196
+ totalLines: number;
197
+ totalBytes: number;
198
+ /** @deprecated Non-enumerable compatibility reason for older consumers. */
199
+ truncatedBy?: "lines" | "bytes" | "middle";
200
+ }
201
+ /**
202
+ * Truncate content while exposing the exact retained head/tail windows.
159
203
  *
160
- * The combined output is `<head>\n<marker>\n<tail>` when truncation is needed.
161
- * `maxHeadBytes` defaults to `floor(maxBytes / 2)`; the tail receives the
162
- * remainder. Falls back to `truncateTail` / `truncateHead` if either side's
163
- * budget is empty or the content already fits.
204
+ * The budget split and fallback ordering intentionally mirror truncateMiddle.
205
+ * The overlap classification is performed before resolving an overlap to a
206
+ * full window, so callers can distinguish disjoint, adjacent and overlapping
207
+ * candidate windows even when no marker is needed.
208
+ */
209
+ export declare function truncateMiddleWindows(content: string, options?: TruncationOptions): ReadWindow;
210
+ /**
211
+ * Truncate content keeping a head window and a tail window, eliding the middle.
212
+ * The composed return shape remains field-for-field compatible with the
213
+ * historical implementation; callers that need coordinates use
214
+ * truncateMiddleWindows directly.
164
215
  */
165
216
  export declare function truncateMiddle(content: string, options?: TruncationOptions): TruncationResult;
217
+ /**
218
+ * Dispatch truncation using the caller-facing direction vocabulary.
219
+ */
220
+ export declare function truncateContent(content: string, options?: TruncationOptions): TruncationResult;
166
221
  export declare class TailBuffer {
167
222
  #private;
168
223
  readonly maxBytes: number;
@@ -45,8 +45,6 @@ export interface SkillActiveEntry {
45
45
  handoff_at?: string;
46
46
  active_subskills?: ActiveSubskillEntry[];
47
47
  source_state_revision?: number;
48
- /** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
49
- committed_mode_state_revision?: number;
50
48
  }
51
49
  export interface SkillActiveState {
52
50
  version?: number;
@@ -87,8 +85,6 @@ export interface SyncSkillActiveStateOptions {
87
85
  handoff_at?: string;
88
86
  active_subskills?: ActiveSubskillEntry[];
89
87
  sourceRevision?: number;
90
- /** Durable ordering token from the source workflow mode-state, not this cache file's revision. */
91
- committedModeRevision?: number;
92
88
  }
93
89
  export declare function normalizeWorkflowHudSummary(raw: unknown): WorkflowHudSummary | undefined;
94
90
  export declare function isCanonicalGjcWorkflowSkill(skill: string): skill is CanonicalGjcWorkflowSkill;
@@ -20,6 +20,9 @@ interface RalplanHudState extends WorkflowGateHudState {
20
20
  iteration?: number;
21
21
  iterationFromIndex?: number;
22
22
  stages?: string;
23
+ architectPasses?: number;
24
+ criticPasses?: number;
25
+ reviewPassBudget?: number;
23
26
  verdict?: string;
24
27
  latestSummary?: string;
25
28
  pendingApproval?: boolean;
@@ -20,6 +20,7 @@ import type { ContextFileEntry } from "../tools";
20
20
  import type { EventBus } from "../utils/event-bus";
21
21
  import type { WorkspaceTree } from "../workspace-tree";
22
22
  import { type AgentDefinition, type AgentProgress, type ReviewFinding, type SingleResult } from "./types";
23
+ import { type ExecutorExecutionMode } from "./ultragoal-redteam-activation";
23
24
  export declare function trimForkContextSeedForModel(seed: ForkContextSeed, model: Model | undefined): ForkContextSeed;
24
25
  /** Options for subagent execution */
25
26
  export interface ExecutorOptions {
@@ -28,6 +29,11 @@ export interface ExecutorOptions {
28
29
  agent: AgentDefinition;
29
30
  task: string;
30
31
  assignment?: string;
32
+ /**
33
+ * Typed executor execution mode. When set, overrides assignment-text heuristics
34
+ * for ultragoal red-team prompt injection (#2698 / #2456).
35
+ */
36
+ executionMode?: ExecutorExecutionMode;
31
37
  context?: string;
32
38
  description?: string;
33
39
  index: number;