@gajae-code/coding-agent 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/dist/types/async/job-manager.d.ts +17 -3
  3. package/dist/types/config/settings-schema.d.ts +56 -2
  4. package/dist/types/exa/mcp-client.d.ts +10 -1
  5. package/dist/types/exec/bash-executor.d.ts +45 -12
  6. package/dist/types/extensibility/extensions/types.d.ts +16 -2
  7. package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
  8. package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
  9. package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
  10. package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
  11. package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
  12. package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
  13. package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
  14. package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
  15. package/dist/types/gjc-runtime/ralplan-review-conflicts.d.ts +114 -0
  16. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +23 -3
  17. package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
  18. package/dist/types/gjc-runtime/team-runtime.d.ts +25 -0
  19. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
  20. package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +10 -0
  21. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +37 -80
  22. package/dist/types/modes/acp/acp-agent.d.ts +2 -19
  23. package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
  24. package/dist/types/modes/components/irc-sidebar.d.ts +16 -0
  25. package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
  26. package/dist/types/modes/components/session-observer-overlay.d.ts +18 -0
  27. package/dist/types/modes/components/settings-selector.d.ts +9 -0
  28. package/dist/types/modes/components/status-line/gh.d.ts +5 -0
  29. package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
  30. package/dist/types/modes/controllers/command-controller.d.ts +1 -1
  31. package/dist/types/modes/controllers/event-controller.d.ts +1 -1
  32. package/dist/types/modes/controllers/extension-ui-controller.d.ts +2 -1
  33. package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
  34. package/dist/types/modes/interactive-mode.d.ts +9 -0
  35. package/dist/types/modes/theme/theme.d.ts +3 -1
  36. package/dist/types/modes/types.d.ts +32 -0
  37. package/dist/types/reminders/star-reminder.d.ts +3 -13
  38. package/dist/types/runtime-mcp/manager.d.ts +1 -0
  39. package/dist/types/sdk/acp/adapter.d.ts +3 -1
  40. package/dist/types/sdk/broker/transport.d.ts +2 -0
  41. package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
  42. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  43. package/dist/types/sdk/bus/config.d.ts +6 -2
  44. package/dist/types/sdk/bus/index.d.ts +29 -0
  45. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +8 -1
  46. package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
  47. package/dist/types/sdk/bus/reconciliation-store.d.ts +7 -3
  48. package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
  49. package/dist/types/sdk/bus/rich-render.d.ts +2 -0
  50. package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
  51. package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
  52. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -4
  53. package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
  54. package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
  55. package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
  56. package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
  57. package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
  58. package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
  59. package/dist/types/sdk/prompt-status.d.ts +23 -3
  60. package/dist/types/sdk/session.d.ts +6 -0
  61. package/dist/types/session/agent-session.d.ts +40 -2
  62. package/dist/types/session/artifacts.d.ts +8 -0
  63. package/dist/types/session/blob-store.d.ts +57 -4
  64. package/dist/types/session/internal/managed-session-storage.d.ts +30 -4
  65. package/dist/types/session/session-manager.d.ts +23 -6
  66. package/dist/types/session/session-storage.d.ts +4 -0
  67. package/dist/types/session/streaming-output.d.ts +36 -7
  68. package/dist/types/setup/credential-import.d.ts +12 -0
  69. package/dist/types/skill-state/active-state.d.ts +12 -0
  70. package/dist/types/skill-state/workflow-hud.d.ts +6 -0
  71. package/dist/types/task/executor.d.ts +3 -2
  72. package/dist/types/task/index.d.ts +7 -1
  73. package/dist/types/task/output-manager.d.ts +1 -0
  74. package/dist/types/task/provider-retry-status.d.ts +8 -0
  75. package/dist/types/task/receipt.d.ts +9 -1
  76. package/dist/types/task/types.d.ts +23 -0
  77. package/dist/types/tools/ask-answer-registry.d.ts +2 -2
  78. package/dist/types/tools/bash-interactive.d.ts +4 -1
  79. package/dist/types/tools/bash.d.ts +3 -1
  80. package/dist/types/tools/image-gen.d.ts +4 -0
  81. package/dist/types/tools/index.d.ts +6 -0
  82. package/dist/types/tools/output-meta.d.ts +23 -2
  83. package/dist/types/tools/path-utils.d.ts +1 -0
  84. package/dist/types/tools/read.d.ts +0 -6
  85. package/dist/types/tools/review.d.ts +5 -7
  86. package/dist/types/tools/subagent.d.ts +2 -0
  87. package/dist/types/utils/gh.d.ts +13 -0
  88. package/dist/types/utils/image-resize.d.ts +1 -0
  89. package/dist/types/web/search/providers/kimi.d.ts +2 -0
  90. package/dist/types/web/search/providers/searxng.d.ts +7 -0
  91. package/dist/types/web/search/providers/xai.d.ts +2 -0
  92. package/package.json +10 -8
  93. package/scripts/acp-conformance-agent.ts +218 -0
  94. package/scripts/capture-gjc-bundle-settings.ts +306 -0
  95. package/scripts/dogfood-ralplan-review-conflicts.ts +272 -0
  96. package/scripts/generate-sdk-operation-inventory.ts +5 -0
  97. package/scripts/resident-memory-bench.ts +1341 -0
  98. package/scripts/run-acp-conformance.ts +290 -0
  99. package/src/async/job-manager.ts +99 -39
  100. package/src/cli/fast-help.ts +1 -1
  101. package/src/cli/plugin-cli.ts +176 -18
  102. package/src/commands/team.ts +19 -1
  103. package/src/config/file-lock.ts +11 -2
  104. package/src/config/settings-schema.ts +53 -2
  105. package/src/coordinator-mcp/question-gate-codec.ts +1 -1
  106. package/src/coordinator-mcp/server.ts +5 -12
  107. package/src/debug/index.ts +42 -17
  108. package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -0
  109. package/src/defaults/gjc/skills/ralplan/SKILL.md +25 -20
  110. package/src/defaults/gjc/skills/team/SKILL.md +2 -0
  111. package/src/defaults/gjc/skills/ultragoal/SKILL.md +39 -26
  112. package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
  113. package/src/defaults/gjc-defaults.ts +4 -4
  114. package/src/exa/mcp-client.ts +12 -3
  115. package/src/exec/bash-executor.ts +144 -27
  116. package/src/extensibility/extensions/runner.ts +15 -0
  117. package/src/extensibility/extensions/types.ts +18 -1
  118. package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
  119. package/src/extensibility/gjc-plugins/index.ts +19 -2
  120. package/src/extensibility/gjc-plugins/installer.ts +189 -50
  121. package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
  122. package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
  123. package/src/extensibility/gjc-plugins/observability.ts +3 -3
  124. package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
  125. package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
  126. package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
  127. package/src/extensibility/gjc-plugins/schema.ts +84 -12
  128. package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
  129. package/src/extensibility/gjc-plugins/types.ts +141 -0
  130. package/src/extensibility/gjc-plugins/validation.ts +9 -0
  131. package/src/gjc-runtime/launch-tmux.ts +25 -6
  132. package/src/gjc-runtime/launch-worktree.ts +103 -1
  133. package/src/gjc-runtime/ledger-event-renderer.ts +1 -0
  134. package/src/gjc-runtime/managed-owner-admission.ts +1 -1
  135. package/src/gjc-runtime/ralplan-review-conflicts.ts +472 -0
  136. package/src/gjc-runtime/ralplan-runtime.ts +491 -27
  137. package/src/gjc-runtime/team-launch.ts +8 -0
  138. package/src/gjc-runtime/team-runtime.ts +140 -32
  139. package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
  140. package/src/gjc-runtime/tmux-owner-isolation.ts +10 -0
  141. package/src/gjc-runtime/tmux-sessions.ts +58 -13
  142. package/src/gjc-runtime/ultragoal-evidence.ts +6 -74
  143. package/src/gjc-runtime/ultragoal-runtime.ts +635 -612
  144. package/src/gjc-runtime/workflow-manifest.generated.json +37 -99
  145. package/src/gjc-runtime/workflow-manifest.ts +21 -70
  146. package/src/internal-urls/docs-index.generated.ts +16 -16
  147. package/src/modes/DESIGN.md +104 -0
  148. package/src/modes/acp/acp-agent.ts +298 -186
  149. package/src/modes/components/gjc-bundle-settings.ts +508 -0
  150. package/src/modes/components/irc-sidebar.ts +30 -1
  151. package/src/modes/components/notifications-settings-editor.ts +12 -1
  152. package/src/modes/components/oauth-selector.ts +68 -30
  153. package/src/modes/components/session-observer-overlay.ts +305 -86
  154. package/src/modes/components/settings-selector.ts +56 -5
  155. package/src/modes/components/status-line/gh.ts +16 -0
  156. package/src/modes/components/tool-status-header.ts +3 -15
  157. package/src/modes/components/transcript-viewer-overlay.ts +99 -24
  158. package/src/modes/controllers/command-controller.ts +42 -34
  159. package/src/modes/controllers/event-controller.ts +27 -16
  160. package/src/modes/controllers/extension-ui-controller.ts +193 -34
  161. package/src/modes/controllers/selector-controller.ts +160 -22
  162. package/src/modes/interactive-mode.ts +189 -62
  163. package/src/modes/jobs-observer.ts +1 -1
  164. package/src/modes/runtime-init.ts +3 -0
  165. package/src/modes/theme/theme.ts +11 -9
  166. package/src/modes/types.ts +88 -0
  167. package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
  168. package/src/prompts/system/eager-todo.md +8 -4
  169. package/src/prompts/system/system-prompt.md +11 -4
  170. package/src/prompts/tools/bash.md +5 -5
  171. package/src/prompts/tools/search-tool-bm25.md +5 -0
  172. package/src/prompts/tools/task.md +1 -1
  173. package/src/reminders/star-reminder.ts +4 -42
  174. package/src/runtime-mcp/manager.ts +19 -4
  175. package/src/sdk/acp/adapter.ts +22 -6
  176. package/src/sdk/broker/lifecycle.ts +18 -13
  177. package/src/sdk/broker/transport.ts +35 -3
  178. package/src/sdk/bus/attachment-registry.ts +5 -1
  179. package/src/sdk/bus/chat-daemon-cli.ts +4 -39
  180. package/src/sdk/bus/chat-daemon-control.ts +7 -3
  181. package/src/sdk/bus/config.ts +18 -2
  182. package/src/sdk/bus/index.ts +661 -126
  183. package/src/sdk/bus/kind-aware-reconciliation.ts +148 -73
  184. package/src/sdk/bus/lifecycle-commands.ts +4 -1
  185. package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
  186. package/src/sdk/bus/reconciliation-store.ts +95 -16
  187. package/src/sdk/bus/rich-draft.ts +1 -1
  188. package/src/sdk/bus/rich-render.ts +2 -2
  189. package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
  190. package/src/sdk/bus/telegram-cli.ts +33 -8
  191. package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
  192. package/src/sdk/bus/telegram-daemon-contract.ts +12 -4
  193. package/src/sdk/bus/telegram-daemon.ts +916 -23
  194. package/src/sdk/bus/telegram-reference.ts +40 -3
  195. package/src/sdk/bus/threaded-render.ts +48 -3
  196. package/src/sdk/bus/topic-registry.ts +20 -0
  197. package/src/sdk/host/query/revision-store.ts +36 -2
  198. package/src/sdk/host/reverse-leases.ts +44 -7
  199. package/src/sdk/prompt-status.ts +16 -3
  200. package/src/sdk/protocol/operation-inventory.generated.json +33 -0
  201. package/src/sdk/session.ts +89 -9
  202. package/src/session/agent-session.ts +844 -173
  203. package/src/session/artifacts.ts +22 -0
  204. package/src/session/auth-broker-config.ts +10 -3
  205. package/src/session/blob-store.ts +915 -24
  206. package/src/session/internal/managed-session-scope.ts +200 -111
  207. package/src/session/internal/managed-session-storage.ts +492 -62
  208. package/src/session/session-manager.ts +1614 -435
  209. package/src/session/session-storage.ts +38 -45
  210. package/src/session/streaming-output.ts +238 -68
  211. package/src/setup/credential-import.ts +75 -13
  212. package/src/skill-state/active-state.ts +32 -0
  213. package/src/skill-state/workflow-hud.ts +17 -0
  214. package/src/skill-state/workflow-mutation-guard.ts +496 -2
  215. package/src/task/executor.ts +122 -39
  216. package/src/task/index.ts +280 -45
  217. package/src/task/output-manager.ts +24 -14
  218. package/src/task/provider-retry-status.ts +16 -0
  219. package/src/task/receipt.ts +34 -8
  220. package/src/task/render.ts +6 -2
  221. package/src/task/types.ts +108 -0
  222. package/src/tools/ask-answer-registry.ts +12 -6
  223. package/src/tools/ask.ts +86 -55
  224. package/src/tools/ast-edit.ts +1 -0
  225. package/src/tools/ast-grep.ts +1 -0
  226. package/src/tools/bash-interactive.ts +8 -3
  227. package/src/tools/bash.ts +503 -60
  228. package/src/tools/find.ts +1 -0
  229. package/src/tools/image-gen.ts +29 -5
  230. package/src/tools/index.ts +6 -0
  231. package/src/tools/output-meta.ts +108 -14
  232. package/src/tools/path-utils.ts +3 -2
  233. package/src/tools/read.ts +18 -0
  234. package/src/tools/review.ts +5 -7
  235. package/src/tools/search.ts +1 -0
  236. package/src/tools/subagent-render.ts +6 -2
  237. package/src/tools/subagent.ts +6 -0
  238. package/src/tools/telegram-send.ts +6 -3
  239. package/src/utils/gh.ts +39 -0
  240. package/src/utils/image-resize.ts +3 -0
  241. package/src/web/search/providers/anthropic.ts +4 -4
  242. package/src/web/search/providers/kimi.ts +15 -5
  243. package/src/web/search/providers/searxng.ts +47 -4
  244. package/src/web/search/providers/xai.ts +7 -2
  245. package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
  246. package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
  247. package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
