@zvada/agent-server 0.3.25 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +3 -0
- package/dist/core/agents/acp/acp-agent.js +91 -14
- package/dist/core/agents/acp/mappings.js +5 -1
- package/dist/core/agents/claude-code/approvals.js +2 -1
- package/dist/core/agents/claude-code/claude-agent.js +12 -2
- package/dist/core/agents/claude-code/mcp.js +9 -1
- package/dist/core/agents/claude-code/models.js +16 -10
- package/dist/core/agents/claude-code/options.js +23 -2
- package/dist/core/agents/claude-code/session.js +21 -1
- package/dist/core/agents/claude-code/tools.js +9 -4
- package/dist/core/agents/claude-code/turn.js +2 -0
- package/dist/core/agents/codex-app-server/adapter.js +2 -0
- package/dist/core/agents/codex-app-server/client.js +8 -5
- package/dist/core/agents/codex-app-server/codex-agent.js +35 -2
- package/dist/core/agents/codex-app-server/effort.js +13 -6
- package/dist/core/agents/codex-app-server/mcp.js +35 -18
- package/dist/core/agents/codex-app-server/models.js +10 -10
- package/dist/core/agents/codex-app-server/options.js +11 -2
- package/dist/core/agents/codex-app-server/session.js +11 -4
- package/dist/core/agents/codex-app-server/thread-settings.js +30 -11
- package/dist/core/agents/host-tools.js +493 -0
- package/dist/core/agents/mcp-config.js +6 -2
- package/dist/core/agents/scripted/scripted-agent.js +9 -3
- package/dist/core/agents/scripted/steps.js +5 -1
- package/dist/core/agents/session-agent.js +70 -2
- package/dist/core/agents/thinking-levels.js +8 -5
- package/dist/core/index.js +1 -0
- package/dist/core/presets.js +12 -2
- package/dist/core/processes/lifeline.js +9 -5
- package/dist/core/provision/pins.js +7 -16
- package/dist/core/provision/releases.js +25 -25
- package/dist/core/proxy/loopback.js +22 -4
- package/dist/protocol/config.js +21 -1
- package/dist/protocol/model-catalog.js +58 -18
- package/dist/protocol/models.js +6 -27
- package/dist/protocol/thinking.js +22 -9
- package/dist/protocol/wire-api.js +2 -2
- package/dist/server/bin.js +6 -4
- package/dist/types/core/agents/acp/acp-agent.d.ts +15 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +5 -1
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/acp/requests.d.ts +2 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts +2 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/mcp.d.ts +8 -1
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/models.d.ts +9 -5
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts +10 -1
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +2 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/turn.d.ts +3 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts +2 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +11 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/effort.d.ts +7 -7
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +11 -3
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/models.d.ts +4 -1
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/options.d.ts +9 -2
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/requests.d.ts +2 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/session.d.ts +6 -3
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
- package/dist/types/core/agents/host-tools.d.ts +162 -0
- package/dist/types/core/agents/host-tools.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +11 -2
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
- package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
- package/dist/types/core/agents/scripted/steps.d.ts.map +1 -1
- package/dist/types/core/agents/session-agent.d.ts +2 -7
- package/dist/types/core/agents/session-agent.d.ts.map +1 -1
- package/dist/types/core/agents/thinking-levels.d.ts +7 -3
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -1
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +11 -1
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/lifeline.d.ts.map +1 -1
- package/dist/types/core/provision/pins.d.ts +5 -4
- package/dist/types/core/provision/pins.d.ts.map +1 -1
- package/dist/types/core/proxy/loopback.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +12 -19
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +4 -36
- package/dist/types/protocol/conversation.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +2 -18
- package/dist/types/protocol/execution.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +8 -72
- package/dist/types/protocol/lifecycle.d.ts.map +1 -1
- package/dist/types/protocol/model-catalog.d.ts.map +1 -1
- package/dist/types/protocol/models.d.ts +4 -42
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/thinking.d.ts +19 -19
- package/dist/types/protocol/thinking.d.ts.map +1 -1
- package/dist/types/protocol/wire-api.d.ts +20 -105
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +16 -117
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/docs/consuming.md +68 -11
- package/docs/deploy.md +6 -5
- package/docs/harnesses.md +79 -31
- package/package.json +4 -4
- package/src/core/agents/acp/acp-agent.ts +123 -17
- package/src/core/agents/acp/mappings.ts +5 -1
- package/src/core/agents/acp/requests.ts +2 -0
- package/src/core/agents/claude-code/approvals.ts +2 -1
- package/src/core/agents/claude-code/claude-agent.ts +14 -2
- package/src/core/agents/claude-code/mcp.ts +11 -1
- package/src/core/agents/claude-code/models.ts +15 -10
- package/src/core/agents/claude-code/options.ts +33 -3
- package/src/core/agents/claude-code/session.ts +26 -1
- package/src/core/agents/claude-code/tools.ts +10 -4
- package/src/core/agents/claude-code/turn.ts +4 -0
- package/src/core/agents/codex-app-server/adapter.ts +2 -0
- package/src/core/agents/codex-app-server/client.ts +11 -5
- package/src/core/agents/codex-app-server/codex-agent.ts +45 -1
- package/src/core/agents/codex-app-server/effort.ts +15 -20
- package/src/core/agents/codex-app-server/mcp.ts +46 -23
- package/src/core/agents/codex-app-server/models.ts +10 -10
- package/src/core/agents/codex-app-server/options.ts +16 -2
- package/src/core/agents/codex-app-server/requests.ts +2 -0
- package/src/core/agents/codex-app-server/session.ts +19 -4
- package/src/core/agents/codex-app-server/thread-settings.ts +31 -11
- package/src/core/agents/host-tools.ts +649 -0
- package/src/core/agents/mcp-config.ts +15 -3
- package/src/core/agents/scripted/scripted-agent.ts +9 -2
- package/src/core/agents/scripted/steps.ts +5 -1
- package/src/core/agents/session-agent.ts +78 -2
- package/src/core/agents/thinking-levels.ts +9 -6
- package/src/core/index.ts +9 -0
- package/src/core/presets.ts +24 -3
- package/src/core/processes/lifeline.ts +9 -5
- package/src/core/provision/pins.ts +7 -16
- package/src/core/provision/releases.ts +25 -25
- package/src/core/proxy/loopback.ts +25 -4
- package/src/protocol/config.ts +22 -1
- package/src/protocol/model-catalog.ts +58 -18
- package/src/protocol/models.ts +6 -26
- package/src/protocol/thinking.ts +27 -14
- package/src/protocol/wire-api.ts +2 -2
- package/src/server/bin.ts +6 -4
|
@@ -9,8 +9,8 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
9
9
|
readonly models: readonly ModelDescriptor[];
|
|
10
10
|
} = {
|
|
11
11
|
cli: {
|
|
12
|
-
claude: "0.3.
|
|
13
|
-
codex: "0.
|
|
12
|
+
claude: "0.3.327",
|
|
13
|
+
codex: "0.169.1",
|
|
14
14
|
},
|
|
15
15
|
models: [
|
|
16
16
|
{
|
|
@@ -34,6 +34,16 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
34
34
|
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
+
{
|
|
38
|
+
id: "fable",
|
|
39
|
+
harness: "claude-code",
|
|
40
|
+
label: "Fable 5.2",
|
|
41
|
+
description: "For your toughest challenges",
|
|
42
|
+
resolvedId: "claude-fable-5-2",
|
|
43
|
+
thinking: {
|
|
44
|
+
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
37
47
|
{
|
|
38
48
|
id: "sonnet",
|
|
39
49
|
harness: "claude-code",
|
|
@@ -45,21 +55,29 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
45
55
|
},
|
|
46
56
|
},
|
|
47
57
|
{
|
|
48
|
-
id: "
|
|
58
|
+
id: "haiku",
|
|
59
|
+
harness: "claude-code",
|
|
60
|
+
label: "Haiku 5.5",
|
|
61
|
+
description: "Fastest for quick answers",
|
|
62
|
+
resolvedId: "claude-haiku-5-5",
|
|
63
|
+
thinking: {
|
|
64
|
+
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "claude-fable-5-1",
|
|
49
69
|
harness: "claude-code",
|
|
50
70
|
label: "Fable 5.1",
|
|
51
71
|
description: "Most capable for your hardest and longest-running tasks",
|
|
52
|
-
resolvedId: "claude-fable-5-1",
|
|
53
72
|
thinking: {
|
|
54
73
|
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
55
74
|
},
|
|
56
75
|
},
|
|
57
76
|
{
|
|
58
|
-
id: "haiku",
|
|
77
|
+
id: "claude-haiku-4-5-20251001",
|
|
59
78
|
harness: "claude-code",
|
|
60
79
|
label: "Haiku 4.5",
|
|
61
80
|
description: "Fastest for quick answers",
|
|
62
|
-
resolvedId: "claude-haiku-4-5-20251001",
|
|
63
81
|
thinking: {
|
|
64
82
|
levels: [],
|
|
65
83
|
},
|
|
@@ -128,10 +146,10 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
128
146
|
},
|
|
129
147
|
},
|
|
130
148
|
{
|
|
131
|
-
id: "gpt-6.
|
|
149
|
+
id: "gpt-6.2-sol",
|
|
132
150
|
harness: "codex-app-server",
|
|
133
|
-
label: "GPT-6.
|
|
134
|
-
description: "
|
|
151
|
+
label: "GPT-6.2-Sol",
|
|
152
|
+
description: "Fast, go-to model for coding and everyday work.",
|
|
135
153
|
isDefault: true,
|
|
136
154
|
thinking: {
|
|
137
155
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
@@ -140,13 +158,13 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
140
158
|
images: true,
|
|
141
159
|
},
|
|
142
160
|
{
|
|
143
|
-
id: "gpt-6-astra",
|
|
161
|
+
id: "gpt-6.2-astra",
|
|
144
162
|
harness: "codex-app-server",
|
|
145
|
-
label: "GPT-6-Astra",
|
|
146
|
-
description: "
|
|
163
|
+
label: "GPT-6.2-Astra",
|
|
164
|
+
description: "Our most capable model for complex coding and professional work.",
|
|
147
165
|
thinking: {
|
|
148
166
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
149
|
-
default: "
|
|
167
|
+
default: "low",
|
|
150
168
|
},
|
|
151
169
|
images: true,
|
|
152
170
|
},
|
|
@@ -154,18 +172,40 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
154
172
|
id: "gpt-6.1-terra",
|
|
155
173
|
harness: "codex-app-server",
|
|
156
174
|
label: "GPT-6.1 Terra",
|
|
157
|
-
description: "
|
|
175
|
+
description: "Efficient model that excels at visual understanding and computer use.",
|
|
176
|
+
thinking: {
|
|
177
|
+
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
178
|
+
default: "low",
|
|
179
|
+
},
|
|
180
|
+
images: true,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "gpt-6.1-sol",
|
|
184
|
+
harness: "codex-app-server",
|
|
185
|
+
label: "GPT-6.1-Sol",
|
|
186
|
+
description: "Previous generation model for coding and everyday work.",
|
|
158
187
|
thinking: {
|
|
159
188
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
160
189
|
default: "low",
|
|
161
190
|
},
|
|
162
191
|
images: true,
|
|
163
192
|
},
|
|
193
|
+
{
|
|
194
|
+
id: "gpt-6-astra",
|
|
195
|
+
harness: "codex-app-server",
|
|
196
|
+
label: "GPT-6-Astra",
|
|
197
|
+
description: "Previous generation model for complex coding and professional work.",
|
|
198
|
+
thinking: {
|
|
199
|
+
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
200
|
+
default: "medium",
|
|
201
|
+
},
|
|
202
|
+
images: true,
|
|
203
|
+
},
|
|
164
204
|
{
|
|
165
205
|
id: "gpt-6-sol",
|
|
166
206
|
harness: "codex-app-server",
|
|
167
207
|
label: "GPT-6-Sol",
|
|
168
|
-
description: "
|
|
208
|
+
description: "Legacy model for coding and everyday work.",
|
|
169
209
|
thinking: {
|
|
170
210
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
171
211
|
default: "medium",
|
|
@@ -187,7 +227,7 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
187
227
|
id: "gpt-5.6-sol",
|
|
188
228
|
harness: "codex-app-server",
|
|
189
229
|
label: "GPT-5.6-Sol",
|
|
190
|
-
description: "
|
|
230
|
+
description: "Legacy model for coding and everyday work.",
|
|
191
231
|
thinking: {
|
|
192
232
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
193
233
|
default: "low",
|
|
@@ -198,7 +238,7 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
198
238
|
id: "gpt-5.6-terra",
|
|
199
239
|
harness: "codex-app-server",
|
|
200
240
|
label: "GPT-5.6-Terra",
|
|
201
|
-
description: "
|
|
241
|
+
description: "Legacy balanced model for agentic coding.",
|
|
202
242
|
thinking: {
|
|
203
243
|
levels: ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
204
244
|
default: "medium",
|
|
@@ -209,7 +249,7 @@ export const GENERATED_MODEL_CATALOG: {
|
|
|
209
249
|
id: "gpt-5.6-luna",
|
|
210
250
|
harness: "codex-app-server",
|
|
211
251
|
label: "GPT-5.6-Luna",
|
|
212
|
-
description: "
|
|
252
|
+
description: "Legacy fast model for simpler tasks.",
|
|
213
253
|
thinking: {
|
|
214
254
|
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
215
255
|
default: "medium",
|
package/src/protocol/models.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { type AgentHarness, AgentHarnessSchema } from "./harness.ts";
|
|
3
3
|
import { MetaSchema } from "./meta.ts";
|
|
4
4
|
import { GENERATED_MODEL_CATALOG } from "./model-catalog.ts";
|
|
5
|
-
import { type ThinkingLevel, ThinkingLevelSchema
|
|
5
|
+
import { type ThinkingLevel, ThinkingLevelSchema } from "./thinking.ts";
|
|
6
6
|
import { EpochMsSchema } from "./time.ts";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -20,7 +20,11 @@ export const ModelDescriptorSchema = z.object({
|
|
|
20
20
|
/** The model a turn runs when its config names none. */
|
|
21
21
|
isDefault: z.boolean().optional(),
|
|
22
22
|
thinking: z.object({
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The levels the model runs as distinct settings, by the harness's own
|
|
25
|
+
* names and in its order (both CLIs list lowest first); a name may be
|
|
26
|
+
* one this build does not know. Empty: no thinking control.
|
|
27
|
+
*/
|
|
24
28
|
levels: z.array(ThinkingLevelSchema),
|
|
25
29
|
/** The model's own default, when the harness states one. Never invented. */
|
|
26
30
|
default: ThinkingLevelSchema.optional(),
|
|
@@ -52,30 +56,6 @@ export const ModelListSchema = z.object({
|
|
|
52
56
|
});
|
|
53
57
|
export type ModelList = z.infer<typeof ModelListSchema>;
|
|
54
58
|
|
|
55
|
-
/**
|
|
56
|
-
* Parse a model list from a server that may be newer than this build: a
|
|
57
|
-
* thinking level this build does not know is dropped from `levels` (and from
|
|
58
|
-
* `default`) instead of failing the whole list.
|
|
59
|
-
*/
|
|
60
|
-
export function decodeModelList(value: unknown): ModelList {
|
|
61
|
-
const raw = value as { models?: unknown };
|
|
62
|
-
if (!Array.isArray(raw?.models)) return ModelListSchema.parse(value);
|
|
63
|
-
const models = raw.models.map((model: unknown) => {
|
|
64
|
-
const thinking = (model as { thinking?: { levels?: unknown; default?: unknown } })?.thinking;
|
|
65
|
-
if (!thinking || typeof thinking !== "object") return model;
|
|
66
|
-
const levels = Array.isArray(thinking.levels)
|
|
67
|
-
? thinking.levels.filter((level) => typeof level === "string" && isThinkingLevel(level))
|
|
68
|
-
: thinking.levels;
|
|
69
|
-
const known = typeof thinking.default === "string" && isThinkingLevel(thinking.default);
|
|
70
|
-
const { default: _dropped, ...rest } = thinking;
|
|
71
|
-
return {
|
|
72
|
-
...(model as object),
|
|
73
|
-
thinking: { ...rest, levels, ...(known && { default: thinking.default }) },
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
return ModelListSchema.parse({ ...(value as object), models });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
59
|
/**
|
|
80
60
|
* The models each harness's pinned CLI listed when this release was built
|
|
81
61
|
* (`bun run models:refresh`), for a picker without a live list. The live list
|
package/src/protocol/thinking.ts
CHANGED
|
@@ -1,35 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { openVocabulary } from "./vocabulary.ts";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A single, harness-agnostic reasoning dial. Each harness maps it to its own
|
|
5
5
|
* native control: Claude -> adaptive `thinking` + `effort`; Codex ->
|
|
6
|
-
* `ReasoningEffort`. What runs depends on the model:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* `ReasoningEffort`. What runs depends on the model: each harness runs the
|
|
7
|
+
* nearest level the model accepts (`ultra` on a Claude model topping out at
|
|
8
|
+
* `max` runs `max`).
|
|
9
|
+
*
|
|
10
|
+
* The levels this build knows, in order, lowest first. A harness may list
|
|
11
|
+
* others for a model: the names are an open vocabulary, the harness's own.
|
|
9
12
|
*/
|
|
10
13
|
export const THINKING_LEVELS = ["off", "low", "medium", "high", "xhigh", "max", "ultra"] as const;
|
|
11
|
-
|
|
12
|
-
export
|
|
14
|
+
/** A level this build knows and orders. */
|
|
15
|
+
export type KnownThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
16
|
+
/** A thinking level: one this build knows, or another a harness lists. OPEN. */
|
|
17
|
+
export type ThinkingLevel = KnownThinkingLevel | (string & {});
|
|
18
|
+
// @ref LLP 0002#open-vocabularies — a level a harness lists is kept, known or not
|
|
19
|
+
export const ThinkingLevelSchema = openVocabulary(THINKING_LEVELS);
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
/** Whether `v` is a level this build knows. */
|
|
22
|
+
export function isThinkingLevel(v: string): v is KnownThinkingLevel {
|
|
15
23
|
return (THINKING_LEVELS as readonly string[]).includes(v);
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
const rank = (level:
|
|
26
|
+
const rank = (level: KnownThinkingLevel) => THINKING_LEVELS.indexOf(level);
|
|
19
27
|
|
|
20
28
|
/**
|
|
21
|
-
* The level a model runs when it offers only `supported
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* `
|
|
29
|
+
* The level a model runs when it offers only `supported`. A level it lists is
|
|
30
|
+
* itself. Otherwise, for a level this build knows, the highest known level it
|
|
31
|
+
* lists at or below `level`, else its lowest known one: use it when switching
|
|
32
|
+
* models, so `ultra` on a model topping out at `max` becomes `max`, not a
|
|
33
|
+
* fixed fallback. `undefined` for a level this build does not know and the
|
|
34
|
+
* model does not list, and when the model offers none.
|
|
25
35
|
*/
|
|
26
36
|
export function clampThinkingLevel(
|
|
27
37
|
level: ThinkingLevel,
|
|
28
38
|
supported: readonly ThinkingLevel[],
|
|
29
39
|
): ThinkingLevel | undefined {
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
if (supported.includes(level)) return level;
|
|
41
|
+
if (!isThinkingLevel(level)) return undefined;
|
|
42
|
+
let below: KnownThinkingLevel | undefined;
|
|
43
|
+
let lowest: KnownThinkingLevel | undefined;
|
|
32
44
|
for (const candidate of supported) {
|
|
45
|
+
if (!isThinkingLevel(candidate)) continue;
|
|
33
46
|
if (lowest === undefined || rank(candidate) < rank(lowest)) lowest = candidate;
|
|
34
47
|
if (rank(candidate) <= rank(level) && (below === undefined || rank(candidate) > rank(below)))
|
|
35
48
|
below = candidate;
|
package/src/protocol/wire-api.ts
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
HistoryWaitSchema,
|
|
28
28
|
SessionRefSchema,
|
|
29
29
|
} from "./history.ts";
|
|
30
|
-
import { ModelListSchema
|
|
30
|
+
import { ModelListSchema } from "./models.ts";
|
|
31
31
|
import {
|
|
32
32
|
DurableSessionSchema,
|
|
33
33
|
ElicitationRespondParamsSchema,
|
|
@@ -106,7 +106,7 @@ const API = {
|
|
|
106
106
|
EventsReplayResultSchema,
|
|
107
107
|
decodeEventsReplayResult,
|
|
108
108
|
),
|
|
109
|
-
[WIRE_METHODS.modelsList]: method(ModelsListParamsSchema, ModelListSchema
|
|
109
|
+
[WIRE_METHODS.modelsList]: method(ModelsListParamsSchema, ModelListSchema),
|
|
110
110
|
[WIRE_METHODS.clisList]: method(ClisParamsSchema, ClisResultSchema),
|
|
111
111
|
[WIRE_METHODS.clisPrepare]: method(ClisParamsSchema, ClisResultSchema),
|
|
112
112
|
[WIRE_METHODS.authStatus]: method(AuthStatusParamsSchema, AuthStatusResultSchema),
|
package/src/server/bin.ts
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
resolveHarnessName,
|
|
34
34
|
scriptedFile,
|
|
35
35
|
} from "../core/index.ts";
|
|
36
|
-
import { THINKING_LEVELS, type ThinkingLevel
|
|
36
|
+
import { THINKING_LEVELS, type ThinkingLevel } from "../protocol/index.ts";
|
|
37
37
|
import { AgentServer } from "./agent-server.ts";
|
|
38
38
|
import { runFeedbackCommand } from "./feedback.ts";
|
|
39
39
|
import { installedLine, nothingToInstall, runInstall, toolsFor } from "./install.ts";
|
|
@@ -88,7 +88,8 @@ function usage(exitCode: number): never {
|
|
|
88
88
|
" --stdio serve NDJSON JSON-RPC on stdio (the default)",
|
|
89
89
|
" --acp speak ACP v1 on stdio instead (be the agent)",
|
|
90
90
|
" --model <id> every turn runs on this model (default: the harness's own)",
|
|
91
|
-
` --thinking <level> and at this thinking level (${THINKING_LEVELS.join(", ")}
|
|
91
|
+
` --thinking <level> and at this thinking level (${THINKING_LEVELS.join(", ")},`,
|
|
92
|
+
" or another the model lists);",
|
|
92
93
|
" the operator's choice: an ACP client cannot change either",
|
|
93
94
|
" install download the pinned agent CLIs into the managed cache",
|
|
94
95
|
" (always downloads — run at image build time to erase",
|
|
@@ -237,9 +238,10 @@ function parseArgs(argv: string[]): Args {
|
|
|
237
238
|
if (!args.model) fail("--model needs a model id");
|
|
238
239
|
} else if (arg === "--thinking") {
|
|
239
240
|
const level = next();
|
|
240
|
-
|
|
241
|
+
// A flag where the level belongs means the level was left out.
|
|
242
|
+
if (!level.trim() || level.startsWith("-"))
|
|
241
243
|
fail(
|
|
242
|
-
`--thinking
|
|
244
|
+
`--thinking needs a level: ${THINKING_LEVELS.slice(0, -1).join(", ")} or ${THINKING_LEVELS.at(-1)}, or another the model lists`,
|
|
243
245
|
);
|
|
244
246
|
args.thinking = level;
|
|
245
247
|
} else if (arg === "--credentials-url") {
|