@gajae-code/coding-agent 0.18.6 → 0.18.8

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 (302) hide show
  1. package/CHANGELOG.md +318 -1
  2. package/dist/types/async/job-manager.d.ts +1 -1
  3. package/dist/types/capability/mcp.d.ts +2 -0
  4. package/dist/types/capability/skill.d.ts +2 -0
  5. package/dist/types/capability/types.d.ts +6 -0
  6. package/dist/types/cli/public-command-errors.d.ts +3 -1
  7. package/dist/types/cli/setup-cli.d.ts +1 -1
  8. package/dist/types/commands/deep-interview.d.ts +3 -0
  9. package/dist/types/config/autorouting-tier-map.d.ts +348 -9
  10. package/dist/types/config/file-lock.d.ts +1 -0
  11. package/dist/types/config/model-bindings-applier.d.ts +2 -0
  12. package/dist/types/config/model-profile-activation.d.ts +11 -3
  13. package/dist/types/config/model-registry.d.ts +4 -9
  14. package/dist/types/config/settings.d.ts +4 -0
  15. package/dist/types/config/skill-settings-defaults.d.ts +2 -0
  16. package/dist/types/cursor-delete-path.d.ts +1 -0
  17. package/dist/types/cursor-mcp-name.d.ts +8 -0
  18. package/dist/types/customization/inventory.d.ts +2 -0
  19. package/dist/types/debug/report-bundle-parent.d.ts +2 -0
  20. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.d.ts +1 -0
  21. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.d.ts +31 -0
  22. package/dist/types/defaults/gjc-skills.generated.d.ts +5 -6
  23. package/dist/types/discovery/helpers.d.ts +8 -3
  24. package/dist/types/export/html/css-color.d.ts +2 -0
  25. package/dist/types/export/html/template.generated.d.ts +1 -1
  26. package/dist/types/extensibility/extensions/types.d.ts +7 -0
  27. package/dist/types/extensibility/gjc-plugins/runtime-adapters.d.ts +14 -1
  28. package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
  29. package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
  30. package/dist/types/extensibility/runtime-skill-discovery.d.ts +3 -1
  31. package/dist/types/extensibility/skill-management.d.ts +3 -1
  32. package/dist/types/extensibility/skills.d.ts +2 -0
  33. package/dist/types/gjc-runtime/deep-interview-crystallize.d.ts +74 -0
  34. package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +11 -0
  35. package/dist/types/gjc-runtime/gc-runtime.d.ts +5 -0
  36. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +0 -5
  37. package/dist/types/gjc-runtime/state-argv.d.ts +1 -1
  38. package/dist/types/gjc-runtime/state-migrations.d.ts +8 -0
  39. package/dist/types/gjc-runtime/state-runtime.d.ts +95 -0
  40. package/dist/types/gjc-runtime/state-writer.d.ts +11 -1
  41. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +8 -0
  42. package/dist/types/internal-urls/skill-path.d.ts +1 -0
  43. package/dist/types/lsp/workspace-path.d.ts +1 -0
  44. package/dist/types/modes/acp/acp-agent.d.ts +7 -0
  45. package/dist/types/modes/components/custom-editor.d.ts +6 -0
  46. package/dist/types/modes/components/customization/customization-dashboard.d.ts +1 -0
  47. package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
  48. package/dist/types/modes/controllers/input-controller.d.ts +9 -0
  49. package/dist/types/modes/interactive-mode.d.ts +1 -0
  50. package/dist/types/modes/utils/interrupt-ownership.d.ts +3 -0
  51. package/dist/types/modes/utils/keybinding-matchers.d.ts +1 -0
  52. package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
  53. package/dist/types/progress/collect-project-progress.d.ts +38 -0
  54. package/dist/types/progress/progress-contract.d.ts +154 -0
  55. package/dist/types/progress/progress-snapshot.d.ts +11 -0
  56. package/dist/types/progress/project-progress.d.ts +141 -0
  57. package/dist/types/progress/render-progress.d.ts +28 -0
  58. package/dist/types/runtime-mcp/elicitation.d.ts +12 -0
  59. package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
  60. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
  61. package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
  62. package/dist/types/runtime-mcp/types.d.ts +6 -0
  63. package/dist/types/sdk/acp/adapter.d.ts +1 -1
  64. package/dist/types/sdk/broker/broker-exit.d.ts +6 -2
  65. package/dist/types/sdk/broker/broker.d.ts +18 -1
  66. package/dist/types/sdk/broker/lifecycle.d.ts +9 -0
  67. package/dist/types/sdk/broker/session-index.d.ts +12 -6
  68. package/dist/types/sdk/broker/task-artifact-owner-validation.d.ts +55 -0
  69. package/dist/types/sdk/bus/index.d.ts +12 -1
  70. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -1
  71. package/dist/types/sdk/bus/telegram-daemon.d.ts +3 -2
  72. package/dist/types/sdk/client/client.d.ts +2 -0
  73. package/dist/types/sdk/host/host.d.ts +6 -0
  74. package/dist/types/sdk/host/query/handlers.d.ts +3 -0
  75. package/dist/types/sdk/index.d.ts +1 -0
  76. package/dist/types/sdk/router/session-router.d.ts +9 -0
  77. package/dist/types/sdk/session-list.d.ts +1 -1
  78. package/dist/types/sdk/session.d.ts +8 -0
  79. package/dist/types/session/agent-session.d.ts +38 -9
  80. package/dist/types/session/artifacts.d.ts +2 -2
  81. package/dist/types/session/internal/managed-gc-retirement-codec.d.ts +32 -0
  82. package/dist/types/session/internal/managed-session-scope.d.ts +79 -2
  83. package/dist/types/session/internal/managed-session-storage.d.ts +36 -1
  84. package/dist/types/session/internal/managed-task-owner-cleanup.d.ts +62 -0
  85. package/dist/types/session/internal/task-artifact-owner-access.d.ts +19 -0
  86. package/dist/types/session/internal/task-artifact-owner-transcript.d.ts +11 -0
  87. package/dist/types/session/session-manager.d.ts +31 -5
  88. package/dist/types/session/session-retirement.d.ts +71 -0
  89. package/dist/types/session/session-storage.d.ts +62 -48
  90. package/dist/types/session/session-transcript-header.d.ts +2 -0
  91. package/dist/types/session/task-artifact-owner-codec.d.ts +109 -0
  92. package/dist/types/session/task-artifact-owner-retirement.d.ts +7 -0
  93. package/dist/types/session/task-artifact-owner.d.ts +10 -0
  94. package/dist/types/setup/credential-auto-import.d.ts +1 -1
  95. package/dist/types/setup/credential-import.d.ts +6 -4
  96. package/dist/types/skill-state/active-state.d.ts +38 -0
  97. package/dist/types/slash-commands/helpers/progress-report.d.ts +8 -0
  98. package/dist/types/task/executor.d.ts +3 -0
  99. package/dist/types/tools/bash-skill-urls.d.ts +1 -1
  100. package/dist/types/tools/index.d.ts +3 -0
  101. package/dist/types/tools/python.d.ts +9 -1
  102. package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
  103. package/dist/types/tools/restricted-cwd.d.ts +1 -0
  104. package/dist/types/tools/todo-write.d.ts +6 -0
  105. package/dist/types/utils/tools-checksum.d.ts +7 -0
  106. package/package.json +7 -7
  107. package/scripts/generate-sdk-operation-inventory.ts +21 -0
  108. package/scripts/resident-memory-bench.ts +174 -20
  109. package/scripts/verify-managed-empty-stop.ts +28 -0
  110. package/src/async/job-manager.ts +228 -122
  111. package/src/capability/index.ts +18 -0
  112. package/src/capability/mcp.ts +2 -0
  113. package/src/capability/skill.ts +2 -0
  114. package/src/capability/types.ts +6 -0
  115. package/src/cli/auth-broker-cli.ts +1 -1
  116. package/src/cli/config-cli.ts +8 -18
  117. package/src/cli/customize-doctor.ts +15 -2
  118. package/src/cli/public-command-errors.ts +21 -1
  119. package/src/cli/setup-cli.ts +4 -4
  120. package/src/cli/skills-cli.ts +5 -0
  121. package/src/cli-main.ts +7 -8
  122. package/src/commands/deep-interview.ts +47 -8
  123. package/src/commands/sdk.ts +140 -29
  124. package/src/config/autorouting-tier-map.ts +117 -7
  125. package/src/config/file-lock.ts +307 -68
  126. package/src/config/mcp-schema.json +4 -0
  127. package/src/config/model-bindings-applier.ts +20 -0
  128. package/src/config/model-profile-activation.ts +240 -46
  129. package/src/config/model-registry.ts +47 -153
  130. package/src/config/settings.ts +44 -4
  131. package/src/config/skill-settings-defaults.ts +7 -0
  132. package/src/coordinator-mcp/policy.ts +3 -2
  133. package/src/cursor-delete-path.ts +10 -0
  134. package/src/cursor-mcp-name.ts +15 -0
  135. package/src/cursor.ts +13 -2
  136. package/src/customization/inventory.ts +3 -0
  137. package/src/debug/report-bundle-parent.ts +22 -0
  138. package/src/debug/report-bundle.ts +3 -0
  139. package/src/debug/system-info.ts +13 -1
  140. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.ts +67 -4
  141. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.ts +80 -0
  142. package/src/defaults/gjc/skills/deep-interview/SKILL.md +105 -10
  143. package/src/defaults/gjc/skills/ralplan/SKILL.md +6 -4
  144. package/src/defaults/gjc-defaults.test.ts +18 -1
  145. package/src/defaults/gjc-defaults.ts +3 -0
  146. package/src/defaults/gjc-skills.generated.ts +58 -36
  147. package/src/discovery/agents.ts +6 -1
  148. package/src/discovery/builtin.ts +10 -0
  149. package/src/discovery/helpers.ts +168 -23
  150. package/src/discovery/mcp-json.ts +6 -0
  151. package/src/discovery/ssh.ts +9 -4
  152. package/src/discovery/substitute-plugin-root.ts +3 -1
  153. package/src/edit/file-read-cache.ts +1 -1
  154. package/src/eval/py/executor.ts +380 -120
  155. package/src/export/html/css-color.ts +9 -0
  156. package/src/export/html/index.ts +5 -4
  157. package/src/export/html/template.generated.ts +1 -1
  158. package/src/extensibility/extensions/runner.ts +4 -0
  159. package/src/extensibility/extensions/types.ts +7 -0
  160. package/src/extensibility/gjc-plugins/runtime-adapters.ts +73 -8
  161. package/src/extensibility/plugins/manager.ts +3 -2
  162. package/src/extensibility/plugins/marketplace/cache.ts +15 -0
  163. package/src/extensibility/plugins/marketplace/manager.ts +11 -3
  164. package/src/extensibility/plugins/plugin-link-path.ts +12 -0
  165. package/src/extensibility/runtime-skill-discovery.ts +20 -2
  166. package/src/extensibility/skill-management.ts +6 -2
  167. package/src/extensibility/skills.ts +6 -1
  168. package/src/gjc-runtime/deep-interview-crystallize.ts +1814 -0
  169. package/src/gjc-runtime/deep-interview-recorder.ts +20 -2
  170. package/src/gjc-runtime/deep-interview-runtime.ts +1415 -13
  171. package/src/gjc-runtime/deep-interview-stage.ts +98 -21
  172. package/src/gjc-runtime/gc-runtime.ts +206 -8
  173. package/src/gjc-runtime/launch-worktree.ts +14 -4
  174. package/src/gjc-runtime/ralplan-runtime.ts +447 -52
  175. package/src/gjc-runtime/state-argv.ts +2 -0
  176. package/src/gjc-runtime/state-migrations.ts +91 -29
  177. package/src/gjc-runtime/state-runtime.ts +3716 -135
  178. package/src/gjc-runtime/state-writer.ts +83 -8
  179. package/src/gjc-runtime/ultragoal-runtime.ts +16 -4
  180. package/src/gjc-runtime/workflow-manifest.generated.json +70 -42
  181. package/src/gjc-runtime/workflow-manifest.ts +54 -21
  182. package/src/harness-control-plane/operate.ts +12 -4
  183. package/src/harness-control-plane/owner.ts +5 -1
  184. package/src/hashline/parser.ts +48 -9
  185. package/src/hashline/recovery.ts +13 -4
  186. package/src/hindsight/config.ts +9 -3
  187. package/src/internal-urls/docs-index.generated.ts +19 -18
  188. package/src/internal-urls/skill-path.ts +19 -0
  189. package/src/internal-urls/skill-protocol.ts +2 -0
  190. package/src/lsp/edits.ts +6 -0
  191. package/src/lsp/workspace-path.ts +51 -0
  192. package/src/main.ts +195 -31
  193. package/src/modes/acp/acp-agent.ts +163 -7
  194. package/src/modes/components/custom-editor.ts +14 -0
  195. package/src/modes/components/customization/customization-dashboard.ts +12 -0
  196. package/src/modes/components/extensions/extension-dashboard.ts +2 -2
  197. package/src/modes/components/extensions/state-manager.ts +15 -5
  198. package/src/modes/components/model-selector.ts +1 -4
  199. package/src/modes/components/provider-onboarding-selector.ts +1 -1
  200. package/src/modes/components/status-line/segments.ts +4 -0
  201. package/src/modes/controllers/event-controller.ts +11 -4
  202. package/src/modes/controllers/input-controller.ts +74 -29
  203. package/src/modes/controllers/runtime-mcp-command-controller.ts +8 -3
  204. package/src/modes/controllers/selector-controller.ts +28 -15
  205. package/src/modes/interactive-mode.ts +4 -0
  206. package/src/modes/runtime-init.ts +4 -0
  207. package/src/modes/utils/abort-message.ts +3 -1
  208. package/src/modes/utils/interrupt-ownership.ts +12 -0
  209. package/src/modes/utils/keybinding-matchers.ts +4 -0
  210. package/src/modes/utils/macos-option-forwarding.ts +80 -0
  211. package/src/progress/collect-project-progress.ts +153 -0
  212. package/src/progress/progress-contract.ts +172 -0
  213. package/src/progress/progress-snapshot.ts +140 -0
  214. package/src/progress/project-progress.ts +446 -0
  215. package/src/progress/render-progress.ts +209 -0
  216. package/src/prompts/system/master-mode.md +1 -0
  217. package/src/prompts/tools/skill-discovery.md +1 -1
  218. package/src/runtime-mcp/client.ts +13 -4
  219. package/src/runtime-mcp/config-writer.ts +10 -6
  220. package/src/runtime-mcp/config.ts +1 -0
  221. package/src/runtime-mcp/elicitation.ts +142 -0
  222. package/src/runtime-mcp/oauth-flow.ts +5 -0
  223. package/src/runtime-mcp/oauth-public-url.ts +8 -0
  224. package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
  225. package/src/runtime-mcp/smithery-registry.ts +22 -3
  226. package/src/runtime-mcp/transports/http.ts +2 -2
  227. package/src/runtime-mcp/types.ts +6 -0
  228. package/src/sdk/acp/adapter.ts +93 -8
  229. package/src/sdk/broker/broker-exit.ts +52 -23
  230. package/src/sdk/broker/broker.ts +83 -7
  231. package/src/sdk/broker/ensure.ts +2 -0
  232. package/src/sdk/broker/lifecycle.ts +820 -73
  233. package/src/sdk/broker/session-index.ts +191 -81
  234. package/src/sdk/broker/task-artifact-owner-validation.ts +259 -0
  235. package/src/sdk/bus/chat-daemon-cli.ts +38 -1
  236. package/src/sdk/bus/chat-daemon-control.ts +2 -2
  237. package/src/sdk/bus/chat-daemon-runtime.ts +3 -0
  238. package/src/sdk/bus/index.ts +241 -46
  239. package/src/sdk/bus/telegram-daemon-contract.ts +6 -1
  240. package/src/sdk/bus/telegram-daemon.ts +4 -2
  241. package/src/sdk/cli/session-cli.ts +17 -3
  242. package/src/sdk/client/client.ts +28 -8
  243. package/src/sdk/host/host.ts +6 -0
  244. package/src/sdk/host/query/handlers.ts +9 -1
  245. package/src/sdk/host/session-runtime.test.ts +2805 -411
  246. package/src/sdk/host/session-runtime.ts +428 -111
  247. package/src/sdk/host/surface-policy.ts +1 -0
  248. package/src/sdk/index.ts +8 -0
  249. package/src/sdk/lifecycle-session.ts +3 -1
  250. package/src/sdk/mcp/server.ts +15 -3
  251. package/src/sdk/prompt-deadline-manager.ts +15 -0
  252. package/src/sdk/protocol/operation-inventory.generated.json +146 -0
  253. package/src/sdk/protocol/operation-registry.ts +9 -2
  254. package/src/sdk/router/session-router.ts +94 -14
  255. package/src/sdk/session-list.ts +1 -0
  256. package/src/sdk/session.ts +81 -38
  257. package/src/session/agent-session.ts +674 -224
  258. package/src/session/artifacts.ts +174 -70
  259. package/src/session/internal/managed-gc-retirement-codec.ts +319 -0
  260. package/src/session/internal/managed-session-scope.ts +3457 -462
  261. package/src/session/internal/managed-session-storage.ts +482 -61
  262. package/src/session/internal/managed-task-owner-cleanup.ts +473 -0
  263. package/src/session/internal/task-artifact-owner-access.ts +245 -0
  264. package/src/session/internal/task-artifact-owner-transcript.ts +614 -0
  265. package/src/session/session-manager.ts +939 -133
  266. package/src/session/session-retirement.ts +714 -0
  267. package/src/session/session-storage.ts +418 -174
  268. package/src/session/session-transcript-header.ts +17 -0
  269. package/src/session/task-artifact-owner-codec.ts +641 -0
  270. package/src/session/task-artifact-owner-retirement.ts +477 -0
  271. package/src/session/task-artifact-owner.ts +289 -0
  272. package/src/setup/credential-auto-import.ts +12 -3
  273. package/src/setup/credential-import.ts +176 -5
  274. package/src/setup/paseo/announce.ts +6 -1
  275. package/src/skill-state/active-state.ts +132 -2
  276. package/src/slash-commands/builtin-registry.ts +39 -9
  277. package/src/slash-commands/helpers/progress-report.ts +23 -0
  278. package/src/stt/setup.ts +3 -5
  279. package/src/task/commands.ts +3 -1
  280. package/src/task/executor.ts +4 -0
  281. package/src/task/index.ts +6 -0
  282. package/src/tools/ask.ts +205 -6
  283. package/src/tools/ast-edit.ts +4 -0
  284. package/src/tools/bash-allowed-prefixes.ts +15 -0
  285. package/src/tools/bash-skill-urls.ts +56 -3
  286. package/src/tools/bash.ts +48 -79
  287. package/src/tools/descriptors.ts +5 -1
  288. package/src/tools/eval.ts +56 -36
  289. package/src/tools/image-gen.ts +1 -1
  290. package/src/tools/index.ts +3 -0
  291. package/src/tools/python.ts +187 -66
  292. package/src/tools/recipe/index.ts +9 -0
  293. package/src/tools/recipe/recipe-guard.ts +19 -0
  294. package/src/tools/restricted-cwd.ts +10 -0
  295. package/src/tools/skill-discovery.ts +5 -0
  296. package/src/tools/skill.ts +28 -1
  297. package/src/tools/todo-write.ts +10 -1
  298. package/src/tools/tool-catalog.generated.ts +1 -1
  299. package/src/tools/write.ts +1 -0
  300. package/src/utils/tools-checksum.ts +34 -0
  301. package/src/utils/tools-manager.ts +24 -6
  302. package/src/web/search/providers/codex.ts +3 -2
