@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
@@ -0,0 +1,35 @@
1
+ import type { Model } from "@gajae-code/ai/core";
2
+ import { type AutoroutingEffective, type AutoroutingTier } from "./autorouting-contract";
3
+ export type TierSelectorNormalization = {
4
+ pinned: string;
5
+ } | {
6
+ rejected: "selector_not_provider_qualified";
7
+ } | {
8
+ unmatched: true;
9
+ };
10
+ export type RoutingOutcome = {
11
+ kind: "disabled";
12
+ } | {
13
+ kind: "routed";
14
+ tier: AutoroutingTier;
15
+ requestedTier?: AutoroutingTier;
16
+ defaultTierApplied?: true;
17
+ pinnedSelector: string;
18
+ } | {
19
+ kind: "manual-fallback";
20
+ tier: AutoroutingTier;
21
+ requestedTier?: AutoroutingTier;
22
+ defaultTierApplied?: true;
23
+ attemptedSelectorCount: number;
24
+ reason: "tier_unmatched" | "tier_missing_in_map";
25
+ };
26
+ /**
27
+ * Pin one configured selector against exactly the supplied ordered snapshot.
28
+ * No settings, role aliases, usage ordering, or fuzzy matching participate.
29
+ */
30
+ export declare function normalizeTierSelector(selector: string, snapshot: readonly Model[]): TierSelectorNormalization;
31
+ export declare function resolveTaskRouting(input: {
32
+ effectiveAutorouting: AutoroutingEffective;
33
+ requestedTier?: AutoroutingTier;
34
+ availableModels?: readonly Model[];
35
+ }): RoutingOutcome;
@@ -36,6 +36,13 @@ export interface ProviderDiscoveryCallbacks<TProvider extends DiscoveryProvider>
36
36
  fetchModels: (provider: TProvider, apiKey: string | undefined) => Promise<Model<Api>[]>;
37
37
  getEvidenceGeneration?: (provider: TProvider) => string;
38
38
  canPublishCache?: (provider: TProvider) => boolean;
39
+ /**
40
+ * Stable fingerprint of the discovery fetch context (credential evidence +
41
+ * endpoint). When supplied, the published cache row records it alongside the
42
+ * discovered model ids so a later `online-if-uncached` refresh can trust a
43
+ * fresh cache instead of treating the ids as provenance-less and re-fetching.
44
+ */
45
+ cacheDynamicModelProvenance?: string;
39
46
  }
40
47
  /** Owns configured discovery inputs, status, cache lifecycle, and refresh generations. */
