@gajae-code/coding-agent 0.18.7 → 0.18.9

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 (344) hide show
  1. package/CHANGELOG.md +377 -1
  2. package/dist/types/async/endpoint-id.d.ts +16 -0
  3. package/dist/types/async/job-manager.d.ts +1 -1
  4. package/dist/types/async/support.d.ts +0 -14
  5. package/dist/types/capability/mcp.d.ts +2 -0
  6. package/dist/types/capability/skill.d.ts +2 -0
  7. package/dist/types/capability/types.d.ts +2 -0
  8. package/dist/types/cli/public-command-errors.d.ts +3 -1
  9. package/dist/types/cli/setup-cli.d.ts +1 -1
  10. package/dist/types/commands/deep-interview.d.ts +3 -0
  11. package/dist/types/commands/mcp-serve.d.ts +4 -0
  12. package/dist/types/config/autorouting-tier-map.d.ts +348 -9
  13. package/dist/types/config/file-lock.d.ts +1 -0
  14. package/dist/types/config/model-bindings-applier.d.ts +2 -0
  15. package/dist/types/config/model-profile-activation.d.ts +11 -3
  16. package/dist/types/config/model-registry.d.ts +4 -9
  17. package/dist/types/config/skill-settings-defaults.d.ts +2 -0
  18. package/dist/types/cursor-delete-path.d.ts +1 -0
  19. package/dist/types/cursor-mcp-name.d.ts +8 -0
  20. package/dist/types/customization/inventory.d.ts +2 -0
  21. package/dist/types/debug/report-bundle-parent.d.ts +2 -0
  22. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.d.ts +1 -0
  23. package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.d.ts +31 -0
  24. package/dist/types/defaults/gjc-skills.generated.d.ts +5 -6
  25. package/dist/types/discovery/helpers.d.ts +6 -1
  26. package/dist/types/discovery/mcp-json.d.ts +1 -0
  27. package/dist/types/eval/py/kernel.d.ts +18 -0
  28. package/dist/types/export/html/css-color.d.ts +2 -0
  29. package/dist/types/export/html/html-export-destination.d.ts +2 -0
  30. package/dist/types/export/html/template.generated.d.ts +1 -1
  31. package/dist/types/extensibility/extensions/function-hooks-internal.d.ts +5 -0
  32. package/dist/types/extensibility/extensions/types.d.ts +7 -0
  33. package/dist/types/extensibility/gjc-plugins/runtime-adapters.d.ts +14 -1
  34. package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
  35. package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
  36. package/dist/types/extensibility/runtime-skill-discovery.d.ts +3 -1
  37. package/dist/types/extensibility/skill-management.d.ts +4 -1
  38. package/dist/types/extensibility/skills.d.ts +2 -0
  39. package/dist/types/gjc-runtime/deep-interview-crystallize.d.ts +74 -0
  40. package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +11 -0
  41. package/dist/types/gjc-runtime/gc-runtime.d.ts +5 -0
  42. package/dist/types/gjc-runtime/psmux-detect.d.ts +3 -3
  43. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +0 -5
  44. package/dist/types/gjc-runtime/sidecar-bootstrap-env.d.ts +6 -0
  45. package/dist/types/gjc-runtime/state-argv.d.ts +1 -1
  46. package/dist/types/gjc-runtime/state-migrations.d.ts +8 -0
  47. package/dist/types/gjc-runtime/state-runtime.d.ts +95 -0
  48. package/dist/types/gjc-runtime/state-writer.d.ts +14 -1
  49. package/dist/types/gjc-runtime/tmux-common.d.ts +8 -5
  50. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +8 -0
  51. package/dist/types/internal-urls/skill-path.d.ts +1 -0
  52. package/dist/types/lsp/config.d.ts +8 -5
  53. package/dist/types/lsp/workspace-path.d.ts +1 -0
  54. package/dist/types/modes/acp/acp-agent.d.ts +7 -0
  55. package/dist/types/modes/components/custom-editor.d.ts +6 -0
  56. package/dist/types/modes/components/customization/customization-dashboard.d.ts +1 -0
  57. package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
  58. package/dist/types/modes/controllers/input-controller.d.ts +9 -0
  59. package/dist/types/modes/interactive-mode.d.ts +1 -0
  60. package/dist/types/modes/utils/interrupt-ownership.d.ts +3 -0
  61. package/dist/types/modes/utils/keybinding-matchers.d.ts +1 -0
  62. package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
  63. package/dist/types/progress/collect-project-progress.d.ts +38 -0
  64. package/dist/types/progress/progress-contract.d.ts +154 -0
  65. package/dist/types/progress/progress-snapshot.d.ts +11 -0
  66. package/dist/types/progress/project-progress.d.ts +141 -0
  67. package/dist/types/progress/render-progress.d.ts +28 -0
  68. package/dist/types/runtime-mcp/manager.d.ts +2 -1
  69. package/dist/types/runtime-mcp/mcp-redirect.d.ts +9 -0
  70. package/dist/types/runtime-mcp/oauth-public-url.d.ts +3 -0
  71. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
  72. package/dist/types/runtime-mcp/project-host-values.d.ts +27 -0
  73. package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
  74. package/dist/types/runtime-mcp/types.d.ts +6 -0
  75. package/dist/types/sdk/acp/adapter.d.ts +1 -1
  76. package/dist/types/sdk/broker/broker-exit.d.ts +6 -2
  77. package/dist/types/sdk/broker/broker.d.ts +24 -2
  78. package/dist/types/sdk/broker/doctor-restart.d.ts +5 -0
  79. package/dist/types/sdk/broker/ensure.d.ts +14 -1
  80. package/dist/types/sdk/broker/session-index.d.ts +12 -6
  81. package/dist/types/sdk/bus/index.d.ts +12 -1
  82. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -1
  83. package/dist/types/sdk/client/client.d.ts +2 -0
  84. package/dist/types/sdk/host/query/handlers.d.ts +3 -0
  85. package/dist/types/sdk/index.d.ts +1 -0
  86. package/dist/types/sdk/router/session-router.d.ts +2 -0
  87. package/dist/types/sdk/session-list.d.ts +1 -1
  88. package/dist/types/sdk/session.d.ts +8 -0
  89. package/dist/types/session/agent-session.d.ts +38 -9
  90. package/dist/types/session/artifacts.d.ts +2 -2
  91. package/dist/types/session/internal/managed-gc-retirement-codec.d.ts +32 -0
  92. package/dist/types/session/internal/managed-session-scope.d.ts +79 -2
  93. package/dist/types/session/internal/managed-session-storage.d.ts +26 -1
  94. package/dist/types/session/internal/managed-task-owner-cleanup.d.ts +62 -0
  95. package/dist/types/session/internal/task-artifact-owner-access.d.ts +2 -0
  96. package/dist/types/session/internal/task-artifact-owner-transcript.d.ts +9 -1
  97. package/dist/types/session/session-manager.d.ts +31 -5
  98. package/dist/types/session/session-retirement.d.ts +31 -7
  99. package/dist/types/session/session-storage.d.ts +69 -2
  100. package/dist/types/session/task-artifact-owner-codec.d.ts +2 -0
  101. package/dist/types/setup/credential-auto-import.d.ts +1 -1
  102. package/dist/types/setup/credential-import.d.ts +6 -4
  103. package/dist/types/skill-state/active-state.d.ts +38 -0
  104. package/dist/types/skill-state/workflow-mutation-guard.d.ts +3 -0
  105. package/dist/types/slash-commands/helpers/progress-report.d.ts +8 -0
  106. package/dist/types/task/executor.d.ts +3 -0
  107. package/dist/types/task/isolation-dir.d.ts +26 -0
  108. package/dist/types/tools/ast-edit-write-path.d.ts +13 -0
  109. package/dist/types/tools/bash-skill-urls.d.ts +1 -1
  110. package/dist/types/tools/browser/cdp-url.d.ts +2 -0
  111. package/dist/types/tools/github-side-effect.d.ts +22 -0
  112. package/dist/types/tools/index.d.ts +3 -0
  113. package/dist/types/tools/monitor-mutation.d.ts +9 -0
  114. package/dist/types/tools/python.d.ts +9 -1
  115. package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
  116. package/dist/types/tools/restricted-cwd.d.ts +1 -0
  117. package/dist/types/tools/todo-write.d.ts +6 -0
  118. package/dist/types/utils/tools-checksum.d.ts +7 -0
  119. package/package.json +7 -7
  120. package/scripts/generate-sdk-operation-inventory.ts +21 -0
  121. package/scripts/verify-managed-empty-stop.ts +28 -0
  122. package/src/async/endpoint-id.ts +26 -0
  123. package/src/async/job-manager.ts +247 -132
  124. package/src/async/support.ts +0 -25
  125. package/src/capability/index.ts +15 -0
  126. package/src/capability/mcp.ts +2 -0
  127. package/src/capability/skill.ts +2 -0
  128. package/src/capability/types.ts +2 -0
  129. package/src/cli/auth-broker-cli.ts +1 -1
  130. package/src/cli/customize-doctor.ts +15 -2
  131. package/src/cli/doctor/repairs.ts +4 -1
  132. package/src/cli/doctor-supervisor.ts +3 -0
  133. package/src/cli/public-command-errors.ts +21 -1
  134. package/src/cli/public-command-registry.ts +28 -6
  135. package/src/cli/setup-cli.ts +4 -4
  136. package/src/cli/skills-cli.ts +5 -0
  137. package/src/commands/deep-interview.ts +47 -8
  138. package/src/commands/mcp-serve.ts +7 -0
  139. package/src/commands/sdk.ts +455 -397
  140. package/src/config/autorouting-tier-map.ts +117 -7
  141. package/src/config/file-lock.ts +316 -79
  142. package/src/config/mcp-schema.json +4 -0
  143. package/src/config/model-bindings-applier.ts +20 -0
  144. package/src/config/model-profile-activation.ts +240 -46
  145. package/src/config/model-registry.ts +47 -153
  146. package/src/config/skill-settings-defaults.ts +7 -0
  147. package/src/coordinator-mcp/policy.ts +3 -2
  148. package/src/coordinator-mcp/server.ts +2 -0
  149. package/src/cursor-delete-path.ts +10 -0
  150. package/src/cursor-mcp-name.ts +15 -0
  151. package/src/cursor.ts +13 -2
  152. package/src/customization/inventory.ts +4 -13
  153. package/src/dap/config.ts +2 -2
  154. package/src/debug/report-bundle-parent.ts +22 -0
  155. package/src/debug/report-bundle.ts +3 -0
  156. package/src/debug/system-info.ts +13 -1
  157. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/register.ts +10 -6
  158. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.ts +67 -4
  159. package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.ts +80 -0
  160. package/src/defaults/gjc/skills/deep-interview/SKILL.md +105 -10
  161. package/src/defaults/gjc/skills/ralplan/SKILL.md +6 -4
  162. package/src/defaults/gjc-defaults.test.ts +18 -1
  163. package/src/defaults/gjc-defaults.ts +3 -0
  164. package/src/defaults/gjc-skills.generated.ts +58 -36
  165. package/src/discovery/agents.ts +6 -1
  166. package/src/discovery/builtin.ts +13 -1
  167. package/src/discovery/helpers.ts +171 -29
  168. package/src/discovery/mcp-json.ts +26 -12
  169. package/src/discovery/ssh.ts +1 -1
  170. package/src/discovery/substitute-plugin-root.ts +3 -1
  171. package/src/edit/file-read-cache.ts +1 -1
  172. package/src/eval/py/executor.ts +796 -154
  173. package/src/eval/py/kernel.ts +79 -13
  174. package/src/eval/py/tool-bridge.ts +4 -0
  175. package/src/export/html/css-color.ts +9 -0
  176. package/src/export/html/html-export-destination.ts +16 -0
  177. package/src/export/html/index.ts +7 -10
  178. package/src/export/html/template.generated.ts +1 -1
  179. package/src/extensibility/extensions/function-hooks-internal.ts +27 -0
  180. package/src/extensibility/extensions/runner.ts +15 -1
  181. package/src/extensibility/extensions/types.ts +7 -0
  182. package/src/extensibility/gjc-plugins/mcp-policy.ts +2 -1
  183. package/src/extensibility/gjc-plugins/runtime-adapters.ts +85 -8
  184. package/src/extensibility/plugins/manager.ts +3 -2
  185. package/src/extensibility/plugins/marketplace/cache.ts +15 -0
  186. package/src/extensibility/plugins/marketplace/manager.ts +11 -3
  187. package/src/extensibility/plugins/plugin-link-path.ts +12 -0
  188. package/src/extensibility/runtime-skill-discovery.ts +20 -2
  189. package/src/extensibility/skill-management.ts +9 -2
  190. package/src/extensibility/skills.ts +6 -1
  191. package/src/gjc-runtime/deep-interview-crystallize.ts +1814 -0
  192. package/src/gjc-runtime/deep-interview-recorder.ts +20 -2
  193. package/src/gjc-runtime/deep-interview-runtime.ts +1415 -13
  194. package/src/gjc-runtime/deep-interview-stage.ts +98 -21
  195. package/src/gjc-runtime/gc-runtime.ts +206 -9
  196. package/src/gjc-runtime/launch-worktree.ts +70 -9
  197. package/src/gjc-runtime/psmux-detect.ts +28 -4
  198. package/src/gjc-runtime/ralplan-runtime.ts +447 -52
  199. package/src/gjc-runtime/session-state-sidecar.ts +3 -2
  200. package/src/gjc-runtime/sidecar-bootstrap-env.ts +19 -0
  201. package/src/gjc-runtime/state-argv.ts +2 -0
  202. package/src/gjc-runtime/state-migrations.ts +91 -29
  203. package/src/gjc-runtime/state-runtime.ts +3716 -135
  204. package/src/gjc-runtime/state-writer.ts +105 -16
  205. package/src/gjc-runtime/tmux-common.ts +8 -5
  206. package/src/gjc-runtime/ultragoal-runtime.ts +16 -4
  207. package/src/gjc-runtime/workflow-manifest.generated.json +70 -42
  208. package/src/gjc-runtime/workflow-manifest.ts +54 -21
  209. package/src/harness-control-plane/operate.ts +12 -4
  210. package/src/harness-control-plane/owner.ts +5 -1
  211. package/src/hashline/parser.ts +48 -9
  212. package/src/hashline/recovery.ts +13 -4
  213. package/src/internal-urls/docs-index.generated.ts +20 -19
  214. package/src/internal-urls/skill-path.ts +19 -0
  215. package/src/internal-urls/skill-protocol.ts +2 -0
  216. package/src/lsp/config.ts +12 -63
  217. package/src/lsp/edits.ts +6 -0
  218. package/src/lsp/workspace-path.ts +51 -0
  219. package/src/main.ts +195 -31
  220. package/src/memories/index.ts +88 -7
  221. package/src/modes/acp/acp-agent.ts +88 -4
  222. package/src/modes/components/custom-editor.ts +14 -0
  223. package/src/modes/components/customization/customization-dashboard.ts +12 -0
  224. package/src/modes/components/extensions/extension-dashboard.ts +2 -2
  225. package/src/modes/components/extensions/state-manager.ts +15 -5
  226. package/src/modes/components/hook-editor.ts +1 -1
  227. package/src/modes/components/hook-selector.ts +1 -1
  228. package/src/modes/components/model-selector.ts +1 -4
  229. package/src/modes/components/provider-onboarding-selector.ts +1 -1
  230. package/src/modes/components/status-line/segments.ts +4 -0
  231. package/src/modes/controllers/event-controller.ts +11 -4
  232. package/src/modes/controllers/input-controller.ts +76 -31
  233. package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -16
  234. package/src/modes/controllers/selector-controller.ts +24 -15
  235. package/src/modes/controllers/todo-command-controller.ts +1 -1
  236. package/src/modes/interactive-mode.ts +5 -1
  237. package/src/modes/runtime-init.ts +4 -0
  238. package/src/modes/utils/abort-message.ts +3 -1
  239. package/src/modes/utils/interrupt-ownership.ts +12 -0
  240. package/src/modes/utils/keybinding-matchers.ts +4 -0
  241. package/src/modes/utils/macos-option-forwarding.ts +80 -0
  242. package/src/progress/collect-project-progress.ts +153 -0
  243. package/src/progress/progress-contract.ts +172 -0
  244. package/src/progress/progress-snapshot.ts +140 -0
  245. package/src/progress/project-progress.ts +446 -0
  246. package/src/progress/render-progress.ts +209 -0
  247. package/src/prompts/system/master-mode.md +1 -0
  248. package/src/prompts/tools/skill-discovery.md +1 -1
  249. package/src/runtime-mcp/client.ts +4 -2
  250. package/src/runtime-mcp/config-writer.ts +10 -6
  251. package/src/runtime-mcp/config.ts +1 -0
  252. package/src/runtime-mcp/json-rpc.ts +2 -1
  253. package/src/runtime-mcp/manager.ts +29 -11
  254. package/src/runtime-mcp/mcp-redirect.ts +73 -0
  255. package/src/runtime-mcp/oauth-flow.ts +14 -2
  256. package/src/runtime-mcp/oauth-public-url.ts +14 -0
  257. package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
  258. package/src/runtime-mcp/pool.ts +6 -0
  259. package/src/runtime-mcp/project-host-values.ts +46 -0
  260. package/src/runtime-mcp/smithery-registry.ts +22 -3
  261. package/src/runtime-mcp/transports/http.ts +4 -3
  262. package/src/runtime-mcp/types.ts +6 -0
  263. package/src/sdk/acp/adapter.ts +95 -8
  264. package/src/sdk/broker/broker-exit.ts +52 -23
  265. package/src/sdk/broker/broker.ts +81 -6
  266. package/src/sdk/broker/doctor-restart.ts +4 -0
  267. package/src/sdk/broker/ensure.ts +31 -2
  268. package/src/sdk/broker/lifecycle.ts +711 -66
  269. package/src/sdk/broker/session-index.ts +191 -81
  270. package/src/sdk/bus/chat-daemon-cli.ts +38 -1
  271. package/src/sdk/bus/chat-daemon-control.ts +2 -2
  272. package/src/sdk/bus/index.ts +238 -43
  273. package/src/sdk/bus/telegram-daemon-contract.ts +6 -1
  274. package/src/sdk/cli/session-cli.ts +17 -3
  275. package/src/sdk/client/client.ts +28 -8
  276. package/src/sdk/host/query/handlers.ts +9 -1
  277. package/src/sdk/host/session-runtime.test.ts +2705 -303
  278. package/src/sdk/host/session-runtime.ts +490 -143
  279. package/src/sdk/host/surface-policy.ts +1 -0
  280. package/src/sdk/index.ts +8 -0
  281. package/src/sdk/lifecycle-session.ts +3 -1
  282. package/src/sdk/prompt-deadline-manager.ts +15 -0
  283. package/src/sdk/protocol/operation-inventory.generated.json +146 -0
  284. package/src/sdk/protocol/operation-registry.ts +9 -2
  285. package/src/sdk/router/session-router.ts +82 -18
  286. package/src/sdk/session-list.ts +1 -0
  287. package/src/sdk/session.ts +69 -45
  288. package/src/session/agent-session.ts +679 -238
  289. package/src/session/artifacts.ts +176 -71
  290. package/src/session/internal/managed-gc-retirement-codec.ts +319 -0
  291. package/src/session/internal/managed-session-scope.ts +3779 -462
  292. package/src/session/internal/managed-session-storage.ts +501 -78
  293. package/src/session/internal/managed-task-owner-cleanup.ts +473 -0
  294. package/src/session/internal/task-artifact-owner-access.ts +19 -3
  295. package/src/session/internal/task-artifact-owner-transcript.ts +547 -1
  296. package/src/session/session-manager.ts +951 -133
  297. package/src/session/session-retirement.ts +573 -14
  298. package/src/session/session-storage.ts +447 -15
  299. package/src/session/task-artifact-owner-codec.ts +71 -8
  300. package/src/session/task-artifact-owner-retirement.ts +21 -19
  301. package/src/setup/credential-auto-import.ts +12 -3
  302. package/src/setup/credential-import.ts +176 -5
  303. package/src/setup/paseo/announce.ts +6 -1
  304. package/src/skill-state/active-state.ts +145 -2
  305. package/src/skill-state/workflow-mutation-guard.ts +102 -10
  306. package/src/slash-commands/builtin-registry.ts +39 -9
  307. package/src/slash-commands/helpers/mcp.ts +8 -4
  308. package/src/slash-commands/helpers/progress-report.ts +23 -0
  309. package/src/stt/setup.ts +3 -5
  310. package/src/task/commands.ts +3 -1
  311. package/src/task/executor.ts +4 -0
  312. package/src/task/index.ts +6 -0
  313. package/src/task/isolation-dir.ts +143 -0
  314. package/src/task/worktree.ts +16 -7
  315. package/src/tools/ask.ts +205 -6
  316. package/src/tools/ast-edit-write-path.ts +68 -0
  317. package/src/tools/ast-edit.ts +10 -1
  318. package/src/tools/bash-allowed-prefixes.ts +15 -0
  319. package/src/tools/bash-skill-urls.ts +56 -3
  320. package/src/tools/bash.ts +48 -79
  321. package/src/tools/browser/cdp-url.ts +18 -0
  322. package/src/tools/browser.ts +8 -1
  323. package/src/tools/descriptors.ts +5 -1
  324. package/src/tools/eval.ts +56 -36
  325. package/src/tools/gh.ts +10 -0
  326. package/src/tools/github-side-effect.ts +112 -0
  327. package/src/tools/image-gen.ts +1 -1
  328. package/src/tools/index.ts +3 -0
  329. package/src/tools/monitor-mutation.ts +27 -0
  330. package/src/tools/monitor.ts +7 -0
  331. package/src/tools/python.ts +188 -66
  332. package/src/tools/recipe/index.ts +9 -0
  333. package/src/tools/recipe/recipe-guard.ts +19 -0
  334. package/src/tools/restricted-cwd.ts +10 -0
  335. package/src/tools/skill-discovery.ts +5 -0
  336. package/src/tools/skill.ts +28 -1
  337. package/src/tools/todo-write.ts +10 -1
  338. package/src/tools/tool-catalog.generated.ts +1 -1
  339. package/src/tools/write.ts +1 -0
  340. package/src/utils/external-editor.ts +3 -2
  341. package/src/utils/tools-checksum.ts +34 -0
  342. package/src/utils/tools-manager.ts +24 -6
  343. package/src/web/insane/url-guard.ts +2 -1
  344. package/src/web/search/providers/codex.ts +3 -2
