@anchrd/colab-sdk 0.1.43 → 0.1.44

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.
@@ -300,6 +300,8 @@ export declare const ActionNoticeTitle: z.ZodDiscriminatedUnion<[z.ZodObject<{
300
300
  }>;
301
301
  }, z.core.$strip>, z.ZodObject<{
302
302
  text: z.ZodLiteral<"runUnfinished">;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ text: z.ZodLiteral<"ownCredential">;
303
305
  }, z.core.$strip>], "text">;
304
306
  export type ActionNoticeTitle = z.infer<typeof ActionNoticeTitle>;
305
307
  export declare const ActionNoticeCrumb: z.ZodUnion<readonly [z.ZodObject<{
@@ -334,6 +336,15 @@ export declare const ActionNoticeReason: z.ZodObject<{
334
336
  spentUsd: z.ZodNumber;
335
337
  limitUsd: z.ZodNumber;
336
338
  until: z.ZodISODateTime;
339
+ }, z.core.$strip>, z.ZodObject<{
340
+ text: z.ZodLiteral<"ownDown">;
341
+ state: z.ZodEnum<{
342
+ limit: "limit";
343
+ invalid: "invalid";
344
+ }>;
345
+ since: z.ZodISODateTime;
346
+ until: z.ZodNullable<z.ZodISODateTime>;
347
+ paused: z.ZodArray<z.ZodString>;
337
348
  }, z.core.$strip>, z.ZodObject<{
338
349
  text: z.ZodLiteral<"lastFailure">;
339
350
  at: z.ZodNullable<z.ZodISODateTime>;
@@ -421,6 +432,8 @@ export declare const ActionNotice: z.ZodObject<{
421
432
  }>;
422
433
  }, z.core.$strip>, z.ZodObject<{
423
434
  text: z.ZodLiteral<"runUnfinished">;
435
+ }, z.core.$strip>, z.ZodObject<{
436
+ text: z.ZodLiteral<"ownCredential">;
424
437
  }, z.core.$strip>], "text">;
425
438
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
426
439
  word: z.ZodEnum<{
@@ -453,6 +466,15 @@ export declare const ActionNotice: z.ZodObject<{
453
466
  spentUsd: z.ZodNumber;
454
467
  limitUsd: z.ZodNumber;
455
468
  until: z.ZodISODateTime;
469
+ }, z.core.$strip>, z.ZodObject<{
470
+ text: z.ZodLiteral<"ownDown">;
471
+ state: z.ZodEnum<{
472
+ limit: "limit";
473
+ invalid: "invalid";
474
+ }>;
475
+ since: z.ZodISODateTime;
476
+ until: z.ZodNullable<z.ZodISODateTime>;
477
+ paused: z.ZodArray<z.ZodString>;
456
478
  }, z.core.$strip>, z.ZodObject<{
457
479
  text: z.ZodLiteral<"lastFailure">;
458
480
  at: z.ZodNullable<z.ZodISODateTime>;
@@ -541,6 +563,8 @@ export declare const ActionNoticeItem: z.ZodObject<{
541
563
  }>;
542
564
  }, z.core.$strip>, z.ZodObject<{
543
565
  text: z.ZodLiteral<"runUnfinished">;
566
+ }, z.core.$strip>, z.ZodObject<{
567
+ text: z.ZodLiteral<"ownCredential">;
544
568
  }, z.core.$strip>], "text">;
545
569
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
546
570
  word: z.ZodEnum<{
@@ -573,6 +597,15 @@ export declare const ActionNoticeItem: z.ZodObject<{
573
597
  spentUsd: z.ZodNumber;
574
598
  limitUsd: z.ZodNumber;
575
599
  until: z.ZodISODateTime;
600
+ }, z.core.$strip>, z.ZodObject<{
601
+ text: z.ZodLiteral<"ownDown">;
602
+ state: z.ZodEnum<{
603
+ limit: "limit";
604
+ invalid: "invalid";
605
+ }>;
606
+ since: z.ZodISODateTime;
607
+ until: z.ZodNullable<z.ZodISODateTime>;
608
+ paused: z.ZodArray<z.ZodString>;
576
609
  }, z.core.$strip>, z.ZodObject<{
577
610
  text: z.ZodLiteral<"lastFailure">;
578
611
  at: z.ZodNullable<z.ZodISODateTime>;
@@ -795,6 +828,8 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
795
828
  }>;
796
829
  }, z.core.$strip>, z.ZodObject<{
797
830
  text: z.ZodLiteral<"runUnfinished">;
831
+ }, z.core.$strip>, z.ZodObject<{
832
+ text: z.ZodLiteral<"ownCredential">;
798
833
  }, z.core.$strip>], "text">;