@@ -51,6 +51,12 @@ declare const todoWriteSchema: z.ZodObject<{
51
51
  type TodoWriteParams = z.infer<typeof todoWriteSchema>;
52
52
  export declare const USER_TODO_EDIT_CUSTOM_TYPE = "user_todo_edit";
53
53
  export declare function getLatestTodoPhasesFromEntries(entries: SessionEntry[]): TodoPhase[];
54
+ /**
55
+ * Latest persisted todo list on the branch, terminal items included. `undefined`
56
+ * means no todo state was ever persisted; an empty array is an authoritative
57
+ * empty list (for example after a bare `/todo rm`).
58
+ */
59
+ export declare function findLatestTodoPhasesFromEntries(entries: SessionEntry[]): TodoPhase[] | undefined;
54
60
  /** Apply an array of `todo_write`-style ops to existing phases. Used by /todo slash command. */
55
61
  export declare function applyOpsToPhases(currentPhases: TodoPhase[], ops: TodoWriteParams["ops"]): {
56
62
  phases: TodoPhase[];
@@ -0,0 +1,7 @@
1
+ export interface ReleaseAssetDigest {
2
+ name?: string;
3
+ digest?: string | null;
4
+ }
5
+ export declare function sha256FromReleaseDigest(digest: string | null | undefined): string | null;
6
+ export declare function requireAssetSha256(assets: readonly ReleaseAssetDigest[], assetName: string): string;
7
+ export declare function assertFileMatchesSha256(filePath: string, expectedSha256: string): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/coding-agent",
4
- "version": "0.18.6",
4
+ "version": "0.18.8",
5
5
  "description": "Gajae Code CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -57,12 +57,12 @@
57
57
  "@agentclientprotocol/sdk": "1.3.0",
58
58
  "@babel/parser": "^7.29.3",
59
59
  "@mozilla/readability": "^0.6.0",
60
- "@gajae-code/stats": "0.18.6",
61
- "@gajae-code/agent-core": "0.18.6",
62
- "@gajae-code/ai": "0.18.6",
63
- "@gajae-code/natives": "0.18.6",
64
- "@gajae-code/tui": "0.18.6",
65
- "@gajae-code/utils": "0.18.6",
60
+ "@gajae-code/stats": "0.18.8",
61
+ "@gajae-code/agent-core": "0.18.8",
62
+ "@gajae-code/ai": "0.18.8",
63
+ "@gajae-code/natives": "0.18.8",
64
+ "@gajae-code/tui": "0.18.8",
65
+ "@gajae-code/utils": "0.18.8",
66
66
  "@puppeteer/browsers": "^2.13.0",
67
67
  "@types/turndown": "5.0.6",
68
68
  "@xterm/headless": "^6.0.0",
@@ -15,6 +15,10 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
15
15
  "internal marketplace lifecycle refresh for the session skill catalog; not an independent SDK ingress operation",
16
16
  "agent_session:getTerminalTurnEpoch":
17
17
  "internal terminal-abort bus seam (epoch only), threaded via terminalAbortSeams; not a user-facing SDK control seam",
18
+ "agent_session:getTerminalRunOwnerForEvent":
19
+ "internal Agent-claimed event ownership proof, read only through the terminalAbortSeams bus capability; not a public SDK operation",
20
+ "agent_session:getRunOwnerDomain":
21
+ "internal run-resource ledger domain lookup for exact consuming-run ownership; not a public SDK operation",
18
22
  "agent_session:cancelPendingPreflightForTerminalAbort":
19
23
  "internal terminal-abort bus seam, threaded via terminalAbortSeams; not a user-facing SDK control seam",
20
24
  "agent_session:abortPromptAndWaitWithTerminal":
@@ -62,6 +66,8 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
62
66
  "local transcript-discovery metadata command; no SDK operation counterpart or runtime/retention authority",
63
67
  "slash_command:unstar":
64
68
  "local transcript-discovery metadata command; no SDK operation counterpart or runtime/retention authority",
69
+ "agent_session:getSubagentLifecycleStatuses":
70
+ "internal read-only subagent status projection consumed through session.progress (Q32), not a separate SDK seam",
65
71
  "agent_session:constructor": "internal accessor/plumbing, not a user-facing control seam",
66
72
  "agent_session:getSessionAgentDir":
67
73
  "internal session-scoped agent-directory accessor, not a user-facing SDK control seam",
@@ -205,6 +211,10 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
205
211
  "agent_session:getContextUsageObservabilityForTests": "test-only observability, not a user-facing control seam",
206
212
  "agent_session:getAutoCompactionThresholdTokens":
207
213
  "internal compaction-threshold accessor feeding the /context breakdown; exposed through context.get, not an independent SDK operation",
214
+ "agent_session:resolvePromptSkillInvocation":
215
+ "internal prompt-dispatch classifier shared with interactive title seeding, not a user-facing control seam",
216
+ "agent_session:isLocallyHandledSlashCommand":
217
+ "internal slash-command classifier that keeps command text out of title seeding, not a user-facing control seam",
208
218
  "agent_session:purgeQueuedCustomMessages": "internal accessor/plumbing, not a user-facing control seam",
209
219
  "agent_session:clearQueue": "internal accessor/plumbing, not a user-facing control seam",
210
220
  "agent_session:popLastQueuedMessage": "internal accessor/plumbing, not a user-facing control seam",
@@ -217,6 +227,12 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
217
227
  "internal owner-recovery staged restore builder after durable claims/fencing, never a user-facing SDK operation",
218
228
  "agent_session:setActiveModelProfile": "internal accessor/plumbing, not a user-facing control seam",
219
229
  "agent_session:getActiveModelProfile": "internal accessor/plumbing, not a user-facing control seam",
230
+ "agent_session:getUserModelSelectionRevision":
231
+ "internal session-scoped model selection revision tracking behind the reviewed model.set seam, not an independent public SDK operation",
232
+ "agent_session:getUserCanonicalVariantSelection":
233
+ "internal session-scoped model variant selection state behind the reviewed model.set seam, not an independent public SDK operation",
234
+ "agent_session:markUserModelSelection":
235
+ "internal session-scoped model selection revision marker behind the reviewed model.set seam, not an independent public SDK operation",
220
236
  "agent_session:clearSessionOnlyModelProfileState":
221
237
  "internal session-scoped profile lifecycle plumbing behind the reviewed model.set seam, not an independent public SDK operation",
222
238
  "agent_session:noteProfileInstalledOverrides":
@@ -311,6 +327,10 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
311
327
  "internal profile-derived eager delegation synchronization, not a user-facing SDK control seam",
312
328
  "agent_session:submitUserMessage":
313
329
  "public in-process embedder lifecycle API; direct handle surface, not an SDK transport operation",
330
+ "agent_session:setUnavailableModelProfile":
331
+ "internal session-scoped unavailable profile tracking; mutated by the session lifecycle on model-load failure, not a public SDK control seam",
332
+ "agent_session:getUnavailableModelProfile":
333
+ "internal session-scoped unavailable profile query for UI status rendering; not a public SDK operation",
314
334
  };
315
335
  /** Maps reviewed source seams to registry SDK operation IDs. */
316
336
  const SEAM_TO_SDK: Readonly<Record<string, string>> = {
@@ -385,6 +405,7 @@ const SEAM_TO_SDK: Readonly<Record<string, string>> = {
385
405
  "slash_command:session": "session.list",
386
406
  "slash_command:jobs": "runtime.jobs.list",
387
407
  "slash_command:context": "context.get",
408
+ "slash_command:progress": "session.progress",
388
409
  "slash_command:usage": "usage.get",
389
410
  "slash_command:tools": "tools.list",
390
411
  "slash_command:login": "auth.login",
@@ -2,24 +2,25 @@
2
2
  * Pinned, child-isolated resident-cache benchmark.
3
3
  *
4
4
  * Each `--runs` repetition executes in a fresh Bun child. The default fixture is
5
- * 5,000 deterministic, unique 48 KiB messages; use the small overrides only for
6
- * local smoke checks, not performance comparisons.
5
+ * 500 deterministic, unique 48 KiB messages; it stays inside the product's
6
+ * eager-resume ceiling so a default run completes, and larger scales are explicit
7
+ * `--entries`/`--bytes-per-entry` overrides that fail closed above that ceiling.
7
8
  *
8
9
  * Normal measurements (five child runs per command):
9
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --runs 5
10
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode put-latency --runs 5
11
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --runs 5
10
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --runs 5
11
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode put-latency --runs 5
12
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --runs 5
12
13
  *
13
14
  * HEAD forced-rebuild baseline (copy this script to the pinned HEAD worktree):
14
15
  * git worktree add /tmp/gjc-bench-head 3649db42e
15
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --baseline forced-rebuild --runs 5
16
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --baseline forced-rebuild --runs 5
16
17
  *
17
18
  * Small smoke fixture and deliberate invalid-run demonstration:
18
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --entries 8 --bytes-per-entry 4096 --runs 1
19
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode put-latency --puts 64 --runs 1
20
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --entries 8 --bytes-per-entry 4096 --cache-cap-bytes 1024 --runs 1
21
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --entries 8 --bytes-per-entry 4096 --cache-cap-bytes 1024 --skip-gc --runs 1
22
- * TMPDIR="$HOME/tmp-gjc-tests/" GJC_CODING_AGENT_DIR="$(mktemp -d)" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --force-memory-only --runs 1
19
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --entries 8 --bytes-per-entry 4096 --runs 1
20
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode put-latency --puts 64 --runs 1
21
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --entries 8 --bytes-per-entry 4096 --cache-cap-bytes 1024 --runs 1
22
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode read-churn --entries 8 --bytes-per-entry 4096 --cache-cap-bytes 1024 --skip-gc --runs 1
23
+ * TMPDIR="$HOME/tmp-gjc-tests/" NO_COLOR=1 bun packages/coding-agent/scripts/resident-memory-bench.ts --mode rss --force-memory-only --runs 1
23
24
  *
24
25
  * `--skip-gc` deliberately bypasses the required turn boundary and forced GC;
25
26
  * the --skip-gc command must exit non-zero with the invalid-run diagnostic. Do not
@@ -28,9 +29,17 @@
28
29
  * exercise the existing fallback and is not a supported product configuration.
29
30
  * RSS mode reports append-phase and fresh-process reopen measurements with the full
30
31
  * `process.memoryUsage()` breakdown, plus repeated forced-GC idle-turn reclaim samples.
31
- * AC-1 passes only when append steady-state RSS delta stays within 100 MiB; a
32
- * post-reclaim result within that limit is separately labeled documented evidence. AC-2
33
- * measures direct `putSync` calls over pre-generated unique Buffers into a
32
+ * AC-1 passes only when all three ceilings hold: the append steady-state RSS delta stays
33
+ * within 100 MiB; the read-path residual (post-read forced-GC delta) stays within
34
+ * max(READ_PATH_RESIDUAL_FLOOR_BYTES, READ_PATH_RESIDUAL_TRANSCRIPT_RATIO_LIMIT x the
35
+ * fixture's persisted transcript); and the reclaim contract holds
36
+ * (RECLAIM_ALLOCATOR_FLOOR_BYTES, post-reclaim delta inside the append limit). A reclaim
37
+ * proof only excuses a steady-state miss: the read-path ceiling and the reclaim contract
38
+ * are hard gates, so a failed read path exits non-zero instead of being relabeled
39
+ * documented evidence. The harness always runs against its own throwaway agent dir, so
40
+ * nothing has to be pre-set, an ambient `GJC_CODING_AGENT_DIR` is ignored, and the
41
+ * operator's `~/.gjc` is never read; `GJC_RESIDENT_MEMORY_BENCH_AGENT_DIR` pins it.
42
+ * AC-2 measures direct `putSync` calls over pre-generated unique Buffers into a
34
43
  * canonical MemoryBlobStore and an adopted verified EphemeralBlobStore.
35
44
  * SessionManager append figures are separate `e2eAppend` diagnostics. A direct
36
45
  * store ratio above 1.5x is documented evidence, not a relaxation of the
@@ -43,6 +52,7 @@ import { createRequire, syncBuiltinESMExports } from "node:module";
43
52
  import * as os from "node:os";
44
53
  import * as path from "node:path";
45
54
  import { EphemeralBlobStore, MemoryBlobStore, openVerifiedResidentCacheInstanceDir } from "../src/session/blob-store";
55
+ import { MANAGED_ARTIFACT_MAX_FILE_BYTES } from "../src/session/internal/managed-session-storage";
46
56
  import type {
47
57
  SessionManagerObservabilityStats,
48
58
  SessionManager as SessionManagerType,
@@ -54,14 +64,50 @@ const { SessionManager } = sessionManagerModule;
54
64
  const SCHEMA_VERSION = 4;
55
65
  const SYNTHETIC_SEED = 0x5eedc0de;
56
66
  const DEFAULT_RUNS = 5;
57
- const RSS_ENTRY_COUNT = 5_000;
67
+ /**
68
+ * Default fixture. It has to stay inside the eager-resume ceiling, and at the default
69
+ * scale the append steady state has to stay inside AC-1: the previous 5_000 x 48 KiB
70
+ * default persisted about 234 MiB, so every default run died with the product's
71
+ * oversized-transcript recovery message before it could report anything. Larger scales
72
+ * are explicit opt-in through `--entries`/`--bytes-per-entry`, bounded by
73
+ * `assertFixtureWithinEagerResumeCeiling`.
74
+ */
75
+ const RSS_ENTRY_COUNT = 500;
58
76
  const RSS_BYTES_PER_ENTRY = 48 * 1024;
77
+ /**
78
+ * The eager-resume ceiling the product enforces, imported rather than copied so a
79
+ * product-side change is reflected here instead of silently invalidating the fixture.
80
+ */
81
+ const EAGER_RESUME_TRANSCRIPT_CEILING_BYTES = MANAGED_ARTIFACT_MAX_FILE_BYTES;
82
+ /** Measured per-entry framing overhead of the persisted JSONL transcript. */
83
+ const SYNTHETIC_ENTRY_OVERHEAD_BYTES = 160;
59
84
  const READ_CHURN_CYCLES = 100;
60
85
  const PUT_WARMUP_ITERATIONS = 1_000;
61
86
  const PUT_MEASURE_ITERATIONS = 10_000;
62
87
  const PUT_BYTES = 4 * 1024;
63
88
  const BASELINE_MARKER_BYTES = 128;
64
89
  const AC1_APPEND_PHASE_RSS_LIMIT_BYTES = 100 * 1024 * 1024;
90
+ /**
91
+ * Read-path residual ceiling: after the read plus the forced-GC idle turns the append
92
+ * phase must not still hold more than `max(READ_PATH_RESIDUAL_FLOOR_BYTES, ratio x the
93
+ * fixture's persisted transcript)` above the pre-append baseline. Expressing the ceiling
94
+ * against the fixture keeps an `--entries` override from walking out from under it, and
95
+ * the absolute floor covers the part of the residual that does not scale with the
96
+ * fixture: on a tiny smoke fixture the forced-GC delta is a few MiB of ordinary runtime
97
+ * overhead, which a pure ratio would flag as a failure. AC-1 gates only the append steady
98
+ * state, so without this second ceiling a retention regression on the read path can keep
99
+ * a large block of RSS and still report pass. The current tree measures about 5x on the
100
+ * default fixture (about 121 MiB retained over a 24 MiB transcript).
101
+ */
102
+ const READ_PATH_RESIDUAL_TRANSCRIPT_RATIO_LIMIT = 8;
103
+ const READ_PATH_RESIDUAL_FLOOR_BYTES = 32 * 1024 * 1024;
104
+ /**
105
+ * Bun's allocator retains freed pages, so the forced-GC reclaim returns nothing on this
106
+ * runtime. The floor is an explicit contract instead of an unexplained zero: the reclaim
107
+ * must never increase RSS, and the post-reclaim delta must stay inside the append limit,
108
+ * or the run fails closed.
109
+ */
110
+ const RECLAIM_ALLOCATOR_FLOOR_BYTES = 0;
65
111
  const MEMORY_RECLAIM_GC_ROUNDS = 4;
66
112
  const SYNTHETIC_TEXT_PATTERN =
67
113
  "gjc-resident-cache-fixture-abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789";
@@ -353,11 +399,34 @@ function parseArgs(argv: string[]): CliArgs {
353
399
  }
354
400
 
355
401
  function fixtureFor(args: CliArgs): FixtureDimensions {
356
- return {
402
+ const fixture: FixtureDimensions = {
357
403
  seed: SYNTHETIC_SEED,
358
404
  entries: args.entries ?? RSS_ENTRY_COUNT,
359
405
  bytesPerEntry: args.bytesPerEntry ?? RSS_BYTES_PER_ENTRY,
360
406
  };
407
+ assertFixtureWithinEagerResumeCeiling(fixture);
408
+ return fixture;
409
+ }
410
+
411
+ /**
412
+ * Fail closed before the run instead of dying inside the product: a fixture whose
413
+ * persisted transcript exceeds the eager-resume ceiling cannot be re-opened by the
414
+ * fresh-open phase, and the failure otherwise surfaces as the product's oversized-
415
+ * transcript recovery message with no hint that the fixture size is the cause.
416
+ */
417
+ /** Estimated persisted JSONL size of a fixture; the ceiling and read-path gates share it. */
418
+ function estimatedTranscriptBytes(fixture: FixtureDimensions): number {
419
+ return fixture.entries * (fixture.bytesPerEntry + SYNTHETIC_ENTRY_OVERHEAD_BYTES);
420
+ }
421
+
422
+ function assertFixtureWithinEagerResumeCeiling(fixture: FixtureDimensions): void {
423
+ const estimatedBytes = estimatedTranscriptBytes(fixture);
424
+ if (estimatedBytes <= EAGER_RESUME_TRANSCRIPT_CEILING_BYTES) return;
425
+ const estimatedMiB = Math.round(estimatedBytes / (1024 * 1024));
426
+ const ceilingMiB = Math.round(EAGER_RESUME_TRANSCRIPT_CEILING_BYTES / (1024 * 1024));
427
+ throw new Error(
428
+ `--entries/--bytes-per-entry would persist about ${estimatedMiB} MiB of transcript, above the ${ceilingMiB} MiB eager-resume ceiling; lower the fixture so the fresh-open phase can re-open it.`,
429
+ );
361
430
  }
362
431
 
363
432
  function fixtureForMode(args: CliArgs): FixtureDimensions {
@@ -539,6 +608,34 @@ async function withPersistentFixture<T>(
539
608
  }
540
609
  }
541
610
 
611
+ /**
612
+ * The harness runs against its own throwaway agent dir so it never reads or writes the
613
+ * operator's `~/.gjc` — an ambient `GJC_CODING_AGENT_DIR` (an agent session exports one)
614
+ * must not redirect a benchmark into live state, and the resident-cache poison that
615
+ * `--force-memory-only` relies on is only meaningful in a fresh directory anyway.
616
+ * `GJC_RESIDENT_MEMORY_BENCH_AGENT_DIR` is the explicit opt-in for pinning the directory.
617
+ */
618
+ let isolatedAgentDir: string | undefined;
619
+
620
+ async function ensureIsolatedAgentDir(): Promise<void> {
621
+ const pinned = process.env.GJC_RESIDENT_MEMORY_BENCH_AGENT_DIR;
622
+ if (pinned) {
623
+ process.env.GJC_CODING_AGENT_DIR = pinned;
624
+ process.env.PI_CODING_AGENT_DIR ??= pinned;
625
+ return;
626
+ }
627
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), "gjc-resident-memory-agent-"));
628
+ process.env.GJC_CODING_AGENT_DIR = dir;
629
+ process.env.PI_CODING_AGENT_DIR = dir;
630
+ isolatedAgentDir = dir;
631
+ }
632
+
633
+ async function cleanupIsolatedAgentDir(): Promise<void> {
634
+ const dir = isolatedAgentDir;
635
+ isolatedAgentDir = undefined;
636
+ if (dir) await fs.rm(dir, { recursive: true, force: true });
637
+ }
638
+
542
639
  async function forceResidentCacheMemoryFallback(): Promise<void> {
543
640
  const agentDir = process.env.GJC_CODING_AGENT_DIR;
544
641
  if (!agentDir) throw new Error("--force-memory-only requires GJC_CODING_AGENT_DIR to be set.");
@@ -590,7 +687,10 @@ async function settleAndForceGcTwice(): Promise<void> {
590
687
 
591
688
  /**
592
689
  * Let the collector and allocator reclaim after an idle turn without injecting a
593
- * larger temporary allocation that itself becomes an RSS high-water artifact.
690
+ * larger temporary allocation that itself becomes an RSS high-water artifact. The
691
+ * allocator retains the pages it already mapped, so this is expected to release
692
+ * `RECLAIM_ALLOCATOR_FLOOR_BYTES`; the AC-1 report gates that contract instead of
693
+ * printing a bare zero.
594
694
  */
595
695
  async function reclaimAfterMemoryPressure(): Promise<MemoryPressureReclaim> {
596
696
  for (let round = 0; round < MEMORY_RECLAIM_GC_ROUNDS; round++) {
@@ -635,6 +735,9 @@ async function runFreshOpenRss(args: CliArgs): Promise<FreshOpenRssWorkerResult>
635
735
  try {
636
736
  await settleFreshOpenRss();
637
737
  const baseline = memorySample();
738
+ // `fixtureFor` already proved the persisted transcript stays under the eager-resume
739
+ // ceiling, so this is the ordinary resume path the product takes for a session a
740
+ // user would actually reopen.
638
741
  manager = await SessionManager.open(sessionFile);
639
742
  const postOpen = memorySample();
640
743
  const diskBytes = await residentCacheDiskBytes();
@@ -1113,11 +1216,24 @@ function summarizeAc1(runs: readonly RssWorkerResult[]): {
1113
1216
  postReclaimRssDelta: number;
1114
1217
  classification: "documented-evidence";
1115
1218
  };
1219
+ readPathResidual: {
1220
+ postReadGcRssDelta: number;
1221
+ limitBytes: number;
1222
+ floorBytes: number;
1223
+ ratioLimit: number;
1224
+ passes: boolean;
1225
+ };
1226
+ reclaimFloor: {
1227
+ allocatorFloorBytes: number;
1228
+ postReclaimWithinLimit: boolean;
1229
+ passes: boolean;
1230
+ };
1116
1231
  verdict: "pass" | "documented-evidence-with-reclaim-proof" | "fail";
1117
1232
  } {
1118
1233
  const appendSteadyDelta = summarize(runs.map(run => run.appendPhase.steadyStateDelta.rssBytes));
1119
1234
  const postReclaimDelta = summarize(runs.map(run => run.appendPhase.postReclaimDelta.rssBytes));
1120
1235
  const reclaimedBytes = summarize(runs.map(run => run.appendPhase.reclaimedBytes));
1236
+ const readPathResidualDelta = summarize(runs.map(run => run.appendPhase.postReadGcDelta.rssBytes));
1121
1237
  const steadyStateExternal = summarize(runs.map(run => run.appendPhase.steadyState.externalBytes));
1122
1238
  const postReclaimExternal = summarize(runs.map(run => run.appendPhase.postReclaim.externalBytes));
1123
1239
  const postReclaimExternalDelta = summarize(runs.map(run => run.appendPhase.postReclaimDelta.externalBytes));
@@ -1127,7 +1243,19 @@ function summarizeAc1(runs: readonly RssWorkerResult[]): {
1127
1243
  const freshOpenRssDelta = summarize(runs.map(run => run.freshOpenPhase.steadyStateDelta.rssBytes));
1128
1244
  const freshOpenPostReclaimRssDelta = summarize(runs.map(run => run.freshOpenPhase.postReclaimDelta.rssBytes));
1129
1245
  const passesSteadyStateGate = appendSteadyDelta.median <= AC1_APPEND_PHASE_RSS_LIMIT_BYTES;
1130
- const hasReclaimProof = postReclaimDelta.median <= AC1_APPEND_PHASE_RSS_LIMIT_BYTES && reclaimedBytes.median > 0;
1246
+ const readPathResidualLimitBytes = Math.max(
1247
+ READ_PATH_RESIDUAL_FLOOR_BYTES,
1248
+ estimatedTranscriptBytes(runs[0]?.fixture ?? { seed: SYNTHETIC_SEED, entries: 0, bytesPerEntry: 0 }) *
1249
+ READ_PATH_RESIDUAL_TRANSCRIPT_RATIO_LIMIT,
1250
+ );
1251
+ const passesReadPathGate = readPathResidualDelta.median <= readPathResidualLimitBytes;
1252
+ const postReclaimWithinLimit = postReclaimDelta.median <= AC1_APPEND_PHASE_RSS_LIMIT_BYTES;
1253
+ const passesReclaimFloorGate = reclaimedBytes.median >= RECLAIM_ALLOCATOR_FLOOR_BYTES && postReclaimWithinLimit;
1254
+ const hasReclaimProof = postReclaimWithinLimit && reclaimedBytes.median > 0;
1255
+ // The reclaim proof excuses the steady-state ceiling only. The read-path ceiling and
1256
+ // the reclaim contract are hard gates, so a proof must not relabel a failed read path
1257
+ // as documented evidence and let the process exit zero.
1258
+ const reclaimProofExcusesOnlySteadyState = hasReclaimProof && passesReadPathGate && passesReclaimFloorGate;
1131
1259
  return {
1132
1260
  appendSteadyDelta: appendSteadyDelta.median,
1133
1261
  postReclaimDelta: postReclaimDelta.median,
@@ -1147,7 +1275,24 @@ function summarizeAc1(runs: readonly RssWorkerResult[]): {
1147
1275
  postReclaimRssDelta: freshOpenPostReclaimRssDelta.median,
1148
1276
  classification: "documented-evidence",
1149
1277
  },
1150
- verdict: passesSteadyStateGate ? "pass" : hasReclaimProof ? "documented-evidence-with-reclaim-proof" : "fail",
1278
+ readPathResidual: {
1279
+ postReadGcRssDelta: readPathResidualDelta.median,
1280
+ limitBytes: readPathResidualLimitBytes,
1281
+ floorBytes: READ_PATH_RESIDUAL_FLOOR_BYTES,
1282
+ ratioLimit: READ_PATH_RESIDUAL_TRANSCRIPT_RATIO_LIMIT,
1283
+ passes: passesReadPathGate,
1284
+ },
1285
+ reclaimFloor: {
1286
+ allocatorFloorBytes: RECLAIM_ALLOCATOR_FLOOR_BYTES,
1287
+ postReclaimWithinLimit,
1288
+ passes: passesReclaimFloorGate,
1289
+ },
1290
+ verdict:
1291
+ passesSteadyStateGate && passesReadPathGate && passesReclaimFloorGate
1292
+ ? "pass"
1293
+ : reclaimProofExcusesOnlySteadyState
1294
+ ? "documented-evidence-with-reclaim-proof"
1295
+ : "fail",
1151
1296
  };
1152
1297
  }
1153
1298
 
@@ -1323,6 +1468,10 @@ async function runParent(args: CliArgs): Promise<void> {
1323
1468
  runResults: runs,
1324
1469
  };
1325
1470
  process.stdout.write(`${JSON.stringify(output)}\n`);
1471
+ // A failed RSS acceptance verdict has to fail the process, otherwise the declared
1472
+ // ceilings are only advisory and nothing downstream can gate on them.
1473
+ if (args.mode === "rss" && (acceptanceReport as { ac1: { verdict: string } }).ac1.verdict === "fail")
1474
+ process.exitCode = 1;
1326
1475
  }
1327
1476
 
1328
1477
  async function main(): Promise<void> {
@@ -1332,7 +1481,12 @@ async function main(): Promise<void> {
1332
1481
  process.stdout.write(`${JSON.stringify(result)}\n`);
1333
1482
  return;
1334
1483
  }
1335
- await runParent(args);
1484
+ await ensureIsolatedAgentDir();
1485
+ try {
1486
+ await runParent(args);
1487
+ } finally {
1488
+ await cleanupIsolatedAgentDir();
1489
+ }
1336
1490
  }
1337
1491
 
1338
1492
  await main().catch(error => {
@@ -0,0 +1,28 @@
1
+ import {
2
+ assertExecutedScenarios,
3
+ parseHarnessPort,
4
+ runManagedEmptyStopScenario,
5
+ scenarioNames,
6
+ } from "../test/helpers/managed-empty-stop-harness";
7
+
8
+ export async function main(args = process.argv.slice(2)): Promise<number> {
9
+ let executed = 0;
10
+ try {
11
+ const scenarios = scenarioNames(args);
12
+ const port = parseHarnessPort();
13
+ for (const scenario of scenarios) {
14
+ executed++;
15
+ const report = await runManagedEmptyStopScenario(scenario, port);
16
+ process.stdout.write(`PASS ${scenario}: ${report.providerModels.join(" -> ")}, ${report.terminal.status}\n`);
17
+ }
18
+ assertExecutedScenarios(executed);
19
+ return 0;
20
+ } catch (error) {
21
+ process.stderr.write(`FAIL managed-empty-stop: ${error instanceof Error ? error.message : String(error)}\n`);
22
+ return 1;
23
+ } finally {
24
+ process.stdout.write(`managed-empty-stop: executed ${executed} scenario(s)\n`);
25
+ }
26
+ }
27
+
28
+ if (import.meta.main) process.exitCode = await main();