@gajae-code/coding-agent 0.11.11 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/CHANGELOG.md +131 -4
  2. package/dist/types/async/job-manager.d.ts +17 -3
  3. package/dist/types/cli/read-cli.d.ts +1 -0
  4. package/dist/types/commands/deep-interview.d.ts +9 -0
  5. package/dist/types/commands/harness.d.ts +22 -0
  6. package/dist/types/commands/read.d.ts +6 -0
  7. package/dist/types/config/model-registry.d.ts +4 -0
  8. package/dist/types/config/provider-auth-health.d.ts +14 -0
  9. package/dist/types/config/provider-ranking.d.ts +59 -0
  10. package/dist/types/config/settings-schema.d.ts +83 -1
  11. package/dist/types/config/settings.d.ts +2 -0
  12. package/dist/types/exa/mcp-client.d.ts +10 -1
  13. package/dist/types/exec/bash-executor.d.ts +45 -12
  14. package/dist/types/extensibility/extensions/types.d.ts +38 -4
  15. package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
  16. package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
  17. package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
  18. package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
  19. package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
  20. package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
  21. package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
  22. package/dist/types/extensibility/shared-events.d.ts +6 -0
  23. package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +5 -12
  24. package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +17 -32
  25. package/dist/types/gjc-runtime/deep-interview-stage.d.ts +37 -0
  26. package/dist/types/gjc-runtime/deep-interview-state.d.ts +4 -135
  27. package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
  28. package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
  29. package/dist/types/gjc-runtime/memory-guard-owner-claims.d.ts +47 -0
  30. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +70 -1
  31. package/dist/types/gjc-runtime/state-writer.d.ts +5 -46
  32. package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
  33. package/dist/types/gjc-runtime/team-runtime.d.ts +27 -1
  34. package/dist/types/gjc-runtime/team-store.d.ts +12 -0
  35. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
  36. package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +92 -0
  37. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +17 -0
  38. package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +8 -0
  39. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +31 -80
  40. package/dist/types/gjc-runtime/workflow-manifest.d.ts +3 -5
  41. package/dist/types/internal-urls/local-root-gc.d.ts +2 -0
  42. package/dist/types/main.d.ts +1 -1
  43. package/dist/types/memories/index.d.ts +2 -0
  44. package/dist/types/modes/acp/acp-agent.d.ts +10 -19
  45. package/dist/types/modes/components/assistant-message.d.ts +3 -1
  46. package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
  47. package/dist/types/modes/components/irc-sidebar.d.ts +41 -0
  48. package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
  49. package/dist/types/modes/components/read-tool-group.d.ts +4 -4
  50. package/dist/types/modes/components/session-observer-overlay.d.ts +22 -0
  51. package/dist/types/modes/components/settings-selector.d.ts +11 -0
  52. package/dist/types/modes/components/status-line/gh.d.ts +5 -0
  53. package/dist/types/modes/components/tool-execution.d.ts +8 -0
  54. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
  55. package/dist/types/modes/controllers/event-controller.d.ts +3 -0
  56. package/dist/types/modes/interactive-mode.d.ts +2 -0
  57. package/dist/types/modes/irc-observation-ledger.d.ts +17 -1
  58. package/dist/types/modes/types.d.ts +2 -0
  59. package/dist/types/modes/utils/ui-helpers.d.ts +16 -0
  60. package/dist/types/reminders/star-reminder.d.ts +3 -13
  61. package/dist/types/runtime-mcp/manager.d.ts +1 -0
  62. package/dist/types/runtime-mcp/smithery-auth.d.ts +5 -0
  63. package/dist/types/sdk/acp/adapter.d.ts +3 -1
  64. package/dist/types/sdk/broker/lifecycle.d.ts +5 -0
  65. package/dist/types/sdk/broker/transport.d.ts +2 -0
  66. package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
  67. package/dist/types/sdk/bus/chat-daemon-control.d.ts +4 -1
  68. package/dist/types/sdk/bus/config.d.ts +6 -2
  69. package/dist/types/sdk/bus/control-drain-lease.d.ts +52 -0
  70. package/dist/types/sdk/bus/index.d.ts +44 -1
  71. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +44 -0
  72. package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
  73. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +2 -1
  74. package/dist/types/sdk/bus/reconciliation-store.d.ts +69 -0
  75. package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
  76. package/dist/types/sdk/bus/rich-render.d.ts +2 -0
  77. package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
  78. package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
  79. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +11 -4
  80. package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
  81. package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
  82. package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
  83. package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
  84. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  85. package/dist/types/sdk/host/host.d.ts +2 -0
  86. package/dist/types/sdk/host/query/handlers.d.ts +5 -0
  87. package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
  88. package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
  89. package/dist/types/sdk/prompt-status.d.ts +23 -3
  90. package/dist/types/sdk/session.d.ts +6 -0
  91. package/dist/types/session/agent-session.d.ts +82 -12
  92. package/dist/types/session/artifacts.d.ts +8 -0
  93. package/dist/types/session/blob-store.d.ts +57 -4
  94. package/dist/types/session/internal/managed-session-storage.d.ts +8 -1
  95. package/dist/types/session/memory-guard-checkpoint-participant.d.ts +69 -0
  96. package/dist/types/session/session-manager.d.ts +48 -19
  97. package/dist/types/session/session-storage.d.ts +4 -0
  98. package/dist/types/session/streaming-output.d.ts +96 -12
  99. package/dist/types/setup/credential-import.d.ts +12 -0
  100. package/dist/types/skill-state/active-state.d.ts +12 -4
  101. package/dist/types/skill-state/workflow-hud.d.ts +9 -0
  102. package/dist/types/task/executor.d.ts +3 -2
  103. package/dist/types/task/index.d.ts +3 -1
  104. package/dist/types/task/provider-retry-status.d.ts +8 -0
  105. package/dist/types/task/receipt.d.ts +7 -1
  106. package/dist/types/task/types.d.ts +23 -0
  107. package/dist/types/tools/ask-answer-registry.d.ts +2 -2
  108. package/dist/types/tools/bash-interactive.d.ts +4 -1
  109. package/dist/types/tools/bash.d.ts +3 -1
  110. package/dist/types/tools/browser/launch.d.ts +7 -0
  111. package/dist/types/tools/fetch.d.ts +17 -1
  112. package/dist/types/tools/image-gen.d.ts +4 -0
  113. package/dist/types/tools/index.d.ts +4 -0
  114. package/dist/types/tools/output-meta.d.ts +44 -3
  115. package/dist/types/tools/path-utils.d.ts +1 -0
  116. package/dist/types/tools/read-internals.d.ts +12 -0
  117. package/dist/types/tools/read.d.ts +45 -7
  118. package/dist/types/tools/resource-gc.d.ts +4 -0
  119. package/dist/types/tools/review.d.ts +5 -7
  120. package/dist/types/tools/subagent.d.ts +2 -0
  121. package/dist/types/tools/tool-result.d.ts +7 -1
  122. package/dist/types/utils/gh.d.ts +13 -0
  123. package/dist/types/utils/image-resize.d.ts +1 -0
  124. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  125. package/dist/types/web/search/providers/searxng.d.ts +7 -0
  126. package/dist/types/web/search/providers/xai.d.ts +2 -0
  127. package/package.json +11 -13
  128. package/scripts/acp-conformance-agent.ts +218 -0
  129. package/scripts/benchmark-sticky-viewport-pr1.ts +239 -0
  130. package/scripts/capture-gjc-bundle-settings.ts +306 -0
  131. package/scripts/capture-sticky-viewport-showcase.ts +292 -0
  132. package/scripts/generate-sdk-operation-inventory.ts +5 -0
  133. package/scripts/resident-memory-bench.ts +1341 -0
  134. package/scripts/run-acp-conformance.ts +285 -0
  135. package/scripts/verify-gjc-sdk-canonicalization.ts +122 -18
  136. package/scripts/verify-sticky-viewport-showcase.ts +611 -0
  137. package/src/async/job-manager.ts +78 -20
  138. package/src/capability/index.ts +8 -0
  139. package/src/cli/fast-help.ts +1 -1
  140. package/src/cli/plugin-cli.ts +176 -18
  141. package/src/cli/read-cli.ts +2 -1
  142. package/src/cli.ts +1 -0
  143. package/src/commands/deep-interview.ts +29 -9
  144. package/src/commands/harness.ts +35 -12
  145. package/src/commands/read.ts +11 -2
  146. package/src/commands/team.ts +20 -2
  147. package/src/config/file-lock.ts +11 -2
  148. package/src/config/model-registry.ts +21 -2
  149. package/src/config/provider-auth-health.ts +42 -0
  150. package/src/config/provider-ranking.ts +119 -0
  151. package/src/config/settings-schema.ts +74 -1
  152. package/src/config/settings.ts +246 -108
  153. package/src/coordinator-mcp/question-gate-codec.ts +1 -1
  154. package/src/coordinator-mcp/server.ts +5 -12
  155. package/src/defaults/gjc/skills/deep-interview/SKILL.md +230 -82
  156. package/src/defaults/gjc/skills/ralplan/SKILL.md +77 -41
  157. package/src/defaults/gjc/skills/team/SKILL.md +3 -1
  158. package/src/defaults/gjc/skills/ultragoal/SKILL.md +62 -39
  159. package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
  160. package/src/defaults/gjc-defaults.ts +4 -4
  161. package/src/eval/py/executor.ts +7 -2
  162. package/src/exa/mcp-client.ts +12 -3
  163. package/src/exec/bash-executor.ts +144 -27
  164. package/src/extensibility/extensions/runner.ts +15 -0
  165. package/src/extensibility/extensions/types.ts +46 -5
  166. package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
  167. package/src/extensibility/gjc-plugins/index.ts +19 -2
  168. package/src/extensibility/gjc-plugins/installer.ts +189 -50
  169. package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
  170. package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
  171. package/src/extensibility/gjc-plugins/observability.ts +3 -3
  172. package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
  173. package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
  174. package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
  175. package/src/extensibility/gjc-plugins/schema.ts +84 -12
  176. package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
  177. package/src/extensibility/gjc-plugins/types.ts +141 -0
  178. package/src/extensibility/gjc-plugins/validation.ts +9 -0
  179. package/src/extensibility/shared-events.ts +5 -0
  180. package/src/gjc-runtime/deep-interview-ambiguity.ts +47 -82
  181. package/src/gjc-runtime/deep-interview-recorder.ts +227 -310
  182. package/src/gjc-runtime/deep-interview-runtime.ts +109 -270
  183. package/src/gjc-runtime/deep-interview-stage.ts +1016 -0
  184. package/src/gjc-runtime/deep-interview-state.ts +12 -943
  185. package/src/gjc-runtime/gc-render.ts +1 -0
  186. package/src/gjc-runtime/gc-runtime.ts +11 -1
  187. package/src/gjc-runtime/launch-tmux.ts +25 -6
  188. package/src/gjc-runtime/managed-owner-admission.ts +1 -1
  189. package/src/gjc-runtime/memory-guard-owner-claims.ts +389 -0
  190. package/src/gjc-runtime/ralplan-runtime.ts +1149 -98
  191. package/src/gjc-runtime/state-runtime.ts +2 -1
  192. package/src/gjc-runtime/state-writer.ts +70 -222
  193. package/src/gjc-runtime/team-launch.ts +42 -5
  194. package/src/gjc-runtime/team-runtime.ts +1085 -40
  195. package/src/gjc-runtime/team-store.ts +32 -0
  196. package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
  197. package/src/gjc-runtime/team-worker-memory-guard.ts +363 -0
  198. package/src/gjc-runtime/team-workers.ts +1 -0
  199. package/src/gjc-runtime/tmux-owner-isolation.ts +28 -0
  200. package/src/gjc-runtime/tmux-sessions.ts +58 -13
  201. package/src/gjc-runtime/ultragoal-receipt-freshness.ts +20 -0
  202. package/src/gjc-runtime/ultragoal-runtime.ts +414 -618
  203. package/src/gjc-runtime/workflow-manifest.generated.json +105 -449
  204. package/src/gjc-runtime/workflow-manifest.ts +38 -247
  205. package/src/hooks/native-skill-hook.ts +17 -4
  206. package/src/hooks/skill-state.ts +1 -23
  207. package/src/internal-urls/docs-index.generated.ts +21 -22
  208. package/src/internal-urls/local-root-gc.ts +127 -0
  209. package/src/main.ts +9 -5
  210. package/src/memories/index.ts +10 -0
  211. package/src/modes/DESIGN.md +98 -0
  212. package/src/modes/acp/acp-agent.ts +339 -191
  213. package/src/modes/acp/acp-event-mapper.ts +14 -7
  214. package/src/modes/acp/acp-mode.ts +39 -3
  215. package/src/modes/components/assistant-message.ts +123 -22
  216. package/src/modes/components/gjc-bundle-settings.ts +508 -0
  217. package/src/modes/components/irc-sidebar.ts +176 -62
  218. package/src/modes/components/model-selector.ts +61 -4
  219. package/src/modes/components/notifications-settings-editor.ts +12 -1
  220. package/src/modes/components/oauth-selector.ts +96 -28
  221. package/src/modes/components/read-tool-group.ts +82 -14
  222. package/src/modes/components/session-observer-overlay.ts +457 -83
  223. package/src/modes/components/settings-selector.ts +116 -23
  224. package/src/modes/components/status-line/gh.ts +16 -0
  225. package/src/modes/components/tool-execution.ts +138 -27
  226. package/src/modes/components/tool-status-header.ts +3 -14
  227. package/src/modes/components/transcript-viewer-overlay.ts +99 -24
  228. package/src/modes/controllers/command-controller.ts +4 -0
  229. package/src/modes/controllers/event-controller.ts +109 -27
  230. package/src/modes/controllers/extension-ui-controller.ts +26 -2
  231. package/src/modes/controllers/input-controller.ts +18 -3
  232. package/src/modes/controllers/selector-controller.ts +127 -36
  233. package/src/modes/interactive-mode.ts +62 -3
  234. package/src/modes/irc-observation-ledger.ts +71 -15
  235. package/src/modes/runtime-init.ts +22 -2
  236. package/src/modes/types.ts +2 -0
  237. package/src/modes/utils/ui-helpers.ts +94 -1
  238. package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
  239. package/src/prompts/agents/architect.md +9 -1
  240. package/src/prompts/agents/critic.md +9 -0
  241. package/src/prompts/system/eager-todo.md +8 -4
  242. package/src/prompts/system/system-prompt.md +11 -5
  243. package/src/prompts/tools/bash.md +5 -5
  244. package/src/prompts/tools/read.md +4 -2
  245. package/src/prompts/tools/search-tool-bm25.md +5 -0
  246. package/src/prompts/tools/task.md +1 -1
  247. package/src/reminders/star-reminder.ts +4 -42
  248. package/src/runtime-mcp/manager.ts +19 -4
  249. package/src/runtime-mcp/smithery-auth.ts +17 -2
  250. package/src/runtime-mcp/smithery-connect.ts +11 -1
  251. package/src/sdk/acp/adapter.ts +22 -6
  252. package/src/sdk/broker/lifecycle.ts +25 -6
  253. package/src/sdk/broker/transport.ts +35 -3
  254. package/src/sdk/bus/attachment-registry.ts +5 -1
  255. package/src/sdk/bus/chat-daemon-cli.ts +4 -39
  256. package/src/sdk/bus/chat-daemon-control.ts +6 -3
  257. package/src/sdk/bus/config.ts +18 -2
  258. package/src/sdk/bus/control-drain-lease.ts +104 -0
  259. package/src/sdk/bus/index.ts +984 -146
  260. package/src/sdk/bus/kind-aware-reconciliation.ts +317 -0
  261. package/src/sdk/bus/lifecycle-commands.ts +4 -1
  262. package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
  263. package/src/sdk/bus/prompt-reconciliation.ts +2 -1
  264. package/src/sdk/bus/reconciliation-store.ts +303 -0
  265. package/src/sdk/bus/rich-draft.ts +1 -1
  266. package/src/sdk/bus/rich-render.ts +2 -2
  267. package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
  268. package/src/sdk/bus/telegram-cli.ts +33 -8
  269. package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
  270. package/src/sdk/bus/telegram-daemon-contract.ts +11 -4
  271. package/src/sdk/bus/telegram-daemon.ts +916 -23
  272. package/src/sdk/bus/telegram-reference.ts +40 -3
  273. package/src/sdk/bus/threaded-render.ts +48 -3
  274. package/src/sdk/bus/topic-registry.ts +20 -0
  275. package/src/sdk/host/control/dispatch.ts +5 -1
  276. package/src/sdk/host/control/operations.ts +1 -1
  277. package/src/sdk/host/host.ts +23 -1
  278. package/src/sdk/host/query/handlers.ts +55 -0
  279. package/src/sdk/host/query/revision-store.ts +36 -2
  280. package/src/sdk/host/reverse-leases.ts +44 -7
  281. package/src/sdk/mcp/server.ts +46 -18
  282. package/src/sdk/prompt-status.ts +16 -3
  283. package/src/sdk/protocol/operation-inventory.generated.json +51 -0
  284. package/src/sdk/protocol/operation-registry.ts +7 -2
  285. package/src/sdk/session.ts +101 -10
  286. package/src/session/agent-session.ts +1286 -220
  287. package/src/session/artifacts.ts +22 -0
  288. package/src/session/auth-broker-config.ts +10 -3
  289. package/src/session/blob-store.ts +915 -24
  290. package/src/session/internal/managed-session-scope.ts +44 -6
  291. package/src/session/internal/managed-session-storage.ts +48 -6
  292. package/src/session/memory-guard-checkpoint-participant.ts +131 -0
  293. package/src/session/session-manager.ts +2364 -438
  294. package/src/session/session-storage.ts +9 -1
  295. package/src/session/streaming-output.ts +500 -111
  296. package/src/setup/credential-import.ts +75 -13
  297. package/src/setup/provider-onboarding.ts +19 -4
  298. package/src/skill-state/active-state.ts +32 -10
  299. package/src/skill-state/workflow-hud.ts +42 -2
  300. package/src/skill-state/workflow-mutation-guard.ts +560 -8
  301. package/src/task/executor.ts +122 -39
  302. package/src/task/index.ts +23 -14
  303. package/src/task/provider-retry-status.ts +16 -0
  304. package/src/task/receipt.ts +23 -7
  305. package/src/task/render.ts +6 -2
  306. package/src/task/types.ts +108 -0
  307. package/src/tools/ask-answer-registry.ts +12 -6
  308. package/src/tools/ask.ts +169 -118
  309. package/src/tools/ast-edit.ts +1 -0
  310. package/src/tools/ast-grep.ts +1 -0
  311. package/src/tools/bash-interactive.ts +8 -3
  312. package/src/tools/bash.ts +503 -60
  313. package/src/tools/browser/launch.ts +41 -6
  314. package/src/tools/fetch.ts +114 -23
  315. package/src/tools/find.ts +1 -0
  316. package/src/tools/image-gen.ts +29 -5
  317. package/src/tools/index.ts +4 -0
  318. package/src/tools/output-meta.ts +281 -20
  319. package/src/tools/path-utils.ts +8 -3
  320. package/src/tools/read-internals.ts +44 -0
  321. package/src/tools/read.ts +1560 -310
  322. package/src/tools/resource-gc.ts +182 -18
  323. package/src/tools/review.ts +5 -7
  324. package/src/tools/search.ts +1 -0
  325. package/src/tools/subagent-render.ts +6 -2
  326. package/src/tools/subagent.ts +6 -0
  327. package/src/tools/telegram-send.ts +6 -3
  328. package/src/tools/tool-result.ts +14 -1
  329. package/src/utils/gh.ts +39 -0
  330. package/src/utils/image-resize.ts +3 -0
  331. package/src/web/search/providers/anthropic.ts +4 -4
  332. package/src/web/search/providers/codex.ts +1 -1
  333. package/src/web/search/providers/kimi.ts +15 -5
  334. package/src/web/search/providers/searxng.ts +47 -4
  335. package/src/web/search/providers/xai.ts +7 -2
  336. package/dist/types/gjc-runtime/deep-interview-draft.d.ts +0 -8
  337. package/dist/types/gjc-runtime/deep-interview-payload.d.ts +0 -41
  338. package/dist/types/gjc-runtime/deep-interview-repair.d.ts +0 -17
  339. package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
  340. package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
  341. package/src/gjc-runtime/deep-interview-draft.ts +0 -843
  342. package/src/gjc-runtime/deep-interview-payload.ts +0 -262
  343. package/src/gjc-runtime/deep-interview-repair.ts +0 -1674
  344. package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
