@anchrd/colab-sdk 0.1.35 → 0.1.37

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.
Files changed (49) hide show
  1. package/dist/actions/actions.d.ts +30 -23
  2. package/dist/actions/actions.js +2 -2
  3. package/dist/archive/archive.d.ts +1 -0
  4. package/dist/archive/archive.js +3 -0
  5. package/dist/boards/boards.d.ts +21 -21
  6. package/dist/columns/columns.d.ts +2 -2
  7. package/dist/connectors/connectors.d.ts +6 -6
  8. package/dist/crawls/crawls.d.ts +3 -3
  9. package/dist/crawls/crawls.js +1 -1
  10. package/dist/error/error.d.ts +9 -3
  11. package/dist/error/error.js +12 -3
  12. package/dist/gadgets/gadgets.d.ts +125 -9
  13. package/dist/gadgets/gadgets.js +123 -0
  14. package/dist/goals/goals.d.ts +54 -10
  15. package/dist/goals/goals.js +36 -7
  16. package/dist/grammar/grammar.d.ts +2 -0
  17. package/dist/grammar/grammar.js +10 -0
  18. package/dist/home/home.d.ts +300 -0
  19. package/dist/home/home.js +53 -0
  20. package/dist/links/links.d.ts +166 -0
  21. package/dist/links/links.js +149 -0
  22. package/dist/mcps/mcps.d.ts +3 -3
  23. package/dist/messages/messages.d.ts +3 -0
  24. package/dist/nodes/nodes.d.ts +46 -20
  25. package/dist/nodes/nodes.js +11 -3
  26. package/dist/operators/operators.d.ts +389 -47
  27. package/dist/operators/operators.js +268 -70
  28. package/dist/organisation/organisation.d.ts +2 -0
  29. package/dist/organisation/organisation.js +9 -0
  30. package/dist/primitives/primitives.d.ts +9 -0
  31. package/dist/primitives/primitives.js +16 -0
  32. package/dist/roles/roles.d.ts +1 -0
  33. package/dist/roles/roles.js +3 -0
  34. package/dist/runs/runs.d.ts +2 -2
  35. package/dist/sdk.d.ts +10 -9
  36. package/dist/sdk.js +10 -9
  37. package/dist/skills/skills.d.ts +37 -7
  38. package/dist/skills/skills.js +50 -0
  39. package/dist/sources/sources.d.ts +54 -14
  40. package/dist/sources/sources.js +50 -5
  41. package/dist/tables/tables.d.ts +42 -0
  42. package/dist/tables/tables.js +55 -2
  43. package/dist/tool.d.ts +1 -0
  44. package/dist/tree-order/tree-order.d.ts +2 -2
  45. package/dist/tree-order/tree-order.js +1 -1
  46. package/dist/users/users.d.ts +2 -0
  47. package/dist/users/users.js +3 -2
  48. package/dist/versions/versions.d.ts +13 -13
  49. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { idSchema } from "../ids/ids.js";
4
4
  import { Limit } from "../list-input.js";
5
5
  import { CreateSection, NodeId, NodePath, NodePerson } from "../nodes/nodes.js";
6
6
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
7
+ import { ServiceId } from "../services/services.js";
7
8
  import { UserId } from "../users/users.js";
8
9
  // Gadgets (#642, E118, Nodes › Gadget): a small application an AI builds and Colab runs. Its files
9
10
  // without a build step, every change into the draft, publishing as a version, and calling a function
@@ -32,6 +33,13 @@ export const GadgetFunctionName = z
32
33
  .max(64)
33
34
  .regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/)
34
35
  .describe("The function's name, exported by server.js under the same name.");
36
+ // The right a function needs (#790, E162): `interface.function` of the service in `access.service`,
37
+ // each word one word like every word of a right (E64).
38
+ export const GadgetRequires = z
39
+ .string()
40
+ .max(129)
41
+ .regex(/^[a-z][a-z0-9]*\.[a-z][a-z0-9]*$/)
42
+ .describe("The function of the gadget's service a caller needs, as interface.function, such as leads.read.");
35
43
  // One function of the manifest, under its name in `functions`.
