@zvada/agent-server 0.3.24 → 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 +110 -0
- package/README.md +3 -0
- package/dist/client/client.js +93 -34
- 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 +11 -4
- 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/identity.js +1 -0
- package/dist/core/processes/lifeline.js +13 -1
- package/dist/core/processes/process-table.js +1 -0
- package/dist/core/provision/extract.js +1 -0
- 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/core/runtime/agent-runtime.js +6 -3
- package/dist/core/runtime/turn.js +20 -10
- package/dist/protocol/config.js +21 -1
- package/dist/protocol/credentials.js +2 -1
- package/dist/protocol/errors.js +12 -3
- 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/server/routes.js +3 -2
- package/dist/types/client/client.d.ts +6 -1
- package/dist/types/client/client.d.ts.map +1 -1
- 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 +14 -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 +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/identity.d.ts.map +1 -1
- package/dist/types/core/processes/lifeline.d.ts.map +1 -1
- package/dist/types/core/processes/process-table.d.ts.map +1 -1
- package/dist/types/core/provision/extract.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/core/runtime/agent-runtime.d.ts +4 -1
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
- package/dist/types/core/runtime/turn.d.ts +12 -7
- package/dist/types/core/runtime/turn.d.ts.map +1 -1
- package/dist/types/protocol/clis.d.ts +3 -3
- 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 +10 -42
- package/dist/types/protocol/conversation.d.ts.map +1 -1
- package/dist/types/protocol/credentials.d.ts +13 -1
- package/dist/types/protocol/credentials.d.ts.map +1 -1
- package/dist/types/protocol/errors.d.ts +6 -4
- package/dist/types/protocol/errors.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 +12 -76
- 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 +32 -117
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +24 -125
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/routes.d.ts.map +1 -1
- package/docs/consuming.md +92 -12
- package/docs/deploy.md +8 -0
- package/docs/harnesses.md +88 -27
- package/package.json +4 -4
- package/src/client/client.ts +114 -44
- 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 +37 -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 +11 -3
- 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/identity.ts +1 -0
- package/src/core/processes/lifeline.ts +14 -1
- package/src/core/processes/process-table.ts +1 -0
- package/src/core/provision/extract.ts +1 -0
- 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/core/runtime/agent-runtime.ts +6 -3
- package/src/core/runtime/turn.ts +21 -9
- package/src/protocol/config.ts +22 -1
- package/src/protocol/credentials.ts +19 -5
- package/src/protocol/errors.ts +12 -3
- 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
- package/src/server/routes.ts +3 -2
package/src/protocol/config.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type PermissionMode = z.infer<typeof PermissionModeSchema>;
|
|
|
29
29
|
export type ReportedPermissionMode = PermissionMode | (string & {});
|
|
30
30
|
export const ReportedPermissionModeSchema = openVocabulary(PermissionModeSchema.options);
|
|
31
31
|
|
|
32
|
-
/** The longest `requestTimeoutMs`: a timer's own limit, about 24.8 days. */
|
|
32
|
+
/** The longest `requestTimeoutMs` and the longest MCP `timeoutMs`: a timer's own limit, about 24.8 days. */
|
|
33
33
|
export const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -41,6 +41,24 @@ export const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
|
|
|
41
41
|
*/
|
|
42
42
|
const required = z.boolean().optional();
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* How long one call to one of the server's tools may run, in milliseconds,
|
|
46
|
+
* on any transport: past it the call fails, and the model is told it timed out.
|
|
47
|
+
* - Claude: the server's `timeout`. A value under 1000 is ignored, as if unset.
|
|
48
|
+
* Unset, a call to an HTTP or SSE server is cut at 60 s unless
|
|
49
|
+
* `MCP_TOOL_TIMEOUT` (ms) is in the turn's or the engine's environment; a
|
|
50
|
+
* call to a stdio server is not cut at 60 s (one ran 70 s), and Claude's
|
|
51
|
+
* own longer limits still apply.
|
|
52
|
+
* - Codex: the server's `tool_timeout_sec`, in whole seconds rounded up
|
|
53
|
+
* (1118 cuts a call at 2 s), as Codex reads a fraction back changed.
|
|
54
|
+
* Unset, a call is cut at 300 s.
|
|
55
|
+
* - An ACP agent is not given it (ACP v1 has no such field): the agent keeps
|
|
56
|
+
* its own limit, if it has one.
|
|
57
|
+
* At most `MAX_REQUEST_TIMEOUT_MS`, a timer's own limit; a larger value is refused.
|
|
58
|
+
* A changed value applies from the next turn of a warm session.
|
|
59
|
+
*/
|
|
60
|
+
const timeoutMs = z.number().int().positive().max(MAX_REQUEST_TIMEOUT_MS).optional();
|
|
61
|
+
|
|
44
62
|
/** Minimal external MCP server descriptor (stdio or http/sse). */
|
|
45
63
|
export const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
46
64
|
z.object({
|
|
@@ -49,18 +67,21 @@ export const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
|
49
67
|
args: z.array(z.string()).optional(),
|
|
50
68
|
env: z.record(z.string(), z.string()).optional(),
|
|
51
69
|
required,
|
|
70
|
+
timeoutMs,
|
|
52
71
|
}),
|
|
53
72
|
z.object({
|
|
54
73
|
type: z.literal("http"),
|
|
55
74
|
url: z.string(),
|
|
56
75
|
headers: z.record(z.string(), z.string()).optional(),
|
|
57
76
|
required,
|
|
77
|
+
timeoutMs,
|
|
58
78
|
}),
|
|
59
79
|
z.object({
|
|
60
80
|
type: z.literal("sse"),
|
|
61
81
|
url: z.string(),
|
|
62
82
|
headers: z.record(z.string(), z.string()).optional(),
|
|
63
83
|
required,
|
|
84
|
+
timeoutMs,
|
|
64
85
|
}),
|
|
65
86
|
]);
|
|
66
87
|
export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AccountInfoSchema } from "./account.ts";
|
|
3
|
-
import { AgentHarnessSchema } from "./harness.ts";
|
|
3
|
+
import { type AgentHarness, AgentHarnessSchema } from "./harness.ts";
|
|
4
4
|
|
|
5
5
|
const ApiKeySchema = z.object({
|
|
6
6
|
type: z.literal("api_key"),
|
|
@@ -60,13 +60,27 @@ const RUNS_ON = {
|
|
|
60
60
|
"codex-app-server": CodexCredentialSchema,
|
|
61
61
|
} as const;
|
|
62
62
|
|
|
63
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* The credential as the kind `harness` runs on, or why that harness cannot
|
|
65
|
+
* run it. Any harness may be asked, one only known at run time too: one that
|
|
66
|
+
* runs on no credential a product holds (ACP, scripted) answers why.
|
|
67
|
+
*/
|
|
64
68
|
export function credentialRunsOn<H extends keyof HarnessCredentials>(
|
|
65
69
|
harness: H,
|
|
66
70
|
credential: HarnessCredential,
|
|
67
|
-
): { ok: true; credential: HarnessCredentials[H] } | { ok: false; error: string }
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
): { ok: true; credential: HarnessCredentials[H] } | { ok: false; error: string };
|
|
72
|
+
export function credentialRunsOn(
|
|
73
|
+
harness: AgentHarness,
|
|
74
|
+
credential: HarnessCredential,
|
|
75
|
+
): { ok: true; credential: HarnessCredential } | { ok: false; error: string };
|
|
76
|
+
export function credentialRunsOn(
|
|
77
|
+
harness: AgentHarness,
|
|
78
|
+
credential: HarnessCredential,
|
|
79
|
+
): { ok: true; credential: HarnessCredential } | { ok: false; error: string } {
|
|
80
|
+
if (!Object.hasOwn(RUNS_ON, harness))
|
|
81
|
+
return { ok: false, error: `${harness} runs on no credential a product holds.` };
|
|
82
|
+
const parsed = RUNS_ON[harness as keyof HarnessCredentials].safeParse(credential);
|
|
83
|
+
if (parsed.success) return { ok: true, credential: parsed.data };
|
|
70
84
|
const what =
|
|
71
85
|
credential.type === "api_key" && credential.baseUrl
|
|
72
86
|
? "a key for another endpoint"
|
package/src/protocol/errors.ts
CHANGED
|
@@ -9,7 +9,9 @@ import { openVocabulary } from "./vocabulary.ts";
|
|
|
9
9
|
* unknown non-`_` values are reserved for this protocol.
|
|
10
10
|
* `usage_limit` (plan/quota exhausted) and `rate_limit` (429/backoff) are
|
|
11
11
|
* deliberately distinct — they need different user guidance; collapsing them
|
|
12
|
-
* is a display choice, never a wire merge.
|
|
12
|
+
* is a display choice, never a wire merge. So are `resume_failed` (the
|
|
13
|
+
* conversation is gone: offer a fresh start) and `resume_busy` (another
|
|
14
|
+
* process holds it now: try again once that one has let it go).
|
|
13
15
|
*/
|
|
14
16
|
export const ERROR_CATEGORIES = [
|
|
15
17
|
"auth",
|
|
@@ -22,6 +24,7 @@ export const ERROR_CATEGORIES = [
|
|
|
22
24
|
"invalid_request",
|
|
23
25
|
"process_exit",
|
|
24
26
|
"resume_failed",
|
|
27
|
+
"resume_busy",
|
|
25
28
|
"mcp_unavailable",
|
|
26
29
|
"server_restart",
|
|
27
30
|
"internal",
|
|
@@ -50,6 +53,8 @@ export type ErrorInfo = z.infer<typeof ErrorInfoSchema>;
|
|
|
50
53
|
* classifier; lives in /protocol because categories are vocabulary.
|
|
51
54
|
*/
|
|
52
55
|
const RULES: ReadonlyArray<[ErrorCategory, readonly string[]]> = [
|
|
56
|
+
// Codex 0.160 and newer: another app-server holds the thread warm.
|
|
57
|
+
["resume_busy", ["already has an active writer"]],
|
|
53
58
|
["resume_failed", ["no conversation found with session id", "no rollout found for thread id"]],
|
|
54
59
|
["abort", ["aborted", "aborterror", "cancelled", "canceled", "interrupted", "sigint"]],
|
|
55
60
|
[
|
|
@@ -142,13 +147,17 @@ export function classifyError(error: unknown): ErrorCategory {
|
|
|
142
147
|
return "internal";
|
|
143
148
|
}
|
|
144
149
|
|
|
145
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* A status code counts where it stands as a number of its own, never inside
|
|
152
|
+
* a longer number ("240129 tokens") or an identifier's alphanumeric run (a
|
|
153
|
+
* thread id's "-b401-" or "-a429-"): no letter or digit touches it.
|
|
154
|
+
*/
|
|
146
155
|
function mentions(message: string, needle: string): boolean {
|
|
147
156
|
if (!/\d$/.test(needle)) return message.includes(needle);
|
|
148
157
|
for (let at = message.indexOf(needle); at >= 0; at = message.indexOf(needle, at + 1)) {
|
|
149
158
|
const before = message[at - 1] ?? "";
|
|
150
159
|
const after = message[at + needle.length] ?? "";
|
|
151
|
-
if (
|
|
160
|
+
if (!/[a-z0-9]/.test(before) && !/[a-z0-9]/.test(after)) return true;
|
|
152
161
|
}
|
|
153
162
|
return false;
|
|
154
163
|
}
|
|
@@ -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") {
|
package/src/server/routes.ts
CHANGED
|
@@ -219,8 +219,9 @@ export function executionRoutes(host: RouteHost): Routes<ExecutionMethod> {
|
|
|
219
219
|
// running and `turn.ended` stays the source of truth. `hadTurn: false`
|
|
220
220
|
// while the server tracks an active turn is the pre-first-yield window
|
|
221
221
|
// (between the turn/start quick-ack and the harness registering its
|
|
222
|
-
// abortable turn)
|
|
223
|
-
//
|
|
222
|
+
// abortable turn): the turn keeps the cancel and its harness begins it
|
|
223
|
+
// stopped, but nothing has confirmed a stop yet, so it reports
|
|
224
|
+
// `unconfirmed`, never a clean cancel, and `turn.ended` says `cancelled`.
|
|
224
225
|
return {
|
|
225
226
|
outcome: confirmed && hadTurn ? "cancelled" : "unconfirmed",
|
|
226
227
|
turnId: active.turnId,
|