@@ -82,11 +82,18 @@ import {
82
82
  import { ExtensionRuntime } from "../extensibility/extensions/loader";
83
83
  import { type ConstrainedPluginHook, loadConstrainedPluginHooks } from "../extensibility/gjc-plugins/constrained-hooks";
84
84
  import { resolveCurrentPhaseForParent } from "../extensibility/gjc-plugins/injection";
85
+ import { currentActivationFingerprint } from "../extensibility/gjc-plugins/lifecycle";
85
86
  import {
86
87
  buildPluginMcpConfigs,
87
88
  loadAlwaysOnPluginTools,
88
89
  renderAlwaysOnSystemAppendices,
89
90
  } from "../extensibility/gjc-plugins/runtime-adapters";
91
+ import {
92
+ GjcRuntimeFindingAccumulator,
93
+ type GjcRuntimeSnapshotProvider,
94
+ GjcRuntimeSnapshotStore,
95
+ gjcActivationGenerationFor,
96
+ } from "../extensibility/gjc-plugins/runtime-quarantine";
90
97
  import { loadActiveSubskillTools } from "../extensibility/gjc-plugins/tools";
91
98
  import { loadSkills, type Skill, type SkillWarning, setActiveSkills } from "../extensibility/skills";
92
99
  import type { FileSlashCommand } from "../extensibility/slash-commands";
@@ -494,6 +501,11 @@ export interface CreateAgentSessionResult {
494
501
  lspServers?: LspStartupServerInfo[];
495
502
  /** Shared event bus for tool/extension communication */
496
503
  eventBus: EventBus;
504
+ /**
505
+ * Read-only view of GJC bundle runtime evidence for the activation generation
506
+ * this session published. Undefined when no GJC bundles participated.
507
+ */
508
+ gjcRuntimeSnapshot?: GjcRuntimeSnapshotProvider;
497
509
  }
498
510
 
499
511
  // Re-exports
@@ -1070,6 +1082,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1070
1082
  "options.authStorage and options.modelRegistry.authStorage must be the same instance when both are provided",
1071
1083
  );
