@gajae-code/coding-agent 0.11.0 → 0.11.2

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 (418) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/dist/types/async/job-manager.d.ts +46 -7
  3. package/dist/types/cli/config-cli.d.ts +11 -1
  4. package/dist/types/cli/notify-cli.d.ts +1 -0
  5. package/dist/types/cli/session-picker.d.ts +2 -1
  6. package/dist/types/cli/setup-cli.d.ts +1 -1
  7. package/dist/types/commands/mcp-serve.d.ts +33 -0
  8. package/dist/types/commands/mcp.d.ts +1 -1
  9. package/dist/types/commands/notify.d.ts +0 -2
  10. package/dist/types/commands/sdk.d.ts +1 -1
  11. package/dist/types/config/atomic-yaml-patch.d.ts +18 -0
  12. package/dist/types/config/file-lock.d.ts +14 -4
  13. package/dist/types/config/keybindings.d.ts +42 -1
  14. package/dist/types/config/model-auth.d.ts +3 -0
  15. package/dist/types/config/model-bindings-applier.d.ts +13 -0
  16. package/dist/types/config/model-discovery-manager.d.ts +49 -0
  17. package/dist/types/config/model-equivalence.d.ts +20 -0
  18. package/dist/types/config/model-registry.d.ts +16 -15
  19. package/dist/types/config/model-resolver.d.ts +28 -18
  20. package/dist/types/config/models-config-schema.d.ts +11 -0
  21. package/dist/types/config/settings-schema.d.ts +56 -1
  22. package/dist/types/config/settings.d.ts +14 -11
  23. package/dist/types/coordinator-mcp/policy.d.ts +5 -0
  24. package/dist/types/coordinator-mcp/question-gate-codec.d.ts +129 -0
  25. package/dist/types/coordinator-mcp/question-state.d.ts +356 -0
  26. package/dist/types/coordinator-mcp/server.d.ts +4 -0
  27. package/dist/types/discovery/helpers.d.ts +0 -6
  28. package/dist/types/edit/index.d.ts +3 -0
  29. package/dist/types/eval/py/env.d.ts +9 -0
  30. package/dist/types/extensibility/extensions/loader.d.ts +2 -1
  31. package/dist/types/extensibility/extensions/runner.d.ts +2 -2
  32. package/dist/types/extensibility/extensions/types.d.ts +34 -3
  33. package/dist/types/extensibility/hooks/runner.d.ts +1 -1
  34. package/dist/types/extensibility/shared-events.d.ts +2 -0
  35. package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +10 -1
  36. package/dist/types/gjc-runtime/deep-interview-state.d.ts +44 -0
  37. package/dist/types/gjc-runtime/goal-mode-request.d.ts +11 -1
  38. package/dist/types/gjc-runtime/launch-worktree.d.ts +4 -2
  39. package/dist/types/gjc-runtime/linux-proc.d.ts +29 -0
  40. package/dist/types/gjc-runtime/session-resolution.d.ts +2 -2
  41. package/dist/types/gjc-runtime/state-migrations.d.ts +1 -1
  42. package/dist/types/gjc-runtime/state-writer.d.ts +2 -1
  43. package/dist/types/gjc-runtime/team-launch.d.ts +59 -0
  44. package/dist/types/gjc-runtime/team-notify.d.ts +45 -0
  45. package/dist/types/gjc-runtime/team-runtime.d.ts +29 -121
  46. package/dist/types/gjc-runtime/team-store.d.ts +160 -0
  47. package/dist/types/gjc-runtime/team-workers.d.ts +78 -0
  48. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +8 -0
  49. package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +13 -0
  50. package/dist/types/gjc-runtime/ultragoal-evidence.d.ts +38 -0
  51. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +7 -0
  52. package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +23 -0
  53. package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +11 -0
  54. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +55 -33
  55. package/dist/types/gjc-runtime/workflow-cli-common.d.ts +8 -0
  56. package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -0
  57. package/dist/types/goals/continuation-timeout-guard.d.ts +22 -0
  58. package/dist/types/goals/runtime.d.ts +1 -0
  59. package/dist/types/goals/state.d.ts +8 -0
  60. package/dist/types/harness-control-plane/lifecycle-reconciliation.d.ts +17 -0
  61. package/dist/types/harness-control-plane/phase-rollup.d.ts +4 -7
  62. package/dist/types/harness-control-plane/receipt-ingest.d.ts +5 -0
  63. package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
  64. package/dist/types/hindsight/state.d.ts +11 -4
  65. package/dist/types/lsp/lspmux.d.ts +5 -3
  66. package/dist/types/lsp/path-trust.d.ts +1 -0
  67. package/dist/types/main.d.ts +3 -2
  68. package/dist/types/memories/storage.d.ts +1 -0
  69. package/dist/types/modes/action-registry.d.ts +29 -0
  70. package/dist/types/modes/components/chrome.d.ts +14 -0
  71. package/dist/types/modes/components/command-palette.d.ts +27 -0
  72. package/dist/types/modes/components/custom-provider-wizard.d.ts +1 -0
  73. package/dist/types/modes/components/index.d.ts +2 -1
  74. package/dist/types/modes/components/pet-selector.d.ts +1 -1
  75. package/dist/types/modes/components/plan-preview-overlay.d.ts +43 -0
  76. package/dist/types/modes/components/queue-mode-selector.d.ts +1 -1
  77. package/dist/types/modes/components/queue-pane.d.ts +12 -0
  78. package/dist/types/modes/components/read-tool-group.d.ts +6 -0
  79. package/dist/types/modes/components/session-observer-overlay.d.ts +3 -4
  80. package/dist/types/modes/components/sessions-dashboard.d.ts +32 -0
  81. package/dist/types/modes/components/settings-selector.d.ts +1 -1
  82. package/dist/types/modes/components/show-images-selector.d.ts +1 -1
  83. package/dist/types/modes/components/status-line/types.d.ts +1 -1
  84. package/dist/types/modes/components/status-line.d.ts +1 -94
  85. package/dist/types/modes/components/tasks-pane.d.ts +15 -0
  86. package/dist/types/modes/components/theme-selector.d.ts +1 -1
  87. package/dist/types/modes/components/tool-execution.d.ts +15 -0
  88. package/dist/types/modes/components/tool-status-header.d.ts +111 -0
  89. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +42 -0
  90. package/dist/types/modes/controllers/command-controller.d.ts +2 -2
  91. package/dist/types/modes/controllers/extension-ui-controller.d.ts +1 -0
  92. package/dist/types/modes/controllers/goal-mode-controller.d.ts +62 -0
  93. package/dist/types/modes/controllers/input-controller.d.ts +8 -1
  94. package/dist/types/modes/controllers/mode-gate.d.ts +8 -0
  95. package/dist/types/modes/controllers/plan-mode-controller.d.ts +65 -0
  96. package/dist/types/modes/controllers/selector-controller.d.ts +15 -3
  97. package/dist/types/modes/controllers/stt-controller.d.ts +26 -0
  98. package/dist/types/modes/interactive-mode.d.ts +21 -19
  99. package/dist/types/modes/jobs-observer.d.ts +2 -0
  100. package/dist/types/modes/shared/agent-wire/deep-interview-gate.d.ts +4 -11
  101. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +21 -2
  102. package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +31 -0
  103. package/dist/types/modes/tasks-aggregator.d.ts +39 -0
  104. package/dist/types/modes/transcript-item-registry.d.ts +60 -0
  105. package/dist/types/modes/types.d.ts +22 -15
  106. package/dist/types/modes/utils/ui-helpers.d.ts +2 -2
  107. package/dist/types/runtime-mcp/manager.d.ts +1 -1
  108. package/dist/types/sdk/broker/broker.d.ts +78 -12
  109. package/dist/types/sdk/broker/ensure.d.ts +9 -0
  110. package/dist/types/sdk/broker/lifecycle-codec.d.ts +4 -0
  111. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +15 -1
  112. package/dist/types/sdk/broker/lifecycle.d.ts +6 -2
  113. package/dist/types/sdk/broker/process-incarnation.d.ts +2 -0
  114. package/dist/types/sdk/broker/session-index.d.ts +0 -1
  115. package/dist/types/sdk/broker/state-version.d.ts +2 -0
  116. package/dist/types/sdk/bus/chat-effect-journal.d.ts +1 -0
  117. package/dist/types/sdk/bus/config-commands.d.ts +1 -1
  118. package/dist/types/sdk/bus/config.d.ts +11 -0
  119. package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
  120. package/dist/types/sdk/bus/discord-daemon.d.ts +5 -0
  121. package/dist/types/sdk/bus/html-format.d.ts +3 -2
  122. package/dist/types/sdk/bus/index.d.ts +27 -0
  123. package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
  124. package/dist/types/sdk/bus/notification-service.d.ts +20 -0
  125. package/dist/types/sdk/bus/rate-limit-pool.d.ts +13 -2
  126. package/dist/types/sdk/bus/recent-activity.d.ts +21 -12
  127. package/dist/types/sdk/bus/rich-document.d.ts +7 -0
  128. package/dist/types/sdk/bus/rich-render.d.ts +18 -41
  129. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +9 -4
  130. package/dist/types/sdk/bus/telegram-daemon.d.ts +69 -3
  131. package/dist/types/sdk/bus/threaded-inbound.d.ts +1 -1
  132. package/dist/types/sdk/bus/threaded-render.d.ts +13 -0
  133. package/dist/types/sdk/bus/topic-registry.d.ts +24 -2
  134. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  135. package/dist/types/sdk/host/host.d.ts +2 -0
  136. package/dist/types/sdk/index.d.ts +1 -0
  137. package/dist/types/sdk/session-directory.d.ts +56 -0
  138. package/dist/types/session/agent-session.d.ts +82 -47
  139. package/dist/types/session/agent-storage.d.ts +7 -0
  140. package/dist/types/session/fallback-chain-controller.d.ts +10 -2
  141. package/dist/types/session/internal/managed-session-scope.d.ts +102 -0
  142. package/dist/types/session/internal/managed-session-storage.d.ts +38 -0
  143. package/dist/types/session/messages.d.ts +16 -0
  144. package/dist/types/session/session-manager-internal.d.ts +14 -0
  145. package/dist/types/session/session-manager.d.ts +82 -12
  146. package/dist/types/session/session-storage.d.ts +43 -3
  147. package/dist/types/session/volatile-context-pruning.d.ts +15 -0
  148. package/dist/types/skill-state/{deep-interview-mutation-guard.d.ts → workflow-mutation-guard.d.ts} +24 -8
  149. package/dist/types/skill-state/workflow-state-contract.d.ts +1 -3
  150. package/dist/types/slash-commands/builtin-registry.d.ts +4 -1
  151. package/dist/types/system-prompt.d.ts +2 -11
  152. package/dist/types/task/executor.d.ts +3 -1
  153. package/dist/types/thinking.d.ts +7 -0
  154. package/dist/types/tool-discovery/tool-index.d.ts +1 -50
  155. package/dist/types/tools/ask.d.ts +64 -2
  156. package/dist/types/tools/bash.d.ts +3 -0
  157. package/dist/types/tools/browser/dead-tab-recovery.d.ts +24 -0
  158. package/dist/types/tools/browser/tab-supervisor.d.ts +21 -0
  159. package/dist/types/tools/cron.d.ts +2 -0
  160. package/dist/types/tools/fetch.d.ts +1 -0
  161. package/dist/types/tools/index.d.ts +30 -15
  162. package/dist/types/tools/output-meta.d.ts +1 -0
  163. package/dist/types/tools/read.d.ts +3 -0
  164. package/dist/types/tools/search-tool-bm25.d.ts +3 -4
  165. package/dist/types/tools/subagent-render.d.ts +1 -0
  166. package/dist/types/tools/subagent.d.ts +6 -1
  167. package/dist/types/utils/event-bus.d.ts +1 -1
  168. package/dist/types/web/search/index.d.ts +3 -1
  169. package/package.json +21 -9
  170. package/scripts/build-sdk-package-smoke.ts +39 -1
  171. package/scripts/generate-hotkeys-docs.ts +74 -0
  172. package/scripts/generate-sdk-operation-inventory.ts +64 -20
  173. package/scripts/verify-gjc-sdk-canonicalization.ts +182 -2
  174. package/src/async/job-manager.ts +455 -69
  175. package/src/cli/config-cli.ts +75 -2
  176. package/src/cli/notify-cli.ts +92 -26
  177. package/src/cli/session-picker.ts +20 -3
  178. package/src/cli/setup-cli.ts +1 -1
  179. package/src/cli.ts +1 -1
  180. package/src/commands/config.ts +1 -1
  181. package/src/commands/harness.ts +34 -106
  182. package/src/commands/launch.ts +6 -4
  183. package/src/commands/mcp-serve.ts +85 -8
  184. package/src/commands/mcp.ts +2 -2
  185. package/src/commands/notify.ts +8 -4
  186. package/src/commands/sdk.ts +61 -40
  187. package/src/commands/ultragoal.ts +4 -1
  188. package/src/config/atomic-yaml-patch.ts +80 -13
  189. package/src/config/file-lock.ts +105 -43
  190. package/src/config/keybindings.ts +64 -20
  191. package/src/config/model-auth.ts +9 -0
  192. package/src/config/model-bindings-applier.ts +139 -0
  193. package/src/config/model-discovery-manager.ts +224 -0
  194. package/src/config/model-equivalence.ts +66 -0
  195. package/src/config/model-registry.ts +169 -302
  196. package/src/config/model-resolver.ts +361 -369
  197. package/src/config/models-config-schema.ts +5 -4
  198. package/src/config/settings-schema.ts +159 -2
  199. package/src/config/settings.ts +458 -482
  200. package/src/coordinator-mcp/policy.ts +76 -11
  201. package/src/coordinator-mcp/question-gate-codec.ts +274 -0
  202. package/src/coordinator-mcp/question-state.ts +778 -0
  203. package/src/coordinator-mcp/server.ts +1702 -238
  204. package/src/debug/index.ts +1 -1
  205. package/src/defaults/gjc/skills/deep-interview/SKILL.md +13 -1
  206. package/src/defaults/gjc/skills/team/SKILL.md +16 -0
  207. package/src/discovery/helpers.ts +1 -50
  208. package/src/edit/index.ts +64 -0
  209. package/src/eval/py/env.ts +26 -0
  210. package/src/eval/py/kernel.ts +5 -3
  211. package/src/extensibility/extensions/loader.ts +9 -1
  212. package/src/extensibility/extensions/runner.ts +12 -3
  213. package/src/extensibility/extensions/types.ts +39 -1
  214. package/src/extensibility/gjc-plugins/installer.ts +16 -16
  215. package/src/extensibility/hooks/runner.ts +2 -2
  216. package/src/extensibility/runtime-skill-discovery.ts +33 -13
  217. package/src/extensibility/shared-events.ts +2 -0
  218. package/src/gjc-runtime/deep-interview-recorder.ts +63 -3
  219. package/src/gjc-runtime/deep-interview-runtime.ts +76 -27
  220. package/src/gjc-runtime/deep-interview-state.ts +317 -5
  221. package/src/gjc-runtime/goal-mode-request.ts +55 -8
  222. package/src/gjc-runtime/launch-tmux.ts +2 -5
  223. package/src/gjc-runtime/launch-worktree.ts +5 -5
  224. package/src/gjc-runtime/linux-proc.ts +71 -0
  225. package/src/gjc-runtime/ralplan-runtime.ts +74 -90
  226. package/src/gjc-runtime/session-resolution.ts +18 -3
  227. package/src/gjc-runtime/session-state-sidecar.ts +6 -107
  228. package/src/gjc-runtime/state-migrations.ts +1 -1
  229. package/src/gjc-runtime/state-runtime.ts +320 -249
  230. package/src/gjc-runtime/state-writer.ts +36 -40
  231. package/src/gjc-runtime/team-launch.ts +319 -0
  232. package/src/gjc-runtime/team-notify.ts +326 -0
  233. package/src/gjc-runtime/team-runtime.ts +1099 -1482
  234. package/src/gjc-runtime/team-store.ts +828 -0
  235. package/src/gjc-runtime/team-workers.ts +962 -0
  236. package/src/gjc-runtime/tmux-owner-isolation-cli.ts +2 -11
  237. package/src/gjc-runtime/tmux-owner-isolation.ts +14 -9
  238. package/src/gjc-runtime/tmux-sessions.ts +4 -21
  239. package/src/gjc-runtime/ultragoal-change-set.ts +172 -0
  240. package/src/gjc-runtime/ultragoal-evidence.ts +874 -0
  241. package/src/gjc-runtime/ultragoal-guard.ts +83 -12
  242. package/src/gjc-runtime/ultragoal-pipeline.ts +306 -0
  243. package/src/gjc-runtime/ultragoal-receipt-freshness.ts +102 -1
  244. package/src/gjc-runtime/ultragoal-runtime.ts +156 -1319
  245. package/src/gjc-runtime/workflow-cli-common.ts +30 -0
  246. package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
  247. package/src/gjc-runtime/workflow-manifest.ts +18 -0
  248. package/src/goals/continuation-timeout-guard.ts +79 -0
  249. package/src/goals/runtime.ts +7 -5
  250. package/src/goals/state.ts +18 -0
  251. package/src/harness-control-plane/lifecycle-reconciliation.ts +64 -0
  252. package/src/harness-control-plane/phase-rollup.ts +4 -7
  253. package/src/harness-control-plane/receipt-ingest.ts +5 -0
  254. package/src/harness-control-plane/receipt-spool.ts +51 -7
  255. package/src/harness-control-plane/session-lease.ts +12 -130
  256. package/src/hindsight/backend.ts +26 -27
  257. package/src/hindsight/state.ts +101 -32
  258. package/src/hooks/skill-state.ts +17 -11
  259. package/src/internal-urls/docs-index.generated.ts +21 -18
  260. package/src/lsp/client.ts +1 -1
  261. package/src/lsp/config.ts +145 -26
  262. package/src/lsp/index.ts +1 -1
  263. package/src/lsp/lspmux.ts +39 -10
  264. package/src/lsp/path-trust.ts +81 -0
  265. package/src/main.ts +28 -8
  266. package/src/memories/index.ts +1 -0
  267. package/src/memories/storage.ts +6 -2
  268. package/src/modes/action-registry.ts +165 -0
  269. package/src/modes/components/chrome.ts +40 -0
  270. package/src/modes/components/command-palette.ts +168 -0
  271. package/src/modes/components/custom-editor.ts +1 -1
  272. package/src/modes/components/custom-provider-wizard.ts +51 -14
  273. package/src/modes/components/index.ts +2 -1
  274. package/src/modes/components/pet-selector.ts +11 -17
  275. package/src/modes/components/plan-preview-overlay.ts +295 -0
  276. package/src/modes/components/queue-mode-selector.ts +10 -27
  277. package/src/modes/components/queue-pane.ts +79 -0
  278. package/src/modes/components/read-tool-group.ts +13 -0
  279. package/src/modes/components/session-observer-overlay.ts +207 -772
  280. package/src/modes/components/sessions-dashboard.ts +181 -0
  281. package/src/modes/components/settings-selector.ts +1 -1
  282. package/src/modes/components/show-images-selector.ts +10 -24
  283. package/src/modes/components/status-line/types.ts +1 -1
  284. package/src/modes/components/status-line.ts +1 -969
  285. package/src/modes/components/tasks-pane.ts +73 -0
  286. package/src/modes/components/theme-selector.ts +11 -31
  287. package/src/modes/components/tool-execution.ts +22 -0
  288. package/src/modes/components/tool-status-header.ts +1056 -0
  289. package/src/modes/components/transcript-viewer-overlay.ts +384 -0
  290. package/src/modes/controllers/btw-controller.ts +1 -0
  291. package/src/modes/controllers/command-controller.ts +9 -15
  292. package/src/modes/controllers/event-controller.ts +3 -2
  293. package/src/modes/controllers/extension-ui-controller.ts +72 -25
  294. package/src/modes/controllers/goal-mode-controller.ts +474 -0
  295. package/src/modes/controllers/input-controller.ts +764 -229
  296. package/src/modes/controllers/mode-gate.ts +24 -0
  297. package/src/modes/controllers/plan-mode-controller.ts +517 -0
  298. package/src/modes/controllers/selector-controller.ts +225 -10
  299. package/src/modes/controllers/stt-controller.ts +125 -0
  300. package/src/modes/interactive-mode.ts +302 -1151
  301. package/src/modes/jobs-observer.ts +3 -0
  302. package/src/modes/runtime-init.ts +8 -0
  303. package/src/modes/shared/agent-wire/deep-interview-gate.ts +31 -106
  304. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +78 -19
  305. package/src/modes/shared/agent-wire/workflow-gate-types.ts +177 -0
  306. package/src/modes/tasks-aggregator.ts +199 -0
  307. package/src/modes/transcript-item-registry.ts +229 -0
  308. package/src/modes/types.ts +47 -20
  309. package/src/modes/utils/ui-helpers.ts +17 -9
  310. package/src/prompts/agent-fragments/ralplan-persistence.md +6 -0
  311. package/src/prompts/agent-fragments/restricted-bash.md +1 -0
  312. package/src/prompts/agents/architect.md +2 -8
  313. package/src/prompts/agents/critic.md +2 -8
  314. package/src/prompts/agents/executor.md +3 -0
  315. package/src/prompts/agents/planner.md +4 -12
  316. package/src/prompts/system/custom-system-prompt.md +1 -23
  317. package/src/prompts/system/plan-mode-approved.md +8 -0
  318. package/src/prompts/system/system-prompt.md +17 -96
  319. package/src/prompts/tools/bash.md +4 -4
  320. package/src/prompts/tools/browser.md +15 -52
  321. package/src/prompts/tools/find.md +2 -2
  322. package/src/prompts/tools/hashline.md +13 -55
  323. package/src/prompts/tools/read.md +3 -6
  324. package/src/prompts/tools/search-tool-bm25.md +0 -2
  325. package/src/prompts/tools/search.md +2 -4
  326. package/src/prompts/tools/skill-discovery.md +1 -2
  327. package/src/prompts/tools/task.md +1 -1
  328. package/src/runtime-mcp/manager.ts +1 -1
  329. package/src/sdk/broker/broker.ts +206 -78
  330. package/src/sdk/broker/discovery.ts +21 -2
  331. package/src/sdk/broker/ensure.ts +85 -25
  332. package/src/sdk/broker/lifecycle-codec.ts +11 -0
  333. package/src/sdk/broker/lifecycle-ledger.ts +371 -74
  334. package/src/sdk/broker/lifecycle.ts +1399 -142
  335. package/src/sdk/broker/process-incarnation.ts +5 -13
  336. package/src/sdk/broker/session-index.ts +145 -56
  337. package/src/sdk/broker/state-version.ts +21 -0
  338. package/src/sdk/broker/transport.ts +1 -1
  339. package/src/sdk/bus/chat-daemon-cli.ts +2 -0
  340. package/src/sdk/bus/chat-daemon-control.ts +8 -28
  341. package/src/sdk/bus/chat-effect-journal.ts +14 -4
  342. package/src/sdk/bus/config-commands.ts +5 -4
  343. package/src/sdk/bus/config.ts +98 -0
  344. package/src/sdk/bus/conversation-store.ts +5 -29
  345. package/src/sdk/bus/daemon-paths.ts +2 -0
  346. package/src/sdk/bus/discord-daemon.ts +25 -8
  347. package/src/sdk/bus/html-format.ts +20 -3
  348. package/src/sdk/bus/index.ts +834 -113
  349. package/src/sdk/bus/lifecycle-control-runtime.ts +91 -33
  350. package/src/sdk/bus/native-runtime-compatibility.ts +1 -1
  351. package/src/sdk/bus/natives-augment.d.ts +26 -1
  352. package/src/sdk/bus/notification-service.ts +168 -20
  353. package/src/sdk/bus/rate-limit-pool.ts +58 -14
  354. package/src/sdk/bus/recent-activity.ts +188 -74
  355. package/src/sdk/bus/rich-document.ts +258 -0
  356. package/src/sdk/bus/rich-render.ts +62 -70
  357. package/src/sdk/bus/telegram-daemon-cli.ts +15 -59
  358. package/src/sdk/bus/telegram-daemon-contract.ts +9 -4
  359. package/src/sdk/bus/telegram-daemon.ts +1491 -247
  360. package/src/sdk/bus/threaded-inbound.ts +8 -3
  361. package/src/sdk/bus/threaded-render.ts +57 -1
  362. package/src/sdk/bus/topic-registry.ts +120 -13
  363. package/src/sdk/host/control/dispatch.ts +14 -2
  364. package/src/sdk/host/control/operations.ts +6 -1
  365. package/src/sdk/host/host.ts +31 -1
  366. package/src/sdk/host/query/handlers.ts +20 -22
  367. package/src/sdk/host/query/revision-store.ts +80 -57
  368. package/src/sdk/index.ts +1 -0
  369. package/src/sdk/protocol/operation-inventory.generated.json +943 -1907
  370. package/src/sdk/session-directory.ts +141 -0
  371. package/src/sdk/session.ts +458 -479
  372. package/src/session/agent-session.ts +1901 -637
  373. package/src/session/agent-storage.ts +18 -0
  374. package/src/session/cache-economics.ts +25 -8
  375. package/src/session/fallback-chain-controller.ts +53 -3
  376. package/src/session/internal/managed-session-scope.ts +2226 -0
  377. package/src/session/internal/managed-session-storage.ts +453 -0
  378. package/src/session/messages.ts +91 -2
  379. package/src/session/session-manager-internal.ts +33 -0
  380. package/src/session/session-manager.ts +1112 -333
  381. package/src/session/session-storage.ts +444 -39
  382. package/src/session/volatile-context-pruning.ts +78 -0
  383. package/src/setup/credential-auto-import.ts +2 -1
  384. package/src/setup/hermes/templates/operator-instructions.v1.md +1 -1
  385. package/src/setup/provider-onboarding.ts +36 -61
  386. package/src/setup/provider-presets.json +5 -0
  387. package/src/skill-state/active-state.ts +3 -13
  388. package/src/skill-state/{deep-interview-mutation-guard.ts → workflow-mutation-guard.ts} +47 -29
  389. package/src/skill-state/workflow-state-contract.ts +6 -41
  390. package/src/slash-commands/builtin-registry.ts +46 -11
  391. package/src/system-prompt.ts +37 -44
  392. package/src/task/agents.ts +19 -1
  393. package/src/task/executor.ts +90 -6
  394. package/src/task/index.ts +62 -37
  395. package/src/thinking.ts +21 -6
  396. package/src/tool-discovery/tool-index.ts +2 -134
  397. package/src/tools/ask.ts +157 -21
  398. package/src/tools/ast-edit.ts +1 -1
  399. package/src/tools/bash.ts +38 -0
  400. package/src/tools/browser/dead-tab-recovery.ts +78 -0
  401. package/src/tools/browser/tab-supervisor.ts +282 -36
  402. package/src/tools/computer.ts +10 -3
  403. package/src/tools/cron.ts +30 -16
  404. package/src/tools/eval.ts +1 -2
  405. package/src/tools/fetch.ts +11 -4
  406. package/src/tools/index.ts +76 -24
  407. package/src/tools/output-meta.ts +13 -5
  408. package/src/tools/read.ts +37 -1
  409. package/src/tools/resource-gc.ts +2 -2
  410. package/src/tools/search-tool-bm25.ts +11 -74
  411. package/src/tools/subagent-render.ts +19 -8
  412. package/src/tools/subagent.ts +84 -32
  413. package/src/utils/event-bus.ts +9 -4
  414. package/src/web/search/index.ts +3 -3
  415. package/dist/types/discovery/plugin-dir-roots.d.ts +0 -15
  416. package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +0 -7
  417. package/src/discovery/plugin-dir-roots.ts +0 -28
  418. package/src/runtime-mcp/discoverable-tool-metadata.ts +0 -25
