@gajae-code/coding-agent 0.17.2 → 0.17.4

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 (349) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/dist/types/cli/daemon-cli.d.ts +3 -1
  3. package/dist/types/cli/github-release.d.ts +17 -0
  4. package/dist/types/cli/public-command-entry.d.ts +56 -0
  5. package/dist/types/cli/public-command-errors.d.ts +126 -0
  6. package/dist/types/cli/public-command-evidence.d.ts +99 -0
  7. package/dist/types/cli/public-command-help.d.ts +65 -0
  8. package/dist/types/cli/public-command-registry.d.ts +69 -0
  9. package/dist/types/cli/session-picker.d.ts +1 -1
  10. package/dist/types/cli/setup-cli.d.ts +1 -0
  11. package/dist/types/cli/skills-cli.d.ts +5 -0
  12. package/dist/types/cli.d.ts +3 -0
  13. package/dist/types/commands/daemon.d.ts +4 -50
  14. package/dist/types/commands/sdk.d.ts +20 -37
  15. package/dist/types/commands/setup.d.ts +3 -0
  16. package/dist/types/commands/skills.d.ts +9 -0
  17. package/dist/types/config/autorouting-tier-map.d.ts +18 -0
  18. package/dist/types/config/file-lock.d.ts +9 -1
  19. package/dist/types/config/model-profile-activation.d.ts +45 -1
  20. package/dist/types/config/model-registry.d.ts +11 -2
  21. package/dist/types/config/settings-schema.d.ts +11 -0
  22. package/dist/types/coordinator-mcp/question-state.d.ts +6 -1
  23. package/dist/types/daemon/operator-contract.d.ts +5 -1
  24. package/dist/types/eval/js/worker-protocol.d.ts +2 -0
  25. package/dist/types/extensibility/extensions/types.d.ts +12 -0
  26. package/dist/types/extensibility/gjc-plugins/registry.d.ts +4 -0
  27. package/dist/types/extensibility/runtime-skill-discovery.d.ts +18 -0
  28. package/dist/types/extensibility/shared-events.d.ts +3 -1
  29. package/dist/types/gjc-runtime/session-state-lock.d.ts +61 -0
  30. package/dist/types/internal-urls/embedded-protocol.d.ts +9 -0
  31. package/dist/types/internal-urls/index.d.ts +1 -0
  32. package/dist/types/internal-urls/parse.d.ts +9 -1
  33. package/dist/types/main.d.ts +22 -0
  34. package/dist/types/modes/acp/acp-agent.d.ts +55 -1
  35. package/dist/types/modes/acp/startup-provenance.d.ts +16 -0
  36. package/dist/types/modes/components/custom-provider-wizard.d.ts +19 -1
  37. package/dist/types/modes/components/session-selector.d.ts +5 -2
  38. package/dist/types/modes/components/user-message-selector.d.ts +5 -2
  39. package/dist/types/modes/controllers/command-controller.d.ts +1 -1
  40. package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
  41. package/dist/types/modes/interactive-mode.d.ts +1 -1
  42. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +11 -1
  43. package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +14 -1
  44. package/dist/types/modes/types.d.ts +2 -2
  45. package/dist/types/runtime/process-lifecycle.d.ts +2 -0
  46. package/dist/types/runtime-mcp/manager.d.ts +56 -0
  47. package/dist/types/runtime-mcp/pool.d.ts +17 -0
  48. package/dist/types/runtime-mcp/redaction.d.ts +20 -0
  49. package/dist/types/runtime-mcp/startup-policy.d.ts +6 -0
  50. package/dist/types/runtime-mcp/tool-bridge.d.ts +9 -0
  51. package/dist/types/runtime-mcp/transports/http.d.ts +11 -0
  52. package/dist/types/sdk/broker/broker.d.ts +13 -2
  53. package/dist/types/sdk/broker/identity.d.ts +3 -1
  54. package/dist/types/sdk/broker/lifecycle-ledger.d.ts +23 -3
  55. package/dist/types/sdk/broker/lifecycle.d.ts +15 -8
  56. package/dist/types/sdk/broker/runtime.d.ts +1 -1
  57. package/dist/types/sdk/broker/session-index.d.ts +22 -3
  58. package/dist/types/sdk/broker/spawn-authority.d.ts +4 -0
  59. package/dist/types/sdk/broker/stderr-drainer.d.ts +13 -0
  60. package/dist/types/sdk/bus/index.d.ts +19 -0
  61. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
  62. package/dist/types/sdk/bus/telegram-daemon.d.ts +5 -0
  63. package/dist/types/sdk/cli/master-cli.d.ts +6 -10
  64. package/dist/types/sdk/cli/rows.d.ts +19 -1
  65. package/dist/types/sdk/cli/session-cli.d.ts +22 -5
  66. package/dist/types/sdk/client/client.d.ts +2 -0
  67. package/dist/types/sdk/guides/cli.d.ts +3 -4
  68. package/dist/types/sdk/guides/verify.d.ts +2 -0
  69. package/dist/types/sdk/host/host.d.ts +9 -0
  70. package/dist/types/sdk/host/session-runtime.d.ts +31 -0
  71. package/dist/types/sdk/host/types.d.ts +10 -0
  72. package/dist/types/sdk/index.d.ts +1 -0
  73. package/dist/types/sdk/prompt-deadline-flush.d.ts +83 -0
  74. package/dist/types/sdk/prompt-deadline-manager.d.ts +37 -0
  75. package/dist/types/sdk/prompt-tool-boundary.d.ts +73 -0
  76. package/dist/types/sdk/router/session-router.d.ts +2 -0
  77. package/dist/types/sdk/startup-capability.d.ts +2 -0
  78. package/dist/types/sdk/transport/relay.d.ts +1 -0
  79. package/dist/types/sdk/transport/serve-cli.d.ts +48 -4
  80. package/dist/types/sdk/transport/stdio.d.ts +5 -1
  81. package/dist/types/session/agent-session.d.ts +168 -21
  82. package/dist/types/session/fallback-chain-controller.d.ts +6 -6
  83. package/dist/types/session/fold-coordinator.d.ts +17 -3
  84. package/dist/types/session/internal/managed-session-storage.d.ts +7 -1
  85. package/dist/types/session/session-manager.d.ts +64 -1
  86. package/dist/types/session/session-work-lease.d.ts +14 -0
  87. package/dist/types/setup/model-onboarding-guidance.d.ts +1 -1
  88. package/dist/types/setup/provider-onboarding.d.ts +81 -1
  89. package/dist/types/tools/bash.d.ts +37 -11
  90. package/dist/types/tools/job.d.ts +1 -1
  91. package/dist/types/tools/steer-fold.d.ts +31 -0
  92. package/dist/types/utils/git.d.ts +28 -2
  93. package/dist/types/utils/mupdf-embedded.d.ts +2 -0
  94. package/dist/types/utils/mupdf.d.ts +4 -0
  95. package/dist/types/utils/session-title-generation.d.ts +6 -0
  96. package/dist/types/utils/title-generator.d.ts +11 -2
  97. package/dist/types/web/scrapers/types.d.ts +3 -0
  98. package/package.json +18 -10
  99. package/scripts/build-binary.ts +9 -3
  100. package/scripts/compile-args.ts +0 -9
  101. package/scripts/embed-mupdf.ts +52 -0
  102. package/scripts/generate-sdk-operation-inventory.ts +31 -1
  103. package/scripts/vendor-markit.ts +196 -0
  104. package/src/async/job-manager.ts +22 -1
  105. package/src/cli/daemon-cli.ts +53 -18
  106. package/src/cli/github-release.ts +87 -5
  107. package/src/cli/mcp-cli.ts +38 -4
  108. package/src/cli/public-command-entry.ts +450 -0
  109. package/src/cli/public-command-errors.ts +581 -0
  110. package/src/cli/public-command-evidence.ts +717 -0
  111. package/src/cli/public-command-help.ts +360 -0
  112. package/src/cli/public-command-registry.ts +535 -0
  113. package/src/cli/session-picker.ts +2 -1
  114. package/src/cli/setup-cli.ts +9 -1
  115. package/src/cli/skills-cli.ts +46 -2
  116. package/src/cli.ts +61 -1
  117. package/src/commands/daemon.ts +65 -69
  118. package/src/commands/sdk.ts +175 -117
  119. package/src/commands/setup.ts +2 -0
  120. package/src/commands/skills.ts +11 -0
  121. package/src/config/autorouting-tier-map.ts +14 -0
  122. package/src/config/file-lock.ts +147 -51
  123. package/src/config/model-profile-activation.ts +334 -43
  124. package/src/config/model-registry.ts +183 -25
  125. package/src/config/settings-schema.ts +26 -2
  126. package/src/coordinator-mcp/policy.ts +10 -5
  127. package/src/coordinator-mcp/question-gate-codec.ts +17 -0
  128. package/src/coordinator-mcp/question-state.ts +175 -8
  129. package/src/coordinator-mcp/server.ts +507 -81
  130. package/src/coordinator-mcp/session-reaper.ts +6 -4
  131. package/src/crash/record-loader.ts +6 -2
  132. package/src/daemon/operator-contract.ts +26 -12
  133. package/src/defaults/gjc/skills/ultragoal/SKILL.md +1 -1
  134. package/src/eval/js/context-manager.ts +8 -8
  135. package/src/eval/js/worker-core.ts +9 -4
  136. package/src/eval/js/worker-protocol.ts +2 -0
  137. package/src/extensibility/extensions/runner.ts +52 -4
  138. package/src/extensibility/extensions/types.ts +10 -0
  139. package/src/extensibility/gjc-plugins/registry.ts +196 -37
  140. package/src/extensibility/runtime-skill-discovery.ts +61 -3
  141. package/src/extensibility/shared-events.ts +3 -1
  142. package/src/gjc-runtime/session-state-lock.ts +165 -24
  143. package/src/gjc-runtime/ultragoal-succession.ts +31 -3
  144. package/src/internal-urls/docs-index.generated.ts +20 -19
  145. package/src/internal-urls/embedded-protocol.ts +83 -0
  146. package/src/internal-urls/index.ts +1 -0
  147. package/src/internal-urls/parse.ts +21 -1
  148. package/src/internal-urls/router.ts +4 -2
  149. package/src/main.ts +123 -55
  150. package/src/modes/acp/acp-agent.ts +408 -35
  151. package/src/modes/acp/startup-provenance.ts +59 -0
  152. package/src/modes/components/custom-provider-wizard.ts +308 -7
  153. package/src/modes/components/oauth-selector.ts +9 -0
  154. package/src/modes/components/session-selector.ts +47 -4
  155. package/src/modes/components/user-message-selector.ts +57 -15
  156. package/src/modes/controllers/command-controller.ts +58 -32
  157. package/src/modes/controllers/extension-ui-controller.ts +33 -7
  158. package/src/modes/controllers/input-controller.ts +4 -0
  159. package/src/modes/controllers/selector-controller.ts +161 -15
  160. package/src/modes/interactive-mode.ts +21 -7
  161. package/src/modes/runtime-init.ts +1 -0
  162. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +124 -7
  163. package/src/modes/shared/agent-wire/workflow-gate-types.ts +16 -2
  164. package/src/modes/types.ts +2 -2
  165. package/src/prompts/agent-fragments/browser-aside.md +1 -0
  166. package/src/prompts/system/title-system.md +1 -1
  167. package/src/prompts/tools/bash.md +1 -1
  168. package/src/prompts/tools/job.md +1 -1
  169. package/src/prompts/tools/read.md +2 -0
  170. package/src/runtime/network-prewarm-service.test.ts +36 -1
  171. package/src/runtime/network-prewarm-service.ts +28 -3
  172. package/src/runtime/process-lifecycle.ts +22 -11
  173. package/src/runtime-mcp/config.ts +16 -1
  174. package/src/runtime-mcp/manager.ts +689 -55
  175. package/src/runtime-mcp/pool.test.ts +31 -0
  176. package/src/runtime-mcp/pool.ts +304 -28
  177. package/src/runtime-mcp/redaction.ts +42 -0
  178. package/src/runtime-mcp/startup-policy.ts +7 -0
  179. package/src/runtime-mcp/tool-bridge.ts +71 -0
  180. package/src/runtime-mcp/transports/http.ts +108 -25
  181. package/src/sdk/acp/adapter.ts +27 -8
  182. package/src/sdk/broker/broker.ts +378 -52
  183. package/src/sdk/broker/identity.ts +9 -1
  184. package/src/sdk/broker/lifecycle-ledger.ts +95 -31
  185. package/src/sdk/broker/lifecycle.ts +690 -141
  186. package/src/sdk/broker/runtime.ts +1 -1
  187. package/src/sdk/broker/session-index.ts +97 -4
  188. package/src/sdk/broker/spawn-authority.ts +35 -7
  189. package/src/sdk/broker/stderr-drainer.ts +59 -0
  190. package/src/sdk/bus/chat-daemon-control.ts +2 -2
  191. package/src/sdk/bus/chat-daemon-runtime.ts +1 -0
  192. package/src/sdk/bus/index.ts +690 -80
  193. package/src/sdk/bus/telegram-daemon-cli.ts +31 -2
  194. package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
  195. package/src/sdk/bus/telegram-daemon.ts +10 -3
  196. package/src/sdk/cli/master-cli.ts +47 -36
  197. package/src/sdk/cli/rows.ts +30 -7
  198. package/src/sdk/cli/session-cli.ts +687 -184
  199. package/src/sdk/client/client.ts +18 -0
  200. package/src/sdk/guides/catalog.ts +2 -2
  201. package/src/sdk/guides/cli.ts +20 -62
  202. package/src/sdk/guides/verify.ts +14 -0
  203. package/src/sdk/host/host.ts +49 -5
  204. package/src/sdk/host/session-runtime.test.ts +138 -2
  205. package/src/sdk/host/session-runtime.ts +311 -97
  206. package/src/sdk/host/types.ts +12 -1
  207. package/src/sdk/host/websocket-transport.lifecycle.test.ts +84 -0
  208. package/src/sdk/host/websocket-transport.ts +40 -6
  209. package/src/sdk/index.ts +11 -0
  210. package/src/sdk/prompt-deadline-flush.ts +334 -0
  211. package/src/sdk/prompt-deadline-manager.ts +133 -1
  212. package/src/sdk/prompt-tool-boundary.ts +121 -0
  213. package/src/sdk/protocol/operation-inventory.generated.json +106 -0
  214. package/src/sdk/router/session-router.ts +9 -1
  215. package/src/sdk/session.ts +182 -7
  216. package/src/sdk/startup-capability.ts +1 -1
  217. package/src/sdk/transport/relay.ts +71 -6
  218. package/src/sdk/transport/serve-cli.ts +397 -42
  219. package/src/sdk/transport/socket.ts +12 -11
  220. package/src/sdk/transport/stdio.ts +7 -3
  221. package/src/session/agent-session.ts +2437 -400
  222. package/src/session/fallback-chain-controller.ts +6 -7
  223. package/src/session/fold-coordinator.ts +24 -5
  224. package/src/session/internal/managed-session-scope.ts +58 -18
  225. package/src/session/internal/managed-session-storage.ts +304 -11
  226. package/src/session/session-manager.ts +382 -44
  227. package/src/session/session-work-lease.ts +34 -0
  228. package/src/setup/model-onboarding-guidance.ts +1 -1
  229. package/src/setup/provider-onboarding.ts +397 -24
  230. package/src/slash-commands/builtin-registry.ts +258 -14
  231. package/src/task/index.ts +14 -2
  232. package/src/tools/bash.ts +98 -78
  233. package/src/tools/fetch.ts +119 -20
  234. package/src/tools/job.ts +151 -25
  235. package/src/tools/output-meta.ts +15 -2
  236. package/src/tools/path-utils.ts +27 -3
  237. package/src/tools/read.ts +3 -3
  238. package/src/tools/steer-fold.ts +107 -0
  239. package/src/tools/tool-catalog.generated.ts +29 -2
  240. package/src/tools/tool-errors.ts +4 -0
  241. package/src/utils/git.ts +53 -3
  242. package/src/utils/markit.ts +55 -41
  243. package/src/utils/mupdf-assets.d.ts +4 -0
  244. package/src/utils/mupdf-embedded.ts +4 -0
  245. package/src/utils/mupdf.ts +129 -0
  246. package/src/utils/session-title-generation.ts +29 -0
  247. package/src/utils/title-generator.ts +46 -2
  248. package/src/web/scrapers/types.ts +24 -3
  249. package/vendor/markit-ai/LICENSE +21 -0
  250. package/vendor/markit-ai/MANIFEST.json +412 -0
  251. package/vendor/markit-ai/dist/commands/config.d.ts +4 -0
  252. package/vendor/markit-ai/dist/commands/config.js +139 -0
  253. package/vendor/markit-ai/dist/commands/convert.d.ts +6 -0
  254. package/vendor/markit-ai/dist/commands/convert.js +113 -0
  255. package/vendor/markit-ai/dist/commands/formats.d.ts +2 -0
  256. package/vendor/markit-ai/dist/commands/formats.js +92 -0
  257. package/vendor/markit-ai/dist/commands/init.d.ts +2 -0
  258. package/vendor/markit-ai/dist/commands/init.js +29 -0
  259. package/vendor/markit-ai/dist/commands/onboard.d.ts +2 -0
  260. package/vendor/markit-ai/dist/commands/onboard.js +61 -0
  261. package/vendor/markit-ai/dist/commands/plugin.d.ts +4 -0
  262. package/vendor/markit-ai/dist/commands/plugin.js +58 -0
  263. package/vendor/markit-ai/dist/config.d.ts +26 -0
  264. package/vendor/markit-ai/dist/config.js +42 -0
  265. package/vendor/markit-ai/dist/converters/audio.d.ts +7 -0
  266. package/vendor/markit-ai/dist/converters/audio.js +104 -0
  267. package/vendor/markit-ai/dist/converters/csv.d.ts +7 -0
  268. package/vendor/markit-ai/dist/converters/csv.js +83 -0
  269. package/vendor/markit-ai/dist/converters/docx.d.ts +6 -0
  270. package/vendor/markit-ai/dist/converters/docx.js +57 -0
  271. package/vendor/markit-ai/dist/converters/epub.d.ts +8 -0
  272. package/vendor/markit-ai/dist/converters/epub.js +128 -0
  273. package/vendor/markit-ai/dist/converters/github.d.ts +18 -0
  274. package/vendor/markit-ai/dist/converters/github.js +148 -0
  275. package/vendor/markit-ai/dist/converters/html.d.ts +6 -0
  276. package/vendor/markit-ai/dist/converters/html.js +30 -0
  277. package/vendor/markit-ai/dist/converters/image.d.ts +6 -0
  278. package/vendor/markit-ai/dist/converters/image.js +124 -0
  279. package/vendor/markit-ai/dist/converters/ipynb.d.ts +6 -0
  280. package/vendor/markit-ai/dist/converters/ipynb.js +75 -0
  281. package/vendor/markit-ai/dist/converters/iwork.d.ts +20 -0
  282. package/vendor/markit-ai/dist/converters/iwork.js +391 -0
  283. package/vendor/markit-ai/dist/converters/json.d.ts +6 -0
  284. package/vendor/markit-ai/dist/converters/json.js +21 -0
  285. package/vendor/markit-ai/dist/converters/pdf/columns.d.ts +35 -0
  286. package/vendor/markit-ai/dist/converters/pdf/columns.js +93 -0
  287. package/vendor/markit-ai/dist/converters/pdf/extract.d.ts +19 -0
  288. package/vendor/markit-ai/dist/converters/pdf/extract.js +514 -0
  289. package/vendor/markit-ai/dist/converters/pdf/grid.d.ts +25 -0
  290. package/vendor/markit-ai/dist/converters/pdf/grid.js +795 -0
  291. package/vendor/markit-ai/dist/converters/pdf/headers.d.ts +24 -0
  292. package/vendor/markit-ai/dist/converters/pdf/headers.js +108 -0
  293. package/vendor/markit-ai/dist/converters/pdf/index.d.ts +19 -0
  294. package/vendor/markit-ai/dist/converters/pdf/index.js +136 -0
  295. package/vendor/markit-ai/dist/converters/pdf/mupdf-loader.js +9 -0
  296. package/vendor/markit-ai/dist/converters/pdf/render.d.ts +24 -0
  297. package/vendor/markit-ai/dist/converters/pdf/render.js +513 -0
  298. package/vendor/markit-ai/dist/converters/pdf/types.d.ts +75 -0
  299. package/vendor/markit-ai/dist/converters/pdf/types.js +1 -0
  300. package/vendor/markit-ai/dist/converters/plain-text.d.ts +6 -0
  301. package/vendor/markit-ai/dist/converters/plain-text.js +87 -0
  302. package/vendor/markit-ai/dist/converters/pptx.d.ts +8 -0
  303. package/vendor/markit-ai/dist/converters/pptx.js +289 -0
  304. package/vendor/markit-ai/dist/converters/rss.d.ts +11 -0
  305. package/vendor/markit-ai/dist/converters/rss.js +138 -0
  306. package/vendor/markit-ai/dist/converters/wikipedia.d.ts +6 -0
  307. package/vendor/markit-ai/dist/converters/wikipedia.js +33 -0
  308. package/vendor/markit-ai/dist/converters/xlsx.d.ts +8 -0
  309. package/vendor/markit-ai/dist/converters/xlsx.js +147 -0
  310. package/vendor/markit-ai/dist/converters/xml.d.ts +6 -0
  311. package/vendor/markit-ai/dist/converters/xml.js +18 -0
  312. package/vendor/markit-ai/dist/converters/yaml.d.ts +6 -0
  313. package/vendor/markit-ai/dist/converters/yaml.js +17 -0
  314. package/vendor/markit-ai/dist/converters/zip.d.ts +8 -0
  315. package/vendor/markit-ai/dist/converters/zip.js +57 -0
  316. package/vendor/markit-ai/dist/index.d.ts +30 -0
  317. package/vendor/markit-ai/dist/index.js +26 -0
  318. package/vendor/markit-ai/dist/main.d.ts +2 -0
  319. package/vendor/markit-ai/dist/main.js +191 -0
  320. package/vendor/markit-ai/dist/markit.d.ts +45 -0
  321. package/vendor/markit-ai/dist/markit.js +267 -0
  322. package/vendor/markit-ai/dist/plugins/api.d.ts +7 -0
  323. package/vendor/markit-ai/dist/plugins/api.js +42 -0
  324. package/vendor/markit-ai/dist/plugins/index.d.ts +4 -0
  325. package/vendor/markit-ai/dist/plugins/index.js +3 -0
  326. package/vendor/markit-ai/dist/plugins/installer.d.ts +25 -0
  327. package/vendor/markit-ai/dist/plugins/installer.js +176 -0
  328. package/vendor/markit-ai/dist/plugins/loader.d.ts +6 -0
  329. package/vendor/markit-ai/dist/plugins/loader.js +61 -0
  330. package/vendor/markit-ai/dist/plugins/types.d.ts +25 -0
  331. package/vendor/markit-ai/dist/plugins/types.js +1 -0
  332. package/vendor/markit-ai/dist/providers/anthropic.d.ts +2 -0
  333. package/vendor/markit-ai/dist/providers/anthropic.js +47 -0
  334. package/vendor/markit-ai/dist/providers/index.d.ts +21 -0
  335. package/vendor/markit-ai/dist/providers/index.js +56 -0
  336. package/vendor/markit-ai/dist/providers/openai.d.ts +2 -0
  337. package/vendor/markit-ai/dist/providers/openai.js +76 -0
  338. package/vendor/markit-ai/dist/providers/types.d.ts +26 -0
  339. package/vendor/markit-ai/dist/providers/types.js +1 -0
  340. package/vendor/markit-ai/dist/types.d.ts +36 -0
  341. package/vendor/markit-ai/dist/types.js +1 -0
  342. package/vendor/markit-ai/dist/utils/exit-codes.d.ts +4 -0
  343. package/vendor/markit-ai/dist/utils/exit-codes.js +4 -0
  344. package/vendor/markit-ai/dist/utils/output.d.ts +22 -0
  345. package/vendor/markit-ai/dist/utils/output.js +31 -0
  346. package/vendor/markit-ai/dist/utils/turndown.d.ts +8 -0
  347. package/vendor/markit-ai/dist/utils/turndown.js +70 -0
  348. package/vendor/markit-ai/package.json +74 -0
  349. package/vendor/markit-ai.patch +49 -0
