@anchrd/colab-sdk 0.1.21 → 0.1.23

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.
@@ -0,0 +1,437 @@
1
+ import { z } from "zod";
2
+ export declare const SkillId: z.ZodTemplateLiteral<`node_${string}`>;
3
+ export type SkillId = z.infer<typeof SkillId>;
4
+ export declare const skillFilePattern: RegExp;
5
+ export declare const SkillFilePath: z.ZodString;
6
+ export declare const SkillCreateInput: z.ZodObject<{
7
+ parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
8
+ name: z.ZodString;
9
+ content: z.ZodString;
10
+ result: z.ZodOptional<z.ZodString>;
11
+ trigger: z.ZodOptional<z.ZodString>;
12
+ triggerOn: z.ZodOptional<z.ZodBoolean>;
13
+ idempotencyKey: z.ZodString;
14
+ }, z.core.$strict>;
15
+ export type SkillCreateInput = z.infer<typeof SkillCreateInput>;
16
+ export declare const SkillGetInput: z.ZodObject<{
17
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
18
+ files: z.ZodOptional<z.ZodPreprocess<z.ZodBoolean, unknown>>;
19
+ }, z.core.$strict>;
20
+ export type SkillGetInput = z.infer<typeof SkillGetInput>;
21
+ export declare const SkillUpdateInput: z.ZodObject<{
22
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
23
+ content: z.ZodOptional<z.ZodString>;
24
+ result: z.ZodOptional<z.ZodString>;
25
+ trigger: z.ZodOptional<z.ZodString>;
26
+ triggerOn: z.ZodOptional<z.ZodBoolean>;
27
+ files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
28
+ fromRun: z.ZodOptional<z.ZodTemplateLiteral<`run_${string}`>>;
29
+ rev: z.ZodNumber;
30
+ editSession: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strict>;
32
+ export type SkillUpdateInput = z.infer<typeof SkillUpdateInput>;
33
+ export declare const SkillTestInput: z.ZodObject<{
34
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
35
+ record: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strict>;
37
+ export type SkillTestInput = z.infer<typeof SkillTestInput>;
38
+ export declare const SkillRunListInput: z.ZodObject<{
39
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
40
+ cursor: z.ZodOptional<z.ZodString>;
41
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
42
+ }, z.core.$strict>;
43
+ export type SkillRunListInput = z.infer<typeof SkillRunListInput>;
44
+ export declare const SkillRunGetInput: z.ZodObject<{
45
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
46
+ runId: z.ZodTemplateLiteral<`run_${string}`>;
47
+ }, z.core.$strict>;
48
+ export type SkillRunGetInput = z.infer<typeof SkillRunGetInput>;
49
+ export declare const SkillFile: z.ZodObject<{
50
+ path: z.ZodString;
51
+ content: z.ZodString;
52
+ }, z.core.$strip>;
53
+ export type SkillFile = z.infer<typeof SkillFile>;
54
+ export declare const SkillPoint: z.ZodObject<{
55
+ text: z.ZodString;
56
+ kind: z.ZodEnum<{
57
+ expected: "expected";
58
+ result: "result";
59
+ }>;
60
+ ok: z.ZodBoolean;
61
+ reason: z.ZodNullable<z.ZodString>;
62
+ }, z.core.$strip>;
63
+ export type SkillPoint = z.infer<typeof SkillPoint>;
64
+ export declare const skillCaseStatuses: readonly ["passed", "failed", "missing"];
65
+ export declare const SkillCaseResult: z.ZodObject<{
66
+ name: z.ZodString;
67
+ status: z.ZodEnum<{
68
+ failed: "failed";
69
+ passed: "passed";
70
+ missing: "missing";
71
+ }>;
72
+ recordedAt: z.ZodNullable<z.ZodString>;
73
+ fromRun: z.ZodNullable<z.ZodString>;
74
+ runs: z.ZodInt;
75
+ passedRuns: z.ZodInt;
76
+ points: z.ZodArray<z.ZodObject<{
77
+ text: z.ZodString;
78
+ kind: z.ZodEnum<{
79
+ expected: "expected";
80
+ result: "result";
81
+ }>;
82
+ ok: z.ZodBoolean;
83
+ reason: z.ZodNullable<z.ZodString>;
84
+ }, z.core.$strip>>;
85
+ missing: z.ZodNullable<z.ZodObject<{
86
+ tool: z.ZodString;
87
+ path: z.ZodString;
88
+ }, z.core.$strip>>;
89
+ sandbox: z.ZodArray<z.ZodObject<{
90
+ tool: z.ZodString;
91
+ }, z.core.$strip>>;
92
+ costUsd: z.ZodNumber;
93
+ runId: z.ZodNullable<z.ZodTemplateLiteral<`run_${string}`>>;
94
+ }, z.core.$strip>;
95
+ export type SkillCaseResult = z.infer<typeof SkillCaseResult>;
96
+ export declare const SkillTriggerHit: z.ZodObject<{
97
+ kind: z.ZodEnum<{
98
+ should: "should";
99
+ shouldNot: "shouldNot";
100
+ }>;
101
+ request: z.ZodString;
102
+ chosen: z.ZodNullable<z.ZodString>;
103
+ ok: z.ZodBoolean;
104
+ }, z.core.$strip>;
105
+ export type SkillTriggerHit = z.infer<typeof SkillTriggerHit>;
106
+ export declare const SkillTestReport: z.ZodObject<{
107
+ version: z.ZodInt;
108
+ at: z.ZodISODateTime;
109
+ by: z.ZodObject<{
110
+ userId: z.ZodString;
111
+ name: z.ZodNullable<z.ZodString>;
112
+ kind: z.ZodNullable<z.ZodEnum<{
113
+ machine: "machine";
114
+ human: "human";
115
+ }>>;
116
+ }, z.core.$strip>;
117
+ passed: z.ZodInt;
118
+ failed: z.ZodInt;
119
+ missing: z.ZodInt;
120
+ trigger: z.ZodNullable<z.ZodObject<{
121
+ skills: z.ZodInt;
122
+ operator: z.ZodNullable<z.ZodObject<{
123
+ userId: z.ZodString;
124
+ name: z.ZodNullable<z.ZodString>;
125
+ kind: z.ZodNullable<z.ZodEnum<{
126
+ machine: "machine";
127
+ human: "human";
128
+ }>>;
129
+ }, z.core.$strip>>;
130
+ hits: z.ZodArray<z.ZodObject<{
131
+ kind: z.ZodEnum<{
132
+ should: "should";
133
+ shouldNot: "shouldNot";
134
+ }>;
135
+ request: z.ZodString;
136
+ chosen: z.ZodNullable<z.ZodString>;
137
+ ok: z.ZodBoolean;
138
+ }, z.core.$strip>>;
139
+ costUsd: z.ZodNumber;
140
+ }, z.core.$strip>>;
141
+ cases: z.ZodArray<z.ZodObject<{
142
+ name: z.ZodString;
143
+ status: z.ZodEnum<{
144
+ failed: "failed";
145
+ passed: "passed";
146
+ missing: "missing";
147
+ }>;
148
+ recordedAt: z.ZodNullable<z.ZodString>;
149
+ fromRun: z.ZodNullable<z.ZodString>;
150
+ runs: z.ZodInt;
151
+ passedRuns: z.ZodInt;
152
+ points: z.ZodArray<z.ZodObject<{
153
+ text: z.ZodString;
154
+ kind: z.ZodEnum<{
155
+ expected: "expected";
156
+ result: "result";
157
+ }>;
158
+ ok: z.ZodBoolean;
159
+ reason: z.ZodNullable<z.ZodString>;
160
+ }, z.core.$strip>>;
161
+ missing: z.ZodNullable<z.ZodObject<{
162
+ tool: z.ZodString;
163
+ path: z.ZodString;
164
+ }, z.core.$strip>>;
165
+ sandbox: z.ZodArray<z.ZodObject<{
166
+ tool: z.ZodString;
167
+ }, z.core.$strip>>;
168
+ costUsd: z.ZodNumber;
169
+ runId: z.ZodNullable<z.ZodTemplateLiteral<`run_${string}`>>;
170
+ }, z.core.$strip>>;
171
+ problem: z.ZodNullable<z.ZodString>;
172
+ }, z.core.$strip>;
173
+ export type SkillTestReport = z.infer<typeof SkillTestReport>;
174
+ export declare const SkillDetail: z.ZodObject<{
175
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
176
+ name: z.ZodString;
177
+ hidden: z.ZodBoolean;
178
+ parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
179
+ path: z.ZodObject<{
180
+ section: z.ZodEnum<{
181
+ users: "users";
182
+ own: "own";
183
+ shared: "shared";
184
+ }>;
185
+ items: z.ZodArray<z.ZodObject<{
186
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
187
+ name: z.ZodString;
188
+ }, z.core.$strip>>;
189
+ }, z.core.$strip>;
190
+ content: z.ZodString;
191
+ result: z.ZodString;
192
+ trigger: z.ZodString;
193
+ triggerOn: z.ZodBoolean;
194
+ version: z.ZodInt;
195
+ rev: z.ZodInt;
196
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
197
+ files: z.ZodNullable<z.ZodArray<z.ZodObject<{
198
+ path: z.ZodString;
199
+ content: z.ZodString;
200
+ }, z.core.$strip>>>;
201
+ test: z.ZodNullable<z.ZodObject<{
202
+ version: z.ZodInt;
203
+ at: z.ZodISODateTime;
204
+ by: z.ZodObject<{
205
+ userId: z.ZodString;
206
+ name: z.ZodNullable<z.ZodString>;
207
+ kind: z.ZodNullable<z.ZodEnum<{
208
+ machine: "machine";
209
+ human: "human";
210
+ }>>;
211
+ }, z.core.$strip>;
212
+ passed: z.ZodInt;
213
+ failed: z.ZodInt;
214
+ missing: z.ZodInt;
215
+ trigger: z.ZodNullable<z.ZodObject<{
216
+ skills: z.ZodInt;
217
+ operator: z.ZodNullable<z.ZodObject<{
218
+ userId: z.ZodString;
219
+ name: z.ZodNullable<z.ZodString>;
220
+ kind: z.ZodNullable<z.ZodEnum<{
221
+ machine: "machine";
222
+ human: "human";
223
+ }>>;
224
+ }, z.core.$strip>>;
225
+ hits: z.ZodArray<z.ZodObject<{
226
+ kind: z.ZodEnum<{
227
+ should: "should";
228
+ shouldNot: "shouldNot";
229
+ }>;
230
+ request: z.ZodString;
231
+ chosen: z.ZodNullable<z.ZodString>;
232
+ ok: z.ZodBoolean;
233
+ }, z.core.$strip>>;
234
+ costUsd: z.ZodNumber;
235
+ }, z.core.$strip>>;
236
+ cases: z.ZodArray<z.ZodObject<{
237
+ name: z.ZodString;
238
+ status: z.ZodEnum<{
239
+ failed: "failed";
240
+ passed: "passed";
241
+ missing: "missing";
242
+ }>;
243
+ recordedAt: z.ZodNullable<z.ZodString>;
244
+ fromRun: z.ZodNullable<z.ZodString>;
245
+ runs: z.ZodInt;
246
+ passedRuns: z.ZodInt;
247
+ points: z.ZodArray<z.ZodObject<{
248
+ text: z.ZodString;
249
+ kind: z.ZodEnum<{
250
+ expected: "expected";
251
+ result: "result";
252
+ }>;
253
+ ok: z.ZodBoolean;
254
+ reason: z.ZodNullable<z.ZodString>;
255
+ }, z.core.$strip>>;
256
+ missing: z.ZodNullable<z.ZodObject<{
257
+ tool: z.ZodString;
258
+ path: z.ZodString;
259
+ }, z.core.$strip>>;
260
+ sandbox: z.ZodArray<z.ZodObject<{
261
+ tool: z.ZodString;
262
+ }, z.core.$strip>>;
263
+ costUsd: z.ZodNumber;
264
+ runId: z.ZodNullable<z.ZodTemplateLiteral<`run_${string}`>>;
265
+ }, z.core.$strip>>;
266
+ problem: z.ZodNullable<z.ZodString>;
267
+ }, z.core.$strip>>;
268
+ rights: z.ZodObject<{
269
+ write: z.ZodBoolean;
270
+ }, z.core.$strip>;
271
+ }, z.core.$strip>;
272
+ export type SkillDetail = z.infer<typeof SkillDetail>;
273
+ export declare const skillRunKinds: readonly ["operator", "person", "probe"];
274
+ export declare const skillRunStatuses: readonly ["open", "reached", "missed", "passed", "failed", "missing"];
275
+ export declare const SkillRunItem: z.ZodObject<{
276
+ runId: z.ZodTemplateLiteral<`run_${string}`>;
277
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
278
+ kind: z.ZodEnum<{
279
+ operator: "operator";
280
+ person: "person";
281
+ probe: "probe";
282
+ }>;
283
+ by: z.ZodObject<{
284
+ userId: z.ZodString;
285
+ name: z.ZodNullable<z.ZodString>;
286
+ kind: z.ZodNullable<z.ZodEnum<{
287
+ machine: "machine";
288
+ human: "human";
289
+ }>>;
290
+ }, z.core.$strip>;
291
+ via: z.ZodNullable<z.ZodString>;
292
+ context: z.ZodObject<{
293
+ kind: z.ZodEnum<{
294
+ goal: "goal";
295
+ chat: "chat";
296
+ tests: "tests";
297
+ }>;
298
+ nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
299
+ name: z.ZodNullable<z.ZodString>;
300
+ }, z.core.$strip>;
301
+ version: z.ZodInt;
302
+ status: z.ZodEnum<{
303
+ open: "open";
304
+ failed: "failed";
305
+ passed: "passed";
306
+ reached: "reached";
307
+ missing: "missing";
308
+ missed: "missed";
309
+ }>;
310
+ startedAt: z.ZodISODateTime;
311
+ calls: z.ZodInt;
312
+ caseName: z.ZodNullable<z.ZodString>;
313
+ kept: z.ZodBoolean;
314
+ }, z.core.$strip>;
315
+ export type SkillRunItem = z.infer<typeof SkillRunItem>;
316
+ export declare const SkillRunCall: z.ZodObject<{
317
+ seq: z.ZodInt;
318
+ tool: z.ZodString;
319
+ write: z.ZodBoolean;
320
+ sandbox: z.ZodBoolean;
321
+ input: z.ZodUnknown;
322
+ answer: z.ZodUnknown;
323
+ size: z.ZodNullable<z.ZodInt>;
324
+ durationMs: z.ZodInt;
325
+ code: z.ZodNullable<z.ZodString>;
326
+ }, z.core.$strip>;
327
+ export type SkillRunCall = z.infer<typeof SkillRunCall>;
328
+ export declare const SkillRunDetail: z.ZodObject<{
329
+ runId: z.ZodTemplateLiteral<`run_${string}`>;
330
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
331
+ kind: z.ZodEnum<{
332
+ operator: "operator";
333
+ person: "person";
334
+ probe: "probe";
335
+ }>;
336
+ by: z.ZodObject<{
337
+ userId: z.ZodString;
338
+ name: z.ZodNullable<z.ZodString>;
339
+ kind: z.ZodNullable<z.ZodEnum<{
340
+ machine: "machine";
341
+ human: "human";
342
+ }>>;
343
+ }, z.core.$strip>;
344
+ via: z.ZodNullable<z.ZodString>;
345
+ context: z.ZodObject<{
346
+ kind: z.ZodEnum<{
347
+ goal: "goal";
348
+ chat: "chat";
349
+ tests: "tests";
350
+ }>;
351
+ nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
352
+ name: z.ZodNullable<z.ZodString>;
353
+ }, z.core.$strip>;
354
+ version: z.ZodInt;
355
+ status: z.ZodEnum<{
356
+ open: "open";
357
+ failed: "failed";
358
+ passed: "passed";
359
+ reached: "reached";
360
+ missing: "missing";
361
+ missed: "missed";
362
+ }>;
363
+ startedAt: z.ZodISODateTime;
364
+ caseName: z.ZodNullable<z.ZodString>;
365
+ kept: z.ZodBoolean;
366
+ calls: z.ZodArray<z.ZodObject<{
367
+ seq: z.ZodInt;
368
+ tool: z.ZodString;
369
+ write: z.ZodBoolean;
370
+ sandbox: z.ZodBoolean;
371
+ input: z.ZodUnknown;
372
+ answer: z.ZodUnknown;
373
+ size: z.ZodNullable<z.ZodInt>;
374
+ durationMs: z.ZodInt;
375
+ code: z.ZodNullable<z.ZodString>;
376
+ }, z.core.$strip>>;
377
+ note: z.ZodNullable<z.ZodString>;
378
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
379
+ }, z.core.$strip>;
380
+ export type SkillRunDetail = z.infer<typeof SkillRunDetail>;
381
+ export declare const SkillRunList: z.ZodObject<{
382
+ items: z.ZodArray<z.ZodObject<{
383
+ runId: z.ZodTemplateLiteral<`run_${string}`>;
384
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
385
+ kind: z.ZodEnum<{
386
+ operator: "operator";
387
+ person: "person";
388
+ probe: "probe";
389
+ }>;
390
+ by: z.ZodObject<{
391
+ userId: z.ZodString;
392
+ name: z.ZodNullable<z.ZodString>;
393
+ kind: z.ZodNullable<z.ZodEnum<{
394
+ machine: "machine";
395
+ human: "human";
396
+ }>>;
397
+ }, z.core.$strip>;
398
+ via: z.ZodNullable<z.ZodString>;
399
+ context: z.ZodObject<{
400
+ kind: z.ZodEnum<{
401
+ goal: "goal";
402
+ chat: "chat";
403
+ tests: "tests";
404
+ }>;
405
+ nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
406
+ name: z.ZodNullable<z.ZodString>;
407
+ }, z.core.$strip>;
408
+ version: z.ZodInt;
409
+ status: z.ZodEnum<{
410
+ open: "open";
411
+ failed: "failed";
412
+ passed: "passed";
413
+ reached: "reached";
414
+ missing: "missing";
415
+ missed: "missed";
416
+ }>;
417
+ startedAt: z.ZodISODateTime;
418
+ calls: z.ZodInt;
419
+ caseName: z.ZodNullable<z.ZodString>;
420
+ kept: z.ZodBoolean;
421
+ }, z.core.$strip>>;
422
+ nextCursor: z.ZodNullable<z.ZodString>;
423
+ }, z.core.$strip>;
424
+ export type SkillRunList = z.infer<typeof SkillRunList>;
425
+ export declare const SkillFields: z.ZodObject<{
426
+ result: z.ZodString;
427
+ trigger: z.ZodString;
428
+ triggerOn: z.ZodBoolean;
429
+ files: z.ZodRecord<z.ZodString, z.ZodString>;
430
+ }, z.core.$strip>;
431
+ export type SkillFields = z.infer<typeof SkillFields>;
432
+ export declare const SkillOffer: z.ZodObject<{
433
+ skillId: z.ZodTemplateLiteral<`node_${string}`>;
434
+ name: z.ZodString;
435
+ trigger: z.ZodString;
436
+ }, z.core.$strip>;
437
+ export type SkillOffer = z.infer<typeof SkillOffer>;
@@ -0,0 +1,240 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ import { Flag, Limit } from "../list-input.js";
4
+ import { NodeId, NodePath, NodePerson } from "../nodes/nodes.js";
5
+ import { IdempotencyKey, Rev } from "../primitives/primitives.js";
6
+ // Skills (#817, #807, Nodes › Skill, E140): the inputs of `intelligence_skill_create|get|update|test`
7
+ // and `intelligence_skill_run_list|get`, and their answers. A skill says how something is done well:
8
+ // its text in Markdown, the result that is there at the end, and a trigger that says when it fits.
9
+ // Its tests check the result, not the way, with recordings of real runs.
10
+ export const SkillId = NodeId.describe("The skill's id, a `node_…` of kind skill.");
11
+ // A run of a skill is the resource `run` (`run_…`), like a run of a goal.
12
+ const RunId = idSchema("run").describe("The run's id, `run_…`, as intelligence_skill_run_list names it.");
13
+ const Content = z
14
+ .string()
15
+ .max(200_000)
16
+ .describe("The skill's text as Markdown, without a fixed structure and without a title (the name is the title). Its first paragraph says what the skill is for.");
17
+ const Result = z
18
+ .string()
19
+ .max(20_000)
20
+ .describe("What is there at the end, as a Markdown list of checkable sentences, one point per line. The tests check against it; optional, but tests need it.");
21
+ const Trigger = z
22
+ .string()
23
+ .max(2000)
24
+ .describe("When the skill fits, like the description of a Claude skill: an Operator reads it with the name at the start of a run and decides itself whether to load the skill. Used only while triggerOn is true.");
25
+ const TriggerOn = z
26
+ .boolean()
27
+ .describe("Whether the trigger is used. Off, the skill comes only when someone names it with @Skill; its trigger text stays.");
28
+ // The code of a skill (#807): `evals.yaml` and `data/<case>/<tool>.json`.
29
+ export const skillFilePattern = /^(evals\.yaml|data\/[a-z0-9][a-z0-9-]{0,63}\/[a-z0-9_]{1,80}\.json)$/;
30
+ export const SkillFilePath = z
31
+ .string()
32
+ .regex(skillFilePattern)
33
+ .describe("`evals.yaml`, or `data/<case>/<tool>.json` with the recorded answers of one tool for one test case (case in kebab-case).");
34
+ const FileText = z.string().max(500_000);
35
+ export const SkillCreateInput = z.strictObject({
36
+ // ⚠️ Required and nullable (trap C015): null is the top level of Shared.
37
+ parentId: NodeId.nullable().describe("The folder to create the skill in, one you can write to, mostly `.Skills` or the folder it is for; null creates it on the top level of Shared."),
38
+ name: z.string().max(200).describe("The name as people read it, like `Leads übernehmen`."),
39
+ content: Content,
40
+ result: Result.optional(),
41
+ trigger: Trigger.optional(),
42
+ triggerOn: TriggerOn.optional(),
43
+ idempotencyKey: IdempotencyKey,
44
+ });
45
+ export const SkillGetInput = z.strictObject({
46
+ skillId: SkillId,
47
+ files: Flag.optional().describe("Also answer the code (evals.yaml and data/) and the latest test run. Only for whoever may change the skill; a reader gets neither."),
48
+ });
49
+ export const SkillUpdateInput = z.strictObject({
50
+ skillId: SkillId,
51
+ content: Content.optional(),
52
+ result: Result.optional(),
53
+ trigger: Trigger.optional(),
54
+ triggerOn: TriggerOn.optional(),
55
+ files: z
56
+ .record(SkillFilePath, FileText.nullable())
57
+ .optional()
58
+ .describe("Files of the code to write, by path; null removes one. Files you leave out stay as they are."),
59
+ fromRun: RunId.optional().describe("A run of the skill's log to take over as a test case: writes data/<case>/ with the answers of its reading tools and a case in evals.yaml with aus_lauf. Write the expectation into the case afterwards."),
60
+ rev: Rev,
61
+ editSession: z
62
+ .string()
63
+ .min(1)
64
+ .max(100)
65
+ .optional()
66
+ .describe("The editing session the editor keeps while a person stays on the skill: saves of one session go into one version. Leaving it out makes every save a version of its own, which is right for an AI."),
67
+ });
68
+ export const SkillTestInput = z.strictObject({
69
+ skillId: SkillId,
70
+ record: z
71
+ .string()
72
+ .min(1)
73
+ .max(200)
74
+ .optional()
75
+ .describe("The name of one case to record anew: it runs once with real reading tools and the rights of the Operator in evals.yaml; if it passes, its data/ replaces the old recording. Writing still goes into the sandbox."),
76
+ });
77
+ export const SkillRunListInput = z.strictObject({
78
+ skillId: SkillId,
79
+ cursor: z
80
+ .string()
81
+ .max(1000)
82
+ .optional()
83
+ .describe("The nextCursor of the previous page, unchanged. Leaving it out starts at the newest."),
84
+ limit: Limit.optional().describe("How many runs one page holds, 1 to 100. Leaving it out gives 50."),
85
+ });
86
+ export const SkillRunGetInput = z.strictObject({ skillId: SkillId, runId: RunId });
87
+ export const SkillFile = z.object({ path: z.string(), content: z.string() });
88
+ // One point a case is checked against: a line of the result, or one it expects in addition.
89
+ export const SkillPoint = z.object({
90
+ text: z.string(),
91
+ kind: z.enum(["result", "expected"]),
92
+ ok: z.boolean(),
93
+ // Why it failed, as the grading model read the trace and the result; null when it passed.
94
+ reason: z.string().nullable(),
95
+ });
96
+ export const skillCaseStatuses = ["passed", "failed", "missing"];
97
+ export const SkillCaseResult = z.object({
98
+ name: z.string(),
99
+ // passed: every run passed every point; failed: one did not; missing: a tool without a recording
100
+ // was called, so the case stopped before it ran it. Not a fault of the skill.
101
+ status: z.enum(skillCaseStatuses),
102
+ // When the case's data was recorded, with which version; null where evals.yaml does not say.
103
+ recordedAt: z.string().nullable(),
104
+ fromRun: z.string().nullable(),
105
+ runs: z.int(),
106
+ passedRuns: z.int(),
107
+ points: z.array(SkillPoint),
108
+ // The call without a recording that stopped the case.
109
+ missing: z.object({ tool: z.string(), path: z.string() }).nullable(),
110
+ // The sandbox's writes of the last run: what it would have written, written nowhere.
111
+ sandbox: z.array(z.object({ tool: z.string() })),
112
+ costUsd: z.number(),
113
+ // The probe run of the case's last attempt, its trace in the log.
114
+ runId: RunId.nullable(),
115
+ });
116
+ export const SkillTriggerHit = z.object({
117
+ kind: z.enum(["should", "shouldNot"]),
118
+ request: z.string(),
119
+ // The skill the model chose for the request, by name; null for none.
120
+ chosen: z.string().nullable(),
121
+ ok: z.boolean(),
122
+ });
123
+ export const SkillTestReport = z.object({
124
+ version: z.int(),
125
+ at: z.iso.datetime(),
126
+ by: NodePerson,
127
+ passed: z.int(),
128
+ failed: z.int(),
129
+ missing: z.int(),
130
+ // Only while the trigger is on and evals.yaml names requests.
131
+ trigger: z
132
+ .object({
133
+ // How many skills the list held that the Operator sees at its start.
134
+ skills: z.int(),
135
+ operator: NodePerson.nullable(),
136
+ hits: z.array(SkillTriggerHit),
137
+ costUsd: z.number(),
138
+ })
139
+ .nullable(),
140
+ cases: z.array(SkillCaseResult),
141
+ // What evals.yaml got wrong, a sentence; null when it reads.
142
+ problem: z.string().nullable(),
143
+ });
144
+ export const SkillDetail = z.object({
145
+ skillId: SkillId,
146
+ name: z.string(),
147
+ hidden: z.boolean(),
148
+ parentId: NodeId.nullable(),
149
+ path: NodePath,
150
+ content: z.string(),
151
+ result: z.string(),
152
+ trigger: z.string(),
153
+ triggerOn: z.boolean(),
154
+ // The current version's number ("Version 13").
155
+ version: z.int(),
156
+ rev: z.int(),
157
+ archivedAt: z.iso.datetime().nullable(),
158
+ // The code and the latest test run, only for whoever may change the skill and asked for them;
159
+ // null otherwise. Recordings carry real data of runs that a reader does not see (E140).
160
+ files: z.array(SkillFile).nullable(),
161
+ test: SkillTestReport.nullable(),
162
+ rights: z.object({
163
+ // Change the skill, see its code and console, run its tests.
164
+ write: z.boolean(),
165
+ }),
166
+ });
167
+ export const skillRunKinds = ["operator", "person", "probe"];
168
+ export const skillRunStatuses = [
169
+ "open",
170
+ "reached",
171
+ "missed",
172
+ "passed",
173
+ "failed",
174
+ "missing",
175
+ ];
176
+ export const SkillRunItem = z.object({
177
+ runId: RunId,
178
+ skillId: SkillId,
179
+ // operator: an Operator ran it; person: a person through their AI; probe: a test case.
180
+ kind: z.enum(skillRunKinds),
181
+ by: NodePerson,
182
+ // The connected app it came through ("Claude"), null for an Operator and a probe.
183
+ via: z.string().nullable(),
184
+ // Where it ran: the goal of an Operator run, the chat or a test case.
185
+ context: z.object({
186
+ kind: z.enum(["goal", "chat", "tests"]),
187
+ nodeId: NodeId.nullable(),
188
+ name: z.string().nullable(),
189
+ }),
190
+ // The skill's version it ran with.
191
+ version: z.int(),
192
+ // open while nothing says how it ended; reached and missed from the goal run it worked for;
193
+ // passed, failed and missing for a probe.
194
+ status: z.enum(skillRunStatuses),
195
+ startedAt: z.iso.datetime(),
196
+ calls: z.int(),
197
+ // The case of a probe, null otherwise.
198
+ caseName: z.string().nullable(),
199
+ // Taken over as a test case: its recording stays past the 30 days.
200
+ kept: z.boolean(),
201
+ });
202
+ export const SkillRunCall = z.object({
203
+ seq: z.int(),
204
+ tool: z.string(),
205
+ write: z.boolean(),
206
+ // Recorded only in the sandbox of a probe: written nowhere.
207
+ sandbox: z.boolean(),
208
+ input: z.unknown(),
209
+ answer: z.unknown(),
210
+ // How many rows or entries the answer carried, null where it holds no list.
211
+ size: z.int().nullable(),
212
+ durationMs: z.int(),
213
+ // The error code of a refused call, null otherwise.
214
+ code: z.string().nullable(),
215
+ });
216
+ export const SkillRunDetail = SkillRunItem.extend({
217
+ calls: z.array(SkillRunCall),
218
+ // A point that failed, with the grading's reason; null where nothing failed.
219
+ note: z.string().nullable(),
220
+ // When the recording goes: 30 days after the run, null when kept.
221
+ expiresAt: z.iso.datetime().nullable(),
222
+ });
223
+ export const SkillRunList = z.object({
224
+ items: z.array(SkillRunItem),
225
+ nextCursor: z.string().nullable(),
226
+ });
227
+ // What a version of a skill holds beside its text (E140): result, trigger and the code.
228
+ export const SkillFields = z.object({
229
+ result: z.string(),
230
+ trigger: z.string(),
231
+ triggerOn: z.boolean(),
232
+ files: z.record(z.string(), z.string()),
233
+ });
234
+ // The skills an Operator gets at the start of a run (E140): name and trigger of every readable skill
235
+ // with its trigger on, from `.Skills` and the folders above the nodes it works at.
236
+ export const SkillOffer = z.object({
237
+ skillId: SkillId,
238
+ name: z.string(),
239
+ trigger: z.string(),
240
+ });
package/dist/tool.d.ts CHANGED
@@ -10,6 +10,7 @@ export type Actor = {
10
10
  adminMode: boolean;
11
11
  client?: string;
12
12
  session?: string;
13
+ operator?: string;
13
14
  };
14
15
  export type ToolSource = "api" | "mcp";
15
16
  export type ToolContext = {