@anchrd/colab-sdk 0.1.36 → 0.1.38
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/dist/actions/actions.d.ts +34 -23
- package/dist/actions/actions.js +5 -2
- package/dist/archive/archive.d.ts +1 -0
- package/dist/archive/archive.js +3 -0
- package/dist/boards/boards.d.ts +21 -21
- package/dist/columns/columns.d.ts +2 -2
- package/dist/connectors/connectors.d.ts +6 -6
- package/dist/crawls/crawls.d.ts +3 -3
- package/dist/error/error.d.ts +9 -3
- package/dist/error/error.js +12 -3
- package/dist/gadgets/gadgets.d.ts +147 -9
- package/dist/gadgets/gadgets.js +156 -0
- package/dist/goals/goals.d.ts +56 -10
- package/dist/goals/goals.js +36 -7
- package/dist/grammar/grammar.d.ts +2 -0
- package/dist/grammar/grammar.js +10 -0
- package/dist/home/home.d.ts +312 -0
- package/dist/home/home.js +53 -0
- package/dist/links/links.d.ts +166 -0
- package/dist/links/links.js +149 -0
- package/dist/mcps/mcps.d.ts +3 -3
- package/dist/messages/messages.d.ts +26 -0
- package/dist/messages/messages.js +33 -0
- package/dist/nodes/nodes.d.ts +46 -20
- package/dist/nodes/nodes.js +11 -3
- package/dist/operators/operators.d.ts +737 -47
- package/dist/operators/operators.js +388 -71
- package/dist/organisation/organisation.d.ts +2 -0
- package/dist/organisation/organisation.js +9 -0
- package/dist/primitives/primitives.d.ts +9 -0
- package/dist/primitives/primitives.js +16 -0
- package/dist/roles/roles.d.ts +1 -0
- package/dist/roles/roles.js +3 -0
- package/dist/runs/runs.d.ts +2 -2
- package/dist/sdk.d.ts +12 -11
- package/dist/sdk.js +12 -11
- package/dist/skills/skills.d.ts +37 -7
- package/dist/skills/skills.js +50 -0
- package/dist/sources/sources.d.ts +82 -20
- package/dist/sources/sources.js +71 -12
- package/dist/tables/tables.d.ts +42 -0
- package/dist/tables/tables.js +55 -2
- package/dist/tool.d.ts +1 -0
- package/dist/tree-order/tree-order.d.ts +2 -2
- package/dist/tree-order/tree-order.js +1 -1
- package/dist/users/users.d.ts +2 -0
- package/dist/users/users.js +3 -2
- package/dist/versions/versions.d.ts +13 -13
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { Flag, Limit } from "../list-input.js";
|
|
|
4
4
|
import { MachineId } from "../machines/machines.js";
|
|
5
5
|
import { McpId } from "../mcps/mcps.js";
|
|
6
6
|
import { NodeId } from "../nodes/nodes.js";
|
|
7
|
-
import { Rev } from "../primitives/primitives.js";
|
|
7
|
+
import { AgentName, PlanSubstep, planEvidenceMax, Rev } from "../primitives/primitives.js";
|
|
8
8
|
import { RoleId } from "../roles/roles.js";
|
|
9
9
|
import { Schedule } from "../schedule/schedule.js";
|
|
10
10
|
import { OperatorProvider, UserId } from "../users/users.js";
|
|
@@ -16,85 +16,250 @@ import { OperatorProvider, UserId } from "../users/users.js";
|
|
|
16
16
|
// ⚠️ A credential's value goes in and never comes out: no answer carries it, and no field of an answer
|
|
17
17
|
// is called `key`, `secret`, `token` or `password` (`/mcp` would strike it, `redactSecrets`). The
|
|
18
18
|
// value's field in the inputs is `value`, the kinds are `subscription` and `apikey`.
|
|
19
|
-
// The
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
// (
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
// The models of the kind Gateway (E210, #1011), by the gateway's own name `provider/model` as its
|
|
20
|
+
// Unified API (`/compat`) takes it. `context` in tokens; `price` in US dollars per million tokens
|
|
21
|
+
// (input, input read from the cache, output, and a cache write where the catalog names its own): the
|
|
22
|
+
// amount of a run where the token cannot read the gateway's logs. Since #1059 every price and context
|
|
23
|
+
// is the one of the model's page in Cloudflare's catalog (developers.cloudflare.com/ai/models/,
|
|
24
|
+
// read 2026-11-05; for Claude Haiku 5.5 the short-context price, for Grok 4.7 the one under 200k).
|
|
25
|
+
// Where a page names no price for cached input, `cacheRead` is the input's.
|
|
26
|
+
// ⚠️ The names are `/compat`'s, not the catalog page's: Claude 5.x goes with hyphens
|
|
27
|
+
// (`anthropic/claude-opus-5-5`); the page's `claude-opus-5.5` answers 404 "Did you mean
|
|
28
|
+
// claude-opus-5-5?". Workers AI's models go with `workers-ai/` before their `@cf/…` name.
|
|
29
|
+
// Each model of the catalog finished one test card under `bun run dev` on 2026-11-05 (#1059): read
|
|
30
|
+
// the card, one sentence in its chat, the card to Done. Left out after that test: Gemini 4 Argon and
|
|
31
|
+
// 3.8 Pro (`/compat` asks for a Google key, Unified Billing does not pay for them), Gemini 3.8 Flash
|
|
32
|
+
// (its streamed tool call carries `thought_signature`, which the AI SDK refuses), Granite 4.0 Micro
|
|
33
|
+
// and gpt-oss-120b (Workers AI answers "Bad Request" to the run's tools), Alibaba, MiniMax and Meta's
|
|
34
|
+
// Muse (`/compat` knows no such provider), Perplexity, Mistral's own API and DeepSeek through
|
|
35
|
+
// Fireworks (`/compat` asks for the provider's key). OpenAI's GPT models (#1018) refuse
|
|
36
|
+
// `max_tokens` (`outputLimit` names the field that caps a step's output) and call tools only with
|
|
37
|
+
// `reasoning_effort: "none"` (`reasoningEffort`); `openai/gpt-6.1-sol` and `gpt-6-sol` call tools only
|
|
38
|
+
// through `/responses` (Spike #979). GPT-6.1 Terra stays (#1059 keeps it) although it left its test
|
|
39
|
+
// card open twice (#1066).
|
|
40
|
+
export const gatewayCatalog = [
|
|
41
|
+
{
|
|
42
|
+
gateway: "cloudflare",
|
|
43
|
+
name: "Cloudflare",
|
|
44
|
+
models: [
|
|
45
|
+
{
|
|
46
|
+
model: "workers-ai/@cf/deepseek-ai/deepseek-v4-pro-0813",
|
|
47
|
+
name: "DeepSeek V4 Pro",
|
|
48
|
+
context: 1_000_000,
|
|
49
|
+
price: { input: 1.32, cacheRead: 0.044, output: 3.96 },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
model: "workers-ai/@cf/deepseek-ai/deepseek-v4.1-flash-1017",
|
|
53
|
+
name: "DeepSeek V4.1 Flash",
|
|
54
|
+
context: 1_048_576,
|
|
55
|
+
price: { input: 0.3, cacheRead: 0.006, output: 1.2 },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
model: "anthropic/claude-haiku-5-5",
|
|
59
|
+
name: "Claude Haiku 5.5",
|
|
60
|
+
context: 1_000_000,
|
|
61
|
+
price: { input: 0.1, cacheRead: 0.01, cacheWrite: 0.125, output: 0.5 },
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
model: "anthropic/claude-sonnet-5-5",
|
|
65
|
+
name: "Claude Sonnet 5.5",
|
|
66
|
+
context: 1_000_000,
|
|
67
|
+
price: { input: 2, cacheRead: 0.1, cacheWrite: 2.5, output: 10 },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
model: "anthropic/claude-opus-5-5",
|
|
71
|
+
name: "Claude Opus 5.5",
|
|
72
|
+
context: 1_000_000,
|
|
73
|
+
price: { input: 4, cacheRead: 0.2, cacheWrite: 5, output: 20 },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
model: "anthropic/claude-fable-5-1",
|
|
77
|
+
name: "Claude Fable 5.1",
|
|
78
|
+
context: 1_000_000,
|
|
79
|
+
price: { input: 10, cacheRead: 0.25, cacheWrite: 12.5, output: 50 },
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
model: "xai/grok-4.7",
|
|
83
|
+
name: "Grok 4.7",
|
|
84
|
+
context: 500_000,
|
|
85
|
+
price: { input: 2, cacheRead: 0.5, output: 6 },
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
model: "moonshotai/kimi-k3",
|
|
89
|
+
name: "Kimi K3",
|
|
90
|
+
context: 1_048_576,
|
|
91
|
+
price: { input: 3, cacheRead: 0.3, output: 15 },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
model: "workers-ai/@cf/moonshotai/kimi-k2.7-code",
|
|
95
|
+
name: "Kimi K2.7 Code",
|
|
96
|
+
context: 262_144,
|
|
97
|
+
price: { input: 0.95, cacheRead: 0.19, output: 4 },
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
model: "workers-ai/@cf/moonshotai/kimi-k2.6",
|
|
101
|
+
name: "Kimi K2.6",
|
|
102
|
+
context: 262_144,
|
|
103
|
+
price: { input: 0.95, cacheRead: 0.16, output: 4 },
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
model: "workers-ai/@cf/zai-org/glm-5.3",
|
|
107
|
+
name: "GLM 5.3",
|
|
108
|
+
context: 1_048_576,
|
|
109
|
+
price: { input: 1.4, cacheRead: 0.26, output: 4.4 },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
model: "workers-ai/@cf/zai-org/glm-5.3-flash",
|
|
113
|
+
name: "GLM 5.3 Flash",
|
|
114
|
+
context: 1_048_576,
|
|
115
|
+
price: { input: 0.15, cacheRead: 0.03, output: 0.5 },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
model: "workers-ai/@cf/qwen/qwen3.8-27b",
|
|
119
|
+
name: "Qwen3.8 27B",
|
|
120
|
+
context: 262_144,
|
|
121
|
+
price: { input: 0.45, cacheRead: 0.05, output: 3.2 },
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
model: "workers-ai/@cf/google/gemma-4-26b-a4b-it",
|
|
125
|
+
name: "Gemma 4 26B",
|
|
126
|
+
context: 256_000,
|
|
127
|
+
price: { input: 0.1, cacheRead: 0.1, output: 0.3 },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
model: "workers-ai/@cf/nvidia/nemotron-3-120b-a12b",
|
|
131
|
+
name: "Nemotron 3 120B",
|
|
132
|
+
context: 256_000,
|
|
133
|
+
price: { input: 0.5, cacheRead: 0.5, output: 1.5 },
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
model: "workers-ai/@cf/meta/llama-4-scout-17b-16e-instruct",
|
|
137
|
+
name: "Llama 4 Scout",
|
|
138
|
+
context: 131_000,
|
|
139
|
+
price: { input: 0.27, cacheRead: 0.27, output: 0.85 },
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
model: "workers-ai/@cf/mistralai/mistral-small-3.1-24b-instruct",
|
|
143
|
+
name: "Mistral Small 3.1",
|
|
144
|
+
context: 128_000,
|
|
145
|
+
price: { input: 0.351, cacheRead: 0.351, output: 0.555 },
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
model: "openai/gpt-6.1-terra",
|
|
149
|
+
name: "GPT-6.1 Terra",
|
|
150
|
+
context: 1_050_000,
|
|
151
|
+
price: { input: 1, cacheRead: 0.05, cacheWrite: 1.25, output: 5 },
|
|
152
|
+
outputLimit: "max_completion_tokens",
|
|
153
|
+
reasoningEffort: "none",
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
model: "openai/gpt-6-luna",
|
|
157
|
+
name: "GPT-6 Luna",
|
|
158
|
+
context: 1_050_000,
|
|
159
|
+
price: { input: 0.1, cacheRead: 0.01, cacheWrite: 0.125, output: 0.5 },
|
|
160
|
+
outputLimit: "max_completion_tokens",
|
|
161
|
+
reasoningEffort: "none",
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
function gatewayModelIds() {
|
|
167
|
+
return gatewayCatalog.flatMap((entry) => entry.models.map((model) => model.model));
|
|
168
|
+
}
|
|
169
|
+
// The models the catalog held before (#1011) and no longer holds (#1059): Claude 4.x and Gemini 2.5.
|
|
170
|
+
// They stay in `OperatorModel`, so an Operator stored on one still reads; it pauses with the reason
|
|
171
|
+
// `model` ("Modell nicht mehr im Katalog") until it gets a model of the catalog, and no run starts.
|
|
172
|
+
export const retiredGatewayModels = [
|
|
173
|
+
{ model: "anthropic/claude-sonnet-4-6", name: "Claude Sonnet 4.6" },
|
|
174
|
+
{ model: "anthropic/claude-opus-4-6", name: "Claude Opus 4.6" },
|
|
175
|
+
{ model: "anthropic/claude-haiku-4-5", name: "Claude Haiku 4.5" },
|
|
176
|
+
{ model: "google-ai-studio/gemini-2.5-pro", name: "Gemini 2.5 Pro" },
|
|
177
|
+
{ model: "google-ai-studio/gemini-2.5-flash", name: "Gemini 2.5 Flash" },
|
|
178
|
+
];
|
|
179
|
+
// The entry of a model of the kind Gateway, or null for every other model.
|
|
180
|
+
export function gatewayModelOf(model) {
|
|
181
|
+
for (const entry of gatewayCatalog) {
|
|
182
|
+
for (const found of entry.models)
|
|
183
|
+
if (found.model === model)
|
|
184
|
+
return found;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
export function outputLimitOf(model) {
|
|
189
|
+
const entry = gatewayModelOf(model);
|
|
190
|
+
return entry && "outputLimit" in entry ? entry.outputLimit : "max_tokens";
|
|
191
|
+
}
|
|
192
|
+
// The reasoning effort a model must be sent to call tools on Chat Completions, or null (#1018).
|
|
193
|
+
export function reasoningEffortOf(model) {
|
|
194
|
+
const entry = gatewayModelOf(model);
|
|
195
|
+
return entry && "reasoningEffort" in entry ? entry.reasoningEffort : null;
|
|
196
|
+
}
|
|
197
|
+
// A cache write at its own price where the catalog names one, else at the input's.
|
|
198
|
+
export function cacheWritePriceOf(entry) {
|
|
199
|
+
return "cacheWrite" in entry.price ? entry.price.cacheWrite : entry.price.input;
|
|
200
|
+
}
|
|
201
|
+
// The table of a gateway model, checked: every price and context a positive number, every name a
|
|
202
|
+
// `provider/model` the gateway's Unified API takes.
|
|
203
|
+
export const GatewayModelEntrySchema = z.object({
|
|
204
|
+
model: z.string().regex(/^[a-z-]+\/[^\s]+$/),
|
|
205
|
+
name: z.string().min(1),
|
|
206
|
+
context: z.int().positive(),
|
|
207
|
+
price: z.object({
|
|
208
|
+
input: z.number().nonnegative(),
|
|
209
|
+
cacheRead: z.number().nonnegative(),
|
|
210
|
+
cacheWrite: z.number().nonnegative().optional(),
|
|
211
|
+
output: z.number().nonnegative(),
|
|
212
|
+
}),
|
|
213
|
+
outputLimit: z.enum(["max_tokens", "max_completion_tokens"]).optional(),
|
|
214
|
+
reasoningEffort: z.literal("none").optional(),
|
|
215
|
+
});
|
|
216
|
+
// The catalog (Einstellungen › Operator › Katalog), two kinds (E210):
|
|
217
|
+
// - `claude`: Claude Code in a container, with the sign-in of a subscription or an API key. Its
|
|
218
|
+
// `models` are Claude Code's aliases for "the newest of this line". Through the gateway it runs no
|
|
219
|
+
// more since #978: that is the kind Gateway's.
|
|
220
|
+
// - `gateway` (#1011): an Operator on Project Think without a CLI, whose model is any of
|
|
221
|
+
// `gatewayCatalog` through the customer's AI Gateway; its credential is the gateway credential.
|
|
222
|
+
// Codex and Gemini are gone since #978 (Jack, 2026-11-04, after the Spike #979): GPT and Gemini come
|
|
223
|
+
// as models of the gateway. `OperatorProvider` keeps their names, so a row stored before still reads;
|
|
224
|
+
// a credential of theirs reads invalid with the reason (`withdrawnOf`), and no run of theirs starts.
|
|
225
|
+
// `subagents`: only Claude Code has them. `costs`: both report an amount, the gateway's from its logs
|
|
226
|
+
// or the catalog's price.
|
|
46
227
|
export const operatorProviders = [
|
|
47
228
|
{
|
|
48
229
|
provider: "claude",
|
|
49
230
|
name: "Claude",
|
|
50
231
|
vendor: "Anthropic",
|
|
51
232
|
selectable: true,
|
|
52
|
-
kinds: ["subscription", "apikey"
|
|
233
|
+
kinds: ["subscription", "apikey"],
|
|
53
234
|
beta: false,
|
|
54
235
|
models: ["opus", "sonnet", "haiku"],
|
|
55
236
|
defaultModel: "sonnet",
|
|
56
|
-
gateway: { models: ["opus", "sonnet"], defaultModel: "sonnet" },
|
|
57
237
|
subagents: true,
|
|
58
238
|
costs: true,
|
|
59
239
|
},
|
|
60
240
|
{
|
|
61
|
-
provider: "
|
|
62
|
-
name: "
|
|
63
|
-
vendor: "
|
|
241
|
+
provider: "gateway",
|
|
242
|
+
name: "Gateway",
|
|
243
|
+
vendor: "Cloudflare AI Gateway",
|
|
64
244
|
selectable: true,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
models: ["gpt-6-astra", "gpt-6.1-sol", "gpt-6-luna"],
|
|
70
|
-
defaultModel: "gpt-6.1-sol",
|
|
71
|
-
gateway: { models: ["gpt-6.1-sol", "gpt-6-luna"], defaultModel: "gpt-6.1-sol" },
|
|
72
|
-
subagents: false,
|
|
73
|
-
costs: false,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
provider: "gemini",
|
|
77
|
-
name: "Gemini",
|
|
78
|
-
vendor: "Google",
|
|
79
|
-
selectable: true,
|
|
80
|
-
// No Google sign-in (#459): Code Assist then asks for a Google Cloud project of the account,
|
|
81
|
-
// and for free accounts the Gemini CLI gave way to Antigravity (#507, from #502).
|
|
82
|
-
kinds: ["apikey", "gateway"],
|
|
83
|
-
beta: true,
|
|
84
|
-
models: ["pro", "flash", "flash-lite"],
|
|
85
|
-
defaultModel: "flash",
|
|
86
|
-
gateway: {
|
|
87
|
-
models: ["gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite"],
|
|
88
|
-
defaultModel: "gemini-2.5-flash",
|
|
89
|
-
},
|
|
245
|
+
kinds: ["gateway"],
|
|
246
|
+
beta: false,
|
|
247
|
+
models: gatewayModelIds(),
|
|
248
|
+
defaultModel: "workers-ai/@cf/deepseek-ai/deepseek-v4-pro-0813",
|
|
90
249
|
subagents: false,
|
|
91
|
-
costs:
|
|
250
|
+
costs: true,
|
|
92
251
|
},
|
|
93
252
|
];
|
|
94
|
-
// The models an Operator of this provider may take
|
|
95
|
-
//
|
|
96
|
-
export function modelsOf(entry,
|
|
97
|
-
return
|
|
253
|
+
// The models an Operator of this provider may take, and the default among them (#483). Since #978
|
|
254
|
+
// the kind decides nothing more: a gateway credential serves the kind Gateway only.
|
|
255
|
+
export function modelsOf(entry, _kind) {
|
|
256
|
+
return entry;
|
|
257
|
+
}
|
|
258
|
+
// Whether a provider's catalog still holds this model (#1059). A provider without an entry (Codex and
|
|
259
|
+
// Gemini since #978) answers true: its Operators pause by their credential, not by their model.
|
|
260
|
+
export function inCatalog(provider, model) {
|
|
261
|
+
const entry = operatorProviders.find((item) => item.provider === provider);
|
|
262
|
+
return !entry || entry.models.includes(model);
|
|
98
263
|
}
|
|
99
264
|
// `subscription`: the sign-in of a subscription, the token of `claude setup-token`; none for Codex
|
|
100
265
|
// and Gemini since #459, a stored one reads as invalid. `apikey`: an API key (Claude Console,
|
|
@@ -122,6 +287,33 @@ export const OperatorModel = z.enum([
|
|
|
122
287
|
"gemini-2.5-pro",
|
|
123
288
|
"gemini-2.5-flash",
|
|
124
289
|
"gemini-2.5-flash-lite",
|
|
290
|
+
// The kind Gateway (#1011, #1059), `gatewayCatalog`.
|
|
291
|
+
"workers-ai/@cf/deepseek-ai/deepseek-v4-pro-0813",
|
|
292
|
+
"workers-ai/@cf/deepseek-ai/deepseek-v4.1-flash-1017",
|
|
293
|
+
"anthropic/claude-haiku-5-5",
|
|
294
|
+
"anthropic/claude-sonnet-5-5",
|
|
295
|
+
"anthropic/claude-opus-5-5",
|
|
296
|
+
"anthropic/claude-fable-5-1",
|
|
297
|
+
"xai/grok-4.7",
|
|
298
|
+
"moonshotai/kimi-k3",
|
|
299
|
+
"workers-ai/@cf/moonshotai/kimi-k2.7-code",
|
|
300
|
+
"workers-ai/@cf/moonshotai/kimi-k2.6",
|
|
301
|
+
"workers-ai/@cf/zai-org/glm-5.3",
|
|
302
|
+
"workers-ai/@cf/zai-org/glm-5.3-flash",
|
|
303
|
+
"workers-ai/@cf/qwen/qwen3.8-27b",
|
|
304
|
+
"workers-ai/@cf/google/gemma-4-26b-a4b-it",
|
|
305
|
+
"workers-ai/@cf/nvidia/nemotron-3-120b-a12b",
|
|
306
|
+
"workers-ai/@cf/meta/llama-4-scout-17b-16e-instruct",
|
|
307
|
+
"workers-ai/@cf/mistralai/mistral-small-3.1-24b-instruct",
|
|
308
|
+
// OpenAI through the gateway (#1018).
|
|
309
|
+
"openai/gpt-6.1-terra",
|
|
310
|
+
"openai/gpt-6-luna",
|
|
311
|
+
// Out of the catalog since #1059 (`retiredGatewayModels`): a stored Operator still reads.
|
|
312
|
+
"anthropic/claude-sonnet-4-6",
|
|
313
|
+
"anthropic/claude-opus-4-6",
|
|
314
|
+
"anthropic/claude-haiku-4-5",
|
|
315
|
+
"google-ai-studio/gemini-2.5-pro",
|
|
316
|
+
"google-ai-studio/gemini-2.5-flash",
|
|
125
317
|
]);
|
|
126
318
|
export const CredentialId = idSchema("credential");
|
|
127
319
|
const CredentialName = z.string().trim().min(1).max(64);
|
|
@@ -140,6 +332,17 @@ export const GatewayTarget = z.strictObject({
|
|
|
140
332
|
.trim()
|
|
141
333
|
.regex(/^[A-Za-z0-9_-]{1,64}$/, "A gateway id holds letters, digits, - and _ only."),
|
|
142
334
|
});
|
|
335
|
+
// What a gateway credential's token may do (#1012), each tested with one smallest call: `run` the
|
|
336
|
+
// models through the gateway (needed, without it no Operator runs), `read` the gateway's logs (the
|
|
337
|
+
// amount of a run; without it the amount is tokens times the catalog's price) and `workersai` the
|
|
338
|
+
// REST API of Workers AI (`/ai/v1/…`, the models served only there). `granted` is null where the
|
|
339
|
+
// call could not tell; `without` says what is missing without the right.
|
|
340
|
+
export const GatewayRight = z.enum(["run", "read", "workersai"]);
|
|
341
|
+
export const GatewayRightCheck = z.object({
|
|
342
|
+
right: GatewayRight,
|
|
343
|
+
granted: z.boolean().nullable(),
|
|
344
|
+
without: z.string().nullable(),
|
|
345
|
+
});
|
|
143
346
|
export const CredentialListInput = z.strictObject({
|
|
144
347
|
cursor: CredentialId.optional(),
|
|
145
348
|
limit: Limit.optional(),
|
|
@@ -156,9 +359,12 @@ export const CredentialCreateInput = z
|
|
|
156
359
|
gateway: GatewayTarget.optional(),
|
|
157
360
|
})
|
|
158
361
|
.refine((input) => input.kind === "gateway"
|
|
159
|
-
? input.provider === undefined
|
|
160
|
-
|
|
161
|
-
|
|
362
|
+
? (input.provider === undefined || input.provider === "gateway") &&
|
|
363
|
+
input.gateway !== undefined
|
|
364
|
+
: input.provider !== undefined &&
|
|
365
|
+
input.provider !== "gateway" &&
|
|
366
|
+
input.gateway === undefined, {
|
|
367
|
+
message: "A gateway credential takes gateway and no provider but gateway (the kind Gateway, #1012); every other kind takes its provider and no gateway.",
|
|
162
368
|
});
|
|
163
369
|
// "Token ersetzen": a new value, a new name, or both. A new value is tested at once. A gateway
|
|
164
370
|
// credential takes a new value only together with its `gateway` (#470).
|
|
@@ -206,6 +412,9 @@ export const Credential = z.object({
|
|
|
206
412
|
personal: z.boolean(),
|
|
207
413
|
// Ausweichen: a run that fails on it moves on to the next fitting credential in the order.
|
|
208
414
|
fallback: z.boolean(),
|
|
415
|
+
// A gateway credential's rights as its last test found them (#1012); null for every other kind
|
|
416
|
+
// and before the first test since #1012.
|
|
417
|
+
rights: z.array(GatewayRightCheck).nullable(),
|
|
209
418
|
// When a run last met the provider's usage limit on it, and until when the order skips it: the
|
|
210
419
|
// time the provider named for its reset, else an hour (#890). Null where no limit was met.
|
|
211
420
|
limitedAt: z.iso.datetime().nullable(),
|
|
@@ -249,17 +458,29 @@ export const Trigger = z.discriminatedUnion("on", [
|
|
|
249
458
|
z.object({ on: z.literal("change"), quietMinutes: z.int().min(0).max(1440) }),
|
|
250
459
|
z.object({ on: z.literal("schedule"), schedule: Schedule }),
|
|
251
460
|
]);
|
|
252
|
-
//
|
|
461
|
+
// How long the steps of a run stay (E211, #1028): 7, 30 or 90 days, or null for as long as the run.
|
|
462
|
+
export const KeepStepsDays = z.union([z.literal(7), z.literal(30), z.literal(90), z.null()]);
|
|
463
|
+
// The limits of E81: the longest run in minutes and the most runs a day; and how long the steps of
|
|
464
|
+
// its runs stay (E211).
|
|
253
465
|
export const OperatorLimits = z.strictObject({
|
|
254
466
|
maxRunMinutes: z.int().min(1).max(240),
|
|
255
467
|
maxRunsPerDay: z.int().min(1).max(1000),
|
|
468
|
+
keepStepsDays: KeepStepsDays,
|
|
256
469
|
});
|
|
257
470
|
export const operatorDefaults = {
|
|
258
471
|
model: "sonnet",
|
|
259
472
|
subagents: { allowed: false, max: 3 },
|
|
260
|
-
|
|
261
|
-
|
|
473
|
+
// No quiet time (E185, #966): woken by a mention or a goal's rhythm, a wait is only a delay.
|
|
474
|
+
trigger: { on: "change", quietMinutes: 0 },
|
|
475
|
+
limits: { maxRunMinutes: 30, maxRunsPerDay: 50, keepStepsDays: 30 },
|
|
262
476
|
};
|
|
477
|
+
// The validation's Operator keeps 5 minutes, as a fixed value when it is created with the role
|
|
478
|
+
// `validator` and no trigger (E185): it sees many small saves in a row and takes them in one run.
|
|
479
|
+
// ⚠️ Not a standard of its own: an Operator handed the role later keeps what it stored.
|
|
480
|
+
export const validatorTrigger = { on: "change", quietMinutes: 5 };
|
|
481
|
+
// A schedule stored before #824 carries no quiet time and was read with the standard of then; it
|
|
482
|
+
// keeps those 5 minutes, so E185 changes no stored Operator silently.
|
|
483
|
+
export const scheduleQuietMinutes = 5;
|
|
263
484
|
// `no_role`: it has no role and starts no run (E84). `paused`: see `pausedReason`. `ready`: it may run.
|
|
264
485
|
// "läuft" is `running` beside the state (#337).
|
|
265
486
|
export const OperatorState = z.enum(["no_role", "ready", "paused"]);
|
|
@@ -268,7 +489,18 @@ export const OperatorState = z.enum(["no_role", "ready", "paused"]);
|
|
|
268
489
|
// `owner`: a personal Operator whose person is locked (E143), derived like `credential`.
|
|
269
490
|
// `budget`: its person's limit of the month is reached (E143, #804); it ends on the first of the next
|
|
270
491
|
// month (UTC), or when an admin raises the limit.
|
|
271
|
-
|
|
492
|
+
// `model` (#1059): its model is no longer in its provider's catalog ("Modell nicht mehr im Katalog"),
|
|
493
|
+
// derived like `credential`; it ends once the Operator gets a model of the catalog
|
|
494
|
+
// (`operator_machine_update`).
|
|
495
|
+
export const PauseReason = z.enum([
|
|
496
|
+
"manual",
|
|
497
|
+
"limit",
|
|
498
|
+
"failures",
|
|
499
|
+
"credential",
|
|
500
|
+
"owner",
|
|
501
|
+
"budget",
|
|
502
|
+
"model",
|
|
503
|
+
]);
|
|
272
504
|
export const MachineListInput = z.strictObject({
|
|
273
505
|
personal: Flag.optional().describe("true: the personal Operators (E143), your own, or every person's for an admin in admin mode. Leaving it out lists the company's Operators; without admin rights you read your own personal ones only, whatever you send."),
|
|
274
506
|
cursor: MachineId.optional(),
|
|
@@ -469,6 +701,9 @@ export const OperatorRunReason = z.enum([
|
|
|
469
701
|
]);
|
|
470
702
|
// What woke it: a change after the quiet minutes, a fixed time, or the retry after a failure.
|
|
471
703
|
export const OperatorRunTrigger = z.enum(["change", "schedule", "retry"]);
|
|
704
|
+
// Where a run's amount comes from (#1013): the AI Gateway's logs, the catalog's price times the
|
|
705
|
+
// tokens (the kind Gateway without "AI Gateway Read"), or the CLI's own figure.
|
|
706
|
+
export const OperatorRunCostSource = z.enum(["logs", "catalog", "provider"]);
|
|
472
707
|
export const OperatorRunTokens = z.object({
|
|
473
708
|
input: z.int().min(0),
|
|
474
709
|
output: z.int().min(0),
|
|
@@ -509,6 +744,19 @@ const RunMachine = {
|
|
|
509
744
|
// a page without `limit` this many runs. The protocol page reads every summary whole, 50 a page.
|
|
510
745
|
export const runSummaryChars = 300;
|
|
511
746
|
export const compactRunLimit = 20;
|
|
747
|
+
// One step of a run's plan (E218, #1036): what it is, how it is done, what it left, and whether it
|
|
748
|
+
// is done. Not a `step` of the protocol (`operator_run_step_list`): those are what the run did.
|
|
749
|
+
export const RunPlanStep = z.object({
|
|
750
|
+
title: z.string(),
|
|
751
|
+
how: z.string().nullable(),
|
|
752
|
+
result: z.string().nullable(),
|
|
753
|
+
done: z.boolean(),
|
|
754
|
+
// What the step left (E219, #1037): nodes as proof; empty for a step without any.
|
|
755
|
+
evidence: z.array(z.string()),
|
|
756
|
+
// The subagent the step went to and its plan beneath it (E220, #1038); absent on the main agent's.
|
|
757
|
+
agent: z.string().nullable().optional(),
|
|
758
|
+
steps: z.array(PlanSubstep).optional(),
|
|
759
|
+
});
|
|
512
760
|
export const OperatorRun = z.object({
|
|
513
761
|
runId: OperatorRunId,
|
|
514
762
|
...RunMachine,
|
|
@@ -531,6 +779,8 @@ export const OperatorRun = z.object({
|
|
|
531
779
|
// Claude's own amount; Codex and Gemini report tokens and no amount, so their runs carry null
|
|
532
780
|
// (#455). Through the Cloudflare AI Gateway the amount of its logs, for every provider (#470).
|
|
533
781
|
costUsd: z.number().nullable(),
|
|
782
|
+
// Where the amount comes from (#1013); null without one and for a run before #1013.
|
|
783
|
+
costSource: OperatorRunCostSource.nullable(),
|
|
534
784
|
tokens: OperatorRunTokens.nullable(),
|
|
535
785
|
// The subagents the run started, and how many of them run now (E112); null for a run before
|
|
536
786
|
// they were counted. Only Claude Code has subagents (E99).
|
|
@@ -547,6 +797,10 @@ export const OperatorRun = z.object({
|
|
|
547
797
|
startedAt: z.iso.datetime(),
|
|
548
798
|
endedAt: z.iso.datetime().nullable(),
|
|
549
799
|
durationMs: z.int().nullable(),
|
|
800
|
+
// After how many days the daily job removed its steps (E211, #1028); null while they stand.
|
|
801
|
+
stepsRemovedDays: z.int().nullable(),
|
|
802
|
+
// Its plan (E218, #1036); null for a run that wrote none.
|
|
803
|
+
plan: z.array(RunPlanStep).nullable(),
|
|
550
804
|
});
|
|
551
805
|
const RunMoment = z.iso.datetime({ offset: true });
|
|
552
806
|
export const OperatorRunListInput = z.strictObject({
|
|
@@ -571,12 +825,75 @@ export const OperatorRunGetInput = z.strictObject({ runId: OperatorRunId });
|
|
|
571
825
|
// Stopping a run by hand (E112): its container ends, the run ends `stopped`.
|
|
572
826
|
export const RunCancelInput = z.strictObject({ runId: OperatorRunId });
|
|
573
827
|
// Marks the technical abort of a run read (E141, #825), like a chat: its row leaves the Actions.
|
|
574
|
-
export const
|
|
828
|
+
export const runPlanMax = 30;
|
|
829
|
+
const RunPlanStepInput = z.strictObject({
|
|
830
|
+
title: z.string().trim().min(1).max(200).describe("The step in a few words."),
|
|
831
|
+
how: z
|
|
832
|
+
.string()
|
|
833
|
+
.trim()
|
|
834
|
+
.max(2000)
|
|
835
|
+
.nullable()
|
|
836
|
+
.optional()
|
|
837
|
+
.describe("How it is done: the tools, the nodes, what to check. Shown when it is next."),
|
|
838
|
+
result: z
|
|
839
|
+
.string()
|
|
840
|
+
.trim()
|
|
841
|
+
.max(2000)
|
|
842
|
+
.nullable()
|
|
843
|
+
.optional()
|
|
844
|
+
.describe("What the step left, in a sentence: the node made, the value found, what was checked. Needed to mark it done."),
|
|
845
|
+
done: z
|
|
846
|
+
.boolean()
|
|
847
|
+
.optional()
|
|
848
|
+
.describe("Whether the step is done; only with a result. Leaving it out means not yet."),
|
|
849
|
+
evidence: z
|
|
850
|
+
.array(idSchema("node"))
|
|
851
|
+
.max(planEvidenceMax)
|
|
852
|
+
.optional()
|
|
853
|
+
.describe("What the step left: the nodes it made or used as proof (a document, a table, a card handed over, a file)."),
|
|
854
|
+
agent: AgentName.nullable()
|
|
855
|
+
.optional()
|
|
856
|
+
.describe("The subagent you hand this step to with agent_run, by the name you give it; its own plan then stands beneath the step."),
|
|
857
|
+
});
|
|
858
|
+
export const RunUpdateInput = z
|
|
859
|
+
.strictObject({
|
|
575
860
|
runId: OperatorRunId,
|
|
576
861
|
read: z
|
|
577
862
|
.literal(true)
|
|
863
|
+
.optional()
|
|
578
864
|
.describe("true: you have seen that this run broke off. Its row leaves your Actions; a later run that completes takes it away by itself."),
|
|
865
|
+
plan: z
|
|
866
|
+
.array(RunPlanStepInput)
|
|
867
|
+
.min(1)
|
|
868
|
+
.max(runPlanMax)
|
|
869
|
+
.optional()
|
|
870
|
+
.describe("The plan of your own running run, in order; it replaces the one before. Mark a step done only with its result."),
|
|
871
|
+
agent: AgentName.optional().describe("Set by the run for a subagent: its plan goes beneath the step of the main agent's plan it took."),
|
|
872
|
+
})
|
|
873
|
+
.refine((input) => (input.read === undefined) !== (input.plan === undefined), {
|
|
874
|
+
message: "Give either read or plan.",
|
|
579
875
|
});
|
|
876
|
+
// What `operator_run_update` answers to a plan (E218): the next open step with how it is done, of
|
|
877
|
+
// the rest only the titles, so the run works one step at a time.
|
|
878
|
+
export const RunPlanAnswer = z.object({
|
|
879
|
+
runId: OperatorRunId,
|
|
880
|
+
done: z.int(),
|
|
881
|
+
total: z.int(),
|
|
882
|
+
next: z.object({ title: z.string(), how: z.string().nullable() }).nullable(),
|
|
883
|
+
remaining: z.array(z.string()),
|
|
884
|
+
});
|
|
885
|
+
// The answer of a plan as it is stored: a step is next while it is not done, the first such first.
|
|
886
|
+
export function planAnswerOf(runId, plan) {
|
|
887
|
+
const open = plan.filter((step) => !step.done);
|
|
888
|
+
const [next, ...rest] = open;
|
|
889
|
+
return {
|
|
890
|
+
runId,
|
|
891
|
+
done: plan.length - open.length,
|
|
892
|
+
total: plan.length,
|
|
893
|
+
next: next ? { title: next.title, how: next.how } : null,
|
|
894
|
+
remaining: rest.map((step) => step.title),
|
|
895
|
+
};
|
|
896
|
+
}
|
|
580
897
|
// One step of a run as its CLI's output showed it (E112): what the model wrote, a tool it called
|
|
581
898
|
// with a short form of the input, the shortened result, a subagent's start and end. `agentId` is
|
|
582
899
|
// the id of the call that started the subagent the step belongs to (`parent_tool_use_id` of Claude
|
|
@@ -23,6 +23,7 @@ export declare const OrganisationUpdateInput: z.ZodObject<{
|
|
|
23
23
|
GBP: "GBP";
|
|
24
24
|
}>>>;
|
|
25
25
|
currencyRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
26
|
+
homeGadgetId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
26
27
|
}, z.core.$strict>;
|
|
27
28
|
export type OrganisationUpdateInput = z.infer<typeof OrganisationUpdateInput>;
|
|
28
29
|
export declare const Organisation: z.ZodObject<{
|
|
@@ -39,6 +40,7 @@ export declare const Organisation: z.ZodObject<{
|
|
|
39
40
|
GBP: "GBP";
|
|
40
41
|
}>>;
|
|
41
42
|
currencyRate: z.ZodNullable<z.ZodNumber>;
|
|
43
|
+
homeGadgetId: z.ZodNullable<z.ZodString>;
|
|
42
44
|
setAt: z.ZodNullable<z.ZodISODateTime>;
|
|
43
45
|
setBy: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
|
|
44
46
|
}, z.core.$strip>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { NodeId } from "../nodes/nodes.js";
|
|
2
3
|
import { Locale, TimeZone } from "../profile/profile.js";
|
|
3
4
|
import { UserId } from "../users/users.js";
|
|
4
5
|
// Organisation › System (#930): what holds for the whole company. The name is the installation's
|
|
@@ -12,6 +13,9 @@ import { UserId } from "../users/users.js";
|
|
|
12
13
|
// US dollars. With a currency other than USD and a fixed rate the admin enters (1 USD = `currencyRate`
|
|
13
14
|
// of the currency), the UI shows and takes amounts in that currency, converted with the rate. The
|
|
14
15
|
// MCP tools stay in US dollars. Null or USD: dollars everywhere, as before.
|
|
16
|
+
//
|
|
17
|
+
// The start (#1020, E208): the gadget whose live version stands under `/` for everybody who may read
|
|
18
|
+
// it. Null: none, and `/` shows Colab's fallback.
|
|
15
19
|
export const currencies = ["EUR", "USD", "CHF", "GBP"];
|
|
16
20
|
export const Currency = z.enum(currencies);
|
|
17
21
|
// How many units of the currency one US dollar buys; fixed until an admin changes it.
|
|
@@ -30,6 +34,9 @@ export const OrganisationUpdateInput = z.strictObject({
|
|
|
30
34
|
currencyRate: CurrencyRate.nullable()
|
|
31
35
|
.optional()
|
|
32
36
|
.describe("The fixed rate: how many units of the currency one US dollar is (1 USD = currencyRate), greater than 0, such as 0.92 for EUR. null takes it out. Left out: unchanged."),
|
|
37
|
+
homeGadgetId: NodeId.nullable()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("The gadget everybody sees under / (the start, E208): its live version, for whoever may read it. A gadget that is not archived. null takes it out, and / shows Colab's own fallback. Left out: unchanged."),
|
|
33
40
|
});
|
|
34
41
|
export const Organisation = z.object({
|
|
35
42
|
// The installation's name for people; empty when the installation sets none.
|
|
@@ -39,6 +46,8 @@ export const Organisation = z.object({
|
|
|
39
46
|
currency: Currency.nullable(),
|
|
40
47
|
// 1 USD = currencyRate of the currency; null while unset.
|
|
41
48
|
currencyRate: z.number().nullable(),
|
|
49
|
+
// The gadget under `/` (#1020, E208); null while none is set.
|
|
50
|
+
homeGadgetId: z.string().nullable(),
|
|
42
51
|
// When and by whom the defaults were last changed; null while nobody has.
|
|
43
52
|
setAt: z.iso.datetime().nullable(),
|
|
44
53
|
setBy: UserId.nullable(),
|
|
@@ -3,3 +3,12 @@ export declare const IdempotencyKey: z.ZodString;
|
|
|
3
3
|
export type IdempotencyKey = z.infer<typeof IdempotencyKey>;
|
|
4
4
|
export declare const Rev: z.ZodNumber;
|
|
5
5
|
export type Rev = z.infer<typeof Rev>;
|
|
6
|
+
export declare const planEvidenceMax = 20;
|
|
7
|
+
export declare const gatewayAgentsMax = 3;
|
|
8
|
+
export declare const AgentName: z.ZodString;
|
|
9
|
+
export declare const PlanSubstep: z.ZodObject<{
|
|
10
|
+
title: z.ZodString;
|
|
11
|
+
result: z.ZodNullable<z.ZodString>;
|
|
12
|
+
done: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type PlanSubstep = z.infer<typeof PlanSubstep>;
|