@anchrd/colab-sdk 0.1.17 → 0.1.19

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.
@@ -58,6 +58,7 @@ export declare const TableGetInput: z.ZodObject<{
58
58
  rows: "rows";
59
59
  csv: "csv";
60
60
  }>>;
61
+ cursor: z.ZodOptional<z.ZodString>;
61
62
  }, z.core.$strict>;
62
63
  export type TableGetInput = z.infer<typeof TableGetInput>;
63
64
  export declare const TableUpdateInput: z.ZodObject<{
@@ -117,6 +118,37 @@ export declare const TableDetail: z.ZodObject<{
117
118
  updatedAt: z.ZodISODateTime;
118
119
  }, z.core.$strip>;
119
120
  export type TableDetail = z.infer<typeof TableDetail>;
121
+ export declare const TableExcerpt: z.ZodObject<{
122
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
123
+ locked: z.ZodOptional<z.ZodBoolean>;
124
+ tableId: z.ZodTemplateLiteral<`node_${string}`>;
125
+ name: z.ZodString;
126
+ columns: z.ZodArray<z.ZodObject<{
127
+ name: z.ZodString;
128
+ type: z.ZodEnum<{
129
+ number: "number";
130
+ date: "date";
131
+ email: "email";
132
+ text: "text";
133
+ chip: "chip";
134
+ }>;
135
+ }, z.core.$strict>>;
136
+ rows: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
137
+ csv: z.ZodOptional<z.ZodString>;
138
+ version: z.ZodNumber;
139
+ rights: z.ZodObject<{
140
+ write: z.ZodBoolean;
141
+ }, z.core.$strip>;
142
+ updatedAt: z.ZodISODateTime;
143
+ excerpt: z.ZodObject<{
144
+ firstRow: z.ZodNumber;
145
+ lastRow: z.ZodNumber;
146
+ rowCount: z.ZodNumber;
147
+ nextCursor: z.ZodNullable<z.ZodString>;
148
+ }, z.core.$strip>;
149
+ rev: z.ZodOptional<z.ZodNumber>;
150
+ }, z.core.$strip>;
151
+ export type TableExcerpt = z.infer<typeof TableExcerpt>;
120
152
  export declare const TableSaved: z.ZodObject<{
121
153
  tableId: z.ZodTemplateLiteral<`node_${string}`>;
122
154
  name: z.ZodString;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { ExcerptCursor, RowsExcerpt } from "../excerpt/excerpt.js";
2
3
  import { NodeId, SecretFields } from "../nodes/nodes.js";
3
4
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
4
5
  // Tables (#40, Nodes › Tabelle, E39, E59, E70): the inputs of `intelligence_table_create`, `_get`
@@ -36,7 +37,7 @@ const Cells = z
36
37
  const Rows = z.array(Cells).max(10_000);
37
38
  const Csv = z
38
39
  .string()
39
- .describe("The whole table as CSV: the header line with the column names first, then one line per row, as intelligence_table_get with format csv answers it. At most 1 MB in UTF-8.");
40
+ .describe("The whole table as CSV: the header line with the column names first, then one line per row, as intelligence_table_get with format csv answers it; a table read in excerpts is every excerpt joined, read until nextCursor is null. At most 1 MB in UTF-8.");
40
41
  // Counted from 1 at the first data row; the header line is no row.
41
42
  const Position = z
42
43
  .number()
@@ -65,6 +66,7 @@ export const TableGetInput = z.strictObject({
65
66
  .enum(tableFormats)
66
67
  .optional()
67
68
  .describe("rows (the default) answers the rows as lists of cells; csv answers the whole table as CSV text instead, the header line first."),
69
+ cursor: ExcerptCursor.optional(),
68
70
  });
69
71
  // One cell of a `set` entry (#630, E120): the new text and the text that was read. The cell is
70
72
  // checked on its own, so a change elsewhere in the table is no conflict.
@@ -138,6 +140,15 @@ export const TableDetail = z.object({
138
140
  // caller.
139
141
  ...SecretFields,
140
142
  });
143
+ // One excerpt of a large table over MCP (E127, #674): whole rows, `rows` or `csv` some of them (the
144
+ // CSV's header line in the first excerpt only), `excerpt` which they are and the cursor of the next.
145
+ // ⚠️ `rev` comes with the last excerpt only: `csv` and `replace` replace by the state a `rev` names,
146
+ // and a `rev` beside a part of the table would let a save of that part drop the rest without a
147
+ // conflict. `set` and `append` need no `rev`.
148
+ export const TableExcerpt = TableDetail.extend({
149
+ excerpt: RowsExcerpt,
150
+ rev: z.number().int().optional(),
151
+ });
141
152
  // The answer of a create and an update: the state after it, without the rows, so appending one row
142
153
  // to a large table does not send the table back.
143
154
  export const TableSaved = z.object({
package/dist/tool.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { z } from "zod";
2
+ import type { ErrorResponse } from "./error/error.js";
2
3
  import type { ActionAnnotations, Package } from "./grammar/grammar.js";
4
+ import type { Written } from "./written/written.js";
3
5
  export type ToolInput = z.ZodObject<z.core.$ZodShape, z.core.$strict>;
4
6
  export type Permission = `${Package} / ${string} / ${string}`;
5
7
  export type Actor = {
@@ -26,5 +28,6 @@ export type Tool<Input extends ToolInput = ToolInput> = {
26
28
  browserOnly?: true;
27
29
  annotations?: ToolAnnotations;
28
30
  handler(input: z.output<Input>, context: ToolContext): Promise<unknown>;
31
+ written?(input: z.output<Input>, context: ToolContext): Promise<Written | ErrorResponse>;
29
32
  };
30
33
  export declare function defineTool<Input extends ToolInput>(tool: Tool<Input>): Tool;
@@ -107,6 +107,7 @@ export type NodeVersionListInput = z.infer<typeof NodeVersionListInput>;
107
107
  export declare const NodeVersionGetInput: z.ZodObject<{
108
108
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
109
109
  versionId: z.ZodTemplateLiteral<`version_${string}`>;
110
+ cursor: z.ZodOptional<z.ZodString>;
110
111
  }, z.core.$strict>;
111
112
  export type NodeVersionGetInput = z.infer<typeof NodeVersionGetInput>;
112
113
  export declare const NodeVersionCreateInput: z.ZodObject<{
@@ -330,3 +331,104 @@ export declare const NodeVersionDetail: z.ZodObject<{
330
331
  rev: z.ZodNumber;
331
332
  }, z.core.$strip>;
332
333
  export type NodeVersionDetail = z.infer<typeof NodeVersionDetail>;
334
+ export declare const NodeVersionExcerpt: z.ZodObject<{
335
+ versionId: z.ZodTemplateLiteral<`version_${string}`>;
336
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
337
+ number: z.ZodNumber;
338
+ createdAt: z.ZodISODateTime;
339
+ updatedAt: z.ZodISODateTime;
340
+ createdBy: z.ZodObject<{
341
+ userId: z.ZodString;
342
+ name: z.ZodNullable<z.ZodString>;
343
+ kind: z.ZodNullable<z.ZodEnum<{
344
+ machine: "machine";
345
+ human: "human";
346
+ }>>;
347
+ }, z.core.$strip>;
348
+ appHandle: z.ZodNullable<z.ZodString>;
349
+ restoredFrom: z.ZodNullable<z.ZodNumber>;
350
+ current: z.ZodBoolean;
351
+ size: z.ZodNumber;
352
+ move: z.ZodNullable<z.ZodObject<{
353
+ from: z.ZodNullable<z.ZodObject<{
354
+ columnId: z.ZodTemplateLiteral<`column_${string}`>;
355
+ name: z.ZodNullable<z.ZodString>;
356
+ type: z.ZodNullable<z.ZodEnum<{
357
+ backlog: "backlog";
358
+ open: "open";
359
+ progress: "progress";
360
+ done: "done";
361
+ discarded: "discarded";
362
+ blocked: "blocked";
363
+ archive: "archive";
364
+ }>>;
365
+ }, z.core.$strip>>;
366
+ to: z.ZodObject<{
367
+ columnId: z.ZodTemplateLiteral<`column_${string}`>;
368
+ name: z.ZodNullable<z.ZodString>;
369
+ type: z.ZodNullable<z.ZodEnum<{
370
+ backlog: "backlog";
371
+ open: "open";
372
+ progress: "progress";
373
+ done: "done";
374
+ discarded: "discarded";
375
+ blocked: "blocked";
376
+ archive: "archive";
377
+ }>>;
378
+ }, z.core.$strip>;
379
+ comment: z.ZodNullable<z.ZodString>;
380
+ }, z.core.$strip>>;
381
+ changes: z.ZodNullable<z.ZodArray<z.ZodEnum<{
382
+ fields: "fields";
383
+ title: "title";
384
+ text: "text";
385
+ dates: "dates";
386
+ assignee: "assignee";
387
+ labels: "labels";
388
+ parent: "parent";
389
+ dependencies: "dependencies";
390
+ waiting: "waiting";
391
+ }>>>;
392
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
393
+ locked: z.ZodOptional<z.ZodBoolean>;
394
+ content: z.ZodNullable<z.ZodString>;
395
+ mediaType: z.ZodNullable<z.ZodString>;
396
+ columns: z.ZodNullable<z.ZodArray<z.ZodObject<{
397
+ name: z.ZodString;
398
+ type: z.ZodEnum<{
399
+ number: "number";
400
+ date: "date";
401
+ email: "email";
402
+ text: "text";
403
+ chip: "chip";
404
+ }>;
405
+ }, z.core.$strict>>>;
406
+ fields: z.ZodNullable<z.ZodArray<z.ZodObject<{
407
+ name: z.ZodString;
408
+ type: z.ZodEnum<{
409
+ number: "number";
410
+ date: "date";
411
+ list: "list";
412
+ link: "link";
413
+ text: "text";
414
+ checklist: "checklist";
415
+ select: "select";
416
+ }>;
417
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodObject<{
418
+ text: z.ZodString;
419
+ done: z.ZodBoolean;
420
+ }, z.core.$strip>>]>;
421
+ }, z.core.$strip>>>;
422
+ excerpt: z.ZodUnion<readonly [z.ZodObject<{
423
+ offset: z.ZodNumber;
424
+ length: z.ZodNumber;
425
+ nextCursor: z.ZodNullable<z.ZodString>;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ firstRow: z.ZodNumber;
428
+ lastRow: z.ZodNumber;
429
+ rowCount: z.ZodNumber;
430
+ nextCursor: z.ZodNullable<z.ZodString>;
431
+ }, z.core.$strip>]>;
432
+ rev: z.ZodOptional<z.ZodNumber>;
433
+ }, z.core.$strip>;
434
+ export type NodeVersionExcerpt = z.infer<typeof NodeVersionExcerpt>;
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { CardFieldType, CardFieldValue } from "../card-kinds/card-kinds.js";
3
3
  import { ColumnId, ColumnType } from "../columns/columns.js";
4
+ import { ExcerptCursor, RowsExcerpt, TextExcerpt } from "../excerpt/excerpt.js";
4
5
  import { idSchema } from "../ids/ids.js";
5
6
  import { Limit as PageSize } from "../list-input.js";
6
7
  import { NodeId, NodePerson, SecretFields } from "../nodes/nodes.js";
@@ -61,6 +62,7 @@ export const NodeVersionListInput = z.strictObject({
61
62
  export const NodeVersionGetInput = z.strictObject({
62
63
  nodeId: NodeId.describe("The document, table, file or task the version belongs to."),
63
64
  versionId: VersionId.describe("The version to read, from intelligence_node_version_list. A version of another node answers not_found."),
65
+ cursor: ExcerptCursor.optional(),
64
66
  });
65
67
  export const NodeVersionCreateInput = z.strictObject({
66
68
  nodeId: NodeId.describe("The document, table, file or task to restore an earlier state of."),
@@ -99,6 +101,7 @@ export const NodeVersionList = z.object({
99
101
  });
100
102
  export const NodeVersionDetail = NodeVersion.extend({
101
103
  // The text of a document or a task (Markdown) or a table; null for a file, whose bytes come with #41.
104
+ // Over MCP a text above `excerptChars` comes in excerpts (E127, #762): see `NodeVersionExcerpt`.
102
105
  content: z.string().nullable(),
103
106
  // Only for a file: its media type.
104
107
  mediaType: z.string().nullable(),
@@ -115,3 +118,14 @@ export const NodeVersionDetail = NodeVersion.extend({
115
118
  // this caller.
116
119
  ...SecretFields,
117
120
  });
121
+ // One excerpt of a version over MCP whose content is above `excerptChars` (E127, #762), cut like the
122
+ // read of its kind (#674): a table's CSV in whole rows (`RowsExcerpt`, the header line in the first
123
+ // excerpt), every other text by characters (`TextExcerpt`). ⚠️ `rev` comes with the last excerpt
124
+ // only: it is the node's `rev`, which `_document_update`, `_table_update` with `csv` and
125
+ // `_task_update` take beside a whole new text, and beside a part of an old version it would let a
126
+ // save of that part cut the rest away without a conflict. A restore takes the `rev` of
127
+ // `intelligence_node_version_list`.
128
+ export const NodeVersionExcerpt = NodeVersionDetail.extend({
129
+ excerpt: z.union([TextExcerpt, RowsExcerpt]),
130
+ rev: z.number().int().optional(),
131
+ });
@@ -0,0 +1,206 @@
1
+ import { z } from "zod";
2
+ export declare const Changed: z.ZodObject<{
3
+ nodeId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
4
+ documentId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
5
+ tableId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
6
+ fileId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
7
+ boardId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
8
+ taskId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
9
+ gadgetId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
10
+ runId: z.ZodOptional<z.ZodTemplateLiteral<`run_${string}`>>;
11
+ messageId: z.ZodOptional<z.ZodTemplateLiteral<`message_${string}`>>;
12
+ chatId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
13
+ grantId: z.ZodOptional<z.ZodTemplateLiteral<`grant_${string}`>>;
14
+ linkId: z.ZodOptional<z.ZodTemplateLiteral<`link_${string}`>>;
15
+ userId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
16
+ machineId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
17
+ roleId: z.ZodOptional<z.ZodTemplateLiteral<`role_${string}`>>;
18
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ invitationId: z.ZodOptional<z.ZodTemplateLiteral<`invitation_${string}`>>;
20
+ serviceId: z.ZodOptional<z.ZodTemplateLiteral<`service_${string}`>>;
21
+ interfaceId: z.ZodOptional<z.ZodTemplateLiteral<`interface_${string}`>>;
22
+ functionId: z.ZodOptional<z.ZodTemplateLiteral<`function_${string}`>>;
23
+ appId: z.ZodOptional<z.ZodTemplateLiteral<`app_${string}`>>;
24
+ sessionId: z.ZodOptional<z.ZodTemplateLiteral<`session_${string}`>>;
25
+ ssoId: z.ZodOptional<z.ZodEnum<{
26
+ google: "google";
27
+ microsoft: "microsoft";
28
+ }>>;
29
+ connectorId: z.ZodOptional<z.ZodString>;
30
+ connectionId: z.ZodOptional<z.ZodTemplateLiteral<`connection_${string}`>>;
31
+ credentialId: z.ZodOptional<z.ZodTemplateLiteral<`credential_${string}`>>;
32
+ ref: z.ZodOptional<z.ZodString>;
33
+ rev: z.ZodOptional<z.ZodNumber>;
34
+ version: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$strip>;
36
+ export type Changed = z.infer<typeof Changed>;
37
+ export declare const Unblocked: z.ZodObject<{
38
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
39
+ title: z.ZodString;
40
+ assignee: z.ZodObject<{
41
+ userId: z.ZodString;
42
+ name: z.ZodString;
43
+ }, z.core.$strip>;
44
+ rev: z.ZodNumber;
45
+ own: z.ZodOptional<z.ZodLiteral<true>>;
46
+ }, z.core.$strip>;
47
+ export type Unblocked = z.infer<typeof Unblocked>;
48
+ export declare const Effects: z.ZodObject<{
49
+ woken: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ userId: z.ZodString;
51
+ name: z.ZodString;
52
+ }, z.core.$strip>>>;
53
+ notified: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
+ userId: z.ZodString;
55
+ name: z.ZodString;
56
+ }, z.core.$strip>>>;
57
+ unblocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
59
+ title: z.ZodString;
60
+ assignee: z.ZodObject<{
61
+ userId: z.ZodString;
62
+ name: z.ZodString;
63
+ }, z.core.$strip>;
64
+ rev: z.ZodNumber;
65
+ own: z.ZodOptional<z.ZodLiteral<true>>;
66
+ }, z.core.$strip>>>;
67
+ validationReset: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
68
+ readers: z.ZodOptional<z.ZodArray<z.ZodObject<{
69
+ userId: z.ZodString;
70
+ name: z.ZodNullable<z.ZodString>;
71
+ kind: z.ZodNullable<z.ZodEnum<{
72
+ machine: "machine";
73
+ human: "human";
74
+ }>>;
75
+ right: z.ZodEnum<{
76
+ share: "share";
77
+ write: "write";
78
+ read: "read";
79
+ }>;
80
+ origin: z.ZodEnum<{
81
+ creator: "creator";
82
+ direct: "direct";
83
+ inherited: "inherited";
84
+ }>;
85
+ fromNodeId: z.ZodTemplateLiteral<`node_${string}`>;
86
+ }, z.core.$strip>>>;
87
+ }, z.core.$strip>;
88
+ export type Effects = z.infer<typeof Effects>;
89
+ export declare const Written: z.ZodObject<{
90
+ changed: z.ZodArray<z.ZodObject<{
91
+ nodeId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
92
+ documentId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
93
+ tableId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
94
+ fileId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
95
+ boardId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
96
+ taskId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
97
+ gadgetId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
98
+ runId: z.ZodOptional<z.ZodTemplateLiteral<`run_${string}`>>;
99
+ messageId: z.ZodOptional<z.ZodTemplateLiteral<`message_${string}`>>;
100
+ chatId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
101
+ grantId: z.ZodOptional<z.ZodTemplateLiteral<`grant_${string}`>>;
102
+ linkId: z.ZodOptional<z.ZodTemplateLiteral<`link_${string}`>>;
103
+ userId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
104
+ machineId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
105
+ roleId: z.ZodOptional<z.ZodTemplateLiteral<`role_${string}`>>;
106
+ permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ invitationId: z.ZodOptional<z.ZodTemplateLiteral<`invitation_${string}`>>;
108
+ serviceId: z.ZodOptional<z.ZodTemplateLiteral<`service_${string}`>>;
109
+ interfaceId: z.ZodOptional<z.ZodTemplateLiteral<`interface_${string}`>>;
110
+ functionId: z.ZodOptional<z.ZodTemplateLiteral<`function_${string}`>>;
111
+ appId: z.ZodOptional<z.ZodTemplateLiteral<`app_${string}`>>;
112
+ sessionId: z.ZodOptional<z.ZodTemplateLiteral<`session_${string}`>>;
113
+ ssoId: z.ZodOptional<z.ZodEnum<{
114
+ google: "google";
115
+ microsoft: "microsoft";
116
+ }>>;
117
+ connectorId: z.ZodOptional<z.ZodString>;
118
+ connectionId: z.ZodOptional<z.ZodTemplateLiteral<`connection_${string}`>>;
119
+ credentialId: z.ZodOptional<z.ZodTemplateLiteral<`credential_${string}`>>;
120
+ ref: z.ZodOptional<z.ZodString>;
121
+ rev: z.ZodOptional<z.ZodNumber>;
122
+ version: z.ZodOptional<z.ZodNumber>;
123
+ }, z.core.$strip>>;
124
+ effects: z.ZodOptional<z.ZodObject<{
125
+ woken: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
+ userId: z.ZodString;
127
+ name: z.ZodString;
128
+ }, z.core.$strip>>>;
129
+ notified: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
+ userId: z.ZodString;
131
+ name: z.ZodString;
132
+ }, z.core.$strip>>>;
133
+ unblocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
134
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
135
+ title: z.ZodString;
136
+ assignee: z.ZodObject<{
137
+ userId: z.ZodString;
138
+ name: z.ZodString;
139
+ }, z.core.$strip>;
140
+ rev: z.ZodNumber;
141
+ own: z.ZodOptional<z.ZodLiteral<true>>;
142
+ }, z.core.$strip>>>;
143
+ validationReset: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
144
+ readers: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ userId: z.ZodString;
146
+ name: z.ZodNullable<z.ZodString>;
147
+ kind: z.ZodNullable<z.ZodEnum<{
148
+ machine: "machine";
149
+ human: "human";
150
+ }>>;
151
+ right: z.ZodEnum<{
152
+ share: "share";
153
+ write: "write";
154
+ read: "read";
155
+ }>;
156
+ origin: z.ZodEnum<{
157
+ creator: "creator";
158
+ direct: "direct";
159
+ inherited: "inherited";
160
+ }>;
161
+ fromNodeId: z.ZodTemplateLiteral<`node_${string}`>;
162
+ }, z.core.$strip>>>;
163
+ }, z.core.$strip>>;
164
+ missing: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
+ code: z.ZodEnum<{
166
+ test_failed: "test_failed";
167
+ no_role: "no_role";
168
+ no_folder: "no_folder";
169
+ credential_invalid: "credential_invalid";
170
+ incomplete: "incomplete";
171
+ no_right: "no_right";
172
+ no_kind: "no_kind";
173
+ no_assignee: "no_assignee";
174
+ no_machine: "no_machine";
175
+ }>;
176
+ machineId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
177
+ credentialId: z.ZodOptional<z.ZodTemplateLiteral<`credential_${string}`>>;
178
+ connectorId: z.ZodOptional<z.ZodString>;
179
+ connectionId: z.ZodOptional<z.ZodTemplateLiteral<`connection_${string}`>>;
180
+ taskId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
181
+ documentId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
182
+ userId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
183
+ nodeId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
184
+ message: z.ZodString;
185
+ right: z.ZodOptional<z.ZodString>;
186
+ givenBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
187
+ userId: z.ZodString;
188
+ name: z.ZodString;
189
+ }, z.core.$strip>>>;
190
+ call: z.ZodOptional<z.ZodObject<{
191
+ tool: z.ZodString;
192
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
193
+ }, z.core.$strip>>;
194
+ }, z.core.$strip>>>;
195
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
196
+ code: z.ZodEnum<{
197
+ followup_failed: "followup_failed";
198
+ test_failed: "test_failed";
199
+ mail_failed: "mail_failed";
200
+ unused: "unused";
201
+ too_long: "too_long";
202
+ }>;
203
+ message: z.ZodString;
204
+ }, z.core.$strip>>>;
205
+ }, z.core.$strip>;
206
+ export type Written = z.infer<typeof Written>;
@@ -0,0 +1,90 @@
1
+ import { z } from "zod";
2
+ import { AppId, SessionId } from "../apps/apps.js";
3
+ import { ConnectionId } from "../connections/connections.js";
4
+ import { ConnectorId } from "../connectors/connectors.js";
5
+ import { Warning } from "../error/error.js";
6
+ import { GrantId } from "../grants/grants.js";
7
+ import { InvitationId } from "../invitations/invitations.js";
8
+ import { LinkId } from "../links/links.js";
9
+ import { MachineId } from "../machines/machines.js";
10
+ import { MessageId } from "../messages/messages.js";
11
+ import { Missing, Reached } from "../missing/missing.js";
12
+ import { NodeId, NodeReader } from "../nodes/nodes.js";
13
+ import { CredentialId } from "../operators/operators.js";
14
+ import { RoleId } from "../roles/roles.js";
15
+ import { RunId } from "../runs/runs.js";
16
+ import { FunctionId, InterfaceId, ServiceId } from "../services/services.js";
17
+ import { SsoId } from "../sso/sso.js";
18
+ import { UserId } from "../users/users.js";
19
+ // What a write answers over `/mcp` (E126, #672): what it changed and what that caused, never the
20
+ // object it wrote. The AI sent the object itself; echoing it back filled an Operator's context with
21
+ // every card and document it saved (#617). `/api` keeps the whole object for the UI.
22
+ // One thing a write changed: its id under its resource's name, and where the resource has them the
23
+ // `rev` for the next save (E70) and the version number. A folder, and a node of any kind where the
24
+ // tool is about nodes, is `nodeId`.
25
+ export const Changed = z.object({
26
+ nodeId: NodeId.optional(),
27
+ documentId: NodeId.optional(),
28
+ tableId: NodeId.optional(),
29
+ fileId: NodeId.optional(),
30
+ boardId: NodeId.optional(),
31
+ taskId: NodeId.optional(),
32
+ gadgetId: NodeId.optional(),
33
+ runId: RunId.optional(),
34
+ messageId: MessageId.optional(),
35
+ // A chat is its node's (#45).
36
+ chatId: NodeId.optional(),
37
+ grantId: GrantId.optional(),
38
+ linkId: LinkId.optional(),
39
+ // A person or machine in `access`, and the caller's own settings in `intelligence`.
40
+ userId: UserId.optional(),
41
+ // The other packages (#743). A machine is `machineId` in `access` and an Operator in `operator`,
42
+ // its `user_…` id either way.
43
+ machineId: MachineId.optional(),
44
+ roleId: RoleId.optional(),
45
+ // The rights a switch of a role really turned on or off, which a level in the call expands to.
46
+ permissions: z.array(z.string()).optional(),
47
+ invitationId: InvitationId.optional(),
48
+ serviceId: ServiceId.optional(),
49
+ interfaceId: InterfaceId.optional(),
50
+ functionId: FunctionId.optional(),
51
+ appId: AppId.optional(),
52
+ sessionId: SessionId.optional(),
53
+ ssoId: SsoId.optional(),
54
+ connectorId: ConnectorId.optional(),
55
+ connectionId: ConnectionId.optional(),
56
+ credentialId: CredentialId.optional(),
57
+ // The caller's own name for an entry of a create of many (#625).
58
+ ref: z.string().optional(),
59
+ rev: z.number().int().optional(),
60
+ version: z.number().int().optional(),
61
+ });
62
+ // A task that waited only on what this call closed, and now waits on nothing (Nodes › Aufgabe):
63
+ // whoever closed a task moves the next one to Open (E124). `own` marks the caller's: with its `rev`
64
+ // the caller writes it at once, without reading it first.
65
+ export const Unblocked = z.object({
66
+ taskId: NodeId,
67
+ title: z.string(),
68
+ assignee: Reached,
69
+ rev: z.number().int(),
70
+ own: z.literal(true).optional(),
71
+ });
72
+ // What the write caused for others; an empty field is left out.
73
+ export const Effects = z.object({
74
+ // Machines whose Actions changed by it (#334, E124): an Operator among them wakes.
75
+ woken: z.array(Reached).optional(),
76
+ // People it put something in front of in their Actions, by mail as their setting says (#50).
77
+ notified: z.array(Reached).optional(),
78
+ // Tasks ready now, because the last thing they waited on was closed by this call.
79
+ unblocked: z.array(Unblocked).optional(),
80
+ // Nodes whose validation went back to new (#47): their new version is unchecked.
81
+ validationReset: z.array(NodeId).optional(),
82
+ // Who reads a moved node now (#36): a move takes the grants of its new folder.
83
+ readers: z.array(NodeReader).optional(),
84
+ });
85
+ export const Written = z.object({
86
+ changed: z.array(Changed),
87
+ effects: Effects.optional(),
88
+ missing: z.array(Missing).optional(),
89
+ warnings: z.array(Warning).optional(),
90
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/colab-sdk",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Types, Zod schemas and the service client of Colab, the contract between its UI, backends and outside services.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",