@@ -1,7 +1,16 @@
1
1
  import type { TSchema } from "@gajae-code/ai";
2
2
  import type { CustomTool, CustomToolResult } from "../extensibility/custom-tools/types";
3
3
  import type { ExaRenderDetails, ExaSearchResponse, MCPTool, MCPToolWrapperConfig } from "./types";
4
- /** Find EXA_API_KEY from Bun.env or .env files */
4
+ /**
5
+ * Find `EXA_API_KEY` from trusted environment sources.
6
+ *
7
+ * The key authenticates every Exa MCP call and travels in the request URL, so
8
+ * whatever can set it decides which account the agent's searches run through —
9
+ * and therefore who can see those queries. `$env` merges the caller's `cwd/.env`
10
+ * into `process.env`, so reading it there would let repository content supply
11
+ * that account. Resolve it the same way provider credentials are: launching
12
+ * shell plus GJC/user-owned `.env` files, never the project `.env`.
13
+ */
5
14
  export declare function findApiKey(): string | null;
6
15
  /** Fetch available tools from Exa MCP */
7
16
  export declare function fetchExaTools(apiKey: string | null, toolNames: string[]): Promise<MCPTool[]>;
@@ -1,6 +1,43 @@
1
1
  import { type MinimizerOptions } from "@gajae-code/natives";
