@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.
Files changed (49) hide show
  1. package/dist/actions/actions.d.ts +34 -23
  2. package/dist/actions/actions.js +5 -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/error/error.d.ts +9 -3
  10. package/dist/error/error.js +12 -3
  11. package/dist/gadgets/gadgets.d.ts +147 -9
  12. package/dist/gadgets/gadgets.js +156 -0
  13. package/dist/goals/goals.d.ts +56 -10
  14. package/dist/goals/goals.js +36 -7
  15. package/dist/grammar/grammar.d.ts +2 -0
  16. package/dist/grammar/grammar.js +10 -0
  17. package/dist/home/home.d.ts +312 -0
  18. package/dist/home/home.js +53 -0
  19. package/dist/links/links.d.ts +166 -0
  20. package/dist/links/links.js +149 -0
  21. package/dist/mcps/mcps.d.ts +3 -3
  22. package/dist/messages/messages.d.ts +26 -0
  23. package/dist/messages/messages.js +33 -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 +737 -47
  27. package/dist/operators/operators.js +388 -71
  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 +12 -11
  36. package/dist/sdk.js +12 -11
  37. package/dist/skills/skills.d.ts +37 -7
  38. package/dist/skills/skills.js +50 -0
  39. package/dist/sources/sources.d.ts +82 -20
  40. package/dist/sources/sources.js +71 -12
  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
@@ -86,6 +86,9 @@ export declare const SourceManifest: z.ZodObject<{
86
86
  }>;
87
87
  base: z.ZodString;
88
88
  hosts: z.ZodArray<z.ZodString>;
89
+ limits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
90
+ perHour: z.ZodNumber;
91
+ }, z.core.$strict>>>;
89
92
  access: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
90
93
  kind: z.ZodLiteral<"bearer">;
91
94
  secret: z.ZodString;
@@ -164,6 +167,7 @@ export declare const sourceLimits: {
164
167
  readonly requests: 50;
165
168
  readonly items: 1000;
166
169
  };
170
+ export declare const sourceFormHeaders: readonly ["accept", "faces-request", "x-requested-with"];
167
171
  export declare const sourceKeepDays: readonly [30, 90, 180];
168
172
  export declare const sourceEvery: readonly ["hour", "day", "week"];
169
173
  export declare const SourceSchedule: z.ZodObject<{
@@ -188,11 +192,11 @@ export type SourceSchedule = z.infer<typeof SourceSchedule>;
188
192
  export declare const SourceWhere: z.ZodObject<{
189
193
  field: z.ZodString;
190
194
  op: z.ZodEnum<{
195
+ contains: "contains";
191
196
  eq: "eq";
192
197
  ne: "ne";
193
198
  gte: "gte";
194
199
  lte: "lte";
195
- contains: "contains";
196
200
  }>;
197
201
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
198
202
  }, z.core.$strict>;
@@ -205,6 +209,13 @@ export declare const SourceCreateInput: z.ZodObject<{
205
209
  }>>;
206
210
  name: z.ZodString;
207
211
  files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
212
+ from: z.ZodOptional<z.ZodObject<{
213
+ sourceId: z.ZodTemplateLiteral<`node_${string}`>;
214
+ as: z.ZodEnum<{
215
+ link: "link";
216
+ copy: "copy";
217
+ }>;
218
+ }, z.core.$strict>>;
208
219
  idempotencyKey: z.ZodString;
209
220
  }, z.core.$strict>;
210
221
  export type SourceCreateInput = z.infer<typeof SourceCreateInput>;
@@ -238,6 +249,7 @@ export declare const SourceUpdateInput: z.ZodObject<{
238
249
  }>>;
239
250
  keepDays: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<30>, z.ZodLiteral<90>, z.ZodLiteral<180>]>>;
240
251
  logDays: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<14>, z.ZodLiteral<30>]>>;
252
+ original: z.ZodOptional<z.ZodNull>;
241
253
  }, z.core.$strict>>;
242
254
  rev: z.ZodNumber;
243
255
  }, z.core.$strict>;
