@anchrd/colab-sdk 0.1.37 → 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.
@@ -76,6 +76,7 @@ export declare const ActionChat: z.ZodObject<{
76
76
  appHandle: z.ZodNullable<z.ZodString>;
77
77
  }, z.core.$strip>;
78
78
  line: z.ZodString;
79
+ topic: z.ZodNullable<z.ZodString>;
79
80
  createdAt: z.ZodISODateTime;
80
81
  }, z.core.$strip>;
81
82
  }, z.core.$strip>;
@@ -236,6 +237,7 @@ export declare const ActionItem: z.ZodObject<{
236
237
  appHandle: z.ZodNullable<z.ZodString>;
237
238
  }, z.core.$strip>;
238
239
  line: z.ZodString;
240
+ topic: z.ZodNullable<z.ZodString>;
239
241
  createdAt: z.ZodISODateTime;
240
242
  }, z.core.$strip>;
241
243
  }, z.core.$strip>>;
@@ -729,6 +731,7 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
729
731
  appHandle: z.ZodNullable<z.ZodString>;
730
732
  }, z.core.$strip>;
731
733
  line: z.ZodString;
734
+ topic: z.ZodNullable<z.ZodString>;
732
735
  createdAt: z.ZodISODateTime;
733
736
  }, z.core.$strip>;
734
737
  }, z.core.$strip>>;
@@ -1008,6 +1011,7 @@ export declare const ActionList: z.ZodObject<{
1008
1011
  appHandle: z.ZodNullable<z.ZodString>;
1009
1012
  }, z.core.$strip>;
1010
1013
  line: z.ZodString;
1014
+ topic: z.ZodNullable<z.ZodString>;
1011
1015
  createdAt: z.ZodISODateTime;
1012
1016
  }, z.core.$strip>;
1013
1017
  }, z.core.$strip>>;
@@ -56,6 +56,9 @@ export const ActionChat = z.object({
56
56
  author: MessageAuthor,
57
57
  // The first line of its text that is not empty, at most 200 characters.
58
58
  line: z.string(),
59
+ // Its topic (#994, E223); null for the general one (Allgemein). Read it with
60
+ // intelligence_message_list and topic.
61
+ topic: z.string().nullable(),
59
62
  createdAt: z.iso.datetime(),
60
63
  }),
61
64
  });
@@ -176,8 +176,18 @@ export declare const GadgetClientLog: z.ZodObject<{
176
176
  message: z.ZodString;
177
177
  stack: z.ZodOptional<z.ZodString>;
178
178
  }, z.core.$strict>>>;
179
+ startMs: z.ZodOptional<z.ZodNumber>;
179
180
  }, z.core.$strict>;
180
181
  export type GadgetClientLog = z.infer<typeof GadgetClientLog>;
182
+ export declare const GadgetDistAnswer: z.ZodUnion<readonly [z.ZodObject<{
183
+ js: z.ZodString;
184
+ css: z.ZodString;
185
+ bytes: z.ZodNumber;
186
+ gzipBytes: z.ZodNumber;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ buildError: z.ZodString;
189
+ }, z.core.$strip>]>;
190
+ export type GadgetDistAnswer = z.infer<typeof GadgetDistAnswer>;
181
191
  export declare const GadgetCallCreateInput: z.ZodObject<{
182
192
  gadgetId: z.ZodTemplateLiteral<`node_${string}`>;
183
193
  function: z.ZodString;
@@ -408,6 +418,7 @@ export declare const GadgetDetail: z.ZodObject<{
408
418
  }, z.core.$strip>>;
409
419
  }, z.core.$strip>;
410
420
  version: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"draft">]>>;