@@ -17,6 +17,7 @@ import type { AttemptScope } from "@gajae-code/agent-core/attempt-scope";
17
17
  import { type CompactionResult, type EmergencyCompactionSample } from "@gajae-code/agent-core/compaction";
18
18
  import type { AssistantMessage, AttemptScopeRef, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolCall, ToolChoice, Usage, UsageReport } from "@gajae-code/ai/core";
19
19
  import { type BtwTextExchange } from "./btw-contract";
20
+ import { type SessionWorkLease } from "./session-work-lease";
20
21
  export interface ForkContextSeedMetadata {
21
22
  sourceSessionId: string;
22
23
  parentMessageCount: number;
@@ -96,7 +97,7 @@ import { type AgentRegistry } from "../registry/agent-registry";
96
97
  import type { LazyService } from "../runtime/lazy-service";
97
98
  import type { NetworkPrewarmRuntime } from "../runtime/network-prewarm-service";
98
99
  import type { WorkspaceTreeRuntime } from "../runtime/workspace-tree-service";
99
- import { MCPManager } from "../runtime-mcp/manager";
100
+ import { type ExactMcpServerControlResult, MCPManager } from "../runtime-mcp/manager";
100
101
  import type { NotificationSessionController } from "../sdk/bus/session-control";
101
102
  import type { SecretObfuscator } from "../secrets/obfuscator";
102
103
  import { type DiscoverableTool, type DiscoverableToolSearchIndex } from "../tool-discovery/tool-index";
@@ -196,6 +197,47 @@ export type AgentSessionEvent = AgentEvent | {
196
197
  goal: Goal | null;
197
198
  state?: GoalModeState;
198
199
  };
200
+ export type QueuedInputDelivery = "steer" | "followUp";
201
+ export type QueuedInputQueuePolicy = "respect-mode" | "sequential";
202
+ export type QueuedInputRemovalReason = "cancelled" | "removed";
203
+ export interface QueuedInputAdmission {
204
+ submissionId: string;
205
+ delivery: QueuedInputDelivery;
206
+ queuePolicy: QueuedInputQueuePolicy;
207
+ }
208
+ export type QueuedInputExecution = {
209
+ submissionId: string;
210
+ delivery: QueuedInputDelivery;
211
+ disposition: "joined-current-run" | "promoted-to-run";
212
+ attemptScope: AttemptScopeRef;
213
+ } | {
214
+ submissionId: string;
215
+ delivery: QueuedInputDelivery;
216
+ disposition: "removed";
217
+ reason: QueuedInputRemovalReason;
218
+ };
219
+ export type QueuedInputTerminal = {
220
+ submissionId: string;
221
+ delivery: QueuedInputDelivery;
222
+ disposition: "completed";
223
+ attemptScope: AttemptScopeRef;
224
+ } | {
225
+ submissionId: string;
226
+ delivery: QueuedInputDelivery;
227
+ disposition: "removed";
228
+ reason: QueuedInputRemovalReason;
229
+ };
230
+ /**
231
+ * Lifecycle receipt for one explicitly queued `submitUserMessage` submission.
232
+ */
233
+ export interface QueuedInputSubmission {
234
+ readonly submissionId: string;
235
+ readonly admitted: Promise<QueuedInputAdmission>;
236
+ readonly execution: Promise<QueuedInputExecution>;
237
+ readonly terminal: Promise<QueuedInputTerminal>;
238
+ /** Remove the submission if it is still queued. Returns false after execution or removal. */
239
+ readonly cancel: () => boolean;
240
+ }
199
241
  /** Listener function for agent session events */
200
242
  export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
201
243
  export type AsyncJobSnapshotItem = Pick<AsyncJob, "id" | "type" | "status" | "label" | "startTime" | "endTime" | "metadata">;
@@ -439,6 +481,30 @@ export interface PromptOptions {
439
481
  /** Internal host capability; ordinary package callers cannot construct the branded value. */
440
482
  sdkRunCapability?: unknown;
441
483
  }
484
+ export interface SendUserMessageOptions {
485
+ deliverAs?: QueuedInputDelivery;
486
+ /** Preserve a busy SDK dispatch as queued work across an admission fence. */
487
+ queuedAtDispatch?: boolean;
488
+ /** Delivery ordering for a tracked or SDK-queued submission. */
489
+ queuePolicy?: QueuedInputQueuePolicy;
490
+ onPreflightAccepted?: () => void;
491
+ onPreflightAcceptCommit?: () => void | Promise<void>;
492
+ /** Internal SDK ownership callback. */
493
+ onQueuedPromoted?: (promotion: {
494
+ startsOwnRun?: boolean;
495
+ removed?: boolean;
496
+ }) => void;
497
+ /** Internal dispatch disposition used before actual queue consumption. */
498
+ onDispatchDisposition?: (promotion: {
499
+ startsOwnRun: boolean;
500
+ }) => void;
501
+ preflightSignal?: AbortSignal;
502
+ sdkRunCapability?: unknown;
503
+ }
504
+ export interface TrackedSendUserMessageOptions extends SendUserMessageOptions {
505
+ deliverAs: QueuedInputDelivery;
506
+ trackSubmission: true;
507
+ }
442
508
  /** Result from a handoff operation. */
443
509
  export interface HandoffResult {
444
510
  document: string;
@@ -614,11 +680,58 @@ export declare class StreamingEditFileCache {
614
680
  has(path: string): boolean;
615
681
  get totalBytes(): number;
616
682
  }
683
+ /**
684
+ * Startup phase of the session-owned exact-config MCP manager.
685
+ *
686
+ * `not-started` and `no-servers-declared` are distinguishable only because the
687
+ * snapshot reads the declared server list from the exact config; the manager
688
+ * alone reports an empty name list in both cases.
689
+ */
690
+ export type ExactMcpStartupState = "not-started" | "no-servers-declared" | "in-flight" | "settled";
691
+ /**
692
+ * Per-server state.
693
+ *
694
+ * `unavailable` covers a server the config declares that the manager has no
695
+ * live record of. A tools-only manager erases a server from its own bookkeeping
696
+ * when the connection fails, so a failed server and one whose startup has not
697
+ * reached it are indistinguishable from here; both surface as `unavailable`
698
+ * rather than being dropped from the table.
699
+ */
700
+ export type ExactMcpServerState = "connecting" | "connected" | "disconnected" | "unavailable";
701
+ export type ExactMcpServerDisplayState = ExactMcpServerState | "suspended";
702
+ /**
703
+ * Transport a server is declared with. Taken from the config's own
704
+ * discriminator, never from a live connection: `getConnection` throws on a
705
+ * tools-only manager, so the declaration is the only source available here.
706
+ */
707
+ export type ExactMcpTransport = "stdio" | "http" | "sse" | "unknown";
708
+ export interface ExactMcpServerStatus {
709
+ readonly name: string;
710
+ readonly transport: ExactMcpTransport;
711
+ readonly state: ExactMcpServerDisplayState;
712
+ readonly toolCount: number;
713
+ }
714
+ /**
715
+ * Whitelisted status shape for the TUI `/mcp` command. Every field here is
716
+ * either a server name the operator already supplied or a derived enum/count;
717
+ * pool keys, endpoints, commands, env, headers, tokens, and raw exception text
718
+ * have no field to travel in.
719
+ */
720
+ export interface ExactMcpStatusSnapshot {
721
+ readonly startup: ExactMcpStartupState;
722
+ readonly servers: readonly ExactMcpServerStatus[];
723
+ }
724
+ export type ExactMcpControlAction = "suspend" | "resume" | "reconnect";
725
+ export interface ExactMcpControlResult extends ExactMcpServerControlResult {
726
+ readonly action: ExactMcpControlAction;
727
+ }
617
728
  export interface DefaultFallbackRuntimeState {
618
729
  chain: ConfiguredFallbackChain;
619
730
  controller: FallbackChainRuntimeState;
620
731
  exhaustedLastTurn: boolean;
621
732
  }
733
+ /** A lost continuation may only settle the emitter/session pair that opened it. */
734
+ export declare function isCurrentWorkflowGateContinuation(currentSessionId: string, expectedSessionId: string, currentEmitter: WorkflowGateEmitter | undefined, expectedEmitter: WorkflowGateEmitter): boolean;
622
735
  export declare class AgentSession {
623
736
  #private;
624
737
  readonly agent: Agent;
@@ -760,7 +873,9 @@ export declare class AgentSession {
760
873
  * Remove all listeners, flush pending writes, and disconnect from agent.
761
874
  * Call this when completely done with the session.
762
875
  */
763
- dispose(): Promise<void>;
876
+ dispose(options?: {
877
+ sessionShutdownReason?: "detached_idle";
878
+ }): Promise<void>;
764
879
  /** Join the retained teardown owner without allocating another public deadline. */
765
880
  awaitDisposeCompletion(): Promise<void>;
766
881
  setDisposeTimeoutForTests(timeoutMs: number): void;
@@ -919,6 +1034,21 @@ export declare class AgentSession {
919
1034
  * Get all configured tool names (built-in via --tools or default, plus custom tools).
920
1035
  */
921
1036
  getAllToolNames(): string[];
1037
+ get hasExactMcpControls(): boolean;
1038
+ /**
1039
+ * Exact-config MCP status for the TUI `/mcp` command.
1040
+ *
1041
+ * Returns `undefined` unless this session holds the exact-config capability,
1042
+ * so a session built outside the root interactive entry point cannot read MCP
1043
+ * state through it. Data comes only from the session-owned tools-only manager
1044
+ * and the call never starts a deferred MCP startup or mutates connections.
1045
+ */
1046
+ getExactMcpStatusSnapshot(): Promise<ExactMcpStatusSnapshot | undefined>;
1047
+ /**
1048
+ * Apply one session-local exact-config control. Selection persistence is
1049
+ * deliberately bypassed: suppression is runtime state, not user authority.
1050
+ */
1051
+ controlExactMcpServer(action: ExactMcpControlAction, name: string): Promise<ExactMcpControlResult | undefined>;
922
1052
  getSelectedMCPToolNames(): string[];
923
1053
  isToolDiscoveryEnabled(): boolean;
924
1054
  getDiscoverableTools(filter?: {
@@ -947,7 +1077,11 @@ export declare class AgentSession {
947
1077
  * Replace MCP tools in the registry and recompute the visible MCP tool set immediately.
948
1078
  * This allows /mcp add/remove/reauth to take effect without restarting the session.
949
1079
  */
950
- refreshMCPTools(mcpTools: CustomTool[]): Promise<void>;
1080
+ refreshMCPTools(mcpTools: CustomTool[], options?: {
1081
+ selectedMCPToolNames?: string[];
1082
+ activeMCPToolNames?: string[];
1083
+ persistMCPSelection?: boolean;
1084
+ }): Promise<void>;
951
1085
  /**
952
1086
  * Refresh plugin sub-skill tools after workflow/sub-skill activation or phase changes.
953
1087
  */
@@ -963,6 +1097,8 @@ export declare class AgentSession {
963
1097
  * to avoid racing against the delivery turn.
964
1098
  */
965
1099
  get hasPostPromptWork(): boolean;
1100
+ /** The host-liveness lease shared by admission, execution, and recovery work. */
1101
+ get sessionWorkLease(): SessionWorkLease;
966
1102
  /** Stable resource ownership identifier for the active prompt run. */
967
1103
  get activePromptHandle(): string | undefined;
968
1104
  /** All messages including custom types like BashExecutionMessage */
@@ -1107,24 +1243,14 @@ export declare class AgentSession {
1107
1243
  * @param content User message content (string or content array)
1108
1244
  * @param options.deliverAs Delivery mode: "steer" or "followUp"
1109
1245
  */
1110
- sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
1111
- deliverAs?: "steer" | "followUp";
1112
- /** Preserve a busy SDK dispatch as queued work across an admission fence. */
1113
- queuedAtDispatch?: boolean;
1114
- onPreflightAccepted?: () => void;
1115
- onPreflightAcceptCommit?: () => void | Promise<void>;
1116
- /** Fired when a queued submission (steering or follow-up) is promoted to its own run (SDK ownership correlation). */
1117
- onQueuedPromoted?: (promotion: {
1118
- startsOwnRun?: boolean;
1119
- removed?: boolean;
1120
- }) => void;
1121
- /** Internal dispatch disposition used before actual queue consumption. */
1122
- onDispatchDisposition?: (promotion: {
1123
- startsOwnRun: boolean;
1124
- }) => void;
1125
- preflightSignal?: AbortSignal;
1126
- sdkRunCapability?: unknown;
1127
- }): Promise<void>;
1246
+ sendUserMessage(content: string | (TextContent | ImageContent)[], options?: SendUserMessageOptions): Promise<void>;
1247
+ /**
1248
+ * Queue one steer or follow-up and return a stable lifecycle handle for that
1249
+ * exact submission. Unlike `sendUserMessage`, this method resolves when the
1250
+ * queue admission receipt is available; use the returned promises to await
1251
+ * execution and the owning terminal boundary.
1252
+ */
1253
+ submitUserMessage(content: string | (TextContent | ImageContent)[], options: TrackedSendUserMessageOptions): Promise<QueuedInputSubmission>;
1128
1254
  /**
1129
1255
  * Clear queued messages and return them.
1130
1256
  * Useful for restoring to editor when user aborts.
@@ -1257,6 +1383,18 @@ export declare class AgentSession {
1257
1383
  rebindTerminalAbortSteeringSnapshot(token: number): void;
1258
1384
  discardTerminalAbortSteeringSnapshot(token: number): void;
1259
1385
  getTerminalTurnEpoch(): number | undefined;
1386
+ /**
1387
+ * Tool call ids the run resource ledger currently holds for `handle` (#5637).
1388
+ *
1389
+ * The authoritative answer to "is a tool running?": AgentLoop reserves the
1390
+ * `kind: "tool"` lease SYNCHRONOUSLY inside its dispatch loop, before the
1391
+ * tool's `execute` is invoked, and the lease settles when the call really
1392
+ * ends — whereas `tool_execution_start` only reaches an extension after an
1393
+ * asynchronous fanout. Strictly read-only: it takes a snapshot and never
1394
+ * claims, reserves, seals or quarantines. An unknown run reads as empty,
1395
+ * matching `RunResourceLedger.pending`.
1396
+ */
1397
+ pendingToolExecutions(handle: string): readonly string[];
1260
1398
  abortPromptAndWait(handle: string, options: {
1261
1399
  graceMs: number;
1262
1400
  terminal?: {
@@ -1386,6 +1524,15 @@ export declare class AgentSession {
1386
1524
  * must not mutate the persisted configured intent.
1387
1525
  */
1388
1526
  setDefaultFallbackRuntimeModel(selector: string): void;
1527
+ /** Install a runtime-only durable fallback without changing saved session intent. */
1528
+ installRecoveredDefaultFallbackChain(entries: readonly string[], identity: string | undefined, activeIndex: number, skips: Array<{
1529
+ selector: string;
1530
+ reason: string;
1531
+ }>, options?: {
1532
+ emitResolutionEvent?: boolean;
1533
+ }): void;
1534
+ markStartupRecoveryBindingsRequired(): void;
1535
+ hasRecoveredDefaultFallbackChain(): boolean;
1389
1536
  /**
1390
1537
  * Seed default fallback state after guarded auth-aware model resolution skips chain entries.
1391
1538
  * The configured chain's role, origin, and identity are retained by the controller.
@@ -97,15 +97,15 @@ export interface CompactionCandidateFailure {
97
97
  readonly model: string;
98
98
  readonly message: string;
99
99
  }
100
+ export declare function sanitizeCompactionCandidateFailureMessage(message: string): string;
100
101
  /**
101
102
  * Error for an auto-compaction run whose every candidate failed.
102
103
  *
103
- * The candidate chain starts at the session model and ends on a same-provider
104
- * largest-context fallback, so surfacing only the final error named a model
105
- * the user never chose and hid that their own model had already failed the
106
- * same way. The message leads with the first failure (the one the user can act
107
- * on), then lists every candidate that was tried with its own error. `cause`
108
- * is the final error so callers that classify by type keep the same object.
104
+ * The candidate chain starts at the session model and includes only explicitly
105
+ * configured role candidates. The message leads with the first failure (the
106
+ * one the user can act on), then lists every candidate that was tried with its
107
+ * own error. `cause` is the final error so callers that classify by type keep
108
+ * the same object.
109
109
  */
110
110
  export declare function describeCompactionCandidateFailures(failures: readonly CompactionCandidateFailure[], lastError: unknown): Error;
111
111
  export declare function effectiveFallbackDelay(baseDelayMs: number, maxDelayMs: number, attemptK: number, random?: () => number): number;
@@ -35,7 +35,17 @@ import type { AsyncJob, FoldReason } from "../async/job-manager";
35
35
  */
36
36
  export declare const FOLD_WAKE_MERGE_WINDOW_MS = 800;
37
37
  /** The wait kinds that can be folded. `task`/`subagent` awaits are a non-goal. */
38
- export type FoldWaitKind = "bash-managed" | "client-terminal" | "bash-pty";
38
+ export type FoldWaitKind = "bash-managed" | "client-terminal" | "bash-pty" | "job-await";
39
+ /**
40
+ * Whether a wait may be picked as the implicit fold target by the chord and
41
+ * the SDK `bash.background` control. A `job-await` watches jobs that are
42
+ * already in the background, so "move the foreground bash into a background
43
+ * job" has nothing to move; it folds only when the `job` tool's own steer
44
+ * watcher names it explicitly. Keeping it out of implicit targeting also stops
45
+ * a `job poll` registered after a foreground bash from taking the chord away
46
+ * from the command the user is actually watching.
47
+ */
48
+ export declare function isImplicitFoldTarget(adapter: FoldAdapter): boolean;
39
49
  /** Outcome of settling the foreground caller. Exactly one party may settle it. */
40
50
  export type ForegroundSettleOutcome = "resolved" | "already-settled";
41
51
  /**
@@ -178,9 +188,13 @@ export declare class FoldCoordinator {
178
188
  constructor(deps: FoldCoordinatorDeps);
179
189
  /** Register a foldable wait. The most recently registered wait is the default target. */
180
190
  registerParticipant(adapter: FoldAdapter): () => void;
181
- /** Whether any wait is currently foldable, for the key-availability gate. */
191
+ /** Whether any implicitly targetable wait is currently foldable, for the key-availability gate. */
182
192
  hasFoldableParticipant(): boolean;
183
- /** Deterministic target: newest registration wins, so the chord folds what the user is watching. */
193
+ /**
194
+ * Deterministic implicit target: newest implicitly targetable registration
195
+ * wins, so the chord folds what the user is watching. `job-await` waits are
196
+ * skipped; they fold only through an explicit adapter.
197
+ */
184
198
  resolveTarget(): FoldAdapter | undefined;
185
199
  /**
186
200
  * T1. Synchronous prologue then async durability tail.
@@ -117,12 +117,18 @@ export interface ScrubbedProtocolRemnantReapResult {
117
117
  * or detached receipts retained as evidence) are never touched. A proven
118
118
  * concurrent disappearance (ENOENT) is benign; all other I/O failures are
119
119
  * returned and logged once without aborting scope preparation.
120
+ *
121
+ * Stranded replacement staging that aliases its own published destination is
122
+ * reaped by the same pass. That entry is neither zero-length nor single-link,
123
+ * so the terminal-remnant filters above can never reach it, yet leaving it in
124
+ * place bricks resume for the session it aliases.
120
125
  */
121
126
  export declare function reapScrubbedProtocolRemnantsSync(directory: string, minAgeMs?: number): ScrubbedProtocolRemnantReapResult;
122
127
  /**
123
128
  * Async twin of {@link reapScrubbedProtocolRemnantsSync} with the same safety
124
129
  * filters (terminal remnant prefix, zero-length, single-link, non-symlink,
125
- * older than the age gate), yielding between bounded batches. Long-lived
130
+ * older than the age gate, plus stranded staging that aliases its own
131
+ * published destination), yielding between bounded batches. Long-lived
126
132
  * processes reap per-session descendant directories through this path so a
127
133
  * legacy oversized directory cannot starve timers or sibling subagents while
128
134
  * it is being drained (issue #4394).
@@ -658,7 +658,44 @@ export declare const RESUME_TRANSCRIPT_MAX_BYTES: number;
658
658
  * source exactly at the advertised limit.
659
659
  */
660
660
  export declare const BOUNDED_RESUME_TRANSCRIPT_MAX_BYTES: number;
661
- export declare const SESSION_OVERSIZED_RECOVERY_MESSAGE = "The selected session transcript is too large to resume safely. Use `gjc export <session-file>` to export its content into a new session, or remove/archive it after confirming its content is no longer needed.";
661
+ /**
662
+ * Recovery actions offered when a live transcript is at or past the managed
663
+ * per-file cap.
664
+ *
665
+ * Constrained three ways, and every command named here satisfies all three:
666
+ *
667
+ * 1. **It must exist.** `gjc export <session-file>` was advised for both limits
668
+ * and is not a subcommand, so following it literally started a fresh agent
669
+ * that read "export" as a prompt while the session stayed unwritable. (The
670
+ * root `--export` flag renders HTML and exits; it yields no resumable
671
+ * session.)
672
+ * 2. **It must be reachable on every surface that renders the message.** These
673
+ * strings reach ACP/text consumers through `AgentSession`, and the ACP
674
+ * registry is filtered to definitions carrying `handle`
675
+ * (`slash-commands/acp-builtins.ts`), so a `handleTui`-only command such as
676
+ * `/new` is a different dead end rather than a fix.
677
+ * 3. **It must not drop the retained near-limit entries.** A failed append is
678
+ * kept in memory with a full rewrite armed, and a rejected managed rewrite
679
+ * likewise retains its resident entries; both messages promise the work
680
+ * persists on the next successful write. `/compact` and `/clear` keep the
681
+ * manager — and therefore that pending debt — alive; a session switch closes
682
+ * the writer without paying it.
683
+ *
684
+ * Every near-limit error class MUST interpolate this constant rather than
685
+ * restate the advice. `SessionNearLimitRewriteError` restated it and thereby
686
+ * reintroduced `gjc export <session-file>` after #5621 removed it (#5691).
687
+ *
688
+ * `session-recovery-guidance.test.ts` pins all three constraints against the
689
+ * CLI, builtin, and ACP registries, for every near-limit error class.
690
+ */
691
+ export declare const SESSION_LIMIT_RECOVERY_ACTIONS = "compact the session (`/compact`), or clear its context (`/clear`) if compaction cannot reclaim enough";
692
+ /**
693
+ * Oversized-resume guidance. This surface is reached *before* a session is
694
+ * opened, so it deliberately does not reuse {@link SESSION_LIMIT_RECOVERY_ACTIONS}:
695
+ * an in-session command there would act on whichever session the user resumes
696
+ * next, never on the transcript that was just rejected.
697
+ */
698
+ export declare const SESSION_OVERSIZED_RECOVERY_MESSAGE = "The selected session transcript is too large to resume safely. Resume a different session, or remove/archive this transcript after confirming its content is no longer needed.";
662
699
  export declare class SessionAppendPersistenceError extends Error {
663
700
  readonly phase: SessionAppendPersistenceFailurePhase;
664
701
  readonly entryId: string;
@@ -692,6 +729,28 @@ export declare class SessionNearLimitAppendError extends Error {
692
729
  entryRetained: boolean;
693
730
  });
694
731
  }
732
+ /**
733
+ * Typed near-limit rewrite outcome (follow-up to #4566).
734
+ *
735
+ * A managed atomic rewrite (`#writeEntriesAtomicallySync`) whose serialized
736
+ * transcript crosses the per-file cap cannot be published: the managed store
737
+ * rejects the bytes with `content_too_large`. Unlike the append path there is
738
+ * no appended entry here — the whole live transcript is the payload — so this
739
+ * error carries the rejected rewrite size and the cap instead of append
740
+ * fields, and every rewrite/flush/close caller can point at compaction or
741
+ * export as the continuation path.
742
+ */
743
+ export declare class SessionNearLimitRewriteError extends Error {
744
+ readonly code: "near_limit_rewrite";
745
+ /** Serialized transcript size (bytes) rejected by the managed store. */
746
+ readonly transcriptBytes: number;
747
+ /** Managed per-file cap in force when the rewrite was rejected. */
748
+ readonly capBytes: number;
749
+ constructor(details: {
750
+ transcriptBytes: number;
751
+ capBytes: number;
752
+ });
753
+ }
695
754
  export declare class SessionManagedStorageError extends Error {
696
755
  readonly code = "managed_storage_unsupported";
697
756
  constructor();
@@ -1037,6 +1096,7 @@ export declare const SessionManagerTestHooks: {
1037
1096
  afterForkTranscriptPublished?: () => void | Promise<void>;
1038
1097
  beforeEphemeralArtifactManagerInstall?: (dir: string) => void | Promise<void>;
1039
1098
  beforePersistPatchFence?: (attempt: number) => void;
1099
+ beforeLivePickerStarFence?: () => void;
1040
1100
  beforeStrictMissingCheck?: (filePath: string, storage: SessionStorage) => void;
1041
1101
  beforeManagedResumeAcceptance?: (filePath: string, storage: SessionStorage) => void;
1042
1102
  beforeManagedResumeReturn?: (filePath: string, storage: SessionStorage) => void;
@@ -1421,6 +1481,9 @@ export declare class SessionManager {
1421
1481
  getSessionName(): string | undefined;
1422
1482
  isSessionStarred(): boolean;
1423
1483
  setSessionStarred(starred: boolean): Promise<boolean>;
1484
+ setSessionStarredForPicker(session: SessionInfo, starred: boolean): Promise<void>;
1485
+ /** Update only a picker candidate's metadata, without opening a runtime or publishing a resume breadcrumb. */
1486
+ static setSessionStarredForPicker(session: SessionInfo, starred: boolean, explicitSessionDir?: string): Promise<void>;
1424
1487
  setSessionName(name: string, source?: "auto" | "user"): Promise<boolean>;
1425
1488
  _persist(entry: SessionEntry): void;
1426
1489
  /** Append a configured fallback chain as child of current leaf, then advance leaf. Returns entry id. */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * One authoritative, reference-counted lease for work that still needs a
3
+ * session host. Each admitted work state owns one handle and releases that
4
+ * handle at its terminal boundary; the host only observes whether any handle
5
+ * remains held.
6
+ */
7
+ export interface SessionWorkLeaseHandle {
8
+ release(): void;
9
+ }
10
+ export interface SessionWorkLease {
11
+ acquire(): SessionWorkLeaseHandle;
12
+ isHeld(): boolean;
13
+ }
14
+ export declare function createSessionWorkLease(): SessionWorkLease;
@@ -1,4 +1,4 @@
1
- export declare const MODEL_ONBOARDING_API_PROVIDER_COMMAND = "/provider add --compat <openai|anthropic> --provider <id> --base-url <url> --api-key-env <ENV> --model <model>";
1
+ export declare const MODEL_ONBOARDING_API_PROVIDER_COMMAND = "/provider add --compat <openai|anthropic> --provider <id> --base-url <url> --api-key-env <ENV> (--model <model> | --discover)";
2
2
  export declare const MODEL_ONBOARDING_PROVIDER_PRESET_COMMAND = "/provider add --preset <id>";
3
3
  export declare const MODEL_ONBOARDING_SETUP_COMMAND = "gjc setup provider";
4
4
  export declare const MODEL_ONBOARDING_OAUTH_COMMAND = "/provider login [provider-id] or /login [provider-id]";
@@ -1,3 +1,4 @@
1
+ import { type AuthStorage } from "@gajae-code/ai/core";
1
2
  import { type ModelsConfig, type ProviderDiscovery } from "../config/models-config-schema";
2
3
  export type ProviderCompatibility = "openai" | "anthropic";
3
4
  export type ProviderSetupApi = "openai-responses" | "openai-completions" | "anthropic-messages";
@@ -11,6 +12,37 @@ export interface ProviderSetupInput {
11
12
  models?: string[];
12
13
  modelsPath?: string;
13
14
  force?: boolean;
15
+ /**
16
+ * Opt into live OpenAI `/v1/models` discovery for an OpenAI-compatible
17
+ * custom provider. Manual `--model` ids may be omitted when set; the
18
+ * runtime auto-discovers the catalog on refresh and merges it without
19
+ * duplicates.
20
+ *
21
+ * When no manual models are given, setup probes the endpoint before
22
+ * writing config so an unreachable endpoint, rejected credential, or
23
+ * empty catalog fails the setup loudly instead of writing a provider
24
+ * that can never serve a model. There is deliberately no skip flag: the
25
+ * pre-write probe is the enforcement point, and the wizard's
26
+ * interactive probe is a preview only (inputs may have changed since).
27
+ */
28
+ discover?: boolean;
29
+ /** Probe override for tests; defaults to the live endpoint probe. */
30
+ probeDiscovery?: (input: ProviderDiscoveryProbeInput) => Promise<ProviderDiscoveryProbeResult>;
31
+ /**
32
+ * Cancel discovery and persistence until the atomic config rename is
33
+ * invoked. Later cancellation does not undo a committed provider.
34
+ * Combined with the shared deadline inside the probe; callers that omit
35
+ * it get deadline-only probe behavior.
36
+ */
37
+ discoverySignal?: AbortSignal;
38
+ /**
39
+ * Live credential authority for literal-key persistence. Interactive
40
+ * callers pass the active session registry's AuthStorage so the
41
+ * subsequent targeted online refresh authenticates from the same
42
+ * authority that stored the key. When omitted, onboarding falls back
43
+ * to a short-lived store at the agent DB path (headless/CLI behavior).
44
+ */
45
+ authStorage?: ProviderSetupCredentialStore;
14
46
  }
15
47
  export interface ProviderSetupResult {
16
48
  providerId: string;
@@ -21,11 +53,18 @@ export interface ProviderSetupResult {
21
53
  modelsPath: string;
22
54
  redactedApiKey: string;
23
55
  credentialSource: "literal" | "env";
56
+ /** True when the provider persists a `discovery:` block (live catalog). */
57
+ discoveryEnabled: boolean;
58
+ /** The persisted discovery type, when any (e.g. `openai-models-list`). */
59
+ discoveryType?: string;
24
60
  preset?: string;
25
61
  presetName?: string;
26
62
  }
27
63
  type ProviderConfig = NonNullable<NonNullable<ModelsConfig["providers"]>[string]>;
28
64
  type ProviderCompatConfig = NonNullable<ProviderConfig["compat"]>;
65
+ type ProviderSetupCredentialStore = Pick<AuthStorage, "set" | "remove" | "exportSnapshot"> & {
66
+ peekApiKey?: (provider: string) => Promise<string | undefined>;
67
+ };
29
68
  interface ProviderPreset {
30
69
  id: string;
31
70
  aliases: readonly string[];
@@ -54,8 +93,49 @@ export declare function parseProviderCompatibility(value: string): ProviderCompa
54
93
  export declare function findProviderPreset(value: string | undefined): ProviderPreset | undefined;
55
94
  export declare function formatProviderPresetList(): string;
56
95
  export declare function parseModelList(values: readonly string[]): string[];
57
- export declare function redactSecret(secret: string): string;
96
+ export declare function redactSecret(_secret: string): string;
58
97
  export declare function validateModelApi(modelApi: Readonly<Record<string, string>> | undefined, models: readonly string[], presetId: string): void;
59
98
  export declare function addApiCompatibleProvider(input: ProviderSetupInput): Promise<ProviderSetupResult>;
99
+ export interface ProviderDiscoveryProbeInput {
100
+ baseUrl: string;
101
+ apiKeyEnv?: string;
102
+ apiKey?: string;
103
+ timeoutMs?: number;
104
+ signal?: AbortSignal;
105
+ }
106
+ export interface ProviderDiscoveryProbeResult {
107
+ models: string[];
108
+ endpoint: string;
109
+ }
110
+ /**
111
+ * Probe an OpenAI-compatible `/v1/models` endpoint and return the sorted
112
+ * model ids. Used by the Add-custom-provider wizard so gateway catalogs
113
+ * (LiteLLM and friends) do not need manual transcription.
114
+ *
115
+ * Credential handling: an `apiKeyEnv` name resolves through the trusted
116
+ * credential env only (never `cwd/.env`); a literal `apiKey` is used as-is.
117
+ * Errors name the redacted endpoint only — the key material never appears
118
+ * in messages, and callers must not log the request headers.
119
+ */
120
+ export declare function probeOpenAIModelsList(input: ProviderDiscoveryProbeInput): Promise<ProviderDiscoveryProbeResult>;
121
+ export interface DiscoveryCatalogRefresher {
122
+ refresh(mode: "offline" | "online" | "online-if-uncached", credentialSessionId?: string): Promise<void>;
123
+ refreshProvider(providerId: string, strategy?: "offline" | "online" | "online-if-uncached", credentialSessionId?: string): Promise<void>;
124
+ getProviderDiscoveryState(providerId: string): {
125
+ status: string;
126
+ error?: string;
127
+ } | undefined;
128
+ }
129
+ /**
130
+ * Reload static config offline, then refresh only the newly added discovery
131
+ * provider online so freshly requested live catalogs are selectable
132
+ * immediately (including alongside manual models). Preset-managed
133
+ * discovery is excluded by callers: presets resolve lazily at runtime.
134
+ * Returns a recovery hint instead of reporting unconditional success when
135
+ * the live catalog stays unavailable: the config is saved and valid, but
136
+ * the user needs to know the catalog did not populate and how to recover
137
+ * (wait for the next refresh, or re-add with explicit `--model` ids).
138
+ */
139
+ export declare function reloadAndRefreshDiscoveryCatalog(registry: DiscoveryCatalogRefresher, providerId: string, credentialSessionId?: string): Promise<string | null>;
60
140
  export declare function formatProviderSetupResult(result: ProviderSetupResult): string;
61
141
  export {};