@gajae-code/coding-agent 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/CHANGELOG.md +120 -1
  2. package/dist/types/async/job-manager.d.ts +4 -1
  3. package/dist/types/autoresearch/dashboard.d.ts +29 -4
  4. package/dist/types/autoresearch/data-context.d.ts +25 -0
  5. package/dist/types/autoresearch/git.d.ts +65 -7
  6. package/dist/types/autoresearch/harness.d.ts +58 -0
  7. package/dist/types/autoresearch/prompts.d.ts +51 -0
  8. package/dist/types/autoresearch/runs.d.ts +173 -0
  9. package/dist/types/autoresearch/types.d.ts +9 -139
  10. package/dist/types/capability/types.d.ts +20 -0
  11. package/dist/types/cli/accounts-cli.d.ts +1 -0
  12. package/dist/types/commands/{rlm.d.ts → autoresearch.d.ts} +2 -4
  13. package/dist/types/config/autorouting-contract.d.ts +146 -0
  14. package/dist/types/config/autorouting-generator.d.ts +40 -0
  15. package/dist/types/config/autorouting-tier-map.d.ts +16844 -0
  16. package/dist/types/config/autorouting.d.ts +35 -0
  17. package/dist/types/config/model-discovery-manager.d.ts +8 -1
  18. package/dist/types/config/model-registry.d.ts +30 -1
  19. package/dist/types/config/provider-selection-policy.d.ts +23 -0
  20. package/dist/types/config/settings-schema.d.ts +61 -3
  21. package/dist/types/config/settings.d.ts +3 -0
  22. package/dist/types/coordinator/contract.d.ts +1 -1
  23. package/dist/types/coordinator-mcp/durability.d.ts +29 -0
  24. package/dist/types/coordinator-mcp/event-webhook.d.ts +50 -0
  25. package/dist/types/coordinator-mcp/question-state.d.ts +1 -1
  26. package/dist/types/coordinator-mcp/server.d.ts +14 -0
  27. package/dist/types/crash/index-store.d.ts +3 -0
  28. package/dist/types/crash/record-loader.d.ts +2 -0
  29. package/dist/types/crash/upstream/relay.d.ts +5 -3
  30. package/dist/types/cursor.d.ts +12 -0
  31. package/dist/types/defaults/gjc-defaults.d.ts +35 -1
  32. package/dist/types/defaults/gjc-skills.generated.d.ts +1 -1
  33. package/dist/types/discovery/helpers.d.ts +1 -1
  34. package/dist/types/edit/index.d.ts +2 -1
  35. package/dist/types/eval/py/executor.d.ts +2 -0
  36. package/dist/types/extensibility/extensions/loader.d.ts +32 -0
  37. package/dist/types/extensibility/gjc-plugins/types.d.ts +1 -1
  38. package/dist/types/extensibility/skills.d.ts +2 -0
  39. package/dist/types/gjc-runtime/autoresearch-runtime.d.ts +194 -0
  40. package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
  41. package/dist/types/gjc-runtime/psmux-detect.d.ts +1 -1
  42. package/dist/types/gjc-runtime/python-transcript.d.ts +19 -0
  43. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +2 -8
  44. package/dist/types/gjc-runtime/session-layout.d.ts +6 -3
  45. package/dist/types/gjc-runtime/state-renderer.d.ts +0 -22
  46. package/dist/types/gjc-runtime/state-schema.d.ts +7 -7
  47. package/dist/types/gjc-runtime/tmux-common.d.ts +2 -2
  48. package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +38 -1
  49. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +2 -24
  50. package/dist/types/gjc-runtime/ultragoal-validation-policy.d.ts +73 -0
  51. package/dist/types/gjc-runtime/workflow-recovery-projection.d.ts +100 -0
  52. package/dist/types/hooks/skill-keywords.d.ts +1 -1
  53. package/dist/types/main.d.ts +0 -10
  54. package/dist/types/modes/acp/acp-agent.d.ts +13 -6
  55. package/dist/types/modes/components/model-selector.d.ts +14 -0
  56. package/dist/types/modes/components/skill-hud/render.d.ts +6 -1
  57. package/dist/types/modes/components/smart-routing-panel.d.ts +82 -0
  58. package/dist/types/modes/controllers/selector-controller.d.ts +14 -0
  59. package/dist/types/modes/interactive-mode.d.ts +3 -0
  60. package/dist/types/modes/types.d.ts +9 -0
  61. package/dist/types/rlm/artifacts.d.ts +4 -4
  62. package/dist/types/runtime/optional-runtime-services.d.ts +2 -1
  63. package/dist/types/runtime/workspace-tree-service.d.ts +5 -1
  64. package/dist/types/runtime-mcp/config.d.ts +6 -0
  65. package/dist/types/runtime-mcp/manager.d.ts +10 -0
  66. package/dist/types/sdk/acp/adapter.d.ts +0 -4
  67. package/dist/types/sdk/broker/broker.d.ts +1 -1
  68. package/dist/types/sdk/broker/lifecycle.d.ts +57 -2
  69. package/dist/types/sdk/broker/session-index.d.ts +15 -0
  70. package/dist/types/sdk/bus/chat-daemon-control.d.ts +6 -0
  71. package/dist/types/sdk/bus/chat-daemon-runtime.d.ts +4 -0
  72. package/dist/types/sdk/bus/index.d.ts +8 -0
  73. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +2 -0
  74. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -2
  75. package/dist/types/sdk/client/client.d.ts +39 -4
  76. package/dist/types/sdk/host/host.d.ts +1 -0
  77. package/dist/types/sdk/host/internal-autorouting-state.d.ts +3 -0
  78. package/dist/types/sdk/host/model-pin.d.ts +29 -0
  79. package/dist/types/sdk/host/session-runtime.d.ts +2 -1
  80. package/dist/types/sdk/lifecycle-session.d.ts +13 -0
  81. package/dist/types/sdk/router/session-router.d.ts +27 -1
  82. package/dist/types/sdk/session.d.ts +11 -1
  83. package/dist/types/session/agent-session.d.ts +36 -6
  84. package/dist/types/session/artifacts.d.ts +16 -1
  85. package/dist/types/session/internal/managed-session-storage.d.ts +7 -0
  86. package/dist/types/session/session-manager.d.ts +84 -2
  87. package/dist/types/session/session-staging-paths.d.ts +3 -0
  88. package/dist/types/skill-state/canonical-skills.d.ts +1 -1
  89. package/dist/types/skill-state/workflow-hud.d.ts +12 -21
  90. package/dist/types/skill-state/workflow-mutation-guard.d.ts +1 -0
  91. package/dist/types/slash-commands/helpers/autorouting-status.d.ts +8 -0
  92. package/dist/types/system-prompt.d.ts +23 -0
  93. package/dist/types/task/executor.d.ts +35 -4
  94. package/dist/types/task/index.d.ts +17 -3
  95. package/dist/types/task/receipt.d.ts +3 -1
  96. package/dist/types/task/types.d.ts +144 -0
  97. package/dist/types/tools/atomic-file-write.d.ts +72 -0
  98. package/dist/types/tools/descriptors.d.ts +1 -0
  99. package/dist/types/tools/index.d.ts +36 -1
  100. package/dist/types/tools/move-session.d.ts +40 -0
  101. package/dist/types/tools/python.d.ts +12 -0
  102. package/dist/types/tools/resource-gc.d.ts +0 -3
  103. package/dist/types/tools/search.d.ts +8 -1
  104. package/dist/types/tools/skill.d.ts +9 -4
  105. package/dist/types/tools/subagent.d.ts +33 -3
  106. package/dist/types/utils/xml-escape.d.ts +2 -0
  107. package/dist/types/workflow/workflow-intent-diff.d.ts +2 -2
  108. package/dist/types/workflow/workflow-intent-report-consumer.d.ts +1 -1
  109. package/package.json +11 -12
  110. package/scripts/build-sdk-package-smoke.ts +7 -5
  111. package/scripts/check-autorouting-tier-map.ts +183 -0
  112. package/scripts/generate-sdk-operation-inventory.ts +12 -0
  113. package/scripts/generate-tool-catalog.ts +40 -5
  114. package/src/async/job-manager.ts +5 -2
  115. package/src/autoresearch/dashboard.ts +134 -314
  116. package/src/autoresearch/data-context.ts +35 -0
  117. package/src/autoresearch/git.ts +186 -26
  118. package/src/autoresearch/{helpers.ts → harness.ts} +65 -40
  119. package/src/autoresearch/{prompt-setup.md → prompts/prompt-setup.md} +7 -7
  120. package/src/autoresearch/prompts/prompt.md +103 -0
  121. package/src/autoresearch/prompts.ts +126 -0
  122. package/src/autoresearch/runs.ts +708 -0
  123. package/src/autoresearch/types.ts +9 -150
  124. package/src/capability/index.ts +4 -4
  125. package/src/capability/types.ts +20 -0
  126. package/src/cli/accounts-cli.ts +21 -5
  127. package/src/cli/config-cli.ts +25 -1
  128. package/src/cli/fast-help.ts +1 -2
  129. package/src/cli/list-models.ts +5 -8
  130. package/src/cli/setup-cli.ts +8 -0
  131. package/src/cli.ts +2 -21
  132. package/src/commands/autoresearch.ts +33 -0
  133. package/src/commands/coordinator.ts +15 -0
  134. package/src/commands/launch.ts +2 -4
  135. package/src/commands/quick-lane.ts +1 -1
  136. package/src/commands/sdk.ts +24 -0
  137. package/src/commands/state.ts +1 -1
  138. package/src/config/autorouting-contract.ts +474 -0
  139. package/src/config/autorouting-generator.ts +238 -0
  140. package/src/config/autorouting-tier-map.ts +6108 -0
  141. package/src/config/autorouting.ts +120 -0
  142. package/src/config/model-discovery-manager.ts +42 -11
  143. package/src/config/model-registry.ts +348 -68
  144. package/src/config/provider-selection-policy.ts +60 -9
  145. package/src/config/settings-schema.ts +195 -6
  146. package/src/config/settings.ts +62 -1
  147. package/src/config.ts +2 -3
  148. package/src/coordinator/contract.ts +0 -1
  149. package/src/coordinator-mcp/codex-handoff.ts +68 -42
  150. package/src/coordinator-mcp/durability.ts +200 -0
  151. package/src/coordinator-mcp/event-webhook.ts +278 -0
  152. package/src/coordinator-mcp/question-state.ts +109 -46
  153. package/src/coordinator-mcp/server.ts +932 -504
  154. package/src/crash/index-store.ts +126 -22
  155. package/src/crash/record-loader.ts +7 -0
  156. package/src/crash/upstream/relay.ts +82 -34
  157. package/src/cursor.ts +84 -1
  158. package/src/debug/index.ts +26 -0
  159. package/src/defaults/gjc/skills/autoresearch/SKILL.md +116 -0
  160. package/src/defaults/gjc/skills/autoresearch/auto-critic.md +46 -0
  161. package/src/defaults/gjc/skills/autoresearch/auto-iterate.md +42 -0
  162. package/src/defaults/gjc/skills/deep-interview/SKILL.md +17 -37
  163. package/src/defaults/gjc/skills/ralplan/SKILL.md +21 -18
  164. package/src/defaults/gjc/skills/ultragoal/SKILL.md +6 -17
  165. package/src/defaults/gjc/skills/ultragoal/ai-slop-cleaner.md +2 -2
  166. package/src/defaults/gjc-defaults.ts +89 -2
  167. package/src/defaults/gjc-skills.generated.ts +24 -17
  168. package/src/discovery/builtin.ts +18 -5
  169. package/src/discovery/helpers.ts +6 -6
  170. package/src/edit/index.ts +5 -2
  171. package/src/eval/py/executor.ts +8 -0
  172. package/src/extensibility/extensions/loader.ts +135 -13
  173. package/src/extensibility/extensions/wrapper.ts +1 -2
  174. package/src/extensibility/gjc-plugins/schema.ts +1 -1
  175. package/src/extensibility/runtime-skill-discovery.ts +2 -2
  176. package/src/extensibility/skill-management.ts +2 -3
  177. package/src/extensibility/skills.ts +16 -8
  178. package/src/gjc-runtime/autoresearch-runtime.ts +1509 -0
  179. package/src/gjc-runtime/gc-render.ts +0 -1
  180. package/src/gjc-runtime/gc-runtime.ts +1 -11
  181. package/src/gjc-runtime/launch-tmux.ts +3 -3
  182. package/src/gjc-runtime/psmux-detect.ts +2 -2
  183. package/src/gjc-runtime/python-transcript.ts +58 -0
  184. package/src/gjc-runtime/ralplan-runtime.ts +6 -18
  185. package/src/gjc-runtime/session-layout.ts +18 -7
  186. package/src/gjc-runtime/session-state-sidecar.ts +58 -9
  187. package/src/gjc-runtime/state-renderer.ts +0 -38
  188. package/src/gjc-runtime/state-runtime.ts +43 -22
  189. package/src/gjc-runtime/state-schema.ts +1 -1
  190. package/src/gjc-runtime/tmux-common.ts +7 -7
  191. package/src/gjc-runtime/ultragoal-change-set.ts +232 -11
  192. package/src/gjc-runtime/ultragoal-runtime.ts +309 -114
  193. package/src/gjc-runtime/ultragoal-validation-policy.ts +247 -0
  194. package/src/gjc-runtime/workflow-command-ref.ts +15 -11
  195. package/src/gjc-runtime/workflow-manifest.generated.json +413 -532
  196. package/src/gjc-runtime/workflow-manifest.ts +43 -83
  197. package/src/gjc-runtime/workflow-recovery-projection.ts +616 -0
  198. package/src/hooks/skill-keywords.ts +3 -3
  199. package/src/hooks/skill-state.ts +2 -2
  200. package/src/internal-urls/docs-index.generated.ts +26 -24
  201. package/src/lsp/index.ts +25 -5
  202. package/src/main.ts +2 -27
  203. package/src/modes/acp/acp-agent.ts +200 -75
  204. package/src/modes/components/model-selector.ts +216 -13
  205. package/src/modes/components/oauth-selector.ts +5 -5
  206. package/src/modes/components/skill-hud/render.ts +173 -35
  207. package/src/modes/components/smart-routing-panel.ts +531 -0
  208. package/src/modes/components/tool-status-header.ts +6 -3
  209. package/src/modes/controllers/command-controller.ts +17 -7
  210. package/src/modes/controllers/input-controller.ts +44 -9
  211. package/src/modes/controllers/runtime-mcp-command-controller.ts +4 -0
  212. package/src/modes/controllers/selector-controller.ts +298 -65
  213. package/src/modes/interactive-mode.ts +8 -1
  214. package/src/modes/shared/agent-wire/workflow-gate-types.ts +1 -1
  215. package/src/modes/types.ts +9 -1
  216. package/src/prompts/agents/planner.md +1 -1
  217. package/src/prompts/system/system-prompt.md +1 -1
  218. package/src/prompts/system/volatile-project-context.md +2 -1
  219. package/src/prompts/tools/move-session.md +15 -0
  220. package/src/prompts/tools/python.md +12 -0
  221. package/src/prompts/tools/skill-discovery.md +1 -1
  222. package/src/prompts/tools/skill.md +2 -2
  223. package/src/prompts/tools/task-summary.md +1 -0
  224. package/src/prompts/tools/task.md +6 -0
  225. package/src/rlm/artifacts.ts +12 -10
  226. package/src/runtime/optional-runtime-services.ts +3 -2
  227. package/src/runtime/workspace-tree-service.ts +11 -3
  228. package/src/runtime-mcp/config.ts +8 -1
  229. package/src/runtime-mcp/manager.ts +33 -0
  230. package/src/sdk/acp/adapter.ts +48 -1
  231. package/src/sdk/broker/broker.ts +30 -2
  232. package/src/sdk/broker/discovery.ts +217 -2
  233. package/src/sdk/broker/lifecycle.ts +385 -59
  234. package/src/sdk/broker/session-index.ts +243 -48
  235. package/src/sdk/broker/transport.ts +1 -0
  236. package/src/sdk/bus/chat-daemon-control.ts +8 -2
  237. package/src/sdk/bus/chat-daemon-runtime.ts +5 -0
  238. package/src/sdk/bus/index.ts +208 -11
  239. package/src/sdk/bus/kind-aware-reconciliation.ts +16 -0
  240. package/src/sdk/bus/reconciliation-store.ts +27 -5
  241. package/src/sdk/bus/telegram-daemon-contract.ts +12 -2
  242. package/src/sdk/client/client.ts +204 -22
  243. package/src/sdk/host/host.ts +16 -0
  244. package/src/sdk/host/internal-autorouting-state.ts +13 -0
  245. package/src/sdk/host/model-pin.ts +101 -0
  246. package/src/sdk/host/reverse-leases.ts +2 -1
  247. package/src/sdk/host/session-runtime.test.ts +224 -1
  248. package/src/sdk/host/session-runtime.ts +125 -37
  249. package/src/sdk/lifecycle/service.ts +3 -1
  250. package/src/sdk/lifecycle-session.ts +42 -1
  251. package/src/sdk/protocol/operation-inventory.generated.json +66 -0
  252. package/src/sdk/router/session-router.ts +375 -36
  253. package/src/sdk/session.ts +547 -47
  254. package/src/session/account-inventory.ts +1 -1
  255. package/src/session/agent-session.ts +765 -189
  256. package/src/session/artifacts.ts +234 -4
  257. package/src/session/internal/managed-session-storage.ts +91 -4
  258. package/src/session/provider-safety-stop-hint.ts +3 -2
  259. package/src/session/session-manager.ts +775 -16
  260. package/src/session/session-staging-paths.ts +8 -0
  261. package/src/setup/hermes/templates/operator-instructions.v1.md +0 -1
  262. package/src/setup/host-plugin-setup.ts +2 -2
  263. package/src/skill-state/active-state.ts +2 -2
  264. package/src/skill-state/canonical-skills.ts +1 -1
  265. package/src/skill-state/initial-phase.ts +1 -1
  266. package/src/skill-state/workflow-hud.ts +41 -41
  267. package/src/skill-state/workflow-mutation-guard.ts +26 -7
  268. package/src/slash-commands/builtin-registry.ts +77 -0
  269. package/src/slash-commands/helpers/autorouting-status.ts +55 -0
  270. package/src/system-prompt.ts +102 -5
  271. package/src/task/discovery.ts +2 -3
  272. package/src/task/executor.ts +617 -43
  273. package/src/task/index.ts +262 -15
  274. package/src/task/receipt.ts +30 -0
  275. package/src/task/render.ts +11 -1
  276. package/src/task/types.ts +316 -0
  277. package/src/tools/atomic-file-write.ts +594 -0
  278. package/src/tools/bisect.ts +3 -2
  279. package/src/tools/descriptors.test.ts +3 -0
  280. package/src/tools/descriptors.ts +24 -0
  281. package/src/tools/image-gen.ts +5 -1
  282. package/src/tools/index.ts +62 -5
  283. package/src/tools/move-session.ts +107 -0
  284. package/src/tools/python.ts +205 -0
  285. package/src/tools/read.ts +88 -15
  286. package/src/tools/renderers.ts +2 -0
  287. package/src/tools/resource-gc.ts +8 -177
  288. package/src/tools/search.ts +30 -6
  289. package/src/tools/skill-discovery.ts +1 -0
  290. package/src/tools/skill.ts +37 -7
  291. package/src/tools/subagent-render.ts +119 -13
  292. package/src/tools/subagent.ts +91 -74
  293. package/src/tools/tool-catalog.generated.ts +64 -2
  294. package/src/tools/write.ts +16 -12
  295. package/src/utils/xml-escape.ts +14 -0
  296. package/src/web/search/providers/codex.ts +2 -2
  297. package/src/workflow/workflow-intent-diff.ts +13 -12
  298. package/src/workflow/workflow-intent-report-consumer.ts +6 -6
  299. package/dist/types/autoresearch/helpers.d.ts +0 -24
  300. package/dist/types/autoresearch/index.d.ts +0 -2
  301. package/dist/types/autoresearch/state.d.ts +0 -17
  302. package/dist/types/autoresearch/storage.d.ts +0 -142
  303. package/dist/types/autoresearch/tools/init-experiment.d.ts +0 -31
  304. package/dist/types/autoresearch/tools/log-experiment.d.ts +0 -23
  305. package/dist/types/autoresearch/tools/run-experiment.d.ts +0 -8
  306. package/dist/types/autoresearch/tools/update-notes.d.ts +0 -12
  307. package/dist/types/commands/team.d.ts +0 -24
  308. package/dist/types/gjc-runtime/team-gc.d.ts +0 -7
  309. package/dist/types/gjc-runtime/team-launch.d.ts +0 -61
  310. package/dist/types/gjc-runtime/team-notify.d.ts +0 -45
  311. package/dist/types/gjc-runtime/team-runtime.d.ts +0 -336
  312. package/dist/types/gjc-runtime/team-store.d.ts +0 -168
  313. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +0 -43
  314. package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +0 -92
  315. package/dist/types/gjc-runtime/team-workers.d.ts +0 -83
  316. package/dist/types/rlm/index.d.ts +0 -47
  317. package/dist/types/rlm/preset.d.ts +0 -23
  318. package/dist/types/rlm/python-tool.d.ts +0 -16
  319. package/src/autoresearch/command-resume.md +0 -14
  320. package/src/autoresearch/index.ts +0 -536
  321. package/src/autoresearch/prompt.md +0 -103
  322. package/src/autoresearch/resume-message.md +0 -10
  323. package/src/autoresearch/state.ts +0 -273
  324. package/src/autoresearch/storage.ts +0 -699
  325. package/src/autoresearch/tools/init-experiment.ts +0 -272
  326. package/src/autoresearch/tools/log-experiment.ts +0 -524
  327. package/src/autoresearch/tools/run-experiment.ts +0 -475
  328. package/src/autoresearch/tools/update-notes.ts +0 -109
  329. package/src/commands/rlm.ts +0 -19
  330. package/src/commands/team.ts +0 -238
  331. package/src/defaults/gjc/skills/deep-interview/auto-research-greenfield.md +0 -42
  332. package/src/defaults/gjc/skills/team/SKILL.md +0 -467
  333. package/src/gjc-runtime/team-gc.ts +0 -49
  334. package/src/gjc-runtime/team-launch.ts +0 -404
  335. package/src/gjc-runtime/team-notify.ts +0 -326
  336. package/src/gjc-runtime/team-runtime.ts +0 -5923
  337. package/src/gjc-runtime/team-store.ts +0 -878
  338. package/src/gjc-runtime/team-worker-heartbeat.ts +0 -149
  339. package/src/gjc-runtime/team-worker-memory-guard.ts +0 -363
  340. package/src/gjc-runtime/team-workers.ts +0 -1123
  341. package/src/prompts/system/rlm-report-command.md +0 -1
  342. package/src/prompts/system/rlm-research.md +0 -23
  343. package/src/rlm/index.ts +0 -365
  344. package/src/rlm/preset.ts +0 -76
  345. package/src/rlm/python-tool.ts +0 -68