@@ -192,10 +192,12 @@ export declare class SessionIndex {
192
192
  * stamp of the last completed locked pass, the in-memory projection is
193
193
  * already current and the locked rescan is skipped entirely — this is what
194
194
  * keeps an idle SessionRouter reconcile (2s cadence) from re-parsing and
195
- * re-checksumming the whole index forever. An append committed before the
196
- * stat always changes the stamp, so a miss is impossible; a change landing
197
- * after the stat is seen on the next poll, the same TOCTOU envelope a
198
- * locked read has. A corrupt suffix never takes the fast path: re-scanning
195
+ * re-checksumming the whole index forever. The unchanged check runs before
196
+ * the local queue so unrelated heartbeat work cannot delay ordinary creates.
197
+ * Admission that requires serialized authority must use refresh() instead.
198
+ * An append committed before the stat always changes
199
+ * the stamp; a change landing after the stat is seen on the next poll, the
200
+ * same TOCTOU envelope a locked read has. A corrupt suffix never takes the fast path: re-scanning
199
201
  * preserves the existing re-diagnosis behavior. Returns true when state was
200
202
  * reloaded. Authority revalidation that needs the strongest available
201
203
  * snapshot inside an already-locked write (append, unregister) keeps using
@@ -229,7 +231,11 @@ export declare class SessionIndex {
229
231
  * injected retention policy to a fresh snapshot and truncates the log.
230
232
  */
231
233
  compact(): Promise<void>;
232
- listSessions(probedIncarnations?: ReadonlyMap<string, string | undefined>): SessionList;
234
+ /**
235
+ * Public session rows. `sessionIds` scopes the projection to those sessions:
236
+ * rows for them are identical to the unscoped read, other sessions are absent.
237
+ */
238
+ listSessions(probedIncarnations?: ReadonlyMap<string, string | undefined>, sessionIds?: ReadonlySet<string>): SessionList;
233
239
  /**
234
240
  * Credential-free proof for one exact public endpoint generation.
235
241
  *
@@ -274,7 +280,7 @@ export declare class SessionIndex {
274
280
  * while the broker was down keep their stale or missing heartbeat and read as
275
281
  * unknown/not-live (never fresh forever). Returns the number of checkpoints written.
276
282
  */
277
- checkpointLiveHeartbeats(now?: number): Promise<number>;
283
+ checkpointLiveHeartbeats(now?: number, abortSignal?: AbortSignal, deadlineAt?: number): Promise<number>;
278
284
  hostUnregisteredAfter(registration: Pick<IndexedSession, "sessionId" | "locator" | "endpointGeneration" | "pid" | "indexSeq" | "lifecycleRequestId" | "hostIncarnation" | "processIncarnation" | "endpointFileId">): {
279
285
  indexSeq: number;
280
286
  lifecycleRequestId?: string;
@@ -17,7 +17,7 @@
17
17
  * Enable with Settings notifications config, `GJC_NOTIFICATIONS=1` (a token is
18
18
  * generated), or `GJC_NOTIFICATIONS_TOKEN`.
19
19
  */
20
- import { type RunSettlementProof } from "@gajae-code/agent-core";
20
+ import { type AgentTerminalOwnerContext, type RunCancellationDomain, type RunSettlementProof } from "@gajae-code/agent-core";
21
21
  import type { Tool } from "@gajae-code/ai/core";
22
22
  import type { NotificationServer as NativeNotificationServer } from "@gajae-code/natives";
23
23
  type NotificationServer = NativeNotificationServer;
@@ -266,6 +266,15 @@ export declare class PresentationArbiter {
266
266
  interface SessionRuntime {
267
267
  server: NotificationServer;
268
268
  host: SessionSdkHost;
269
+ getJoinedPromptCorrelations: (owner: AgentTerminalOwnerContext) => Array<{
270
+ commandId: string;
271
+ turnId: string;
272
+ }>;
273
+ isPromptRunOwner: (correlation: {
274
+ commandId: string;
275
+ turnId: string;
276
+ }, owner: AgentTerminalOwnerContext) => boolean;
277
+ retireJoinedPromptOwners: () => void;
269
278
  /** Delivers one ring-positioned event envelope to every attached subscriber
270
279
  * connection, applying the same capability gate as event replay. */
271
280
  broadcastEventFrame: (event: SdkFrame) => string[];
@@ -640,6 +649,8 @@ export declare function createNotificationsExtension(api: ExtensionAPI, options?
640
649
  * preflight outside the durable admission path (review thread P2).
641
650
  */
642
651
  terminalAbortSeams?: {
652
+ getTerminalRunOwnerForEvent?: (event: object) => AgentTerminalOwnerContext | undefined;
653
+ getRunOwnerDomain?: (handle: string) => RunCancellationDomain | undefined;
643
654
  getTerminalTurnEpoch: () => number | undefined;
644
655
  cancelPendingPreflightForTerminalAbort: () => void;
645
656
  captureTerminalAbortSteeringSnapshot?: () => void;
@@ -291,8 +291,13 @@ export declare const SDK_LIFECYCLE_ROUTER_PROTOCOL_VERSION = 1;
291
291
  * so generation-191 owners cannot reap hosts with queued or promoted work.
292
292
  * Generation 193 gates streamed content on negotiated observer capabilities,
293
293
  * so existing owners are replaced before exposing the new observer path.
294
+ * Generation 201 binds queued cancellation and terminal deadlines to the exact
295
+ * consuming run, so pre-fix owners cannot serve the new generic lifecycle path.
296
+ * Generation 202 joins queued-removal terminal publication before ordinary
297
+ * abort acknowledgement, replacing owners that still acknowledge cancellation
298
+ * before its terminal record is durable.
294
299
  */
295
- export declare const DAEMON_GENERATION = 200;
300
+ export declare const DAEMON_GENERATION = 202;
296
301
  /**
297
302
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 7
298
303
  * requires durable publication receipts and acknowledged attachment dispatch,
@@ -58,6 +58,8 @@ export interface SdkClientOptions {
58
58
  }
59
59
  export interface SdkRequestOptions {
60
60
  timeoutMs?: number;
61
+ /** Absolute wall-clock deadline for this request, including connection setup. */
62
+ deadline?: number;
61
63
  idempotencyKey?: string;
62
64
  confirm?: boolean;
63
65
  /**
@@ -1,3 +1,4 @@
1
+ import type { ProjectProgressSnapshot } from "../../../progress/progress-contract.js";
1
2
  import type { ActiveProviderDescriptor } from "../../providers.js";
2
3
  import { type CursorRegistry } from "./cursor.js";
3
4
  import type { RevisionStore } from "./revision-store.js";
@@ -33,6 +34,8 @@ export interface SessionSurface {
33
34
  totalBytes: number;
34
35
  } | undefined>;
35
36
  getJobs(): unknown | Promise<unknown>;
37
+ /** Q32 read-only project progress snapshot (`gjc.project_progress.v1`). */
38
+ getProjectProgress?(): ProjectProgressSnapshot | Promise<ProjectProgressSnapshot>;
36
39
  /** Q26 keyed lookup of a submitted prompt's authoritative reconciliation status. */
37
40
  getPromptStatus?(selector: {
38
41
  commandId?: string;
@@ -1,4 +1,5 @@
1
1
  export { MODEL_PROFILE_DISCOVERY_QUERY, MODEL_PROFILE_ERROR_DETAIL_MAX_BYTES, type ModelProfileCatalogItem, type ModelProfileErrorCode, type ModelProfileErrorDetails, ModelProfileRegistryError, type ModelProfileRegistryErrorDetails, type UnknownModelProfileDetails, UnknownModelProfileError, } from "../config/model-profile-contract";
2
+ export { PROJECT_PROGRESS_SNAPSHOT_SCHEMA, type ProgressSnapshotAttention, type ProgressSnapshotStory, type ProgressSnapshotTodo, type ProgressSnapshotWorkflow, type ProjectProgressSnapshot, } from "../progress/progress-contract";
2
3
  export type { QueuedInputAdmission, QueuedInputDelivery, QueuedInputExecution, QueuedInputQueuePolicy, QueuedInputRemovalReason, QueuedInputSubmission, QueuedInputTerminal, SendUserMessageOptions, TrackedSendUserMessageOptions, } from "../session/agent-session";
3
4
  export * as bus from "./bus";
4
5
  export * from "./diagnostics/observe-broker";
@@ -112,6 +112,7 @@ export interface SessionRouterClient {
112
112
  connect?(): Promise<void>;
113
113
  request(frame: Record<string, unknown>, options?: {
114
114
  timeoutMs?: number;
115
+ deadline?: number;
115
116
  connectedOnly?: boolean;
116
117
  /** Synchronous pre-send observer; a throw aborts the dispatch before the wire. */
117
118
  beforeDispatch?: (context: SdkDispatchContext) => void;
@@ -224,6 +225,7 @@ export declare class SessionRouter {
224
225
  /** Sends an SDK command through the current attachment without exposing its client. */
225
226
  request(sessionId: string, frame: Record<string, unknown>, expectedGeneration?: number, expectedAttachment?: SessionAttachment, options?: {
226
227
  timeoutMs?: number;
228
+ deadline?: number;
227
229
  beforeDispatch?: (context: SdkDispatchContext) => void;
228
230
  onDispatch?: SdkDispatchHandler;
229
231
  dispatchFence?: (dispatch: () => Promise<Record<string, unknown>>) => Promise<Record<string, unknown>>;
@@ -1,6 +1,6 @@
1
1
  export type SessionListPageRecord = Record<string, unknown>;
2
2
  export type SessionListSavedSessionOmissionReason = "scope_unavailable" | "candidate_scan_failed" | "candidate_not_found" | "candidate_ambiguous" | "candidate_invalid" | "identity_incomplete";
3
- export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "atomic_unavailable", "invalid_request", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
3
+ export declare const SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES: readonly ["cwd_missing", "cwd_not_directory", "identity_unavailable", "network_unsupported", "sessions_root_unavailable", "binding_conflict", "binding_invalid", "migration_busy", "managed_gc_journal_capacity_exceeded", "atomic_unavailable", "invalid_request", "durability_failed", "durability_not_provable", "capacity_exceeded", "scan_failed", "unsafe_root", "invalid_candidate", "invalid_header", "unreadable_candidate", "source_changed", "cwd_not_found", "cwd_not_utf8", "cwd_network_unsupported", "cwd_identity_unavailable", "cwd_io_error"];
4
4
  export type SessionListSavedSessionOmissionDetailCode = (typeof SESSION_LIST_SAVED_SESSION_OMISSION_DETAIL_CODES)[number];
5
5
  /** Path-free diagnostic for a requested managed transcript that could not be selected safely. */
6
6
  export interface SessionListSavedSessionOmission {
@@ -3,6 +3,7 @@ import { type AuthCredentialSelector, type Model, type ProviderSessionState } fr
3
3
  import { createAppendOnlyContextManager, providerSupportsAppendOnlyAuto, resolveAppendOnlyMode } from "../append-only-mode";
4
4
  import { AsyncJobManager } from "../async";
5
5
  import { type Rule } from "../capability/rule";
6
+ import type { ModelProfileOwnershipMarker } from "../config/model-profile-ownership";
6
7
  import { ModelRegistry } from "../config/model-registry";
7
8
  import { type ScopedModelSelection } from "../config/model-resolver";
8
9
  import { type PromptTemplate } from "../config/prompt-templates";
@@ -82,6 +83,8 @@ export interface CreateAgentSessionOptions {
82
83
  modelPattern?: string;
83
84
  /** Active profile inherited by a nested SDK/subagent session. */
84
85
  activeModelProfile?: string;
86
+ /** Model profile ownership marker for propagating parent profile ownership to subagent sessions. */
87
+ modelProfileOwnershipMarker?: ModelProfileOwnershipMarker;
85
88
  /** Thinking selector. Default: from settings, else unset */
86
89
  thinkingLevel?: ThinkingLevel;
87
90
  /** Runtime substitution metadata for the initial model_change session event. */
@@ -194,6 +197,11 @@ export interface CreateAgentSessionOptions {
194
197
  * @internal lifecycle-only startup guard.
195
198
  */
196
199
  deferOptionalModelRefresh?: boolean;
200
+ /**
201
+ * Defer model profile activation until explicit model pin validation occurs.
202
+ * @internal Lifecycle-only: prevents default profile activation before pin resolution.
203
+ */
204
+ deferModelProfileActivation?: boolean;
197
205
  /** Enable LSP integration (tool, formatting, diagnostics, warmup). Default: true */
198
206
  enableLsp?: boolean;
199
207
  /** Skip Python kernel availability check and prelude warmup */
@@ -12,7 +12,7 @@
12
12
  *
13
13
  * Modes use this class and add their own I/O layer on top.
14
14
  */
15
- import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTool, type MidRunMaintenanceOutcome, type RunSettlementProof, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
15
+ import { type Agent, type AgentContext, type AgentEvent, type AgentLoopConfig, type AgentMessage, type AgentState, type AgentTerminalOwnerContext, type AgentTool, type MidRunMaintenanceOutcome, type RunCancellationDomain, type RunSettlementProof, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
16
16
  import type { AttemptScope } from "@gajae-code/agent-core/attempt-scope";
17
17
  import { type CompactionResult, type EmergencyCompactionSample } from "@gajae-code/agent-core/compaction";
18
18
  import type { AssistantMessage, AttemptScopeRef, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolCall, ToolChoice, Usage, UsageReport } from "@gajae-code/ai/core";
@@ -68,7 +68,7 @@ export interface ForkContextSeedOptions {
68
68
  signal?: AbortSignal;
69
69
  }
70
70
  import type { AuthCredentialSelector } from "@gajae-code/ai/core";
71
- import { type AsyncJob, type AsyncJobDeliveryState, AsyncJobManager, type FoldReason, type JobFoldEvent } from "../async";
71
+ import { type AsyncJob, type AsyncJobDeliveryState, AsyncJobManager, type FoldReason, type JobFoldEvent, type SubagentLifecycle } from "../async";
72
72
  import type { Rule } from "../capability/rule";
73
73
  import { type ModelRegistry } from "../config/model-registry";
74
74
  import { type ResolvedModelRoleValue, type ScopedModelSelection } from "../config/model-resolver";
@@ -84,7 +84,7 @@ import type { ExtensionRunner } from "../extensibility/extensions";
84
84
  import { type CompactOptions, type ContextUsage, type ExtensionTranscriptEntry } from "../extensibility/extensions/types";
85
85
  import type { GjcRuntimeSnapshotProvider } from "../extensibility/gjc-plugins/runtime-quarantine";
86
86
  import type { SessionSwitchEvent } from "../extensibility/shared-events";
87
- import { type Skill, type SkillWarning } from "../extensibility/skills";
87
+ import { type ParsedSkillInvocation, type Skill, type SkillWarning } from "../extensibility/skills";
88
88
  import { type FileSlashCommand } from "../extensibility/slash-commands";
89
89
  import { type MemoryGuardClaimsLease } from "../gjc-runtime/memory-guard-owner-claims";
90
90
  import { GoalRuntime } from "../goals/runtime";
@@ -113,7 +113,7 @@ import { type ContributionPrepOptions, type ContributionPrepResult } from "./con
113
113
  import { type FoldAdapter, FoldCoordinator, type ForegroundFoldOutcome } from "./fold-coordinator";
114
114
  import type { MemoryGuardRestoreResult } from "./memory-guard-checkpoint-participant";
115
115
  import { type CustomMessage } from "./messages";
116
- import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManagerCloseOutcome, SessionMemoryStats } from "./session-manager";
116
+ import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, PreparedNewSession, RecoveryHydrationContext, RecoveryHydrationPromotionFence, SessionContext, SessionManagerCloseOutcome, SessionMemoryStats, SessionArtifactPublication } from "./session-manager";
117
117
  import { SessionManager } from "./session-manager";
118
118
  import { ToolChoiceQueue } from "./tool-choice-queue";
119
119
  import { YieldQueue } from "./yield-queue";
@@ -603,11 +603,7 @@ export declare class SessionDisposalIncompleteError extends Error {
603
603
  constructor(label?: string);
604
604
  }
605
605
  export declare function isSessionDisposalIncompleteError(error: unknown): error is SessionDisposalIncompleteError;
606
- export interface AgentBashArtifactStore {
607
- saveArtifact(content: string, toolType: string): Promise<string | undefined>;
608
- getArtifactPath(id: string): Promise<string | null>;
609
- }
610
- export declare function saveAgentBashOriginalArtifact(store: AgentBashArtifactStore, originalText: string): Promise<BashArtifactSaveResult>;
606
+ export declare function saveAgentBashOriginalArtifact(publication: SessionArtifactPublication, originalText: string): Promise<BashArtifactSaveResult>;
611
607
  type IrcRosterClaim = {
612
608
  token: symbol;
613
609
  signature: string;
@@ -854,6 +850,11 @@ export declare class AgentSession {
854
850
  getAsyncJobSnapshot(options?: {
855
851
  recentLimit?: number;
856
852
  }): AsyncJobSnapshot | null;
853
+ /**
854
+ * Lifecycle status of every subagent owned by this session, read from the
855
+ * manager's stable control-plane records (they outlive AsyncJob eviction).
856
+ */
857
+ getSubagentLifecycleStatuses(): SubagentLifecycle[];
857
858
  /**
858
859
  * Emit a UI-only notice to the session. Surfaces in interactive mode as a
859
860
  * `showWarning` / `showError` / `showStatus` line; non-interactive modes
@@ -1212,6 +1213,20 @@ export declare class AgentSession {
1212
1213
  * @throws Error if no model selected or no API key available (when not streaming)
1213
1214
  */
1214
1215
  prompt(text: string, options?: PromptOptions): Promise<void>;
1216
+ /**
1217
+ * The loaded skill a prompt's text dispatches to, or undefined when `prompt`
1218
+ * would submit it as ordinary text (unknown or disabled `/skill:` names,
1219
+ * chains, or attached images). Single source for dispatch and for callers
1220
+ * that must mirror it, such as startup title seeding.
1221
+ */
1222
+ resolvePromptSkillInvocation(text: string, images?: readonly unknown[]): ParsedSkillInvocation | undefined;
1223
+ /**
1224
+ * Whether `prompt` intercepts this slash text as an extension or custom/MCP
1225
+ * command. Used to keep command arguments away from the title model. Mirrors the
1226
+ * command lookup in `#tryExecuteExtensionCommand` / `#tryExecuteCustomCommand`
1227
+ * without executing anything.
1228
+ */
1229
+ isLocallyHandledSlashCommand(text: string): boolean;
1215
1230
  promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice" | "followUpQueuePolicy" | "steerQueuePolicy" | "onPreflightAccepted" | "onPreflightAcceptCommit" | "preflightSignal" | "sdkRunCapability">): Promise<void>;
1216
1231
  /**
1217
1232
  * Queue a steering message to interrupt the agent mid-run.
@@ -1397,6 +1412,8 @@ export declare class AgentSession {
1397
1412
  rebindTerminalAbortSteeringSnapshot(token: number): void;
1398
1413
  discardTerminalAbortSteeringSnapshot(token: number): void;
1399
1414
  getTerminalTurnEpoch(): number | undefined;
1415
+ getTerminalRunOwnerForEvent(event: object): AgentTerminalOwnerContext | undefined;
1416
+ getRunOwnerDomain(handle: string): RunCancellationDomain | undefined;
1400
1417
  /**
1401
1418
  * Tool call ids the run resource ledger currently holds for `handle` (#5637).
1402
1419
  *
@@ -1464,6 +1481,17 @@ export declare class AgentSession {
1464
1481
  }): Promise<void>;
1465
1482
  setActiveModelProfile(name: string | undefined): void;
1466
1483
  getActiveModelProfile(): string | undefined;
1484
+ setUnavailableModelProfile(name: string | undefined): void;
1485
+ getUnavailableModelProfile(): string | undefined;
1486
+ /** Revision fence for deferred activation after a user model selection. */
1487
+ getUserModelSelectionRevision(): number;
1488
+ /** Latest concrete user choice that seeded or cleared the session's sticky canonical variant. */
1489
+ getUserCanonicalVariantSelection(): {
1490
+ revision: number;
1491
+ canonicalVariant: string | undefined;
1492
+ };
1493
+ /** Fence deferred startup profile recovery before an explicit control-surface selection. */
1494
+ markUserModelSelection(): void;
1467
1495
  /**
1468
1496
  * Re-apply vendor-separated delegation after a profile activation changed the
1469
1497
  * role layer. `eagerTasks` is resolved at prompt build time, but under
@@ -1597,6 +1625,7 @@ export declare class AgentSession {
1597
1625
  reason?: TemporaryModelReason;
1598
1626
  providerSessionScope?: TemporaryProviderSessionScope;
1599
1627
  signal?: AbortSignal;
1628
+ shouldMutate?: () => boolean;
1600
1629
  onMutationStarted?: () => void;
1601
1630
  }): Promise<TemporaryProviderSessionScope | void>;
1602
1631
  /** Restore the exact live-model state captured before a failed selector transaction. */
@@ -77,8 +77,8 @@ export declare class ArtifactManager {
77
77
  * Best-effort removal of a previously published named artifact. Used to roll
78
78
  * back staged publications when a transactional operation (e.g. gated
79
79
  * maintenance pruning) is rejected after publication succeeded. Returns false
80
- * when the artifact could not be removed so callers can log the failure
81
- * instead of silently treating the rollback as complete.
80
+ * when the exact named artifact is absent or could not be removed; success does
81
+ * not claim that unrelated native cleanup residue was reclaimed.
82
82
  */
83
83
  removeNamedBestEffort(filename: string): Promise<boolean>;
84
84
  /**
@@ -0,0 +1,32 @@
1
+ import type { SessionStorageFileIdentity } from "../session-storage";
2
+ import { type TaskArtifactOwnerDeletionEvidence, type TaskArtifactOwnerLocator, type TaskArtifactOwnerRetirementContinuation, type TaskArtifactOwnerRetirementOutcome, type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
3
+ export type ManagedGcSessionRetirementState = "prepared" | "artifacts_removed" | "owner_pending" | "owner_retired";
4
+ export interface ManagedGcSessionRetirementTarget {
5
+ readonly transcriptPath: string;
6
+ readonly sessionId: string;
7
+ readonly cwd: string;
8
+ readonly transcriptIdentity: SessionStorageFileIdentity;
9
+ readonly taskArtifactOwnerLocator: TaskArtifactOwnerLocator;
10
+ }
11
+ export interface ManagedGcSessionRetirementReceipt extends ManagedGcSessionRetirementTarget {
12
+ readonly state: ManagedGcSessionRetirementState;
13
+ readonly taskArtifactOwnerDeletionEvidence: TaskArtifactOwnerDeletionEvidence;
14
+ readonly artifactsRemoved?: true;
15
+ readonly ownerRetirementAttempt?: number;
16
+ readonly taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
17
+ readonly taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
18
+ readonly taskArtifactOwnerPayloadRetired?: true;
19
+ readonly taskArtifactOwnerNamespaceRetained?: true;
20
+ readonly taskArtifactOwnerRetired?: true;
21
+ }
22
+ export declare function managedGcRetirementIdentityRecord(identity: SessionStorageFileIdentity): Record<string, unknown>;
23
+ export declare function sameIdentity(left: SessionStorageFileIdentity, right: SessionStorageFileIdentity): boolean;
24
+ export declare function managedGcRetirementIdentityValue(value: unknown): SessionStorageFileIdentity;
25
+ /**
26
+ * Strictly decode one persisted managed-GC receipt. A decoded `owner_retired` outcome is persisted DTO data only;
27
+ * this pure parser does not verify current filesystem state, payload destruction, or writer quiescence. A future
28
+ * journal reader must perform the live physical-retirement proof for the relevant state before treating it as done.
29
+ */
30
+ export declare function parseManagedGcRetirementReceipt(value: unknown, scopeDigest: string, ownerContext: TaskArtifactOwnerStorageContext, target: ManagedGcSessionRetirementTarget): ManagedGcSessionRetirementReceipt;
31
+ /** Check only monotone DTO history; this does not establish physical cleanup or current authority. */
32
+ export declare function continuationExtendsPrevious(previous: TaskArtifactOwnerRetirementContinuation, next: TaskArtifactOwnerRetirementContinuation): boolean;
@@ -1,6 +1,8 @@
1
1
  import type { RecoveryFsRoot } from "@gajae-code/natives";
2
2
  import type { ResumeSessionIdentity } from "../session-manager";
3
3
  import { type NativeDirectoryTreeSnapshot } from "../session-storage";
4
+ import { type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
5
+ import { type ManagedGcSessionRetirementReceipt, type ManagedGcSessionRetirementTarget } from "./managed-gc-retirement-codec";
4
6
  import { type ManagedDirectoryRoot, type ManagedSessionSecurityPolicy, type ManagedStorageLock } from "./managed-session-storage";
5
7
  export declare const MANAGED_SESSION_LAYOUT_VERSION: 2;
6
8
  export declare const MANAGED_SESSION_IDENTITY_VERSION: 1;
@@ -17,6 +19,57 @@ export interface ManagedScope {
17
19
  directoryPath: string;
18
20
  platform: "posix" | "win32";
19
21
  }
22
+ export interface ManagedGcProtocolPathIdentity {
23
+ readonly path: string;
24
+ readonly dev: string;
25
+ readonly ino: string;
26
+ }
27
+ export interface ManagedGcProtocolFileSnapshot {
28
+ readonly name: string;
29
+ readonly dev: string;
30
+ readonly ino: string;
31
+ readonly nlink: string;
32
+ readonly size: number;
33
+ readonly mtimeNs: string;
34
+ readonly ctimeNs: string;
35
+ readonly mode: number;
36
+ readonly sha256: string;
37
+ }
38
+ export type ManagedGcProtocolRole = "locks" | "receipts" | "tombstones";
39
+ export interface ManagedGcProtocolDirectorySnapshot {
40
+ readonly role: ManagedGcProtocolRole;
41
+ readonly path: string;
42
+ readonly dev: string;
43
+ readonly ino: string;
44
+ readonly mtimeNs: string;
45
+ readonly ctimeNs: string;
46
+ readonly mode: number;
47
+ readonly files: readonly ManagedGcProtocolFileSnapshot[];
48
+ }
49
+ /** Read-only protocol data; never a deletion capability. */
50
+ export interface ManagedGcProtocolScopeSnapshot {
51
+ readonly configuredRoot: ManagedGcProtocolPathIdentity;
52
+ readonly profile: ManagedGcProtocolPathIdentity;
53
+ readonly sessionsRoot: ManagedGcProtocolPathIdentity;
54
+ readonly scope: ManagedGcProtocolPathIdentity;
55
+ readonly binding: ManagedGcProtocolFileSnapshot;
56
+ readonly protocol: ManagedGcProtocolPathIdentity;
57
+ readonly protocolMtimeNs: string;
58
+ readonly protocolCtimeNs: string;
59
+ readonly protocolMode: number;
60
+ readonly directories: readonly ManagedGcProtocolDirectorySnapshot[];
61
+ }
62
+ export interface ManagedGcProtocolScopeInput {
63
+ readonly scopePath: string;
64
+ readonly scopeIdentity: ManagedGcProtocolPathIdentity;
65
+ readonly bindingIdentity: ManagedGcProtocolFileSnapshot;
66
+ readonly protocolIdentity: ManagedGcProtocolScopeSnapshot["protocol"] & {
67
+ readonly mtimeNs: string;
68
+ readonly ctimeNs: string;
69
+ readonly mode: number;
70
+ };
71
+ }
72
+ export type ManagedGcProtocolScopeInspector = (inputs: readonly ManagedGcProtocolScopeInput[]) => Promise<readonly ManagedGcProtocolScopeSnapshot[]>;
20
73
  /**
21
74
  * Opaque managed writer authority captured by a trusted destination. The open
22
75
  * transaction must use this authority rather than reacquiring its root from a
@@ -34,7 +87,7 @@ export declare function managedDirectoryIdentityForScope(scope: ManagedScope): {
34
87
  };
35
88
  export declare function managedRootForScope(scope: ManagedScope): ManagedDirectoryRoot;
36
89
  export type ManagedMigrationPolicy = "copy-retain" | "disabled";
37
- export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable" | "capacity_exceeded";
90
+ export type ManagedScopeErrorCode = "cwd_missing" | "cwd_not_directory" | "identity_unavailable" | "network_unsupported" | "sessions_root_unavailable" | "binding_conflict" | "binding_invalid" | "migration_busy" | "managed_gc_journal_capacity_exceeded" | "atomic_unavailable" | "invalid_request" | "durability_failed" | "durability_not_provable" | "capacity_exceeded";
38
91
  export type ManagedScopeResolution = {
39
92
  kind: "resolved";
40
93
  scope: ManagedScope;
@@ -69,7 +122,7 @@ export type ManagedCandidateListing = {
69
122
  code: "scan_failed" | "unsafe_root" | "invalid_candidate";
70
123
  message: string;
71
124
  };
72
- export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
125
+ export type ManagedOpenFailure = "migration_busy" | "binding_conflict" | "binding_invalid" | "destination_conflict" | "source_changed" | "unsafe_artifacts" | "artifact_capacity_exceeded" | "managed_gc_journal_capacity_exceeded" | "durability_failed" | "atomic_unavailable" | "invalid_request" | "durability_not_provable" | "migration_retired" | "legacy_migration_disabled" | "managed_storage_unsupported";
73
126
  export type ManagedOpenCandidateResult = {
74
127
  kind: "opened";
75
128
  path: string;
@@ -132,6 +185,8 @@ interface ManagedScopeInput {
132
185
  export declare function resolveManagedScope(input: ManagedScopeInput): ManagedScopeResolution;
133
186
  /** Resolve a scope for a synchronous write without mutating an existing ACL mismatch. */
134
187
  export declare function resolveManagedScopeForWrite(input: ManagedScopeInput): ManagedScopeResolution;
188
+ /** Resolve only an existing, authenticated v2 scope; this path never initializes or repairs storage. */
189
+ export declare function resolveManagedGcScopeForRead(input: ManagedScopeInput): ManagedScopeResolution;
135
190
  export declare function canonicalBindingOpenFlags(platform?: NodeJS.Platform): number;
136
191
  export declare function fsyncCanonicalBinding(bindingPath: string, expected: string): void;
137
192
  export declare function ensureManagedScope(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy): Promise<ManagedScopeResolution>;
@@ -201,6 +256,28 @@ export declare function isRecoverableOwnerOnlyModeDrift(error: unknown): boolean
201
256
  /** Synchronously create and validate the v2 binding before a default session writer exists. */
202
257
  export declare function prepareManagedSessionScopeForWriteSync(scope: ManagedScope, policy?: ManagedSessionSecurityPolicy, authority?: ManagedCandidateWriteAuthority): ManagedScopeResolution;
203
258
  export declare function listManagedCandidates(scope: ManagedScope): ManagedCandidateListing;
259
+ /** Build owner-storage authority only from a previously prepared trusted managed scope. */
260
+ export declare function taskArtifactOwnerStorageContextForScope(scope: ManagedScope): TaskArtifactOwnerStorageContext;
261
+ /** Bind the first transcript header through FileSessionStorage's descriptor-bound, no-follow snapshot. */
262
+ export declare function bindManagedGcSessionRetirementTarget(scope: ManagedScope, transcriptPathValue: string): ManagedGcSessionRetirementTarget;
263
+ /** Read the prepared authority first, then strictly validate every later receipt against it. */
264
+ export declare function readManagedGcSessionRetirementReceipt(scope: ManagedScope, transcriptPath: string): Promise<ManagedGcSessionRetirementReceipt | undefined>;
265
+ /** Read an authenticated journal without creating lock/receipt directories or repairing security state. */
266
+ export declare function readManagedGcSessionRetirementReceiptReadOnly(scope: ManagedScope, transcriptPath: string): Promise<ManagedGcSessionRetirementReceipt | undefined>;
267
+ /** Discover complete owner journals under authenticated existing v2 scopes without initializing storage. */
268
+ export declare function discoverManagedGcSessionRetirementReceipts(input: {
269
+ agentDir: string;
270
+ sessionsRoot: string;
271
+ }): Promise<readonly {
272
+ readonly scope: ManagedScope;
273
+ readonly receipt: ManagedGcSessionRetirementReceipt;
274
+ }[]>;
275
+ /** Inspect under a live operation lease; returned snapshots never authorize effects. */
276
+ export declare function managedGcProtocolInspectorForLock(scope: ManagedScope, lock: ManagedStorageLock): ManagedGcProtocolScopeInspector;
277
+ /** Bind a read-only protocol inventory to an already prepared scope's root/profile/session identities. */
278
+ export declare function managedGcProtocolScopeInspectorForScope(scope: ManagedScope): ManagedGcProtocolScopeInspector;
279
+ /** Atomically publish one journal state under the managed scope lock; no GC effects are activated here. */
280
+ export declare function publishManagedGcSessionRetirementReceipt(scope: ManagedScope, receipt: ManagedGcSessionRetirementReceipt): Promise<ManagedGcSessionRetirementReceipt>;
204
281
  export declare function artifactTreeReplayCompatible(observed: NativeDirectoryTreeSnapshot, expected: NativeDirectoryTreeSnapshot): boolean;
205
282
  type DetachedArtifactRoot = {
206
283
  originalPath: string;
@@ -5,6 +5,7 @@ export declare const MANAGED_ARTIFACT_MAX_DEPTH = 32;
5
5
  export declare const MANAGED_ARTIFACT_MAX_FILES = 50000;
6
6
  export declare const MANAGED_ARTIFACT_MAX_FILE_BYTES: number;
7
7
  export declare const MANAGED_ARTIFACT_MAX_TOTAL_BYTES: number;
8
+ export declare const MANAGED_SESSION_READ_RANGE_MAX_BYTES: number;
8
9
  export declare const MANAGED_ARTIFACT_COPY_BATCH_SIZE = 256;
9
10
  /** A pre-mutation append fence rejection: no bytes from this append were written. */
10
11
  export declare class ManagedAppendIdentityMismatchError extends Error {
@@ -104,6 +105,8 @@ export interface ManagedBoundedAppendExpectation {
104
105
  readonly ctimeNs: string;
105
106
  readonly sha256: string;
106
107
  }
108
+ /** Exact quarantine names used when native exact-unlink leaves a scrubbed lock inode. */
109
+ export declare function isManagedLockQuarantineName(name: string): boolean;
107
110
  export interface ScrubbedProtocolRemnantReapResult {
108
111
  readonly reaped: number;
109
112
  readonly failures: number;
@@ -135,6 +138,16 @@ export declare function reapScrubbedProtocolRemnantsSync(directory: string, minA
135
138
  */
136
139
  export declare function reapScrubbedProtocolRemnants(directory: string, minAgeMs?: number): Promise<ScrubbedProtocolRemnantReapResult>;
137
140
  export declare function validateNativeSecurityResult(value: unknown, operation: "apply" | "verify", kind: "directory" | "file"): NativeOwnerOnlySecurityResult;
141
+ export type LockRecord = {
142
+ attemptId: string;
143
+ pid: number;
144
+ bootId?: string;
145
+ processStartId: string;
146
+ createdAt: number;
147
+ heartbeatAt: number;
148
+ leaseExpiresAt: number;
149
+ released?: boolean;
150
+ };
138
151
  export interface ManagedLockRetirementTestEvent {
139
152
  readonly path: string;
140
153
  readonly attemptId: string;
@@ -168,13 +181,18 @@ export declare function retainManagedDirectoryAuthority(root: ManagedDirectoryRo
168
181
  }): RecoveryFsRoot | undefined;
169
182
  export declare function assertManagedDirectoryRoot(root: ManagedDirectoryRoot): void;
170
183
  export declare function managedSecurityFailureClassification(error: unknown): string | undefined;
184
+ /** Exact, identity-bound read access retained for the lifetime of one managed stream. */
185
+ export interface ManagedSessionReadLease {
186
+ readRange(start: number, length: number): Uint8Array;
187
+ close(): void;
188
+ }
171
189
  /** Internal retained-root capability for one managed descendant subtree. */
172
190
  export declare class ManagedSessionDescendantStore {
173
191
  #private;
174
192
  constructor(root: ManagedDirectoryRoot, baseDir: string, retained?: {
175
193
  authority: RecoveryFsRoot;
176
194
  authorityBaseDir: string;
177
- }, policy?: ManagedSessionSecurityPolicy, profileAgentDir?: string, expectedSubtreeRoot?: ManagedDirectoryRoot);
195
+ }, policy?: ManagedSessionSecurityPolicy, profileAgentDir?: string, expectedSubtreeRoot?: ManagedDirectoryRoot, access?: "read-only" | "read-write");
178
196
  get dir(): string;
179
197
  get rootAuthority(): ManagedDirectoryRoot;
180
198
  get subtreeRootAuthority(): ManagedDirectoryRoot;
@@ -223,8 +241,12 @@ export declare class ManagedSessionDescendantStore {
223
241
  * managed-session indexing without weakening pathname authority.
224
242
  */
225
243
  readRangeExpectedSync(relativePath: string, start: number, length: number, expectedDescriptor?: Pick<SessionStorageStat, "dev" | "ino" | "nlink" | "size" | "mtimeNs" | "ctimeNs">): SessionStorageRangeSnapshot;
244
+ /** Open an identity-bound stream lease; Darwin uses exact bounded range reads per chunk. */
245
+ openReadLease(relativePath: string, expectedDescriptor: Pick<SessionStorageStat, "dev" | "ino" | "nlink" | "size" | "mtimeNs" | "ctimeNs">): ManagedSessionReadLease;
226
246
  /** Read an exact managed file without exposing its pathname as authority. */
227
247
  readExpected(relativePath: string): ManagedFileSnapshot | null;
248
+ /** Read one complete managed file through retained authority after descriptor-size admission. */
249
+ readExpectedBounded(relativePath: string, maxBytes: number, admitSize?: (size: number, descriptor: ManagedFileIdentity) => void): ManagedFileSnapshot | null;
228
250
  /** Remove an exact captured file without reopening its pathname as authority. */
229
251
  removeExpected(relativePath: string, expected: ManagedFileSnapshot): void;
230
252
  /** Remove one exact file without allocating its contents. */
@@ -253,10 +275,13 @@ export declare class ManagedSessionDescendantStore {
253
275
  fsyncTree(): NativeDirectoryTreeSnapshot;
254
276
  }
255
277
  export declare function shouldFsyncManagedDirectory(platform?: NodeJS.Platform): boolean;
278
+ export declare function parseManagedLockRecord(bytes: Uint8Array): LockRecord | undefined;
256
279
  /** Create a managed directory and fail closed unless its owner-only mode/ACL verifies. */
257
280
  export declare function ensureManagedDirectory(pathname: string, root?: ManagedDirectoryRoot, policy?: ManagedSessionSecurityPolicy): void;
258
281
  /** Captures a bounded prefix from one no-follow descriptor and rechecks the pathname before use. */
259
282
  export declare function captureManagedFilePrefixNoFollow(pathname: string, maxBytes: number): ManagedFileSnapshot;
283
+ /** Captures a complete no-follow file only after descriptor-size admission and before allocating its bytes. */
284
+ export declare function captureManagedFileNoFollowBounded(pathname: string, maxBytes: number, admitSize?: (size: number, descriptor: ManagedFileIdentity) => void): ManagedFileSnapshot;
260
285
  /** Captures header/hash/copy input from one no-follow descriptor and rechecks the pathname before use. */
261
286
  export declare function captureManagedFileNoFollow(pathname: string): ManagedFileSnapshot;
262
287
  /** Streams a managed file once while retaining only a bounded header prefix and the full descriptor-bound digest. */
@@ -0,0 +1,62 @@
1
+ import type { ResumeSessionIdentity } from "../session-manager";
2
+ import { type VerifiedSessionDeleteResult, type VerifiedSessionDeleteTarget } from "../session-storage";
3
+ import type { TaskArtifactOwnerDeletionEvidence, TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
4
+ import type { ManagedGcSessionRetirementReceipt, ManagedGcSessionRetirementTarget } from "./managed-gc-retirement-codec";
5
+ import type { ManagedGcProtocolScopeInspector } from "./managed-session-scope";
6
+ export interface ManagedGcOwnerCleanupTarget {
7
+ readonly path: string;
8
+ readonly sessionId: string;
9
+ readonly cwd: string;
10
+ readonly identity: ResumeSessionIdentity;
11
+ readonly taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
12
+ }
13
+ /** Authenticated receipt operations and fencing supplied by the prepared managed scope. */
14
+ export interface ManagedGcOwnerCleanupAuthority {
15
+ readonly agentDir: string;
16
+ readonly sessionsRoot: string;
17
+ readonly directoryPath: string;
18
+ readonly storageContext: TaskArtifactOwnerStorageContext;
19
+ readonly inspectProtocol: ManagedGcProtocolScopeInspector;
20
+ readonly assertOwned: () => void;
21
+ readonly bindTarget: (transcriptPath: string) => ManagedGcSessionRetirementTarget;
22
+ readonly readReceipt: (transcriptPath: string) => Promise<ManagedGcSessionRetirementReceipt | undefined>;
23
+ readonly publishReceipt: (receipt: ManagedGcSessionRetirementReceipt) => Promise<ManagedGcSessionRetirementReceipt>;
24
+ readonly findCompletedRetirement: (evidence: TaskArtifactOwnerDeletionEvidence, exceptTranscriptPath: string) => Promise<{
25
+ scope: {
26
+ readonly agentDir: string;
27
+ readonly sessionsRoot: string;
28
+ readonly directoryPath: string;
29
+ };
30
+ receipt: ManagedGcSessionRetirementReceipt;
31
+ } | undefined>;
32
+ }
33
+ export type ManagedGcOwnerProgress = {
34
+ readonly state: "none" | "owner_retired" | "payload_retired" | "pending";
35
+ readonly message?: string;
36
+ };
37
+ export type ManagedGcOwnerDeleteFields = Pick<VerifiedSessionDeleteTarget, "taskArtifactOwnerStorageContext" | "taskArtifactOwnerDeletionEvidence" | "taskArtifactOwnerRetirementOutcome" | "taskArtifactOwnerRetirementContinuation" | "taskArtifactOwnerPayloadRetired" | "taskArtifactOwnerNamespaceRetained" | "deferTaskArtifactOwnerRetirement" | "taskArtifactOwnerRetired">;
38
+ export declare function hasUnsupportedLegacyOwnerTarget(scopeDirectory: string, target: ManagedGcOwnerCleanupTarget): boolean;
39
+ export declare function prepareManagedGcOwnerTarget<T extends ManagedGcOwnerCleanupTarget>(authority: ManagedGcOwnerCleanupAuthority, target: T): Promise<T & ManagedGcOwnerCleanupTarget>;
40
+ export declare function prepareManagedGcOwnerTargets<T extends ManagedGcOwnerCleanupTarget>(authority: ManagedGcOwnerCleanupAuthority, targets: readonly T[]): Promise<(T & ManagedGcOwnerCleanupTarget)[]>;
41
+ export declare function managedGcOwnerDeleteFields(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<ManagedGcOwnerDeleteFields>;
42
+ export declare function publishManagedGcArtifactsRemoved(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<ManagedGcSessionRetirementReceipt | undefined>;
43
+ export declare function retireManagedGcOwnerAfterArtifacts(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, tombstoneTargets: readonly ManagedGcOwnerCleanupTarget[]): Promise<ManagedGcOwnerProgress>;
44
+ export declare function persistManagedGcStorageOwnerDisposition(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, deletion: Extract<VerifiedSessionDeleteResult, {
45
+ kind: "cleanup_pending";
46
+ phase: "task_artifact_owner";
47
+ }>): Promise<ManagedGcOwnerProgress>;
48
+ export declare function managedGcOwnerProgressBeforeDelete(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget, tombstoneTargets: readonly ManagedGcOwnerCleanupTarget[], artifactsRemoved: boolean): Promise<ManagedGcOwnerProgress>;
49
+ export declare function taskArtifactOwnerTranscriptResult(authority: ManagedGcOwnerCleanupAuthority, target: ManagedGcOwnerCleanupTarget): Promise<"none" | "retired" | "payload_retired">;
50
+ export interface ManagedGcOwnerTranscriptDeleteReceipt {
51
+ readonly taskArtifactOwnerTranscriptDeleted?: true;
52
+ }
53
+ export declare function persistManagedGcOwnerTranscriptDeletion<T extends ManagedGcOwnerTranscriptDeleteReceipt>(input: {
54
+ target: ManagedGcOwnerCleanupTarget;
55
+ fallback: T;
56
+ deletion: Extract<VerifiedSessionDeleteResult, {
57
+ kind: "deleted";
58
+ }>;
59
+ readLatest: () => T | undefined;
60
+ nextReceipt: (latest: T) => T;
61
+ publishPending: (receipt: T) => Promise<void>;
62
+ }): Promise<void>;
@@ -5,6 +5,8 @@ export interface OwnerManifest extends TaskArtifactOwnerLocator {
5
5
  readonly sessionId: string;
6
6
  }
7
7
  export declare function newSessionRootStore(context: TaskArtifactOwnerStorageContext): ManagedSessionDescendantStore;
8
+ /** Path-backed reader with no retained or recovery-mutable native authority. */
9
+ export declare function newSessionRootReaderStore(context: TaskArtifactOwnerStorageContext): ManagedSessionDescendantStore;
8
10
  export declare function readOwnerManifest(store: ManagedSessionDescendantStore, locator: TaskArtifactOwnerLocator, relativePath?: string): OwnerManifest;
9
11
  export declare function assertOwnerDirectoryExists(context: TaskArtifactOwnerStorageContext, ownerId: string): void;
10
12
  export declare function assertOwnerIdentity(store: ManagedSessionDescendantStore, locator: TaskArtifactOwnerLocator): void;