799
834
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
800
835
  word: z.ZodEnum<{
@@ -827,6 +862,15 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
827
862
  spentUsd: z.ZodNumber;
828
863
  limitUsd: z.ZodNumber;
829
864
  until: z.ZodISODateTime;
865
+ }, z.core.$strip>, z.ZodObject<{
866
+ text: z.ZodLiteral<"ownDown">;
867
+ state: z.ZodEnum<{
868
+ limit: "limit";
869
+ invalid: "invalid";
870
+ }>;
871
+ since: z.ZodISODateTime;
872
+ until: z.ZodNullable<z.ZodISODateTime>;
873
+ paused: z.ZodArray<z.ZodString>;
830
874
  }, z.core.$strip>, z.ZodObject<{
831
875
  text: z.ZodLiteral<"lastFailure">;
832
876
  at: z.ZodNullable<z.ZodISODateTime>;
@@ -1067,6 +1111,8 @@ export declare const ActionList: z.ZodObject<{
1067
1111
  }>;
1068
1112
  }, z.core.$strip>, z.ZodObject<{
1069
1113
  text: z.ZodLiteral<"runUnfinished">;
1114
+ }, z.core.$strip>, z.ZodObject<{
1115
+ text: z.ZodLiteral<"ownCredential">;
1070
1116
  }, z.core.$strip>], "text">;
1071
1117
  path: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1072
