@anchrd/colab-sdk 0.1.51 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ import { z } from "zod";
2
+ export declare const actionBlockLanguage = "colab";
3
+ export declare const ActionButton: z.ZodUnion<readonly [z.ZodObject<{
4
+ label: z.ZodString;
5
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
6
+ column: z.ZodString;
7
+ }, z.core.$strict>, z.ZodObject<{
8
+ label: z.ZodString;
9
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
10
+ field: z.ZodString;
11
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
12
+ }, z.core.$strict>]>;
13
+ export type ActionButton = z.infer<typeof ActionButton>;
14
+ export declare const ButtonsBlock: z.ZodObject<{
15
+ buttons: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
16
+ label: z.ZodString;
17
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
18
+ column: z.ZodString;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ label: z.ZodString;
21
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
22
+ field: z.ZodString;
23
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
24
+ }, z.core.$strict>]>>;
25
+ }, z.core.$strict>;
26
+ export type ButtonsBlock = z.infer<typeof ButtonsBlock>;
27
+ export declare const ChoiceBlock: z.ZodObject<{
28
+ choice: z.ZodString;
29
+ options: z.ZodArray<z.ZodString>;
30
+ }, z.core.$strict>;
31
+ export type ChoiceBlock = z.infer<typeof ChoiceBlock>;
32
+ export declare const ChecklistBlock: z.ZodObject<{
33
+ checklist: z.ZodString;
34
+ items: z.ZodArray<z.ZodString>;
35
+ }, z.core.$strict>;
36
+ export type ChecklistBlock = z.infer<typeof ChecklistBlock>;
37
+ export declare const InputBlock: z.ZodObject<{
38
+ input: z.ZodString;
39
+ label: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strict>;
41
+ export type InputBlock = z.infer<typeof InputBlock>;
42
+ export declare const ActionBlock: z.ZodUnion<readonly [z.ZodObject<{
43
+ buttons: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
44
+ label: z.ZodString;
45
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
46
+ column: z.ZodString;
47
+ }, z.core.$strict>, z.ZodObject<{
48
+ label: z.ZodString;
49
+ task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
50
+ field: z.ZodString;
51
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
52
+ }, z.core.$strict>]>>;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ choice: z.ZodString;
55
+ options: z.ZodArray<z.ZodString>;
56
+ }, z.core.$strict>, z.ZodObject<{
57
+ checklist: z.ZodString;
58
+ items: z.ZodArray<z.ZodString>;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ input: z.ZodString;
61
+ label: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>]>;
63
+ export type ActionBlock = z.infer<typeof ActionBlock>;
@@ -0,0 +1,47 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ // The blocks an AI writes into a text so that Colab draws buttons and fields (E270, #1215, Nodes ›
4
+ // Aufgabe › Knöpfe im Text). A block is a fenced code block with the language `colab` holding YAML;
5
+ // AI, export and search read it as text. A fixed catalog of four, each a strict object: an unknown
6
+ // or misspelled key fails the schema, and such a block stays an ordinary code block that does nothing.
7
+ //
8
+ // A block acts on the card its text belongs to (in a chat: the chat's node) and names columns and
9
+ // fields by their names, as an AI reads them over MCP; a column may also be named by its id. A button
10
+ // may name another card of the same board with `task` instead (#1223): it moves that card or sets its
11
+ // field, and its tick follows that card. Only buttons take `task`.
12
+ export const actionBlockLanguage = "colab";
13
+ const Text = z.string().trim().min(1).max(200);
14
+ // Two buttons, options or points of the same text could not be told apart, on screen or in the card.
15
+ const distinct = (texts) => new Set(texts.map((text) => text.toLowerCase())).size === texts.length;
16
+ const ColumnRef = Text.describe("A column of the card's board, by its name or its `column_…` id.");
17
+ const FieldRef = Text.describe("A field of the card's kind, by its name.");
18
+ const TaskRef = idSchema("node").describe("Another card of the same board the button acts on, by its `node_…` id; without it, its own card.");
19
+ const ColumnButton = z.strictObject({ label: Text, task: TaskRef.optional(), column: ColumnRef });
20
+ const FieldButton = z.strictObject({
21
+ label: Text,
22
+ task: TaskRef.optional(),
23
+ field: FieldRef,
24
+ value: z.union([Text, z.number().finite()]),
25
+ });
26
+ export const ActionButton = z.union([ColumnButton, FieldButton]);
27
+ // One or several buttons side by side; the first is the primary one.
28
+ export const ButtonsBlock = z.strictObject({
29
+ buttons: z
30
+ .array(ActionButton)
31
+ .min(1)
32
+ .max(4)
33
+ .refine((buttons) => distinct(buttons.map((button) => button.label))),
34
+ });
35
+ // One of several, saved at once into a select or text field.
36
+ export const ChoiceBlock = z.strictObject({
37
+ choice: FieldRef,
38
+ options: z.array(Text).min(2).max(10).refine(distinct),
39
+ });
40
+ // Points ticked in a checklist field, matched by their text.
41
+ export const ChecklistBlock = z.strictObject({
42
+ checklist: FieldRef,
43
+ items: z.array(Text).min(1).max(20).refine(distinct),
44
+ });
45
+ // A text or number field, with a label above it (the field's name without one).
46
+ export const InputBlock = z.strictObject({ input: FieldRef, label: Text.optional() });
47
+ export const ActionBlock = z.union([ButtonsBlock, ChoiceBlock, ChecklistBlock, InputBlock]);
@@ -61,6 +61,7 @@ export declare const ActionChat: z.ZodObject<{
61
61
  machine: "machine";
62
62
  human: "human";
63
63
  }>>;