1072
1084
  }
1085
+
1073
1086
  let agent: Agent;
1074
1087
  let session!: AgentSession;
1075
1088
  let hasSession = false;
@@ -1281,13 +1294,16 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1281
1294
  );
1282
1295
  let model = options.model;
1283
1296
  let modelFallbackMessage: string | undefined;
1297
+ const resumeModelBehavior = settings.get("session.resumeModelBehavior");
1284
1298
  const persistedDefaultChain = existingSession.configuredModelChains.default?.entries;
1285
1299
  const defaultModelEntries =
1286
- persistedDefaultChain && persistedDefaultChain.length > 0
1287
- ? persistedDefaultChain
1288
- : existingSession.models.default
1289
- ? [existingSession.models.default]
1290
- : [];
1300
+ resumeModelBehavior === "useCurrentDefault"
1301
+ ? []
1302
+ : persistedDefaultChain && persistedDefaultChain.length > 0
1303
+ ? persistedDefaultChain
1304
+ : existingSession.models.default
1305
+ ? [existingSession.models.default]
1306
+ : [];
1291
1307
  // If session has data, restore its configured default chain rather than the
1292
1308
  // scalar runtime model, which may be a stale fallback from the prior run.
1293
1309
  if (!hasExplicitModel && !model && hasExistingSession && defaultModelEntries.length > 0) {
@@ -1607,6 +1623,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1607
1623
  }
