comisai 1.0.25 → 1.0.27
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.
- package/node_modules/@comis/agent/dist/bootstrap/sections/tool-descriptions.js +130 -10
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.d.ts +1 -1
- package/node_modules/@comis/agent/dist/bootstrap/sections/tooling-sections.js +9 -2
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.d.ts +8 -0
- package/node_modules/@comis/agent/dist/bridge/bridge-metrics.js +2 -0
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.d.ts +29 -0
- package/node_modules/@comis/agent/dist/bridge/pi-event-bridge.js +242 -2
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.d.ts +210 -0
- package/node_modules/@comis/agent/dist/bridge/thinking-block-hash-invariant.js +566 -0
- package/node_modules/@comis/agent/dist/context-engine/context-engine.js +8 -6
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.d.ts +51 -30
- package/node_modules/@comis/agent/dist/context-engine/signature-replay-scrubber.js +109 -36
- package/node_modules/@comis/agent/dist/executor/executor-context-engine-setup.js +5 -1
- package/node_modules/@comis/agent/dist/executor/executor-post-execution.js +22 -20
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.d.ts +2 -0
- package/node_modules/@comis/agent/dist/executor/executor-prompt-runner.js +111 -15
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.d.ts +20 -17
- package/node_modules/@comis/agent/dist/executor/executor-response-filter.js +132 -52
- package/node_modules/@comis/agent/dist/executor/executor-tool-assembly.js +16 -3
- package/node_modules/@comis/agent/dist/executor/model-retry.d.ts +14 -0
- package/node_modules/@comis/agent/dist/executor/model-retry.js +72 -1
- package/node_modules/@comis/agent/dist/executor/pi-executor.d.ts +3 -0
- package/node_modules/@comis/agent/dist/executor/pi-executor.js +68 -9
- package/node_modules/@comis/agent/dist/executor/post-batch-continuation.d.ts +82 -0
- package/node_modules/@comis/agent/dist/executor/post-batch-continuation.js +200 -0
- package/node_modules/@comis/agent/dist/executor/stream-wrappers/request-body-injector.js +1 -9
- package/node_modules/@comis/agent/dist/executor/tool-deferral.d.ts +37 -2
- package/node_modules/@comis/agent/dist/executor/tool-deferral.js +45 -3
- package/node_modules/@comis/agent/dist/executor/tool-parallelism.js +0 -1
- package/node_modules/@comis/agent/dist/executor/types.d.ts +11 -2
- package/node_modules/@comis/agent/dist/index.d.ts +3 -1
- package/node_modules/@comis/agent/dist/index.js +2 -0
- package/node_modules/@comis/agent/dist/model/last-known-model.d.ts +36 -0
- package/node_modules/@comis/agent/dist/model/last-known-model.js +49 -0
- package/node_modules/@comis/agent/dist/model/model-registry-adapter.d.ts +16 -4
- package/node_modules/@comis/agent/dist/model/model-registry-adapter.js +65 -21
- package/node_modules/@comis/agent/dist/planner/types.d.ts +0 -2
- package/node_modules/@comis/agent/dist/session/comis-session-manager.d.ts +10 -0
- package/node_modules/@comis/agent/dist/session/comis-session-manager.js +5 -0
- package/node_modules/@comis/agent/dist/spawn/pi-mono-adapters.js +7 -0
- package/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/client/rpc-client.js +6 -1
- package/node_modules/@comis/cli/dist/commands/doctor.js +5 -3
- package/node_modules/@comis/cli/dist/commands/health.js +5 -2
- package/node_modules/@comis/cli/dist/wizard/json-output.js +7 -3
- package/node_modules/@comis/cli/dist/wizard/steps/11-daemon-start.js +130 -0
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/dist/config/immutable-keys.d.ts +2 -2
- package/node_modules/@comis/core/dist/config/immutable-keys.js +8 -3
- package/node_modules/@comis/core/dist/config/managed-sections.d.ts +43 -4
- package/node_modules/@comis/core/dist/config/managed-sections.js +100 -6
- package/node_modules/@comis/core/dist/config/schema-agent.d.ts +39 -0
- package/node_modules/@comis/core/dist/config/schema-agent.js +14 -0
- package/node_modules/@comis/core/dist/config/schema.d.ts +4 -0
- package/node_modules/@comis/core/dist/config/schema.js +14 -0
- package/node_modules/@comis/core/dist/domain/execution-graph.d.ts +1 -1
- package/node_modules/@comis/core/dist/event-bus/events-agent.d.ts +17 -2
- package/node_modules/@comis/core/dist/exports/config.d.ts +2 -2
- package/node_modules/@comis/core/dist/exports/config.js +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/dist/daemon.d.ts +22 -0
- package/node_modules/@comis/daemon/dist/daemon.js +42 -0
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.d.ts +5 -2
- package/node_modules/@comis/daemon/dist/rpc/agent-handlers.js +80 -1
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.d.ts +67 -0
- package/node_modules/@comis/daemon/dist/rpc/agent-inline-workspace.js +139 -0
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.d.ts +3 -0
- package/node_modules/@comis/daemon/dist/rpc/model-handlers.js +29 -5
- package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.d.ts +30 -0
- package/node_modules/@comis/daemon/dist/rpc/probe-provider-auth.js +59 -0
- package/node_modules/@comis/daemon/dist/rpc/provider-handlers.d.ts +37 -0
- package/node_modules/@comis/daemon/dist/rpc/provider-handlers.js +330 -0
- package/node_modules/@comis/daemon/dist/rpc/rpc-dispatch.js +18 -1
- package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.d.ts +4 -0
- package/node_modules/@comis/daemon/dist/setup-docker-restart-warn.js +30 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.d.ts +3 -1
- package/node_modules/@comis/daemon/dist/wiring/setup-agents.js +28 -2
- package/node_modules/@comis/daemon/dist/wiring/setup-cross-session.js +1 -0
- package/node_modules/@comis/daemon/dist/wiring/setup-tools.js +7 -4
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/dist/index.d.ts +1 -0
- package/node_modules/@comis/infra/dist/index.js +2 -0
- package/node_modules/@comis/infra/dist/runtime/is-docker.d.ts +1 -0
- package/node_modules/@comis/infra/dist/runtime/is-docker.js +25 -0
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/dist/bridge/tool-metadata-registry.js +1 -3
- package/node_modules/@comis/skills/dist/builtin/platform/admin-manage-factory.js +24 -1
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.d.ts +53 -7
- package/node_modules/@comis/skills/dist/builtin/platform/agents-manage-tool.js +218 -24
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.d.ts +4 -1
- package/node_modules/@comis/skills/dist/builtin/platform/gateway-tool.js +16 -1
- package/node_modules/@comis/skills/dist/builtin/platform/index.d.ts +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/index.js +1 -1
- package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.d.ts +56 -0
- package/node_modules/@comis/skills/dist/builtin/platform/providers-manage-tool.js +203 -0
- package/node_modules/@comis/skills/dist/index.d.ts +1 -1
- package/node_modules/@comis/skills/dist/index.js +2 -2
- package/node_modules/@comis/skills/dist/policy/tool-policy.js +0 -1
- package/node_modules/@comis/skills/package.json +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-detail-ru-AhppM.js → agent-detail-DqL6Artv.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-editor-hjwRuFVp.js → agent-editor-CNM_h94Y.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{agent-list-6Uotjatr.js → agent-list-Dbh-xD_F.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{billing-view-CxysXH0p.js → billing-view-C1DmtyzK.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{channel-detail-BBCKtmne.js → channel-detail-CtCH22N1.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{channel-list-FkfeOLBQ.js → channel-list-C7xXn-60.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{chat-console-BumBaIgO.js → chat-console-C51pjFwk.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{config-editor-C9BSwHGy.js → config-editor-BLArYRB7.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{context-dag-browser-BHm00mJD.js → context-dag-browser-fuyMinNI.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{context-engine-BENY3pWE.js → context-engine-Bngf2bH0.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{delivery-view-BCnkPsAp.js → delivery-view-C80hucxX.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{diagnostics-view-C_jQFG2H.js → diagnostics-view-Cl4VbHZ6.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-chat-message-FdQcZsSQ.js → ic-chat-message-ByFUoMm6.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-connection-dot-BgYiK2N4.js → ic-connection-dot-C4nDHgY2.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{ic-tool-call-DMPHsLyx.js → ic-tool-call-Bh5kq-yY.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{index-FLPhHz8p.js → index-BBkuC-EU.js} +2 -2
- package/node_modules/@comis/web/dist/assets/{mcp-management-5jyScQis.js → mcp-management-DB-phOo7.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{media-config-J9oT9PPs.js → media-config-CRqZ1ZUH.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{media-test-DGTCtM8-.js → media-test-C9vE20Oy.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{memory-inspector-D5Re9ptG.js → memory-inspector-CeqfnxMZ.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{message-center-cRLK6ZmG.js → message-center-Daup7Mof.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{models-D5vu07MR.js → models-DLYnEU8E.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{observe-view-CalNNEmd.js → observe-view-BTSt_PO5.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-builder-DUYDGwZf.js → pipeline-builder-DknfzyLt.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-history-BAO8brOe.js → pipeline-history-JnHZdeU_.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-history-detail-DectIoQt.js → pipeline-history-detail-Dg4knsEb.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-list-BHlaBKww.js → pipeline-list-AEnibjsp.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{pipeline-monitor-BhtpNEHf.js → pipeline-monitor-DG7RbIOO.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{scheduler-VafN_8xi.js → scheduler-uL1fYKAT.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{security-QQXMRTlo.js → security-C3DywRLH.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{session-detail-BpZ_8Yih.js → session-detail-BtqCNWXV.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{session-list-DfCm8Cec.js → session-list-CJXWa2XT.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{setup-wizard-C-z477CG.js → setup-wizard-ywn7oJvu.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{skills-BCOGPf6s.js → skills-DX0KYnWD.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{subagents-l-auUraL.js → subagents-B8p5YJEB.js} +1 -1
- package/node_modules/@comis/web/dist/assets/{workspace-manager-DlvBixiq.js → workspace-manager-CgzNIrw1.js} +1 -1
- package/node_modules/@comis/web/dist/index.html +1 -1
- package/node_modules/@comis/web/package.json +1 -1
- package/package.json +14 -14
- package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.d.ts +0 -19
- package/node_modules/@comis/skills/dist/builtin/platform/agents-list-tool.js +0 -39
|
@@ -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
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
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:
|
|
193
|
+
parts.push(`Recovery: call ${redirect.tool}(${example}).`);
|
|
113
194
|
}
|
|
114
195
|
else {
|
|
115
|
-
parts.push(`
|
|
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";
|
|
@@ -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;
|
|
@@ -1281,6 +1319,10 @@ export async function main(overrides = {}) {
|
|
|
1281
1319
|
},
|
|
1282
1320
|
},
|
|
1283
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);
|
|
1284
1326
|
// Snapshot current config as last-known-good after successful startup
|
|
1285
1327
|
if (configPaths.length > 0) {
|
|
1286
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.
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
import { PerAgentConfigSchema } from "@comis/core";
|
|
17
17
|
import { resolveWorkspaceDir, resolveOperationModel, resolveProviderFamily, OPERATION_TIER_MAP, DEFAULT_PROVIDER_KEYS, } from "@comis/agent";
|
|
18
18
|
import { persistToConfig } from "./persist-to-config.js";
|
|
19
|
+
import { writeInlineWorkspaceFiles, } from "./agent-inline-workspace.js";
|
|
20
|
+
import { probeProviderAuth } from "./probe-provider-auth.js";
|
|
19
21
|
// ---------------------------------------------------------------------------
|
|
20
22
|
// Factory
|
|
21
23
|
// ---------------------------------------------------------------------------
|
|
@@ -36,6 +38,16 @@ export function createAgentHandlers(deps) {
|
|
|
36
38
|
if (deps.agents[agentId] !== undefined) {
|
|
37
39
|
throw new Error(`Agent already exists: ${agentId}`);
|
|
38
40
|
}
|
|
41
|
+
// 260428-vyf L2: extract inlineContent BEFORE config processing.
|
|
42
|
+
// role/identity are write-once side-effects (ROLE.md / IDENTITY.md
|
|
43
|
+
// file writes), NOT durable state — they NEVER enter the persisted
|
|
44
|
+
// config patch. The L1 tool boundary is responsible for stripping
|
|
45
|
+
// them from `config.workspace` before this RPC is called; this
|
|
46
|
+
// handler only consumes the dedicated top-level `inlineContent`
|
|
47
|
+
// field. If a (mis)caller leaves them inside config.workspace, the
|
|
48
|
+
// downstream Zod strict-object will reject them — that's an
|
|
49
|
+
// explicit failure mode, not a silent drop.
|
|
50
|
+
const inlineContent = params.inlineContent ?? undefined;
|
|
39
51
|
const config = params.config ?? {};
|
|
40
52
|
// Strip workspacePath so new agents always get the auto-computed
|
|
41
53
|
// isolated workspace (~/.comis/workspace-{agentId}) instead of
|
|
@@ -83,7 +95,46 @@ export function createAgentHandlers(deps) {
|
|
|
83
95
|
errorKind: "internal" }, "Agent hot-add failed");
|
|
84
96
|
}
|
|
85
97
|
}
|
|
86
|
-
|
|
98
|
+
const workspaceDir = resolveWorkspaceDir(parsedConfig, agentId);
|
|
99
|
+
// 260428-vyf L2: best-effort inline ROLE.md / IDENTITY.md write.
|
|
100
|
+
// Only invoke when inlineContent has at least one populated field
|
|
101
|
+
// AND the persistDeps logger is available (the helper requires a
|
|
102
|
+
// structured logger; the in-memory-only test path skips it).
|
|
103
|
+
let inlineWritesResult;
|
|
104
|
+
if (deps.persistDeps?.logger
|
|
105
|
+
&& inlineContent
|
|
106
|
+
&& (inlineContent.role !== undefined || inlineContent.identity !== undefined)) {
|
|
107
|
+
const writeResult = await writeInlineWorkspaceFiles({ logger: deps.persistDeps.logger }, { workspaceDir, agentId, role: inlineContent.role, identity: inlineContent.identity });
|
|
108
|
+
if (writeResult.ok) {
|
|
109
|
+
inlineWritesResult = writeResult.value;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// Best-effort: don't fail the create. The helper has already
|
|
113
|
+
// emitted a structured WARN for io / path_traversal. For the
|
|
114
|
+
// oversize branch the helper does NOT log (the schema layer
|
|
115
|
+
// is the canonical gate) — emit a defensive WARN here so the
|
|
116
|
+
// daemon-side surface is not silent.
|
|
117
|
+
if (writeResult.error.kind === "oversize") {
|
|
118
|
+
deps.persistDeps.logger.warn({
|
|
119
|
+
method: "agents.create",
|
|
120
|
+
agentId,
|
|
121
|
+
file: writeResult.error.file,
|
|
122
|
+
limit: writeResult.error.limit,
|
|
123
|
+
actual: writeResult.error.actual,
|
|
124
|
+
hint: "Inline content exceeded size limit at helper layer (schema should have caught this); agent exists with template files.",
|
|
125
|
+
errorKind: "validation",
|
|
126
|
+
}, "Inline workspace content oversize");
|
|
127
|
+
}
|
|
128
|
+
inlineWritesResult = { ok: false, error: writeResult.error };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
agentId,
|
|
133
|
+
config: parsedConfig,
|
|
134
|
+
created: true,
|
|
135
|
+
workspaceDir,
|
|
136
|
+
...(inlineWritesResult !== undefined ? { inlineWritesResult } : {}),
|
|
137
|
+
};
|
|
87
138
|
},
|
|
88
139
|
"agents.get": async (params) => {
|
|
89
140
|
const agentId = params.agentId;
|
|
@@ -142,8 +193,36 @@ export function createAgentHandlers(deps) {
|
|
|
142
193
|
: existing.scheduler.heartbeat,
|
|
143
194
|
};
|
|
144
195
|
}
|
|
196
|
+
// Preserve scalar fields on partial modelFailover updates. fallbackModels,
|
|
197
|
+
// authProfiles, and allowedModels are arrays -- they are replaced wholesale
|
|
198
|
+
// by the spread (no element-wise merge), which matches the documented
|
|
199
|
+
// "user provides the complete desired list" semantic. Scalar fields
|
|
200
|
+
// (cooldownInitialMs, cooldownMultiplier, cooldownCapMs, maxAttempts) are
|
|
201
|
+
// preserved when omitted from the patch.
|
|
202
|
+
if (config.modelFailover && existing.modelFailover) {
|
|
203
|
+
config.modelFailover = {
|
|
204
|
+
...existing.modelFailover,
|
|
205
|
+
...config.modelFailover,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
145
208
|
const merged = { ...existing, ...config };
|
|
146
209
|
const parsedConfig = PerAgentConfigSchema.parse(merged);
|
|
210
|
+
// Probe provider API key when provider or model changes
|
|
211
|
+
const providerChanging = config.provider !== undefined && config.provider !== existing.provider;
|
|
212
|
+
const modelChanging = config.model !== undefined && config.model !== existing.model;
|
|
213
|
+
if ((providerChanging || modelChanging) && deps.providerEntries) {
|
|
214
|
+
const targetProvider = parsedConfig.provider;
|
|
215
|
+
const providerEntry = deps.providerEntries[targetProvider];
|
|
216
|
+
if (providerEntry?.apiKeyName && deps.secretManager) {
|
|
217
|
+
const apiKey = deps.secretManager.get(providerEntry.apiKeyName);
|
|
218
|
+
if (apiKey) {
|
|
219
|
+
const probeResult = await probeProviderAuth(providerEntry.baseUrl, apiKey, parsedConfig.model);
|
|
220
|
+
if (!probeResult.ok) {
|
|
221
|
+
throw new Error(`Cannot switch agent "${agentId}" to provider "${targetProvider}": ${probeResult.error}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
147
226
|
deps.agents[agentId] = parsedConfig;
|
|
148
227
|
// Best-effort persistence to config.yaml
|
|
149
228
|
if (deps.persistDeps) {
|