2
2
  import { type ShellMinimizerSettings } from "../config/settings";
3
+ import { type TerminalArtifactPublisher } from "../session/streaming-output";
4
+ export interface BashArtifactSaveSummary {
5
+ artifactId: string;
6
+ complete: boolean;
7
+ omittedBytes?: number;
8
+ }
9
+ export type BashMinimizedSaveReturn = BashArtifactSaveResult | BashArtifactSaveSummary | string | undefined;
10
+ export type BashArtifactSaveResult = {
11
+ status: "saved";
12
+ artifactId: string;
13
+ complete: true;
14
+ omittedBytes?: undefined;
15
+ } | {
16
+ status: "saved";
17
+ artifactId: string;
18
+ complete: false;
19
+ omittedBytes: number;
20
+ } | {
21
+ status: "unavailable";
22
+ } | {
23
+ status: "failed";
24
+ diagnostic: string;
25
+ };
26
+ export declare function normalizeMinimizedSaveResultForTests(value: BashMinimizedSaveReturn, originalText: string): BashArtifactSaveResult;
3
27
  export interface BashExecutorOptions {
28
+ /**
29
+ * Invoked when the native minimizer rewrote the command's output, giving
30
+ * the caller a chance to persist the lossless original capture (typically
31
+ * via the session's `ArtifactManager`). Complete saves preserve the
32
+ * historical `[raw output: artifact://<id>]` footer; capped saves carry an
33
+ * honest retained/omitted reference. A legacy string id is still accepted
34
+ * for non-tool callers and is classified from the original UTF-8 byte count.
35
+ */
36
+ onMinimizedSave?: (originalText: string, info: {
37
+ filter: string;
38
+ inputBytes: number;
39
+ outputBytes: number;
40
+ }) => Promise<BashMinimizedSaveReturn>;
4
41
  cwd?: string;
5
42
  timeout?: number | null;
6
43
  onChunk?: (chunk: string) => void;
@@ -19,24 +56,18 @@ export interface BashExecutorOptions {
19
56
  /** Artifact path/id for full output storage */
20
57
  artifactPath?: string;
21
58
  artifactId?: string;
59
+ /** Optional terminal publisher for managed artifacts without writable paths. */
60
+ artifactPublisher?: TerminalArtifactPublisher;
61
+ /** Optional Bash-specific retained tail budget in bytes. */
62
+ spillThreshold?: number;
63
+ /** Optional Bash-specific retained head budget in bytes. */
64
+ headBytes?: number;
22
65
  /** Execute without retaining a native Shell in the persistent session registry. */
23
66
  oneShot?: boolean;
24
67
  /** Ignore user-configured shell command prefixes. Used by constrained read-only shells. */
25
68
  ignoreShellPrefix?: boolean;
26
69
  /** Skip sourced shell snapshots. Used by constrained read-only shells. */
27
70
  disableShellSnapshot?: boolean;
28
- /**
29
- * Invoked when the native minimizer rewrote the command's output, giving
30
- * the caller a chance to persist the lossless original capture (typically
31
- * via the session's `ArtifactManager`). The returned id is spliced into
32
- * the sink output as `artifact://<id>` so the agent can retrieve the raw
33
- * bytes. Return `undefined` to skip the footer.
34
- */
35
- onMinimizedSave?: (originalText: string, info: {
36
- filter: string;
37
- inputBytes: number;
38
- outputBytes: number;
39
- }) => Promise<string | undefined>;
40
71
  }
41
72
  export interface BashResult {
42
73
  output: string;
@@ -48,6 +79,8 @@ export interface BashResult {
48
79
  outputLines: number;
49
80
  outputBytes: number;
50
81
  artifactId?: string;
82
+ artifactTruncatedBytes?: number;
83
+ artifactFailureDiagnostic?: string;
51
84
  }
52
85
  /** Number of persistent shell sessions currently retained (owner gauge). */
53
86
  export declare function getShellSessionCount(): number;
@@ -7,7 +7,7 @@
7
7
  * - Register commands, keyboard shortcuts, and CLI flags
8
8
  * - Interact with the user via UI primitives
9
9
  */
10
- import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLevel } from "@gajae-code/agent-core";
10
+ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, RunSettlementProof, ThinkingLevel } from "@gajae-code/agent-core";
11
11
  import type { CompactionResult } from "@gajae-code/agent-core/compaction";