1608
1624
  },
1609
1625
  getArtifactManager: () => sessionManager.getArtifactManager(),
1626
+ registerSessionCleanup: cleanup => session?.registerToolSessionCleanup(cleanup) ?? (() => {}),
1610
1627
  settings,
1611
1628
  authStorage,
1612
1629
  modelRegistry,
@@ -1616,10 +1633,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1616
1633
 
1617
1634
  // Wire process-wide internal URL singletons owned by their real classes.
1618
1635
  // Top-level sessions install the active snapshots; subagents inherit them.
1619
- // Artifact and agent-output URLs resolve via `AgentRegistry.global()` —
1620
- // the protocol handlers walk each ref's `sessionManager.getArtifactsDir()`,
1621
- // which collapses to the parent's dir for subagents (they adopt the
1622
- // parent's ArtifactManager) so one lookup hits everything.
1636
+ // Artifact and agent-output URLs resolve against explicitly authorized
1637
+ // directories only (see `authorizedArtifactsDirsFromContext`): the
1638
+ // caller's own `sessionManager.getArtifactsDir()` plus, when this session
1639
+ // adopted a shared `ArtifactManager` (subagent tree membership),
1640
+ // `getAuthorizedArtifactsDirs` below. There is no registry-wide lookup.
1623
1641
  const getArtifactsDir = () => sessionManager.getArtifactsDir();