@@ -290,11 +302,11 @@ export declare const SourceQueryCreateInput: z.ZodObject<{
290
302
  where: z.ZodOptional<z.ZodArray<z.ZodObject<{
291
303
  field: z.ZodString;
292
304
  op: z.ZodEnum<{
305
+ contains: "contains";
293
306
  eq: "eq";
294
307
  ne: "ne";
295
308
  gte: "gte";
296
309
  lte: "lte";
297
- contains: "contains";
298
310
  }>;
299
311
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
300
312
  }, z.core.$strict>>>;
@@ -328,11 +340,11 @@ export declare const SourceQueryUpdateInput: z.ZodObject<{
328
340
  where: z.ZodOptional<z.ZodArray<z.ZodObject<{
329
341
  field: z.ZodString;
330
342
  op: z.ZodEnum<{
343
+ contains: "contains";
331
344
  eq: "eq";
332
345
  ne: "ne";
333
346
  gte: "gte";
334
347
  lte: "lte";
335
- contains: "contains";
336
348
  }>;
337
349
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
338
350
  }, z.core.$strict>>>;
@@ -372,6 +384,11 @@ export declare const SourceRunCreateInput: z.ZodObject<{
372
384
  queryId: z.ZodTemplateLiteral<`query_${string}`>;
373
385
  }, z.core.$strict>;
374
386
  export type SourceRunCreateInput = z.infer<typeof SourceRunCreateInput>;
387
+ export declare const SourceItemSort: z.ZodEnum<{
388
+ oldest: "oldest";
389
+ newest: "newest";
390
+ }>;
391
+ export type SourceItemSort = z.infer<typeof SourceItemSort>;
375
392
  export declare const SourceItemListInput: z.ZodObject<{
376
393
  sourceId: z.ZodTemplateLiteral<`node_${string}`>;
377
394
  queryId: z.ZodOptional<z.ZodTemplateLiteral<`query_${string}`>>;
@@ -380,14 +397,18 @@ export declare const SourceItemListInput: z.ZodObject<{
380
397
  where: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
381
398
  field: z.ZodString;
382
399
  op: z.ZodEnum<{
400
+ contains: "contains";
383
401
  eq: "eq";
384
402
  ne: "ne";
385
403
  gte: "gte";
386
404
  lte: "lte";
387
- contains: "contains";
388
405
  }>;
389
406
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
390
407
  }, z.core.$strict>>, unknown>>;
408
+ sort: z.ZodOptional<z.ZodEnum<{
409
+ oldest: "oldest";
410
+ newest: "newest";
411
+ }>>;
391
412
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
392
413
  }, z.core.$strict>;
393
414
  export type SourceItemListInput = z.infer<typeof SourceItemListInput>;
@@ -415,16 +436,34 @@ export declare const SourceRunFailure: z.ZodEnum<{
415
436
  provider: "provider";
416
437
  code: "code";
417
438
  host: "host";
439
+ throttled: "throttled";
418
440
  }>;
441
+ export declare const SourceRunFailureRead: z.ZodCatch<z.ZodEnum<{
442
+ unknown: "unknown";
443
+ access: "access";
444
+ provider: "provider";
445
+ code: "code";
446
+ host: "host";
447
+ throttled: "throttled";
448
+ }>>;
449
+ export declare const sourceRunTriggers: readonly ["schedule", "play", "probe"];
450
+ export declare const SourceRunTriggerRead: z.ZodCatch<z.ZodEnum<{
451
+ unknown: "unknown";
452
+ schedule: "schedule";
453
+ probe: "probe";
454
+ play: "play";
455
+ }>>;
419
456
  export declare const SourceRun: z.ZodObject<{
420
457
  runId: z.ZodTemplateLiteral<`run_${string}`>;
421
458
  sourceId: z.ZodTemplateLiteral<`node_${string}`>;
422
- queryId: z.ZodTemplateLiteral<`query_${string}`>;
459
+ queryId: z.ZodCatch<z.ZodNullable<z.ZodTemplateLiteral<`query_${string}`>>>;
423
460
  instance: z.ZodString;
424
- trigger: z.ZodEnum<{
461
+ trigger: z.ZodCatch<z.ZodEnum<{
462
+ unknown: "unknown";
425
463
  schedule: "schedule";
464
+ probe: "probe";
426
465
  play: "play";
427
- }>;
466
+ }>>;
428
467
  by: z.ZodNullable<z.ZodObject<{
429
468
  userId: z.ZodString;
430
469
  name: z.ZodNullable<z.ZodString>;
@@ -434,17 +473,21 @@ export declare const SourceRun: z.ZodObject<{
434
473
  }>>;
435
474
  }, z.core.$strip>>;
436
475
  version: z.ZodNullable<z.ZodNumber>;
476
+ draft: z.ZodBoolean;
477
+ items: z.ZodNullable<z.ZodNumber>;
437
478
  status: z.ZodEnum<{
438
479
  running: "running";
439
480
  succeeded: "succeeded";
440
481
  failed: "failed";
441
482
  }>;
442
- failure: z.ZodNullable<z.ZodEnum<{
483
+ failure: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
484
+ unknown: "unknown";
443
485
  access: "access";
444
486
  provider: "provider";
445
487
  code: "code";
446
488
  host: "host";
447
- }>>;
489
+ throttled: "throttled";
490
+ }>>>;
448
491
  message: z.ZodNullable<z.ZodString>;
449
492
  counts: z.ZodObject<{
450
493
  fetched: z.ZodNumber;
@@ -472,12 +515,14 @@ export declare const SourceRunList: z.ZodObject<{
472
515
  items: z.ZodArray<z.ZodObject<{
473
516
  runId: z.ZodTemplateLiteral<`run_${string}`>;
474
517
  sourceId: z.ZodTemplateLiteral<`node_${string}`>;
475
- queryId: z.ZodTemplateLiteral<`query_${string}`>;
518
+ queryId: z.ZodCatch<z.ZodNullable<z.ZodTemplateLiteral<`query_${string}`>>>;
476
519
  instance: z.ZodString;
477
- trigger: z.ZodEnum<{
520
+ trigger: z.ZodCatch<z.ZodEnum<{
521
+ unknown: "unknown";
478
522
  schedule: "schedule";
523
+ probe: "probe";
479
524
  play: "play";
480
- }>;
525
+ }>>;
481
526
  by: z.ZodNullable<z.ZodObject<{
482
527
  userId: z.ZodString;
483
528
  name: z.ZodNullable<z.ZodString>;
@@ -487,17 +532,21 @@ export declare const SourceRunList: z.ZodObject<{
487
532
  }>>;
488
533
  }, z.core.$strip>>;
489
534
  version: z.ZodNullable<z.ZodNumber>;
535
+ draft: z.ZodBoolean;
536
+ items: z.ZodNullable<z.ZodNumber>;
490
537
  status: z.ZodEnum<{
491
538
  running: "running";
492
539
  succeeded: "succeeded";
493
540
  failed: "failed";
494
541
  }>;
495
- failure: z.ZodNullable<z.ZodEnum<{
542
+ failure: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
543
+ unknown: "unknown";
496
544
  access: "access";
497
545
  provider: "provider";
498
546
  code: "code";
499
547
  host: "host";
500
- }>>;
548
+ throttled: "throttled";
549
+ }>>>;
501
550
  message: z.ZodNullable<z.ZodString>;
502
551
  counts: z.ZodObject<{
503
552
  fetched: z.ZodNumber;
@@ -549,11 +598,11 @@ export declare const SourceQuery: z.ZodObject<{
549
598
  where: z.ZodArray<z.ZodObject<{
550
599
  field: z.ZodString;
551
600
  op: z.ZodEnum<{
601
+ contains: "contains";
552
602
  eq: "eq";
553
603
  ne: "ne";
554
604
  gte: "gte";
555
605
  lte: "lte";
556
- contains: "contains";
557
606
  }>;
558
607
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
559
608
  }, z.core.$strict>>;
@@ -601,11 +650,11 @@ export declare const SourceQueryList: z.ZodObject<{
601
650
  where: z.ZodArray<z.ZodObject<{
602
651
  field: z.ZodString;
603
652
  op: z.ZodEnum<{
653
+ contains: "contains";
604
654
  eq: "eq";
605
655
  ne: "ne";
606
656
  gte: "gte";
607
657
  lte: "lte";
608
- contains: "contains";
609
658
  }>;
610
659
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
611
660
  }, z.core.$strict>>;
@@ -658,12 +707,14 @@ export declare const SourceProbe: z.ZodObject<{
658
707
  succeeded: "succeeded";
659
708
  failed: "failed";
660
709
  }>;
661
- failure: z.ZodNullable<z.ZodEnum<{
710
+ failure: z.ZodNullable<z.ZodCatch<z.ZodEnum<{
711
+ unknown: "unknown";
662
712
  access: "access";
663
713
  provider: "provider";
664
714
  code: "code";
665
715
  host: "host";
666
- }>>;
716
+ throttled: "throttled";
717
+ }>>>;
667
718
  message: z.ZodNullable<z.ZodString>;
668
719
  counts: z.ZodObject<{
669
720
  fetched: z.ZodNumber;
@@ -707,6 +758,9 @@ export declare const SourceDetail: z.ZodObject<{
707
758
  }>;
708
759
  base: z.ZodString;
709
760
  hosts: z.ZodArray<z.ZodString>;
761
+ limits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
762
+ perHour: z.ZodNumber;
763
+ }, z.core.$strict>>>;
710
764
  access: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
711
765
  kind: z.ZodLiteral<"bearer">;
712
766
  secret: z.ZodString;
@@ -870,11 +924,11 @@ export declare const SourceDetail: z.ZodObject<{
870
924
  name: z.ZodString;
871
925
  durationMs: z.ZodNumber;
872
926
  code: z.ZodNullable<z.ZodEnum<{
927
+ unavailable: "unavailable";
873
928
  not_found: "not_found";
874
929
  invalid: "invalid";
875
930
  conflict: "conflict";
876
931
  unauthenticated: "unauthenticated";
877
- unavailable: "unavailable";
878
932
  }>>;
879
933
  }, z.core.$strip>>>;
880
934
  }, z.core.$strip>>;
@@ -885,11 +939,11 @@ export declare const SourceDetail: z.ZodObject<{
885
939
  name: z.ZodString;
886
940
  durationMs: z.ZodNumber;
887
941
  code: z.ZodNullable<z.ZodEnum<{
942
+ unavailable: "unavailable";
888
943
  not_found: "not_found";
889
944
  invalid: "invalid";
890
945
  conflict: "conflict";
891
946
  unauthenticated: "unauthenticated";
892
- unavailable: "unavailable";
893
947
  }>>;
894
948
  }, z.core.$strip>>;
895
949
  }, z.core.$strip>>>;
@@ -929,6 +983,14 @@ export declare const SourceDetail: z.ZodObject<{
929
983
  }, z.core.$strip>>;
930
984
  }, z.core.$strip>>;
931
985
  pausedAt: z.ZodNullable<z.ZodISODateTime>;
986
+ link: z.ZodOptional<z.ZodNullable<z.ZodObject<{
987
+ originalId: z.ZodTemplateLiteral<`node_${string}`>;
988
+ name: z.ZodNullable<z.ZodString>;
989
+ }, z.core.$strip>>>;
990
+ links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
991
+ sourceId: z.ZodTemplateLiteral<`node_${string}`>;
992
+ name: z.ZodNullable<z.ZodString>;
993
+ }, z.core.$strip>>>>;
932
994
  rights: z.ZodObject<{
933
995
  write: z.ZodBoolean;
934
996
  }, z.core.$strip>;
@@ -90,6 +90,11 @@ export const SourceManifest = z.strictObject({
90
90
  base: z.string().min(1).max(500),
91
91
  // The only hosts a request reaches: host names, never an address.
92
92
  hosts: z.array(z.string().min(1).max(253)).min(1).max(10),
93
+ // At most `perHour` requests to a host of `hosts` in any 60 minutes, counted per installation
94
+ // across every run and query (E222), for a provider whose terms set a limit.
95
+ limits: z
96
+ .record(z.string().min(1).max(253), z.strictObject({ perHour: z.number().int().min(1).max(1000) }))
97
+ .optional(),
93
98
  access: SourceAccess.optional(),
94
99
  secrets: z
95
100
  .record(SecretName, z.strictObject({ label: z.string().min(1).max(100), help: z.string().max(500).optional() }))
@@ -114,10 +119,10 @@ export const sourceCodePath = "source.js";
114
119
  // A run's limits (Nodes › Quelle › Grenzen).
115
120
  export const sourceLimits = {
116
121
  timeoutMs: 10_000,
117
- // An answer read whole, by `api.json`, `api.text` and `api.post` of a `source.js`: as much as a
118
- // connector's bridge (`bridgeLimits.bytes`).
122
+ // An answer read whole, by `api.json`, `api.text`, `api.post` and `api.form` of a `source.js`: as
123
+ // much as a connector's bridge (`bridgeLimits.bytes`).
119
124
  bytes: 5 * 1024 * 1024,
120
- // An answer read in the stream, every page of kind json and rss and `api.each` (#936): only a brake
125
+ // An answer read in the stream, every page of kind json and rss, `api.each` and `api.chunks`: a brake
121
126
  // against an answer without end, because a run keeps the entries it needs and never the answer.
122
127
  streamBytes: 50 * 1024 * 1024,
123
128
  pages: 5,
@@ -125,6 +130,9 @@ export const sourceLimits = {
125
130
  requests: 50,
126
131
  items: 1000,
127
132
  };
133
+ // The only headers a `source.js` sets itself, on `api.form` (E222): what a portal's Ajax form asks
134
+ // for. Every other header is refused before anything is sent.
135
+ export const sourceFormHeaders = ["accept", "faces-request", "x-requested-with"];
128
136
  export const sourceKeepDays = [30, 90, 180];
129
137
  const KeepDays = z
130
138
  .union([z.literal(30), z.literal(90), z.literal(180)])
@@ -181,6 +189,15 @@ export const SourceCreateInput = z.strictObject({
181
189
  .record(GadgetFilePath, FileContent)
182
190
  .optional()
183
191
  .describe("The first files by path: source.json, source.js (only for kind code), tests/*.test.js, tests/fixtures/*, icon.svg. They become the draft. Leaving it out creates an empty source."),
192
+ from: z
193
+ .strictObject({
194
+ sourceId: NodeId.describe("The source to duplicate."),
195
+ as: z
196
+ .enum(["copy", "link"])
197
+ .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 queries, key, runs, items and settings; for whoever may read an original that is live."),
198
+ })
199
+ .optional()
200
+ .describe("Duplicate a source instead of giving files (E221)."),
184
201
  idempotencyKey: IdempotencyKey,
185
202
  });
186
203
  export const SourceVersionRef = z.preprocess((value) => (typeof value === "string" && /^[1-9][0-9]{0,8}$/.test(value) ? Number(value) : value), z.union([z.enum(["live", "draft"]), z.number().int().min(1)]));
@@ -214,6 +231,10 @@ export const SourceUpdateInput = z.strictObject({
214
231
  level: GadgetLevel.optional(),
215
232
  keepDays: KeepDays.optional(),
216
233
  logDays: LogDays.optional(),
234
+ original: z
235
+ .null()
236
+ .optional()
237
+ .describe("Only at a link: null turns it into a copy with its own code and history (In Kopie umwandeln)."),
217
238
  })
218
239
  .optional()
219
240
  .describe("The settings; they apply at once, not through the draft."),
@@ -231,7 +252,7 @@ export const SourceTestInput = z.strictObject({
231
252
  params: ParamValues.optional(),
232
253
  })
233
254
  .optional()
234
- .describe("A probe instead of the tests: fetch from the provider for real with that state and answer the items, without storing anything."),
255
+ .describe("A probe instead of the tests: fetch from the provider for real with that state and answer the items without storing them; the probe stands among the source's runs (trigger probe) for its days."),
235
256
  });
236
257
  export const SourcePublishInput = z.strictObject({
237
258
  sourceId: SourceId,
@@ -291,6 +312,9 @@ const WhereList = z.preprocess((value) => {
291
312
  return [value];
292
313
  }
293
314
  }, z.array(SourceWhere).max(10));
315
+ // The order of the items (#922): `oldest` first is the feed a consumer follows, `newest` first is
316
+ // the view of whoever looks; each has a cursor of its own.
317
+ export const SourceItemSort = z.enum(["oldest", "newest"]);
294
318
  export const SourceItemListInput = z.strictObject({
295
319
  sourceId: SourceId,
296
320
  queryId: QueryId.optional().describe("Only the items of this query."),
@@ -304,6 +328,7 @@ export const SourceItemListInput = z.strictObject({
304
328
  .optional()
305
329
  .describe("The nextCursor of an earlier page; it also works after the last page, for what came since."),
306
330
  where: WhereList.optional().describe("Only items whose fields match every condition."),
331
+ sort: SourceItemSort.optional().describe("The order: oldest (the default) first, with a cursor that only grows and also works after the last page for what came since; or newest first, the latest found on the first page, with a cursor of its own that goes on towards older ones."),
307
332
  limit: Limit.optional(),
308
333
  });
309
334
  // ---- Answers ----
@@ -323,20 +348,40 @@ export const SourceRunCounts = z.object({
323
348
  });
324
349
  // Why a run failed: `host` a request to a host the source does not name (sent nowhere), `access`
325
350
  // the provider refused the key (401, 403), `provider` it failed otherwise, `code` the source's code
326
- // or manifest broke.
327
- export const SourceRunFailure = z.enum(["host", "access", "provider", "code"]);
351
+ // or manifest broke, `throttled` a host's budget of `limits` was used for this hour (E222), sent
352
+ // nowhere and the source not paused.
353
+ export const SourceRunFailure = z.enum(["host", "access", "provider", "code", "throttled"]);
354
+ // ⚠️ Read tolerantly in answers, like `trigger`: a failure an older tab does not know reads as
355
+ // `unknown` instead of failing the whole list on every poll (E222 added `throttled`).
356
+ export const SourceRunFailureRead = z
357
+ .enum([...SourceRunFailure.options, "unknown"])
358
+ .catch("unknown");
359
+ // How a run started. ⚠️ Read tolerantly (like `NodeKindRead`, #784): a value an older tab does not
360
+ // know reads as `unknown` instead of failing the whole list on every poll (review of PR #1003).
361
+ export const sourceRunTriggers = ["schedule", "play", "probe"];
362
+ export const SourceRunTriggerRead = z
363
+ .enum([...sourceRunTriggers, "unknown"])
364
+ .catch("unknown");
328
365
  export const SourceRun = z.object({
329
366
  runId: RunId,
330
367
  sourceId: SourceId,
331
- queryId: QueryId,
332
- // The workflow instance, `src-<source>-<query>-<time>`: one run per query and moment.
368
+ // Null for a probe with params of its own (#915). ⚠️ Read tolerantly, like `trigger`: an id this
369
+ // reader does not take reads as null instead of failing the list (review of PR #1003).
370
+ queryId: QueryId.nullable().catch(null),
371
+ // The workflow instance, `src-<source>-<query>-<time>`: one run per query and moment; a probe
372
+ // has none and carries `probe-<runId>`.
333
373
  instance: z.string(),
334
- // schedule, a person or machine by hand, or a probe against the draft.
335
- trigger: z.enum(["schedule", "play"]),
374
+ // schedule, a person or machine by hand (play), or a probe, which keeps no items (#915).
375
+ trigger: SourceRunTriggerRead,
336
376
  by: NodePerson.nullable(),
377
+ // The version it ran with; null for a probe of the draft.
337
378
  version: z.number().int().nullable(),
379
+ // A probe of the draft, not of a published version.
380
+ draft: z.boolean(),
381
+ // How many items a probe found and kept nowhere; null for every other run.
382
+ items: z.number().int().nullable(),
338
383
  status: z.enum(["running", "succeeded", "failed"]),
339
- failure: SourceRunFailure.nullable(),
384
+ failure: SourceRunFailureRead.nullable(),
340
385
  message: z.string().nullable(),
341
386
  counts: SourceRunCounts,
342
387
  steps: z.array(SourceStep),
@@ -392,7 +437,7 @@ export const SourceItemList = z.object({
392
437
  // The items of a probe or a test, never stored.
393
438
  export const SourceProbe = z.object({
394
439
  status: z.enum(["succeeded", "failed"]),
395
- failure: SourceRunFailure.nullable(),
440
+ failure: SourceRunFailureRead.nullable(),
396
441
  message: z.string().nullable(),
397
442
  counts: SourceRunCounts,
398
443
  items: z.array(z.object({ ref: z.string(), fields: SourceItem.shape.fields })),
@@ -437,6 +482,20 @@ export const SourceDetail = z.object({
437
482
  })
438
483
  .nullable(),
439
484
  pausedAt: z.iso.datetime().nullable(),
485
+ // A link (E221): its original, whose live version runs here. Null for an original and a copy.
486
+ link: z
487
+ .object({
488
+ originalId: NodeId,
489
+ // Null where the caller cannot read the original.
490
+ name: z.string().nullable(),
491
+ })
492
+ .nullable()
493
+ .optional(),
494
+ // An original's links (E221), only for whoever may change it: they run its live version.
495
+ links: z
496
+ .array(z.object({ sourceId: NodeId, name: z.string().nullable() }))
497
+ .nullable()
498
+ .optional(),
440
499
  rights: z.object({ write: z.boolean() }),
441
500
  rev: z.number().int(),
442
501
  archivedAt: z.iso.datetime().nullable(),
@@ -33,6 +33,8 @@ export declare const TableColumnChange: z.ZodObject<{
33
33
  from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
34
  }, z.core.$strict>;
35
35
  export type TableColumnChange = z.infer<typeof TableColumnChange>;
36
+ export declare const maxTableColumns = 100;
37
+ export declare const maxTableRows = 100000;
36
38
  export declare const TableCreateInput: z.ZodObject<{
37
39
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
38
40
  section: z.ZodOptional<z.ZodEnum<{
@@ -56,8 +58,34 @@ export declare const TableCreateInput: z.ZodObject<{
56
58
  }, z.core.$strict>;
57
59
  export type TableCreateInput = z.infer<typeof TableCreateInput>;
58
60
  export declare const tableFormats: readonly ["rows", "csv"];
61
+ export declare const TableSort: z.ZodObject<{
62
+ column: z.ZodString;
63
+ direction: z.ZodEnum<{
64
+ asc: "asc";
65
+ desc: "desc";
66
+ }>;
67
+ }, z.core.$strict>;
68
+ export type TableSort = z.infer<typeof TableSort>;
69
+ export declare const TableFilter: z.ZodObject<{
70
+ column: z.ZodString;
71
+ contains: z.ZodString;
72
+ }, z.core.$strict>;
73
+ export type TableFilter = z.infer<typeof TableFilter>;
74
+ export declare const RowLimit: z.ZodCoercedNumber<unknown>;
59
75
  export declare const TableGetInput: z.ZodObject<{
60
76
  tableId: z.ZodTemplateLiteral<`node_${string}`>;
77
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
78
+ sort: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
79
+ column: z.ZodString;
80
+ direction: z.ZodEnum<{
81
+ asc: "asc";
82
+ desc: "desc";
83
+ }>;
84
+ }, z.core.$strict>>, unknown>>;
85
+ filter: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
86
+ column: z.ZodString;
87
+ contains: z.ZodString;
88
+ }, z.core.$strict>>, unknown>>;
61
89
  format: z.ZodOptional<z.ZodEnum<{
62
90
  rows: "rows";
63
91
  csv: "csv";
@@ -114,6 +142,13 @@ export declare const TableDetail: z.ZodObject<{
114
142
  }, z.core.$strict>>;
115
143
  rows: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
116
144
  csv: z.ZodOptional<z.ZodString>;
145
+ positions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
146
+ page: z.ZodOptional<z.ZodObject<{
147
+ offset: z.ZodNumber;
148
+ matched: z.ZodNumber;
149
+ rowCount: z.ZodNumber;
150
+ nextCursor: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$strip>>;
117
152
  version: z.ZodNumber;
118
153
  rev: z.ZodNumber;
119
154
  rights: z.ZodObject<{
@@ -139,6 +174,13 @@ export declare const TableExcerpt: z.ZodObject<{
139
174
  }, z.core.$strict>>;
140
175
  rows: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
141
176
  csv: z.ZodOptional<z.ZodString>;
177
+ positions: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
178
+ page: z.ZodOptional<z.ZodObject<{
179
+ offset: z.ZodNumber;
180
+ matched: z.ZodNumber;
181
+ rowCount: z.ZodNumber;
182
+ nextCursor: z.ZodNullable<z.ZodString>;
183
+ }, z.core.$strip>>;
142
184
  version: z.ZodNumber;
143
185
  rights: z.ZodObject<{
144
186
  write: z.ZodBoolean;
@@ -30,7 +30,11 @@ export const TableColumnChange = TableColumn.extend({
30
30
  .optional()
31
31
  .describe("The current column whose cells fill this one, by its current name: how a column is renamed. Null makes it a new empty column. Left out, a current column of the same name fills it, else it starts empty."),
32
32
  });
33
- const Columns = z.array(TableColumn).min(1).max(64);
33
+ // At most 100 columns (E191, #980).
34
+ export const maxTableColumns = 100;
35
+ // At most 100,000 data rows (E191, #980).
36
+ export const maxTableRows = 100_000;
37
+ const Columns = z.array(TableColumn).min(1).max(maxTableColumns);
34
38
  const Cells = z
35
39
  .array(z.string())
36
40
  .describe("One row: its cells as text, as many as the table has columns, in the order of the columns. A chip cell holds several values separated by commas.");
@@ -61,8 +65,44 @@ export const TableCreateInput = z.strictObject({
61
65
  idempotencyKey: IdempotencyKey,
62
66
  });
63
67
  export const tableFormats = ["rows", "csv"];
68
+ // Over REST a query string carries text: a list comes as its JSON (`?sort=[{…}]`).
69
+ const fromJson = (value, ctx) => {
70
+ if (typeof value !== "string")
71
+ return value;
72
+ try {
73
+ return JSON.parse(value);
74
+ }
75
+ catch {
76
+ ctx.addIssue({ code: "custom", message: "Over REST send this list as JSON." });
77
+ return z.NEVER;
78
+ }
79
+ };
80
+ export const TableSort = z.strictObject({
81
+ column: ColumnName.describe("The column to sort by, by its name (letter case ignored)."),
82
+ direction: z
83
+ .enum(["asc", "desc"])
84
+ .describe("asc from small to large (A to Z, 1 to 9), desc the other way. Empty cells come last either way; a number column sorts by value."),
85
+ });
86
+ export const TableFilter = z.strictObject({
87
+ column: ColumnName.describe("The column to filter by, by its name (letter case ignored)."),
88
+ contains: z
89
+ .string()
90
+ .max(200)
91
+ .describe("Only rows whose cell in this column contains this text, letter case ignored."),
92
+ });
93
+ // A page of rows (#980): up to 1,000 at a time.
94
+ export const RowLimit = z.coerce.number().int().min(1).max(1000);
64
95
  export const TableGetInput = z.strictObject({
65
96
  tableId: TableId,
97
+ limit: RowLimit.optional().describe("Read a range of at most this many rows (1 to 1,000) instead of the whole table: page says which rows came and its nextCursor, sent back as cursor, brings the next range. With sort or filter the range is taken in that order and selection; positions names each row's position in the table."),
98
+ sort: z
99
+ .preprocess(fromJson, z.array(TableSort).min(1).max(3))
100
+ .optional()
101
+ .describe("Read the rows in this order, the first entry first, on the server and over all rows; the table itself keeps its order. Over REST as JSON."),
102
+ filter: z
103
+ .preprocess(fromJson, z.array(TableFilter).min(1).max(10))
104
+ .optional()
105
+ .describe("Read only the rows whose cells contain these texts, every entry at once, on the server and over all rows. Over REST as JSON."),
66
106
  format: z
67
107
  .enum(tableFormats)
68
108
  .optional()
@@ -93,7 +133,7 @@ export const TableUpdateInput = z.strictObject({
93
133
  columns: z
94
134
  .array(TableColumnChange)
95
135
  .min(1)
96
- .max(64)
136
+ .max(maxTableColumns)
97
137
  .optional()
98
138
  .describe("The whole new column list in its new order: names, types, new columns and, by leaving them out, removed ones. A removed column's cells stay only in the table's history; the answer names the rows that had content in it. With csv, it is the header the csv must match instead."),
99
139
  csv: Csv.optional().describe("Replace the whole table: CSV whose header line holds exactly the column names, the current ones or those sent in columns alongside."),
@@ -131,6 +171,19 @@ export const TableDetail = z.object({
131
171
  rows: z.array(z.array(z.string())).optional(),
132
172
  // The whole table as CSV, header first; only when `format` is csv.
133
173
  csv: z.string().optional(),
174
+ // The position of each row in `rows` within the table (1 for the first data row), when the rows
175
+ // come sorted, filtered or as a page (#980).
176
+ positions: z.array(z.number().int()).optional(),
177
+ // A page of rows (`limit`, #980): the rows before it in the order read, how many rows the filter
178
+ // lets through (all without one), how many the table holds, and the cursor of the next page.
179
+ page: z
180
+ .object({
181
+ offset: z.number().int(),
182
+ matched: z.number().int(),
183
+ rowCount: z.number().int(),
184
+ nextCursor: z.string().nullable(),
185
+ })
186
+ .optional(),
134
187
  // The current version's number, as people read it ("Version 6").
135
188
  version: z.number().int(),
136
189
  // The state the next save sends (E70).
package/dist/tool.d.ts CHANGED
@@ -16,6 +16,7 @@ export type ToolSource = "api" | "mcp";
16
16
  export type ToolContext = {
17
17
  actor: Actor;
18
18
  source?: ToolSource;
19
+ viewer?: string | null;
19
20
  };
20
21
  export type ToolAnnotations = Partial<ActionAnnotations> & {
21
22
  openWorldHint?: boolean;
@@ -1,4 +1,4 @@
1
- import type { NodeKind } from "../nodes/nodes.js";
1
+ import type { NodeKindRead } from "../nodes/nodes.js";
2
2
  export declare const treeKindOrder: readonly ["folder", "document", "table", "board", "gadget", "source", "file", "skill", "goal"];
3
- export declare function treeKindRank(kind: NodeKind): number;
3
+ export declare function treeKindRank(kind: NodeKindRead): number;
4
4
  export declare function compareTreeNames(a: string, b: string): number;
@@ -14,7 +14,7 @@ export const treeKindOrder = [
14
14
  ];
15
15
  // As in German, whatever the language of the UI: case and accents do not count, "2" before "10".
16
16
  const collator = new Intl.Collator("de", { sensitivity: "base", numeric: true });
17
- // A kind outside the list (a task) goes after all of them.
17
+ // A kind outside the list (a task, one this release does not know) goes after all of them.
18
18
  export function treeKindRank(kind) {
19
19
  const rank = treeKindOrder.indexOf(kind);
20
20
  return rank === -1 ? treeKindOrder.length : rank;
@@ -21,6 +21,7 @@ export declare const OperatorProvider: z.ZodEnum<{
21
21
  claude: "claude";
22
22
  codex: "codex";
23
23
  gemini: "gemini";
24
+ gateway: "gateway";
24
25
  }>;
25
26
  export type OperatorProvider = z.infer<typeof OperatorProvider>;
26
27
  export declare const MessageMachine: z.ZodObject<{
@@ -32,6 +33,7 @@ export declare const MessageMachine: z.ZodObject<{
32
33
  claude: "claude";
33
34
  codex: "codex";
34
35
  gemini: "gemini";
36
+ gateway: "gateway";
35
37
  }>>;
36
38
  }, z.core.$strip>;
37
39
  export type MessageMachine = z.infer<typeof MessageMachine>;