41
48
  export declare class ModelDiscoveryManager<TProvider extends DiscoveryProvider> {
@@ -47,7 +54,7 @@ export declare class ModelDiscoveryManager<TProvider extends DiscoveryProvider>
47
54
  providerIds(): Set<string>;
48
55
  getState(provider: string): ProviderDiscoveryState | undefined;
49
56
  invalidate(provider: string): void;
50
- loadCached(provider: TProvider, cacheDbPath?: string): readonly Model<Api>[];
57
+ loadCached(provider: TProvider, cacheDbPath?: string, expectedProvenance?: string): readonly Model<Api>[];
51
58
  beginRefresh(provider: string): DiscoveryRefreshToken;
52
59
  isCurrent(token: DiscoveryRefreshToken): boolean;
53
60
  discover(provider: TProvider, strategy: ModelRefreshStrategy, callbacks: ProviderDiscoveryCallbacks<TProvider>): Promise<DiscoveryMergeInput>;
@@ -335,6 +335,11 @@ export interface CanonicalModelQueryOptions {
335
335
  /** Credential-selection session used to classify effective provider auth. Defaults to sessionId. */
336
336
  credentialSessionId?: string;
337
337
  }
338
+ /** One canonical record with its winning variant resolved, from a batch query. */
339
+ export interface CanonicalModelSelection {
340
+ record: CanonicalModelRecord;
341
+ model: Model<Api> | undefined;
342
+ }
338
343
  /**
339
344
  * Model registry - loads and manages models, resolves API keys via AuthStorage.
340
345
  */
@@ -344,8 +349,10 @@ export declare class ModelRegistry {
344
349
  /**
345
350
  * @param authStorage - Auth storage for API key resolution
346
351
  */
347
- constructor(authStorage: AuthStorage, modelsPath?: string);
352
+ constructor(authStorage: AuthStorage, modelsPath?: string, registrySettings?: Pick<Settings, "get" | "getGlobal">);
348
353
  onCatalogChanged(listener: () => void): () => void;
354
+ /** Replace the read-only settings snapshot used by profile-scoped resolution. */
355
+ setScopedSettings(settingsReader: Pick<Settings, "get" | "getGlobal">): void;
349
356
  /**
350
357
  * Reload models from disk (built-in + custom from models.json).
351
358
  */
@@ -378,7 +385,29 @@ export declare class ModelRegistry {
378
385
  getAll(): Model<Api>[];
379
386
  /** Provider ids declared in models.yml, including override-only providers. */
380
387
  getConfiguredProviderIds(): readonly string[];
388
+ /**
389
+ * Deterministic provider priority for autorouting tier generation: configured
390
+ * `modelProviderOrder` first, then first-wins catalog order.
391
+ *
392
+ * Deliberately takes no session and never touches `authStorage`. It bypasses
393
+ * `#buildProviderSelectionPolicy` entirely so no `effectiveAuth` map is even
394
+ * assembled — auth-independence is structural here, not a convention. Ranking
395
+ * that *is* auth-aware stays private to the policy.
396
+ *
397
+ * Providers absent from the catalog are dropped so a dead declaration cannot
398
+ * pollute the generated setup's `declarationFingerprint`. Returned ids use the
399
+ * catalog's original spelling because the generator matches provider prefixes
400
+ * with case-sensitive exact strings.
401
+ */
402
+ autoroutingProviderOrder(): readonly string[];
381
403
  getCanonicalModels(options?: CanonicalModelQueryOptions): CanonicalModelRecord[];
404
+ /**
405
+ * Batch form of {@link resolveCanonicalModel} over every canonical record:
406
+ * one candidate-key set, one provider policy, and one catalog order for the
407
+ * whole query instead of per record. `model` is `undefined` only when a
408
+ * record has surviving variants but none can win resolution.
409
+ */
410
+ getCanonicalModelSelections(options?: CanonicalModelQueryOptions): CanonicalModelSelection[];
382
411
  getCanonicalVariants(canonicalId: string, options?: CanonicalModelQueryOptions): CanonicalModelVariant[];
383
412
  /**
384
413
  * Resolve an exact canonical id to a concrete model.
@@ -48,6 +48,16 @@ export interface ProviderSelectionPolicy {
48
48
  * current values in so ranking stays deterministic and testable.
49
49
  */
50
50
  export declare function createProviderSelectionPolicy(input: ProviderSelectionPolicyInput): ProviderSelectionPolicy;
51
+ /**
52
+ * Project the deterministic provider order: normalized explicit order first, then
53
+ * first-wins catalog order for everything else.
54
+ *
55
+ * This is the single implementation of that ordering. It reads no credentials and
56
+ * takes no auth input at all, so any consumer that only needs "which providers, in
57
+ * what priority" cannot accidentally acquire auth sensitivity. Auth-aware banding
58
+ * lives exclusively in {@link ProviderSelectionPolicy.rank}.
59
+ */
60
+ export declare function projectProviderOrder(explicitProviderOrder: readonly string[], catalogProviders: readonly string[]): string[];
51
61
  export interface ProviderSelectionCatalog {
52
62
  /** Lowercased provider ids in first-wins registry catalog order. */
53
63
  readonly catalogProviders: readonly string[];
@@ -60,3 +70,16 @@ export interface ProviderSelectionCatalog {
60
70
  * candidates never changes ranking.
61
71
  */
62
72
  export declare function buildProviderSelectionCatalog(models: readonly Model<Api>[]): ProviderSelectionCatalog;
73
+ /**
74
+ * Deterministic provider priority for a catalog, returned in the catalog's own
75
+ * spelling.
76
+ *
77
+ * Ordering and de-duplication run on normalized ids, but the result restores each
78
+ * provider's first-seen catalog spelling because the autorouting generator matches
79
+ * provider prefixes with case-sensitive exact strings — a lowercased id would
80
+ * silently empty that provider's tiers. Providers absent from the catalog are
81
+ * dropped so a dead declaration cannot pollute a generated declarationFingerprint.
82
+ *
83
+ * Reads no credentials: it takes a catalog and an explicit order, nothing else.
84
+ */
85
+ export declare function projectCatalogProviderOrder(explicitProviderOrder: readonly string[], models: readonly Model<Api>[]): string[];
@@ -1,5 +1,6 @@
1
1
  import type { Effort } from "@gajae-code/ai/model-thinking";
2
2
  import { type EditMode } from "../utils/edit-mode";
3
+ import { type AutoroutingLocalIssue, type AutoroutingProvenance, type AutoroutingSetup, type AutoroutingTierMapInput } from "./autorouting-contract";
3
4
  import type { ModelSelectorValue } from "./model-selector-value";
4
5
  import { type SkillDiscoverySettings } from "./skill-settings-defaults";
5
6
  /** Unified settings schema - single source of truth for all settings.
@@ -68,6 +69,21 @@ interface UiString extends UiBase {
68
69
  export type AnyUiMetadata = UiBase & {
69
70
  options?: ReadonlyArray<SubmenuOption> | "runtime";
70
71
  };
72
+ /** JSON Schema fragment carried by settings definitions that own nested validation. */
73
+ export type JsonSchemaObject = {
74
+ [key: string]: unknown;
75
+ type?: string;
76
+ properties?: Record<string, JsonSchemaObject>;
77
+ additionalProperties?: boolean | JsonSchemaObject;
78
+ items?: JsonSchemaObject;
79
+ required?: readonly string[];
80
+ pattern?: string;
81
+ minItems?: number;
82
+ minLength?: number;
83
+ uniqueItems?: boolean;
84
+ minimum?: number;
85
+ const?: unknown;
86
+ };
71
87
  interface BooleanDef {
72
88
  type: "boolean";
73
89
  default?: boolean;
@@ -106,13 +122,33 @@ type RecordValueDef = {
106
122
  } | {
107
123
  type: "credential-selector";
108
124
  };
125
+ interface ConstrainedRecordValueDef {
126
+ type: "autorouting-selector-value";
127
+ pattern: string;
128
+ description: string;
129
+ }
130
+ interface ConstrainedRecordDef<T> {
131
+ type: "constrained-record";
132
+ default: T;
133
+ keys: readonly string[];
134
+ valueSchema: ConstrainedRecordValueDef;
135
+ description?: string;
136
+ ui?: UiBase;
137
+ }
109
138
  interface RecordDef<T> {
110
139
  type: "record";
111
140
  default: Record<string, T>;
112
141
  valueSchema?: RecordValueDef;
113
142
  ui?: UiBase;
114
143
  }
115
- type SettingDef = BooleanDef | StringDef | NumberDef | EnumDef<readonly string[]> | ArrayDef<unknown> | RecordDef<unknown>;
144
+ export interface OptionalObjectDef<T> {
145
+ type: "optional-object";
146
+ default: undefined;
147
+ jsonSchema: JsonSchemaObject;
148
+ validate: (value: unknown) => AutoroutingLocalIssue[];
149
+ _value?: T;
150
+ }
151
+ export type SettingDef = BooleanDef | StringDef | NumberDef | EnumDef<readonly string[]> | ArrayDef<unknown> | RecordDef<unknown> | ConstrainedRecordDef<unknown> | OptionalObjectDef<unknown>;
116
152
  export interface ModelTagDef {
117
153
  name: string;
118
154
  color?: string;
@@ -548,7 +584,7 @@ export declare const SETTINGS_SCHEMA: {
548
584
  };
549
585
  readonly "gjc.ralplan.autoHandoff": {
550
586
  readonly type: "enum";
551
- readonly values: readonly ["off", "ultragoal", "team"];
587
+ readonly values: readonly ["off", "ultragoal", "autoresearch"];
552
588
  readonly default: "off";
553
589
  };
554
590
  readonly "gjc.ralplan.maxIterations": {
@@ -3972,6 +4008,25 @@ export declare const SETTINGS_SCHEMA: {
3972
4008
  readonly type: "model-selector-value";
3973
4009
  };
3974
4010
  };
4011
+ readonly "task.autorouting.enabled": {
4012
+ readonly type: "boolean";
4013
+ readonly default: false;
4014
+ };
4015
+ readonly "task.autorouting.tiers": {
4016
+ readonly type: "constrained-record";
4017
+ readonly default: AutoroutingTierMapInput;
4018
+ readonly keys: readonly ["fast", "balanced", "strong"];
4019
+ readonly valueSchema: {
4020
+ readonly type: "autorouting-selector-value";
4021
+ readonly minLength: 1;
4022
+ readonly maxLength: 256;
4023
+ readonly pattern: "^[^/\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+\\/[^\\s*?\\[\\x00-\\x1F\\x7F-\\x9F\\u2028\\u2029]+(?::(?:minimal|low|medium|high|xhigh))?$";
4024
+ readonly description: "provider/modelId with an optional valid thinking suffix (:minimal|low|medium|high|xhigh), no globs, no bare model ids, no pi/<role> role aliases.";
4025
+ };
4026
+ readonly description: "provider/modelId with an optional valid thinking suffix (:minimal|low|medium|high|xhigh), no globs, no bare model ids, no pi/<role> role aliases.";
4027
+ };
4028
+ readonly "task.autorouting.setup": OptionalObjectDef<AutoroutingSetup>;
4029
+ readonly "task.autorouting.provenance": OptionalObjectDef<AutoroutingProvenance>;
3975
4030
  readonly "tasks.todoClearDelay": {
3976
4031
  readonly type: "number";
3977
4032
  readonly default: 60;
@@ -4384,7 +4439,10 @@ export type SettingValue<P extends SettingPath> = Schema[P] extends {
4384
4439
  } ? D : Schema[P] extends {
4385
4440
  type: "record";
4386
4441
  default: infer D;
4387
- } ? D : never;
4442
+ } ? D : Schema[P] extends {
4443
+ type: "constrained-record";
4444
+ default: infer D;
4445
+ } ? D : Schema[P] extends OptionalObjectDef<infer D> ? D | undefined : never;
4388
4446
  /** Get the default value for a setting path */
4389
4447
  export declare function getDefault<P extends SettingPath>(path: P): SettingValue<P>;
4390
4448
  /** Check if a path has UI metadata (should appear in settings panel) */
@@ -15,6 +15,7 @@ import { type NotificationSettingsReader, type NotificationSettingsSnapshot } fr
15
15
  import { AgentStorage } from "../session/agent-storage";
16
16
  import { type EditMode, type EditVariantMatch } from "../utils/edit-mode";
17
17
  import { type CasReceipt } from "./atomic-yaml-patch";
18
+ import { type AutoroutingEffective } from "./autorouting-contract";
18
19
  import { type ModelSelectorValue } from "./model-selector-value";
19
20
  import { type BashInterceptorRule, type GroupPrefix, type GroupTypeMap, type SettingPath, type SettingsSchemaReport, type SettingValue } from "./settings-schema";
20
21
  export type * from "./settings-schema";
@@ -139,6 +140,8 @@ export declare class Settings implements NotificationSettingsReader {
139
140
  has(path: SettingPath): boolean;
140
141
  /** Diagnostics from schema reconciliation during the most recent load. */
141
142
  getSchemaReport(): SettingsSchemaReport;
143
+ /** Effective merged autorouting state shared by settings diagnostics and routing policy. */
144
+ getEffectiveAutorouting(): AutoroutingEffective;
142
145
  onChanged(listener: (path: SettingPath) => void): () => void;
143
146
  /** Whether durable settings mutations are permitted for the loaded configuration. */
144
147
  canWriteDurableConfig(): boolean;
@@ -1,4 +1,4 @@
1
1
  export declare const COORDINATOR_MCP_PROTOCOL_VERSION = "2024-11-05";
2
2
  export declare const COORDINATOR_MCP_SERVER_NAME = "gjc-coordinator-mcp";
3
- export declare const COORDINATOR_MCP_TOOL_NAMES: readonly ["gjc_coordinator_list_sessions", "gjc_coordinator_read_status", "gjc_coordinator_read_tail", "gjc_coordinator_list_questions", "gjc_coordinator_list_artifacts", "gjc_coordinator_read_artifact", "gjc_coordinator_read_coordination_status", "gjc_coordinator_watch_events", "gjc_coordinator_register_session", "gjc_coordinator_start_session", "gjc_coordinator_activate_session", "gjc_coordinator_stop_session", "gjc_coordinator_send_prompt", "gjc_coordinator_submit_question_answer", "gjc_coordinator_read_turn", "gjc_coordinator_await_turn", "gjc_coordinator_report_status", "gjc_coordinator_register_codex_handoff", "gjc_coordinator_read_codex_handoff", "gjc_coordinator_ack_codex_handoff", "gjc_delegate_plan", "gjc_delegate_execute", "gjc_delegate_team"];
3
+ export declare const COORDINATOR_MCP_TOOL_NAMES: readonly ["gjc_coordinator_list_sessions", "gjc_coordinator_read_status", "gjc_coordinator_read_tail", "gjc_coordinator_list_questions", "gjc_coordinator_list_artifacts", "gjc_coordinator_read_artifact", "gjc_coordinator_read_coordination_status", "gjc_coordinator_watch_events", "gjc_coordinator_register_session", "gjc_coordinator_start_session", "gjc_coordinator_activate_session", "gjc_coordinator_stop_session", "gjc_coordinator_send_prompt", "gjc_coordinator_submit_question_answer", "gjc_coordinator_read_turn", "gjc_coordinator_await_turn", "gjc_coordinator_report_status", "gjc_coordinator_register_codex_handoff", "gjc_coordinator_read_codex_handoff", "gjc_coordinator_ack_codex_handoff", "gjc_delegate_plan", "gjc_delegate_execute"];
4
4
  export type CoordinatorToolName = (typeof COORDINATOR_MCP_TOOL_NAMES)[number];
@@ -0,0 +1,29 @@
1
+ import * as fs from "node:fs/promises";
2
+ export interface CoordinatorDirectoryBarrierOptions {
3
+ platform?: NodeJS.Platform;
4
+ openDirectory?: (directory: string) => Promise<fs.FileHandle>;
5
+ }
6
+ export interface CoordinatorFileDurabilityOptions {
7
+ syncFile?: (handle: fs.FileHandle) => Promise<void>;
8
+ }
9
+ export interface CoordinatorAtomicWriteOptions extends CoordinatorDirectoryBarrierOptions, CoordinatorFileDurabilityOptions {
10
+ rename?: (source: string, destination: string) => Promise<void>;
11
+ }
12
+ /** The file was published, but its final directory barrier did not complete. */
13
+ export declare class CoordinatorPublicationUncertainError extends Error {
14
+ constructor(cause: unknown);
15
+ }
16
+ export declare function ensureCoordinatorDirectory(directory: string, options?: CoordinatorDirectoryBarrierOptions): Promise<void>;
17
+ /**
18
+ * Windows does not support fsync on directory handles. File contents must be
19
+ * synced before publication; this barrier only makes the renamed directory
20
+ * entry durable where the platform supports that operation.
21
+ */
22
+ export declare function isUnsupportedWindowsDirectorySyncError(error: unknown, platform?: NodeJS.Platform): boolean;
23
+ export declare function syncCoordinatorDirectory(directory: string, options?: CoordinatorDirectoryBarrierOptions): Promise<void>;
24
+ /** File durability is never best-effort: callers must abort on every failure. */
25
+ export declare function syncCoordinatorFile(handle: fs.FileHandle, options?: CoordinatorFileDurabilityOptions): Promise<void>;
26
+ /** Append a durable coordinator journal or diagnostic record, then barrier its parent. */
27
+ export declare function appendCoordinatorFile(file: string, contents: string, options?: CoordinatorDirectoryBarrierOptions & CoordinatorFileDurabilityOptions): Promise<void>;
28
+ /** Atomically publish a synced coordinator state file, then barrier its parent. */
29
+ export declare function writeCoordinatorAtomic(file: string, contents: string, options?: CoordinatorAtomicWriteOptions): Promise<void>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Opt-in webhook delivery of existing coordinator `watch_events` journal rows
3
+ * (issue #4706). Delivery is a durable outbox keyed by the journal row's stable
4
+ * `id`: each delivered row is recorded once, retried with bounded exponential
5
+ * backoff, and never blocks or rewrites the journal append path.
6
+ */
7
+ export interface EventWebhookConfig {
8
+ url: string;
9
+ tokenFile: string | null;
10
+ sessionIds: Set<string> | null;
11
+ timeoutMs: number;
12
+ maxAttempts: number;
13
+ }
14
+ /** Result of one webhook POST attempt; 2xx is ok, anything else carries the reason. */
15
+ interface WebhookPostOutcome {
16
+ ok: boolean;
17
+ status: number | null;
18
+ error: string | null;
19
+ }
20
+ export interface WebhookDelivery {
21
+ /** Called with the exact JSON body to POST and per-attempt request options. */
22
+ post(body: string, options: {
23
+ url: string;
24
+ token: string | null;
25
+ timeoutMs: number;
26
+ signal: AbortSignal;
27
+ }): Promise<WebhookPostOutcome>;
28
+ /** Test seam: delay between retries; default is `Bun.sleep`. */
29
+ sleep(ms: number): Promise<void>;
30
+ /** Monotonic-ish clock for deadline math; default is `Date.now`. */
31
+ now(): number;
32
+ }
33
+ /** Default `WebhookDelivery` over `fetch`: POST, 2xx = ok, no redirects, abort on timeout. */
34
+ export declare function createDefaultEventWebhookDelivery(): WebhookDelivery;
35
+ export declare const DEFAULT_EVENT_WEBHOOK_TIMEOUT_MS = 5000;
36
+ export declare const MAX_EVENT_WEBHOOK_TIMEOUT_MS = 30000;
37
+ export declare const DEFAULT_EVENT_WEBHOOK_MAX_ATTEMPTS = 5;
38
+ export declare const MAX_EVENT_WEBHOOK_MAX_ATTEMPTS = 10;
39
+ export declare function parseEventWebhookConfig(explicitEnv?: NodeJS.ProcessEnv): EventWebhookConfig | null;
40
+ /**
41
+ * Records the row in the durable outbox and, unless the row is already
42
+ * delivered or exhausted, performs one bounded delivery attempt series. The
43
+ * returned promise settles only after bounded attempts/backoff, so a dead sink
44
+ * can never wedge the caller's persistence; callers run it off the append path.
45
+ */
46
+ export declare function deliverEventWebhook(namespaceDir: string, config: EventWebhookConfig, event: {
47
+ id: string;
48
+ session_id?: string;
49
+ }, renderBody: () => string, delivery: WebhookDelivery): Promise<void>;
50
+ export {};
@@ -266,7 +266,7 @@ export type CanonicalCreateIntentV1 = {
266
266
  initial_events: Record<string, string | number | boolean | null>[];
267
267
  } | {
268
268
  kind: "delegate";
269
- workflow: "plan" | "execute" | "team";
269
+ workflow: "plan" | "execute";
270
270
  session: CanonicalSessionSnapshotV1;
271
271
  remote_create_key: string;
272
272
  initial_state: CoordinatorSessionState;
@@ -4,6 +4,7 @@ import { type EnsureBrokerSettings } from "../sdk/broker/ensure";
4
4
  import { SdkClient } from "../sdk/client/client";
5
5
  import { SessionRouter, type SessionRouterDeps } from "../sdk/router";
6
6
  import { type CodexTransportFactory } from "./codex-wake-publisher";
7
+ import { type WebhookDelivery } from "./event-webhook";
7
8
  import { type CoordinatorModelProfileLoader } from "./model-preset";
8
9
  import { type CoordinatorMcpConfig } from "./policy";
9
10
  import { type SessionReaper } from "./session-reaper";
@@ -33,9 +34,20 @@ interface CoordinatorServices {
33
34
  readSdkBrokerDiscovery?: (agentDir: string) => Promise<BrokerDiscovery | null>;
34
35
  getAgentDir?: () => string;
35
36
  resolveModelProfiles?: CoordinatorModelProfileLoader;
37
+ resolveModelPin?: (raw: unknown, cwd?: string) => Promise<CoordinatorModelResolution>;
36
38
  canonicalizePath?: (value: string) => Promise<string>;
37
39
  codexTransportFactory?: CodexTransportFactory;
40
+ eventWebhookDelivery?: WebhookDelivery;
38
41
  }
42
+ type CoordinatorModelResolution = {
43
+ ok: true;
44
+ model: string | null;
45
+ } | {
46
+ ok: false;
47
+ reason: "unknown_model";
48
+ model: string;
49
+ error: string;
50
+ };
39
51
  interface CoordinatorMcpServerOptions {
40
52
  env?: NodeJS.ProcessEnv;
41
53
  services?: CoordinatorServices;
@@ -69,6 +81,8 @@ interface CoordinatorEventInput {
69
81
  payloadRef?: string | null;
70
82
  metadata?: Record<string, string | number | boolean | null>;
71
83
  }
84
+ /** Test-only helper that waits for queued event webhook deliveries in a namespace. */
85
+ export declare function awaitEventWebhookDeliveriesForTest(namespaceDir: string): Promise<void>;
72
86
  /** Test-only helper that waits for queued Codex wake publishes in a namespace. */
73
87
  export declare function awaitCodexWakePublishesForTest(namespaceDir: string): Promise<void>;
74
88
  /** Test-only event injection for coordinator wake-pipeline coverage. */
@@ -30,6 +30,9 @@ export interface CrashSignatureEntry {
30
30
  relayedAt?: number;
31
31
  /** Occurrence record represented by the durable upstream watermark. */
32
32
  relayedRecordId?: string;
33
+ /** Refusal marker for the exact record and sanitizer contract. */
34
+ relayRefusedRecordId?: string;
35
+ relayRefusedVersion?: string;
33
36
  /** Issues this install already "+1"ed, so re-invocations cannot spam comments. */
34
37
  commentedIssues?: string[];
35
38
  }
@@ -15,3 +15,5 @@ export declare function parseCrashRecords(contents: string): LoadedCrashRecord[]
15
15
  export declare function parseRecoverableCrashRecords(contents: string): LoadedCrashRecord[];
16
16
  /** Newest identity-bearing record for a fingerprint, or `undefined` when unmatchable. */
17
17
  export declare function findLatestRecord(contents: string, fingerprint: string): LoadedCrashRecord | undefined;
18
+ /** Identity-bearing record bound to the indexed append-order identity. */
19
+ export declare function findRecordById(contents: string, fingerprint: string, recordId: string): LoadedCrashRecord | undefined;
@@ -20,6 +20,8 @@
20
20
  */
21
21
  import { type CrashSignatureView, type CrashStatePaths } from "../index-store";
22
22
  import { type SentryDsn } from "./dsn";
23
+ /** Version of the complete sanitizer/egress contract persisted in refusals. */
24
+ export declare const SANITIZER_EGRESS_CONTRACT_VERSION = "sanitize-external-crash-v1";
23
25
  /** Trusted environment variable form of the DSN, for CI and one-off runs. */
24
26
  export declare const CRASH_UPSTREAM_DSN_ENV = "GJC_CRASH_SENTRY_DSN";
25
27
  export interface CrashRelayConfig {
@@ -113,9 +115,9 @@ export declare function resolveRelayDsn(config: CrashRelayConfig, env?: Record<s
113
115
  */
114
116
  export declare function isRelayDue(signature: CrashSignatureView): boolean;
115
117
  /**
116
- * Automatic relay stores use the normal XDG state location only when the XDG
117
- * value came from a trusted environment. `dirs.ts` rejects checkout `.env`
118
- * declarations before resolving these paths, including dotenv-expanded values.
118
+ * Automatic relay always reads the trusted agent stores. XDG-aware paths remain
119
+ * available to ordinary crash state operations, but never select automatic-egress
120
+ * input files.
119
121
  */
120
122
  export declare function resolveTrustedRelayStatePaths(): CrashStatePaths;
121
123
  export declare function resolveTrustedHandledRelayStatePaths(): CrashStatePaths;
@@ -14,6 +14,11 @@ type CursorExecEventEmitter = (event: AgentEvent, dispatchedTool?: AgentTool) =>
14
14
  interface CursorExecBridgeOptions {
15
15
  cwd: string;
16
16
  tools: Map<string, AgentTool>;
17
+ getEditReplaceTool?: () => AgentTool | undefined;
18
+ createSearchTool?: (options: {
19
+ context?: number;
20
+ totalMatchLimit?: number;
21
+ }) => AgentTool | undefined;
17
22
  getToolContext?: () => AgentToolContext | undefined;
18
23
  emitEvent?: CursorExecEventEmitter;
19
24
  createEventEmitter?: () => ((event: AgentEvent) => void) | undefined;
@@ -29,6 +34,13 @@ export declare class CursorExecHandlers implements ICursorExecHandlers {
29
34
  delete(args: Parameters<NonNullable<ICursorExecHandlers["delete"]>>[0]): Promise<ToolResultMessage<any>>;
30
35
  shell(args: Parameters<NonNullable<ICursorExecHandlers["shell"]>>[0]): Promise<ToolResultMessage<any>>;
31
36
  shellStream(args: Parameters<NonNullable<ICursorExecHandlers["shellStream"]>>[0], callbacks: CursorShellStreamCallbacks): Promise<ToolResultMessage<any>>;
37
+ piRead(call: Parameters<NonNullable<ICursorExecHandlers["piRead"]>>[0]): Promise<ToolResultMessage<any>>;
38
+ piBash(call: Parameters<NonNullable<ICursorExecHandlers["piBash"]>>[0]): Promise<ToolResultMessage<any>>;
39
+ piEdit(call: Parameters<NonNullable<ICursorExecHandlers["piEdit"]>>[0]): Promise<ToolResultMessage<any>>;
40
+ piWrite(call: Parameters<NonNullable<ICursorExecHandlers["piWrite"]>>[0]): Promise<ToolResultMessage<any>>;
41
+ piGrep(call: Parameters<NonNullable<ICursorExecHandlers["piGrep"]>>[0]): Promise<ToolResultMessage<any>>;
42
+ piFind(call: Parameters<NonNullable<ICursorExecHandlers["piFind"]>>[0]): Promise<ToolResultMessage<any>>;
43
+ piLs(call: Parameters<NonNullable<ICursorExecHandlers["piLs"]>>[0]): Promise<ToolResultMessage<any>>;
32
44
  diagnostics(args: Parameters<NonNullable<ICursorExecHandlers["diagnostics"]>>[0]): Promise<ToolResultMessage<any>>;
33
45
  mcp(call: CursorMcpCall): Promise<ToolResultMessage<any>>;
34
46
  }
@@ -1,5 +1,5 @@
1
1
  import { type BundledGjcSkillCatalogEntry } from "./gjc-skills.generated";
2
- export declare const DEFAULT_GJC_DEFINITION_NAMES: readonly ["deep-interview", "ralplan", "team", "ultragoal"];
2
+ export declare const DEFAULT_GJC_DEFINITION_NAMES: readonly ["autoresearch", "deep-interview", "ralplan", "ultragoal"];
3
3
  export type DefaultGjcDefinitionName = (typeof DEFAULT_GJC_DEFINITION_NAMES)[number];
4
4
  export type DefaultGjcDefinitionKind = "skill" | "skill-fragment";
5
5
  export type EmbeddedDefaultGjcSkill = {
@@ -52,6 +52,29 @@ export type DefaultGjcDefinitionInstallFile = {
52
52
  path: string;
53
53
  status: DefaultGjcInstallStatus;
54
54
  };
55
+ /**
56
+ * Bundled workflow definitions that GJC used to ship and no longer does.
57
+ *
58
+ * Installing defaults only ever wrote the CURRENT set, so a definition dropped
59
+ * from the bundle stayed on disk under the agent dir forever — where
60
+ * filesystem skill discovery still found it and `/skill:<name>` still resolved.
61
+ * `team` was the first removal, so it was the first to expose that gap.
62
+ *
63
+ * Retirement QUARANTINES rather than deletes: the directory is moved aside to
64
+ * `<targetRoot>/retired/<name>.<timestamp>/`. A user who customized the skill
65
+ * keeps their content, and nothing is destroyed to satisfy a rename.
66
+ */
67
+ export declare const RETIRED_GJC_DEFINITION_NAMES: readonly ["team"];
68
+ export type RetiredGjcDefinitionName = (typeof RETIRED_GJC_DEFINITION_NAMES)[number];
69
+ export type RetiredGjcDefinitionStatus = "absent" | "quarantined";
70
+ export interface RetiredGjcDefinitionFile {
71
+ name: RetiredGjcDefinitionName;
72
+ /** Directory that held the retired definition. */
73
+ path: string;
74
+ /** Where it was moved, when quarantined. */
75
+ quarantinedTo?: string;
76
+ status: RetiredGjcDefinitionStatus;
77
+ }
55
78
  export interface DefaultGjcDefinitionInstallResult {
56
79
  targetRoot: string;
57
80
  total: number;
@@ -61,6 +84,8 @@ export interface DefaultGjcDefinitionInstallResult {
61
84
  missing: number;
62
85
  different: number;
63
86
  files: DefaultGjcDefinitionInstallFile[];
87
+ /** Retired bundled definitions found under `targetRoot`, and what happened to them. */
88
+ retired: RetiredGjcDefinitionFile[];
64
89
  }
65
90
  export declare class BundledDefaultContentError extends Error {
66
91
  readonly sourcePath: string;
@@ -74,3 +99,12 @@ export declare function getDefaultGjcAgentDefinitions(): readonly DefaultGjcDefi
74
99
  export declare function getEmbeddedDefaultGjcSkillFragments(parentSkillName: DefaultGjcDefinitionName): DefaultGjcSkillFragmentDefinition[];
75
100
  export declare function getEmbeddedDefaultGjcSkills(): EmbeddedDefaultGjcSkill[];
76
101
  export declare function installDefaultGjcDefinitions(options?: InstallDefaultGjcDefinitionsOptions): Promise<DefaultGjcDefinitionInstallResult>;
102
+ /**
103
+ * Quarantine any retired bundled definition still present under `targetRoot`.
104
+ *
105
+ * `check` reports what WOULD move without touching the filesystem, so
106
+ * `--check` callers stay read-only.
107
+ */
108
+ export declare function retireRemovedGjcDefinitions(targetRoot: string, options?: {
109
+ check?: boolean;
110
+ }): Promise<RetiredGjcDefinitionFile[]>;
@@ -4,7 +4,7 @@
4
4
  * Keep this module metadata-only: skill bodies are loaded through literal
5
5
  * dynamic imports only when a caller asks for their content.
6
6
  */
7
- export type BundledGjcSkillName = "deep-interview" | "ralplan" | "team" | "ultragoal";
7
+ export type BundledGjcSkillName = "autoresearch" | "deep-interview" | "ralplan" | "ultragoal";
8
8
  export interface BundledGjcSkillCatalogEntry {
9
9
  readonly kind: "skill" | "skill-fragment";
10
10
  readonly name?: BundledGjcSkillName;
@@ -232,7 +232,7 @@ export declare function resolveActiveProjectRegistryPath(cwd: string): Promise<s
232
232
  * bootstrapped directory (no .gjc/ or .git/ yet) works: writeInstalledPluginsRegistry auto-creates
233
233
  * the directory tree on first write.
234
234
  *
235
- * Returns undefined when cwd is os.homedir() — that path is already the user registry and must
235
+ * Returns undefined when cwd is the trusted home — that path is already the user registry and must
236
236
  * never alias as the project registry.
237
237
  */
238
238
  export declare function resolveOrDefaultProjectRegistryPath(cwd: string): Promise<string | undefined>;
@@ -29,6 +29,7 @@ export declare function summarizeEditToolActivity(kind: "args" | "result", value
29
29
  export declare class EditTool implements AgentTool<TInput> {
30
30
  #private;
31
31
  private readonly session;
32
+ private readonly modeOverride?;
32
33
  readonly name = "edit";
33
34
  readonly label = "Edit";
34
35
  readonly loadMode = "essential";
@@ -36,7 +37,7 @@ export declare class EditTool implements AgentTool<TInput> {
36
37
  readonly concurrency = "exclusive";
37
38
  readonly strict = true;
38
39
  readonly safeSummary: typeof summarizeEditToolActivity;
39
- constructor(session: ToolSession);
40
+ constructor(session: ToolSession, modeOverride?: EditMode | undefined);
40
41
  get mode(): EditMode;
41
42
  get description(): string;
42
43
  get parameters(): TInput;
@@ -21,6 +21,8 @@ export interface PythonExecutorOptions {
21
21
  kernelOwnerId?: string;
22
22
  /** Kernel mode (session reuse vs per-call) */
23
23
  kernelMode?: PythonKernelMode;
24
+ /** Called when a retained session kernel is acquired or replaced. */
25
+ onKernelStart?: (kernelInstanceId: string) => void;
24
26
  /** Restart the kernel before executing */
25
27
  reset?: boolean;
26
28
  /** Session file path for accessing task outputs */
@@ -39,6 +39,38 @@ export declare class ExtensionRuntime implements IExtensionRuntime {
39
39
  getSessionName(): string | undefined;
40
40
  setSessionName(): Promise<void>;
41
41
  }
42
+ /**
43
+ * Per-extension activation transaction over the shared runtime state.
44
+ *
45
+ * Registration writes from a factory are staged here (stage); the factory
46
+ * completing without throwing is the validation step; commit copies the
47
+ * staged mutations into the shared runtime; rollback discards them, so a
48
+ * factory that fails midway leaves no registration behind (issue #4718).
49
+ */
50
+ export declare class ExtensionActivationScope {
51
+ #private;
52
+ /** True while staged writes may still be added or committed. */
53
+ get open(): boolean;
54
+ constructor(runtime: IExtensionRuntime);
55
+ get flagValues(): Map<string, boolean | string>;
56
+ get pendingProviderRegistrations(): Array<{
57
+ name: string;
58
+ config: import("./types").ProviderConfig;
59
+ sourceId: string;
60
+ }>;
61
+ /**
62
+ * Publish the staged mutations into the shared runtime as one transaction.
63
+ *
64
+ * Prior state is journaled before any live mutation so a throw partway
65
+ * through publication is undone before it escapes: flag entries that did
66
+ * not exist are removed, overwritten entries are restored, and the
67
+ * provider queue is truncated to its prior length. The scope only becomes
68
+ * terminal once publication has fully succeeded, so a failed commit
69
+ * leaves the shared runtime exactly as it was (issue #4718).
70
+ */
71
+ commit(): void;
72
+ rollback(): void;
73
+ }
42
74
  /**
43
75
  * Create an Extension from an inline factory function.
44
76
  */
@@ -1,7 +1,7 @@
1
1
  import type { CanonicalGjcWorkflowSkill } from "../../skill-state/active-state";
2
2
  export declare const GJC_PLUGIN_MANIFEST_FILENAME = "gajae-plugin.json";
3
3
  export declare const GJC_PLUGIN_KIND = "gajae-code-plugin";
4
- export declare const GJC_SUBSKILL_PARENT_SKILLS: readonly ["deep-interview", "ralplan", "ultragoal", "team"];
4
+ export declare const GJC_SUBSKILL_PARENT_SKILLS: readonly ["deep-interview", "ralplan", "ultragoal", "autoresearch"];
5
5
  export type GjcSubskillParentSkill = CanonicalGjcWorkflowSkill;
6
6
  export declare const GJC_SUBSKILL_PARENT_AGENTS: readonly ["executor", "architect", "planner", "critic"];
7
7
  export type GjcSubskillParentAgent = (typeof GJC_SUBSKILL_PARENT_AGENTS)[number];