1624
1642
  const localProtocolOptions = options.localProtocolOptions ?? {
1625
1643
  getArtifactsDir,
@@ -1637,6 +1655,10 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1637
1655
  disposeLocalProtocolOverride = LocalProtocolHandler.installOverride(options.localProtocolOptions);
1638
1656
  }
1639
1657
  toolSession.getArtifactsDir = getArtifactsDir;
1658
+ toolSession.getAuthorizedArtifactsDirs = () => {
1659
+ const manager = sessionManager.getArtifactManager();
1660
+ return manager ? [manager.dir] : [];
1661
+ };
1640
1662
  toolSession.agentOutputManager = new AgentOutputManager(
1641
1663
  getArtifactsDir,
1642
1664
  options.parentTaskPrefix ? { parentPrefix: options.parentTaskPrefix } : undefined,
@@ -1709,6 +1731,23 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1709
1731
  }
1710
1732
  }
1711
1733
 
1734
+ // GJC bundle runtime evidence for this activation. Producers below return
1735
+ // findings into this caller-owned accumulator and never publish; exactly one
1736
+ // complete snapshot is published once every producer has run.
1737
+ const gjcRuntimeStore = new GjcRuntimeSnapshotStore();
1738
+ let gjcProducersComplete = true;
1739
+ let gjcActivationGeneration = 0;
1740
+ try {
1741
+ gjcActivationGeneration = gjcActivationGenerationFor(await currentActivationFingerprint({ cwd }));
1742
+ } catch (error) {
1743
+ // Without a readable activation generation no snapshot can be proven
1744
+ // current, so publish nothing rather than a snapshot consumers cannot
1745
+ // validate against.
1746
+ gjcProducersComplete = false;
1747
+ logger.warn("Failed to derive GJC bundle activation generation", { error });
1748
+ }
1749
+ const gjcFindings = new GjcRuntimeFindingAccumulator(gjcActivationGeneration);
1750
+
1712
1751
  // Always-on GJC plugin bundle tools (validated registry surfaces). This is
