@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.
@@ -13,18 +13,65 @@ export declare const MessageListInput: z.ZodObject<{
13
13
  topic: z.ZodOptional<z.ZodString>;
14
14
  }, z.core.$strict>;
15
15
  export type MessageListInput = z.infer<typeof MessageListInput>;
16
+ export declare const AttachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
17
+ export type AttachmentId = z.infer<typeof AttachmentId>;
18
+ export declare const attachmentsMax = 10;
19
+ export declare const attachmentMaxBytes: number;
20
+ export declare const ChatAttachmentCreateInput: z.ZodObject<{
21
+ chatId: z.ZodTemplateLiteral<`node_${string}`>;
22
+ name: z.ZodString;
23
+ mediaType: z.ZodString;
24
+ content: z.ZodBase64;
25
+ idempotencyKey: z.ZodString;
26
+ }, z.core.$strict>;
27
+ export type ChatAttachmentCreateInput = z.infer<typeof ChatAttachmentCreateInput>;
28
+ export declare const ChatAttachmentGetInput: z.ZodObject<{
29
+ chatId: z.ZodTemplateLiteral<`node_${string}`>;
30
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
31
+ }, z.core.$strict>;
32
+ export type ChatAttachmentGetInput = z.infer<typeof ChatAttachmentGetInput>;
33
+ export declare const MessageAttachment: z.ZodObject<{
34
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
35
+ name: z.ZodString;
36
+ mediaType: z.ZodString;
37
+ size: z.ZodNumber;
38
+ image: z.ZodBoolean;
39
+ contentUrl: z.ZodString;
40
+ previewUrl: z.ZodNullable<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ export type MessageAttachment = z.infer<typeof MessageAttachment>;
43
+ export declare const ChatAttachmentRead: z.ZodObject<{
44
+ attachment: z.ZodObject<{
45
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
46
+ name: z.ZodString;
47
+ mediaType: z.ZodString;
48
+ size: z.ZodNumber;
49
+ image: z.ZodBoolean;
50
+ contentUrl: z.ZodString;
51
+ previewUrl: z.ZodNullable<z.ZodString>;
52
+ }, z.core.$strip>;
53
+ messageId: z.ZodNullable<z.ZodString>;
54
+ text: z.ZodNullable<z.ZodString>;
55
+ image: z.ZodNullable<z.ZodObject<{
56
+ data: z.ZodString;
57
+ mimeType: z.ZodString;
58
+ }, z.core.$strip>>;
59
+ }, z.core.$strip>;
60
+ export type ChatAttachmentRead = z.infer<typeof ChatAttachmentRead>;
16
61
  export declare const MessageCreateInput: z.ZodObject<{
17
62
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
18
63
  text: z.ZodString;
19
64
  mentions: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`user_${string}`>>>;
20
65
  topic: z.ZodOptional<z.ZodString>;
66
+ attachments: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`attachment_${string}`>>>;
21
67
  idempotencyKey: z.ZodString;
22
68
  }, z.core.$strict>;
23
69
  export type MessageCreateInput = z.infer<typeof MessageCreateInput>;
24
70
  export declare const ChatUpdateInput: z.ZodObject<{
25
71
  chatId: z.ZodTemplateLiteral<`node_${string}`>;
26
- readUntil: z.ZodTemplateLiteral<`message_${string}`>;
72
+ readUntil: z.ZodOptional<z.ZodTemplateLiteral<`message_${string}`>>;
27
73
  topic: z.ZodOptional<z.ZodString>;
74
+ typing: z.ZodOptional<z.ZodBoolean>;
28
75
  }, z.core.$strict>;
29
76
  export type ChatUpdateInput = z.infer<typeof ChatUpdateInput>;
30
77
  export declare const MessageAuthor: z.ZodObject<{
@@ -34,6 +81,7 @@ export declare const MessageAuthor: z.ZodObject<{
34
81
  machine: "machine";
35
82
  human: "human";
36
83
  }>>;
84
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
85
  machine: z.ZodNullable<z.ZodObject<{
38
86
  kind: z.ZodEnum<{
39
87
  operator: "operator";
@@ -61,6 +109,7 @@ export declare const Message: z.ZodObject<{
61
109
  machine: "machine";
62
110
  human: "human";
63
111
  }>>;
112
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
113
  machine: z.ZodNullable<z.ZodObject<{
65
114
  kind: z.ZodEnum<{
66
115
  operator: "operator";
@@ -79,6 +128,15 @@ export declare const Message: z.ZodObject<{
79
128
  userId: z.ZodString;
80
129
  name: z.ZodNullable<z.ZodString>;
81
130
  }, z.core.$strip>>;
131
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
132
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
133
+ name: z.ZodString;
134
+ mediaType: z.ZodString;
135
+ size: z.ZodNumber;
136
+ image: z.ZodBoolean;
137
+ contentUrl: z.ZodString;
138
+ previewUrl: z.ZodNullable<z.ZodString>;
139
+ }, z.core.$strip>>>;
82
140
  createdAt: z.ZodISODateTime;
83
141
  }, z.core.$strip>;
84
142
  export type Message = z.infer<typeof Message>;
@@ -103,6 +161,7 @@ export declare const MessageList: z.ZodObject<{
103
161
  machine: "machine";
104
162
  human: "human";
105
163
  }>>;
164
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
165
  machine: z.ZodNullable<z.ZodObject<{
107
166
  kind: z.ZodEnum<{
108
167
  operator: "operator";
@@ -121,6 +180,15 @@ export declare const MessageList: z.ZodObject<{
121
180
  userId: z.ZodString;
122
181
  name: z.ZodNullable<z.ZodString>;
123
182
  }, z.core.$strip>>;
183
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
184
+ attachmentId: z.ZodTemplateLiteral<`attachment_${string}`>;
185
+ name: z.ZodString;
186
+ mediaType: z.ZodString;
187
+ size: z.ZodNumber;
188
+ image: z.ZodBoolean;
189
+ contentUrl: z.ZodString;
190
+ previewUrl: z.ZodNullable<z.ZodString>;
191
+ }, z.core.$strip>>>;
124
192
  createdAt: z.ZodISODateTime;
125
193
  }, z.core.$strip>>;
126
194
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -7,7 +7,8 @@ import { MessageMachine } from "../users/users.js";
7
7
  // The chat of a node (#45, Funktionen › Chat, E49, E67): the inputs of `intelligence_message_list`,
8
8
  // `intelligence_message_create` and `intelligence_chat_update`, and their answers. Every node but a
9
9
  // folder has a chat; it has no row of its own, and its `chatId` is the node's id. Messages are only
10
- // appended: no editing, no attachment, no following.
10
+ // appended: no editing, no following. A message carries up to ten attachments (#1210, E265), each
11
+ // uploaded into the chat first and named by the message that sends it.
11
12
  export const MessageId = idSchema("message").describe("A message's id, `message_…`, as intelligence_message_list returns it.");
12
13
  // What a message may hold, in characters of Markdown.
13
14
  export const messageMaxLength = 10_000;
@@ -37,26 +38,103 @@ export const MessageListInput = z.strictObject({
37
38
  limit: PageSize.optional().describe("How many messages one page holds, 1 to 100. Leaving it out gives 50."),
38
39
  topic: TopicName.optional().describe("Only the messages of this topic, as topics names it; an empty text reads the general topic (Allgemein). Leaving it out reads every topic. Read topics first, then only the one you need."),
39
40
  });
40
- export const MessageCreateInput = z.strictObject({
41
+ // An attachment of a chat message (#1210, E265): uploaded into a chat, then sent with one message.
42
+ // No node: no place in the tree, no rights and no versions of its own.
43
+ export const AttachmentId = idSchema("attachment").describe("An attachment's id, `attachment_…`, as intelligence_chat_attachment_create or intelligence_message_list returns it.");
44
+ // At most this many attachments per message, each at most this many bytes (E265).
45
+ export const attachmentsMax = 10;
46
+ export const attachmentMaxBytes = 20 * 1024 * 1024;
47
+ // The Base64 of the largest attachment, padded: what the input's length is held to.
48
+ const attachmentMaxBase64 = Math.ceil(attachmentMaxBytes / 3) * 4;
49
+ export const ChatAttachmentCreateInput = z.strictObject({
50
+ chatId: NodeId.describe("The chat to attach the file in: the id of its node, `node_…`, any node you can read except a folder."),
51
+ name: z
52
+ .string()
53
+ .trim()
54
+ .min(1)
55
+ .max(255)
56
+ .describe("The file's name as it shows in the chat, e.g. `kunde-buero.jpg`."),
57
+ mediaType: z
58
+ .string()
59
+ .trim()
60
+ .min(1)
61
+ .max(255)
62
+ .describe("The file's media type, e.g. `image/jpeg` or `application/pdf`."),
63
+ content: z
64
+ .base64()
65
+ .max(attachmentMaxBase64, "An attachment holds at most 20 MB.")
66
+ .describe("The file's bytes as Base64 (standard alphabet, padded with =), at most 20 MB after decoding."),
67
+ idempotencyKey: IdempotencyKey,
68
+ });
69
+ export const ChatAttachmentGetInput = z.strictObject({
70
+ chatId: NodeId.describe("The node whose chat holds the attachment, `node_…`."),
71
+ attachmentId: AttachmentId,
72
+ });
73
+ // An attachment as a message and the upload name it. `image`: a raster image the browser draws and
74
+ // `intelligence_chat_attachment_get` hands an AI as a picture.
75
+ export const MessageAttachment = z.object({
76
+ attachmentId: AttachmentId,
77
+ name: z.string(),
78
+ mediaType: z.string(),
79
+ size: z.number().int(),
80
+ image: z.boolean(),
81
+ // The original, opened with the caller's own session or token.
82
+ contentUrl: z.string(),
83
+ // The smaller picture of an image; null for every other file.
84
+ previewUrl: z.string().nullable(),
85
+ });
86
+ // What `intelligence_chat_attachment_get` answers: the attachment, and its content as far as it can
87
+ // travel. An image comes as a picture beside this answer over `/mcp` (`image`, Base64 here); a text
88
+ // file as `text`; any other file only names `contentUrl` to load it with the caller's token.
89
+ export const ChatAttachmentRead = z.object({
90
+ attachment: MessageAttachment,
91
+ messageId: z.string().nullable(),
92
+ text: z.string().nullable(),
93
+ image: z.object({ data: z.string(), mimeType: z.string() }).nullable(),
94
+ });
95
+ export const MessageCreateInput = z
96
+ .strictObject({
41
97
  nodeId: NodeId.describe("The node whose chat to write in: any node you can read except a folder. Reading is enough to write."),
42
98
  text: z
43
99
  .string()
44
100
  .trim()
45
- .min(1)
46
101
  .max(messageMaxLength)
47
- .describe("The message as Markdown, at most 10,000 characters. It cannot be edited afterwards. To point at a file, put it into the tree and link the node."),
102
+ .describe("The message as Markdown, at most 10,000 characters; empty only with attachments. It cannot be edited afterwards. To point at a file of the tree, link its node."),
48
103
  mentions: z
49
104
  .array(idSchema("user"))
50
105
  .max(50)
51
106
  .optional()
52
107
  .describe("The people and machines this message mentions, `user_…`; they see the chat in their Actions. Only someone who can read the node: find them with intelligence_user_list and readersOnly. One who cannot read it refuses the whole message."),
53
108
  topic: TopicName.optional().describe("The topic the message belongs to, at most 60 characters: one of the topics intelligence_message_list names, or a new one, which starts with this message. Leaving it out writes in the general topic (Allgemein). Keep to the topic the conversation is in."),
109
+ attachments: z
110
+ .array(AttachmentId)
111
+ .max(attachmentsMax, "A message carries at most 10 attachments.")
112
+ .optional()
113
+ .describe("Up to 10 attachments uploaded into this chat with intelligence_chat_attachment_create and not sent yet; the message carries them."),
54
114
  idempotencyKey: IdempotencyKey,
115
+ })
116
+ .refine((input) => input.text !== "" || (input.attachments?.length ?? 0) > 0, {
117
+ message: "A message needs text or an attachment.",
118
+ path: ["text"],
55
119
  });
56
- export const ChatUpdateInput = z.strictObject({
57
- chatId: NodeId.describe("The chat to mark as read: the id of its node, `node_…`."),
58
- readUntil: MessageId.describe("The newest message of this chat you have read. Your read state never moves back: an older one changes nothing."),
120
+ // `typing` (#1209, E264): a machine says it writes a message for this chat; the chat shows
121
+ // "‹Name› schreibt …" for 10 seconds, until its message comes or it says so again. Without effect for
122
+ // a person, whose browser says it over its socket.
123
+ export const ChatUpdateInput = z
124
+ .strictObject({
125
+ chatId: NodeId.describe("The chat to mark as read or to write in: the id of its node, `node_…`."),
126
+ readUntil: MessageId.optional().describe("The newest message of this chat you have read. Your read state never moves back: an older one changes nothing. Leave it out to only say you are writing."),
59
127
  topic: TopicName.optional().describe("Mark only this topic as read, up to readUntil, which must be one of its messages; an empty text is the general topic. Leaving it out marks the whole chat."),
128
+ typing: z
129
+ .boolean()
130
+ .optional()
131
+ .describe("true: you are writing a message for this chat, and the people who have it open see that you write, for 10 seconds or until your message comes; send it again for longer. Only for a machine; a person's browser says it itself."),
132
+ })
133
+ .refine((input) => input.readUntil !== undefined || input.typing === true, {
134
+ message: "Give readUntil, typing: true, or both.",
135
+ })
136
+ .refine((input) => input.topic === undefined || input.readUntil !== undefined, {
137
+ message: "topic marks a topic as read and needs readUntil.",
60
138
  });
61
139
  // Who wrote a message. A person writing in the browser has no `appHandle`; their AI writing through a
62
140
  // connected app carries that app's name. A machine carries its kind and an Operator its provider.
@@ -66,6 +144,9 @@ export const MessageAuthor = z.object({
66
144
  // As `access` names them today; null for an account that is gone.
67
145
  name: z.string().nullable(),
68
146
  kind: z.enum(["human", "machine"]).nullable(),
147
+ // The picture of person or machine (`/auth/profile-image/…`, E263); null without one. Optional
148
+ // only for the readers' sake: the server always names it.
149
+ image: z.string().nullable().optional(),
69
150
  // Only for a machine `access` still knows; null for a person.
70
151
  machine: MessageMachine.nullable(),
71
152
  appHandle: z.string().nullable(),
@@ -78,6 +159,9 @@ export const Message = z.object({
78
159
  topic: z.string().nullable(),
79
160
  author: MessageAuthor,
80
161
  mentions: z.array(z.object({ userId: z.string(), name: z.string().nullable() })),
162
+ // In the order they were uploaded (#1210). Optional only for the readers' sake: the server always
163
+ // names them.
164
+ attachments: z.array(MessageAttachment).optional(),
81
165
  createdAt: z.iso.datetime(),
82
166
  });
83
167
  // One topic of a chat as the list names it (#994): newest activity first.
@@ -7,7 +7,7 @@ export declare const SecretFields: {
7
7
  secret: z.ZodOptional<z.ZodLiteral<true>>;
8
8
  locked: z.ZodOptional<z.ZodBoolean>;
9
9
  };
10
- export declare const nodeKinds: readonly ["folder", "document", "table", "board", "task", "file", "gadget", "goal", "skill", "source"];
10
+ export declare const nodeKinds: readonly ["folder", "document", "table", "board", "task", "file", "gadget", "goal", "skill", "source", "flow"];
11
11
  export declare const NodeKind: z.ZodEnum<{
12
12
  file: "file";
13
13
  folder: "folder";
@@ -19,6 +19,7 @@ export declare const NodeKind: z.ZodEnum<{
19
19
  goal: "goal";
20
20
  skill: "skill";
21
21
  source: "source";
22
+ flow: "flow";
22
23
  }>;
23
24
  export type NodeKind = z.infer<typeof NodeKind>;
24
25
  export declare const unknownNodeKind: "unknown";
@@ -34,6 +35,7 @@ export declare const NodeKindRead: z.ZodCatch<z.ZodEnum<{
34
35
  goal: "goal";
35
36
  skill: "skill";
36
37
  source: "source";
38
+ flow: "flow";
37
39
  }>>;
38
40
  export type NodeKindRead = z.infer<typeof NodeKindRead>;
39
41
  export declare const responsibleKinds: readonly ["document", "table", "file"];
@@ -60,6 +62,7 @@ export declare const NodeSort: z.ZodEnum<{
60
62
  }>;
61
63
  export type NodeSort = z.infer<typeof NodeSort>;
62
64
  export declare const NodeQuery: z.ZodString;
65
+ export declare const nodeListLimitMax = 1000;
63
66
  export declare const NodeListInput: z.ZodObject<{
64
67
  parentId: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
65
68
  section: z.ZodOptional<z.ZodEnum<{
@@ -117,6 +120,7 @@ export declare const NodeListItem: z.ZodObject<{
117
120
  goal: "goal";
118
121
  skill: "skill";
119
122
  source: "source";
123
+ flow: "flow";
120
124
  }>>;
121
125
  name: z.ZodString;
122
126
  hidden: z.ZodBoolean;
@@ -181,6 +185,7 @@ export declare const NodeList: z.ZodObject<{
181
185
  goal: "goal";
182
186
  skill: "skill";
183
187
  source: "source";
188
+ flow: "flow";
184
189
  }>>;
185
190
  name: z.ZodString;
186
191
  hidden: z.ZodBoolean;
@@ -269,6 +274,7 @@ export declare const NodeHit: z.ZodObject<{
269
274
  goal: "goal";
270
275
  skill: "skill";
271
276
  source: "source";
277
+ flow: "flow";
272
278
  }>>;
273
279
  name: z.ZodString;
274
280
  path: z.ZodObject<{
@@ -333,6 +339,7 @@ export declare const NodeSearch: z.ZodObject<{
333
339
  goal: "goal";
334
340
  skill: "skill";
335
341
  source: "source";
342
+ flow: "flow";
336
343
  }>>;
337
344
  name: z.ZodString;
338
345
  path: z.ZodObject<{
@@ -429,6 +436,7 @@ export declare const NodeDetail: z.ZodObject<{
429
436
  goal: "goal";
430
437
  skill: "skill";
431
438
  source: "source";
439
+ flow: "flow";
432
440
  }>>;
433
441
  name: z.ZodString;
434
442
  hidden: z.ZodBoolean;
@@ -40,6 +40,8 @@ export const nodeKinds = [
40
40
  "skill",
41
41
  // #900, E151: fetches data from outside on a schedule and keeps it as items.
42
42
  "source",
43
+ // #1228, E274: operates a portal without an API in a browser, step by step.
44
+ "flow",
43
45
  ];
44
46
  export const NodeKind = z.enum(nodeKinds);
45
47
  // A list entry of a kind this release does not know yet reads as `unknown` (E195, #784): a tab
@@ -82,6 +84,16 @@ export const NodeQuery = z
82
84
  .min(2)
83
85
  .max(200)
84
86
  .describe("Search instead of listing: words to find in titles, the text of documents, tables, files and tasks, at least two characters; each word also finds longer words it begins (preis finds Preisliste). Only what you can read, never archived nodes or chats. parentId narrows it to that folder and everything below it, section to own, shared or users; leaving both out searches own and shared together. The hits come in the order of their rank, grouped by folder; sort, foldersFirst and includeHidden do not apply.");
87
+ // The page size of `intelligence_node_list`, larger than other lists (E260): the tree's order is
88
+ // sorted in code over the whole level, so the UI asks for a level in one page instead of reading it
89
+ // again per page. The default stays that of every list.
90
+ export const nodeListLimitMax = 1000;
91
+ const NodeListLimit = z.coerce
92
+ .number()
93
+ .int()
94
+ .min(1)
95
+ .max(nodeListLimitMax)
96
+ .describe("How many entries one page holds, 1 to 1000. Leaving it out gives 50.");
85
97
  export const NodeListInput = z.strictObject({
86
98
  parentId: NodeId.optional().describe("List the children of this folder. Give exactly one of parentId, section and nodeIds; with query at most one of parentId and section."),
87
99
  section: NodeSection.optional().describe("List a section of the tree instead of a folder: own (what lies in your own root folder), shared (the tops of everything others let you reach) or users (every other person's root folder, only for an admin in admin mode)."),
@@ -94,7 +106,7 @@ export const NodeListInput = z.strictObject({
94
106
  .max(1000)
95
107
  .optional()
96
108
  .describe("The nextCursor of the previous page, unchanged. Leaving it out starts at the top."),
97
- limit: Limit.optional(),
109
+ limit: NodeListLimit.optional(),
98
110
  archived: Flag.optional().describe("List the archive instead: with section own or shared the archived entries there, each with its path and when it was archived; with parentId the archived nodes in that folder, also inside an archived one. Leaving it out lists what is not archived."),
99
111
  // Over REST one comma-separated value (`?nodeIds=node_…,node_…`): a query string carries text.
100
112
  nodeIds: z