36
44
  export const GadgetFunction = z.strictObject({
37
45
  description: z.string().max(2000).describe("What the function does, for the AI that calls it."),
@@ -39,10 +47,24 @@ export const GadgetFunction = z.strictObject({
39
47
  .record(z.string(), z.unknown())
40
48
  .optional()
41
49
  .describe("A JSON Schema of the function's input, an object; Colab checks every call against it. Leaving it out takes any object."),
50
+ requires: GadgetRequires.optional(),
51
+ });
52
+ // Rights per person over a service of Access (#790, E162): the gadget names a service an admin set
53
+ // up, and every function names the function of that service it requires.
54
+ export const GadgetAccess = z.strictObject({
55
+ service: ServiceId.describe("The service of Access whose functions this gadget's functions require, `service_…`. An admin creates it and switches it on in roles."),
42
56
  });
57
+ // The nodes a gadget reads and writes with rights of its own (#986, E163): node id to `read` or
58
+ // `write`. Granted at publish, only as far as the one who publishes holds them.
59
+ export const GadgetUseRight = z.enum(["read", "write"]);
60
+ export const GadgetUses = z
61
+ .record(NodeId, GadgetUseRight)
62
+ .describe("The nodes the gadget reads or writes with rights of its own, each node id with read or write. Granted when it goes live, only as far as you hold them yourself.");
43
63
  export const GadgetManifest = z.strictObject({
44
64
  name: z.string().min(1).max(200).describe("The gadget's name in the manifest."),
45
65
  description: z.string().max(2000).optional().describe("What the gadget is for."),
66
+ access: GadgetAccess.optional(),
67
+ uses: GadgetUses.optional(),
46
68
  functions: z
47
69
  .record(GadgetFunctionName, GadgetFunction)
48
70
  .describe("The functions server.js exports, each under its name."),
@@ -70,6 +92,19 @@ export const GadgetCreateInput = z.strictObject({
70
92
  .record(GadgetFilePath, FileContent)
71
93
  .optional()
72
94
  .describe("The gadget's first files by path, such as gadget.json, server.js, client.js and tests/*.test.js. They become its draft; nothing is live until it is published. Leaving it out creates an empty gadget."),
95
+ from: z
96
+ .strictObject({
97
+ gadgetId: NodeId.describe("The gadget to duplicate."),
98
+ as: z
99
+ .enum(["copy", "link"])
100
+ .describe("copy: its own code and history from here on, starting as a draft of the original's live state, for whoever may change the original. link: the original's code, following every version it publishes and read only here, with its own settings, data and storage; for whoever may read an original that is live."),
101
+ uses: z
102
+ .record(NodeId, NodeId)
103
+ .optional()
104
+ .describe("Only for a link: for a node of the original's uses, the node it uses here instead, with the same right (Daten an dieser Stelle). Nodes left out stay the original's."),
105
+ })
106
+ .optional()
107
+ .describe("Duplicate a gadget instead of giving files (E216)."),
73
108
  idempotencyKey: IdempotencyKey,
74
109
  });
75
110
  // `include` over REST is one comma-separated value (`?include=files`): a query string carries text.
@@ -81,6 +116,19 @@ export const GadgetGetInput = z.strictObject({
81
116
  .preprocess((value) => (typeof value === "string" ? value.split(",") : value), z.array(GadgetInclude).min(1).max(1))
82
117
  .optional()
83
118
  .describe("files: answer the text of every file of that state, not only their paths."),
119
+ // ⚠️ Over REST a query string carries text only: `?compare=6,live` is the same as the object.
120
+ compare: z
121
+ .preprocess((value) => {
122
+ if (typeof value !== "string")
123
+ return value;
124
+ const [from, to, ...rest] = value.split(",");
125
+ return rest.length === 0 && to !== undefined ? { from, to } : value;
126
+ }, z.strictObject({
127
+ from: GadgetVersionRef.describe("The older side: a version's number, live or draft."),
128
+ to: GadgetVersionRef.describe("The newer side: a version's number, live or draft."),
129
+ }))
130
+ .optional()
131
+ .describe("Also answer what changed from one state to another, file by file with both texts (the diff). Only for whoever may change the gadget."),
84
132
  });
85
133
  const GadgetSettingsInput = z.strictObject({
86
134
  responsibleId: UserId.nullable()
@@ -88,6 +136,14 @@ const GadgetSettingsInput = z.strictObject({
88
136
  .describe("The Operator or person who gets every new error and red test as an Action; null for nobody, then the publisher gets a hint."),
89
137
  level: GadgetLevel.optional().describe("How far the responsible goes: report, draft (repair as a draft, the default) or publish (repair and publish, only with every test green and no new rights)."),
90
138
  logDays: LogDays.optional(),
139
+ uses: z
140
+ .record(NodeId, NodeId)
141
+ .optional()
142
+ .describe("Only at a link: for a node of the original's uses, the node it uses here instead (Daten an dieser Stelle); the whole mapping, a node left out uses the original's again."),
143
+ original: z
144
+ .null()
145
+ .optional()
146
+ .describe("Only at a link: null turns it into a copy with its own code and history (In Kopie umwandeln)."),
91
147
  });
92
148
  export const GadgetUpdateInput = z.strictObject({
93
149
  gadgetId: GadgetId,
@@ -188,6 +244,11 @@ export const GadgetChange = z.object({
188
244
  path: z.string(),
189
245
  change: z.enum(["added", "changed", "removed"]),
190
246
  });
247
+ // A file of a diff (E216): its change with both texts, null on the side it is missing.
248
+ export const GadgetDiffFile = GadgetChange.extend({
249
+ before: z.string().nullable(),
250
+ after: z.string().nullable(),
251
+ });
191
252
  export const GadgetSettings = z.object({
192
253
  responsible: NodePerson.nullable(),
193
254
  level: GadgetLevel,
@@ -307,6 +368,10 @@ export const GadgetDetail = z.object({
307
368
  // The Colab tools the draft's backend names and the live one does not ("Keine neuen Rechte"),
308
369
  // read from the text of its files: a name built at run time is not seen.
309
370
  newTools: z.array(z.string()),
371
+ // The nodes the draft's `uses` adds or raises to write against live (#986, "Nutzt neu").
372
+ newUses: z
373
+ .array(z.object({ nodeId: z.string(), name: z.string().nullable(), right: GadgetUseRight }))
374
+ .optional(),
310
375
  })
311
376
  .nullable(),
312
377
  // The last run of the tests (#643); null for a reader and before the first.
@@ -323,6 +388,59 @@ export const GadgetDetail = z.object({
323
388
  // Only for whoever may change the gadget; null for a reader.
324
389
  settings: GadgetSettings.nullable(),
325
390
  rights: z.object({ write: z.boolean() }),
391
+ // The service of `access.service` in this state's manifest and what the caller holds of it (#790,
392
+ // E162): its functions as `interface.function`, and of them the ones the caller may call. `name`
393
+ // is null when the service is gone; an archived one holds nothing. Null without `access`.
394
+ access: z
395
+ .object({
396
+ serviceId: z.string(),
397
+ name: z.string().nullable(),
398
+ archived: z.boolean(),
399
+ functions: z.array(z.string()),
400
+ held: z.array(z.string()),
401
+ })
402
+ .nullable()
403
+ .optional(),
404
+ // The nodes of `uses` in this state (#986, E163), only for whoever may change the gadget: name
405
+ // (null where the reader cannot read it), the right, and `missing` for a node archived or out of
406
+ // the gadget's reach. Null for a reader and without `uses`.
407
+ uses: z
408
+ .array(z.object({
409
+ nodeId: z.string(),
410
+ name: z.string().nullable(),
411
+ path: z.array(z.string()),
412
+ right: GadgetUseRight,
413
+ missing: z.boolean(),
414
+ // Lies in Own (under a root folder): goes along when the gadget moves to Shared.
415
+ own: z.boolean().optional(),
416
+ }))
417
+ .nullable()
418
+ .optional(),
419
+ // A link (E216): its original, whose live version runs here, and what it uses here instead of
420
+ // the original's nodes. Null for an original and a copy.
421
+ link: z
422
+ .object({
423
+ originalId: NodeId,
424
+ // Null where the caller cannot read the original.
425
+ name: z.string().nullable(),
426
+ uses: z.record(z.string(), z.string()),
427
+ })
428
+ .nullable()
429
+ .optional(),
430
+ // An original's links (E216), only for whoever may change it: they run its live version.
431
+ links: z
432
+ .array(z.object({ gadgetId: NodeId, name: z.string().nullable() }))
433
+ .nullable()
434
+ .optional(),
435
+ // What `compare` asked for: the files that changed between the two states.
436
+ diff: z
437
+ .object({
438
+ from: z.union([z.number().int(), z.literal("draft")]).nullable(),
439
+ to: z.union([z.number().int(), z.literal("draft")]).nullable(),
440
+ files: z.array(GadgetDiffFile),
441
+ })
442
+ .nullable()
443
+ .optional(),
326
444
  // The state the next save sends (E70).
327
445
  rev: z.number().int(),
328
446
  archivedAt: z.iso.datetime().nullable(),
@@ -347,6 +465,11 @@ export const GadgetCall = z.object({
347
465
  durationMs: z.number().int(),
348
466
  console: z.array(GadgetConsoleLine),
349
467
  tools: z.array(GadgetToolUse),
468
+ // A live call that did not run because a node of `uses` is missing (#986): each with its name for
469
+ // whoever may change the gadget, null for a reader.
470
+ missing: z
471
+ .array(z.object({ nodeId: z.string().nullable(), name: z.string().nullable() }))
472
+ .optional(),
350
473
  });
351
474
  // One entry of the log as the list shows it (#643): a call of a function on the server, or the
352
475
  // interface opened in the browser (`function` null, "Geöffnet").
@@ -143,7 +143,8 @@ export declare const GoalCheck: z.ZodObject<{
143
143
  }>;
144
144
  nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
145
145
  name: z.ZodNullable<z.ZodString>;
146
- nodeKind: z.ZodNullable<z.ZodEnum<{
146
+ nodeKind: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
147
+ unknown: "unknown";
147
148
  file: "file";
148
149
  folder: "folder";
149
150
  document: "document";
@@ -154,7 +155,7 @@ export declare const GoalCheck: z.ZodObject<{
154
155
  goal: "goal";
155
156
  skill: "skill";
156
157
  source: "source";
157
- }>>;
158
+ }>>>;
158
159
  needs: z.ZodNullable<z.ZodEnum<{
159
160
  write: "write";
160
161
  read: "read";
@@ -218,7 +219,8 @@ export declare const GoalReady: z.ZodObject<{
218
219
  }>;
219
220
  nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
220
221
  name: z.ZodNullable<z.ZodString>;
221
- nodeKind: z.ZodNullable<z.ZodEnum<{
222
+ nodeKind: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
223
+ unknown: "unknown";
222
224
  file: "file";
223
225
  folder: "folder";
224
226
  document: "document";
@@ -229,7 +231,7 @@ export declare const GoalReady: z.ZodObject<{
229
231
  goal: "goal";
230
232
  skill: "skill";
231
233
  source: "source";
232
- }>>;
234
+ }>>>;
233
235
  needs: z.ZodNullable<z.ZodEnum<{
234
236
  write: "write";
235
237
  read: "read";
@@ -300,7 +302,13 @@ export declare const GoalPlanStep: z.ZodObject<{
300
302
  how: z.ZodNullable<z.ZodString>;
301
303
  result: z.ZodNullable<z.ZodString>;
302
304
  done: z.ZodBoolean;
303
- taskId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
305
+ evidence: z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>;
306
+ agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
307
+ steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
308
+ title: z.ZodString;
309
+ result: z.ZodNullable<z.ZodString>;
310
+ done: z.ZodBoolean;
311
+ }, z.core.$strip>>>;
304
312
  }, z.core.$strip>;
305
313
  export type GoalPlanStep = z.infer<typeof GoalPlanStep>;
306
314
  export declare const GoalFollowUp: z.ZodObject<{
@@ -338,8 +346,17 @@ export declare const GoalSession: z.ZodObject<{
338
346
  costUsd: z.ZodNullable<z.ZodNumber>;
339
347
  }, z.core.$strip>;
340
348
  export type GoalSession = z.infer<typeof GoalSession>;
349
+ export declare const GoalProof: z.ZodObject<{
350
+ criterion: z.ZodString;
351
+ evidence: z.ZodString;
352
+ }, z.core.$strip>;
353
+ export type GoalProof = z.infer<typeof GoalProof>;
341
354
  export declare const GoalReport: z.ZodObject<{
342
355
  result: z.ZodString;
356
+ proof: z.ZodOptional<z.ZodArray<z.ZodObject<{
357
+ criterion: z.ZodString;
358
+ evidence: z.ZodString;
359
+ }, z.core.$strip>>>;
343
360
  changed: z.ZodNullable<z.ZodString>;
344
361
  open: z.ZodNullable<z.ZodString>;
345
362
  learned: z.ZodNullable<z.ZodString>;
@@ -495,7 +512,13 @@ export declare const GoalRunDetail: z.ZodObject<{
495
512
  how: z.ZodNullable<z.ZodString>;
496
513
  result: z.ZodNullable<z.ZodString>;
497
514
  done: z.ZodBoolean;
498
- taskId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
515
+ evidence: z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>;
516
+ agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
517
+ steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
518
+ title: z.ZodString;
519
+ result: z.ZodNullable<z.ZodString>;
520
+ done: z.ZodBoolean;
521
+ }, z.core.$strip>>>;
499
522
  }, z.core.$strip>>;
500
523
  state: z.ZodNullable<z.ZodString>;
501
524
  followUp: z.ZodNullable<z.ZodObject<{
@@ -533,6 +556,10 @@ export declare const GoalRunDetail: z.ZodObject<{
533
556
  }, z.core.$strip>>;
534
557
  report: z.ZodNullable<z.ZodObject<{
535
558
  result: z.ZodString;
559
+ proof: z.ZodOptional<z.ZodArray<z.ZodObject<{
560
+ criterion: z.ZodString;
561
+ evidence: z.ZodString;
562
+ }, z.core.$strip>>>;
536
563
  changed: z.ZodNullable<z.ZodString>;
537
564
  open: z.ZodNullable<z.ZodString>;
538
565
  learned: z.ZodNullable<z.ZodString>;
@@ -630,6 +657,7 @@ export declare const GoalRunDetail: z.ZodObject<{
630
657
  claude: "claude";
631
658
  codex: "codex";
632
659
  gemini: "gemini";
660
+ gateway: "gateway";
633
661
  }>>;
634
662
  }, z.core.$strip>>;
635
663
  appHandle: z.ZodNullable<z.ZodString>;
@@ -745,7 +773,8 @@ export declare const GoalDetail: z.ZodObject<{
745
773
  }>;
746
774
  nodeId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
747
775
  name: z.ZodNullable<z.ZodString>;
748
- nodeKind: z.ZodNullable<z.ZodEnum<{
776
+ nodeKind: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
777
+ unknown: "unknown";
749
778
  file: "file";
750
779
  folder: "folder";
751
780
  document: "document";
@@ -756,7 +785,7 @@ export declare const GoalDetail: z.ZodObject<{
756
785
  goal: "goal";
757
786
  skill: "skill";
758
787
  source: "source";
759
- }>>;
788
+ }>>>;
760
789
  needs: z.ZodNullable<z.ZodEnum<{
761
790
  write: "write";
762
791
  read: "read";
@@ -856,7 +885,13 @@ export declare const GoalDetail: z.ZodObject<{
856
885
  how: z.ZodNullable<z.ZodString>;
857
886
  result: z.ZodNullable<z.ZodString>;
858
887
  done: z.ZodBoolean;
859
- taskId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
888
+ evidence: z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>;
889
+ agent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
890
+ steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
891
+ title: z.ZodString;
892
+ result: z.ZodNullable<z.ZodString>;
893
+ done: z.ZodBoolean;
894
+ }, z.core.$strip>>>;
860
895
  }, z.core.$strip>>;
861
896
  state: z.ZodNullable<z.ZodString>;
862
897
  followUp: z.ZodNullable<z.ZodObject<{
@@ -894,6 +929,10 @@ export declare const GoalDetail: z.ZodObject<{
894
929
  }, z.core.$strip>>;
895
930
  report: z.ZodNullable<z.ZodObject<{
896
931
  result: z.ZodString;
932
+ proof: z.ZodOptional<z.ZodArray<z.ZodObject<{
933
+ criterion: z.ZodString;
934
+ evidence: z.ZodString;
935
+ }, z.core.$strip>>>;
897
936
  changed: z.ZodNullable<z.ZodString>;
898
937
  open: z.ZodNullable<z.ZodString>;
899
938
  learned: z.ZodNullable<z.ZodString>;
@@ -991,6 +1030,7 @@ export declare const GoalDetail: z.ZodObject<{
991
1030
  claude: "claude";
992
1031
  codex: "codex";
993
1032
  gemini: "gemini";
1033
+ gateway: "gateway";
994
1034
  }>>;
995
1035
  }, z.core.$strip>>;
996
1036
  appHandle: z.ZodNullable<z.ZodString>;
@@ -1095,7 +1135,7 @@ export declare const GoalRunUpdateInput: z.ZodObject<{
1095
1135
  how: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1096
1136
  result: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1097
1137
  done: z.ZodOptional<z.ZodBoolean>;
1098
- taskId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
1138
+ evidence: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
1099
1139
  }, z.core.$strict>>>;
1100
1140
  state: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1101
1141
  followUp: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -1121,6 +1161,10 @@ export declare const GoalRunCompleteInput: z.ZodObject<{
1121
1161
  participants: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1122
1162
  frame: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1123
1163
  }, z.core.$strict>;
1164
+ proof: z.ZodOptional<z.ZodArray<z.ZodObject<{
1165
+ criterion: z.ZodString;
1166
+ evidence: z.ZodString;
1167
+ }, z.core.$strict>>>;
1124
1168
  }, z.core.$strict>;
1125
1169
  export type GoalRunCompleteInput = z.infer<typeof GoalRunCompleteInput>;
1126
1170
  export declare const GoalRunCancelInput: z.ZodObject<{
@@ -3,8 +3,8 @@ import { idSchema } from "../ids/ids.js";
3
3
  import { Limit } from "../list-input.js";
4
4
  import { Message } from "../messages/messages.js";
5
5
  import { Missing } from "../missing/missing.js";
6
- import { CreateSection, NodeId, NodeKind, NodePath, NodePerson } from "../nodes/nodes.js";
7
- import { IdempotencyKey, Rev } from "../primitives/primitives.js";
6
+ import { CreateSection, NodeId, NodeKindRead, NodePath, NodePerson } from "../nodes/nodes.js";
7
+ import { IdempotencyKey, PlanSubstep, planEvidenceMax, Rev } from "../primitives/primitives.js";
8
8
  import { Schedule } from "../schedule/schedule.js";
9
9
  import { UserId } from "../users/users.js";
10
10
  // Goals (#813, Nodes › Ziel, E139): the inputs of `intelligence_goal_create|get|update` and
@@ -82,7 +82,7 @@ export const GoalCheck = z.object({
82
82
  nodeId: NodeId.nullable(),
83
83
  // The node's name and kind as the caller may read them; null where they may not, or it is gone.
84
84
  name: z.string().nullable(),
85
- nodeKind: NodeKind.nullable(),
85
+ nodeKind: NodeKindRead.nullable(),
86
86
  // The right the Operator needs on the node: write on a board, where it hands over work as cards,
87
87
  // read on everything else.
88
88
  needs: z.enum(["read", "write"]).nullable(),
@@ -125,8 +125,12 @@ export const GoalPlanStep = z.object({
125
125
  how: Paragraph.nullable(),
126
126
  result: Paragraph.nullable(),
127
127
  done: z.boolean(),
128
- // The card this step was handed over as, on a normal board; null when the Operator does it itself.
129
- taskId: NodeId.nullable(),
128
+ // What the step left (E219, #1037): any node, a document, a table, a card handed over, a file. A
129
+ // step stored before with a `taskId` shows that card here.
130
+ evidence: z.array(NodeId),
131
+ // The subagent of the Operator's run the step went to, and its plan beneath it (E220, #1038).
132
+ agent: z.string().nullable().optional(),
133
+ steps: z.array(PlanSubstep).optional(),
130
134
  });
131
135
  const GoalPlanStepInput = z.strictObject({
132
136
  title: Line.describe("The step in a few words."),
@@ -135,9 +139,11 @@ const GoalPlanStepInput = z.strictObject({
135
139
  .describe("How it is done, and by whom: yourself, or a card for someone else."),
136
140
  result: Paragraph.nullable().optional().describe("What the step left, once it is done."),
137
141
  done: z.boolean().optional().describe("Whether the step is done; leaving it out means not yet."),
138
- taskId: NodeId.nullable()
142
+ evidence: z
143
+ .array(NodeId)
144
+ .max(planEvidenceMax)
139
145
  .optional()
140
- .describe("The card the step was handed over as, on a normal board."),
146
+ .describe("What the step left: the nodes it made or used as proof (a document, a table, a card handed over, a file)."),
141
147
  });
142
148
  export const GoalFollowUp = z.object({
143
149
  at: z.iso.datetime(),
@@ -172,8 +178,13 @@ const reportParts = {
172
178
  .describe("Who worked on it, people and Operators."),
173
179
  frame: ReportText.nullable().optional().describe("Time and money spent against the frame."),
174
180
  };
181
+ // One criterion of the goal's "Fertig wenn" with its proof (E219, #1037): a link to a node or a
182
+ // value someone can check.
183
+ export const GoalProof = z.object({ criterion: z.string(), evidence: z.string() });
175
184
  export const GoalReport = z.object({
176
185
  result: z.string(),
186
+ // The proof per criterion of a run that was reached (E219); empty for a goal without "Fertig wenn".
187
+ proof: z.array(GoalProof).optional(),
177
188
  changed: z.string().nullable(),
178
189
  open: z.string().nullable(),
179
190
  learned: z.string().nullable(),
@@ -323,6 +334,24 @@ export const GoalRunCompleteInput = z.strictObject({
323
334
  .enum(["reached", "missed"])
324
335
  .describe("reached when every point of done-when holds, missed otherwise. Ignored for a run that is already over (Colab or a person ended it): then only the report is added."),
325
336
  report: z.strictObject(reportParts).describe("The report of the run, sent to Report to."),
337
+ proof: z
338
+ .array(z.strictObject({
339
+ criterion: z
340
+ .string()
341
+ .trim()
342
+ .min(1)
343
+ .max(500)
344
+ .describe("The criterion, as the goal words it."),
345
+ evidence: z
346
+ .string()
347
+ .trim()
348
+ .min(1)
349
+ .max(2000)
350
+ .describe("Its proof: a link to the node (`/n/node_…`) or a value someone can check."),
351
+ }))
352
+ .max(50)
353
+ .optional()
354
+ .describe("With reached: one entry per point of the goal's done-when (Fertig wenn), in its order. reached is refused while one has no proof; missed needs none."),
326
355
  });
327
356
  export const GoalRunCancelInput = z.strictObject({
328
357
  goalId: GoalId,
@@ -34,6 +34,7 @@ export declare const resources: {
34
34
  readonly credential: "credentials";
35
35
  readonly provider: "providers";
36
36
  readonly secret: "secrets";
37
+ readonly token: "tokens";
37
38
  readonly step: "steps";
38
39
  readonly crawl: "crawls";
39
40
  readonly mcp: "mcps";
@@ -41,6 +42,7 @@ export declare const resources: {
41
42
  readonly query: "queries";
42
43
  readonly item: "items";
43
44
  readonly organisation: "organisations";
45
+ readonly home: "homes";
44
46
  };
45
47
  export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
46
48
  export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel"];
@@ -63,6 +63,10 @@ export const resources = {
63
63
  // password, `_get` shows it to an admin in admin mode, `_remove` makes the node public again. One
64
64
  // per node, with an id of its own like every sub-resource (`secret_…`).
65
65
  secret: "secrets",
66
+ // A Git token of a code node's repository (E215, #976), a sub-resource of the skill, decided by
67
+ // the orchestrator (2026-11-04): `intelligence_skill_token_create` gives one for `git clone` or
68
+ // `git push`, with an expiry; never stored, never in a protocol.
69
+ token: "tokens",
66
70
  // One step of an Operator run as its CLI's output showed it (E112), a sub-resource of the run:
67
71
  // `operator_run_step_list`. Not `event`, the protocol's resource, and not `message`, a chat's.
68
72
  step: "steps",
@@ -81,6 +85,10 @@ export const resources = {
81
85
  // The company as a whole (#930, Organisation › System): its default time zone and language,
82
86
  // `access_organisation_get` and `_update`. One per installation, so its routes carry no id.
83
87
  organisation: "organisations",
88
+ // The start of an installation (#1020, E208, Seiten › Startfläche): `intelligence_home_get`, which
89
+ // gadget stands under `/`, the setup steps and Colab's news. One per installation like
90
+ // `organisation`, so its route carries no id. The word the orchestrator gave the start for #993.
91
+ home: "homes",
84
92
  };
85
93
  // The closed list of actions with a route of their own shape.
86
94
  export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
@@ -244,6 +252,8 @@ const routeExceptions = {
244
252
  // The one organisation of an installation (#930): there is no `organisationId` to name.
245
253
  access_organisation_get: { method: "GET", path: "/api/access/organisation" },
246
254
  access_organisation_update: { method: "PATCH", path: "/api/access/organisation" },
255
+ // The one start of an installation (#1020): there is no `homeId` to name either.
256
+ intelligence_home_get: { method: "GET", path: "/api/intelligence/home" },
247
257
  };
248
258
  // `access_user_invite` → `POST /api/access/users/:userId/invite`.
249
259
  export function toolRoute(name) {