12
12
  import type { Api, AssistantMessageEvent, AssistantMessageEventStream, Context, ImageContent, Model, ProviderResponseMetadata, SimpleStreamOptions, Static, TextContent, Tool, TSchema, UsageReport } from "@gajae-code/ai";
13
13
  import type { OAuthCredentials, OAuthLoginCallbacks } from "@gajae-code/ai/utils/oauth/types";
@@ -22,7 +22,7 @@ import type { ExecOptions, ExecResult } from "../../exec/exec";
22
22
  import type { CustomEditor } from "../../modes/components/custom-editor";
23
23
  import type { WorkflowGateEmitter } from "../../modes/shared/agent-wire/workflow-gate-broker";
24
24
  import type { Theme } from "../../modes/theme/theme";
25
- import type { ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "../../session/client-bridge";
25
+ import type { ClientBridge, ClientBridgePermissionOption, ClientBridgePermissionOutcome, ClientBridgePermissionToolCall } from "../../session/client-bridge";
26
26
  import type { CustomMessage } from "../../session/messages";
27
27
  import type { ReadonlySessionManager, SessionManager } from "../../session/session-manager";
28
28
  import type { BashToolDetails, BashToolInput, FindToolDetails, FindToolInput, ReadToolDetails, ReadToolInput, SearchToolDetails, SearchToolInput, WriteToolInput } from "../../tools";
@@ -249,8 +249,14 @@ export interface ExtensionContext {
249
249
  model: Model | undefined;
250
250
  /** Whether the agent is idle (not streaming) */
251
251
  isIdle(): boolean;
252
+ /** Stable resource ownership identifier for the active prompt run. */
253
+ getActivePromptHandle(): string | undefined;
252
254
  /** Abort the current agent operation */
253
255
  abort(): void;
256
+ /** Abort and prove whether resources for a specific prompt settled. */
257
+ abortPromptAndWait?(handle: string, options: {
258
+ graceMs: number;
259
+ }): Promise<RunSettlementProof>;
254
260
  /** Whether there are queued messages waiting */
255
261
  hasPendingMessages(): boolean;
256
262
  /** Typed pending-message counts per queue (steering, follow-up, next-turn). */
@@ -291,13 +297,24 @@ export interface ExtensionContext {
291
297
  } | undefined>;
292
298
  getJobs(): unknown;
293
299
  /** Typed skill and mode controls exposed to the SDK host. */
294
- invokeSkill?(name: string, args?: string): Promise<unknown>;
300
+ invokeSkill?(name: string, args?: string, options?: {
301
+ onPreflightAccepted?: () => void;
302
+ onPreflightAcceptCommit?: () => void | Promise<void>;
303
+ onSkillPrepared?: (meta: {
304
+ name: string;
305
+ path: string;
306
+ lineCount?: number;
307
+ cleanedArgs?: string;
308
+ }) => void;
309
+ }): Promise<unknown>;
295
310
  setPlanMode?(on: boolean): unknown;
296
311
  operateGoal?(op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string): Promise<unknown>;
297
312
  /** Typed nonvisual session controls exposed to the SDK host. */
298
313
  sdkControl?(operation: string, input: Record<string, unknown>): unknown | Promise<unknown>;
299
314
  /** Install a permission callback backed by a live SDK reverse provider lease. */
300
315
  setSdkPermissionProvider?(provider: ((toolCall: ClientBridgePermissionToolCall, options: ClientBridgePermissionOption[], signal?: AbortSignal) => Promise<ClientBridgePermissionOutcome>) | undefined): void;
316
+ /** Install a client bridge backed by a live SDK reverse provider lease. */
317
+ setSdkClientBridge?(bridge: ClientBridge | undefined): void;
301
318
  /** Names of session SDK seams actually installed by the active runtime. */
302
319
  sdkBindings?(): readonly string[];
303
320
  /** Gracefully shutdown and exit. */
@@ -760,6 +777,7 @@ export interface ExtensionAPI {
760
777
  sendUserMessage(content: string | (TextContent | ImageContent)[], options?: {
761
778
  deliverAs?: "steer" | "followUp";
762
779
  onPreflightAccepted?: () => void;
780
+ onPreflightAcceptCommit?: () => void | Promise<void>;
763
781
  }): Promise<void>;
764
782
  /** Append a custom entry to the session for state persistence (not sent to LLM). */
765
783
  appendEntry<T = unknown>(customType: string, data?: T): void;
@@ -933,6 +951,7 @@ options?: {
933
951
  export type SendUserMessageHandler = (content: string | (TextContent | ImageContent)[], options?: {
934
952
  deliverAs?: "steer" | "followUp";
935
953
  onPreflightAccepted?: () => void;
954
+ onPreflightAcceptCommit?: () => void | Promise<void>;
936
955
  }) => void | Promise<void>;
937
956
  export type AppendEntryHandler = <T = unknown>(customType: string, data?: T) => void;
938
957
  export type GetActiveToolsHandler = () => string[];
@@ -990,7 +1009,12 @@ export interface ExtensionActions {
990
1009
  export interface ExtensionContextActions {
991
1010
  getModel: () => Model | undefined;
992
1011
  isIdle: () => boolean;
1012
+ /** Stable resource ownership identifier for the active prompt run. */
1013
+ getActivePromptHandle?: () => string | undefined;
993
1014
  abort: () => void;
1015
+ abortPromptAndWait?: (handle: string, options: {
1016
+ graceMs: number;
1017
+ }) => Promise<RunSettlementProof>;
994
1018
  hasPendingMessages: () => boolean;
995
1019
  /** Typed pending-message counts per queue; optional for embedders without a counted queue. */
996
1020
  getPendingMessageCounts?: () => {
@@ -1036,8 +1060,18 @@ export interface ExtensionContextActions {
1036
1060
  } | undefined>;
1037
1061
  getJobs?: () => unknown;
1038
1062
  setSdkPermissionProvider?: (provider: ((toolCall: ClientBridgePermissionToolCall, options: ClientBridgePermissionOption[], signal?: AbortSignal) => Promise<ClientBridgePermissionOutcome>) | undefined) => void;
1063
+ setSdkClientBridge?: (bridge: ClientBridge | undefined) => void;
1039
1064
  sdkControl?: (operation: string, input: Record<string, unknown>) => unknown | Promise<unknown>;
1040
- invokeSkill?: (name: string, args?: string) => Promise<unknown>;
1065
+ invokeSkill?: (name: string, args?: string, options?: {
1066
+ onPreflightAccepted?: () => void;
1067
+ onPreflightAcceptCommit?: () => void | Promise<void>;
1068
+ onSkillPrepared?: (meta: {
1069
+ name: string;
1070
+ path: string;
1071
+ lineCount?: number;
1072
+ cleanedArgs?: string;
1073
+ }) => void;
1074
+ }) => Promise<unknown>;
1041
1075
  setPlanMode?: (on: boolean) => unknown;
1042
1076
  operateGoal?: (op: "create" | "get" | "resume" | "pause" | "complete" | "drop", objective?: string) => Promise<unknown>;
1043
1077
  }
@@ -2,14 +2,24 @@ export * from "./activation";
2
2
  export * from "./compiler";
3
3
  export * from "./constrained-hooks";
4
4
  export * from "./injection";
5
- export * from "./installer";
5
+ /**
6
+ * Public barrel. Mutation primitives are deliberately NOT re-exported here:
7
+ * `lifecycle.ts` is the sole policy and persistence writer, so the installer
8
+ * transaction and the registry writers stay reachable only through their own
9
+ * modules. Re-exporting them would let a caller commit a replacement and
10
+ * bypass the create-only rule.
11
+ */
12
+ export { isGjcPluginBundleSource, isGjcPluginSourceShape } from "./installer";
13
+ export * from "./lifecycle";
14
+ export * from "./lifecycle-reconciliation";
6
15
  export * from "./loader";
7
16
  export * from "./mcp-policy";
8
17
  export * from "./observability";
9
18
  export * from "./paths";
10
19
  export * from "./prompt-appendix";
11
- export * from "./registry";
20
+ export { loadEffectiveGjcPluginRegistry, readRegistry, registryEntryFingerprint, registryPathForScope, registryRootForScope, sortRegistryEntries, } from "./registry";
12
21
  export * from "./runtime-adapters";
22
+ export * from "./runtime-quarantine";
13
23
  export * from "./schema";
14
24
  export * from "./session-validation";
15
25
  export * from "./state";
@@ -1,13 +1,69 @@
1
- import { type GjcPluginRegistryEntry, type GjcPluginScope } from "./types";
2
- export interface InstallGjcPluginOptions {
1
+ import { type GjcLifecycleError, type GjcPluginRegistry, type GjcPluginRegistryEntry, type GjcPluginRegistrySource, type GjcPluginScope, type NormalizedGjcPluginBundle } from "./types";
2
+ export interface GjcBundleTransactionOptions {
3
3
  scope: GjcPluginScope;
4
4
  cwd: string;
5
- force?: boolean;
5
+ /**
6
+ * Policy hook evaluated while both scope locks are held. It decides whether
7
+ * to commit the candidate, report an already-satisfied no-op, or abort with
8
+ * a typed lifecycle error. Only the lifecycle service supplies this.
9
+ */
10
+ decide: (input: GjcBundleTransactionContext) => Promise<GjcBundleTransactionDecision>;
6
11
  }
7
- export interface InstallGjcPluginResult {
8
- status: "installed" | "updated" | "unchanged";
9
- entry: GjcPluginRegistryEntry;
12
+ export interface GjcBundleTransactionContext {
13
+ targetRegistry: GjcPluginRegistry;
14
+ /** Both scopes, deterministically sorted, for cross-scope decisions. */
15
+ effective: GjcPluginRegistryEntry[];
16
+ existing: GjcPluginRegistryEntry | undefined;
17
+ bundle: NormalizedGjcPluginBundle;
18
+ /** Entry the candidate would produce if committed as-is. */
19
+ candidate: GjcPluginRegistryEntry;
10
20
  }
11
- export declare function installGjcPluginBundle(source: string, options: InstallGjcPluginOptions): Promise<InstallGjcPluginResult>;
21
+ export type GjcBundleTransactionDecision = {
22
+ kind: "commit";
23
+ entry: GjcPluginRegistryEntry;
24
+ } | {
25
+ kind: "noop";
26
+ entry: GjcPluginRegistryEntry;
27
+ } | {
28
+ kind: "abort";
29
+ error: GjcLifecycleError;
30
+ };
31
+ export type GjcBundleTransactionResult = {
32
+ status: "committed";
33
+ entry: GjcPluginRegistryEntry;
34
+ remnants: string[];
35
+ } | {
36
+ status: "noop";
37
+ entry: GjcPluginRegistryEntry;
38
+ remnants: string[];
39
+ } | {
40
+ status: "aborted";
41
+ error: GjcLifecycleError;
42
+ remnants: string[];
43
+ };
44
+ /**
45
+ * Serialized bundle transaction: prepare outside the locks, then hold the
46
+ * user->project locks in a fixed order so the decision sees a consistent
47
+ * cross-scope view. Only the target scope is ever committed.
48
+ */
49
+ export declare function runGjcBundleTransaction(source: string, options: GjcBundleTransactionOptions): Promise<GjcBundleTransactionResult>;
50
+ /** Compile a source into a validated candidate bundle without touching disk state. */
51
+ export declare function resolveGjcBundleCandidate<T>(source: string, fn: (input: {
52
+ bundle: NormalizedGjcPluginBundle;
53
+ source: GjcPluginRegistrySource;
54
+ }) => Promise<T>): Promise<T>;
55
+ /** Build the registry entry a candidate bundle would produce at a target path. */
56
+ export declare function candidateRegistryEntry(bundle: NormalizedGjcPluginBundle, scope: GjcPluginScope, cwd: string, source: GjcPluginRegistrySource, now: string): GjcPluginRegistryEntry;
57
+ /**
58
+ * True when a spec has the SHAPE of a GJC bundle source: a filesystem path, a
59
+ * git locator, or a tarball. This is a pure string test that never touches the
60
+ * filesystem or the network, so a deleted or unreachable source is still
61
+ * recognised as GJC-intent and can reach the lifecycle's typed refusal instead
62
+ * of falling through to npm.
63
+ *
64
+ * npm and marketplace specs are never path/git/tarball shaped, so this cleanly
65
+ * separates the two install worlds.
66
+ */
67
+ export declare function isGjcPluginSourceShape(source: string): boolean;
12
68
  /** True only when the source actually resolves to a GJC plugin bundle (root gajae-plugin.json). */
13
69
  export declare function isGjcPluginBundleSource(source: string): Promise<boolean>;
@@ -0,0 +1,55 @@
1
+ import { type GjcBundleIdentity, type GjcPluginQuarantineEntry, type GjcPluginRegistryEntry, type GjcPluginScope, type NormalizedGjcPluginBundle, type NormalizedGjcPluginSurfaces } from "./types";
2
+ export declare function bundleIdentity(scope: GjcPluginScope, name: string): GjcBundleIdentity;
3
+ export declare function identityKey(identity: GjcBundleIdentity): string;
4
+ export declare function identityEquals(a: GjcBundleIdentity, b: GjcBundleIdentity): boolean;
5
+ /** All stable surface IDs of a surface set, sorted and de-duplicated. */
6
+ export declare function surfaceIdsOf(surfaces: NormalizedGjcPluginSurfaces): string[];
7
+ /**
8
+ * Fingerprint of the exact installed target: identity plus the persisted bytes
9
+ * that any update must not silently replace.
10
+ */
11
+ export declare function targetFingerprint(entry: GjcPluginRegistryEntry): string;
12
+ /**
13
+ * Fingerprint of the exact installed baseline an update compares against: the
14
+ * installed content, the persisted enablement intent it must carry forward,
15
+ * and the stored source descriptor the update re-resolves from.
16
+ *
17
+ * Toggling the bundle or any surface changes this, so a preview taken before
18
+ * the toggle can no longer be applied. Binding the source matters just as much:
19
+ * apply re-resolves `entry.source.uri` before taking the locks, so a descriptor
20
+ * that changed in between must invalidate the reviewed baseline rather than let
21
+ * an update be committed from a locator the reviewer never saw.
22
+ */
23
+ export declare function baselineFingerprint(entry: GjcPluginRegistryEntry): string;
24
+ /** Fingerprint of an update candidate before it is written anywhere. */
25
+ export declare function candidateFingerprint(scope: GjcPluginScope, bundle: NormalizedGjcPluginBundle): string;
26
+ /**
27
+ * Fingerprint of everything besides the target and candidate bytes that the
28
+ * update decision depended on: opposite-scope same-name entries and the
29
+ * effective collision universe.
30
+ */
31
+ export declare function decisionContextFingerprint(target: GjcBundleIdentity, effectiveEntries: readonly GjcPluginRegistryEntry[]): string;
32
+ /**
33
+ * Fingerprint of the inputs that decide live activation. Changes here (and only
34
+ * here) advance the activation generation.
35
+ */
36
+ export declare function activationFingerprint(entries: readonly GjcPluginRegistryEntry[]): string;
37
+ export interface ReconciledEnablement {
38
+ disabledSurfaceIds: string[];
39
+ quarantine: GjcPluginQuarantineEntry[];
40
+ }
41
+ /**
42
+ * Carry persisted enablement intent across an update:
43
+ * - surviving disabled IDs stay disabled,
44
+ * - IDs whose surface disappeared are dropped,
45
+ * - new surface IDs are enabled by omission,
46
+ * - quarantine is recomputed from candidateQuarantine against the candidate's
47
+ * surface set; omitted input means no candidate quarantine is justified.
48
+ */
49
+ export declare function reconcileEnablement(previousDisabledSurfaceIds: readonly string[], candidateSurfaceIds: readonly string[], candidateQuarantine?: readonly GjcPluginQuarantineEntry[]): ReconciledEnablement;
50
+ export interface SurfaceDelta {
51
+ addedSurfaceIds: string[];
52
+ removedSurfaceIds: string[];
53
+ retainedSurfaceIds: string[];
54
+ }
55
+ export declare function diffSurfaceIds(currentSurfaceIds: readonly string[], candidateSurfaceIds: readonly string[]): SurfaceDelta;
@@ -0,0 +1,64 @@
1
+ import type { GjcBundleIdentity, GjcBundleSummary, GjcInstallResult, GjcLifecycleResult, GjcPluginRegistryEntry, GjcPluginRegistrySource, GjcPluginScope, GjcReviewedUpdateToken, GjcToggleResult, GjcUpdateApplyResult, GjcUpdatePreview } from "./types";
2
+ /**
3
+ * GJC bundle lifecycle service.
4
+ *
5
+ * This module is the ONLY policy and persistence writer for GJC bundles: fresh
6
+ * install, update preview/apply, bundle enable/disable, and surface
7
+ * enable/disable. Callers (CLI, Settings) never touch the registry writers or
8
+ * the installer transaction directly.
9
+ */
10
+ export interface GjcLifecycleContext {
11
+ cwd: string;
12
+ }
13
+ export declare function redactSourceLocator(source: GjcPluginRegistrySource): string;
14
+ /** Safe, redacted DTO for one installed bundle. */
15
+ export declare function toBundleSummary(entry: GjcPluginRegistryEntry): GjcBundleSummary;
16
+ /**
17
+ * Rebuild the exact locator an update must re-resolve from. A git ref is stored
18
+ * separately from the URI, so re-resolving the bare URI would silently drop the
19
+ * reviewed branch or tag and update from the default branch instead.
20
+ */
21
+ declare function storedSourceLocator(source: GjcPluginRegistrySource): string;
22
+ /** Exposed for locator-reconstruction tests; not part of the lifecycle API. */
23
+ export declare const storedSourceLocatorForTest: typeof storedSourceLocator;
24
+ /** Exposed so a test can pin parity with the installer's source predicates. */
25
+ export declare const isLocalDirectorySourceForTest: typeof isLocalDirectorySource;
26
+ /** All installed bundles across both scopes, deterministically ordered. */
27
+ export declare function listGjcBundles(ctx: GjcLifecycleContext): Promise<GjcBundleSummary[]>;
28
+ /** One bundle by exact (scope, name) identity. Opposite scope never matches. */
29
+ export declare function getGjcBundle(ctx: GjcLifecycleContext, identity: GjcBundleIdentity): Promise<GjcLifecycleResult<GjcBundleSummary>>;
30
+ /**
31
+ * True only for strings the installer would treat as a local path rather than
32
+ * a remote locator. This deliberately mirrors the installer's own `looksLikeGit`
33
+ * predicate: if the two ever disagreed, a remote locator could be read as a
34
+ * relative path and shadowed by a local directory of the same shape.
35
+ */
36
+ declare function isLocalDirectorySource(source: string): boolean;
37
+ /**
38
+ * Fresh install only. An existing target in the same scope is create-only and
39
+ * is refused identically with or without force; upgrading is a separate,
40
+ * scope-qualified operation.
41
+ */
42
+ export declare function installGjcBundle(ctx: GjcLifecycleContext, scope: GjcPluginScope, source: string): Promise<GjcLifecycleResult<GjcInstallResult>>;
43
+ /**
44
+ * Re-resolve the stored source descriptor and describe what an update would do.
45
+ * The returned token binds the candidate, the exact installed baseline, and the
46
+ * deterministic decision context; apply is a compare-and-swap on all three.
47
+ */
48
+ export declare function previewGjcBundleUpdate(ctx: GjcLifecycleContext, identity: GjcBundleIdentity): Promise<GjcLifecycleResult<GjcUpdatePreview>>;
49
+ /**
50
+ * Apply a previously reviewed update. Any drift in the candidate bytes, the
51
+ * installed baseline, or the decision context returns a typed stale error with
52
+ * zero mutation.
53
+ */
54
+ export declare function applyGjcBundleUpdate(ctx: GjcLifecycleContext, token: GjcReviewedUpdateToken): Promise<GjcLifecycleResult<GjcUpdateApplyResult>>;
55
+ /**
56
+ * Enable or disable a whole bundle. Deterministic quarantine blocks enabling;
57
+ * disabling is always allowed so operators can always de-escalate.
58
+ */
59
+ export declare function setGjcBundleEnabled(ctx: GjcLifecycleContext, identity: GjcBundleIdentity, enabled: boolean): Promise<GjcLifecycleResult<GjcToggleResult>>;
60
+ /** Enable or disable one surface of a bundle by its stable extension ID. */
61
+ export declare function setGjcBundleSurfaceEnabled(ctx: GjcLifecycleContext, identity: GjcBundleIdentity, surfaceId: string, enabled: boolean): Promise<GjcLifecycleResult<GjcToggleResult>>;
62
+ /** Deterministic activation generation for the current persisted state. */
63
+ export declare function currentActivationFingerprint(ctx: GjcLifecycleContext): Promise<string>;
64
+ export {};
@@ -0,0 +1,67 @@
1
+ import type { GjcBundleIdentity, GjcRuntimeFinding, GjcRuntimeSnapshot, GjcRuntimeSnapshotState } from "./types";
2
+ /**
3
+ * Deterministic numeric activation generation for an activation fingerprint.
4
+ *
5
+ * Equal activation inputs yield an equal generation, so a consumer holding a
6
+ * snapshot can tell whether it still describes the state it is rendering.
7
+ * Derived from the fingerprint's leading hex so it stays inside the safe
8
+ * integer range.
9
+ */
10
+ export declare function gjcActivationGenerationFor(activationFingerprint: string): number;
11
+ /**
12
+ * Caller-owned accumulator for scope-qualified runtime evidence.
13
+ *
14
+ * Producers (loaders, adapters, validators) hand findings to an accumulator
15
+ * they were given; they never publish. Exactly one coordinator publishes a
16
+ * complete generation snapshot, and consumers merge it only when the identity
17
+ * and generation match.
18
+ */
19
+ export declare class GjcRuntimeFindingAccumulator {
20
+ readonly generation: number;
21
+ private readonly findings;
22
+ constructor(generation: number);
23
+ add(finding: GjcRuntimeFinding): void;
24
+ addAll(findings: readonly GjcRuntimeFinding[]): void;
25
+ /** Sorted, de-duplicated snapshot for the generation this accumulator owns. */
26
+ snapshot(): GjcRuntimeSnapshot;
27
+ }
28
+ /** Read-only view of the most recently published complete generation. */
29
+ export interface GjcRuntimeSnapshotProvider {
30
+ current(): GjcRuntimeSnapshotState;
31
+ }
32
+ /**
33
+ * Single-writer publisher for runtime evidence.
34
+ *
35
+ * Passes can overlap: the session's prompt rebuild is re-entrant, so a second
36
+ * pass may start while a first is still awaiting its producers. Publication is
37
+ * therefore fenced by a monotonic epoch. A pass reserves an epoch when it
38
+ * begins, which immediately retires whatever was published before, and its
39
+ * later publish is accepted only if no newer pass has reserved since. A slow or
40
+ * failed older pass can never overwrite a newer one, and an incomplete pass
41
+ * simply never publishes, leaving consumers at `unavailable`.
42
+ */
43
+ export declare class GjcRuntimeSnapshotStore implements GjcRuntimeSnapshotProvider {
44
+ private state;
45
+ private epoch;
46
+ /**
47
+ * Begin a pass. Retires the current snapshot and returns the epoch token the
48
+ * caller must present to publish.
49
+ */
50
+ beginPass(): number;
51
+ /** Publish only if `epoch` is still the newest reserved pass. */
52
+ publish(snapshot: GjcRuntimeSnapshot, epoch?: number): void;
53
+ invalidate(): void;
54
+ current(): GjcRuntimeSnapshotState;
55
+ }
56
+ /**
57
+ * Findings for one bundle, but only when the snapshot is current AND describes
58
+ * the exact generation the consumer is rendering. Missing provider, mismatched
59
+ * generation, or unavailable state resolve to `unavailable` — never to a
60
+ * silently empty "clear" result.
61
+ */
62
+ export declare function findingsForBundle(provider: GjcRuntimeSnapshotProvider | undefined, identity: GjcBundleIdentity, expectedGeneration: number): {
63
+ status: "unavailable";
64
+ } | {
65
+ status: "current";
66
+ findings: GjcRuntimeFinding[];
67
+ };
@@ -1,4 +1,4 @@
1
- import type { GjcPluginLoadErrorCode, GjcPluginRegistryEntry } from "./types";
1
+ import type { GjcBundleIdentity, GjcPluginLoadErrorCode, GjcPluginRegistryEntry } from "./types";
2
2
  /**
3
3
  * Session-start validation: the registry is the collision authority. Capability
4
4
  * provider output is supplied as EVIDENCE only; plugin surfaces are never
@@ -16,6 +16,8 @@ export interface SessionCapabilityEvidence {
16
16
  appendixIds?: Iterable<string>;
17
17
  }
18
18
  export interface SessionQuarantine {
19
+ /** Scope-qualified canonical target this finding belongs to. */
20
+ identity: GjcBundleIdentity;
19
21
  plugin: string;
20
22
  surfaceId: string;
21
23
  code: GjcPluginLoadErrorCode;
@@ -218,3 +218,127 @@ export interface GjcPluginRegistry {
218
218
  * disabledSurfaceIds, and quarantine bookkeeping.
219
219
  */
220
220
  export type GjcPluginSurfaceExtensionId = string;
221
+ /** Canonical GJC bundle identity: kind is fixed, target is (scope, name). */
222
+ export declare const GJC_BUNDLE_KIND = "gjc-bundle";
223
+ export interface GjcBundleIdentity {
224
+ kind: typeof GJC_BUNDLE_KIND;
225
+ scope: GjcPluginScope;
226
+ name: string;
227
+ }
228
+ /** Source descriptor exposed to CLI/Settings: never carries raw locator secrets. */
229
+ export interface GjcBundleSafeSource {
230
+ kind: GjcPluginSourceKind;
231
+ /** Redacted display locator (host + path only; no userinfo/query/fragment). */
232
+ display: string;
233
+ /** Conservative safe git ref, omitted when the stored value is unsafe. */
234
+ ref?: string;
235
+ /** Hex-only revision identifier, omitted when the stored value is unsafe. */
236
+ sha?: string;
237
+ resolvedAt: string;
238
+ /** True when this source kind supports re-resolution during update. */
239
+ updatable: boolean;
240
+ /** Present only when updatable is false. */
241
+ unsupportedReason?: string;
242
+ }
243
+ export interface GjcBundleSurfaceSummary {
244
+ extensionId: string;
245
+ kind: "tool" | "hook" | "mcp" | "system-appendix" | "agent-appendix" | "subskill";
246
+ name: string;
247
+ /** Persisted user intent (registry disabledSurfaceIds). */
248
+ enabled: boolean;
249
+ /** Deterministic quarantine derived from persisted registry state only. */
250
+ quarantined: boolean;
251
+ quarantineCode?: GjcPluginLoadErrorCode;
252
+ }
253
+ /** Installed-bundle DTO shared by CLI and Settings. Contains no raw locators. */
254
+ export interface GjcBundleSummary {
255
+ identity: GjcBundleIdentity;
256
+ version: string;
257
+ description?: string;
258
+ enabled: boolean;
259
+ source: GjcBundleSafeSource;
260
+ installedAt: string;
261
+ updatedAt: string;
262
+ manifestHash: string;
263
+ /** Deterministic fingerprint of the exact installed target. */
264
+ targetFingerprint: string;
265
+ surfaces: GjcBundleSurfaceSummary[];
266
+ /** True when any deterministic quarantine blocks enablement. */
267
+ quarantined: boolean;
268
+ }
269
+ /**
270
+ * Host-derived token binding an update preview to the exact candidate, the
271
+ * exact installed baseline, and the deterministic decision context. Apply is a
272
+ * compare-and-swap against all three fingerprints.
273
+ */
274
+ export interface GjcReviewedUpdateToken {
275
+ identity: GjcBundleIdentity;
276
+ candidateFingerprint: string;
277
+ baselineFingerprint: string;
278
+ decisionContextFingerprint: string;
279
+ reviewedAt: string;
280
+ }
281
+ export type GjcLifecycleErrorCode = "already_installed_use_upgrade" | "not_installed" | "identity_mismatch" | "stale_candidate" | "stale_baseline" | "stale_decision_context" | "source_unsupported" | "source_unavailable" | "quarantined" | "surface_unknown" | "invalid_target";
282
+ export interface GjcLifecycleError {
283
+ code: GjcLifecycleErrorCode;
284
+ /** Sanitized operator-facing message; never contains raw locators or causes. */
285
+ message: string;
286
+ /** Safe scoped recovery hint (e.g. the exact command to run instead). */
287
+ recovery?: string;
288
+ }
289
+ export type GjcLifecycleResult<T> = {
290
+ ok: true;
291
+ value: T;
292
+ } | {
293
+ ok: false;
294
+ error: GjcLifecycleError;
295
+ };
296
+ export interface GjcUpdatePreview {
297
+ identity: GjcBundleIdentity;
298
+ current: GjcBundleSummary;
299
+ candidateVersion: string;
300
+ candidateManifestHash: string;
301
+ /** Surface IDs added, removed, or retained by this candidate. */
302
+ addedSurfaceIds: string[];
303
+ removedSurfaceIds: string[];
304
+ retainedSurfaceIds: string[];
305
+ changed: boolean;
306
+ token: GjcReviewedUpdateToken;
307
+ }
308
+ export type GjcUpdateApplyStatus = "updated" | "unchanged";
309
+ export interface GjcUpdateApplyResult {
310
+ status: GjcUpdateApplyStatus;
311
+ summary: GjcBundleSummary;
312
+ /** Number of filesystem remnants that could not be removed after a successful swap. */
313
+ remnantCount: number;
314
+ }
315
+ export interface GjcInstallResult {
316
+ status: "installed";
317
+ summary: GjcBundleSummary;
318
+ }
319
+ export interface GjcToggleResult {
320
+ summary: GjcBundleSummary;
321
+ /** False when the requested state already matched (no persisted mutation). */
322
+ mutated: boolean;
323
+ }
324
+ /**
325
+ * Scope-qualified runtime evidence emitted by producers. Producers never
326
+ * publish; the session coordinator accumulates one complete generation.
327
+ */
328
+ export interface GjcRuntimeFinding {
329
+ identity: GjcBundleIdentity;
330
+ surfaceId: string;
331
+ code: GjcPluginLoadErrorCode;
332
+ message: string;
333
+ }
334
+ export interface GjcRuntimeSnapshot {
335
+ /** Monotonic activation generation this snapshot describes. */
336
+ generation: number;
337
+ findings: GjcRuntimeFinding[];
338
+ }
339
+ export type GjcRuntimeSnapshotState = {
340
+ status: "unavailable";
341
+ } | {
342
+ status: "current";
343
+ snapshot: GjcRuntimeSnapshot;
344
+ };