1713
1752
  // additive and a no-op when no plugins are installed for the cwd. Surfaces
1714
1753
  // are hash-verified and collision-checked; declared names are authoritative.
@@ -1719,9 +1758,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1719
1758
  });
1720
1759
  if (pluginToolResult.tools.length > 0) customTools.push(...pluginToolResult.tools);
1721
1760
  for (const q of pluginToolResult.quarantine) {
1761
+ gjcFindings.add({ identity: q.identity, surfaceId: q.surfaceId, code: q.code, message: q.message });
1722
1762
  logger.warn("Quarantined GJC plugin surface", { plugin: q.plugin, surface: q.surfaceId, code: q.code });
1723
1763
  }
1724
1764
  } catch (error) {
1765
+ gjcProducersComplete = false;
1725
1766
  logger.warn("Failed to load always-on GJC plugin tools", { error });
1726
1767
  }
1727
1768
 
@@ -1753,6 +1794,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1753
1794
  try {
1754
1795
  const { configs, quarantine } = await buildPluginMcpConfigs({ cwd });
1755
1796
  for (const q of quarantine) {
1797
+ gjcFindings.add({ identity: q.identity, surfaceId: q.surfaceId, code: q.code, message: q.message });
1756
1798
  logger.warn("Quarantined GJC plugin MCP", { plugin: q.plugin, surface: q.surfaceId, code: q.code });
1757
1799
  }
1758
1800
  if (Object.keys(configs).length > 0) {
@@ -1766,6 +1808,10 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1766
1808
  );
1767
1809
  const result = await owned.connectServers(configs, sources as never);
1768
1810
  for (const [server, err] of result.errors) {
1811
+ // A server that failed to connect leaves this generation
1812
+ // incomplete: its surfaces produced no evidence, so publishing
1813
+ // would present a partial pass as a clear one.
1814
+ gjcProducersComplete = false;
1769
1815
  logger.warn("GJC plugin MCP connect failed", { path: `mcp:${server}`, error: err });
1770
1816
  }
1771
1817
  if (result.connectedServers.length > 0) {
@@ -1785,6 +1831,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1785
1831
  }
1786
1832
  }
1787
1833
  } catch (error) {
1834
+ gjcProducersComplete = false;
1788
1835
  logger.warn("Failed to wire GJC plugin MCP servers", { error });
1789
1836
  }
1790
1837
  } else if (isCanonicalSubSession) {
@@ -1834,11 +1881,14 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
1834
1881
  inlineExtensions.push(createPluginHooksExtension(pluginHookResult.hooks));
1835
1882
  }
1836
1883
  for (const q of pluginHookResult.quarantine) {
1884
+ gjcFindings.add({ identity: q.identity, surfaceId: q.surfaceId, code: q.code, message: q.message });
1837
1885
  logger.warn("Quarantined GJC plugin hook", { plugin: q.plugin, surface: q.surfaceId, code: q.code });
1838
1886
  }
1839
1887
  } catch (error) {
1888
+ gjcProducersComplete = false;
1840
1889
  logger.warn("Failed to load constrained GJC plugin hooks", { error });
1841
1890
  }
1891
+
1842
1892
  let notificationCfg: NotificationConfig | undefined;