64
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
65
  machine: z.ZodNullable<z.ZodObject<{
65
66
  kind: z.ZodEnum<{
66
67
  operator: "operator";
@@ -77,6 +78,12 @@ export declare const ActionChat: z.ZodObject<{
77
78
  }, z.core.$strip>;
78
79
  line: z.ZodString;
79
80
  topic: z.ZodNullable<z.ZodString>;
81
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
82
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
83
+ name: z.ZodString;
84
+ mediaType: z.ZodString;
85
+ size: z.ZodNumber;
86
+ }, z.core.$strip>>>;
80
87
  createdAt: z.ZodISODateTime;
81
88
  }, z.core.$strip>;
82
89
  }, z.core.$strip>;
@@ -146,6 +153,7 @@ export declare const ActionItem: z.ZodObject<{
146
153
  goal: "goal";
147
154
  skill: "skill";
148
155
  source: "source";
156
+ flow: "flow";
149
157
  }>>;
150
158
  name: z.ZodString;
151
159
  path: z.ZodObject<{
@@ -212,6 +220,7 @@ export declare const ActionItem: z.ZodObject<{
212
220
  machine: "machine";
213
221
  human: "human";
214
222
  }>>;
223
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
224
  machine: z.ZodNullable<z.ZodObject<{
216
225
  kind: z.ZodEnum<{
217
226
  operator: "operator";
@@ -228,6 +237,12 @@ export declare const ActionItem: z.ZodObject<{
228
237
  }, z.core.$strip>;
229
238
  line: z.ZodString;
230
239
  topic: z.ZodNullable<z.ZodString>;
240
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
241
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
242
+ name: z.ZodString;
243
+ mediaType: z.ZodString;
244
+ size: z.ZodNumber;
245
+ }, z.core.$strip>>>;
231
246
  createdAt: z.ZodISODateTime;
232
247
  }, z.core.$strip>;
233
248
  }, z.core.$strip>>;
@@ -676,6 +691,7 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
676
691
  goal: "goal";
677
692
  skill: "skill";
678
693
  source: "source";
694
+ flow: "flow";
679
695
  }>>;
680
696
  name: z.ZodString;
681
697
  path: z.ZodObject<{
@@ -742,6 +758,7 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
742
758
  machine: "machine";
743
759
  human: "human";
744
760
  }>>;
761
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
745
762
  machine: z.ZodNullable<z.ZodObject<{
746
763
  kind: z.ZodEnum<{
747
764
  operator: "operator";
@@ -758,6 +775,12 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
758
775
  }, z.core.$strip>;
759
776
  line: z.ZodString;
760
777
  topic: z.ZodNullable<z.ZodString>;
778
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
779
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
780
+ name: z.ZodString;
781
+ mediaType: z.ZodString;
782
+ size: z.ZodNumber;
783
+ }, z.core.$strip>>>;
761
784
  createdAt: z.ZodISODateTime;
762
785
  }, z.core.$strip>;
763
786
  }, z.core.$strip>>;
@@ -959,6 +982,7 @@ export declare const ActionList: z.ZodObject<{
959
982
  goal: "goal";
960
983
  skill: "skill";
961
984
  source: "source";
985
+ flow: "flow";
962
986
  }>>;
963
987
  name: z.ZodString;
964
988
  path: z.ZodObject<{
@@ -1025,6 +1049,7 @@ export declare const ActionList: z.ZodObject<{
1025
1049
  machine: "machine";
1026
1050
  human: "human";
1027
1051
  }>>;
1052
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1028
1053
  machine: z.ZodNullable<z.ZodObject<{
1029
1054
  kind: z.ZodEnum<{
1030
1055
  operator: "operator";
@@ -1041,6 +1066,12 @@ export declare const ActionList: z.ZodObject<{
1041
1066
  }, z.core.$strip>;
1042
1067
  line: z.ZodString;
1043
1068
  topic: z.ZodNullable<z.ZodString>;
1069
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
1070
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
1071
+ name: z.ZodString;
1072
+ mediaType: z.ZodString;
1073
+ size: z.ZodNumber;
1074
+ }, z.core.$strip>>>;
1044
1075
  createdAt: z.ZodISODateTime;
1045
1076
  }, z.core.$strip>;
1046
1077
  }, z.core.$strip>>;
@@ -5,7 +5,7 @@ import { GadgetLevel } from "../gadgets/gadgets.js";
5
5
  import { packages } from "../grammar/grammar.js";
6
6
  import { Digest, InstructionsLink, Known, KnownText } from "../instructions/instructions.js";
7
7
  import { Limit as PageSize } from "../list-input.js";
8
- import { MessageAuthor, MessageId } from "../messages/messages.js";
8
+ import { AttachmentId, MessageAuthor, MessageId } from "../messages/messages.js";
9
9
  import { BoardShownKind, NodeId, NodeKindRead, NodePath } from "../nodes/nodes.js";
10
10
  import { OperatorRunId } from "../operators/operators.js";
11
11
  import { SkillOffer } from "../skills/skills.js";
@@ -59,6 +59,16 @@ export const ActionChat = z.object({
59
59
  // Its topic (#994, E223); null for the general one (Allgemein). Read it with
60
60
  // intelligence_message_list and topic.
61
61
  topic: z.string().nullable(),
62
+ // The files it carries (#1210, E265): read each with intelligence_chat_attachment_get. Optional
63
+ // only for the readers' sake: the server always names them.
64
+ attachments: z
65
+ .array(z.object({
66
+ attachmentId: AttachmentId,
67
+ name: z.string(),
68
+ mediaType: z.string(),
69
+ size: z.number().int(),
70
+ }))
71
+ .optional(),
62
72
  createdAt: z.iso.datetime(),
63
73
  }),
64
74
  });