@@ -4,9 +4,11 @@ import type { ImageContent, Message, MessageAttribution, ServiceTier, TextConten
4
4
  import type { TtsrInjectionRecord } from "../export/ttsr";
5
5
  import { ArtifactManager } from "./artifacts";
6
6
  import { type BlobPutResult, BlobStore } from "./blob-store";
7
+ import { type ManagedMigrationPolicy } from "./internal/managed-session-scope";
7
8
  import { type BashExecutionMessage, type CustomMessage, type FileMentionMessage, type HookMessage, type PythonExecutionMessage } from "./messages";
9
+ import { type SessionManagerReadAccess, sessionManagerReadCapability } from "./session-manager-internal";
8
10
  import type { SessionStorage, SessionStorageStat, VerifiedSessionDeleteResult, VerifiedSessionDeleteTarget } from "./session-storage";
9
- export declare const CURRENT_SESSION_VERSION = 3;
11
+ export declare const CURRENT_SESSION_VERSION = 4;
10
12
  export interface SessionHeader {
11
13
  type: "session";
12
14
  version?: number;
@@ -80,6 +82,8 @@ export declare function associateSessionMessageObservationId(message: AgentMessa
80
82
  export declare function getSessionMessageObservationId(message: AgentMessage): string | undefined;
81
83
  export declare function associateSessionMessageViewportAnchorId(message: AgentMessage, anchorId: string): void;
82
84
  export declare function getSessionMessageViewportAnchorId(message: AgentMessage): string | undefined;
85
+ /** Returns registered viewport anchors for durable user messages in session order. */
86
+ export declare function getUserMessageViewportAnchorIds(messages: readonly AgentMessage[]): string[];
83
87
  export declare function transferSessionMessageIdentity(source: AgentMessage[], target: AgentMessage[]): void;
84
88
  export interface ThinkingLevelChangeEntry extends SessionEntryBase {
85
89
  type: "thinking_level_change";
@@ -211,7 +215,19 @@ export interface CustomMessageEntry<T = unknown> extends SessionEntryBase {
211
215
  }
212
216
  /** Session entry - has id/parentId for tree structure (returned by "read" methods in SessionManager) */
213
217
  export type SessionEntry = SessionMessageEntry | ThinkingLevelChangeEntry | ModelChangeEntry | ServiceTierChangeEntry | CompactionEntry | BranchSummaryEntry | CustomEntry | CustomMessageEntry | LabelEntry | TtsrInjectionEntry | MCPToolSelectionEntry | SessionInitEntry | ModeChangeEntry | ConfiguredModelChainEntry;
214
- /** Raw file entry (includes header) */
218
+ /** Append-only replacement for mutable fields on the session header. */
219
+ export interface HeaderPatchRecord {
220
+ type: "header_patch";
221
+ patch: Partial<Pick<SessionHeader, "title" | "titleSource" | "cwd">>;
222
+ }
223
+ /** Append-only replacement for replay metadata on one existing session entry. */
224
+ export interface EntryPatchRecord {
225
+ type: "entry_patch";
226
+ entryId: string;
227
+ patch: Partial<Pick<SessionMessageEntry, "message">>;
228
+ }
229
+ export type SessionPatchRecord = HeaderPatchRecord | EntryPatchRecord;
230
+ /** Resolved file entries; patch records are applied by parseSessionEntries(). */
215
231
  export type FileEntry = SessionHeader | SessionEntry;
216
232
  export type DefaultModelSelectionStage = {
217
233
  readonly entryRevision: number;
@@ -282,7 +298,16 @@ export interface ResumeTailTerminal {
282
298
  }
283
299
  export interface ResumeTailError {
284
300
  kind: "error";
285
- reason: "missing" | "malformed" | "unstable" | "read-failed";
301
+ reason: "missing" | "malformed" | "unstable" | "read-failed" | "legacy_migration_disabled";
302
+ }
303
+ export type SessionDirectoryMigrationPolicy = ManagedMigrationPolicy;
304
+ export declare class SessionManagedStorageError extends Error {
305
+ readonly code = "managed_storage_unsupported";
306
+ constructor();
307
+ }
308
+ export declare class SessionMigrationPolicyError extends Error {
309
+ readonly code = "legacy_migration_disabled";
310
+ constructor();
286
311
  }
287
312
  export type ResumeTailInspection = ResumeTailResumable | ResumeTailTerminal | ResumeTailError;
288
313
  export interface StrictSessionOpenSuccess {
@@ -321,6 +346,8 @@ export interface SessionInfo {
321
346
  created: Date;
322
347
  modified: Date;
323
348
  messageCount: number;
349
+ /** True when messageCount was counted from only the bounded list prefix. */
350
+ messageCountIsEstimate?: boolean;
324
351
  /** File size in bytes on disk; used for compact list rendering. */
325
352
  size: number;
326
353
  firstMessage: string;
@@ -367,7 +394,35 @@ export type SessionManagerCloseOutcome = {
367
394
  kind: "close_unknown";
368
395
  error: Error;
369
396
  };
370
- export type ReadonlySessionManager = Pick<SessionManager, "getCwd" | "getSessionDir" | "getSessionId" | "getSessionFile" | "getSessionName" | "getArtifactsDir" | "getArtifactManager" | "allocateArtifactPath" | "saveArtifact" | "getArtifactPath" | "getLeafId" | "getLeafEntry" | "getEntry" | "getLabel" | "getBranch" | "getHeader" | "getEntries" | "getTree" | "getUsageStatistics" | "putBlob">;
397
+ /** Read-only session state made available to extensions and custom tools. */
398
+ /** Frozen read-only session facade made available to extensions and custom tools. */
399
+ export interface ReadonlySessionManager {
400
+ getCwd(): string;
401
+ getSessionDir(): string;
402
+ getSessionId(): string;
403
+ getSessionFile(): string | undefined;
404
+ getSessionName(): string | undefined;
405
+ getArtifactsDir(): string | null;
406
+ getArtifactPath(id: string): Promise<string | null>;
407
+ getLeafId(): string | null;
408
+ getLeafEntry(): SessionEntry | undefined;
409
+ getEntry(id: string): SessionEntry | undefined;
410
+ getLabel(id: string): string | undefined;
411
+ getBranch(fromId?: string): SessionEntry[];
412
+ getHeader(): SessionHeader | null;
413
+ getEntries(): SessionEntry[];
414
+ getTree(): SessionTreeNode[];
415
+ getUsageStatistics(): UsageStatistics;
416
+ }
417
+ /** Creates an immutable facade that never exposes SessionManager mutation authority. */
418
+ export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
419
+ /** Internal artifact-writing capability. Read-only facades expose it only through a private weak-map lookup. */
420
+ export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob">>;
421
+ /**
422
+ * Returns the artifact capability for a concrete persistence owner or one of its
423
+ * immutable read-only facades. Structural lookalikes remain unauthorized.
424
+ */
425
+ export declare function sessionArtifactCapability(value: unknown): SessionArtifactCapability | undefined;
371
426
  /** Exported for testing */
372
427
  export declare function migrateSessionEntries(entries: FileEntry[]): void;
373
428
  /** Exported for compaction.test.ts */
@@ -408,6 +463,11 @@ declare class RecentSessionInfo {
408
463
  export declare function recoverOrphanedBackups(sessionDir: string, storage: SessionStorage): Promise<void>;
409
464
  /** Exported for testing */
410
465
  export declare function findMostRecentSession(sessionDir: string, storage?: SessionStorage): Promise<string | null>;
466
+ interface SessionMoveDirectoryHandle {
467
+ sync(): Promise<void>;
468
+ close(): Promise<void>;
469
+ }
470
+ export declare function syncSessionMoveDirectory(directory: string, platform?: NodeJS.Platform, openDirectory?: (directory: string) => Promise<SessionMoveDirectoryHandle>): Promise<void>;
411
471
  declare const RESIDENT_BLOB_SENTINEL_KEY = "__gjcResidentBlob";
412
472
  type ResidentBlobKind = "text" | "imageUrl" | "imageData";
413
473
  interface ResidentBlobSentinel {
@@ -481,7 +541,7 @@ export declare class SessionManager {
481
541
  setSessionFile(sessionFile: string): Promise<void>;
482
542
  /** Start a new session. Closes any existing writer first. */
483
543
  newSession(options?: NewSessionOptions): Promise<string | undefined>;
484
- /** Delete a session file and its artifacts. Drains the persist writer first to avoid EPERM on Windows. ENOENT is treated as success. */
544
+ /** Tombstone and exact-delete managed transcripts, detaching the active transcript first. */
485
545
  dropSession(sessionPath: string): Promise<void>;
486
546
  /**
487
547
  * Fork the current session, creating a new session file with the same entries.
@@ -639,6 +699,8 @@ export declare class SessionManager {
639
699
  * the canonical store. This applies such mutations for real.
640
700
  */
641
701
  applyEntryMessageUpdates(entries: readonly SessionMessageEntry[]): void;
702
+ /** Write mutated custom-message entries back into the canonical entry store by id. */
703
+ applyCustomMessageEntryUpdates(entries: readonly CustomMessageEntry[]): void;
642
704
  /**
643
705
  * Rewrite the session file after in-place entry updates.
644
706
  * Use sparingly (e.g., pruning old tool outputs).
@@ -717,8 +779,11 @@ export declare class SessionManager {
717
779
  * Build the session context (what gets sent to the LLM).
718
780
  * Uses tree traversal from current leaf.
719
781
  */
782
+ /**
783
+ * Return a defensive context snapshot for public consumers.
784
+ */
720
785
  buildSessionContext(): SessionContext;
721
- /** Strip stale OpenAI Responses assistant replay metadata from loaded in-memory entries. */
786
+ /** Strip stale OpenAI Responses assistant replay metadata from loaded in-memory entries without persisting it. */
722
787
  sanitizeLoadedOpenAIResponsesReplayMetadata(): boolean;
723
788
  /**
724
789
  * Get session header.
@@ -726,11 +791,12 @@ export declare class SessionManager {
726
791
  getHeader(): SessionHeader | null;
727
792
  getEntries(): SessionEntry[];
728
793
  /**
729
- * Get the session as a tree structure. Returns a shallow defensive copy of all entries.
794
+ * Get the session as a tree structure. Returns defensive copies of all entries.
730
795
  * A well-formed session has exactly one root (first entry with parentId === null).
731
796
  * Orphaned entries (broken parent chain) are also returned as roots.
732
797
  */
733
798
  getTree(): SessionTreeNode[];
799
+ [sessionManagerReadCapability](): SessionManagerReadAccess;
734
800
  /**
735
801
  * Start a new branch from an earlier entry.
736
802
  * Moves the leaf pointer to the specified entry. The next appendXXX() call
@@ -768,21 +834,25 @@ export declare class SessionManager {
768
834
  * @param sessionDir Optional session directory. If omitted, uses default (~/.gjc/agent/sessions/<encoded-cwd>/).
769
835
  */
770
836
  static create(cwd: string, sessionDir?: string, storage?: SessionStorage): SessionManager;
837
+ /** Resolve a default-managed candidate through binding validation and copy-retain migration before mutation. */
838
+ static prepareManagedCandidateForWrite(filePath: string, migrationPolicy: SessionDirectoryMigrationPolicy): Promise<string>;
771
839
  /**
772
840
  * Fork a session into the current project directory.
773
841
  * Copies history from another session file while creating a new session file in the current sessionDir.
774
842
  */
775
- static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
843
+ static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
776
844
  /**
777
845
  * Open a specific session file.
778
846
  * @param path Path to session file
779
847
  * @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
780
848
  */
781
- static open(filePath: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
849
+ static open(filePath: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
782
850
  /**
783
851
  * List sessions for the resume picker without recovery or other maintenance writes.
784
852
  */
785
853
  static listForResumePickerReadOnly(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionInfo[]>;
854
+ /** Tombstone and exact-delete a default-managed candidate. */
855
+ static deleteManagedCandidate(sessionPath: string): Promise<void>;
786
856
  /** Capture exact source content for a strict fork without granting write ownership. */
787
857
  static captureTranscriptStrict(filePath: string, storage?: SessionStorage): StrictSessionCaptureResult;
788
858
  /**
@@ -790,7 +860,7 @@ export declare class SessionManager {
790
860
  * revalidate captured authority before destination initialization and transcript
791
861
  * persistence; destination history always comes from the captured bytes.
792
862
  */
793
- static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, sessionDir?: string): Promise<StrictSessionForkResult>;
863
+ static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, sessionDir?: string, _migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionForkResult>;
794
864
  /** Inspect a selected session without acquiring write-capable ownership. */
795
865
  static inspectSessionTailReadOnly(filePath: string, storage?: SessionStorage): Promise<ResumeTailInspection>;
796
866
  /**
@@ -798,13 +868,13 @@ export declare class SessionManager {
798
868
  * the returned discriminant; an error result never creates, rewrites, or adopts
799
869
  * the selected path. Breadcrumb ownership begins only after `kind: "opened"`.
800
870
  */
801
- static openExistingStrict(identity: ResumeSessionIdentity, sessionDir?: string, storage?: SessionStorage): Promise<StrictSessionOpenResult>;
871
+ static openExistingStrict(identity: ResumeSessionIdentity, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<StrictSessionOpenResult>;
802
872
  /**
803
873
  * Continue the most recent session, or create new if none.
804
874
  * @param cwd Working directory
805
875
  * @param sessionDir Optional session directory. If omitted, uses default (~/.gjc/agent/sessions/<encoded-cwd>/).
806
876
  */
807
- static continueRecent(cwd: string, sessionDir?: string, storage?: SessionStorage): Promise<SessionManager>;
877
+ static continueRecent(cwd: string, sessionDir?: string, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy): Promise<SessionManager>;
808
878
  /** Create an in-memory session (no file persistence) */
809
879
  static inMemory(cwd?: string, storage?: SessionStorage): SessionManager;
810
880
  /**
@@ -109,10 +109,13 @@ export interface SessionStorage {
109
109
  deleteSessionVerified?(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
110
110
  openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
111
111
  }
112
- /** Exact (dev, ino) identity fields used for ACP authorization binding. */
112
+ /** Exact authorization evidence for a transcript or artifact path. */
113
113
  export interface SessionStorageFileIdentity {
114
114
  dev: bigint;
115
115
  ino: bigint;
116
+ size: number;
117
+ mtimeNs: bigint;
118
+ sha256: string;
116
119
  }
117
120
  /** Kind of verification failure surfaced by {@link deleteSessionVerified}. */
118
121
  export type VerifiedDeleteFailureKind = "containment" | "symlink" | "stat" | "identity" | "header" | "cwd" | "artifacts";
@@ -149,6 +152,18 @@ export interface VerifiedSessionDeleteTarget {
149
152
  * fails closed. Omit on first attempt or to accept recorded absence.
150
153
  */
151
154
  expectedArtifactsIdentity?: SessionStorageFileIdentity;
155
+ /** Stable native recursive-tree evidence captured before artifact detachment. */
156
+ expectedArtifactsTree?: NativeDirectoryTreeSnapshot;
157
+ /** Identity-bound quarantine path retained when recursive artifact cleanup failed. */
158
+ detachedArtifactsPath?: string;
159
+ /** Identity-bound quarantine path retained when transcript unlink deferred cleanup. */
160
+ detachedTranscriptPath?: string;
161
+ /** Caller-published, no-replace quarantine pathname for the next artifact detach. */
162
+ plannedArtifactsPath?: string;
163
+ /** Caller-published, no-replace quarantine pathname for the next transcript detach. */
164
+ plannedTranscriptPath?: string;
165
+ /** Set only after a durable caller receipt records successful artifact removal. */
166
+ artifactsRemoved?: true;
152
167
  }
153
168
  /**
154
169
  * Outcome of a verified hard delete. Artifact removal happens first; only after
@@ -157,6 +172,10 @@ export interface VerifiedSessionDeleteTarget {
157
172
  * `deleted` and never `{}`.
158
173
  */
159
174
  export type VerifiedSessionDeleteResult = {
175
+ kind: "artifacts_removed";
176
+ phase: "artifacts";
177
+ transcriptIdentity: SessionStorageFileIdentity;
178
+ } | {
160
179
  kind: "deleted";
161
180
  } | {
162
181
  kind: "cleanup_pending";
@@ -164,6 +183,10 @@ export type VerifiedSessionDeleteResult = {
164
183
  error: Error;
165
184
  /** Artifact directory identity at failure time; undefined when absent. */
166
185
  artifactsIdentity: SessionStorageFileIdentity | undefined;
186
+ /** Identity-bound quarantine path retained when recursive cleanup failed. */
187
+ detachedArtifactsPath: string;
188
+ /** Native snapshot required for an identity-bound recursive retry. */
189
+ artifactsTree: NativeDirectoryTreeSnapshot;
167
190
  /** Transcript identity (unchanged) for retry binding. */
168
191
  transcriptIdentity: SessionStorageFileIdentity;
169
192
  } | {
@@ -172,6 +195,22 @@ export type VerifiedSessionDeleteResult = {
172
195
  error: Error;
173
196
  /** Transcript identity at failure time for retry binding. */
174
197
  transcriptIdentity: SessionStorageFileIdentity;
198
+ /** Optional identity-bound transcript quarantine path for restart cleanup. */
199
+ detachedTranscriptPath?: string;
200
+ };
201
+ type NativeDirectoryTreeEntry = {
202
+ relativePath: string;
203
+ kind: string;
204
+ dev: string;
205
+ ino: string;
206
+ size: string;
207
+ mtimeNs: string;
208
+ sha256?: string;
209
+ };
210
+ export type NativeDirectoryTreeSnapshot = {
211
+ rootDev: string;
212
+ rootIno: string;
213
+ entries: NativeDirectoryTreeEntry[];
175
214
  };
176
215
  export declare class FileSessionStorage implements SessionStorage {
177
216
  #private;
@@ -194,8 +233,8 @@ export declare class FileSessionStorage implements SessionStorage {
194
233
  unlinkSync(path: string): void;
195
234
  openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
196
235
  /**
197
- * Delete a session file and its artifacts directory.
198
- * Artifacts are stored in a sibling directory with the same name minus .jsonl extension.
236
+ * Delete a session and sibling artifacts in an operator-selected explicit directory.
237
+ * Default managed roots use deleteSessionVerified and never call this path.
199
238
  */
200
239
  deleteSessionWithArtifacts(sessionPath: string): Promise<void>;
201
240
  /**
@@ -228,3 +267,4 @@ export declare class MemorySessionStorage implements SessionStorage {
228
267
  deleteSessionVerified(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
229
268
  openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
230
269
  }
270
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { CustomMessageEntry, SessionEntry } from "./session-manager";
2
+ /**
3
+ * Volatile context is refreshed for every prompt. Only its newest copy is useful;
4
+ * replacing older copies at a maintenance boundary preserves the audit trail
5
+ * without repeatedly charging the model for stale workspace snapshots.
6
+ */
7
+ export declare function pruneSupersededVolatileProjectContext(entries: readonly SessionEntry[]): {
8
+ changed: CustomMessageEntry[];
9
+ bytesSaved: number;
10
+ };
11
+ /** Retire superseded known singleton maintenance reminders without touching ordinary user context. */
12
+ export declare function pruneSupersededMaintenanceReminders(entries: readonly SessionEntry[]): {
13
+ changed: CustomMessageEntry[];
14
+ bytesSaved: number;
15
+ };
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool } from "@gajae-code/agent-core";
2
+ import { readVisibleSkillActiveState } from "./active-state";
2
3
  export declare const DEEP_INTERVIEW_MUTATION_BLOCK_MESSAGE = "Deep-interview phase boundary: continue gathering context/questions/risks and emit a handoff/spec before code edits. Mutation tools and patch execution are blocked while deep-interview is active; finalize specs through `gjc deep-interview --write --stage final` or hand off to an execution phase.";
3
4
  export declare const WORKFLOW_STATE_MUTATION_BLOCK_MESSAGE = ".gjc workflow state and artifacts are runtime-owned. Agent mutation tools cannot edit `.gjc/**`; use the sanctioned `gjc` CLI instead.";
4
5
  export declare const RALPLAN_MUTATION_BLOCK_MESSAGE = "Ralplan planning phase boundary: keep refining the consensus plan and persist plan artifacts through `gjc ralplan --write` (stage scratch files under a temp dir if needed). Product-code mutation tools and patch execution are blocked while ralplan is active; mutate only after the plan is approved and execution begins.";
@@ -7,7 +8,7 @@ type ToolWithEditMode = AgentTool & {
7
8
  mode?: unknown;
8
9
  customWireName?: unknown;
9
10
  };
10
- export interface DeepInterviewMutationGuardInput {
11
+ export interface WorkflowMutationGuardInput {
11
12
  cwd: string;
12
13
  sessionId?: string;
13
14
  threadId?: string;
@@ -15,24 +16,39 @@ export interface DeepInterviewMutationGuardInput {
15
16
  args: unknown;
16
17
  forceOverride?: boolean;
17
18
  enforceWorkflowState?: boolean;
19
+ guardContext?: WorkflowGuardContext;
18
20
  }
19
- export interface DeepInterviewMutationDecision {
21
+ export interface WorkflowMutationDecision {
20
22
  blocked: boolean;
21
23
  message?: string;
22
24
  targets: string[];
23
25
  reason?: string;
24
26
  command?: string;
25
27
  }
26
- export declare function assertDeepInterviewMutationRawPathsAllowed(input: {
28
+ export interface WorkflowGuardContext {
29
+ sessionId: string | null;
30
+ activeState: Awaited<ReturnType<typeof readVisibleSkillActiveState>>;
31
+ modeStates: ReadonlyMap<string, ModeState | null>;
32
+ }
33
+ interface ModeState {
34
+ active?: boolean;
35
+ current_phase?: string;
36
+ session_id?: string;
37
+ thread_id?: string;
38
+ [key: string]: unknown;
39
+ }
40
+ export declare function readWorkflowGuardContext(cwd: string, options?: {
41
+ sessionId?: string;
42
+ threadId?: string;
43
+ }): Promise<WorkflowGuardContext>;
44
+ export declare function assertWorkflowMutationRawPathsAllowed(input: {
27
45
  cwd: string;
28
46
  sessionId?: string;
29
47
  threadId?: string;
30
48
  rawPaths: string[];
31
49
  forceOverride?: boolean;
50
+ guardContext?: WorkflowGuardContext;
32
51
  }): Promise<void>;
33
- export declare function getDeepInterviewMutationDecision(input: DeepInterviewMutationGuardInput): Promise<DeepInterviewMutationDecision>;
34
- export declare function assertDeepInterviewMutationAllowed(input: DeepInterviewMutationGuardInput): Promise<void>;
35
- export declare const getWorkflowMutationDecision: typeof getDeepInterviewMutationDecision;
36
- export declare const assertWorkflowMutationAllowed: typeof assertDeepInterviewMutationAllowed;
37
- export declare const assertWorkflowMutationRawPathsAllowed: typeof assertDeepInterviewMutationRawPathsAllowed;
52
+ export declare function getWorkflowMutationDecision(input: WorkflowMutationGuardInput): Promise<WorkflowMutationDecision>;
53
+ export declare function assertWorkflowMutationAllowed(input: WorkflowMutationGuardInput): Promise<void>;
38
54
  export {};
@@ -40,14 +40,12 @@ export interface AuditEntry {
40
40
  paths: string[];
41
41
  }
42
42
  export declare function workflowModeStateFileName(skill: CanonicalGjcWorkflowSkill): string;
43
- export declare function workflowStateStoragePath(cwd: string, skill: CanonicalGjcWorkflowSkill, sessionId?: string): string;
44
- export declare function workflowActiveStatePath(cwd: string, sessionId?: string): string;
45
43
  export declare function buildWorkflowStateReceipt(input: {
46
44
  cwd: string;
47
45
  skill: CanonicalGjcWorkflowSkill;
48
46
  owner: WorkflowStateMutationOwner;
49
47
  command: string;
50
- sessionId?: string;
48
+ sessionId: string;
51
49
  nowIso?: string;
52
50
  mutationId?: string;
53
51
  }): WorkflowStateReceipt;
@@ -1,7 +1,10 @@
1
+ import { type ComposerSubmissionOptions } from "../modes/types";
1
2
  import type { BuiltinSlashCommand, ParsedSlashCommand, SlashCommandResult, SlashCommandRuntime, SlashCommandSpec, TuiSlashCommandRuntime } from "./types";
2
3
  export type { BuiltinSlashCommand, SubcommandDef } from "./types";
3
4
  /** TUI-specific runtime accepted by `executeBuiltinSlashCommand`. */
4
- export type BuiltinSlashCommandRuntime = TuiSlashCommandRuntime;
5
+ export type BuiltinSlashCommandRuntime = TuiSlashCommandRuntime & {
6
+ composer?: ComposerSubmissionOptions;
7
+ };
5
8
  export declare function formatUnknownBuiltinSlashCommandDiagnostic(commandName: string): string | undefined;
6
9
  /** Builtin command metadata used for slash-command autocomplete and help text. */
7
10
  export declare const BUILTIN_SLASH_COMMAND_DEFS: ReadonlyArray<BuiltinSlashCommand>;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { AgentTool } from "@gajae-code/agent-core";
5
5
  import type { SkillsSettings } from "./config/settings";
6
- import { type Skill } from "./extensibility/skills";
6
+ import type { Skill } from "./extensibility/skills";
7
7
  import { type WorkspaceTree } from "./workspace-tree";
8
8
  interface AlwaysApplyRule {
9
9
  name: string;
@@ -75,17 +75,8 @@ export interface BuildSystemPromptOptions {
75
75
  }>;
76
76
  /** Intent field name injected into every tool schema. If set, explains the field in the prompt. */
77
77
  intentField?: string;
78
- /** Whether MCP tool discovery is active for this prompt build. */
79
- mcpDiscoveryMode?: boolean;
80
- /** Discoverable MCP server summaries to advertise when discovery mode is active. */
81
- mcpDiscoveryServerSummaries?: string[];
82
- /** Whether built-in tool discovery ("all" mode) is active; enables the tool-discovery prompt block. */
78
+ /** Whether built-in tool discovery is active; enables the tool-discovery prompt block. */
83
79
  toolDiscoveryActive?: boolean;
84
- /** Hidden discoverable tools to advertise (name + one-line summary) when tool discovery is active. */
85
- discoverableTools?: Array<{
86
- name: string;
87
- summary: string;
88
- }>;
89
80
  /** Encourage the agent to delegate via tasks unless changes are trivial. */
90
81
  eagerTasks?: boolean;
91
82
  /** Rules with alwaysApply=true — their full content is injected into the prompt. */
@@ -4,7 +4,7 @@
4
4
  * Runs each subagent on the main thread and forwards AgentEvents for progress tracking.
5
5
  */
6
6
  import type { AgentTelemetryConfig, ThinkingLevel } from "@gajae-code/agent-core";
7
- import type { ServiceTier } from "@gajae-code/ai";
7
+ import type { Model, ServiceTier } from "@gajae-code/ai";
8
8
  import { ModelRegistry } from "../config/model-registry";
9
9
  import type { PromptTemplate } from "../config/prompt-templates";
10
10
  import { Settings } from "../config/settings";
@@ -19,6 +19,7 @@ import type { ContextFileEntry } from "../tools";
19
19
  import type { EventBus } from "../utils/event-bus";
20
20
  import type { WorkspaceTree } from "../workspace-tree";
21
21
  import { type AgentDefinition, type AgentProgress, type ReviewFinding, type SingleResult } from "./types";
22
+ export declare function trimForkContextSeedForModel(seed: ForkContextSeed, model: Model | undefined): ForkContextSeed;
22
23
  /** Options for subagent execution */
23
24
  export interface ExecutorOptions {
24
25
  cwd: string;
@@ -93,6 +94,7 @@ export interface ExecutorOptions {
93
94
  autoloadSkills?: Skill[];
94
95
  forkContextSeed?: ForkContextSeed;
95
96
  }
97
+ export declare function renderSubagentUserPrompt(assignment: string, independentMode: boolean): string;
96
98
  export interface YieldItem {
97
99
  data?: unknown;
98
100
  status?: "success" | "aborted";
@@ -19,4 +19,11 @@ export declare function toReasoningEffort(level: ThinkingLevel | undefined): Eff
19
19
  */
20
20
  export declare function resolveThinkingLevelForModel(model: Model | undefined, level: ThinkingLevel | undefined): ResolvedThinkingLevel | undefined;
21
21
  export declare function clampExplicitThinkingLevelForModel(model: Model | undefined, level: ThinkingLevel | undefined): ThinkingLevel | undefined;
22
+ export interface SelectorThinkingSuffix {
23
+ selector: string;
24
+ thinkingLevel?: ThinkingLevel;
25
+ invalidSuffix?: string;
26
+ }
27
+ /** Split the final selector suffix once, preserving colons in model IDs. */
28
+ export declare function splitSelectorThinkingSuffix(selector: string): SelectorThinkingSuffix;
22
29
  export declare function formatClampedModelSelector(selector: string, model: Model | undefined): string;
@@ -3,6 +3,7 @@ export type DiscoverableToolSource = "builtin" | "mcp" | "extension" | "custom";
3
3
  export interface DiscoverableTool {
4
4
  name: string;
5
5
  label: string;
6
+ description: string;
6
7
  /** Short BM25 corpus entry; falls back to description first 200 chars */
7
8
  summary: string;
8
9
  source: DiscoverableToolSource;
@@ -34,39 +35,6 @@ export interface DiscoverableToolSearchResult {
34
35
  tool: DiscoverableTool;
35
36
  score: number;
36
37
  }
37
- /** @deprecated Use DiscoverableTool with source === "mcp" */
38
- export type DiscoverableMCPTool = Pick<DiscoverableTool, "name" | "label" | "schemaKeys" | "serverName" | "mcpToolName"> & {
39
- description: string;
40
- };
41
- /** @deprecated Use DiscoverableToolServerSummary */
42
- export type DiscoverableMCPToolServerSummary = DiscoverableToolServerSummary;
43
- /** @deprecated Use DiscoverableToolSummary */
44
- export type DiscoverableMCPToolSummary = DiscoverableToolSummary;
45
- /** Tool object stored on legacy MCP index documents. Carries both legacy `description` and the
46
- * generic `summary`/`source` so the legacy index is structurally assignable to
47
- * DiscoverableToolSearchIndex (search functions read termFrequencies, not the tool fields). */
48
- export type DiscoverableMCPSearchTool = DiscoverableTool & {
49
- description: string;
50
- };
51
- /** @deprecated Use DiscoverableToolSearchDocument */
52
- export interface DiscoverableMCPSearchDocument {
53
- tool: DiscoverableMCPSearchTool;
54
- termFrequencies: Map<string, number>;
55
- length: number;
56
- }
57
- /** @deprecated Use DiscoverableToolSearchIndex.
58
- * Documents on this index expose `tool.description` (legacy MCP shape) while still being
59
- * searchable via `searchDiscoverableTools`. */
60
- export interface DiscoverableMCPSearchIndex {
61
- documents: DiscoverableMCPSearchDocument[];
62
- averageLength: number;
63
- documentFrequencies: Map<string, number>;
64
- }
65
- /** @deprecated Use DiscoverableToolSearchResult */
66
- export interface DiscoverableMCPSearchResult {
67
- tool: DiscoverableMCPSearchTool;
68
- score: number;
69
- }
70
38
  export declare function isMCPToolName(name: string): boolean;
71
39
  export declare function isMCPBridgeTool(tool: {
72
40
  name: string;
@@ -93,20 +61,3 @@ export declare function selectDiscoverableToolNamesByServer(tools: Iterable<Disc
93
61
  export declare function summarizeDiscoverableTools(tools: DiscoverableTool[]): DiscoverableToolSummary;
94
62
  export declare function buildDiscoverableToolSearchIndex(tools: Iterable<DiscoverableTool>): DiscoverableToolSearchIndex;
95
63
  export declare function searchDiscoverableTools(index: DiscoverableToolSearchIndex, query: string, limit: number): DiscoverableToolSearchResult[];
96
- /** @deprecated Use getDiscoverableTool */
97
- export declare function getDiscoverableMCPTool(tool: AgentTool): DiscoverableMCPTool | null;
98
- /** @deprecated Use collectDiscoverableTools with source filter */
99
- export declare function collectDiscoverableMCPTools(tools: Iterable<AgentTool>): DiscoverableMCPTool[];
100
- /** @deprecated Use selectDiscoverableToolNamesByServer */
101
- export declare function selectDiscoverableMCPToolNamesByServer(tools: Iterable<DiscoverableMCPTool>, serverNames: ReadonlySet<string>): string[];
102
- /** @deprecated Use summarizeDiscoverableTools */
103
- export declare function summarizeDiscoverableMCPTools(tools: DiscoverableMCPTool[]): DiscoverableMCPToolSummary;
104
- /** @deprecated Use buildDiscoverableToolSearchIndex.
105
- * Builds an index whose documents preserve the legacy `description` field on each tool while
106
- * also carrying the generic `summary` (set from `description`) so the index remains usable
107
- * with `searchDiscoverableTools`. */
108
- export declare function buildDiscoverableMCPSearchIndex(tools: Iterable<DiscoverableMCPTool>): DiscoverableMCPSearchIndex;
109
- /** @deprecated Use searchDiscoverableTools */
110
- export declare function searchDiscoverableMCPTools(index: DiscoverableMCPSearchIndex | DiscoverableToolSearchIndex, query: string, limit: number): DiscoverableMCPSearchResult[];
111
- /** @deprecated Use formatDiscoverableToolServerSummary */
112
- export declare const formatDiscoverableMCPToolServerSummary: typeof formatDiscoverableToolServerSummary;
@@ -35,7 +35,38 @@ export declare const askSchema: z.ZodObject<{
35
35
  component: z.ZodString;
36
36
  dimension: z.ZodString;
37
37
  ambiguity: z.ZodNumber;
38
- }, z.core.$strip>>;
38
+ intent_contract: z.ZodOptional<z.ZodObject<{
39
+ items: z.ZodArray<z.ZodObject<{
40
+ id: z.ZodString;
41
+ category: z.ZodEnum<{
42
+ artifact: "artifact";
43
+ constraint: "constraint";
44
+ integration: "integration";
45
+ surface: "surface";
46
+ }>;
47
+ statement: z.ZodString;
48
+ }, z.core.$strict>>;
49
+ confirmation_options: z.ZodArray<z.ZodString>;
50
+ }, z.core.$strict>>;
51
+ intent_review: z.ZodOptional<z.ZodObject<{
52
+ observed_items: z.ZodArray<z.ZodObject<{
53
+ id: z.ZodString;
54
+ category: z.ZodEnum<{
55
+ artifact: "artifact";
56
+ constraint: "constraint";
57
+ integration: "integration";
58
+ surface: "surface";
59
+ }>;
60
+ statement: z.ZodString;
61
+ }, z.core.$strict>>;
62
+ supporting_substitutions: z.ZodArray<z.ZodObject<{
63
+ removed_id: z.ZodString;
64
+ replacement_ids: z.ZodArray<z.ZodString>;
65
+ rationale: z.ZodString;
66
+ }, z.core.$strict>>;
67
+ approval_options: z.ZodArray<z.ZodString>;
68
+ }, z.core.$strict>>;
69
+ }, z.core.$strict>>;
39
70
  workflowGate: z.ZodOptional<z.ZodObject<{
40
71
  stage: z.ZodEnum<{
41
72
  "deep-interview": "deep-interview";
@@ -124,7 +155,38 @@ export declare class AskTool implements AgentTool<typeof askSchema, AskToolDetai
124
155
  component: z.ZodString;
125
156
  dimension: z.ZodString;
126
157
  ambiguity: z.ZodNumber;
127
- }, z.core.$strip>>;
158
+ intent_contract: z.ZodOptional<z.ZodObject<{
159
+ items: z.ZodArray<z.ZodObject<{
160
+ id: z.ZodString;
161
+ category: z.ZodEnum<{
162
+ artifact: "artifact";
163
+ constraint: "constraint";
164
+ integration: "integration";
165
+ surface: "surface";
166
+ }>;
167
+ statement: z.ZodString;
168
+ }, z.core.$strict>>;
169
+ confirmation_options: z.ZodArray<z.ZodString>;
170
+ }, z.core.$strict>>;
171
+ intent_review: z.ZodOptional<z.ZodObject<{
172
+ observed_items: z.ZodArray<z.ZodObject<{
173
+ id: z.ZodString;
174
+ category: z.ZodEnum<{
175
+ artifact: "artifact";
176
+ constraint: "constraint";
177
+ integration: "integration";
178
+ surface: "surface";
179
+ }>;
180
+ statement: z.ZodString;
181
+ }, z.core.$strict>>;
182
+ supporting_substitutions: z.ZodArray<z.ZodObject<{
183
+ removed_id: z.ZodString;
184
+ replacement_ids: z.ZodArray<z.ZodString>;
185
+ rationale: z.ZodString;
186
+ }, z.core.$strict>>;
187
+ approval_options: z.ZodArray<z.ZodString>;
188
+ }, z.core.$strict>>;
189
+ }, z.core.$strict>>;
128
190
  workflowGate: z.ZodOptional<z.ZodObject<{
129
191
  stage: z.ZodEnum<{
130
192
  "deep-interview": "deep-interview";
@@ -42,6 +42,8 @@ export interface BashToolDetails {
42
42
  type: "bash";
43
43
  };
44
44
  }
45
+ /** Project only a bare executable name; commands and their output are never notification-safe. */
46
+ export declare function summarizeBashToolActivity(kind: "args" | "result", value: unknown): string | undefined;
45
47
  export interface BashToolOptions {
46
48
  }
47
49
  /**
@@ -59,6 +61,7 @@ export declare class BashTool implements AgentTool<BashToolSchema, BashToolDetai
59
61
  readonly parameters: BashToolSchema;
60
62
  readonly concurrency = "exclusive";
61
63
  readonly strict = true;
64
+ readonly safeSummary: typeof summarizeBashToolActivity;
62
65
  constructor(session: ToolSession);
63
66
  /**
64
67
  * Start a background bash job for the Monitor tool. Reuses the full Bash