@@ -67,6 +67,8 @@ export interface KindAwareReconciliation {
67
67
  activeCount(kind: ReconciliationKind): number;
68
68
  /** Hydrate from durable store (call once at session host start). */
69
69
  hydrateFromStore(): Promise<void>;
70
+ /** Await quiescence of every admitted mutation and the durable store (#4743). */
71
+ drain(): Promise<void>;
70
72
  }
71
73
  export declare function createKindAwareReconciliation(options?: {
72
74
  now?: () => number;
@@ -268,8 +268,15 @@ export declare const SDK_LIFECYCLE_ROUTER_PROTOCOL_VERSION = 1;
268
268
  * reaction settlement for Telegram notification delivery (#4528).
269
269
  * Generation 169 delivers every ring-positioned session event live through the
270
270
  * bounded, capability-gated directed subscriber leg used by replay.
271
+ * Generation 172 fences the SessionRouter idle-poll/change-stamp rollout (#4689).
272
+ * The daemon constructs a SessionRouter, and the router's idle tick no longer
273
+ * re-acquires the machine-global session-index lock on every 2s pass: unchanged
274
+ * polls are stat-only and staleness retirement moved to a 30s sweep. A daemon
275
+ * still running the pre-#4689 router keeps the old hot polling loop and its
276
+ * lock contention, so an already-running owner must be replaced rather than
277
+ * retained across this upgrade.
271
278
  */
272
- export declare const DAEMON_GENERATION = 171;
279
+ export declare const DAEMON_GENERATION = 172;
273
280
  /**
274
281
  * Serving-compatibility boundary for daemon lifecycle requests. Epoch 7
275
282
  * requires durable publication receipts and acknowledged attachment dispatch,
@@ -354,5 +361,8 @@ export declare const DAEMON_GENERATION = 171;
354
361
  * Epoch 85 removes direct relay attachment and prohibits lifecycle controls on every adapter.
355
362
  * Epoch 86 removes public discovery/client exports and retires cross-process raw transports.
356
363
  * Epoch 87 preserves accepted Telegram delivery ambiguity and advances poisoned poll cursors.
364
+ * Epoch 88 requires the #4689 SessionRouter idle-poll contract: generation alone
365
+ * does not force replacement, so the serving boundary advances to guarantee a
366
+ * pre-#4689 daemon cannot keep serving with the old per-tick locked rescan.
357
367
  */
358
- export declare const SERVING_EPOCH = 87;
368
+ export declare const SERVING_EPOCH = 88;
@@ -50,8 +50,46 @@ export interface SdkRequestOptions {
50
50
  timeoutMs?: number;
51
51
  idempotencyKey?: string;
52
52
  confirm?: boolean;
53
+ /**
54
+ * Synchronous pre-send observer for one request. Called after the
55
+ * connection is live and validated, immediately before the frame is written
56
+ * to the socket. Throwing aborts the dispatch: nothing is written, no sent
57
+ * record is retained, and the request rejects with the thrown error, so the
58
+ * caller may safely retry (pre-send semantics).
59
+ */
60
+ beforeDispatch?: SdkBeforeDispatchHandler;
61
+ /**
62
+ * Synchronous dispatch-boundary observer for one request. Called immediately
63
+ * after the frame was handed to the socket — never before — and before any
64
+ * other client work. From this point a transport close before the response
65
+ * settles the request as `uncertain_after_send`; observer exceptions cannot
66
+ * alter that settlement.
67
+ */
68
+ onDispatch?: SdkDispatchHandler;
53
69
  }
54
70
  export type SdkFrame = Record<string, unknown>;
71
+ /**
72
+ * Synchronous by contract. Returning a thenable (e.g. an `async` function) is a
73
+ * contract violation: pre-send the dispatch aborts retryably and the eventual
74
+ * rejection is sunk, never escaping to the process unhandled-rejection channel.
75
+ */
76
+ export type SdkBeforeDispatchHandler = (request: SdkDispatchContext) => void;
77
+ /**
78
+ * Synchronous by contract. A returned thenable's rejection is sunk; it can
79
+ * neither displace request settlement nor escape to the process
80
+ * unhandled-rejection channel.
81
+ */
82
+ export type SdkDispatchHandler = (request: SdkDispatchContext) => void;
83
+ /**
84
+ * Facts about one request at its dispatch boundary. `frame.id` is the exact
85
+ * correlated identity a response frame must carry to settle this request.
86
+ */
87
+ export interface SdkDispatchContext {
88
+ readonly frame: SdkFrame;
89
+ /** Transport generation this request was written to. */
90
+ readonly connectionId: string | undefined;
91
+ readonly generation: number;
92
+ }
55
93
  /** Request identity retained after an uncertain send for lifecycle reconciliation. */
56
94
  export interface SdkSentRecord {
57
95
  readonly id: string;
@@ -84,10 +122,7 @@ export declare class SdkClient {
84
122
  onReconnect(handler: SdkReconnectHandler): () => void;
85
123
  onReconnectFailed(handler: SdkReconnectFailedHandler): () => void;
86
124
  send(frame: SdkFrame): void;
87
- request(frame: SdkFrame, timeout?: number | {
88
- timeoutMs?: number;
89
- idempotencyKey?: string;
90
- }): Promise<SdkFrame>;
125
+ request(frame: SdkFrame, options?: number | SdkRequestOptions): Promise<SdkFrame>;
91
126
  close(): Promise<void>;
92
127
  control(operation: string, input?: Record<string, unknown>, options?: SdkRequestOptions): Promise<unknown>;
93
128
  query(query: string, input?: Record<string, unknown>, cursor?: string, options?: SdkRequestOptions): Promise<unknown>;
@@ -90,6 +90,7 @@ export declare class SessionSdkHost {
90
90
  handleMalformedFrame(connectionId: string, message: string): void;
91
91
  /** Adds an event to the resumable event ring. Transport delivery is owned by bus wiring. */
92
92
  emitEvent(frame: SdkFrame): EventFrame;
93
+ emitAutoroutingInactiveNotice(): EventFrame;
93
94
  start(): Promise<"started" | "already">;
94
95
  /**
95
96
  * Publish the readiness signal a prepared session withheld.
@@ -0,0 +1,3 @@
1
+ export declare function markAutoroutingInactive(target: object): void;
2
+ export declare function clearAutoroutingInactive(target: object): void;
3
+ export declare function isAutoroutingInactive(target: unknown): boolean;
@@ -0,0 +1,29 @@
1
+ import type { AuthStorage } from "@gajae-code/ai/core";
2
+ import { ModelRegistry } from "../../config/model-registry";
3
+ import { Settings } from "../../config/settings";
4
+ export interface SdkHostModelResolveContext {
5
+ cwd?: string;
6
+ }
7
+ /** Registry loader owned by the SDK host, not by machine-facing adapters. */
8
+ export type SdkHostModelRegistryLoader = (context?: SdkHostModelResolveContext) => ModelRegistry | Promise<ModelRegistry>;
9
+ /**
10
+ * Builds an offline model resolver for a single SDK host process.
11
+ *
12
+ * The registry is reused, but refreshed for every validation so additions and
13
+ * removals made while the broker is alive are observed without network I/O.
14
+ */
15
+ export declare function createSdkHostModelRegistryLoader(discoverStorage: () => Promise<AuthStorage>, modelsPath?: string, loadSettings?: (context?: SdkHostModelResolveContext) => Promise<Pick<Settings, "get" | "getGlobal">>): SdkHostModelRegistryLoader;
16
+ export type SdkHostModelResolution = {
17
+ ok: true;
18
+ model: string | null;
19
+ } | {
20
+ ok: false;
21
+ reason: "unknown_model";
22
+ model: string;
23
+ error: string;
24
+ };
25
+ export type SdkHostModelResolver = (raw: unknown, context?: SdkHostModelResolveContext) => Promise<SdkHostModelResolution>;
26
+ /** Resolve the explicit model pin at the SDK host boundary. */
27
+ export declare function resolveSdkHostModel(raw: unknown, loadRegistry: SdkHostModelRegistryLoader, context?: SdkHostModelResolveContext): Promise<SdkHostModelResolution>;
28
+ /** Default resolver used by the SDK broker host. */
29
+ export declare function createDefaultSdkHostModelResolver(agentDir: string): SdkHostModelResolver;
@@ -165,9 +165,10 @@ export interface CreateSdkSessionRuntimeOptions {
165
165
  stateRoot: string;
166
166
  token: string;
167
167
  }): SessionSdkTransport | Promise<SessionSdkTransport>;
168
- onSdkRequest?: SessionSdkHostOptions["onRequest"];
169
168
  /** Session settings; enables `config.patch` application on this runtime. */
170
169
  settings?: Settings;
170
+ /** Callback for diagnostics and lifecycle request observation. */
171
+ onSdkRequest?: SessionSdkHostOptions["onRequest"];
171
172
  /** Mutable shadow of patched config values merged into query readback. */
172
173
  configOverrides?: Map<string, unknown>;
173
174
  /** Private session-owned terminal-abort capabilities; never exposed on ExtensionContext. */
@@ -23,6 +23,19 @@ export type CreateLifecycleAgentSessionResult = {
23
23
  * unbounded LLM work, so deferral is an invariant rather than a caller choice.
24
24
  */
25
25
  export type CreateLifecycleAgentSessionOptions = Omit<CreateAgentSessionOptions, "deferMemoryBackendStartup"> & {
26
+ /**
27
+ * Explicit model pin (#4707): the coordinator-resolved `provider/model`
28
+ * selector, forwarded as {@link CreateAgentSessionOptions.modelPattern} so
29
+ * the session resolves it through the same staged selector resolver the CLI
30
+ * `--model` flag uses (after extension providers register).
31
+ *
32
+ * Resolution is strict: if this child's registry cannot resolve the pin to
33
+ * exactly this model, construction fails and the partial session is
34
+ * disposed instead of continuing into startup profile application, which
35
+ * would otherwise activate `modelProfile.default`/`mpreset` while the
36
+ * coordinator reports the requested pin.
37
+ */
38
+ modelId?: string;
26
39
  /**
27
40
  * Startup budget for ACP lifecycle MCP launches, in milliseconds. Set only
28
41
  * when the lifecycle request supplies `mcpServers`; ordinary consumers keep
@@ -1,4 +1,5 @@
1
1
  import { type SessionIndex } from "../broker/session-index";
2
+ import { type SdkDispatchContext, type SdkDispatchHandler } from "../client/client";
2
3
  import { type ActivatedPreparedSession } from "../session-activation";
3
4
  /**
4
5
  * Exact identity of one attached SDK session endpoint. Providers persist it next to
@@ -23,6 +24,19 @@ export interface SessionAttachment {
23
24
  readonly generation: number;
24
25
  isCurrent(): boolean;
25
26
  send(frame: Record<string, unknown>): unknown;
27
+ /**
28
+ * Idempotent provider-lease heartbeat send that skips the pre-send authority
29
+ * reconcile (#4689).
30
+ *
31
+ * Optional so existing exported-capability implementations (including
32
+ * consumer-provided `resolveAttachment` callbacks on the Discord/Slack daemon
33
+ * options) stay source- and runtime-compatible (#4730 review). It is NOT a
34
+ * fail-open fallback: a caller that finds it absent must fail closed rather
35
+ * than route the heartbeat through `send()`, which would restore the 5s
36
+ * heartbeat-forced locked rescan this fix exists to remove. Router-owned
37
+ * attachments always provide it.
38
+ */
39
+ sendMaintenance?(leaseId: string): unknown;
26
40
  /** Revoke this exact capability after provider admission or replay fails closed. */
27
41
  retire?(): Promise<void>;
28
42
  }
@@ -57,6 +71,10 @@ export interface SessionRouterClient {
57
71
  connect?(): Promise<void>;
58
72
  request(frame: Record<string, unknown>, options?: {
59
73
  timeoutMs?: number;
74
+ /** Synchronous pre-send observer; a throw aborts the dispatch before the wire. */
75
+ beforeDispatch?: (context: SdkDispatchContext) => void;
76
+ /** Synchronous post-send boundary observer for transport-close-aware consumers. */
77
+ onDispatch?: (context: SdkDispatchContext) => void;
60
78
  }): Promise<Record<string, unknown>>;
61
79
  /** Current private transport connection identity, surfaced only through its exact attachment. */
62
80
  readonly connectionId?: string;
@@ -86,6 +104,8 @@ export interface SessionRouterDeps {
86
104
  createBrokerClient?: () => Promise<SessionRouterClient>;
87
105
  /** Receives only an opaque capability and correlated provider-neutral frames. */
88
106
  onFrame?: (attachment: SessionAttachment, frame: SessionRouterFrame) => Promise<void> | void;
107
+ /** Test/runtime observer invoked after a frame's delivery and cursor update settle. */
108
+ onFrameSettled?: (attachment: SessionAttachment, frame: SessionRouterFrame) => void;
89
109
  onAttachment?: (attachment: SessionAttachment) => Promise<void> | void;
90
110
  /** Called only after the opaque capability becomes externally current. */
91
111
  onAttachmentReady?: (attachment: SessionAttachment) => Promise<void> | void;
@@ -101,6 +121,8 @@ export interface SessionRouterDeps {
101
121
  clearInterval?: typeof clearInterval;
102
122
  setTimeout?: typeof setTimeout;
103
123
  clearTimeout?: typeof clearTimeout;
124
+ /** Test seam for the idle liveness-sweep cadence (#4689). */
125
+ idleSweepMs?: number;
104
126
  }
105
127
  export type SessionRouterProviderDeps = Pick<SessionRouterDeps, "createClient" | "createIndex" | "createBrokerClient" | "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout" | "onReconciled">;
106
128
  export interface SessionRouterOptions {
@@ -127,7 +149,9 @@ export declare class SessionRouter {
127
149
  /** Starts reconciliation and the index watcher. */
128
150
  start(): Promise<void>;
129
151
  /** Exposed for deterministic callers and reconciliation tests. */
130
- reconcile(): Promise<void>;
152
+ reconcile(options?: {
153
+ waitForReplay?: boolean;
154
+ }): Promise<void>;
131
155
  /** Ingests a credential-bearing Broker lifecycle result directly into Router custody. */
132
156
  adoptLifecycleResult(value: unknown, fallback: {
133
157
  sessionId: string;
@@ -139,6 +163,8 @@ export declare class SessionRouter {
139
163
  /** Sends an SDK command through the current attachment without exposing its client. */
140
164
  request(sessionId: string, frame: Record<string, unknown>, expectedGeneration?: number, expectedAttachment?: SessionAttachment, options?: {
141
165
  timeoutMs?: number;
166
+ beforeDispatch?: (context: SdkDispatchContext) => void;
167
+ onDispatch?: SdkDispatchHandler;
142
168
  }): Promise<Record<string, unknown>>;
143
169
  /** Resolves the exact provider-neutral binding authority for operator adoption. */
144
170
  bindingAuthority(sessionId: string): Promise<{
@@ -27,9 +27,12 @@ import { AuthStorage } from "../session/auth-storage";
27
27
  import { SessionManager } from "../session/session-manager";
28
28
  import { type StartupAuthConfigSnapshot } from "../session/startup-auth-config";
29
29
  import { type BuildSystemPromptResult } from "../system-prompt";
30
- import { BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type Tool, type ToolSession } from "../tools";
30
+ import { type AutomationTools, BUILTIN_TOOLS, createTools, HIDDEN_TOOLS, type Tool, type ToolSession } from "../tools";
31
31
  import { EventBus } from "../utils/event-bus";
32
32
  import type { WorkspaceTree } from "../workspace-tree";
33
+ export type { AutomationToolName, AutomationTools } from "../tools";
34
+ /** Capture the cursor edit grant before the model-facing edit entry is removed. */
35
+ export declare function captureCursorEditTool<T>(toolRegistry: ReadonlyMap<string, unknown>, createReplaceTool: () => T): T | undefined;
33
36
  /**
34
37
  * Reconcile a resumed transcript that ends on an unpaired tool call.
35
38
  *
@@ -103,6 +106,13 @@ export interface CreateAgentSessionOptions {
103
106
  startupAuthConfig?: StartupAuthConfigSnapshot;
104
107
  /** Custom tools to register (in addition to built-in tools). Accepts both CustomTool and ToolDefinition. */
105
108
  customTools?: (CustomTool | ToolDefinition)[];
109
+ /**
110
+ * Host-owned implementations for the built-in `browser` and `computer`
111
+ * surfaces. These are materialized as built-ins, retain built-in provenance
112
+ * and activation behavior, and receive cancellation through AgentTool's
113
+ * AbortSignal. A matching custom or extension tool is rejected.
114
+ */
115
+ automationTools?: AutomationTools;
106
116
  /** Explicit parent/phase used to load active GJC sub-skill tools for this session. */
107
117
  gjcSubskillToolContext?: {
108
118
  parent: string;
@@ -86,7 +86,6 @@ import type { SessionSwitchEvent } from "../extensibility/shared-events";
86
86
  import { type Skill, type SkillWarning } from "../extensibility/skills";
87
87
  import { type FileSlashCommand } from "../extensibility/slash-commands";
88
88
  import { type MemoryGuardClaimsLease } from "../gjc-runtime/memory-guard-owner-claims";
89
- import { GjcTeamWorkerHeartbeatReporter } from "../gjc-runtime/team-worker-heartbeat";
90
89
  import { GoalRuntime } from "../goals/runtime";
91
90
  import type { Goal, GoalModeState } from "../goals/state";
92
91
  import type { HindsightSessionState } from "../hindsight/state";
@@ -237,11 +236,6 @@ export interface AgentSessionConfig {
237
236
  workerIntegrationRequest?: (signal: AbortSignal) => Promise<void>;
238
237
  /** Bound terminal worker-integration settlement for embedded hosts and deterministic lifecycle tests. */
239
238
  workerIntegrationTimeoutMs?: number;
240
- /**
241
- * Override the runtime-owned `gjc team` worker heartbeat reporter. Defaults to a
242
- * reporter derived from the team worker environment, or none outside a worker pane.
243
- */
244
- teamWorkerHeartbeatReporter?: GjcTeamWorkerHeartbeatReporter;
245
239
  /** Loaded skills (already discovered by SDK) */
246
240
  skills?: Skill[];
247
241
  /** Skill loading warnings (already captured by SDK) */
@@ -647,6 +641,18 @@ export declare class AgentSession {
647
641
  skill: string;
648
642
  session_id?: string;
649
643
  } | undefined;
644
+ /**
645
+ * Live prompt marker or restored durable workflow — the effective state the
646
+ * cwd-local mutation guard must honor after resume.
647
+ */
648
+ getEffectiveActiveWorkflowSkillState(): {
649
+ skill: string;
650
+ sessionId: string;
651
+ } | undefined;
652
+ /** Replace the session-owned MCP manager after a cwd rescope. */
653
+ replaceOwnedMcpManager(next: MCPManager | undefined): Promise<void>;
654
+ /** Swap named custom/project tools after a cwd rescope. */
655
+ replaceNamedCustomTools(previousNames: readonly string[], nextTools: CustomTool[]): Promise<void>;
650
656
  /** Best-effort accessor for the active skill's `current_phase` field from
651
657
  * its persisted mode-state file. Used by the `skill` tool to enforce the
652
658
  * terminal-phase chain guard. Returns undefined when no active skill is
@@ -1055,6 +1061,19 @@ export declare class AgentSession {
1055
1061
  };
1056
1062
  /** Number of pending messages (includes steering, follow-up, and next-turn messages) */
1057
1063
  get queuedMessageCount(): number;
1064
+ /**
1065
+ * Number of pending messages a user-facing drain can actually deliver back:
1066
+ * exactly the steering and follow-up queues that `clearQueue()`,
1067
+ * `popLastQueuedMessage()`, and `getQueuedMessageEntries()` operate on.
1068
+ *
1069
+ * Hidden next-turn context is deliberately excluded. Those entries are
1070
+ * authored by the agent (e.g. a `todo_write` failure reminder queued with
1071
+ * `deliverAs: "nextTurn"` and no `triggerTurn`), are never returned by the
1072
+ * drain handlers, and deliberately survive turn completion — so a UI gate
1073
+ * that counted them would report permanently pending work that no key press
1074
+ * can clear, locking the user out of their own input (#4741).
1075
+ */
1076
+ get drainableQueuedMessageCount(): number;
1058
1077
  /** Typed pending-message counts per queue (steering, follow-up, next-turn). */
1059
1078
  get pendingMessageCounts(): {
1060
1079
  steering: number;
@@ -1086,6 +1105,17 @@ export declare class AgentSession {
1086
1105
  get skillsSettings(): SkillsSettings | undefined;
1087
1106
  /** Skills loaded by SDK (always includes bundled GJC workflow defaults unless explicitly overridden by SDK callers) */
1088
1107
  get skills(): readonly Skill[];
1108
+ /**
1109
+ * Install the skill set discovered at a newly rescoped cwd (`move_session`).
1110
+ * Project-scoped skills belong to the directory they were discovered in, so
1111
+ * they must not survive a move out of it.
1112
+ */
1113
+ replaceSkills(skills: Skill[]): Promise<void>;
1114
+ /**
1115
+ * Retire the cached workspace tree after a rescope so the next turn re-scans
1116
+ * at the new cwd instead of re-presenting the abandoned launcher root.
1117
+ */
1118
+ retireWorkspaceTreeForRescope(): void;
1089
1119
  /** Skill loading warnings captured by SDK */
1090
1120
  get skillWarnings(): readonly SkillWarning[];
1091
1121
  getTodoPhases(): TodoPhase[];
@@ -55,7 +55,11 @@ export declare class ArtifactManager {
55
55
  /**
56
56
  * @param dir Directory that will hold artifact files. Created lazily on first save.
57
57
  */
58
- constructor(target: string | ManagedSessionDescendantStore);
58
+ constructor(target: string | ManagedSessionDescendantStore, options?: {
59
+ readonly attemptId?: string;
60
+ readonly stagingParentStore?: ManagedSessionDescendantStore;
61
+ readonly stagingRelativePath?: string;
62
+ });
59
63
  /**
60
64
  * Artifact directory path.
61
65
  * Directory may not exist until first artifact is saved.
@@ -108,6 +112,17 @@ export declare class ArtifactManager {
108
112
  * Returns empty array if directory doesn't exist.
109
113
  */
110
114
  listFiles(): Promise<string[]>;
115
+ getAttemptId(): string | undefined;
116
+ getAllocatedIds(): readonly string[];
117
+ /** Create an isolated artifact manager rooted below this manager's staging area. */
118
+ createAttemptStaging(attemptId: string): ArtifactManager;
119
+ /** Reserve and publish a candidate's staged artifacts with a contiguous parent ID block. */
120
+ commitAttemptStaging(staging: ArtifactManager, attemptId: string, options?: {
121
+ beforePublish?: (mapping: ReadonlyMap<string, string>) => Promise<void> | void;
122
+ }): Promise<ReadonlyMap<string, string>>;
123
+ rollbackLastAttemptCommit(attemptId?: string): Promise<void>;
124
+ finalizeLastAttemptCommit(attemptId?: string): void;
125
+ discardAttemptStaging(): Promise<void>;
111
126
  /** Persist exact UTF-8 text for heap-eviction rehydration. */
112
127
  publishExactText(text: string, options?: ArtifactPublishOptions): Promise<ArtifactPublishOutcome>;
113
128
  readRange(id: string, range?: ArtifactByteRange): Promise<string>;
@@ -29,6 +29,7 @@ export declare class ManagedCommittedMutationError extends Error {
29
29
  readonly operation: "replace" | "append";
30
30
  constructor(operation: "replace" | "append", cause: unknown);
31
31
  }
32
+ /** A managed move outcome that reports whether the mutation is known not to have committed. */
32
33
  export declare class ManagedTreeMoveOutcomeError extends Error {
33
34
  readonly stagingCleanupSafe: boolean;
34
35
  constructor(message: string, stagingCleanupSafe: boolean);
@@ -218,6 +219,12 @@ export declare class ManagedSessionDescendantStore {
218
219
  /** Copy an exact captured tree into an absent managed destination. */
219
220
  importTree(sourceRelativePath: string, destinationRelativePath: string, snapshot: NativeDirectoryTreeSnapshot): Promise<void>;
220
221
  moveTreeNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: NativeDirectoryTreeSnapshot): NativeDirectoryTreeSnapshot;
222
+ /** Move one exact managed regular file to an absent destination through retained authority. */
223
+ moveFileNoReplace(sourceRelativePath: string, destinationRelativePath: string, expected: ManagedFileSnapshot, options?: {
224
+ /** Subtree store bound to the source's directory; keeps the verification read basename-scoped when this store lacks retained authority. */
225
+ sourceStore: ManagedSessionDescendantStore;
226
+ sourceStoreRelativePath: string;
227
+ }): ManagedFileSnapshot;
221
228
  removeTreeExpected(relativePath: string, expected: NativeDirectoryTreeSnapshot): void;
222
229
  fsyncTree(): NativeDirectoryTreeSnapshot;
223
230
  }
@@ -1,4 +1,5 @@
1
1
  import * as crypto from "node:crypto";
2
+ import * as fs from "node:fs";
2
3
  import { type AgentMessage } from "@gajae-code/agent-core";
3
4
  import type { ConfiguredModelChainEntry as SharedConfiguredModelChainEntry } from "@gajae-code/agent-core/compaction";
4
5
  import type { ImageContent, Message, MessageAttribution, ServiceTier, TextContent } from "@gajae-code/ai/core";
@@ -972,6 +973,12 @@ export declare function materializeResidentEntriesThrowingForTests<T>(entries: T
972
973
  sessionFile?: string;
973
974
  }): T[];
974
975
  export declare function materializeResidentEntriesForPersistenceForTests<T>(entries: T[], textStore: BlobStore, imageStore?: BlobStore): T[];
976
+ /**
977
+ * Discover resumable transcripts intentionally stored inside a project's `.gjc`.
978
+ * Runtime token/audit JSONL files are excluded by requiring a known transcript
979
+ * container (`agent-session` or `sessions`).
980
+ */
981
+ export declare function listProjectSessionTranscriptFiles(cwd: string): string[];
975
982
  /** Get recent sessions for display in welcome screen */
976
983
  export declare function getRecentSessions(sessionDir: string, limit?: number, storage?: SessionStorage): Promise<RecentSessionInfo[]>;
977
984
  export declare function getRecentSessionDisplay(sessions: readonly SessionInfo[], limit?: number): Array<{
@@ -1149,12 +1156,66 @@ export declare class SessionManager {
1149
1156
  newSessionFile: string;
1150
1157
  } | undefined>;
1151
1158
  copyArtifactsForFork(oldSessionFile: string, newSessionFile: string): Promise<ForkArtifactPublication | undefined>;
1159
+ /**
1160
+ * Serialize every cwd transition (model, TUI, SDK/ACP). Re-entry is allowed
1161
+ * only for the async context that already owns the lock — unrelated callers
1162
+ * queue on the tail instead of skipping it.
1163
+ */
1164
+ runExclusiveCwdTransition<T>(fn: () => Promise<T>): Promise<T>;
1165
+ /**
1166
+ * Run `fn` under a shared read lease on `cwd`.
1167
+ *
1168
+ * Tools that resolve relative paths against the session cwd must hold this
1169
+ * lease across their WHOLE execution, not merely re-check a generation before
1170
+ * they start: the check-then-yield shape lets a move commit inside the tool's
1171
+ * first `await`, so a command admitted for root A would execute in root B.
1172
+ * Writers wait for outstanding leases to drain, so the cwd observed at lease
1173
+ * acquisition stays authoritative until the lease is released.
1174
+ */
1175
+ runWithCwdReadLease<T>(fn: () => Promise<T>): Promise<T>;
1176
+ /** Wait for any in-flight exclusive cwd transition to settle. */
1177
+ joinCwdTransition(): Promise<void>;
1178
+ getCwdGeneration(): number;
1179
+ static openNoFollowDirectory(dir: string): Promise<fs.promises.FileHandle>;
1180
+ /**
1181
+ * Claim process-cwd authority for `manager` when it is unowned or the prior
1182
+ * owner has been collected. Returns whether `manager` holds the claim.
1183
+ */
1184
+ static claimProcessCwdOwnership(manager: SessionManager): boolean;
1185
+ static isProcessCwdOwner(manager: SessionManager): boolean;
1186
+ static releaseProcessCwdOwnership(manager: SessionManager): void;
1187
+ /**
1188
+ * Verify that `process.cwd()` is the directory pinned by `expectedIdentity`.
1189
+ *
1190
+ * `process.chdir` resolves a NAME, so a path replaced after the last
1191
+ * name-based comparison lands the process outside the validated directory —
1192
+ * the exact confinement `move_session` exists to enforce. Node exposes no
1193
+ * `fchdir`, so the handle cannot be the chdir authority directly; comparing
1194
+ * the resulting cwd's identity to the pinned handle closes the same gap.
1195
+ */
1196
+ static assertProcessCwdIdentity(expectedIdentity: {
1197
+ dev: bigint;
1198
+ ino: bigint;
1199
+ }): Promise<void>;
1152
1200
  /**
1153
1201
  * Move the session to a new working directory.
1154
1202
  * Moves session files and artifacts on disk, updates all internal references,
1155
1203
  * and rewrites the session header with the new cwd.
1204
+ *
1205
+ * All callers (model `move_session`, TUI `/move`, SDK/ACP `session.cwd.move`)
1206
+ * share this exclusive transition so concurrent moves cannot interleave.
1156
1207
  */
1157
- moveTo(newCwd: string): Promise<void>;
1208
+ moveTo(newCwd: string, options?: {
1209
+ expectedIdentity?: {
1210
+ dev: bigint;
1211
+ ino: bigint;
1212
+ };
1213
+ targetHandle?: {
1214
+ stat: (opts: {
1215
+ bigint: true;
1216
+ }) => Promise<fs.BigIntStats>;
1217
+ };
1218
+ }): Promise<void>;
1158
1219
  isPersisted(): boolean;
1159
1220
  stageDefaultModelSelection(model: string, thinkingLevel: string | undefined, options?: {
1160
1221
  readonly appendThinkingLevel: boolean;
@@ -1215,7 +1276,7 @@ export declare class SessionManager {
1215
1276
  * Adopt an externally-owned ArtifactManager. Used by subagents to share
1216
1277
  * the parent session's artifact directory and ID counter.
1217
1278
  */
1218
- adoptArtifactManager(manager: ArtifactManager): void;
1279
+ adoptArtifactManager(manager: ArtifactManager, parent?: ArtifactManager): void;
1219
1280
  /** Release only the matching externally adopted manager. */
1220
1281
  releaseArtifactManager(manager: ArtifactManager): void;
1221
1282
  /** Temporarily release adopted authority while an outer transition validates its successor. */
@@ -1354,6 +1415,8 @@ export declare class SessionManager {
1354
1415
  * Use sparingly (e.g., pruning old tool outputs).
1355
1416
  */
1356
1417
  rewriteEntries(): Promise<void>;
1418
+ /** Remap artifact references in an unpublished candidate before its publication fence. */
1419
+ remapStagedArtifactReferences(idMap: ReadonlyMap<string, string>): Promise<void>;
1357
1420
  /**
1358
1421
  * Append a custom message entry (for extensions) that participates in LLM context.
1359
1422
  * @param customType Hook identifier for filtering on reload
@@ -1520,6 +1583,25 @@ export declare class SessionManager {
1520
1583
  * @param path Path to session file
1521
1584
  * @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
1522
1585
  */
1586
+ /** Open an unpublished candidate transcript below the reserved staging directory. */
1587
+ static openStaged(finalSessionFile: string, storage?: SessionStorage, attemptId?: string): Promise<SessionManager>;
1588
+ /** Managed-authority variant of {@link openStaged}. */
1589
+ static stagedNestedManaged(finalSessionFile: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, attemptId?: string): Promise<SessionManager>;
1590
+ /** Publish the candidate-owned staged transcript and artifacts at the real accept fence. */
1591
+ static openStagedNestedManaged(finalSessionFile: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, attemptId?: string): Promise<SessionManager>;
1592
+ commitStaged(options?: {
1593
+ deferArtifactFinalize?: boolean;
1594
+ }): Promise<void>;
1595
+ /** Finalize a staged publication whose post-fence publisher completed successfully. */
1596
+ finalizeStagedCommit(): void;
1597
+ /** Roll back a staged publication when post-fence visibility setup fails. */
1598
+ rollbackCommittedStaged(): Promise<void>;
1599
+ /** Refresh the owned final snapshot after post-fence session metadata is appended. */
1600
+ refreshStagedCommitSnapshot(): Promise<void>;
1601
+ /** Idempotently remove an unpublished staged transcript and its owned artifacts. */
1602
+ discardStaged(): Promise<void>;
1603
+ commitStagedNestedManaged(): Promise<void>;
1604
+ discardStagedNestedManaged(): Promise<void>;
1523
1605
  static open(filePath: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
1524
1606
  static openNestedManaged(filePath: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, cwdOverride?: string, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
1525
1607
  /**
@@ -0,0 +1,3 @@
1
+ export declare const SESSION_STAGING_DIRNAME: ".staging";
2
+ /** True when a path is an immediate child of the reserved session staging directory. */
3
+ export declare function isStagedSessionPath(filePath: string): boolean;
@@ -1,3 +1,3 @@
1
1
  /** Native-free canonical GJC workflow skill identifiers. */
2
- export declare const CANONICAL_GJC_WORKFLOW_SKILLS: readonly ["deep-interview", "ralplan", "ultragoal", "team"];
2
+ export declare const CANONICAL_GJC_WORKFLOW_SKILLS: readonly ["deep-interview", "ralplan", "ultragoal", "autoresearch"];
3
3
  export type CanonicalGjcWorkflowSkill = (typeof CANONICAL_GJC_WORKFLOW_SKILLS)[number];
@@ -53,26 +53,6 @@ interface UltragoalHudState extends WorkflowGateHudState {
53
53
  };
54
54
  updatedAt?: string;
55
55
  }
56
- interface TeamHudWorker {
57
- id: string;
58
- status?: string;
59
- }
60
- interface TeamHudState extends WorkflowGateHudState {
61
- phase: string;
62
- task_total: number;
63
- task_counts: Record<string, number>;
64
- workers: TeamHudWorker[];
65
- updated_at?: string;
66
- latestEvent?: {
67
- type?: string;
68
- worker?: string;
69
- message?: string;
70
- };
71
- latestMessage?: {
72
- from_worker?: string;
73
- body?: string;
74
- };
75
- }
76
56
  export declare function buildDeepInterviewHudSummary(state: DeepInterviewHudState): WorkflowHudSummary;
77
57
  export interface DeepInterviewHudDeriveOptions {
78
58
  phase?: string;
@@ -87,6 +67,17 @@ export interface DeepInterviewHudDeriveOptions {
87
67
  */
88
68
  export declare function deriveDeepInterviewHud(payload: Record<string, unknown>, options?: DeepInterviewHudDeriveOptions): WorkflowHudSummary;
89
69
  export declare function buildRalplanHudSummary(state: RalplanHudState): WorkflowHudSummary;
70
+ export interface AutoresearchHudState extends WorkflowGateHudState {
71
+ phase: string;
72
+ mode?: string;
73
+ intake?: string;
74
+ slug?: string;
75
+ specPath?: string;
76
+ verdict?: string;
77
+ experimentCount?: number;
78
+ experimentStatuses?: string[];
79
+ updatedAt?: string;
80
+ }
81
+ export declare function buildAutoresearchHudSummary(state: AutoresearchHudState): WorkflowHudSummary;
90
82
  export declare function buildUltragoalHudSummary(state: UltragoalHudState): WorkflowHudSummary;
91
- export declare function buildTeamHudSummary(state: TeamHudState): WorkflowHudSummary;
92
83
  export {};
@@ -4,6 +4,7 @@ export declare const DEEP_INTERVIEW_MUTATION_BLOCK_MESSAGE = "Deep-interview pha
4
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.";
5
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.";
6
6
  export declare const ULTRAGOAL_GOAL_PLANNING_MUTATION_BLOCK_MESSAGE = "Ultragoal goal-planning phase boundary: finish goal planning and record goals through `gjc ultragoal` before editing code. Product-code mutation tools and patch execution are blocked until goal planning completes and execution begins.";
7
+ export declare const AUTORESEARCH_MUTATION_BLOCK_MESSAGE = "Autoresearch research-only boundary: this workflow produces findings, evidence, and a verdict \u2014 never product code. Product-code mutation tools and patch execution are blocked everywhere, on every branch. Mission research artifacts (`autoresearch.sh` at the workdir root and mission state through the sanctioned `gjc autoresearch` CLI) stay writable; run experiments through the `python` tool, or finish the mission and hand off to an approved implementation workflow.";
7
8
  type ToolWithEditMode = AgentTool & {
8
9
  mode?: unknown;
9
10
  customWireName?: unknown;
@@ -0,0 +1,8 @@
1
+ import { type AutoroutingEffective, type AutoroutingProvenance } from "../../config/autorouting-contract";
2
+ export type AutoroutingStatusSnapshot = {
3
+ effective: AutoroutingEffective;
4
+ tiers: unknown;
5
+ provenance: AutoroutingProvenance | undefined;
6
+ };
7
+ /** Render settings-derived autorouting state without consulting registry/auth. */
8
+ export declare function buildAutoroutingStatusReport(snapshot: AutoroutingStatusSnapshot): string;