comisai 1.0.24 → 1.0.26

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 (192) hide show
  1. package/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +130 -10
  2. package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.d.ts +1 -1
  3. package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +9 -2
  4. package/node_modules/@comis/agent/dist/bridge/bridge-metrics.d.ts +8 -0
  5. package/node_modules/@comis/agent/dist/bridge/bridge-metrics.js +2 -0
  6. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +29 -0
  7. package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +242 -2
  8. package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.d.ts +210 -0
  9. package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.js +566 -0
  10. package/node_modules/@comis/agent/dist/context-engine/context-engine.js +8 -6
  11. package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +51 -30
  12. package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +109 -36
  13. package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.js +5 -1
  14. package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +22 -20
  15. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +2 -0
  16. package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +111 -15
  17. package/node_modules/@comis/agent/dist/executor/executor-response-filter.d.ts +20 -17
  18. package/node_modules/@comis/agent/dist/executor/executor-response-filter.js +132 -52
  19. package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +16 -3
  20. package/node_modules/@comis/agent/dist/executor/model-retry.d.ts +14 -0
  21. package/node_modules/@comis/agent/dist/executor/model-retry.js +72 -1
  22. package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +3 -0
  23. package/node_modules/@comis/agent/dist/executor/pi-executor.js +68 -9
  24. package/node_modules/@comis/agent/dist/executor/post-batch-continuation.d.ts +82 -0
  25. package/node_modules/@comis/agent/dist/executor/post-batch-continuation.js +200 -0
  26. package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +1 -9
  27. package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +37 -2
  28. package/node_modules/@comis/agent/dist/executor/tool-deferral.js +45 -3
  29. package/node_modules/@comis/agent/dist/executor/tool-parallelism.js +0 -1
  30. package/node_modules/@comis/agent/dist/executor/types.d.ts +11 -2
  31. package/node_modules/@comis/agent/dist/index.d.ts +3 -1
  32. package/node_modules/@comis/agent/dist/index.js +2 -0
  33. package/node_modules/@comis/agent/dist/model/last-known-model.d.ts +36 -0
  34. package/node_modules/@comis/agent/dist/model/last-known-model.js +49 -0
  35. package/node_modules/@comis/agent/dist/model/model-registry-adapter.d.ts +16 -4
  36. package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +65 -21
  37. package/node_modules/@comis/agent/dist/planner/types.d.ts +0 -2
  38. package/node_modules/@comis/agent/dist/session/comis-session-manager.d.ts +10 -0
  39. package/node_modules/@comis/agent/dist/session/comis-session-manager.js +5 -0
  40. package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.js +7 -0
  41. package/node_modules/@comis/agent/package.json +1 -1
  42. package/node_modules/@comis/channels/package.json +1 -1
  43. package/node_modules/@comis/cli/dist/client/rpc-client.js +6 -1
  44. package/node_modules/@comis/cli/dist/commands/doctor.js +5 -3
  45. package/node_modules/@comis/cli/dist/commands/health.js +5 -2
  46. package/node_modules/@comis/cli/dist/wizard/json-output.js +7 -3
  47. package/node_modules/@comis/cli/dist/wizard/steps/11-daemon-start.js +130 -0
  48. package/node_modules/@comis/cli/package.json +1 -1
  49. package/node_modules/@comis/core/dist/bootstrap.js +5 -0
  50. package/node_modules/@comis/core/dist/config/env-layer.d.ts +31 -0
  51. package/node_modules/@comis/core/dist/config/env-layer.js +41 -0
  52. package/node_modules/@comis/core/dist/config/immutable-keys.d.ts +2 -2
  53. package/node_modules/@comis/core/dist/config/immutable-keys.js +8 -3
  54. package/node_modules/@comis/core/dist/config/layered.d.ts +9 -0
  55. package/node_modules/@comis/core/dist/config/layered.js +11 -0
  56. package/node_modules/@comis/core/dist/config/managed-sections.d.ts +43 -4
  57. package/node_modules/@comis/core/dist/config/managed-sections.js +100 -6
  58. package/node_modules/@comis/core/dist/config/schema-agent.d.ts +39 -0
  59. package/node_modules/@comis/core/dist/config/schema-agent.js +14 -0
  60. package/node_modules/@comis/core/dist/config/schema.d.ts +4 -0
  61. package/node_modules/@comis/core/dist/config/schema.js +14 -0
  62. package/node_modules/@comis/core/dist/domain/execution-graph.d.ts +1 -1
  63. package/node_modules/@comis/core/dist/event-bus/events-agent.d.ts +17 -2
  64. package/node_modules/@comis/core/dist/exports/config.d.ts +2 -2
  65. package/node_modules/@comis/core/dist/exports/config.js +1 -1
  66. package/node_modules/@comis/core/package.json +1 -1
  67. package/node_modules/@comis/daemon/dist/daemon.d.ts +22 -0
  68. package/node_modules/@comis/daemon/dist/daemon.js +45 -0
  69. package/node_modules/@comis/daemon/dist/rpc/agent-handlers.d.ts +5 -2
  70. package/node_modules/@comis/daemon/dist/rpc/agent-handlers.js +80 -1
  71. package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.d.ts +67 -0
  72. package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.js +139 -0
  73. package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +3 -0
  74. package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +29 -5
  75. package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.d.ts +30 -0
  76. package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.js +59 -0
  77. package/node_modules/@comis/daemon/dist/rpc/provider-handlers.d.ts +37 -0
  78. package/node_modules/@comis/daemon/dist/rpc/provider-handlers.js +330 -0
  79. package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.js +18 -1
  80. package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.d.ts +4 -0
  81. package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.js +30 -0
  82. package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +3 -1
  83. package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +28 -2
  84. package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.js +1 -0
  85. package/node_modules/@comis/daemon/dist/wiring/setup-tools.js +7 -4
  86. package/node_modules/@comis/daemon/package.json +1 -1
  87. package/node_modules/@comis/gateway/package.json +1 -1
  88. package/node_modules/@comis/infra/dist/index.d.ts +1 -0
  89. package/node_modules/@comis/infra/dist/index.js +2 -0
  90. package/node_modules/@comis/infra/dist/runtime/is-docker.d.ts +1 -0
  91. package/node_modules/@comis/infra/dist/runtime/is-docker.js +25 -0
  92. package/node_modules/@comis/infra/package.json +1 -1
  93. package/node_modules/@comis/memory/package.json +1 -1
  94. package/node_modules/@comis/scheduler/package.json +1 -1
  95. package/node_modules/@comis/shared/package.json +1 -1
  96. package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +1 -3
  97. package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.js +24 -1
  98. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +53 -7
  99. package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +218 -24
  100. package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +4 -1
  101. package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +16 -1
  102. package/node_modules/@comis/skills/dist/builtin/platform/index.d.ts +1 -1
  103. package/node_modules/@comis/skills/dist/builtin/platform/index.js +1 -1
  104. package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.d.ts +56 -0
  105. package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.js +203 -0
  106. package/node_modules/@comis/skills/dist/index.d.ts +1 -1
  107. package/node_modules/@comis/skills/dist/index.js +2 -2
  108. package/node_modules/@comis/skills/dist/policy/tool-policy.js +0 -1
  109. package/node_modules/@comis/skills/package.json +1 -1
  110. package/node_modules/@comis/web/dist/assets/{agent-detail-BG9MGWWj.js → agent-detail-DqL6Artv.js} +270 -270
  111. package/node_modules/@comis/web/dist/assets/agent-editor-CNM_h94Y.js +2173 -0
  112. package/node_modules/@comis/web/dist/assets/{agent-list-LHCJ4rw2.js → agent-list-Dbh-xD_F.js} +170 -170
  113. package/node_modules/@comis/web/dist/assets/{approvals-q9VH_IKr.js → approvals-C-K6hN2U.js} +13 -13
  114. package/node_modules/@comis/web/dist/assets/billing-view-C1DmtyzK.js +375 -0
  115. package/node_modules/@comis/web/dist/assets/{channel-detail-CaInesJM.js → channel-detail-CtCH22N1.js} +265 -265
  116. package/node_modules/@comis/web/dist/assets/channel-list-C7xXn-60.js +323 -0
  117. package/node_modules/@comis/web/dist/assets/{chat-console-CNmzl0JW.js → chat-console-C51pjFwk.js} +243 -246
  118. package/node_modules/@comis/web/dist/assets/{config-editor-DX4ITw6y.js → config-editor-BLArYRB7.js} +477 -477
  119. package/node_modules/@comis/web/dist/assets/{context-dag-browser-BwiaF5tf.js → context-dag-browser-fuyMinNI.js} +105 -105
  120. package/node_modules/@comis/web/dist/assets/{context-engine-BZ5Am6hA.js → context-engine-Bngf2bH0.js} +136 -136
  121. package/node_modules/@comis/web/dist/assets/decorate-BvWYovGE.js +38 -0
  122. package/node_modules/@comis/web/dist/assets/{delivery-view-OfBZof-m.js → delivery-view-C80hucxX.js} +134 -134
  123. package/node_modules/@comis/web/dist/assets/{diagnostics-view-YFwCxgr2.js → diagnostics-view-Cl4VbHZ6.js} +82 -82
  124. package/node_modules/@comis/web/dist/assets/directive-BOYXJ-K-.js +1 -0
  125. package/node_modules/@comis/web/dist/assets/{extract-variables-BM5qyK-s.js → extract-variables-B7-Doo7l.js} +39 -39
  126. package/node_modules/@comis/web/dist/assets/{ic-array-editor-B7m6x7-S.js → ic-array-editor-BLoEyeLS.js} +29 -29
  127. package/node_modules/@comis/web/dist/assets/{ic-breadcrumb-CUMpp3BL.js → ic-breadcrumb-DqN6G3gc.js} +16 -16
  128. package/node_modules/@comis/web/dist/assets/{ic-budget-segment-bar-BtJ6x5mN.js → ic-budget-segment-bar-zLsMzjDO.js} +20 -20
  129. package/node_modules/@comis/web/dist/assets/ic-chat-message-ByFUoMm6.js +352 -0
  130. package/node_modules/@comis/web/dist/assets/{ic-confirm-dialog-CCDbB04e.js → ic-confirm-dialog-DGlPbV1T.js} +26 -26
  131. package/node_modules/@comis/web/dist/assets/{ic-connection-dot-CnT1b8xr.js → ic-connection-dot-C4nDHgY2.js} +13 -13
  132. package/node_modules/@comis/web/dist/assets/ic-data-table-CKIvr-ag.js +277 -0
  133. package/node_modules/@comis/web/dist/assets/ic-delivery-row-B3YwjjuM.js +67 -0
  134. package/node_modules/@comis/web/dist/assets/{ic-detail-panel-BF83r-if.js → ic-detail-panel-DiCe4hLr.js} +27 -27
  135. package/node_modules/@comis/web/dist/assets/{ic-empty-state-60l2ePhd.js → ic-empty-state-CM3Wbj2f.js} +19 -19
  136. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-ByRjij68.js +359 -0
  137. package/node_modules/@comis/web/dist/assets/ic-icon-BGNCCPpZ.js +33 -0
  138. package/node_modules/@comis/web/dist/assets/{ic-layer-waterfall-COvEYMg5.js → ic-layer-waterfall-WkaFyu-l.js} +18 -18
  139. package/node_modules/@comis/web/dist/assets/ic-relative-time-B3UAnTqg.js +12 -0
  140. package/node_modules/@comis/web/dist/assets/{ic-search-input-CSOxY9g7.js → ic-search-input-B02AGw1i.js} +22 -22
  141. package/node_modules/@comis/web/dist/assets/{ic-select-Ce-Raudx.js → ic-select-BqfZISjw.js} +29 -29
  142. package/node_modules/@comis/web/dist/assets/ic-tabs-yBjkWKJH.js +95 -0
  143. package/node_modules/@comis/web/dist/assets/ic-tag-CvMVQFRR.js +33 -0
  144. package/node_modules/@comis/web/dist/assets/{ic-time-range-picker-CypCT68y.js → ic-time-range-picker-DXbYeBmY.js} +31 -31
  145. package/node_modules/@comis/web/dist/assets/{ic-tool-call-7MaXSsCW.js → ic-tool-call-Bh5kq-yY.js} +51 -51
  146. package/node_modules/@comis/web/dist/assets/index-BBkuC-EU.js +2792 -0
  147. package/node_modules/@comis/web/dist/assets/index-CVEaS9aY.css +2 -0
  148. package/node_modules/@comis/web/dist/assets/{mcp-management-BNZPnpDn.js → mcp-management-DB-phOo7.js} +209 -209
  149. package/node_modules/@comis/web/dist/assets/{media-config-BBvTYxOX.js → media-config-CRqZ1ZUH.js} +154 -154
  150. package/node_modules/@comis/web/dist/assets/{media-test-BkK3RCRK.js → media-test-C9vE20Oy.js} +259 -259
  151. package/node_modules/@comis/web/dist/assets/{memory-inspector-1hDGCGat.js → memory-inspector-CeqfnxMZ.js} +450 -450
  152. package/node_modules/@comis/web/dist/assets/{message-center-CXefwsUu.js → message-center-Daup7Mof.js} +290 -290
  153. package/node_modules/@comis/web/dist/assets/{models-C1qcU_j3.js → models-DLYnEU8E.js} +371 -371
  154. package/node_modules/@comis/web/dist/assets/observability-types-D0tkwElU.js +1 -0
  155. package/node_modules/@comis/web/dist/assets/{observe-view-C0VBhX4C.js → observe-view-BTSt_PO5.js} +399 -399
  156. package/node_modules/@comis/web/dist/assets/pipeline-builder-DknfzyLt.js +1495 -0
  157. package/node_modules/@comis/web/dist/assets/{pipeline-history-DkfOQ6SW.js → pipeline-history-JnHZdeU_.js} +124 -124
  158. package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-hyHgD0ai.js → pipeline-history-detail-Dg4knsEb.js} +65 -65
  159. package/node_modules/@comis/web/dist/assets/{pipeline-list-BPW8hV-q.js → pipeline-list-AEnibjsp.js} +227 -227
  160. package/node_modules/@comis/web/dist/assets/{pipeline-monitor-Bip16T7e.js → pipeline-monitor-DG7RbIOO.js} +298 -298
  161. package/node_modules/@comis/web/dist/assets/{scheduler-BGgwKd06.js → scheduler-uL1fYKAT.js} +486 -486
  162. package/node_modules/@comis/web/dist/assets/{security-D15st4xx.js → security-C3DywRLH.js} +389 -389
  163. package/node_modules/@comis/web/dist/assets/{session-detail-SGEYNJ0M.js → session-detail-BtqCNWXV.js} +294 -294
  164. package/node_modules/@comis/web/dist/assets/session-key-parser-Dkqcj2Ss.js +1 -0
  165. package/node_modules/@comis/web/dist/assets/session-list-CJXWa2XT.js +231 -0
  166. package/node_modules/@comis/web/dist/assets/{setup-wizard-nT0tz9QP.js → setup-wizard-ywn7oJvu.js} +486 -494
  167. package/node_modules/@comis/web/dist/assets/{skills-D8yVfSUy.js → skills-DX0KYnWD.js} +329 -329
  168. package/node_modules/@comis/web/dist/assets/{subagents-HHXMeHYo.js → subagents-B8p5YJEB.js} +74 -74
  169. package/node_modules/@comis/web/dist/assets/{workspace-manager-BQlr10iH.js → workspace-manager-CgzNIrw1.js} +236 -236
  170. package/node_modules/@comis/web/dist/index.html +3 -2
  171. package/node_modules/@comis/web/package.json +1 -1
  172. package/package.json +15 -15
  173. package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.d.ts +0 -19
  174. package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.js +0 -39
  175. package/node_modules/@comis/web/dist/assets/agent-editor-C26Q_xCs.js +0 -2173
  176. package/node_modules/@comis/web/dist/assets/billing-view-CtYvBqTE.js +0 -375
  177. package/node_modules/@comis/web/dist/assets/channel-list-B8dj3O9a.js +0 -323
  178. package/node_modules/@comis/web/dist/assets/directive-DoeGSK_T.js +0 -1
  179. package/node_modules/@comis/web/dist/assets/ic-chat-message-CFyDJd0z.js +0 -352
  180. package/node_modules/@comis/web/dist/assets/ic-data-table-CKUNTxHw.js +0 -277
  181. package/node_modules/@comis/web/dist/assets/ic-delivery-row-GP5Fkygs.js +0 -67
  182. package/node_modules/@comis/web/dist/assets/ic-graph-canvas-C8FuSMe1.js +0 -359
  183. package/node_modules/@comis/web/dist/assets/ic-icon-xeGTVhVG.js +0 -33
  184. package/node_modules/@comis/web/dist/assets/ic-relative-time-3FqpjeAI.js +0 -12
  185. package/node_modules/@comis/web/dist/assets/ic-tabs-B7QtM_v8.js +0 -95
  186. package/node_modules/@comis/web/dist/assets/ic-tag-CPPUnDLF.js +0 -33
  187. package/node_modules/@comis/web/dist/assets/index-CEcM1R_C.js +0 -2830
  188. package/node_modules/@comis/web/dist/assets/index-CIJFuItj.css +0 -1
  189. package/node_modules/@comis/web/dist/assets/observability-types-D7jUtSde.js +0 -1
  190. package/node_modules/@comis/web/dist/assets/pipeline-builder-DcUUIrm0.js +0 -1496
  191. package/node_modules/@comis/web/dist/assets/session-key-parser-DPORMVyU.js +0 -1
  192. package/node_modules/@comis/web/dist/assets/session-list-6ybUTxbY.js +0 -231