421
+ commit: z.ZodNullable<z.ZodString>;
411
422
  manifest: z.ZodNullable<z.ZodObject<{
412
423
  name: z.ZodString;
413
424
  description: z.ZodOptional<z.ZodString>;
@@ -553,6 +564,17 @@ export declare const GadgetDetail: z.ZodObject<{
553
564
  errors: z.ZodNumber;
554
565
  lastCallAt: z.ZodNullable<z.ZodISODateTime>;
555
566
  }, z.core.$strip>>;
567
+ dist: z.ZodOptional<z.ZodNullable<z.ZodObject<{
568
+ bytes: z.ZodNumber;
569
+ gzipBytes: z.ZodNumber;
570
+ startMs: z.ZodNullable<z.ZodNumber>;
571
+ limits: z.ZodObject<{
572
+ bytes: z.ZodNumber;
573
+ startMs: z.ZodNumber;
574
+ }, z.core.$strip>;
575
+ warnings: z.ZodArray<z.ZodString>;
576
+ error: z.ZodNullable<z.ZodString>;
577
+ }, z.core.$strip>>>;
556
578
  settings: z.ZodNullable<z.ZodObject<{
557
579
  responsible: z.ZodNullable<z.ZodObject<{
558
580
  userId: z.ZodString;
@@ -224,7 +224,21 @@ export const GadgetClientLog = z.strictObject({
224
224
  version: GadgetVersionRef.optional(),
225
225
  console: z.array(ClientConsoleLine).max(200).optional(),
226
226
  errors: z.array(ClientError).max(20).optional(),
227
+ // How long the gadget took to start in this opening (E224, #1058): from writing its document to
228
+ // its module having run. Kept once per entry.
229
+ startMs: z.number().int().min(0).max(600_000).optional(),
227
230
  });
231
+ // A commit's dist (E224, #1058), what `GET /api/intelligence/gadgets/:gadgetId/dist/:commit` answers:
232
+ // the interface bundled into one module with its stylesheet, or why it does not bundle.
233
+ export const GadgetDistAnswer = z.union([
234
+ z.object({
235
+ js: z.string(),
236
+ css: z.string(),
237
+ bytes: z.number().int(),
238
+ gzipBytes: z.number().int(),
239
+ }),
240
+ z.object({ buildError: z.string() }),
241
+ ]);
228
242
  export const GadgetCallCreateInput = z.strictObject({
229
243
  gadgetId: GadgetId,
230
244
  function: GadgetFunctionName.describe("The function to call, one of the manifest's functions of that version."),
@@ -349,6 +363,10 @@ export const GadgetDetail = z.object({
349
363
  // The state the files and the manifest below belong to: a version's number, `draft`, or null for
350
364
  // a gadget that has no live version yet when live was asked for.
351
365
  version: z.union([z.number().int(), z.literal("draft")]).nullable(),
366
+ // The commit of that state (E224, #1058), whose dist the interface loads from
367
+ // `GET /api/intelligence/gadgets/:gadgetId/dist/:commit`; null without one (no live version yet,
368
+ // or a draft from before E215 that no commit holds).
369
+ commit: z.string().nullable(),
352
370
  // Null when that state has no gadget.json, or the draft's cannot be read.
353
371
  manifest: GadgetManifest.nullable(),
354
372
  files: z.array(GadgetFile),
@@ -385,6 +403,21 @@ export const GadgetDetail = z.object({
385
403
  lastCallAt: z.iso.datetime().nullable(),
386
404
  })
387
405
  .nullable(),
406
+ // The dist of this state against the limit (E224, #1058): its size (JavaScript and CSS) and the
407
+ // median start time of its last five openings, null before one; `error` when it does not bundle.
408
+ // Above a limit `warnings` says so; a publish warns with them and does not refuse. Optional, and
409
+ // only for whoever may change the gadget, without a commit, or while no dist is built yet.
410
+ dist: z
411
+ .object({
412
+ bytes: z.number().int(),
413
+ gzipBytes: z.number().int(),
414
+ startMs: z.number().int().nullable(),
415
+ limits: z.object({ bytes: z.number().int(), startMs: z.number().int() }),
416
+ warnings: z.array(z.string()),
417
+ error: z.string().nullable(),
418
+ })
419
+ .nullable()
420
+ .optional(),
388
421
  // Only for whoever may change the gadget; null for a reader.
389
422
  settings: GadgetSettings.nullable(),
390
423
  rights: z.object({ write: z.boolean() }),
@@ -641,6 +641,7 @@ export declare const GoalRunDetail: z.ZodObject<{
641
641
  messageId: z.ZodTemplateLiteral<`message_${string}`>;
642
642
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
643
643
  text: z.ZodString;
644
+ topic: z.ZodNullable<z.ZodString>;
644
645
  author: z.ZodObject<{
645
646
  userId: z.ZodString;
646
647
  name: z.ZodNullable<z.ZodString>;
@@ -1014,6 +1015,7 @@ export declare const GoalDetail: z.ZodObject<{
1014
1015
  messageId: z.ZodTemplateLiteral<`message_${string}`>;
1015
1016
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
1016
1017
  text: z.ZodString;
1018
+ topic: z.ZodNullable<z.ZodString>;
1017
1019
  author: z.ZodObject<{
1018
1020
  userId: z.ZodString;
1019
1021
  name: z.ZodNullable<z.ZodString>;
@@ -88,6 +88,7 @@ export declare const Home: z.ZodObject<{
88
88
  }, z.core.$strip>>;
89
89
  }, z.core.$strip>;
90
90
  version: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"draft">]>>;
91
+ commit: z.ZodNullable<z.ZodString>;
91
92
  manifest: z.ZodNullable<z.ZodObject<{
92
93
  name: z.ZodString;
93
94
  description: z.ZodOptional<z.ZodString>;
@@ -233,6 +234,17 @@ export declare const Home: z.ZodObject<{
233
234
  errors: z.ZodNumber;
234
235
  lastCallAt: z.ZodNullable<z.ZodISODateTime>;
235
236
  }, z.core.$strip>>;
237
+ dist: z.ZodOptional<z.ZodNullable<z.ZodObject<{
238
+ bytes: z.ZodNumber;
239
+ gzipBytes: z.ZodNumber;
240
+ startMs: z.ZodNullable<z.ZodNumber>;
241
+ limits: z.ZodObject<{
242
+ bytes: z.ZodNumber;
243
+ startMs: z.ZodNumber;
244
+ }, z.core.$strip>;
245
+ warnings: z.ZodArray<z.ZodString>;
246
+ error: z.ZodNullable<z.ZodString>;
247
+ }, z.core.$strip>>>;
236
248
  settings: z.ZodNullable<z.ZodObject<{
237
249
  responsible: z.ZodNullable<z.ZodObject<{
238
250
  userId: z.ZodString;
@@ -2,23 +2,29 @@ import { z } from "zod";
2
2
  export declare const MessageId: z.ZodTemplateLiteral<`message_${string}`>;
3
3
  export type MessageId = z.infer<typeof MessageId>;
4
4
  export declare const messageMaxLength = 10000;
5
+ export declare const topicMaxLength = 60;
6
+ export declare const TopicName: z.ZodString;
7
+ export declare function topicOf(name: string): string | null;
5
8
  export declare const MessageListInput: z.ZodObject<{
6
9
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
7
10
  cursor: z.ZodOptional<z.ZodString>;
8
11
  after: z.ZodOptional<z.ZodTemplateLiteral<`message_${string}`>>;
9
12
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
13
+ topic: z.ZodOptional<z.ZodString>;
10
14
  }, z.core.$strict>;
11
15
  export type MessageListInput = z.infer<typeof MessageListInput>;
12
16
  export declare const MessageCreateInput: z.ZodObject<{
13
17
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
14
18
  text: z.ZodString;
15
19
  mentions: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`user_${string}`>>>;
20
+ topic: z.ZodOptional<z.ZodString>;
16
21
  idempotencyKey: z.ZodString;
17
22
  }, z.core.$strict>;
18
23
  export type MessageCreateInput = z.infer<typeof MessageCreateInput>;
19
24
  export declare const ChatUpdateInput: z.ZodObject<{
20
25
  chatId: z.ZodTemplateLiteral<`node_${string}`>;
21
26
  readUntil: z.ZodTemplateLiteral<`message_${string}`>;
27
+ topic: z.ZodOptional<z.ZodString>;
22
28
  }, z.core.$strict>;
23
29
  export type ChatUpdateInput = z.infer<typeof ChatUpdateInput>;
24
30
  export declare const MessageAuthor: z.ZodObject<{
@@ -47,6 +53,7 @@ export declare const Message: z.ZodObject<{
47
53
  messageId: z.ZodTemplateLiteral<`message_${string}`>;
48
54
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
49
55
  text: z.ZodString;
56
+ topic: z.ZodNullable<z.ZodString>;
50
57
  author: z.ZodObject<{
51
58
  userId: z.ZodString;
52
59
  name: z.ZodNullable<z.ZodString>;
@@ -75,11 +82,20 @@ export declare const Message: z.ZodObject<{
75
82
  createdAt: z.ZodISODateTime;
76
83
  }, z.core.$strip>;
77
84
  export type Message = z.infer<typeof Message>;
85
+ export declare const ChatTopic: z.ZodObject<{
86
+ topic: z.ZodNullable<z.ZodString>;
87
+ messageCount: z.ZodNumber;
88
+ lastMessageAt: z.ZodISODateTime;
89
+ unreadCount: z.ZodNumber;
90
+ mentioned: z.ZodBoolean;
91
+ }, z.core.$strip>;
92
+ export type ChatTopic = z.infer<typeof ChatTopic>;
78
93
  export declare const MessageList: z.ZodObject<{
79
94
  items: z.ZodArray<z.ZodObject<{
80
95
  messageId: z.ZodTemplateLiteral<`message_${string}`>;
81
96
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
82
97
  text: z.ZodString;
98
+ topic: z.ZodNullable<z.ZodString>;
83
99
  author: z.ZodObject<{
84
100
  userId: z.ZodString;
85
101
  name: z.ZodNullable<z.ZodString>;
@@ -110,6 +126,13 @@ export declare const MessageList: z.ZodObject<{
110
126
  nextCursor: z.ZodNullable<z.ZodString>;
111
127
  unreadCount: z.ZodNumber;
112
128
  readUntil: z.ZodNullable<z.ZodTemplateLiteral<`message_${string}`>>;
129
+ topics: z.ZodArray<z.ZodObject<{
130
+ topic: z.ZodNullable<z.ZodString>;
131
+ messageCount: z.ZodNumber;
132
+ lastMessageAt: z.ZodISODateTime;
133
+ unreadCount: z.ZodNumber;
134
+ mentioned: z.ZodBoolean;
135
+ }, z.core.$strip>>;
113
136
  }, z.core.$strip>;
114
137
  export type MessageList = z.infer<typeof MessageList>;
115
138
  export declare const ChatRead: z.ZodObject<{
@@ -11,6 +11,21 @@ import { MessageMachine } from "../users/users.js";
11
11
  export const MessageId = idSchema("message").describe("A message's id, `message_…`, as intelligence_message_list returns it.");
12
12
  // What a message may hold, in characters of Markdown.
13
13
  export const messageMaxLength = 10_000;
14
+ // A topic's name (#994, E223). Every message belongs to exactly one topic; the general one ("Allgemein")
15
+ // has no stored name and reads as null. An empty text, "Allgemein" or "General" mean it, any case:
16
+ // `topicOf` says so. No transform here, so the input stays a JSON schema (`z.toJSONSchema`).
17
+ export const topicMaxLength = 60;
18
+ const generalNames = new Set(["", "allgemein", "general"]);
19
+ export const TopicName = z
20
+ .string()
21
+ .trim()
22
+ .max(topicMaxLength)
23
+ .refine((name) => !name.startsWith("#"), "A topic's name starts without #.");
24
+ // The stored name of a topic as given: null for the general one.
25
+ export function topicOf(name) {
26
+ const trimmed = name.trim();
27
+ return generalNames.has(trimmed.toLowerCase()) ? null : trimmed;
28
+ }
14
29
  export const MessageListInput = z.strictObject({
15
30
  nodeId: NodeId.describe("The node whose chat to read: any node you can read except a folder, which has no chat."),
16
31
  cursor: z
@@ -20,6 +35,7 @@ export const MessageListInput = z.strictObject({
20
35
  .describe("The nextCursor of the previous page, unchanged, for the messages before it. Leaving it out starts with the newest."),
21
36
  after: MessageId.optional().describe("Only the messages after this one, oldest first, to poll for what is new. A full page means there may be more: ask again with the last id. Not together with cursor."),
22
37
  limit: PageSize.optional().describe("How many messages one page holds, 1 to 100. Leaving it out gives 50."),
38
+ 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."),
23
39
  });
24
40
  export const MessageCreateInput = z.strictObject({
25
41
  nodeId: NodeId.describe("The node whose chat to write in: any node you can read except a folder. Reading is enough to write."),
@@ -34,11 +50,13 @@ export const MessageCreateInput = z.strictObject({
34
50
  .max(50)
35
51
  .optional()
36
52
  .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
+ 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."),
37
54
  idempotencyKey: IdempotencyKey,
38
55
  });
39
56
  export const ChatUpdateInput = z.strictObject({
40
57
  chatId: NodeId.describe("The chat to mark as read: the id of its node, `node_…`."),
41
58
  readUntil: MessageId.describe("The newest message of this chat you have read. Your read state never moves back: an older one changes nothing."),
59
+ 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."),
42
60
  });
43
61
  // Who wrote a message. A person writing in the browser has no `appHandle`; their AI writing through a
44
62
  // connected app carries that app's name. A machine carries its kind and an Operator its provider.
@@ -56,10 +74,23 @@ export const Message = z.object({
56
74
  messageId: MessageId,
57
75
  nodeId: NodeId,
58
76
  text: z.string(),
77
+ // The topic's name; null for the general topic (Allgemein, E223).
78
+ topic: z.string().nullable(),
59
79
  author: MessageAuthor,
60
80
  mentions: z.array(z.object({ userId: z.string(), name: z.string().nullable() })),
61
81
  createdAt: z.iso.datetime(),
62
82
  });
83
+ // One topic of a chat as the list names it (#994): newest activity first.
84
+ export const ChatTopic = z.object({
85
+ // null for the general topic (Allgemein).
86
+ topic: z.string().nullable(),
87
+ messageCount: z.number().int(),
88
+ lastMessageAt: z.iso.datetime(),
89
+ // The caller's own, like `unreadCount` of the chat.
90
+ unreadCount: z.number().int(),
91
+ // An unread message of this topic mentions the caller.
92
+ mentioned: z.boolean(),
93
+ });
63
94
  export const MessageList = z.object({
64
95
  // Oldest first, as a chat reads.
65
96
  items: z.array(Message),
@@ -69,6 +100,8 @@ export const MessageList = z.object({
69
100
  // read (the "Neu" line goes below it). The read state is kept per person and per app.
70
101
  unreadCount: z.number().int(),
71
102
  readUntil: MessageId.nullable(),
103
+ // Every topic of the chat, whatever `topic` filtered (#994).
104
+ topics: z.array(ChatTopic),
72
105
  });
73
106
  export const ChatRead = z.object({
74
107
  chatId: NodeId,