1843
1893
  try {
1844
1894
  notificationCfg = getNotificationConfig(settings);
@@ -2184,6 +2234,15 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2184
2234
  tools: Map<string, AgentTool>,
2185
2235
  candidateModel?: Model,
2186
2236
  ): Promise<BuildSystemPromptResult> => {
2237
+ // This callback is reused for later prompt/tool/model rebuilds. Retire
2238
+ // the previous generation's evidence up front: from here until a
2239
+ // complete pass republishes, consumers must read `unavailable` rather
2240
+ // than a snapshot describing a generation that no longer applies.
2241
+ // Invalidating at entry (not beside the publish) means an await or a
2242
+ // throw in between cannot leave stale evidence readable. The reserved
2243
+ // epoch additionally fences overlapping rebuilds, so a slower earlier
2244
+ // pass cannot publish over a newer one.
2245
+ const gjcPassEpoch = gjcRuntimeStore.beginPass();
2187
2246
  toolContextStore.setToolNames(toolNames);
2188
2247
  const promptTools = (() => {
2189
2248
  const previousPromptMetadataModel = promptMetadataModel;
@@ -2216,8 +2275,17 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2216
2275
  try {
2217
2276
  pluginSystemAppendices = await renderAlwaysOnSystemAppendices({ cwd });
2218
2277
  } catch (error) {
2278
+ gjcProducersComplete = false;
2219
2279
  logger.warn("Failed to render GJC plugin system appendices", { error });
2220
2280
  }
2281
+
2282
+ // Publication point for GJC bundle runtime evidence. Appendix rendering
2283
+ // is the last producer, so only here is the generation complete.
2284
+ //
2285
+ // The previous generation was already retired at callback entry, so a
2286
+ // partial pass simply never republishes and consumers keep reading
2287
+ // `unavailable` rather than a stale generation.
2288
+ if (gjcProducersComplete) gjcRuntimeStore.publish(gjcFindings.snapshot(), gjcPassEpoch);
2221
2289
  const defaultPrompt = await buildSystemPromptInternal({
2222
2290
  cwd,
2223
2291
  skills,
@@ -2364,6 +2432,9 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2364
2432
  (options.alwaysActiveToolNames ?? []).map(name => name.toLowerCase()),
2365
2433
  );
2366
2434
  const essentialBuiltinNames = new Set(computeEssentialBuiltinNames(settings));
2435
+ // `task.eager` promises delegation preference. In discovery mode the task tool
2436
+ // would otherwise be hidden, making the matching prompt instruction unreachable.
2437
+ if (eagerTasks) essentialBuiltinNames.add("task");
2367
2438
  const allowedDiscoveredBuiltinNames = options.discoverableToolAllowedNames
2368
2439
  ? new Set(options.discoverableToolAllowedNames.map(name => name.toLowerCase()))
2369
2440
  : undefined;
@@ -2568,6 +2639,9 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2568
2639
  maxRetryDelayMs: retrySettings.maxDelayMs,
2569
2640
  requestMaxRetries: retrySettings.requestMaxRetries,
2570
2641
  streamMaxRetries: retrySettings.streamMaxRetries,
2642
+ streamFirstEventTimeoutMs: settings.has("retry.streamFirstEventTimeoutMs")
2643
+ ? retrySettings.streamFirstEventTimeoutMs
2644
+ : undefined,
2571
2645
  kimiApiFormat: settings.get("providers.kimiApiFormat") ?? "anthropic",
2572
2646
  shouldPause: options.shouldPause,
2573
2647
  preferWebsockets: preferOpenAICodexWebsockets,
@@ -2853,6 +2927,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2853
2927
  // microtask (the ToolSession closure needs `session` assigned). Await it
2854
2928
  // so a resumed canonical workflow session returns with `ask` resident.
2855
2929
  await session.workflowGateToolRestoration;
2930
+ // Expose the published evidence on the session itself so UI surfaces that
2931
+ // only hold a session (Settings) can consume it without threading the
2932
+ // creation result through every controller.
2933
+ session.gjcRuntimeSnapshot = gjcRuntimeStore;
2934
+ session.gjcActivationGeneration = gjcActivationGeneration;
2856
2935
  return {
2857
2936
  session,
2858
2937
  extensionsResult,
@@ -2861,6 +2940,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
2861
2940
  modelFallbackMessage,
2862
2941
  lspServers,
2863
2942
  eventBus,
2943
+ gjcRuntimeSnapshot: gjcRuntimeStore,
2864
2944
  };
2865
2945
  } catch (error) {
2866
2946
  // Release the subscription if the throw happened after install but before the