1118
  word: z.ZodEnum<{
@@ -1099,6 +1145,15 @@ export declare const ActionList: z.ZodObject<{
1099
1145
  spentUsd: z.ZodNumber;
1100
1146
  limitUsd: z.ZodNumber;
1101
1147
  until: z.ZodISODateTime;
1148
+ }, z.core.$strip>, z.ZodObject<{
1149
+ text: z.ZodLiteral<"ownDown">;
1150
+ state: z.ZodEnum<{
1151
+ limit: "limit";
1152
+ invalid: "invalid";
1153
+ }>;
1154
+ since: z.ZodISODateTime;
1155
+ until: z.ZodNullable<z.ZodISODateTime>;
1156
+ paused: z.ZodArray<z.ZodString>;
1102
1157
  }, z.core.$strip>, z.ZodObject<{
1103
1158
  text: z.ZodLiteral<"lastFailure">;
1104
1159
  at: z.ZodNullable<z.ZodISODateTime>;
@@ -164,6 +164,9 @@ export const ActionNoticeTitle = z.discriminatedUnion("text", [
164
164
  z.object({ text: z.literal("runAborted"), reason: ActionAbortReason }),
165
165
  // "Run not finished" (E231, #1097): it completed with open work.
166
166
  z.object({ text: z.literal("runUnfinished") }),
167
+ // "Your own access does not carry" (E240, #1114): the person's own token is refused or at its
168
+ // limit and no company credential marked personal takes over.
169
+ z.object({ text: z.literal("ownCredential") }),
167
170
  ]);
168
171
  // One step of the grey path below the title: a word the UI translates, or a name shown as it is.
169
172
  export const ActionNoticeCrumb = z.union([
@@ -195,6 +198,14 @@ export const ActionNoticeReason = z.object({
195
198
  limitUsd: z.number().nonnegative(),
196
199
  until: z.iso.datetime(),
197
200
  }),
201
+ // "Refused since <since>" or "At its limit until <until>", then "<paused> are paused." (E240)
202
+ z.object({
203
+ text: z.literal("ownDown"),
204
+ state: z.enum(["invalid", "limit"]),
205
+ since: z.iso.datetime(),
206
+ until: z.iso.datetime().nullable(),
207
+ paused: z.array(z.string()),
208
+ }),
198
209
  // "Last at <at>: <detail>", the last failed run; null without one.
199
210
  z.object({
200
211
  text: z.literal("lastFailure"),
@@ -279,6 +279,7 @@ export declare const BoardTaskListInput: z.ZodObject<{
279
279
  known: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodString>, unknown>>;
280
280
  }, z.core.$strict>;
281
281
  export type BoardTaskListInput = z.infer<typeof BoardTaskListInput>;
282
+ export declare const maxRules = 5;
282
283
  export declare const BoardTaskCreateInput: z.ZodObject<{
283
284
  title: z.ZodOptional<z.ZodString>;
284
285
  tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -293,6 +294,12 @@ export declare const BoardTaskCreateInput: z.ZodObject<{
293
294
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
294
295
  parentTaskId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
295
296
  dependsOn: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
297
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
298
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
299
+ from: z.ZodTemplateLiteral<`column_${string}`>;
300
+ when: z.ZodTemplateLiteral<`column_${string}`>;
301
+ to: z.ZodTemplateLiteral<`column_${string}`>;
302
+ }, z.core.$strict>>>;
296
303
  position: z.ZodOptional<z.ZodString>;
297
304
  kind: z.ZodOptional<z.ZodString>;
298
305
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -307,6 +314,12 @@ export declare const BoardTaskCreateInput: z.ZodObject<{
307
314
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
308
315
  parentTaskId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
309
316
  dependsOn: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
317
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
318
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
319
+ from: z.ZodTemplateLiteral<`column_${string}`>;
320
+ when: z.ZodTemplateLiteral<`column_${string}`>;
321
+ to: z.ZodTemplateLiteral<`column_${string}`>;
322
+ }, z.core.$strict>>>;
310
323
  position: z.ZodOptional<z.ZodString>;
311
324
  kind: z.ZodOptional<z.ZodString>;
312
325
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -338,6 +351,12 @@ export declare const TaskUpdateInput: z.ZodObject<{
338
351
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
339
352
  parentTaskId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
340
353
  dependsOn: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
354
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
355
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
356
+ from: z.ZodTemplateLiteral<`column_${string}`>;
357
+ when: z.ZodTemplateLiteral<`column_${string}`>;
358
+ to: z.ZodTemplateLiteral<`column_${string}`>;
359
+ }, z.core.$strict>>>;
341
360
  position: z.ZodOptional<z.ZodString>;
342
361
  kind: z.ZodOptional<z.ZodString>;
343
362
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -360,6 +379,12 @@ export declare const BoardTaskUpdateInput: z.ZodObject<{
360
379
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
361
380
  parentTaskId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
362
381
  dependsOn: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>>;
382
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
383
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
384
+ from: z.ZodTemplateLiteral<`column_${string}`>;
385
+ when: z.ZodTemplateLiteral<`column_${string}`>;
386
+ to: z.ZodTemplateLiteral<`column_${string}`>;
387
+ }, z.core.$strict>>>;
363
388
  position: z.ZodOptional<z.ZodString>;
364
389
  kind: z.ZodOptional<z.ZodString>;
365
390
  fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -640,6 +665,14 @@ export declare const BoardTaskBriefList: z.ZodObject<{
640
665
  }, z.core.$strip>>;
641
666
  }, z.core.$strip>;
642
667
  export type BoardTaskBriefList = z.infer<typeof BoardTaskBriefList>;
668
+ export declare const TaskRule: z.ZodObject<{
669
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
670
+ from: z.ZodTemplateLiteral<`column_${string}`>;
671
+ when: z.ZodTemplateLiteral<`column_${string}`>;
672
+ to: z.ZodTemplateLiteral<`column_${string}`>;
673
+ valid: z.ZodBoolean;
674
+ }, z.core.$strip>;
675
+ export type TaskRule = z.infer<typeof TaskRule>;
643
676
  export declare const TaskDetail: z.ZodObject<{
644
677
  taskId: z.ZodTemplateLiteral<`node_${string}`>;
645
678
  boardId: z.ZodTemplateLiteral<`node_${string}`>;
@@ -780,6 +813,13 @@ export declare const TaskDetail: z.ZodObject<{
780
813
  }>;
781
814
  }, z.core.$strip>>;
782
815
  }, z.core.$strip>>;
816
+ rules: z.ZodArray<z.ZodObject<{
817
+ taskId: z.ZodTemplateLiteral<`node_${string}`>;
818
+ from: z.ZodTemplateLiteral<`column_${string}`>;
819
+ when: z.ZodTemplateLiteral<`column_${string}`>;
820
+ to: z.ZodTemplateLiteral<`column_${string}`>;
821
+ valid: z.ZodBoolean;
822
+ }, z.core.$strip>>;
783
823
  ready: z.ZodBoolean;
784
824
  images: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
785
825
  kind: z.ZodLiteral<"url">;
@@ -149,6 +149,19 @@ const DependsOn = z
149
149
  .array(TaskId)
150
150
  .max(100)
151
151
  .describe("The tasks of the same board this one waits for. It is ready once each of them is in a column of type done or discarded.");
152
+ // The rule on "waits for" (E242, #1132): when the card waited for moves into one column, Colab moves
153
+ // this card from one column into another. Every line names the board's columns by id.
154
+ export const maxRules = 5;
155
+ const RuleInput = z.strictObject({
156
+ taskId: TaskId.describe("The card this one waits for, one of its dependsOn: the line watches it. Every line names the same card."),
157
+ from: ColumnId.describe("The column this card must lie in for the line to act; lying elsewhere, nothing moves."),
158
+ when: ColumnId.describe("The column the card waited for moves into."),
159
+ to: ColumnId.describe("The column Colab then moves this card into."),
160
+ });
161
+ const Rules = z
162
+ .array(RuleInput)
163
+ .max(maxRules)
164
+ .describe("The rule on waits for, all its lines (at most 5): each says 'lying in from, when the card waited for moves into when, Colab moves this card to to'. Lines only for ONE card of dependsOn, never the archive column, never two lines with the same from and when. Without a rule nothing moves. Moved into an open column, its assignee wakes. Example, a release: lying in Backlog, when Review moves to Done, to Open; and when Review moves to Discarded, to Open. An empty list removes the rule; leaving it out keeps it.");
152
165
  const Position = z
153
166
  .string()
154
167
  .min(1)
@@ -166,6 +179,7 @@ const newTask = {
166
179
  labels: Labels.optional(),
167
180
  parentTaskId: TaskId.optional().describe("Make it a subtask of this task of the same board; it is still a card of its own."),
168
181
  dependsOn: DependsOn.optional(),
182
+ rules: Rules.optional(),
169
183
  position: Position.optional(),
170
184
  kind: TaskKindInput.optional(),
171
185
  fields: TaskFieldsInput.optional(),
@@ -221,6 +235,7 @@ export const TaskUpdateInput = z.strictObject({
221
235
  .optional()
222
236
  .describe("Hang the task under this task of the same board; null makes it a task of its own again."),
223
237
  dependsOn: DependsOn.optional(),
238
+ rules: Rules.optional(),
224
239
  position: Position.optional(),
225
240
  kind: TaskKindInput.optional().describe("Only to confirm: a card never changes its kind, so any other kind than its own is invalid."),
226
241
  fields: TaskFieldsInput.optional(),
@@ -315,6 +330,15 @@ const TaskRef = z.object({
315
330
  column: TaskColumn,
316
331
  kind: TaskKind.nullable(),
317
332
  });
333
+ // A line of the rule as a card answers it (E242): `valid` false when one of its columns is gone from
334
+ // the board; such a line does not act.
335
+ export const TaskRule = z.object({
336
+ taskId: NodeId,
337
+ from: ColumnId,
338
+ when: ColumnId,
339
+ to: ColumnId,
340
+ valid: z.boolean(),
341
+ });
318
342
  export const TaskDetail = z.object({
319
343
  taskId: NodeId,
320
344
  boardId: NodeId,
@@ -342,6 +366,8 @@ export const TaskDetail = z.object({
342
366
  total: z.number().int(),
343
367
  }),
344
368
  dependencies: z.array(TaskRef),
369
+ // The rule on waits for (E242), its lines in order; empty without one.
370
+ rules: z.array(TaskRule),
345
371
  ready: z.boolean(),
346
372
  images: z.array(TaskImage),
347
373
  // The card's kind and the values of its fields by name (#638, E115); null and {} on a board
@@ -8,6 +8,9 @@ export declare function fileFormatOf(name: string): FileFormat | null;
8
8
  export declare const uploadTicketHeader = "x-colab-upload-ticket";
9
9
  export declare const uploadTicketLifetimeMs: number;
10
10
  export declare const SourceUrl: z.ZodString;
11
+ export declare const maxContentFileBytes: number;
12
+ export declare const fileEncodings: readonly ["utf8", "base64"];
13
+ export type FileEncoding = (typeof fileEncodings)[number];
11
14
  export declare const FileCreateInput: z.ZodObject<{
12
15
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
13
16
  section: z.ZodOptional<z.ZodEnum<{
@@ -17,6 +20,11 @@ export declare const FileCreateInput: z.ZodObject<{
17
20
  name: z.ZodOptional<z.ZodString>;
18
21
  mediaType: z.ZodOptional<z.ZodString>;
19
22
  size: z.ZodOptional<z.ZodNumber>;
23
+ content: z.ZodOptional<z.ZodString>;
24
+ encoding: z.ZodOptional<z.ZodEnum<{
25
+ base64: "base64";
26
+ utf8: "utf8";
27
+ }>>;
20
28
  sourceUrl: z.ZodOptional<z.ZodString>;
21
29
  idempotencyKey: z.ZodString;
22
30
  }, z.core.$strict>;
@@ -25,7 +33,12 @@ export declare const FileUpdateInput: z.ZodObject<{
25
33
  fileId: z.ZodTemplateLiteral<`node_${string}`>;
26
34
  name: z.ZodString;
27
35
  mediaType: z.ZodString;
28
- size: z.ZodNumber;
36
+ size: z.ZodOptional<z.ZodNumber>;
37
+ content: z.ZodOptional<z.ZodString>;
38
+ encoding: z.ZodOptional<z.ZodEnum<{
39
+ base64: "base64";
40
+ utf8: "utf8";
41
+ }>>;
29
42
  rev: z.ZodNumber;
30
43
  }, z.core.$strict>;
31
44
  export type FileUpdateInput = z.infer<typeof FileUpdateInput>;
@@ -34,6 +47,24 @@ export declare const FileGetInput: z.ZodObject<{
34
47
  cursor: z.ZodOptional<z.ZodString>;
35
48
  }, z.core.$strict>;
36
49
  export type FileGetInput = z.infer<typeof FileGetInput>;
50
+ export declare const maxDescribeQuestionChars = 2000;
51
+ export declare const maxDescribeBytes: number;
52
+ export declare const FileDescribeInput: z.ZodObject<{
53
+ fileId: z.ZodTemplateLiteral<`node_${string}`>;
54
+ question: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strict>;
56
+ export type FileDescribeInput = z.infer<typeof FileDescribeInput>;
57
+ export declare const FileDescription: z.ZodObject<{
58
+ fileId: z.ZodTemplateLiteral<`node_${string}`>;
59
+ version: z.ZodObject<{
60
+ versionId: z.ZodTemplateLiteral<`version_${string}`>;
61
+ number: z.ZodNumber;
62
+ }, z.core.$strip>;
63
+ description: z.ZodString;
64
+ stored: z.ZodBoolean;
65
+ answer: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type FileDescription = z.infer<typeof FileDescription>;
37
68
  export declare const UploadTicket: z.ZodObject<{
38
69
  url: z.ZodURL;
39
70
  ticket: z.ZodString;
@@ -101,6 +101,56 @@ export const SourceUrl = z
101
101
  .min(1)
102
102
  .max(2048)
103
103
  .describe("The https address of a public document on the web, like a PDF of a study. Colab downloads it itself and stores it like an upload; leave name optional and send no mediaType or size, Colab reads both from the answer. Only public hosts, at most 100 MB.");
104
+ // The largest file sent with its content in the call (E245, #1137): 5 MB after decoding, decimal
105
+ // like `maxFileBytes`. The content passes through the caller's context, so anything larger goes
106
+ // through the upload ticket.
107
+ export const maxContentFileBytes = 5 * 1000 * 1000;
108
+ // Base64 of `maxContentFileBytes` bytes, padded: the longest string the schema takes before the
109
+ // handler decodes and counts. A text in UTF-8 is never longer in characters than in bytes.
110
+ const maxContentChars = Math.ceil(maxContentFileBytes / 3) * 4;
111
+ export const fileEncodings = ["utf8", "base64"];
112
+ const Content = z
113
+ .string()
114
+ .max(maxContentChars, {
115
+ error: `Content can be at most ${maxContentFileBytes} bytes (5 MB); for a larger file leave content out and send size for an upload ticket.`,
116
+ })
117
+ .describe(`The file's content in the call, at most ${maxContentFileBytes} bytes (5 MB) after decoding: text as it is with encoding utf8 (the default), bytes such as a PNG as Base64 with encoding base64. For a gadget or an AI without a shell; Colab counts the size itself, so send no size. A larger file goes through the upload ticket.`);
118
+ const Encoding = z
119
+ .enum(fileEncodings)
120
+ .describe("How content is written: utf8 (the default) for text, base64 for bytes (standard alphabet, padded with =).");
121
+ // What the three ways of a file share (E245, #1137): exactly one of `content`, an upload (`size`)
122
+ // and, on a new file, `sourceUrl`.
123
+ function exactlyOneWay(input, ctx, call) {
124
+ const issue = (path, message) => ctx.addIssue({ code: "custom", path: [path], message });
125
+ if (input.content === undefined && input.encoding !== undefined) {
126
+ issue("encoding", "encoding goes with content; leave it out.");
127
+ }
128
+ if (input.sourceUrl !== undefined) {
129
+ for (const field of ["mediaType", "size", "content"]) {
130
+ if (input[field] !== undefined) {
131
+ issue(field, `With sourceUrl Colab reads ${field} from the answer; leave it out.`);
132
+ }
133
+ }
134
+ return;
135
+ }
136
+ if (input.content !== undefined) {
137
+ if (input.size !== undefined) {
138
+ issue("size", "With content Colab counts the size itself; leave size out.");
139
+ }
140
+ for (const field of ["name", "mediaType"]) {
141
+ if (input[field] === undefined)
142
+ issue(field, `A file sent with content needs ${field}.`);
143
+ }
144
+ return;
145
+ }
146
+ for (const field of ["name", "mediaType", "size"]) {
147
+ if (input[field] === undefined) {
148
+ issue(field, call === "create"
149
+ ? `An upload needs ${field}; or send content (at most 5 MB), or sourceUrl and Colab fetches the file itself.`
150
+ : `An upload needs ${field}; or send content (at most 5 MB).`);
151
+ }
152
+ }
153
+ }
104
154
  export const FileCreateInput = z
105
155
  .strictObject({
106
156
  // ⚠️ Required and nullable (trap C015): null is the top level of Shared, like a folder.
@@ -110,41 +160,53 @@ export const FileCreateInput = z
110
160
  name: FileName.optional(),
111
161
  mediaType: MediaType.optional(),
112
162
  size: Size.optional(),
163
+ content: Content.optional(),
164
+ encoding: Encoding.optional(),
113
165
  sourceUrl: SourceUrl.optional(),
114
166
  idempotencyKey: IdempotencyKey,
115
167
  })
116
- // An upload names its file, type and size; a file from an address is measured by Colab (#556).
117
- .superRefine((input, ctx) => {
118
- if (input.sourceUrl === undefined) {
119
- for (const field of ["name", "mediaType", "size"]) {
120
- if (input[field] === undefined) {
121
- ctx.addIssue({
122
- code: "custom",
123
- path: [field],
124
- message: `An upload needs ${field}; or send sourceUrl and Colab fetches the file itself.`,
125
- });
126
- }
127
- }
128
- return;
129
- }
130
- for (const field of ["mediaType", "size"]) {
131
- if (input[field] !== undefined) {
132
- ctx.addIssue({
133
- code: "custom",
134
- path: [field],
135
- message: `With sourceUrl Colab reads ${field} from the answer; leave it out.`,
136
- });
137
- }
138
- }
139
- });
140
- export const FileUpdateInput = z.strictObject({
168
+ // An upload names its file, type and size; content names file and type, Colab counts it (#1137);
169
+ // a file from an address is measured by Colab (#556).
170
+ .superRefine((input, ctx) => exactlyOneWay(input, ctx, "create"));
171
+ export const FileUpdateInput = z
172
+ .strictObject({
141
173
  fileId: FileId.describe("The file to upload a new version of."),
142
174
  name: FileName,
143
175
  mediaType: MediaType,
144
- size: Size,
176
+ // An upload ticket's size, or the content itself (#1137): exactly one of them.
177
+ size: Size.optional(),
178
+ content: Content.optional(),
179
+ encoding: Encoding.optional(),
145
180
  rev: Rev,
146
- });
181
+ })
182
+ .superRefine((input, ctx) => exactlyOneWay(input, ctx, "update"));
147
183
  export const FileGetInput = z.strictObject({ fileId: FileId, cursor: ExcerptCursor.optional() });
184
+ // Viewing an image (#1126, E244): `intelligence_file_describe`. Without `question` the stored
185
+ // description of the current version (made on the first call), with one the model is asked again
186
+ // and its answer is not stored.
187
+ export const maxDescribeQuestionChars = 2000;
188
+ // The largest image Colab describes; the bytes go to the model whole, as Base64.
189
+ export const maxDescribeBytes = 10 * 1000 * 1000;
190
+ export const FileDescribeInput = z.strictObject({
191
+ fileId: FileId.describe("The image to describe, a file whose current version is a raster image."),
192
+ question: z
193
+ .string()
194
+ .trim()
195
+ .min(1)
196
+ .max(maxDescribeQuestionChars)
197
+ .optional()
198
+ .describe(`A question about the image, such as whether it fits a brief, at most ${maxDescribeQuestionChars} characters. Its answer comes as answer and is not stored.`),
199
+ });
200
+ export const FileDescription = z.object({
201
+ fileId: FileId,
202
+ version: z.object({ versionId: VersionId, number: z.number().int() }),
203
+ // The general description of this version, stored at it and found by the search.
204
+ description: z.string(),
205
+ // True when the description came from storage and no model was asked for it.
206
+ stored: z.boolean(),
207
+ // Only with a question: the model's answer to it, never stored.
208
+ answer: z.string().optional(),
209
+ });
148
210
  // What `_create` and `_update` answer: the door, the ticket and the whole command. ⚠️ `ticket` is a
149
211
  // credential, and it is in this answer on purpose: it opens ONE upload for ONE person for fifteen
150
212
  // minutes. It appears nowhere else, never in an error and never in a log.
@@ -19,6 +19,8 @@ export declare const resources: {
19
19
  readonly link: "links";
20
20
  readonly user: "users";
21
21
  readonly role: "roles";
22
+ readonly team: "teams";
23
+ readonly member: "members";
22
24
  readonly machine: "machines";
23
25
  readonly app: "apps";
24
26
  readonly session: "sessions";
@@ -43,9 +45,10 @@ export declare const resources: {
43
45
  readonly item: "items";
44
46
  readonly organisation: "organisations";
45
47
  readonly home: "homes";
48
+ readonly job: "jobs";
46
49
  };
47
50
  export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
48
- export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel"];
51
+ export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel", "describe"];
49
52
  export type Package = (typeof packages)[number];
50
53
  export type Resource = keyof typeof resources;
51
54
  export type Action = (typeof actions)[number] | (typeof verbs)[number];
@@ -39,6 +39,13 @@ export const resources = {
39
39
  link: "links",
40
40
  user: "users",
41
41
  role: "roles",
42
+ // A named group of people and Operators that carries roles and can be given a node (#1121, E243):
43
+ // `access_team_*`. Decided by the orchestrator.
44
+ team: "teams",
45
+ // A user, person or machine, in a team (#1121, E243), a sub-resource of the team:
46
+ // `access_team_member_create` and `_remove`. Not `user`, because `access_team_user_*` would read
47
+ // like the user resource itself. Decided by the orchestrator.
48
+ member: "members",
42
49
  machine: "machines",
43
50
  app: "apps",
44
51
  session: "sessions",
@@ -89,6 +96,11 @@ export const resources = {
89
96
  // gadget stands under `/`, the setup steps and Colab's news. One per installation like
90
97
  // `organisation`, so its route carries no id. The word the orchestrator gave the start for #993.
91
98
  home: "homes",
99
+ // A run over many archive entries that the server works off in the queue, entry by entry (#1129,
100
+ // E236): `intelligence_job_create` deletes for good or restores the entries it names, `_get` says
101
+ // how far it is, `_list` the person's jobs still running. Only a person in the browser starts or
102
+ // reads one; no AI (D124). Decided by the orchestrator.
103
+ job: "jobs",
92
104
  };
93
105
  // The closed list of actions with a route of their own shape.
94
106
  export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
@@ -122,6 +134,9 @@ export const verbs = [
122
134
  // stays to restore, and a cancelled run may still be billed. An Operator run stopped by hand is
123
135
  // the same (E112): `operator_run_cancel`.
124
136
  "cancel",
137
+ // Colab describes an image to the AI that asks (#1126, E244): `intelligence_file_describe`. Not
138
+ // `get`: the first call makes the description with a model and stores it at the version.
139
+ "describe",
125
140
  ];
126
141
  const reads = { readOnlyHint: true };
127
142
  // Takes nothing away for good. `archive`, `disable` and `unpublish` have their way back (`restore`,
@@ -170,6 +185,8 @@ const actionAnnotations = {
170
185
  schedule: writes,
171
186
  unpublish: writes,
172
187
  cancel: destroys,
188
+ // Stores the description of a version on the first call; takes nothing away.
189
+ describe: writes,
173
190
  };
174
191
  export function isPackage(word) {
175
192
  return packages.includes(word);
@@ -15,12 +15,15 @@ export declare const NodeGrantListInput: z.ZodObject<{
15
15
  export type NodeGrantListInput = z.infer<typeof NodeGrantListInput>;
16
16
  export declare const NodeGrant: z.ZodObject<{
17
17
  grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
18
- userId: z.ZodString;
18
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
19
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
19
20
  name: z.ZodNullable<z.ZodString>;
20
21
  kind: z.ZodNullable<z.ZodEnum<{
22
+ team: "team";
21
23
  machine: "machine";
22
24
  human: "human";
23
25
  }>>;
26
+ members: z.ZodNullable<z.ZodNumber>;
24
27
  email: z.ZodNullable<z.ZodString>;
25
28
  right: z.ZodEnum<{
26
29
  share: "share";
@@ -37,12 +40,15 @@ export type NodeGrant = z.infer<typeof NodeGrant>;
37
40
  export declare const NodeGrantList: z.ZodObject<{
38
41
  items: z.ZodArray<z.ZodObject<{
39
42
  grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
40
- userId: z.ZodString;
43
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
44
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
41
45
  name: z.ZodNullable<z.ZodString>;
42
46
  kind: z.ZodNullable<z.ZodEnum<{
47
+ team: "team";
43
48
  machine: "machine";
44
49
  human: "human";
45
50
  }>>;
51
+ members: z.ZodNullable<z.ZodNumber>;
46
52
  email: z.ZodNullable<z.ZodString>;
47
53
  right: z.ZodEnum<{
48
54
  share: "share";
@@ -60,7 +66,8 @@ export declare const NodeGrantList: z.ZodObject<{
60
66
  export type NodeGrantList = z.infer<typeof NodeGrantList>;
61
67
  export declare const NodeShareInput: z.ZodObject<{
62
68
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
63
- userId: z.ZodTemplateLiteral<`user_${string}`>;
69
+ userId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
70
+ teamId: z.ZodOptional<z.ZodTemplateLiteral<`team_${string}`>>;
64
71
  right: z.ZodEnum<{
65
72
  share: "share";
66
73
  write: "write";
@@ -71,7 +78,8 @@ export type NodeShareInput = z.infer<typeof NodeShareInput>;
71
78
  export declare const NodeShared: z.ZodObject<{
72
79
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
73
80
  grantId: z.ZodTemplateLiteral<`grant_${string}`>;
74
- userId: z.ZodString;
81
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
82
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
75
83
  right: z.ZodEnum<{
76
84
  share: "share";
77
85
  write: "write";