@spunto/build 0.31.0 → 0.32.0
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 +13 -6
- package/package.json +2 -9
- package/src/agent-contract/index.ts +7 -1
- package/src/agent-contract/runner.ts +124 -0
- package/src/agent-contract/vocabulary.ts +1 -1
- package/src/agent-stream/agent-stream.ts +1 -1
- package/src/agent-stream/index.ts +1 -1
- package/src/catalogs/index.ts +0 -22
- package/src/script/local-features.ts +0 -4
- package/src/agent-runners/catalogs.ts +0 -183
- package/src/agent-runners/claude/adapter.ts +0 -623
- package/src/agent-runners/claude/model-window.ts +0 -192
- package/src/agent-runners/claude/turn-limit.ts +0 -188
- package/src/agent-runners/claude.mjs +0 -245
- package/src/agent-runners/codex/adapter.ts +0 -134
- package/src/agent-runners/codex.mjs +0 -178
- package/src/agent-runners/features.ts +0 -109
- package/src/agent-runners/index.ts +0 -107
- package/src/agent-runners/mistral/adapter.ts +0 -219
- package/src/agent-runners/mistral.mjs +0 -355
package/README.md
CHANGED
|
@@ -185,8 +185,17 @@ The JSON Schema is shipped as `@spunto/build/agent-contract/schema.json`, genera
|
|
|
185
185
|
table the reader validates with. The conformance suite drives a runner like the platform does and
|
|
186
186
|
checks every line and the order of events (simple turn, tool, interrupt, resume, limit, title,
|
|
187
187
|
files). `@spunto/build/agent-contract/fake-agent.mjs` is a whole runner in 46 lines with no SDK
|
|
188
|
-
that passes it.
|
|
189
|
-
|
|
188
|
+
that passes it.
|
|
189
|
+
|
|
190
|
+
The runner's side of the seam is here too, and nothing harness-specific with it: the shell that
|
|
191
|
+
starts a runner (`runnerCommand`, `AGENT_NODE` under `AGENT_HOME`), the variables a runner is
|
|
192
|
+
handed (`RUNNER_ENV`, `OPTIONS_ENV`, `STREAM_ENV`, `MCP_ENV`), and the shape of what an app lets a
|
|
193
|
+
task choose (`AgentCatalog`, checked by `agentOptionsError`).
|
|
194
|
+
|
|
195
|
+
**No harness lives in this package** (since 0.32.0). Spunto's own runners — Claude Code, Codex,
|
|
196
|
+
Mistral Vibe, with their adapters, the install scripts of their SDKs and their catalogs of models —
|
|
197
|
+
are [`@spunto/agent-runners`](../agent-runners/README.md), imported by the apps that *are* those
|
|
198
|
+
harnesses and never by a control plane.
|
|
190
199
|
|
|
191
200
|
### `@spunto/build/agent-stream` — reading an agent session as it happens
|
|
192
201
|
|
|
@@ -201,8 +210,7 @@ message, never stored. Where the draft lives between two reads is the caller's b
|
|
|
201
210
|
|
|
202
211
|
The harnesses' own dialects (Claude Code's `stream-json`, the runners' former `claude-runner` /
|
|
203
212
|
`codex-runner`) were read here until 0.31.0; they are gone, with `applyProtocol`, the title probe of
|
|
204
|
-
Claude's transcript and `PROJECT_AGENT_PROTOCOLS`.
|
|
205
|
-
next to its runner (`agent-runners/claude/`).
|
|
213
|
+
Claude's transcript and `PROJECT_AGENT_PROTOCOLS`.
|
|
206
214
|
|
|
207
215
|
### `@spunto/build/terminal` — the half of a persistent terminal that is a string
|
|
208
216
|
|
|
@@ -300,8 +308,7 @@ imports them.
|
|
|
300
308
|
|
|
301
309
|
Concretely: **no platform I/O**. No database, no Docker socket, no WebSocket. This package produces
|
|
302
310
|
strings and parses strings. Its only network calls are outbound HTTP on the caller's behalf — a
|
|
303
|
-
public extension registry
|
|
304
|
-
`resolveContextWindow` a credential — and it holds no credential of its own. Configuration arrives
|
|
311
|
+
public extension registry — and it holds no credential of its own. Configuration arrives
|
|
305
312
|
as function parameters, never read from the environment, so that one control plane can scope a
|
|
306
313
|
setting per organization and another per process without either shape leaking in here.
|
|
307
314
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spunto/build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Spunto's shared Build engine — the devcontainer image protocol and VS Code extension registry clients, with no database, no HTTP framework and no UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -87,14 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"./sandbox-agent/agent.mjs": "./src/sandbox-agent/agent.mjs",
|
|
89
89
|
"./sandbox-agent/bootstrap.sh": "./src/sandbox-agent/bootstrap.sh",
|
|
90
|
-
"./sandbox-agent/runner.sh": "./src/sandbox-agent/runner.sh"
|
|
91
|
-
"./agent-runners": {
|
|
92
|
-
"types": "./src/agent-runners/index.ts",
|
|
93
|
-
"import": "./src/agent-runners/index.ts"
|
|
94
|
-
},
|
|
95
|
-
"./agent-runners/claude.mjs": "./src/agent-runners/claude.mjs",
|
|
96
|
-
"./agent-runners/codex.mjs": "./src/agent-runners/codex.mjs",
|
|
97
|
-
"./agent-runners/mistral.mjs": "./src/agent-runners/mistral.mjs"
|
|
90
|
+
"./sandbox-agent/runner.sh": "./src/sandbox-agent/runner.sh"
|
|
98
91
|
},
|
|
99
92
|
"files": [
|
|
100
93
|
"src",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export {
|
|
6
6
|
AGENT_CONTRACT_VERSION,
|
|
7
7
|
agentContractSchema,
|
|
8
|
+
cleanTitle,
|
|
8
9
|
clip,
|
|
9
10
|
contractLineProblem,
|
|
10
11
|
isTransient,
|
|
@@ -14,8 +15,13 @@ export {
|
|
|
14
15
|
SUBAGENT_STATUSES,
|
|
15
16
|
TASK_EVENT_TYPES,
|
|
16
17
|
TRANSIENT_TYPES,
|
|
18
|
+
TURN_LIMIT_KINDS,
|
|
17
19
|
} from "./vocabulary"
|
|
18
|
-
export type { NormalizedEvent, RunnerInput, SourcedEvent, TaskEventType, TransientType } from "./vocabulary"
|
|
20
|
+
export type { NormalizedEvent, RunnerInput, SourcedEvent, TaskEventType, TransientType, TurnLimit, TurnLimitKind } from "./vocabulary"
|
|
21
|
+
|
|
22
|
+
// The runner's side of it: how the platform starts one, what reaches it, what an app lets a task choose.
|
|
23
|
+
export { AGENT_HOME, AGENT_NODE, MCP_ENV, OPTIONS_ENV, RUNNER_ENV, STREAM_ENV, agentOptionsError, runnerCommand } from "./runner"
|
|
24
|
+
export type { AgentCatalog, AgentMcpServer, AgentModel, AgentParam, AgentParamValue } from "./runner"
|
|
19
25
|
|
|
20
26
|
export { CONFORMANCE_PROMPTS, CONFORMANCE_SCENARIOS, runConformance } from "./conformance"
|
|
21
27
|
export type { ConformanceOptions, ConformanceResult, ConformanceScenario, RunnerProcess, StartRunner } from "./conformance"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runner contract (RFC 0048), seen from the platform: how a session of an agent app is started,
|
|
3
|
+
* what reaches it in its environment, and the shape of what an app lets a task choose. Every
|
|
4
|
+
* harness is the same here — which one it is, its SDK and its runner live with the app
|
|
5
|
+
* (`@spunto/agent-runners` for Spunto's own: Claude Code, Codex, Mistral Vibe), never in the
|
|
6
|
+
* platform.
|
|
7
|
+
*
|
|
8
|
+
* <node> <runner>.mjs run [--model <id>] [--resume <session id>]
|
|
9
|
+
* stdin one JSON object per line: {"type":"user","text"} · {"type":"interrupt","id"} ·
|
|
10
|
+
* {"type":"title","id","description"} (`RunnerInput`); closed ⇒ end after the turn
|
|
11
|
+
* env SPUNTO_AGENT_OPTIONS — the task's parameters, one JSON object
|
|
12
|
+
* stdout our vocabulary (`./vocabulary.ts`), one JSON object per line
|
|
13
|
+
* exit 0 = the input closed and the last turn ended; ≠ 0 = the session could not run, and its
|
|
14
|
+
* last line is a failed `session.ended` saying why
|
|
15
|
+
*
|
|
16
|
+
* Pure: what a caller gets is the shell that starts a runner. Fetching it and writing it into the
|
|
17
|
+
* machine are the caller's I/O.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Where an agent app's feature installs its harness — and the private Node its runner runs on. */
|
|
21
|
+
export const AGENT_HOME = "/opt/spunto/agents"
|
|
22
|
+
|
|
23
|
+
/** The Node every runner runs on — the private one the features install. */
|
|
24
|
+
export const AGENT_NODE = `${AGENT_HOME}/node/bin/node`
|
|
25
|
+
|
|
26
|
+
/** The variable a runner's text travels in, base64 — see `runnerCommand`. */
|
|
27
|
+
export const RUNNER_ENV = "SPUNTO_AGENT_RUNNER"
|
|
28
|
+
|
|
29
|
+
/** The variable a task's chosen parameters reach the runner in, as one JSON object. */
|
|
30
|
+
export const OPTIONS_ENV = "SPUNTO_AGENT_OPTIONS"
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `"1"` when the session should stream the tokens of a message as they are written (partial
|
|
34
|
+
* messages, folded into the draft by `foldDraft`). Set by the platform behind the org flag
|
|
35
|
+
* `token-streaming`; absent, a runner prints finished messages only — the system before it.
|
|
36
|
+
*/
|
|
37
|
+
export const STREAM_ENV = "SPUNTO_AGENT_STREAM"
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The variable the org's MCP servers reach the runner in (RFC 0049): a JSON array of
|
|
41
|
+
* `{ name, path }`, `path` being the platform's gateway for that server, resolved by the runner
|
|
42
|
+
* against `SPUNTO_API_URL` and called with `SPUNTO_WORKER_TOKEN`. No vendor token, no harness shape.
|
|
43
|
+
*/
|
|
44
|
+
export const MCP_ENV = "SPUNTO_AGENT_MCP"
|
|
45
|
+
|
|
46
|
+
export type AgentMcpServer = { name: string; path: string }
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The shell that starts a session: write the runner out of `$SPUNTO_AGENT_RUNNER` (base64, set by
|
|
50
|
+
* the caller in the command's environment), then `exec` it on the feature's Node so the session
|
|
51
|
+
* *is* the runner — stdin, signals and exit code included.
|
|
52
|
+
*
|
|
53
|
+
* The text rides in the environment rather than in the command because the command is what the
|
|
54
|
+
* platform shows ("what the platform ran"): eight kilobytes of base64 there would bury the one line
|
|
55
|
+
* worth reading. `--model` is appended by the platform like for any harness; `resume` adds the
|
|
56
|
+
* session the platform read off the stream, passed as `$SPUNTO_TASK_SESSION_ID`.
|
|
57
|
+
*
|
|
58
|
+
* Only the app's id is needed (it names the file): the platform calls this for apps it learns of by
|
|
59
|
+
* their manifest (RFC 0057).
|
|
60
|
+
*/
|
|
61
|
+
export function runnerCommand(harness: { id: string }, opts: { resume?: boolean } = {}): string {
|
|
62
|
+
const file = `"$HOME/.spunto/agents/${harness.id}.mjs"`
|
|
63
|
+
return [
|
|
64
|
+
`mkdir -p "$HOME/.spunto/agents" && printf %s "$${RUNNER_ENV}" | base64 -d > ${file} && unset ${RUNNER_ENV} &&`,
|
|
65
|
+
`exec ${AGENT_NODE} ${file} run${opts.resume ? ` --resume "$SPUNTO_TASK_SESSION_ID"` : ""}`,
|
|
66
|
+
].join(" ")
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ── What an app lets a task choose ────────────────────────────────────────────
|
|
70
|
+
//
|
|
71
|
+
// Its models, and **its own parameters** — effort, reasoning, web search… The platform knows none
|
|
72
|
+
// of them by name: it shows what an app declares, checks a task's choice against it
|
|
73
|
+
// (`agentOptionsError`), and hands the choice to the runner (`OPTIONS_ENV`), the only code that
|
|
74
|
+
// knows what a parameter means to its SDK.
|
|
75
|
+
|
|
76
|
+
export type AgentParamValue = { value: string; label: string; description?: string }
|
|
77
|
+
|
|
78
|
+
/** A parameter an app defines. A choice among values — the one shape both SDKs need today. */
|
|
79
|
+
export type AgentParam = {
|
|
80
|
+
id: string
|
|
81
|
+
label: string
|
|
82
|
+
description?: string
|
|
83
|
+
values: AgentParamValue[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type AgentModel = {
|
|
87
|
+
value: string
|
|
88
|
+
label: string
|
|
89
|
+
description?: string
|
|
90
|
+
/** What the harness runs when no model is picked. */
|
|
91
|
+
default?: boolean
|
|
92
|
+
/** Values of a parameter this model allows, when it does not take all of them. */
|
|
93
|
+
params?: Record<string, string[]>
|
|
94
|
+
/** What this model runs with when the parameter is left unset — shown as the chip's placeholder. */
|
|
95
|
+
paramDefaults?: Record<string, string>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type AgentCatalog = {
|
|
99
|
+
models: AgentModel[]
|
|
100
|
+
params: AgentParam[]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Why these options cannot run under this catalog and model — or null when they can. An unknown
|
|
106
|
+
* parameter, a value the parameter does not have, or one the model does not take. A model the
|
|
107
|
+
* catalog does not list (typed by hand) is held to the parameter's values only: the catalog cannot
|
|
108
|
+
* speak for it.
|
|
109
|
+
*/
|
|
110
|
+
export function agentOptionsError(catalog: AgentCatalog, model: string | null | undefined, options: Record<string, string>): string | null {
|
|
111
|
+
const known = model ? catalog.models.find((m) => m.value === model) : undefined
|
|
112
|
+
for (const [id, value] of Object.entries(options)) {
|
|
113
|
+
const param = catalog.params.find((p) => p.id === id)
|
|
114
|
+
if (!param) return `Unknown parameter "${id}" — this harness takes ${catalog.params.map((p) => p.id).join(", ") || "none"}.`
|
|
115
|
+
if (!param.values.some((v) => v.value === value)) {
|
|
116
|
+
return `"${value}" is not a value of ${param.label} — one of ${param.values.map((v) => v.value).join(", ")}.`
|
|
117
|
+
}
|
|
118
|
+
const allowed = known?.params?.[id]
|
|
119
|
+
if (allowed && !allowed.includes(value)) {
|
|
120
|
+
return `${known!.label} does not take ${param.label} "${value}" — one of ${allowed.join(", ")}.`
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return null
|
|
124
|
+
}
|
|
@@ -38,7 +38,7 @@ const MAX_TITLE = 200
|
|
|
38
38
|
* Why a turn ended on a limit rather than on finished work: `usage` (the plan's quota, back at a
|
|
39
39
|
* time the harness usually knows), `rate` (a burst limit, seconds to minutes), `overloaded` (the
|
|
40
40
|
* vendor's API, later). Which harness message is which is the runner's reading
|
|
41
|
-
* (
|
|
41
|
+
* (`claude/turn-limit.ts` of `@spunto/agent-runners` for Claude).
|
|
42
42
|
*/
|
|
43
43
|
export const TURN_LIMIT_KINDS = ["usage", "rate", "overloaded"] as const
|
|
44
44
|
export type TurnLimitKind = (typeof TURN_LIMIT_KINDS)[number]
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* The harnesses' own dialects (Claude Code's `stream-json`, Codex's events) used to be read here
|
|
10
10
|
* too, for the tasks delegated before agent apps and the runners' first sessions. Retired on
|
|
11
11
|
* 2026-11-24, once no task alive spoke them: what a harness prints is its runner's business, in the
|
|
12
|
-
* machine (
|
|
12
|
+
* machine (`@spunto/agent-runners` for Spunto's own apps), never the platform's.
|
|
13
13
|
*
|
|
14
14
|
* Two rules the rest of the code depends on:
|
|
15
15
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// vocabulary out, and how to write to a session.
|
|
3
3
|
//
|
|
4
4
|
// **The vocabulary is what gets stored, never the harness's own shape.** Every harness is read by
|
|
5
|
-
// its agent app's runner, in the machine (
|
|
5
|
+
// its agent app's runner, in the machine (`@spunto/agent-runners`); nothing here knows which one it was.
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
AGENT_PROTOCOLS,
|
package/src/catalogs/index.ts
CHANGED
|
@@ -210,28 +210,6 @@ export const AVAILABLE_FEATURES: DevFeature[] = [
|
|
|
210
210
|
localScript: "google-cloud-cli.sh",
|
|
211
211
|
description: "gcloud, gsutil, bq (local install script)",
|
|
212
212
|
},
|
|
213
|
-
{
|
|
214
|
-
// The agent apps' features (RFC 0048, `../agent-runners`): injected, never picked.
|
|
215
|
-
id: "spunto-agent-claude",
|
|
216
|
-
label: "Claude (agent app)",
|
|
217
|
-
localScript: "spunto-agent-claude.sh",
|
|
218
|
-
description: "The Claude Agent SDK and the Node its runner uses — injected by the Claude app",
|
|
219
|
-
injected: true,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
id: "spunto-agent-codex",
|
|
223
|
-
label: "Codex (agent app)",
|
|
224
|
-
localScript: "spunto-agent-codex.sh",
|
|
225
|
-
description: "The Codex SDK and the Node its runner uses — injected by the Codex app",
|
|
226
|
-
injected: true,
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
id: "spunto-agent-mistral",
|
|
230
|
-
label: "Mistral Vibe (agent app)",
|
|
231
|
-
localScript: "spunto-agent-mistral.sh",
|
|
232
|
-
description: "Mistral Vibe (with its own Python) and the Node its runner uses — injected by the Mistral app",
|
|
233
|
-
injected: true,
|
|
234
|
-
},
|
|
235
213
|
{
|
|
236
214
|
// Always installed, whether or not it's picked here (lib/setup-script.ts § the two features
|
|
237
215
|
// every worker image is made of): it's what creates the `vscode` user. Listed anyway so a
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
//
|
|
9
9
|
// Keyed by the catalog's `localScript` filename so the two stay legible together.
|
|
10
10
|
|
|
11
|
-
import { AGENT_FEATURE_SCRIPTS } from "../agent-runners/features"
|
|
12
|
-
|
|
13
11
|
export const LOCAL_FEATURE_SCRIPTS: Record<string, string> = {
|
|
14
|
-
// The agent apps' features (RFC 0048): ours by definition — nobody upstream installs our runner's SDK.
|
|
15
|
-
...AGENT_FEATURE_SCRIPTS,
|
|
16
12
|
// Google's own apt repository; the upstream devcontainer feature pins a gcloud version and
|
|
17
13
|
// breaks whenever Google retires it.
|
|
18
14
|
"google-cloud-cli.sh": `#!/bin/sh
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What each agent app (RFC 0048) lets a task choose: its models, and **its own parameters** —
|
|
3
|
-
* effort, reasoning, web search… The platform knows none of them by name. It shows what an app
|
|
4
|
-
* declares, checks a task's choice against it (`validateAgentOptions`), and hands the choice to the
|
|
5
|
-
* runner (`OPTIONS_ENV`), which is the only code that knows what a parameter means to its SDK.
|
|
6
|
-
*
|
|
7
|
-
* **Measured, not remembered.** Each catalog is what the SDK pinned by its feature
|
|
8
|
-
* (`./features.ts`) answers, and it changes when that pin moves:
|
|
9
|
-
*
|
|
10
|
-
* - Claude: `query().supportedModels()` of `@anthropic-ai/claude-agent-sdk` 0.3.310, on
|
|
11
|
-
* 2026-10-26. Each model comes back with `supportedEffortLevels`;
|
|
12
|
-
* - Codex: `codex debug models` of `@openai/codex` 0.164.0 — the catalog bundled in the binary,
|
|
13
|
-
* offline, on 2026-10-26 — the `visibility: "list"` models, with their
|
|
14
|
-
* `supported_reasoning_levels` and `default_reasoning_level`;
|
|
15
|
-
* - Mistral: the `model` and `thinking` options of a `session/new` of `vibe-acp` 3.0.4, then of
|
|
16
|
-
* `session/set_config_option` for each model, on 2026-10-31, with a pay-as-you-go API key.
|
|
17
|
-
* Not all in the binary: Vibe's own default is Medium 3.5, and the others came from Mistral's
|
|
18
|
-
* remote config (a rollout of Large 4 as the default the account was in) — an account outside
|
|
19
|
-
* it may lack them, which the runner then says, with the models it does have.
|
|
20
|
-
*
|
|
21
|
-
* `packages/build/scripts/agent-catalogs.mjs` prints both again, to diff against this file when a
|
|
22
|
-
* pin is bumped.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
export type AgentParamValue = { value: string; label: string; description?: string }
|
|
26
|
-
|
|
27
|
-
/** A parameter an app defines. A choice among values — the one shape both SDKs need today. */
|
|
28
|
-
export type AgentParam = {
|
|
29
|
-
id: string
|
|
30
|
-
label: string
|
|
31
|
-
description?: string
|
|
32
|
-
values: AgentParamValue[]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type AgentModel = {
|
|
36
|
-
value: string
|
|
37
|
-
label: string
|
|
38
|
-
description?: string
|
|
39
|
-
/** What the harness runs when no model is picked. */
|
|
40
|
-
default?: boolean
|
|
41
|
-
/** Values of a parameter this model allows, when it does not take all of them. */
|
|
42
|
-
params?: Record<string, string[]>
|
|
43
|
-
/** What this model runs with when the parameter is left unset — shown as the chip's placeholder. */
|
|
44
|
-
paramDefaults?: Record<string, string>
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type AgentCatalog = {
|
|
48
|
-
models: AgentModel[]
|
|
49
|
-
params: AgentParam[]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** The variable a task's chosen parameters reach the runner in, as one JSON object. */
|
|
53
|
-
export const OPTIONS_ENV = "SPUNTO_AGENT_OPTIONS"
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* `"1"` when the session should stream the tokens of a message as they are written (partial
|
|
57
|
-
* messages, folded into the draft by `foldDraft`). Set by the platform behind the org flag
|
|
58
|
-
* `token-streaming`; absent, a runner prints finished messages only — the system before it.
|
|
59
|
-
*/
|
|
60
|
-
export const STREAM_ENV = "SPUNTO_AGENT_STREAM"
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The variable the org's MCP servers reach the runner in (RFC 0049): a JSON array of
|
|
64
|
-
* `{ name, path }`, `path` being the platform's gateway for that server, resolved by the runner
|
|
65
|
-
* against `SPUNTO_API_URL` and called with `SPUNTO_WORKER_TOKEN`. No vendor token, no harness shape.
|
|
66
|
-
*/
|
|
67
|
-
export const MCP_ENV = "SPUNTO_AGENT_MCP"
|
|
68
|
-
|
|
69
|
-
export type AgentMcpServer = { name: string; path: string }
|
|
70
|
-
|
|
71
|
-
const CLAUDE_EFFORT: AgentParamValue[] = [
|
|
72
|
-
{ value: "low", label: "Low" },
|
|
73
|
-
{ value: "medium", label: "Medium" },
|
|
74
|
-
{ value: "high", label: "High" },
|
|
75
|
-
{ value: "xhigh", label: "Extra high" },
|
|
76
|
-
{ value: "max", label: "Max" },
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
const CODEX_REASONING: AgentParamValue[] = [
|
|
80
|
-
{ value: "low", label: "Low", description: "Fast responses with lighter reasoning" },
|
|
81
|
-
{ value: "medium", label: "Medium", description: "Balances speed and reasoning depth for everyday tasks" },
|
|
82
|
-
{ value: "high", label: "High", description: "Greater reasoning depth for complex problems" },
|
|
83
|
-
{ value: "xhigh", label: "Extra high", description: "Extra high reasoning depth for complex problems" },
|
|
84
|
-
{ value: "max", label: "Max", description: "Maximum reasoning depth for the hardest problems" },
|
|
85
|
-
{ value: "ultra", label: "Ultra", description: "Maximum reasoning with automatic task delegation" },
|
|
86
|
-
]
|
|
87
|
-
|
|
88
|
-
const ALL_BUT_ULTRA = ["low", "medium", "high", "xhigh", "max"]
|
|
89
|
-
|
|
90
|
-
export const AGENT_CATALOGS: Record<"claude" | "codex" | "mistral", AgentCatalog> = {
|
|
91
|
-
claude: {
|
|
92
|
-
// The SDK's aliases (`default`, `sonnet`, `opus`, `fable`, `haiku`) resolved to the ids they
|
|
93
|
-
// stand for: a task records the model it ran, not a name whose meaning moves.
|
|
94
|
-
models: [
|
|
95
|
-
{ value: "claude-sonnet-5-5", label: "Claude Sonnet 5.5", description: "Default (recommended)", default: true },
|
|
96
|
-
{ value: "claude-opus-5-5", label: "Claude Opus 5.5" },
|
|
97
|
-
{ value: "claude-fable-5-2", label: "Claude Fable 5.2" },
|
|
98
|
-
{ value: "claude-haiku-5-5", label: "Claude Haiku 5.5" },
|
|
99
|
-
],
|
|
100
|
-
params: [
|
|
101
|
-
{
|
|
102
|
-
id: "effort",
|
|
103
|
-
label: "Effort",
|
|
104
|
-
description: "How much Claude thinks before it acts. Unset = the model's own default.",
|
|
105
|
-
values: CLAUDE_EFFORT,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
codex: {
|
|
110
|
-
models: [
|
|
111
|
-
{ value: "gpt-6-astra", label: "GPT-6-Astra", description: "Frontier intelligence for the most demanding work.", paramDefaults: { reasoningEffort: "low" } },
|
|
112
|
-
{ value: "gpt-6.1-sol", label: "GPT-6.1-Sol", description: "Latest workhorse model for coding and everyday work.", paramDefaults: { reasoningEffort: "low" } },
|
|
113
|
-
{ value: "gpt-6-sol", label: "GPT-6-Sol", description: "Previous generation workhorse model.", paramDefaults: { reasoningEffort: "medium" } },
|
|
114
|
-
{ value: "gpt-6-luna", label: "GPT-6-Luna", description: "Fast and affordable model for easier tasks.", params: { reasoningEffort: ALL_BUT_ULTRA }, paramDefaults: { reasoningEffort: "medium" } },
|
|
115
|
-
{ value: "gpt-5.6-sol", label: "GPT-5.6-Sol", description: "Older generation workhorse model.", paramDefaults: { reasoningEffort: "low" } },
|
|
116
|
-
{ value: "gpt-5.6-terra", label: "GPT-5.6-Terra", description: "Older balanced model for straightforward work.", paramDefaults: { reasoningEffort: "medium" } },
|
|
117
|
-
{ value: "gpt-5.6-luna", label: "GPT-5.6-Luna", description: "Older fast and efficient model.", params: { reasoningEffort: ALL_BUT_ULTRA }, paramDefaults: { reasoningEffort: "medium" } },
|
|
118
|
-
{ value: "gpt-5.5", label: "GPT-5.5", description: "Legacy coding model.", params: { reasoningEffort: ["low", "medium", "high", "xhigh"] }, paramDefaults: { reasoningEffort: "medium" } },
|
|
119
|
-
],
|
|
120
|
-
params: [
|
|
121
|
-
{
|
|
122
|
-
id: "reasoningEffort",
|
|
123
|
-
label: "Reasoning",
|
|
124
|
-
description: "How deeply Codex reasons. Unset = the model's own default.",
|
|
125
|
-
values: CODEX_REASONING,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: "webSearch",
|
|
129
|
-
label: "Web search",
|
|
130
|
-
description: "Whether Codex may search the web: from a cache, live, or not at all. Unset = Codex's default.",
|
|
131
|
-
values: [
|
|
132
|
-
{ value: "disabled", label: "Off" },
|
|
133
|
-
{ value: "cached", label: "Cached" },
|
|
134
|
-
{ value: "live", label: "Live" },
|
|
135
|
-
],
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
}, mistral: {
|
|
139
|
-
// Vibe's aliases, which are what `session/set_config_option` takes (and what `--model` gets).
|
|
140
|
-
models: [
|
|
141
|
-
{ value: "mistral-medium-3.5", label: "Mistral Medium 3.5", description: "Vibe's own default (mistral-vibe-cli-latest)", default: true, params: { thinking: ["off", "high"] }, paramDefaults: { thinking: "high" } },
|
|
142
|
-
{ value: "mistral-large-4-0-3", label: "Mistral Large 4", description: "mistral-large-4-0 — rolling out as Vibe's default", params: { thinking: ["low", "medium", "high"] }, paramDefaults: { thinking: "high" } },
|
|
143
|
-
{ value: "glm-5-3", label: "GLM-5.3", description: "zai-glm-5-3, hosted by Mistral", params: { thinking: ["low", "high", "max"] }, paramDefaults: { thinking: "high" } },
|
|
144
|
-
{ value: "zai-glm-5-3-flash", label: "GLM-5.3 Flash", description: "zai-glm-5-3-flash, hosted by Mistral", params: { thinking: ["low", "high", "max"] }, paramDefaults: { thinking: "high" } },
|
|
145
|
-
],
|
|
146
|
-
params: [
|
|
147
|
-
{
|
|
148
|
-
id: "thinking",
|
|
149
|
-
label: "Thinking",
|
|
150
|
-
description: "How much the model reasons before it acts. Unset = the level Vibe last used for the model.",
|
|
151
|
-
values: [
|
|
152
|
-
{ value: "off", label: "Off" },
|
|
153
|
-
{ value: "low", label: "Low" },
|
|
154
|
-
{ value: "medium", label: "Medium" },
|
|
155
|
-
{ value: "high", label: "High" },
|
|
156
|
-
{ value: "max", label: "Max" },
|
|
157
|
-
],
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Why these options cannot run under this catalog and model — or null when they can. An unknown
|
|
165
|
-
* parameter, a value the parameter does not have, or one the model does not take. A model the
|
|
166
|
-
* catalog does not list (typed by hand) is held to the parameter's values only: the catalog cannot
|
|
167
|
-
* speak for it.
|
|
168
|
-
*/
|
|
169
|
-
export function agentOptionsError(catalog: AgentCatalog, model: string | null | undefined, options: Record<string, string>): string | null {
|
|
170
|
-
const known = model ? catalog.models.find((m) => m.value === model) : undefined
|
|
171
|
-
for (const [id, value] of Object.entries(options)) {
|
|
172
|
-
const param = catalog.params.find((p) => p.id === id)
|
|
173
|
-
if (!param) return `Unknown parameter "${id}" — this harness takes ${catalog.params.map((p) => p.id).join(", ") || "none"}.`
|
|
174
|
-
if (!param.values.some((v) => v.value === value)) {
|
|
175
|
-
return `"${value}" is not a value of ${param.label} — one of ${param.values.map((v) => v.value).join(", ")}.`
|
|
176
|
-
}
|
|
177
|
-
const allowed = known?.params?.[id]
|
|
178
|
-
if (allowed && !allowed.includes(value)) {
|
|
179
|
-
return `${known!.label} does not take ${param.label} "${value}" — one of ${allowed.join(", ")}.`
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return null
|
|
183
|
-
}
|