u-foo 4.0.5 → 4.0.10
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/README.md +224 -19
- package/README.zh-CN.md +3 -3
- package/bin/ucode.js +10 -2
- package/bin/ufoo.js +3 -0
- package/dist/tui/darwin-arm64/ufoo-tui +0 -0
- package/dist/tui/darwin-x64/ufoo-tui +0 -0
- package/dist/tui/linux-arm64/ufoo-tui +0 -0
- package/dist/tui/linux-x64/ufoo-tui +0 -0
- package/{OBSERVABILITY.md → docs/OBSERVABILITY.md} +3 -3
- package/docs/README.md +27 -0
- package/extensions/ufoo-browser/LICENSE +152 -0
- package/extensions/ufoo-browser/NOTICE +10 -0
- package/extensions/ufoo-browser/README.md +30 -0
- package/extensions/ufoo-browser/background.js +409 -0
- package/extensions/ufoo-browser/icons/icon-128.png +0 -0
- package/extensions/ufoo-browser/icons/icon-16.png +0 -0
- package/extensions/ufoo-browser/icons/icon-256.png +0 -0
- package/extensions/ufoo-browser/icons/icon-32.png +0 -0
- package/extensions/ufoo-browser/icons/icon-48.png +0 -0
- package/extensions/ufoo-browser/icons/logo.png +0 -0
- package/extensions/ufoo-browser/icons/toolbar-16.png +0 -0
- package/extensions/ufoo-browser/icons/toolbar-32.png +0 -0
- package/extensions/ufoo-browser/icons/toolbar-logo.png +0 -0
- package/extensions/ufoo-browser/manifest.json +30 -0
- package/extensions/ufoo-browser/popup.css +71 -0
- package/extensions/ufoo-browser/popup.html +44 -0
- package/extensions/ufoo-browser/popup.js +153 -0
- package/package.json +5 -3
- package/scripts/postinstall.js +6 -0
- package/src/agents/capabilities/browser/index.js +49 -0
- package/src/agents/capabilities/coding/backgroundHooks.js +94 -0
- package/src/agents/capabilities/coding/index.js +30 -1
- package/src/agents/capabilities/index.js +5 -2
- package/src/agents/capabilities/planning/index.js +44 -5
- package/src/agents/capabilities/turnRecall/index.js +341 -0
- package/src/agents/controller/controllerToolExecutor.js +2 -2
- package/src/agents/internal/internalRunner.js +30 -8
- package/src/agents/internal/taskControl.js +107 -0
- package/src/agents/profiles/coding.js +1 -1
- package/src/agents/profiles/main.js +1 -1
- package/src/agents/prompts/mainAgent.js +1 -0
- package/src/agents/prompts/native/toolDescriptions/bash.js +7 -1
- package/src/agents/providers/claudeSessionFiles.js +1 -1
- package/src/agents/providers/codexThreadProvider.js +6 -1
- package/src/agents/providers/credentials/agy.js +171 -0
- package/src/agents/providers/directAuthStatus.js +20 -2
- package/src/agents/providers/modelsCatalog.js +26 -5
- package/src/agents/providers/nativeTransport.js +36 -20
- package/src/agents/providers/providerId.js +17 -0
- package/src/agents/providers/runtimeConfig.js +26 -19
- package/src/agents/providers/transports/antigravityTransport.js +242 -0
- package/src/agents/providers/transports/index.js +1 -0
- package/src/agents/providers/transports/openaiChatTransport.js +3 -2
- package/src/agents/providers/transports/openaiResponsesTransport.js +2 -1
- package/src/agents/providers/transports/responsesProtocol.js +119 -18
- package/src/agents/providers/transports/transportContract.js +1 -0
- package/src/agents/providers/upstreamRuntime.js +3 -1
- package/src/agents/runtime/context/contextBudget.js +1 -19
- package/src/agents/runtime/context/contextWindow.js +5 -0
- package/src/agents/runtime/context/replayHistory.js +16 -10
- package/src/agents/runtime/context/runtimeStore.js +0 -2
- package/src/agents/runtime/context/sessionJournal.js +1 -1
- package/src/agents/runtime/context/slidingWindowManager.js +792 -0
- package/src/agents/runtime/context/topicSelector.js +338 -0
- package/src/agents/runtime/context/turnAnalyzer.js +767 -0
- package/src/agents/runtime/context/turnIndexStore.js +515 -0
- package/src/agents/runtime/core/agentLoop.js +95 -32
- package/src/agents/runtime/core/executionBudget.js +2 -1
- package/src/agents/runtime/core/toolErrorGuard.js +39 -0
- package/src/agents/runtime/createAgentRuntime.js +80 -7
- package/src/agents/runtime/index.js +5 -0
- package/src/agents/runtime/protocol/materialize.js +1 -1
- package/src/agents/runtime/tasks/hooks.js +137 -0
- package/src/app/chat/ChatController.js +8 -4
- package/src/app/chat/daemonMessageRouter.js +3 -1
- package/src/app/chat/inputSubmitHandler.js +2 -2
- package/src/app/chat/transport.js +1 -1
- package/src/app/cli/browserCommands.js +340 -0
- package/src/app/cli/features/doctor.js +21 -0
- package/src/app/cli/metricsCommands.js +1 -1
- package/src/app/cli/run.js +80 -1
- package/src/app/cli/setupCommands.js +200 -0
- package/src/code/UcodeController.js +31 -1
- package/src/code/agent.js +41 -7
- package/src/code/busConsumer.js +13 -12
- package/src/code/commands.js +0 -1
- package/src/code/context/assembler.js +11 -88
- package/src/code/context/planGraphService.js +83 -9
- package/src/code/context/planProjection.js +10 -2
- package/src/code/context/reducers.js +172 -4
- package/src/code/context/stateCommit.js +0 -32
- package/src/code/context/transcript.js +7 -4
- package/src/code/internalThread.js +9 -1
- package/src/code/launcher/ucode.js +4 -2
- package/src/code/nativeRunner.js +221 -10
- package/src/code/repl.js +27 -1
- package/src/code/runtime/agentWakeup.js +20 -3
- package/src/code/runtime/backgroundWakeHost.js +45 -0
- package/src/code/runtime/taskFocusContext.js +7 -0
- package/src/code/runtime/taskLoop.js +24 -1
- package/src/code/sessionStore.js +14 -10
- package/src/code/taskDecomposer.js +13 -7
- package/src/code/tools/backgroundProcess.js +23 -0
- package/src/code/tools/bash.js +764 -12
- package/src/code/tools/executor.js +12 -4
- package/src/code/tools/specs.js +60 -3
- package/src/code/tools/taskRun.js +38 -0
- package/src/config.js +92 -6
- package/src/coordination/bus/subscriber.js +1 -1
- package/src/coordination/history/agentPerformance.js +18 -18
- package/src/coordination/history/agentTrace.js +7 -3
- package/src/coordination/state/workspaceAccess.js +3 -1
- package/src/orchestration/groups/modelConfig.js +66 -0
- package/src/orchestration/groups/validateTemplate.js +2 -0
- package/src/runtime/browser/broker.js +1027 -0
- package/src/runtime/browser/brokerClient.js +108 -0
- package/src/runtime/browser/componentInstaller.js +275 -0
- package/src/runtime/browser/installState.js +329 -0
- package/src/runtime/browser/manifest.js +145 -0
- package/src/runtime/browser/native-host-runner.js +198 -0
- package/src/runtime/browser/nativeHost.js +213 -0
- package/src/runtime/browser/nativeMessagingProtocol.js +50 -0
- package/src/runtime/browser/paths.js +134 -0
- package/src/runtime/browser/playwrightSession.js +614 -0
- package/src/runtime/daemon/agentHost.js +175 -30
- package/src/runtime/daemon/busBridge.js +2 -1
- package/src/runtime/daemon/globalDaemon.js +20 -0
- package/src/runtime/daemon/groupOrchestrator.js +20 -1
- package/src/runtime/daemon/index.js +5 -4
- package/src/runtime/daemon/ops.js +14 -8
- package/src/tools/handlers/listAgents.js +1 -1
- package/src/tools/handlers/readBusSummary.js +1 -1
- package/src/tools/handlers/routeAgent.js +122 -5
- package/src/tools/schemaFixtures.js +1 -1
- package/src/ui/agentSurface.js +26 -3
- package/src/ui/format/index.js +34 -2
- package/src/ui/rustChatHost.js +22 -7
- package/src/ui/rustMultiSession.js +14 -2
- package/src/ui/rustUcodeHost.js +246 -77
- package/src/ui/ucodeAgentSession.js +88 -0
- package/templates/groups/build-lane.json +57 -3
- package/templates/groups/build-ultra.json +114 -6
- package/templates/groups/design-system.json +57 -3
- package/templates/groups/product-discovery.json +57 -3
- package/templates/groups/ui-plan-review.json +57 -3
- package/templates/groups/ui-polish.json +57 -3
- package/templates/groups/verify-ship.json +57 -3
- package/src/agents/runtime/context/checkpointStore.js +0 -52
- package/src/agents/runtime/context/compaction.js +0 -171
|
@@ -17,8 +17,15 @@ function writerLease(options) {
|
|
|
17
17
|
return { lease: createResourceLease({ file: path.join(workspaceRoot, ".ufoo", "agent", "runtime", "workspace-leases.json") }),
|
|
18
18
|
key: workspaceRoot, ownerId: options.taskRunId || options.sessionId || `process-${process.pid}` };
|
|
19
19
|
}
|
|
20
|
+
function isReadOnlyBashCall(tool, args) {
|
|
21
|
+
if (normalizeToolName(tool) !== "bash") return false;
|
|
22
|
+
const action = String((args && args.action) || "").trim().toLowerCase();
|
|
23
|
+
return action === "logs" || action === "status" || action === "list";
|
|
24
|
+
}
|
|
20
25
|
function runCoreTool(options = {}) {
|
|
21
|
-
if (!["write", "edit", "bash"].includes(normalizeToolName(options.tool))
|
|
26
|
+
if (!["write", "edit", "bash"].includes(normalizeToolName(options.tool)) || isReadOnlyBashCall(options.tool, options.args)) {
|
|
27
|
+
return runCoreToolUnlocked(options);
|
|
28
|
+
}
|
|
22
29
|
const { lease, key, ownerId } = writerLease(options);
|
|
23
30
|
const acquired = lease.acquire({ key, ownerId });
|
|
24
31
|
if (!acquired.ok) return { ...acquired, error: "workspace writer is active" };
|
|
@@ -229,7 +236,7 @@ function runCoreToolUnlocked({
|
|
|
229
236
|
|
|
230
237
|
const toolOptions = { workspaceRoot, cwd: workspaceRoot };
|
|
231
238
|
if (artifactNamespace !== "ucode") toolOptions.artifactNamespace = artifactNamespace;
|
|
232
|
-
if (normalizedTool === "artifact_read" && sessionId) {
|
|
239
|
+
if ((normalizedTool === "artifact_read" || (normalizedTool === "bash" && safeArgs.background)) && sessionId) {
|
|
233
240
|
toolOptions.sessionId = sessionId;
|
|
234
241
|
}
|
|
235
242
|
const result = runToolCall(
|
|
@@ -283,7 +290,7 @@ function runCoreToolUnlocked({
|
|
|
283
290
|
* dispatcher so bash can terminate on the caller's AbortSignal.
|
|
284
291
|
*/
|
|
285
292
|
async function runCoreToolAsync(options = {}) {
|
|
286
|
-
if (["write", "edit", "bash"].includes(normalizeToolName(options.tool))) {
|
|
293
|
+
if (["write", "edit", "bash"].includes(normalizeToolName(options.tool)) && !isReadOnlyBashCall(options.tool, options.args)) {
|
|
287
294
|
const { lease, key, ownerId } = writerLease(options);
|
|
288
295
|
return lease.run({ key, ownerId, signal: options.signal }, () => runCoreToolAsyncUnlocked(options));
|
|
289
296
|
}
|
|
@@ -320,10 +327,11 @@ async function runCoreToolAsyncUnlocked(options = {}) {
|
|
|
320
327
|
const toolOptions = {
|
|
321
328
|
workspaceRoot,
|
|
322
329
|
cwd: workspaceRoot,
|
|
330
|
+
...(options.backgroundId ? { backgroundId: options.backgroundId } : {}),
|
|
323
331
|
};
|
|
324
332
|
if (artifactNamespace !== "ucode") toolOptions.artifactNamespace = artifactNamespace;
|
|
325
333
|
if (signal) toolOptions.signal = signal;
|
|
326
|
-
if (normalizedTool === "artifact_read" && sessionId) {
|
|
334
|
+
if ((normalizedTool === "artifact_read" || (normalizedTool === "bash" && safeArgs.background)) && sessionId) {
|
|
327
335
|
toolOptions.sessionId = sessionId;
|
|
328
336
|
}
|
|
329
337
|
const result = await runToolCallAsync(
|
package/src/code/tools/specs.js
CHANGED
|
@@ -88,10 +88,67 @@ function buildCoreToolSpecs() {
|
|
|
88
88
|
parameters: {
|
|
89
89
|
type: "object",
|
|
90
90
|
properties: {
|
|
91
|
-
command: {
|
|
92
|
-
|
|
91
|
+
command: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "Shell command to execute when action is \"run\" (default).",
|
|
94
|
+
},
|
|
95
|
+
timeoutMs: {
|
|
96
|
+
type: "integer",
|
|
97
|
+
description: "Foreground command timeout in milliseconds (default 60000, max 600000).",
|
|
98
|
+
},
|
|
99
|
+
background: {
|
|
100
|
+
type: "boolean",
|
|
101
|
+
description: "Set true to start a long-running background process (dev server, watcher) detached from the foreground turn.",
|
|
102
|
+
},
|
|
103
|
+
startupWaitMs: {
|
|
104
|
+
type: "integer",
|
|
105
|
+
description: "When background=true, milliseconds to wait for initial startup logs or early exit (default 2500, max 15000).",
|
|
106
|
+
},
|
|
107
|
+
wake: {
|
|
108
|
+
type: "object",
|
|
109
|
+
description: "Background runtime notifications. Exit notification defaults to true on supported native hosts. Each condition fires once, without model polling. Only valid when starting a background command.",
|
|
110
|
+
additionalProperties: false,
|
|
111
|
+
properties: {
|
|
112
|
+
onExit: { type: "boolean", description: "Notify once on command exit (default true)." },
|
|
113
|
+
timeoutMs: { type: "integer", minimum: 100, maximum: 43200000, description: "Subscription lifetime; default 12 hours. Expiry notifies once without killing the process." },
|
|
114
|
+
conditions: { type: "array", maxItems: 8, items: {
|
|
115
|
+
type: "object", additionalProperties: false, required: ["type"],
|
|
116
|
+
properties: {
|
|
117
|
+
type: { type: "string", enum: ["log_contains", "file_exists", "port_open"] },
|
|
118
|
+
text: { type: "string", description: "Literal log substring for log_contains; at most 1024 bytes." },
|
|
119
|
+
path: { type: "string", description: "Workspace path for file_exists." },
|
|
120
|
+
port: { type: "integer", minimum: 1, maximum: 65535, description: "Local IPv4 loopback port for port_open." },
|
|
121
|
+
},
|
|
122
|
+
} },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
action: {
|
|
126
|
+
type: "string",
|
|
127
|
+
enum: ["run", "logs", "status", "list", "stop"],
|
|
128
|
+
description: "Operation mode: \"run\" (default) executes command; \"logs\" reads background output; \"status\" checks process state; \"list\" lists background processes; \"stop\" terminates a background process.",
|
|
129
|
+
},
|
|
130
|
+
backgroundId: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "Background process ID returned when starting with background=true. Required for logs, status, and stop.",
|
|
133
|
+
},
|
|
134
|
+
offset: {
|
|
135
|
+
type: "integer",
|
|
136
|
+
description: "Byte offset for incremental log reads with action=\"logs\" (pass previous nextOffset to read only newly appended output).",
|
|
137
|
+
},
|
|
138
|
+
tailLines: {
|
|
139
|
+
type: "integer",
|
|
140
|
+
description: "Number of recent log lines to return when offset is omitted (default 80, max 500).",
|
|
141
|
+
},
|
|
142
|
+
maxBytes: {
|
|
143
|
+
type: "integer",
|
|
144
|
+
description: "Maximum log bytes to read in one call (default 32768, max 200000).",
|
|
145
|
+
},
|
|
146
|
+
waitMs: {
|
|
147
|
+
type: "integer",
|
|
148
|
+
description: "Optional milliseconds to wait for new log output when action=\"logs\" and process is running (default 0, max 10000).",
|
|
149
|
+
},
|
|
93
150
|
},
|
|
94
|
-
required: [
|
|
151
|
+
required: [],
|
|
95
152
|
},
|
|
96
153
|
},
|
|
97
154
|
},
|
|
@@ -105,6 +105,44 @@ function runTaskRunTool(args = {}, options = {}) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const ok = payload && payload.ok !== false && payload.status !== "rejected";
|
|
108
|
+
if (
|
|
109
|
+
ok
|
|
110
|
+
&& (operation === "complete" || operation === "cancel" || operation === "fail")
|
|
111
|
+
&& options.autoAdvance !== false
|
|
112
|
+
&& typeof runTool === "function"
|
|
113
|
+
&& executionState.planGraph
|
|
114
|
+
&& executionState.planGraph.graphId
|
|
115
|
+
) {
|
|
116
|
+
const {
|
|
117
|
+
advanceStoredGraph,
|
|
118
|
+
finalizeTerminalPrimaryPlan,
|
|
119
|
+
} = require("../context/planGraphService");
|
|
120
|
+
const advanced = advanceStoredGraph(executionState.planGraph, {
|
|
121
|
+
knownTools,
|
|
122
|
+
runTool,
|
|
123
|
+
parallel: options.parallel !== false,
|
|
124
|
+
maxNodeRuns: options.maxNodeRuns,
|
|
125
|
+
});
|
|
126
|
+
if (advanced && advanced.planGraph) {
|
|
127
|
+
executionState.planGraph = {
|
|
128
|
+
...advanced.planGraph,
|
|
129
|
+
commandLog: executionState.planGraph.commandLog || {},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const terminal = finalizeTerminalPrimaryPlan(
|
|
133
|
+
executionState,
|
|
134
|
+
executionState.planGraph,
|
|
135
|
+
advanced ? advanced.advance : null,
|
|
136
|
+
);
|
|
137
|
+
if (terminal) {
|
|
138
|
+
payload = {
|
|
139
|
+
...payload,
|
|
140
|
+
planCompleted: true,
|
|
141
|
+
archivedGraphId: terminal.archivedGraphId,
|
|
142
|
+
completionSummary: terminal.completionSummary,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
108
146
|
return {
|
|
109
147
|
ok,
|
|
110
148
|
...payload,
|
package/src/config.js
CHANGED
|
@@ -7,6 +7,7 @@ const { writeFileAtomic } = require("./coordination/bus/utils");
|
|
|
7
7
|
const UCODE_FIELDS = [
|
|
8
8
|
"ucodeProvider",
|
|
9
9
|
"ucodeModel",
|
|
10
|
+
"ucodeAuxModel",
|
|
10
11
|
"ucodeBaseUrl",
|
|
11
12
|
"ucodeApiKey",
|
|
12
13
|
"ucodeAgentDir",
|
|
@@ -17,16 +18,19 @@ const SETTINGS_MODEL_DEFAULTS = Object.freeze({
|
|
|
17
18
|
agent: Object.freeze({
|
|
18
19
|
codex: "gpt-6.1-sol",
|
|
19
20
|
claude: "claude-opus-5-5",
|
|
20
|
-
|
|
21
|
-
// `/model` slash command, which persists across launches. There is no
|
|
22
|
-
// command-line flag for model, so the value here is a placeholder for
|
|
23
|
-
// display; we never pass it on the agy command line.
|
|
24
|
-
agy: "",
|
|
21
|
+
agy: "gemini-4-carbon-high",
|
|
25
22
|
// kimi reads its model from its own config.toml (default_model); ufoo
|
|
26
|
-
// never injects -m/--model
|
|
23
|
+
// never injects -m/--model.
|
|
27
24
|
kimi: "",
|
|
28
25
|
"grok-build": "grok-4.6",
|
|
29
26
|
}),
|
|
27
|
+
aux: Object.freeze({
|
|
28
|
+
codex: "gpt-6-luna",
|
|
29
|
+
claude: "claude-haiku-5-5",
|
|
30
|
+
agy: "gemini-4-hydrogen-high",
|
|
31
|
+
kimi: "",
|
|
32
|
+
"grok-build": "",
|
|
33
|
+
}),
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
const DEFAULT_CONFIG = {
|
|
@@ -40,6 +44,7 @@ const DEFAULT_CONFIG = {
|
|
|
40
44
|
claudeOauthTokenPath: "",
|
|
41
45
|
claudeOauthRefreshWindowSec: 300,
|
|
42
46
|
agentModel: "",
|
|
47
|
+
agentAuxModel: "",
|
|
43
48
|
agentBaseUrl: "",
|
|
44
49
|
agentApiKey: "",
|
|
45
50
|
agentThinking: "medium",
|
|
@@ -50,12 +55,25 @@ const DEFAULT_CONFIG = {
|
|
|
50
55
|
const DEFAULT_UCODE_CONFIG = {
|
|
51
56
|
ucodeProvider: "",
|
|
52
57
|
ucodeModel: "",
|
|
58
|
+
ucodeAuxModel: "",
|
|
53
59
|
ucodeBaseUrl: "",
|
|
54
60
|
ucodeApiKey: "",
|
|
55
61
|
ucodeAgentDir: "",
|
|
56
62
|
ucodeThinking: "",
|
|
57
63
|
};
|
|
58
64
|
|
|
65
|
+
const DEFAULT_BROWSER_CONFIG = Object.freeze({
|
|
66
|
+
enabled: false,
|
|
67
|
+
backend: "ufoo-extension",
|
|
68
|
+
setupChoice: "unset",
|
|
69
|
+
schemaVersion: 1,
|
|
70
|
+
profile: "",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
function normalizeAuxModel(value) {
|
|
74
|
+
return typeof value === "string" ? value.trim() : "";
|
|
75
|
+
}
|
|
76
|
+
|
|
59
77
|
function normalizeLaunchMode(value) {
|
|
60
78
|
if (value === "auto") return "auto";
|
|
61
79
|
if (value === "internal") return "internal";
|
|
@@ -103,6 +121,12 @@ function defaultAgentModelForProvider(value = "") {
|
|
|
103
121
|
return SETTINGS_MODEL_DEFAULTS.agent[providerKey(value)] || SETTINGS_MODEL_DEFAULTS.agent.codex;
|
|
104
122
|
}
|
|
105
123
|
|
|
124
|
+
function defaultAuxModelForProvider(value = "") {
|
|
125
|
+
const raw = String(value || "").trim().toLowerCase();
|
|
126
|
+
if (!raw || raw === "custom" || raw === "openai") return "";
|
|
127
|
+
return SETTINGS_MODEL_DEFAULTS.aux[providerKey(raw)] || "";
|
|
128
|
+
}
|
|
129
|
+
|
|
106
130
|
function normalizeModel(value, fallback = "") {
|
|
107
131
|
const text = typeof value === "string" ? value.trim() : "";
|
|
108
132
|
return text || fallback;
|
|
@@ -138,7 +162,36 @@ function normalizeClaudeOauthRefreshWindowSec(value) {
|
|
|
138
162
|
return Math.floor(num);
|
|
139
163
|
}
|
|
140
164
|
|
|
165
|
+
function normalizeBrowserBackend(value) {
|
|
166
|
+
const raw = String(value || "").trim().toLowerCase();
|
|
167
|
+
if (raw === "playwright-extension" || raw === "extension") return "playwright-extension";
|
|
168
|
+
if (raw === "cdp") return "cdp";
|
|
169
|
+
return DEFAULT_BROWSER_CONFIG.backend;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function normalizeBrowserSetupChoice(value) {
|
|
173
|
+
const raw = String(value || "").trim().toLowerCase();
|
|
174
|
+
if (raw === "install") return "install";
|
|
175
|
+
if (raw === "skip") return "skip";
|
|
176
|
+
return DEFAULT_BROWSER_CONFIG.setupChoice;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function normalizeBrowserConfig(raw = {}) {
|
|
180
|
+
const source = raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
181
|
+
const profile = typeof source.profile === "string" ? source.profile.trim() : "";
|
|
182
|
+
const normalized = {
|
|
183
|
+
enabled: source.enabled === true,
|
|
184
|
+
backend: normalizeBrowserBackend(source.backend),
|
|
185
|
+
setupChoice: normalizeBrowserSetupChoice(source.setupChoice),
|
|
186
|
+
schemaVersion: 1,
|
|
187
|
+
};
|
|
188
|
+
if (profile) normalized.profile = profile;
|
|
189
|
+
return normalized;
|
|
190
|
+
}
|
|
191
|
+
|
|
141
192
|
function globalConfigPath() {
|
|
193
|
+
const override = String(process.env.UFOO_GLOBAL_CONFIG_PATH || "").trim();
|
|
194
|
+
if (override) return override;
|
|
142
195
|
return path.join(os.homedir(), ".ufoo", "config.json");
|
|
143
196
|
}
|
|
144
197
|
|
|
@@ -189,6 +242,7 @@ function loadConfig(projectRoot) {
|
|
|
189
242
|
),
|
|
190
243
|
agentProvider,
|
|
191
244
|
agentModel: normalizeModel(raw.agentModel, defaultAgentModelForProvider(agentProvider)),
|
|
245
|
+
agentAuxModel: normalizeAuxModel(raw.agentAuxModel),
|
|
192
246
|
mcpPort: normalizeMcpPort(raw.mcpPort),
|
|
193
247
|
codexAuthPath: normalizeCodexAuthPath(raw.codexAuthPath),
|
|
194
248
|
codexOauthRefreshWindowSec: normalizeCodexOauthRefreshWindowSec(raw.codexOauthRefreshWindowSec),
|
|
@@ -244,6 +298,7 @@ function saveConfig(projectRoot, config) {
|
|
|
244
298
|
}
|
|
245
299
|
merged.agentProvider = normalizeAgentProvider(merged.agentProvider);
|
|
246
300
|
merged.agentModel = typeof merged.agentModel === "string" ? merged.agentModel.trim() : "";
|
|
301
|
+
merged.agentAuxModel = normalizeAuxModel(merged.agentAuxModel);
|
|
247
302
|
merged.mcpPort = normalizeMcpPort(merged.mcpPort);
|
|
248
303
|
merged.codexAuthPath = normalizeCodexAuthPath(merged.codexAuthPath);
|
|
249
304
|
merged.codexOauthRefreshWindowSec = normalizeCodexOauthRefreshWindowSec(merged.codexOauthRefreshWindowSec);
|
|
@@ -261,6 +316,7 @@ function loadGlobalUcodeConfig() {
|
|
|
261
316
|
return {
|
|
262
317
|
ucodeProvider: typeof raw.ucodeProvider === "string" ? raw.ucodeProvider : "",
|
|
263
318
|
ucodeModel: typeof raw.ucodeModel === "string" ? raw.ucodeModel : "",
|
|
319
|
+
ucodeAuxModel: normalizeAuxModel(raw.ucodeAuxModel),
|
|
264
320
|
ucodeBaseUrl: typeof raw.ucodeBaseUrl === "string" ? raw.ucodeBaseUrl : "",
|
|
265
321
|
ucodeApiKey: typeof raw.ucodeApiKey === "string" ? raw.ucodeApiKey : "",
|
|
266
322
|
ucodeAgentDir: typeof raw.ucodeAgentDir === "string" ? raw.ucodeAgentDir : "",
|
|
@@ -305,20 +361,50 @@ function saveGlobalDaemonConfig(updates = {}) {
|
|
|
305
361
|
});
|
|
306
362
|
}
|
|
307
363
|
|
|
364
|
+
function loadGlobalBrowserConfig() {
|
|
365
|
+
const raw = loadJsonSafe(globalConfigPath());
|
|
366
|
+
return normalizeBrowserConfig(raw.browser);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function saveGlobalBrowserConfig(updates = {}) {
|
|
370
|
+
const target = globalConfigPath();
|
|
371
|
+
return withFileLock(target, () => {
|
|
372
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
373
|
+
const existing = loadJsonForUpdate(target);
|
|
374
|
+
const merged = withoutRemovedSettings(existing);
|
|
375
|
+
const nextBrowser = normalizeBrowserConfig({
|
|
376
|
+
...(existing.browser && typeof existing.browser === "object" ? existing.browser : {}),
|
|
377
|
+
...(updates && typeof updates === "object" ? updates : {}),
|
|
378
|
+
});
|
|
379
|
+
merged.browser = nextBrowser;
|
|
380
|
+
writeFileAtomic(target, JSON.stringify(merged, null, 2), { mode: 0o600 });
|
|
381
|
+
return nextBrowser;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
|
|
308
385
|
module.exports = {
|
|
309
386
|
SETTINGS_MODEL_DEFAULTS,
|
|
387
|
+
DEFAULT_BROWSER_CONFIG,
|
|
388
|
+
globalConfigPath,
|
|
310
389
|
loadConfig,
|
|
311
390
|
saveConfig,
|
|
312
391
|
loadGlobalUcodeConfig,
|
|
313
392
|
saveGlobalUcodeConfig,
|
|
314
393
|
loadGlobalDaemonConfig,
|
|
315
394
|
saveGlobalDaemonConfig,
|
|
395
|
+
loadGlobalBrowserConfig,
|
|
396
|
+
saveGlobalBrowserConfig,
|
|
397
|
+
normalizeBrowserBackend,
|
|
398
|
+
normalizeBrowserSetupChoice,
|
|
399
|
+
normalizeBrowserConfig,
|
|
316
400
|
normalizeLaunchMode,
|
|
317
401
|
normalizeDaemonTopology,
|
|
318
402
|
normalizeAgentProvider,
|
|
403
|
+
normalizeAuxModel,
|
|
319
404
|
providerKey,
|
|
320
405
|
sameModelProvider,
|
|
321
406
|
defaultAgentModelForProvider,
|
|
407
|
+
defaultAuxModelForProvider,
|
|
322
408
|
normalizeMcpPort,
|
|
323
409
|
normalizeCodexAuthPath,
|
|
324
410
|
normalizeCodexOauthRefreshWindowSec,
|
|
@@ -298,7 +298,7 @@ class SubscriberManager {
|
|
|
298
298
|
const overrideTty = (typeof options.tty === "string" && isValidTty(options.tty.trim()))
|
|
299
299
|
? options.tty.trim()
|
|
300
300
|
: "";
|
|
301
|
-
const detectedTty = wakeJoin ? "" : (hasOverrideTty ? overrideTty : getTtyPath());
|
|
301
|
+
const detectedTty = (wakeJoin || launchMode === "internal") ? "" : (hasOverrideTty ? overrideTty : getTtyPath());
|
|
302
302
|
const tty = overrideTty || (isValidTty(detectedTty) ? detectedTty : "");
|
|
303
303
|
const preservedTty = !tty && launchMode !== "internal" && isValidTty(existingMeta?.tty)
|
|
304
304
|
? existingMeta.tty
|
|
@@ -61,9 +61,9 @@ function aggregate(runs) {
|
|
|
61
61
|
const counts = {};
|
|
62
62
|
for (const run of runs) for (const [key, value] of Object.entries(run.counts)) counts[key] = (counts[key] || 0) + value;
|
|
63
63
|
const latency = {};
|
|
64
|
-
for (const key of ["elapsedMs", "activeMs", "queueMs", "firstTextMs", "firstThinkingMs", "modelMs", "toolMs", "
|
|
64
|
+
for (const key of ["elapsedMs", "activeMs", "queueMs", "firstTextMs", "firstThinkingMs", "modelMs", "toolMs", "contextSelectMs", "waitingUserMs", "idleMs"]) latency[key] = distribution(runs.map(r => r.timings[key]));
|
|
65
65
|
const tokenTotals = {};
|
|
66
|
-
for (const scope of ["usage"
|
|
66
|
+
for (const scope of ["usage"]) {
|
|
67
67
|
tokenTotals[scope] = {};
|
|
68
68
|
for (const key of ["input", "output", "cacheRead", "cacheCreation"]) {
|
|
69
69
|
const observed = runs.map(r => r[scope][key]).filter(v => v !== null);
|
|
@@ -72,7 +72,7 @@ function aggregate(runs) {
|
|
|
72
72
|
}
|
|
73
73
|
return { runs: runs.length, outcomes, completedOfFinished: rate(outcomes.completed, finished), finished,
|
|
74
74
|
counts, latency, ...tokenTotals, finalTextCharacters: distribution(runs.map(r => r.finalTextCharacters)),
|
|
75
|
-
cache: aggregateCache(runs, "cache"),
|
|
75
|
+
cache: aggregateCache(runs, "cache"),
|
|
76
76
|
signals: Object.fromEntries([...new Set(runs.flatMap(r => r.signals))].map(key => [key, runs.filter(r => r.signals.includes(key)).length])) };
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -99,7 +99,7 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
99
99
|
let uncorrelatedEvents = 0;
|
|
100
100
|
for (const event of events) {
|
|
101
101
|
const type = event.type || "";
|
|
102
|
-
if (!/^(?:task\.|request.accepted|run.config|model\.|tool\.|message.delta|thinking.delta|context
|
|
102
|
+
if (!/^(?:task\.|request.accepted|run.config|model\.|tool\.|message.delta|thinking.delta|context\.(?:select|window|turn_indexed|turn_enriched)|loop\.|interaction\.)/.test(type)) continue;
|
|
103
103
|
if (!event.taskRunId) { uncorrelatedEvents += 1; continue; }
|
|
104
104
|
let run = runs.get(event.taskRunId);
|
|
105
105
|
if (!run) {
|
|
@@ -107,10 +107,10 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
107
107
|
parentTaskRunId: event.parentTaskRunId || null, traceId: event.traceId || null, status: "unknown", configuration: null,
|
|
108
108
|
accepted: null, enqueued: null, started: null, ended: null, lastActivity: null, firstText: null, firstThinking: null,
|
|
109
109
|
activeStart: null, pausedAt: null, activeMs: 0, waitingUserMs: 0, attempts: new Set(), tools: new Map(),
|
|
110
|
-
usageSamples: [], modelOutcomes: 0,
|
|
110
|
+
usageSamples: [], modelOutcomes: 0, terminalUsage: null, finalTextCharacters: null, streamedCharacters: 0,
|
|
111
111
|
counts: { modelCalls: 0, sdkTurns: 0, modelFailures: 0, toolCalls: 0, toolErrors: 0, toolExceptions: 0, toolRejections: 0, unresolvedTools: 0,
|
|
112
|
-
repeatedToolCalls: 0, loopWarnings: 0, loopStops: 0, modelRetries: 0,
|
|
113
|
-
modelDurations: [], modelStarts: new Map(), toolDurations: [],
|
|
112
|
+
repeatedToolCalls: 0, loopWarnings: 0, loopStops: 0, modelRetries: 0, contextSelections: 0, windowProjections: 0, maxEvictionLevel: 0 },
|
|
113
|
+
modelDurations: [], modelStarts: new Map(), toolDurations: [], contextSelectDurations: [], fingerprints: new Map(), errorCodes: {} };
|
|
114
114
|
runs.set(event.taskRunId, run);
|
|
115
115
|
}
|
|
116
116
|
run.agentId ||= event.agentId || "";
|
|
@@ -177,14 +177,15 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
177
177
|
}
|
|
178
178
|
run.tools.set(id, tool);
|
|
179
179
|
}
|
|
180
|
-
if (type === "context.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
if (type === "context.select.completed") {
|
|
181
|
+
run.counts.contextSelections += 1;
|
|
182
|
+
const d = number(event.latencyMs ?? event.durationMs);
|
|
183
|
+
if (d !== null) run.contextSelectDurations.push(d);
|
|
184
|
+
}
|
|
185
|
+
if (type === "context.window.projected") {
|
|
186
|
+
run.counts.windowProjections += 1;
|
|
187
|
+
run.counts.maxEvictionLevel = Math.max(run.counts.maxEvictionLevel, Number(event.evictionLevel) || 0);
|
|
185
188
|
}
|
|
186
|
-
if (type === "context.compaction.failed") run.counts.compactionFailures += 1;
|
|
187
|
-
if (["context.compaction.completed", "context.compaction.failed"].includes(type) && number(event.durationMs) !== null) run.compactionDurations.push(event.durationMs);
|
|
188
189
|
const code = event.code || event.resultCode;
|
|
189
190
|
if (code && (type.endsWith("failed") || type === "tool.rejected" || type === "model.retry" || event.ok === false)) run.errorCodes[code] = (run.errorCodes[code] || 0) + 1;
|
|
190
191
|
}
|
|
@@ -214,7 +215,6 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
214
215
|
if (run.counts.toolRejections) signals.push("rejected_tool_calls");
|
|
215
216
|
if (run.counts.repeatedToolCalls) signals.push("repeated_tool_arguments");
|
|
216
217
|
if (run.counts.loopStops) signals.push("loop_guard_stopped");
|
|
217
|
-
if (run.counts.compactionFailures) signals.push("compaction_failed");
|
|
218
218
|
const idleMs = terminal.has(run.status) ? null : difference(now, run.lastActivity);
|
|
219
219
|
if (run.status === "running" && idleMs > (options.idleThresholdMs || 300000)) signals.push("running_without_recent_events");
|
|
220
220
|
const reports = reportsByTask.get(`${run.taskId}:${run.agentId}`) || [];
|
|
@@ -226,8 +226,8 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
226
226
|
parentTaskRunId: run.parentTaskRunId, traceId: run.traceId, status: run.status, provider, model,
|
|
227
227
|
startedAt: run.started !== null ? new Date(run.started).toISOString() : null,
|
|
228
228
|
endedAt: run.ended !== null ? new Date(run.ended).toISOString() : null,
|
|
229
|
-
configuration: config, attempts: run.attempts.size || null, counts: run.counts, usage: sumUsage(usage),
|
|
230
|
-
cache,
|
|
229
|
+
configuration: config, attempts: run.attempts.size || null, counts: run.counts, usage: sumUsage(usage),
|
|
230
|
+
cache,
|
|
231
231
|
queueTimingSource: run.enqueued !== null ? "bus.sequence" : run.accepted !== null ? "request.accepted" : "unknown",
|
|
232
232
|
finalTextCharacters: run.finalTextCharacters, streamedCharacters: run.streamedCharacters,
|
|
233
233
|
reportCharacters: distribution(reportLengths), errorCodes: run.errorCodes, signals,
|
|
@@ -238,7 +238,7 @@ function summarizeAgentPerformance(events, tasks = [], queues = [], options = {}
|
|
|
238
238
|
activeMs: lifecycleComplete ? run.activeMs + (run.activeStart !== null ? difference(end, run.activeStart) || 0 : 0) : null,
|
|
239
239
|
queueMs: difference(run.started, run.enqueued ?? run.accepted), firstTextMs: difference(run.firstText, run.started),
|
|
240
240
|
firstThinkingMs: difference(run.firstThinking, run.started), modelMs: durations(run.modelDurations), toolMs: durations(run.toolDurations),
|
|
241
|
-
|
|
241
|
+
contextSelectMs: durations(run.contextSelectDurations), waitingUserMs: run.waitingUserMs + (run.pausedAt !== null ? difference(end, run.pausedAt) || 0 : 0), idleMs } });
|
|
242
242
|
}
|
|
243
243
|
rows.sort((a, b) => String(a.startedAt || "").localeCompare(String(b.startedAt || "")) || a.taskRunId.localeCompare(b.taskRunId));
|
|
244
244
|
const groups = new Map();
|
|
@@ -94,7 +94,9 @@ function readAgentTrace(projectRoot, options = {}) {
|
|
|
94
94
|
...(event.binding ? { binding: event.binding } : {}), ...(event.code ? { code: event.code } : {}), ...(event.outcome ? { outcome: event.outcome } : {}),
|
|
95
95
|
...(event.warning ? { warning: event.warning } : {}),
|
|
96
96
|
...(event.error ? { error: event.error } : {}),
|
|
97
|
-
...(String(event.type || "").startsWith("context.
|
|
97
|
+
...(String(event.type || "").startsWith("context.select") ? { mode: event.mode, activeTopics: event.activeTopics, selectedTurnIds: event.selectedTurnIds, latencyMs: event.latencyMs, cached: event.cached } : {}),
|
|
98
|
+
...(String(event.type || "").startsWith("context.window") ? { evictionLevel: event.evictionLevel, rawTurnCount: event.rawTurnCount, totalTurns: event.totalTurns, offWindowCount: event.offWindowCount, estimatedTokens: event.estimatedTokens } : {}),
|
|
99
|
+
...(event.type === "context.turn_indexed" || event.type === "context.turn_enriched" ? { turnId: event.turnId, topic: event.topic, turnKind: event.turnKind, outcome: event.outcome } : {}) };
|
|
98
100
|
}
|
|
99
101
|
for (const record of records) {
|
|
100
102
|
const e = record.value;
|
|
@@ -232,8 +234,10 @@ function readAgentTrace(projectRoot, options = {}) {
|
|
|
232
234
|
modelFailures: matched.filter(e => e.type === "model.failed").length, toolCalls: toolCalls.size,
|
|
233
235
|
toolErrors: [...toolCalls.values()].filter(t => t.outcome === "error").length,
|
|
234
236
|
unresolvedTools: [...toolCalls.values()].filter(t => !t.ended || t.outcome === "unknown").length,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
contextSelections: matched.filter(e => e.type === "context.select.completed").length,
|
|
238
|
+
windowProjections: matched.filter(e => e.type === "context.window.projected").length,
|
|
239
|
+
turnsIndexed: matched.filter(e => e.type === "context.turn_indexed").length,
|
|
240
|
+
turnsEnriched: matched.filter(e => e.type === "context.turn_enriched").length },
|
|
237
241
|
tools: [...toolCalls.values()],
|
|
238
242
|
performance,
|
|
239
243
|
queues: selectedQueues.slice(-100),
|
|
@@ -20,7 +20,9 @@ function createWorkspaceAccess({ projectRoot, externalWriters = () => [] } = {})
|
|
|
20
20
|
return Object.freeze({
|
|
21
21
|
leases,
|
|
22
22
|
async run(context, operation) {
|
|
23
|
-
|
|
23
|
+
const readOnlyBash = context.tool === "bash"
|
|
24
|
+
&& ["logs", "status", "list"].includes(String((context.args && context.args.action) || "").trim().toLowerCase());
|
|
25
|
+
if (!["write", "edit", "bash"].includes(context.tool) || readOnlyBash) return operation();
|
|
24
26
|
const workspace = key(context.workspaceRoot);
|
|
25
27
|
const writers = workspace === root ? externalWriters(context) : [];
|
|
26
28
|
if (writers.length) return { ok: false, code: "workspace_busy", error: "Workers own or may write this workspace. Delegate to them, wait, read files, or use an isolated worktree. Do not close workers to bypass this lease.", owners: writers };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { normalizeProvider } = require("../../agents/providers/providerId");
|
|
4
|
+
|
|
5
|
+
const EFFORTS = new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
6
|
+
const text = value => typeof value === "string" ? value.trim() : "";
|
|
7
|
+
const object = value => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8
|
+
|
|
9
|
+
function validateModelConfig(config, basePath) {
|
|
10
|
+
const errors = [];
|
|
11
|
+
const error = (path, message) => errors.push({ path, message });
|
|
12
|
+
if (config === undefined) return errors;
|
|
13
|
+
if (!object(config)) return [{ path: basePath, message: "model_config must be an object" }];
|
|
14
|
+
for (const [key, setting] of Object.entries(config)) {
|
|
15
|
+
const prefix = `${basePath}.${key}`;
|
|
16
|
+
if (!["codex", "claude", "agy", "override"].includes(key)) {
|
|
17
|
+
error(prefix, "model_config supports codex, claude, agy and override");
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (!object(setting)) { error(prefix, "model setting must be an object"); continue; }
|
|
21
|
+
for (const field of Object.keys(setting)) {
|
|
22
|
+
if (!["model", "reasoning_effort"].includes(field)) error(`${prefix}.${field}`, "unknown model setting");
|
|
23
|
+
}
|
|
24
|
+
if (setting.model !== undefined && typeof setting.model !== "string") error(`${prefix}.model`, "model must be a string");
|
|
25
|
+
if (setting.reasoning_effort !== undefined && (typeof setting.reasoning_effort !== "string"
|
|
26
|
+
|| (text(setting.reasoning_effort) && !EFFORTS.has(text(setting.reasoning_effort))))) {
|
|
27
|
+
error(`${prefix}.reasoning_effort`, "invalid reasoning_effort");
|
|
28
|
+
}
|
|
29
|
+
if (key === "override" && text(setting.reasoning_effort) && !text(setting.model)) {
|
|
30
|
+
error(`${prefix}.model`, "override model is required when overriding reasoning_effort");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return errors;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function resolveGroupModelConfig(config, type, provider = "") {
|
|
37
|
+
const nativeProvider = type === "ucode" ? normalizeProvider(provider) : "";
|
|
38
|
+
const modelProvider = nativeProvider === "anthropic" ? "claude" : nativeProvider || type;
|
|
39
|
+
if (!config || (!["codex", "claude", "agy"].includes(modelProvider) && !nativeProvider)) return {};
|
|
40
|
+
const source = text(config.override?.model) ? "override" : modelProvider;
|
|
41
|
+
const setting = config[source] || {};
|
|
42
|
+
const model = text(setting.model);
|
|
43
|
+
const effort = text(setting.reasoning_effort);
|
|
44
|
+
return model || effort ? { model, reasoning_effort: effort, model_source: source,
|
|
45
|
+
...(nativeProvider ? { model_provider: nativeProvider } : {}) } : {};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildGroupModelArgs(type, setting = {}) {
|
|
49
|
+
const native = type === "ucode";
|
|
50
|
+
if (!["codex", "claude", "agy"].includes(type) && !native) return [];
|
|
51
|
+
const args = [];
|
|
52
|
+
if (text(setting.model)) args.push("--model", text(setting.model));
|
|
53
|
+
if (text(setting.reasoning_effort) && !native) {
|
|
54
|
+
if (type === "codex") args.push("-c", `model_reasoning_effort=${JSON.stringify(text(setting.reasoning_effort))}`);
|
|
55
|
+
else args.push("--effort", text(setting.reasoning_effort));
|
|
56
|
+
}
|
|
57
|
+
return args;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function buildGroupModelEnv(type, setting = {}) {
|
|
61
|
+
if (type !== "ucode") return {};
|
|
62
|
+
return { ...(text(setting.model_provider) ? { UFOO_UCODE_PROVIDER: text(setting.model_provider) } : {}),
|
|
63
|
+
...(text(setting.reasoning_effort) ? { UFOO_UCODE_THINKING: text(setting.reasoning_effort) } : {}) };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = { validateModelConfig, resolveGroupModelConfig, buildGroupModelArgs, buildGroupModelEnv };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const ALLOWED_AGENT_TYPES = new Set(["auto", "codex", "claude", "ucode", "agy", "grok", "kimi"]);
|
|
4
4
|
const { resolvePromptProfileReference } = require("./promptProfiles");
|
|
5
|
+
const { validateModelConfig } = require("./modelConfig");
|
|
5
6
|
|
|
6
7
|
function isPlainObject(value) {
|
|
7
8
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -139,6 +140,7 @@ function validateTemplate(doc, options = {}) {
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
const nickname = asTrimmedString(agent.nickname);
|
|
143
|
+
errors.push(...validateModelConfig(agent.model_config, `${basePath}.model_config`));
|
|
142
144
|
if (!nickname) {
|
|
143
145
|
addError(errors, `${basePath}.nickname`, "nickname is required");
|
|
144
146
|
} else if (knownNicknames.has(nickname)) {
|