@@ -73,9 +73,20 @@ export function mergeLayered(layers) {
73
73
  * This supports the common pattern: defaults.yaml < config.yaml < config.local.yaml
74
74
  *
75
75
  * If any file fails to load, returns the error immediately.
76
+ *
77
+ * `envLayer` (when provided) is prepended to the layer sequence so it sits
78
+ * between Zod schema defaults and YAML files in precedence order:
79
+ * defaults < envLayer < config files
80
+ * Explicit user config in YAML always wins over env-derived values, which
81
+ * preserves secure-by-default semantics for security-sensitive fields like
82
+ * `gateway.host` — an inherited env var can never silently broaden a bind
83
+ * the operator pinned in config.yaml.
76
84
  */
77
85
  export function loadLayered(configPaths, options) {
78
86
  const layers = [];
87
+ if (options?.envLayer && Object.keys(options.envLayer).length > 0) {
88
+ layers.push(options.envLayer);
89
+ }
79
90
  for (const configPath of configPaths) {
80
91
  const result = loadConfigFile(configPath, options?.getSecret ? { getSecret: options.getSecret } : undefined);
81
92
  if (!result.ok) {
@@ -35,6 +35,29 @@ export interface ManagedSectionRedirect {
35
35
  * already present in config.
36
36
  */
37
37
  fullyManaged: boolean;
38
+ /**
39
+ * Compact schema fragment so the LLM can call the tool without a separate
40
+ * discover_tools round-trip. Populated when the action enum + required
41
+ * fields fit in < 20 lines of hint text. Verified against the tool's
42
+ * TypeBox parameter schema as of this commit.
43
+ *
44
+ * Bug B (260428-gj6): production trace c7b91328 showed the agent burning
45
+ * ~30s × 4 LLM calls re-loading the agents_manage schema after an
46
+ * immutable-path rejection. Surfacing the fragment inline closes that
47
+ * round-trip tax.
48
+ */
49
+ schemaFragment?: {
50
+ /** Valid `action` enum values (pinned to the tool's TypeBox Union literals). */
51
+ actions: readonly string[];
52
+ /**
53
+ * Required field names per action -- only entries that are strictly
54
+ * required by the tool's handler (omitting Type.Optional fields with
55
+ * sensible defaults). Omit the whole property when no action has
56
+ * required-beyond-action fields (e.g., channels_manage operates on
57
+ * existing entries only).
58
+ */
59
+ requiredByAction?: Record<string, readonly string[]>;
60
+ };
38
61
  }
39
62
  /**
40
63
  * Registered managed sections.
@@ -55,10 +78,26 @@ export declare function getManagedSectionRedirect(section: string | undefined, k
55
78
  /**
56
79
  * Format an LLM-readable hint for an immutability rejection.
57
80
  *
58
- * The output uses an explicit two-step "Recovery:" framing because smaller
59
- * models (Haiku 4.5, Gemini Flash, GPT-OSS-20b) parse numbered steps more
60
- * reliably than prose. The example call is JSON-stringified compactly so it
61
- * can be copy-pasted into the next tool invocation.
81
+ * Output is a single-step "Recovery: call <tool>(<example>)." line: the
82
+ * dedicated `*_manage` tool auto-loads on first direct invocation under
83
+ * every supported provider path:
84
+ *
85
+ * - Anthropic Sonnet/Opus 4.x: request-body-injector strips client-side
86
+ * `discover_tools` from the payload and marks deferred tools
87
+ * `defer_loading: true`; calling the tool by name auto-loads it.
88
+ * - Anthropic Haiku / OpenAI / xAI / Google: tools surface via the
89
+ * client-side `discover_tools` corpus, but a stub-filter wraps deferred
90
+ * entries so that calling the tool by name still works first try (the
91
+ * stub forwards to the real tool and registers it as discovered).
92
+ *
93
+ * Naming `discover_tools` in the hint actively misleads Anthropic
94
+ * Sonnet/Opus 4.x because that tool is not in their payload (260428-oyc
95
+ * production repro: agent saw "Recovery: (1) call discover_tools(...)" and
96
+ * gave up, reporting "I don't have a discover_tools function"). The
97
+ * single-step framing works on every provider.
98
+ *
99
+ * The example call is JSON-stringified compactly so it can be copy-pasted
100
+ * verbatim into the next tool invocation.
62
101
  *
63
102
  * @param redirect - The matched managed-section entry
64
103
  * @param mutablePaths - Optional override paths for in-place patching of
@@ -36,6 +36,17 @@ export const MANAGED_SECTIONS = [
36
36
  args: [],
37
37
  },
38
38
  fullyManaged: true,
39
+ // Action enum pinned to mcp-manage-tool.ts TypeBox Union (lines 25-31).
40
+ // requiredByAction.connect captures the stdio-transport happy path
41
+ // (transport="sse"|"http" requires `url` instead of `command` -- the
42
+ // exampleArgs above documents the stdio shape, the schema fragment
43
+ // documents required fields for that same shape).
44
+ schemaFragment: {
45
+ actions: ["list", "status", "connect", "disconnect", "reconnect"],
46
+ requiredByAction: {
47
+ connect: ["name", "transport", "command"],
48
+ },
49
+ },
39
50
  },
40
51
  {
41
52
  pathPrefix: "gateway.tokens",
@@ -44,6 +55,43 @@ export const MANAGED_SECTIONS = [
44
55
  // Verified against tokens-manage-tool.ts TokensManageToolParams.
45
56
  exampleArgs: { action: "create", token_id: "<token-id>", scopes: ["rpc", "ws"] },
46
57
  fullyManaged: true,
58
+ // Action enum pinned to tokens-manage-tool.ts TypeBox Union (lines 25-31).
59
+ // token_id is genuinely Type.Optional (auto-generated when omitted, per
60
+ // the schema description at L36); only `scopes` is strictly required for
61
+ // create.
62
+ schemaFragment: {
63
+ actions: ["list", "create", "revoke", "rotate"],
64
+ requiredByAction: {
65
+ create: ["scopes"],
66
+ },
67
+ },
68
+ },
69
+ {
70
+ pathPrefix: "providers",
71
+ tool: "providers_manage",
72
+ description: "Manage LLM providers (list, get, create, update, delete, enable, disable).",
73
+ // Verified against providers-manage-tool.ts ProvidersManageToolParams.
74
+ exampleArgs: {
75
+ action: "create",
76
+ provider_id: "<any-name>",
77
+ config: {
78
+ type: "<sdk-type>",
79
+ name: "<display-name>",
80
+ baseUrl: "<api-base-url>",
81
+ apiKeyName: "<SECRET_KEY_NAME>",
82
+ models: [{ id: "<model-id>" }],
83
+ },
84
+ },
85
+ fullyManaged: true,
86
+ // Action enum pinned to providers-manage-tool.ts TypeBox Union.
87
+ // provider_id + config are required for create; other actions require
88
+ // only provider_id or nothing (list).
89
+ schemaFragment: {
90
+ actions: ["list", "get", "create", "update", "delete", "enable", "disable"],
91
+ requiredByAction: {
92
+ create: ["provider_id", "config"],
93
+ },
94
+ },
47
95
  },
48
96
  {
49
97
  pathPrefix: "channels",
@@ -52,6 +100,12 @@ export const MANAGED_SECTIONS = [
52
100
  // No exampleArgs -- no create-equivalent action; channels are configured
53
101
  // via operator config + media-setting toggles only.
54
102
  fullyManaged: false,
103
+ // Action enum pinned to channels-manage-tool.ts TypeBox Union (lines 32-37).
104
+ // No requiredByAction -- channels_manage operates on existing entries; all
105
+ // fields beyond `action` are looked up from config or optional.
106
+ schemaFragment: {
107
+ actions: ["list", "get", "enable", "disable", "restart", "configure"],
108
+ },
55
109
  },
56
110
  {
57
111
  pathPrefix: "agents",
@@ -69,6 +123,17 @@ export const MANAGED_SECTIONS = [
69
123
  },
70
124
  },
71
125
  fullyManaged: true,
126
+ // Action enum pinned to agents-manage-tool.ts TypeBox Union (lines 27-32).
127
+ // agent_id is required on every action (Type.String, not Optional);
128
+ // config is required for create (the action handler rejects create
129
+ // without a config payload, even though the schema marks it Optional to
130
+ // accept the alternate JSON-string fallback shape).
131
+ schemaFragment: {
132
+ actions: ["create", "get", "update", "delete", "suspend", "resume"],
133
+ requiredByAction: {
134
+ create: ["agent_id", "config"],
135
+ },
136
+ },
72
137
  },
73
138
  ];
74
139
  /**
@@ -95,10 +160,26 @@ export function getManagedSectionRedirect(section, key) {
95
160
  /**
96
161
  * Format an LLM-readable hint for an immutability rejection.
97
162
  *
98
- * The output uses an explicit two-step "Recovery:" framing because smaller
99
- * models (Haiku 4.5, Gemini Flash, GPT-OSS-20b) parse numbered steps more
100
- * reliably than prose. The example call is JSON-stringified compactly so it
101
- * can be copy-pasted into the next tool invocation.
163
+ * Output is a single-step "Recovery: call <tool>(<example>)." line: the
164
+ * dedicated `*_manage` tool auto-loads on first direct invocation under
165
+ * every supported provider path:
166
+ *
167
+ * - Anthropic Sonnet/Opus 4.x: request-body-injector strips client-side
168
+ * `discover_tools` from the payload and marks deferred tools
169
+ * `defer_loading: true`; calling the tool by name auto-loads it.
170
+ * - Anthropic Haiku / OpenAI / xAI / Google: tools surface via the
171
+ * client-side `discover_tools` corpus, but a stub-filter wraps deferred
172
+ * entries so that calling the tool by name still works first try (the
173
+ * stub forwards to the real tool and registers it as discovered).
174
+ *
175
+ * Naming `discover_tools` in the hint actively misleads Anthropic
176
+ * Sonnet/Opus 4.x because that tool is not in their payload (260428-oyc
177
+ * production repro: agent saw "Recovery: (1) call discover_tools(...)" and
178
+ * gave up, reporting "I don't have a discover_tools function"). The
179
+ * single-step framing works on every provider.
180
+ *
181
+ * The example call is JSON-stringified compactly so it can be copy-pasted
182
+ * verbatim into the next tool invocation.
102
183
  *
103
184
  * @param redirect - The matched managed-section entry
104
185
  * @param mutablePaths - Optional override paths for in-place patching of
@@ -109,10 +190,23 @@ export function formatRedirectHint(redirect, mutablePaths) {
109
190
  parts.push(`Use the "${redirect.tool}" tool: ${redirect.description}`);
110
191
  if (redirect.exampleArgs) {
111
192
  const example = JSON.stringify(redirect.exampleArgs);
112
- parts.push(`Recovery: (1) call discover_tools("${redirect.tool}") to load the schema, then (2) call ${redirect.tool}(${example}).`);
193
+ parts.push(`Recovery: call ${redirect.tool}(${example}).`);
113
194
  }
114
195
  else {
115
- parts.push(`Load it via discover_tools("${redirect.tool}") if not yet available.`);
196
+ parts.push(`Call ${redirect.tool} directly; it will auto-load on first invocation.`);
197
+ }
198
+ // Bug B (260428-gj6): inline the dedicated tool's action enum + required
199
+ // fields so the LLM can call it without a separate discover_tools round-
200
+ // trip. Positioned AFTER the Recovery example (so the example is the first
201
+ // thing the model sees) and BEFORE the mutablePaths block (which is the
202
+ // alternative path for already-existing entries).
203
+ if (redirect.schemaFragment) {
204
+ parts.push(`Tool actions: ${redirect.schemaFragment.actions.join(", ")}.`);
205
+ if (redirect.schemaFragment.requiredByAction) {
206
+ for (const [action, fields] of Object.entries(redirect.schemaFragment.requiredByAction)) {
207
+ parts.push(`Required fields for \`${action}\`: ${fields.join(", ")}.`);
208
+ }
209
+ }
116
210
  }
117
211
  if (mutablePaths && mutablePaths.length > 0) {
118
212
  parts.push(`For in-place updates of an entry that ALREADY exists, gateway/patch also accepts these specific paths: ${mutablePaths.join(", ")}.`);
@@ -460,6 +460,19 @@ export declare const ContextEngineConfigSchema: z.ZodObject<{
460
460
  summaryModel: z.ZodOptional<z.ZodString>;
461
461
  /** Optional provider override for DAG summary generation. */
462
462
  summaryProvider: z.ZodOptional<z.ZodString>;
463
+ /** Post-batch continuation handler: when the LLM emits an empty final
464
+ * turn after a successful tool batch, fire a directive followUp with
465
+ * multi-shot retry. Replaces the legacy SEP one-shot completeness nudge
466
+ * (whose enforcement role was superseded; SEP plan extraction + step
467
+ * counting remain intact for observability). */
468
+ postBatchContinuation: z.ZodDefault<z.ZodObject<{
469
+ /** Master toggle. When false, handler returns
470
+ * {recovered: false, outcome: "disabled"} without calling followUp. */
471
+ enabled: z.ZodDefault<z.ZodBoolean>;
472
+ /** Maximum directive followUp attempts before falling through to L3
473
+ * synthesis. 0 = disabled. */
474
+ maxRetries: z.ZodDefault<z.ZodNumber>;
475
+ }, z.core.$strict>>;
463
476
  }, z.core.$strict>;
464
477
  export type ContextEngineConfig = z.infer<typeof ContextEngineConfigSchema>;
465
478
  /**
@@ -1666,6 +1679,19 @@ export declare const PerAgentConfigSchema: z.ZodObject<{
1666
1679
  summaryModel: z.ZodOptional<z.ZodString>;
1667
1680
  /** Optional provider override for DAG summary generation. */
1668
1681
  summaryProvider: z.ZodOptional<z.ZodString>;
1682
+ /** Post-batch continuation handler: when the LLM emits an empty final
1683
+ * turn after a successful tool batch, fire a directive followUp with
1684
+ * multi-shot retry. Replaces the legacy SEP one-shot completeness nudge
1685
+ * (whose enforcement role was superseded; SEP plan extraction + step
1686
+ * counting remain intact for observability). */
1687
+ postBatchContinuation: z.ZodDefault<z.ZodObject<{
1688
+ /** Master toggle. When false, handler returns
1689
+ * {recovered: false, outcome: "disabled"} without calling followUp. */
1690
+ enabled: z.ZodDefault<z.ZodBoolean>;
1691
+ /** Maximum directive followUp attempts before falling through to L3
1692
+ * synthesis. 0 = disabled. */
1693
+ maxRetries: z.ZodDefault<z.ZodNumber>;
1694
+ }, z.core.$strict>>;
1669
1695
  }, z.core.$strict>>;
1670
1696
  sourceGate: z.ZodOptional<z.ZodObject<{
1671
1697
  /** Default byte cap for HTTP responses (matches DEFAULT_SOURCE_PROFILES.web_fetch.maxResponseBytes) */
@@ -2346,6 +2372,19 @@ export declare const AgentsMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
2346
2372
  summaryModel: z.ZodOptional<z.ZodString>;
2347
2373
  /** Optional provider override for DAG summary generation. */
2348
2374
  summaryProvider: z.ZodOptional<z.ZodString>;
2375
+ /** Post-batch continuation handler: when the LLM emits an empty final
2376
+ * turn after a successful tool batch, fire a directive followUp with
2377
+ * multi-shot retry. Replaces the legacy SEP one-shot completeness nudge
2378
+ * (whose enforcement role was superseded; SEP plan extraction + step
2379
+ * counting remain intact for observability). */
2380
+ postBatchContinuation: z.ZodDefault<z.ZodObject<{
2381
+ /** Master toggle. When false, handler returns
2382
+ * {recovered: false, outcome: "disabled"} without calling followUp. */
2383
+ enabled: z.ZodDefault<z.ZodBoolean>;
2384
+ /** Maximum directive followUp attempts before falling through to L3
2385
+ * synthesis. 0 = disabled. */
2386
+ maxRetries: z.ZodDefault<z.ZodNumber>;
2387
+ }, z.core.$strict>>;
2349
2388
  }, z.core.$strict>>;
2350
2389
  sourceGate: z.ZodOptional<z.ZodObject<{
2351
2390
  /** Default byte cap for HTTP responses (matches DEFAULT_SOURCE_PROFILES.web_fetch.maxResponseBytes) */
@@ -359,6 +359,20 @@ export const ContextEngineConfigSchema = z.strictObject({
359
359
  summaryModel: z.string().optional(),
360
360
  /** Optional provider override for DAG summary generation. */
361
361
  summaryProvider: z.string().optional(),
362
+ // --- Post-batch continuation (L4 — replaces SEP nudge enforcement) ---
363
+ /** Post-batch continuation handler: when the LLM emits an empty final
364
+ * turn after a successful tool batch, fire a directive followUp with
365
+ * multi-shot retry. Replaces the legacy SEP one-shot completeness nudge
366
+ * (whose enforcement role was superseded; SEP plan extraction + step
367
+ * counting remain intact for observability). */
368
+ postBatchContinuation: z.strictObject({
369
+ /** Master toggle. When false, handler returns
370
+ * {recovered: false, outcome: "disabled"} without calling followUp. */
371
+ enabled: z.boolean().default(true),
372
+ /** Maximum directive followUp attempts before falling through to L3
373
+ * synthesis. 0 = disabled. */
374
+ maxRetries: z.number().int().min(0).max(5).default(2),
375
+ }).default({ enabled: true, maxRetries: 2 }),
362
376
  });
363
377
  // ── Context Guard Schemas ──────────────────────────────────────���────────
364
378
  /**
@@ -422,6 +422,10 @@ export declare const AppConfigSchema: z.ZodObject<{
422
422
  annotationTriggerChars: z.ZodDefault<z.ZodNumber>;
423
423
  summaryModel: z.ZodOptional<z.ZodString>;
424
424
  summaryProvider: z.ZodOptional<z.ZodString>;
425
+ postBatchContinuation: z.ZodDefault<z.ZodObject<{
426
+ enabled: z.ZodDefault<z.ZodBoolean>;
427
+ maxRetries: z.ZodDefault<z.ZodNumber>;
428
+ }, z.core.$strict>>;
425
429
  }, z.core.$strict>>;
426
430
  sourceGate: z.ZodOptional<z.ZodObject<{
427
431
  maxResponseBytes: z.ZodDefault<z.ZodNumber>;
@@ -112,4 +112,18 @@ export const AppConfigSchema = z.strictObject({
112
112
  documentation: DocumentationConfigSchema.default(() => DocumentationConfigSchema.parse({})),
113
113
  /** Telegram file reference guard: detects hallucinated file paths in responses */
114
114
  telegramFileRefGuard: TelegramFileRefGuardConfigSchema.default(() => TelegramFileRefGuardConfigSchema.parse({})),
115
+ }).superRefine((config, ctx) => {
116
+ // Startup invariant: reject the reserved "default" provider name.
117
+ // "default" collides with PerAgentConfigSchema.provider's schema default
118
+ // value, making it impossible to distinguish "user explicitly chose the
119
+ // provider named 'default'" from "user omitted the provider field and got
120
+ // the schema default". Reject at parse time with an actionable rename hint.
121
+ if (config.providers?.entries?.default !== undefined) {
122
+ ctx.addIssue({
123
+ code: z.ZodIssueCode.custom,
124
+ path: ["providers", "entries", "default"],
125
+ message: "providers.entries.default is reserved (it collides with the PerAgentConfig.provider " +
126
+ "schema default). Rename to a specific identifier like providers.entries.anthropic-default.",
127
+ });
128
+ }
115
129
  });
@@ -201,8 +201,8 @@ export declare const ExecutionGraphSchema: z.ZodObject<{
201
201
  label: z.ZodOptional<z.ZodString>;
202
202
  /** Failure strategy: fail-fast stops on first failure, continue runs remaining */
203
203
  onFailure: z.ZodDefault<z.ZodEnum<{
204
- "fail-fast": "fail-fast";
205
204
  continue: "continue";
205
+ "fail-fast": "fail-fast";
206
206
  }>>;
207
207
  /** Graph-level timeout in milliseconds (default: 1 500 000 — 25 minutes) */
208
208
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -234,6 +234,20 @@ export interface AgentEvents {
234
234
  totalAttempts: number;
235
235
  timestamp: number;
236
236
  };
237
+ /** Last-known-working model fallback: attempt to use a recently successful model */
238
+ "model:lkw_fallback_attempt": {
239
+ fromProvider: string;
240
+ fromModel: string;
241
+ toProvider: string;
242
+ toModel: string;
243
+ timestamp: number;
244
+ };
245
+ /** Last-known-working model fallback: LKW model succeeded */
246
+ "model:lkw_fallback_succeeded": {
247
+ provider: string;
248
+ model: string;
249
+ timestamp: number;
250
+ };
237
251
  /** Auth profile entered cooldown after failure */
238
252
  "model:auth_cooldown": {
239
253
  keyName: string;
@@ -346,14 +360,15 @@ export interface AgentEvents {
346
360
  stepCount: number;
347
361
  timestamp: number;
348
362
  };
349
- /** SEP plan completed (all steps resolved) */
363
+ /** SEP plan completed (all steps resolved). Observability-only post-L4 —
364
+ * the legacy enforcement nudge was replaced by the post-batch
365
+ * continuation handler. */
350
366
  "sep:plan_completed": {
351
367
  agentId: string;
352
368
  sessionKey: string;
353
369
  stepsPlanned: number;
354
370
  stepsCompleted: number;
355
371
  stepsSkipped: number;
356
- nudgeTriggered: boolean;
357
372
  durationMs: number;
358
373
  timestamp: number;
359
374
  };
@@ -1,2 +1,2 @@
1
- export { AppConfigSchema, AgentConfigSchema, AgentsMapSchema, BudgetConfigSchema, CircuitBreakerConfigSchema, DmScopeConfigSchema, ElevatedReplyConfigSchema, ModelRoutesSchema, HeartbeatConfigSchema, HeartbeatTargetSchema, PerAgentConfigSchema, PerAgentCronConfigSchema, PerAgentHeartbeatConfigSchema, PerAgentSchedulerConfigSchema, PruningConfigSchema, RagConfigSchema, ResetPolicyOverrideSchema, RoutingBindingSchema, RoutingConfigSchema, SessionResetPolicySchema, TracingConfigSchema, ChannelConfigSchema, ChannelEntrySchema, ChannelHealthCheckSchema, MemoryConfigSchema, CompactionConfigSchema, RetentionConfigSchema, SecurityConfigSchema, PermissionConfigSchema, ActionConfirmationConfigSchema, AgentToAgentConfigSchema, SkillsConfigSchema, DaemonConfigSchema, LoggingConfigSchema, TracingDefaultsSchema, ConfigWebhookSchema, SchedulerConfigSchema, GatewayConfigSchema, GatewayTlsConfigSchema, GatewayTokenSchema, GatewayRateLimitSchema, IntegrationsConfigSchema, BraveSearchConfigSchema, McpServerEntrySchema, McpConfigSchema, TranscriptionConfigSchema, TtsConfigSchema, TtsAutoModeSchema, ElevenLabsVoiceSettingsSchema, TtsOutputFormatSchema, ImageAnalysisConfigSchema, VisionScopeRuleSchema, VisionConfigSchema, LinkUnderstandingConfigSchema, MediaConfigSchema, DOCUMENT_MIME_WHITELIST, FileExtractionConfigSchema, AutoReplyRuleSchema, AutoReplyConfigSchema, MonitoringConfigSchema, PluginsConfigSchema, PluginEntrySchema, QueueConfigSchema, QueueModeSchema, OverflowPolicySchema, PerChannelQueueConfigSchema, OverflowConfigSchema, DebounceBufferConfigSchema, FollowupConfigSchema, PriorityLaneConfigSchema, LaneAssignmentConfigSchema, StreamingConfigSchema, PerChannelStreamingConfigSchema, TypingModeSchema, ChunkModeSchema, DeliveryMirrorConfigSchema, DeliveryQueueConfigSchema, DeliveryTimingConfigSchema, DeliveryTimingModeSchema, CoalescerConfigSchema, AutoReplyEngineConfigSchema, GroupActivationModeSchema, SendPolicyConfigSchema, SendPolicyRuleSchema, SendActionSchema, EnvelopeConfigSchema, RetryConfigSchema, WebhooksConfigSchema, WebhookMappingConfigSchema, WebhookMappingMatchSchema, AgentSecretsConfigSchema, SecretsConfigSchema, DocumentationConfigSchema, DocumentationLinkSchema, ImageGenerationConfigSchema, NotificationConfigSchema, VerbosityConfigSchema, VerbosityLevelSchema, VerbosityOverrideSchema, ContextEngineConfigSchema, BackgroundTasksConfigSchema, MemoryReviewConfigSchema, UserModelSchema, ModelCostSchema, OperationModelEntrySchema, OperationModelsSchema, substituteEnvVars, warnSuspiciousEnvValues, loadConfigFile, validateConfig, deepMerge, mergeLayered, loadLayered, IMMUTABLE_CONFIG_PREFIXES, MUTABLE_CONFIG_OVERRIDES, isImmutableConfigPath, matchesOverridePattern, getMutableOverridesForSection, MANAGED_SECTIONS, getManagedSectionRedirect, formatRedirectHint, getConfigSchema, getConfigSections, getFieldMetadata, validatePartial, createConfigGitManager, checkApprovalsConfig, } from "../config/index.js";
2
- export type { AppConfig, AgentConfig, BudgetConfig, CircuitBreakerConfig, DmScopeConfig, ElevatedReplyConfig, ModelRoutes, PruningConfig, HeartbeatConfig, HeartbeatTarget, PerAgentConfig, PerAgentCronConfig, PerAgentHeartbeatConfig, PerAgentSchedulerConfig, RagConfig, ResetPolicyOverride, RoutingBinding, RoutingConfig, SessionResetPolicyConfig, TracingConfig, ChannelConfig, ChannelEntry, ChannelHealthCheckConfig, AckReactionConfig, MemoryConfig, CompactionConfig, RetentionConfig, SecurityConfig, PermissionConfig, ActionConfirmationConfig, AgentToAgentConfig, SkillsConfig, DaemonConfig, LoggingConfig, TracingDefaults, ConfigWebhook, SchedulerConfig, GatewayConfig, GatewayTlsConfig, GatewayToken, GatewayRateLimit, IntegrationsConfig, BraveSearchConfig, McpServerEntry, McpConfig, TranscriptionConfig, TtsConfig, TtsAutoMode, ElevenLabsVoiceSettings, TtsOutputFormat, ImageAnalysisConfig, VisionScopeRule, VisionConfig, LinkUnderstandingConfig, MediaConfig, FileExtractionConfig, AutoReplyRule, AutoReplyConfig, MonitoringConfig, DiskMonitorConfig, ResourceMonitorConfig, SystemdMonitorConfig, SecurityUpdateMonitorConfig, GitMonitorConfig, PluginsConfig, PluginEntry, QueueConfig, PerChannelQueueConfig, QueueMode, OverflowPolicy, OverflowConfig, DebounceBufferConfig, FollowupConfig, PriorityLaneConfig, LaneAssignmentConfig, StreamingConfig, PerChannelStreamingConfig, TypingMode, ChunkMode, DeliveryMirrorConfig, DeliveryQueueConfig, DeliveryTimingConfig, DeliveryTimingMode, CoalescerConfig, AutoReplyEngineConfig, GroupActivationMode, SendPolicyConfig, SendPolicyRule, SendAction, EnvelopeConfig, RetryConfig, WebhooksConfig, WebhookMappingConfig, AgentSecretsConfig, SecretsConfig, ConfigError, ConfigErrorCode, FieldMetadata, PartialValidationResult, ConfigGitManager, GitCommitMetadata, HistoryEntry, GitManagerDeps, ExecGitFn, EnvValueWarning, LifecycleReactionsConfig, LifecycleReactionsTimingConfig, SenderTrustDisplayConfig, DocumentationConfig, DocumentationLink, ImageGenerationConfig, NotificationConfig, VerbosityConfig, VerbosityLevel, VerbosityOverride, ContextEngineConfig, BackgroundTasksConfig, MemoryReviewConfig, UserModel, ModelCost, OperationModelEntry, OperationModels, ModelOperationType, } from "../config/index.js";
1
+ export { AppConfigSchema, AgentConfigSchema, AgentsMapSchema, BudgetConfigSchema, CircuitBreakerConfigSchema, DmScopeConfigSchema, ElevatedReplyConfigSchema, ModelRoutesSchema, HeartbeatConfigSchema, HeartbeatTargetSchema, PerAgentConfigSchema, PerAgentCronConfigSchema, PerAgentHeartbeatConfigSchema, PerAgentSchedulerConfigSchema, PruningConfigSchema, RagConfigSchema, ResetPolicyOverrideSchema, RoutingBindingSchema, RoutingConfigSchema, SessionResetPolicySchema, TracingConfigSchema, ChannelConfigSchema, ChannelEntrySchema, ChannelHealthCheckSchema, MemoryConfigSchema, CompactionConfigSchema, RetentionConfigSchema, SecurityConfigSchema, PermissionConfigSchema, ActionConfirmationConfigSchema, AgentToAgentConfigSchema, SkillsConfigSchema, DaemonConfigSchema, LoggingConfigSchema, TracingDefaultsSchema, ConfigWebhookSchema, SchedulerConfigSchema, GatewayConfigSchema, GatewayTlsConfigSchema, GatewayTokenSchema, GatewayRateLimitSchema, IntegrationsConfigSchema, BraveSearchConfigSchema, McpServerEntrySchema, McpConfigSchema, TranscriptionConfigSchema, TtsConfigSchema, TtsAutoModeSchema, ElevenLabsVoiceSettingsSchema, TtsOutputFormatSchema, ImageAnalysisConfigSchema, VisionScopeRuleSchema, VisionConfigSchema, LinkUnderstandingConfigSchema, MediaConfigSchema, DOCUMENT_MIME_WHITELIST, FileExtractionConfigSchema, AutoReplyRuleSchema, AutoReplyConfigSchema, MonitoringConfigSchema, PluginsConfigSchema, PluginEntrySchema, QueueConfigSchema, QueueModeSchema, OverflowPolicySchema, PerChannelQueueConfigSchema, OverflowConfigSchema, DebounceBufferConfigSchema, FollowupConfigSchema, PriorityLaneConfigSchema, LaneAssignmentConfigSchema, StreamingConfigSchema, PerChannelStreamingConfigSchema, TypingModeSchema, ChunkModeSchema, DeliveryMirrorConfigSchema, DeliveryQueueConfigSchema, DeliveryTimingConfigSchema, DeliveryTimingModeSchema, CoalescerConfigSchema, AutoReplyEngineConfigSchema, GroupActivationModeSchema, SendPolicyConfigSchema, SendPolicyRuleSchema, SendActionSchema, EnvelopeConfigSchema, RetryConfigSchema, WebhooksConfigSchema, WebhookMappingConfigSchema, WebhookMappingMatchSchema, AgentSecretsConfigSchema, SecretsConfigSchema, DocumentationConfigSchema, DocumentationLinkSchema, ImageGenerationConfigSchema, NotificationConfigSchema, VerbosityConfigSchema, VerbosityLevelSchema, VerbosityOverrideSchema, ContextEngineConfigSchema, BackgroundTasksConfigSchema, MemoryReviewConfigSchema, ProviderEntrySchema, ProvidersConfigSchema, UserModelSchema, ModelCostSchema, OperationModelEntrySchema, OperationModelsSchema, substituteEnvVars, warnSuspiciousEnvValues, loadConfigFile, validateConfig, deepMerge, mergeLayered, loadLayered, IMMUTABLE_CONFIG_PREFIXES, MUTABLE_CONFIG_OVERRIDES, isImmutableConfigPath, matchesOverridePattern, getMutableOverridesForSection, MANAGED_SECTIONS, getManagedSectionRedirect, formatRedirectHint, getConfigSchema, getConfigSections, getFieldMetadata, validatePartial, createConfigGitManager, checkApprovalsConfig, } from "../config/index.js";
2
+ export type { AppConfig, AgentConfig, BudgetConfig, CircuitBreakerConfig, DmScopeConfig, ElevatedReplyConfig, ModelRoutes, PruningConfig, HeartbeatConfig, HeartbeatTarget, PerAgentConfig, PerAgentCronConfig, PerAgentHeartbeatConfig, PerAgentSchedulerConfig, RagConfig, ResetPolicyOverride, RoutingBinding, RoutingConfig, SessionResetPolicyConfig, TracingConfig, ChannelConfig, ChannelEntry, ChannelHealthCheckConfig, AckReactionConfig, MemoryConfig, CompactionConfig, RetentionConfig, SecurityConfig, PermissionConfig, ActionConfirmationConfig, AgentToAgentConfig, SkillsConfig, DaemonConfig, LoggingConfig, TracingDefaults, ConfigWebhook, SchedulerConfig, GatewayConfig, GatewayTlsConfig, GatewayToken, GatewayRateLimit, IntegrationsConfig, BraveSearchConfig, McpServerEntry, McpConfig, TranscriptionConfig, TtsConfig, TtsAutoMode, ElevenLabsVoiceSettings, TtsOutputFormat, ImageAnalysisConfig, VisionScopeRule, VisionConfig, LinkUnderstandingConfig, MediaConfig, FileExtractionConfig, AutoReplyRule, AutoReplyConfig, MonitoringConfig, DiskMonitorConfig, ResourceMonitorConfig, SystemdMonitorConfig, SecurityUpdateMonitorConfig, GitMonitorConfig, PluginsConfig, PluginEntry, QueueConfig, PerChannelQueueConfig, QueueMode, OverflowPolicy, OverflowConfig, DebounceBufferConfig, FollowupConfig, PriorityLaneConfig, LaneAssignmentConfig, StreamingConfig, PerChannelStreamingConfig, TypingMode, ChunkMode, DeliveryMirrorConfig, DeliveryQueueConfig, DeliveryTimingConfig, DeliveryTimingMode, CoalescerConfig, AutoReplyEngineConfig, GroupActivationMode, SendPolicyConfig, SendPolicyRule, SendAction, EnvelopeConfig, RetryConfig, WebhooksConfig, WebhookMappingConfig, AgentSecretsConfig, SecretsConfig, ConfigError, ConfigErrorCode, FieldMetadata, PartialValidationResult, ConfigGitManager, GitCommitMetadata, HistoryEntry, GitManagerDeps, ExecGitFn, EnvValueWarning, LifecycleReactionsConfig, LifecycleReactionsTimingConfig, SenderTrustDisplayConfig, DocumentationConfig, DocumentationLink, ImageGenerationConfig, NotificationConfig, VerbosityConfig, VerbosityLevel, VerbosityOverride, ContextEngineConfig, BackgroundTasksConfig, MemoryReviewConfig, ProviderEntry, ProvidersConfig, UserModel, ModelCost, OperationModelEntry, OperationModels, ModelOperationType, } from "../config/index.js";
@@ -1,3 +1,3 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // @comis/core exports — Config (layered configuration with Zod validation)
3
- export { AppConfigSchema, AgentConfigSchema, AgentsMapSchema, BudgetConfigSchema, CircuitBreakerConfigSchema, DmScopeConfigSchema, ElevatedReplyConfigSchema, ModelRoutesSchema, HeartbeatConfigSchema, HeartbeatTargetSchema, PerAgentConfigSchema, PerAgentCronConfigSchema, PerAgentHeartbeatConfigSchema, PerAgentSchedulerConfigSchema, PruningConfigSchema, RagConfigSchema, ResetPolicyOverrideSchema, RoutingBindingSchema, RoutingConfigSchema, SessionResetPolicySchema, TracingConfigSchema, ChannelConfigSchema, ChannelEntrySchema, ChannelHealthCheckSchema, MemoryConfigSchema, CompactionConfigSchema, RetentionConfigSchema, SecurityConfigSchema, PermissionConfigSchema, ActionConfirmationConfigSchema, AgentToAgentConfigSchema, SkillsConfigSchema, DaemonConfigSchema, LoggingConfigSchema, TracingDefaultsSchema, ConfigWebhookSchema, SchedulerConfigSchema, GatewayConfigSchema, GatewayTlsConfigSchema, GatewayTokenSchema, GatewayRateLimitSchema, IntegrationsConfigSchema, BraveSearchConfigSchema, McpServerEntrySchema, McpConfigSchema, TranscriptionConfigSchema, TtsConfigSchema, TtsAutoModeSchema, ElevenLabsVoiceSettingsSchema, TtsOutputFormatSchema, ImageAnalysisConfigSchema, VisionScopeRuleSchema, VisionConfigSchema, LinkUnderstandingConfigSchema, MediaConfigSchema, DOCUMENT_MIME_WHITELIST, FileExtractionConfigSchema, AutoReplyRuleSchema, AutoReplyConfigSchema, MonitoringConfigSchema, PluginsConfigSchema, PluginEntrySchema, QueueConfigSchema, QueueModeSchema, OverflowPolicySchema, PerChannelQueueConfigSchema, OverflowConfigSchema, DebounceBufferConfigSchema, FollowupConfigSchema, PriorityLaneConfigSchema, LaneAssignmentConfigSchema, StreamingConfigSchema, PerChannelStreamingConfigSchema, TypingModeSchema, ChunkModeSchema, DeliveryMirrorConfigSchema, DeliveryQueueConfigSchema, DeliveryTimingConfigSchema, DeliveryTimingModeSchema, CoalescerConfigSchema, AutoReplyEngineConfigSchema, GroupActivationModeSchema, SendPolicyConfigSchema, SendPolicyRuleSchema, SendActionSchema, EnvelopeConfigSchema, RetryConfigSchema, WebhooksConfigSchema, WebhookMappingConfigSchema, WebhookMappingMatchSchema, AgentSecretsConfigSchema, SecretsConfigSchema, DocumentationConfigSchema, DocumentationLinkSchema, ImageGenerationConfigSchema, NotificationConfigSchema, VerbosityConfigSchema, VerbosityLevelSchema, VerbosityOverrideSchema, ContextEngineConfigSchema, BackgroundTasksConfigSchema, MemoryReviewConfigSchema, UserModelSchema, ModelCostSchema, OperationModelEntrySchema, OperationModelsSchema, substituteEnvVars, warnSuspiciousEnvValues, loadConfigFile, validateConfig, deepMerge, mergeLayered, loadLayered, IMMUTABLE_CONFIG_PREFIXES, MUTABLE_CONFIG_OVERRIDES, isImmutableConfigPath, matchesOverridePattern, getMutableOverridesForSection, MANAGED_SECTIONS, getManagedSectionRedirect, formatRedirectHint, getConfigSchema, getConfigSections, getFieldMetadata, validatePartial, createConfigGitManager, checkApprovalsConfig, } from "../config/index.js";
3
+ export { AppConfigSchema, AgentConfigSchema, AgentsMapSchema, BudgetConfigSchema, CircuitBreakerConfigSchema, DmScopeConfigSchema, ElevatedReplyConfigSchema, ModelRoutesSchema, HeartbeatConfigSchema, HeartbeatTargetSchema, PerAgentConfigSchema, PerAgentCronConfigSchema, PerAgentHeartbeatConfigSchema, PerAgentSchedulerConfigSchema, PruningConfigSchema, RagConfigSchema, ResetPolicyOverrideSchema, RoutingBindingSchema, RoutingConfigSchema, SessionResetPolicySchema, TracingConfigSchema, ChannelConfigSchema, ChannelEntrySchema, ChannelHealthCheckSchema, MemoryConfigSchema, CompactionConfigSchema, RetentionConfigSchema, SecurityConfigSchema, PermissionConfigSchema, ActionConfirmationConfigSchema, AgentToAgentConfigSchema, SkillsConfigSchema, DaemonConfigSchema, LoggingConfigSchema, TracingDefaultsSchema, ConfigWebhookSchema, SchedulerConfigSchema, GatewayConfigSchema, GatewayTlsConfigSchema, GatewayTokenSchema, GatewayRateLimitSchema, IntegrationsConfigSchema, BraveSearchConfigSchema, McpServerEntrySchema, McpConfigSchema, TranscriptionConfigSchema, TtsConfigSchema, TtsAutoModeSchema, ElevenLabsVoiceSettingsSchema, TtsOutputFormatSchema, ImageAnalysisConfigSchema, VisionScopeRuleSchema, VisionConfigSchema, LinkUnderstandingConfigSchema, MediaConfigSchema, DOCUMENT_MIME_WHITELIST, FileExtractionConfigSchema, AutoReplyRuleSchema, AutoReplyConfigSchema, MonitoringConfigSchema, PluginsConfigSchema, PluginEntrySchema, QueueConfigSchema, QueueModeSchema, OverflowPolicySchema, PerChannelQueueConfigSchema, OverflowConfigSchema, DebounceBufferConfigSchema, FollowupConfigSchema, PriorityLaneConfigSchema, LaneAssignmentConfigSchema, StreamingConfigSchema, PerChannelStreamingConfigSchema, TypingModeSchema, ChunkModeSchema, DeliveryMirrorConfigSchema, DeliveryQueueConfigSchema, DeliveryTimingConfigSchema, DeliveryTimingModeSchema, CoalescerConfigSchema, AutoReplyEngineConfigSchema, GroupActivationModeSchema, SendPolicyConfigSchema, SendPolicyRuleSchema, SendActionSchema, EnvelopeConfigSchema, RetryConfigSchema, WebhooksConfigSchema, WebhookMappingConfigSchema, WebhookMappingMatchSchema, AgentSecretsConfigSchema, SecretsConfigSchema, DocumentationConfigSchema, DocumentationLinkSchema, ImageGenerationConfigSchema, NotificationConfigSchema, VerbosityConfigSchema, VerbosityLevelSchema, VerbosityOverrideSchema, ContextEngineConfigSchema, BackgroundTasksConfigSchema, MemoryReviewConfigSchema, ProviderEntrySchema, ProvidersConfigSchema, UserModelSchema, ModelCostSchema, OperationModelEntrySchema, OperationModelsSchema, substituteEnvVars, warnSuspiciousEnvValues, loadConfigFile, validateConfig, deepMerge, mergeLayered, loadLayered, IMMUTABLE_CONFIG_PREFIXES, MUTABLE_CONFIG_OVERRIDES, isImmutableConfigPath, matchesOverridePattern, getMutableOverridesForSection, MANAGED_SECTIONS, getManagedSectionRedirect, formatRedirectHint, getConfigSchema, getConfigSections, getFieldMetadata, validatePartial, createConfigGitManager, checkApprovalsConfig, } from "../config/index.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/core",
3
3
  "private": true,
4
- "version": "1.0.24",
4
+ "version": "1.0.26",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Core domain types, ports, event bus, security, and config for Comis",
@@ -4,6 +4,28 @@
4
4
  */
5
5
  import type { DaemonInstance, DaemonOverrides } from "./daemon-types.js";
6
6
  export type { DaemonInstance, DaemonOverrides } from "./daemon-types.js";
7
+ /**
8
+ * When ANTHROPIC_LOG=debug|info is set, the Anthropic SDK calls
9
+ * `console.debug('[req] sending request', { ...payload })`, which Node
10
+ * formats with util.inspect using the default `depth: 2`. That collapses
11
+ * the request body to `messages: [Array]`, so we lose the actual body
12
+ * we are trying to capture.
13
+ *
14
+ * This helper deepens util.inspect ONLY when the SDK debug logger is
15
+ * actually enabled. When ANTHROPIC_LOG is unset, the SDK emits no debug
16
+ * lines anyway, so we leave inspect defaults alone — keeping production
17
+ * logs unchanged.
18
+ *
19
+ * `breakLength: Infinity` keeps each log line single-line so grep-based
20
+ * inspection of the daemon log keeps working.
21
+ *
22
+ * Returns whether each default was changed (used by tests; ignored at
23
+ * runtime).
24
+ */
25
+ export declare function applyInspectDefaultsForLogging(env: Record<string, string | undefined>): {
26
+ depthChanged: boolean;
27
+ breakLengthChanged: boolean;
28
+ };
7
29
  interface PermissionCorrection {
8
30
  file: string;
9
31
  oldMode: number;
@@ -26,6 +26,7 @@ import { setupChannelHealthLogging } from "./observability/channel-health-logger
26
26
  import { registerGracefulShutdown } from "./process/graceful-shutdown.js";
27
27
  import { createProcessMonitor } from "./process/process-monitor.js";
28
28
  import { startWatchdog } from "./health/watchdog.js";
29
+ import { emitDockerRestartPolicyWarn } from "./setup-docker-restart-warn.js";
29
30
  import { randomUUID, createHmac } from "node:crypto";
30
31
  import { existsSync, chmodSync, statSync, mkdirSync, readFileSync, unlinkSync, cpSync } from "node:fs";
31
32
  import { writeFile as fsWriteFile, rm } from "node:fs/promises";
@@ -36,10 +37,40 @@ import { logOperationModelDryRun } from "./wiring/startup-dry-run.js";
36
37
  import os from "node:os";
37
38
  import { join as pathJoin, dirname as pathDirname, resolve as pathResolve } from "node:path";
38
39
  import { fileURLToPath } from "node:url";
40
+ import { inspect } from "node:util";
39
41
  const DEFAULT_CONFIG_PATHS = [
40
42
  safePath(safePath(os.homedir(), ".comis"), "config.yaml"),
41
43
  safePath(safePath(os.homedir(), ".comis"), "config.local.yaml"),
42
44
  ];
45
+ /**
46
+ * When ANTHROPIC_LOG=debug|info is set, the Anthropic SDK calls
47
+ * `console.debug('[req] sending request', { ...payload })`, which Node
48
+ * formats with util.inspect using the default `depth: 2`. That collapses
49
+ * the request body to `messages: [Array]`, so we lose the actual body
50
+ * we are trying to capture.
51
+ *
52
+ * This helper deepens util.inspect ONLY when the SDK debug logger is
53
+ * actually enabled. When ANTHROPIC_LOG is unset, the SDK emits no debug
54
+ * lines anyway, so we leave inspect defaults alone — keeping production
55
+ * logs unchanged.
56
+ *
57
+ * `breakLength: Infinity` keeps each log line single-line so grep-based
58
+ * inspection of the daemon log keeps working.
59
+ *
60
+ * Returns whether each default was changed (used by tests; ignored at
61
+ * runtime).
62
+ */
63
+ export function applyInspectDefaultsForLogging(env) {
64
+ const lvl = env["ANTHROPIC_LOG"];
65
+ if (lvl !== "debug" && lvl !== "info") {
66
+ return { depthChanged: false, breakLengthChanged: false };
67
+ }
68
+ const depthChanged = inspect.defaultOptions.depth !== null;
69
+ const breakLengthChanged = inspect.defaultOptions.breakLength !== Infinity;
70
+ inspect.defaultOptions.depth = null;
71
+ inspect.defaultOptions.breakLength = Infinity;
72
+ return { depthChanged, breakLengthChanged };
73
+ }
43
74
  /**
44
75
  * Sensitive environment variable prefixes to remove from process.env after
45
76
  * the SecretManager snapshot captures them. Prevents leakage through
@@ -165,6 +196,13 @@ export async function runPreflightDoctor(exitFn, opts = {}) {
165
196
  export async function main(overrides = {}) {
166
197
  const startupStartMs = Date.now();
167
198
  const instanceId = randomUUID().slice(0, 8);
199
+ // Anthropic SDK debug log lines route through console.debug -> util.inspect.
200
+ // Deepen inspect defaults BEFORE any code path that may construct an
201
+ // Anthropic client (skills/agent setup, prewarm, etc.) so the very first
202
+ // `[req] sending request` line shows the full body. Gated on ANTHROPIC_LOG
203
+ // so production runs are unaffected.
204
+ // eslint-disable-next-line no-restricted-syntax -- process.env access required before SecretManager is initialized; ANTHROPIC_LOG is the SDK-owned switch, not a comis credential.
205
+ applyInspectDefaultsForLogging(process.env);
168
206
  const _bootstrap = overrides.bootstrap ?? bootstrap;
169
207
  const _setupSecrets = overrides.setupSecrets ?? _setupSecretsImpl;
170
208
  const _createTracingLogger = overrides.createTracingLogger ?? createTracingLogger;
@@ -1044,6 +1082,9 @@ export async function main(overrides = {}) {
1044
1082
  };
1045
1083
  wireDispatch(rpcDispatchDeps);
1046
1084
  // 7. Gateway
1085
+ // gateway.host / .port are resolved through the layered config in bootstrap:
1086
+ // schema defaults < env layer (COMIS_GATEWAY_HOST/PORT) < config.yaml.
1087
+ // See packages/core/src/config/env-layer.ts.
1047
1088
  const gwConfig = container.config.gateway;
1048
1089
  const { gatewayHandle, activeExecutions, getActiveConnectionCount, wsConnections } = await setupGateway({
1049
1090
  container, gwConfig, webhooksConfig: container.config.webhooks, agents, defaultAgentId,
@@ -1278,6 +1319,10 @@ export async function main(overrides = {}) {
1278
1319
  },
1279
1320
  },
1280
1321
  }, "Comis daemon started");
1322
+ // Docker-only: surface restart-policy requirement immediately after the
1323
+ // startup banner. No-op outside containers. Wired here so the WARN lands
1324
+ // in `docker logs` next to the banner, where operators look first.
1325
+ emitDockerRestartPolicyWarn(daemonLogger);
1281
1326
  // Snapshot current config as last-known-good after successful startup
1282
1327
  if (configPaths.length > 0) {
1283
1328
  const activeConfigPath = configPaths[configPaths.length - 1];
@@ -12,7 +12,7 @@
12
12
  * the runtime agents map, and returns structured results.
13
13
  * @module
14
14
  */
15
- import type { PerAgentConfig } from "@comis/core";
15
+ import type { PerAgentConfig, ProviderEntry } from "@comis/core";
16
16
  import { type PersistToConfigDeps } from "./persist-to-config.js";
17
17
  import type { RpcHandler } from "./types.js";
18
18
  /** Dependencies required by agent management RPC handlers. */
@@ -29,10 +29,13 @@ export interface AgentHandlerDeps {
29
29
  hotAdd?: (agentId: string, config: PerAgentConfig) => Promise<void>;
30
30
  /** Hot-remove callback: tears down agent runtime without restart. When provided, skipRestart: true is passed to persistToConfig. */
31
31
  hotRemove?: (agentId: string) => Promise<void>;
32
- /** SecretManager for API key availability checks. */
32
+ /** SecretManager for API key availability checks and probe key retrieval. */
33
33
  secretManager?: {
34
34
  has(key: string): boolean;
35
+ get(key: string): string | undefined;
35
36
  };
37
+ /** Provider entries map for probe lookups when agents switch providers. */
38
+ providerEntries?: Record<string, ProviderEntry>;
36
39
  }
37
40
  /**
38
41
  * Create a record of agent management RPC handlers bound to the given deps.