@anchrd/colab-sdk 0.1.52 → 0.1.54
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.
- package/dist/action-blocks/action-blocks.d.ts +6 -0
- package/dist/action-blocks/action-blocks.js +7 -2
- package/dist/actions/actions.d.ts +3 -20
- package/dist/actions/actions.js +0 -3
- package/dist/conversations/conversations.d.ts +8 -0
- package/dist/conversations/conversations.js +5 -0
- package/dist/error/error.js +48 -3
- package/dist/flows/flow-runs.d.ts +2313 -0
- package/dist/flows/flow-runs.js +424 -0
- package/dist/flows/flows.d.ts +2751 -0
- package/dist/flows/flows.js +469 -0
- package/dist/gadgets/gadgets.d.ts +0 -21
- package/dist/gadgets/gadgets.js +1 -6
- package/dist/goals/goals.d.ts +3 -0
- package/dist/grammar/grammar.d.ts +1 -0
- package/dist/grammar/grammar.js +4 -0
- package/dist/home/home.d.ts +0 -5
- package/dist/nodes/nodes.d.ts +8 -1
- package/dist/nodes/nodes.js +2 -0
- package/dist/operators/operators.js +2 -1
- package/dist/relations/relations.d.ts +2 -0
- package/dist/schedule/schedule.d.ts +1 -0
- package/dist/schedule/schedule.js +1 -1
- package/dist/sdk.d.ts +3 -1
- package/dist/sdk.js +3 -1
- package/dist/sources/sources.d.ts +0 -10
- package/dist/sources/sources.js +4 -4
- package/dist/tree-order/tree-order.d.ts +1 -1
- package/dist/tree-order/tree-order.js +1 -0
- package/dist/written/written.d.ts +4 -0
- package/dist/written/written.js +4 -0
- package/package.json +1 -1
|
@@ -2,9 +2,11 @@ import { z } from "zod";
|
|
|
2
2
|
export declare const actionBlockLanguage = "colab";
|
|
3
3
|
export declare const ActionButton: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
4
|
label: z.ZodString;
|
|
5
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
5
6
|
column: z.ZodString;
|
|
6
7
|
}, z.core.$strict>, z.ZodObject<{
|
|
7
8
|
label: z.ZodString;
|
|
9
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
8
10
|
field: z.ZodString;
|
|
9
11
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
10
12
|
}, z.core.$strict>]>;
|
|
@@ -12,9 +14,11 @@ export type ActionButton = z.infer<typeof ActionButton>;
|
|
|
12
14
|
export declare const ButtonsBlock: z.ZodObject<{
|
|
13
15
|
buttons: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
14
16
|
label: z.ZodString;
|
|
17
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
15
18
|
column: z.ZodString;
|
|
16
19
|
}, z.core.$strict>, z.ZodObject<{
|
|
17
20
|
label: z.ZodString;
|
|
21
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
18
22
|
field: z.ZodString;
|
|
19
23
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
20
24
|
}, z.core.$strict>]>>;
|
|
@@ -38,9 +42,11 @@ export type InputBlock = z.infer<typeof InputBlock>;
|
|
|
38
42
|
export declare const ActionBlock: z.ZodUnion<readonly [z.ZodObject<{
|
|
39
43
|
buttons: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
40
44
|
label: z.ZodString;
|
|
45
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
41
46
|
column: z.ZodString;
|
|
42
47
|
}, z.core.$strict>, z.ZodObject<{
|
|
43
48
|
label: z.ZodString;
|
|
49
|
+
task: z.ZodOptional<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
44
50
|
field: z.ZodString;
|
|
45
51
|
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
46
52
|
}, z.core.$strict>]>>;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { idSchema } from "../ids/ids.js";
|
|
2
3
|
// The blocks an AI writes into a text so that Colab draws buttons and fields (E270, #1215, Nodes ›
|
|
3
4
|
// Aufgabe › Knöpfe im Text). A block is a fenced code block with the language `colab` holding YAML;
|
|
4
5
|
// AI, export and search read it as text. A fixed catalog of four, each a strict object: an unknown
|
|
5
6
|
// or misspelled key fails the schema, and such a block stays an ordinary code block that does nothing.
|
|
6
7
|
//
|
|
7
8
|
// A block acts on the card its text belongs to (in a chat: the chat's node) and names columns and
|
|
8
|
-
// fields by their names, as an AI reads them over MCP; a column may also be named by its id.
|
|
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`.
|
|
9
12
|
export const actionBlockLanguage = "colab";
|
|
10
13
|
const Text = z.string().trim().min(1).max(200);
|
|
11
14
|
// Two buttons, options or points of the same text could not be told apart, on screen or in the card.
|
|
12
15
|
const distinct = (texts) => new Set(texts.map((text) => text.toLowerCase())).size === texts.length;
|
|
13
16
|
const ColumnRef = Text.describe("A column of the card's board, by its name or its `column_…` id.");
|
|
14
17
|
const FieldRef = Text.describe("A field of the card's kind, by its name.");
|
|
15
|
-
const
|
|
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 });
|
|
16
20
|
const FieldButton = z.strictObject({
|
|
17
21
|
label: Text,
|
|
22
|
+
task: TaskRef.optional(),
|
|
18
23
|
field: FieldRef,
|
|
19
24
|
value: z.union([Text, z.number().finite()]),
|
|
20
25
|
});
|
|
@@ -115,11 +115,6 @@ export declare const ActionGadget: z.ZodObject<{
|
|
|
115
115
|
message: z.ZodString;
|
|
116
116
|
callId: z.ZodNullable<z.ZodTemplateLiteral<`call_${string}`>>;
|
|
117
117
|
open: z.ZodNumber;
|
|
118
|
-
level: z.ZodEnum<{
|
|
119
|
-
publish: "publish";
|
|
120
|
-
draft: "draft";
|
|
121
|
-
report: "report";
|
|
122
|
-
}>;
|
|
123
118
|
hint: z.ZodBoolean;
|
|
124
119
|
}, z.core.$strip>;
|
|
125
120
|
export type ActionGadget = z.infer<typeof ActionGadget>;
|
|
@@ -153,6 +148,7 @@ export declare const ActionItem: z.ZodObject<{
|
|
|
153
148
|
goal: "goal";
|
|
154
149
|
skill: "skill";
|
|
155
150
|
source: "source";
|
|
151
|
+
flow: "flow";
|
|
156
152
|
}>>;
|
|
157
153
|
name: z.ZodString;
|
|
158
154
|
path: z.ZodObject<{
|
|
@@ -253,11 +249,6 @@ export declare const ActionItem: z.ZodObject<{
|
|
|
253
249
|
message: z.ZodString;
|
|
254
250
|
callId: z.ZodNullable<z.ZodTemplateLiteral<`call_${string}`>>;
|
|
255
251
|
open: z.ZodNumber;
|
|
256
|
-
level: z.ZodEnum<{
|
|
257
|
-
publish: "publish";
|
|
258
|
-
draft: "draft";
|
|
259
|
-
report: "report";
|
|
260
|
-
}>;
|
|
261
252
|
hint: z.ZodBoolean;
|
|
262
253
|
}, z.core.$strip>>;
|
|
263
254
|
source: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -690,6 +681,7 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
690
681
|
goal: "goal";
|
|
691
682
|
skill: "skill";
|
|
692
683
|
source: "source";
|
|
684
|
+
flow: "flow";
|
|
693
685
|
}>>;
|
|
694
686
|
name: z.ZodString;
|
|
695
687
|
path: z.ZodObject<{
|
|
@@ -790,11 +782,6 @@ export declare const ActionRow: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
790
782
|
message: z.ZodString;
|
|
791
783
|
callId: z.ZodNullable<z.ZodTemplateLiteral<`call_${string}`>>;
|
|
792
784
|
open: z.ZodNumber;
|
|
793
|
-
level: z.ZodEnum<{
|
|
794
|
-
publish: "publish";
|
|
795
|
-
draft: "draft";
|
|
796
|
-
report: "report";
|
|
797
|
-
}>;
|
|
798
785
|
hint: z.ZodBoolean;
|
|
799
786
|
}, z.core.$strip>>;
|
|
800
787
|
source: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
@@ -980,6 +967,7 @@ export declare const ActionList: z.ZodObject<{
|
|
|
980
967
|
goal: "goal";
|
|
981
968
|
skill: "skill";
|
|
982
969
|
source: "source";
|
|
970
|
+
flow: "flow";
|
|
983
971
|
}>>;
|
|
984
972
|
name: z.ZodString;
|
|
985
973
|
path: z.ZodObject<{
|
|
@@ -1080,11 +1068,6 @@ export declare const ActionList: z.ZodObject<{
|
|
|
1080
1068
|
message: z.ZodString;
|
|
1081
1069
|
callId: z.ZodNullable<z.ZodTemplateLiteral<`call_${string}`>>;
|
|
1082
1070
|
open: z.ZodNumber;
|
|
1083
|
-
level: z.ZodEnum<{
|
|
1084
|
-
publish: "publish";
|
|
1085
|
-
draft: "draft";
|
|
1086
|
-
report: "report";
|
|
1087
|
-
}>;
|
|
1088
1071
|
hint: z.ZodBoolean;
|
|
1089
1072
|
}, z.core.$strip>>;
|
|
1090
1073
|
source: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
package/dist/actions/actions.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { TaskColumn } from "../columns/columns.js";
|
|
3
3
|
import { CallId } from "../connectors/connectors.js";
|
|
4
|
-
import { GadgetLevel } from "../gadgets/gadgets.js";
|
|
5
4
|
import { packages } from "../grammar/grammar.js";
|
|
6
5
|
import { Digest, InstructionsLink, Known, KnownText } from "../instructions/instructions.js";
|
|
7
6
|
import { Limit as PageSize } from "../list-input.js";
|
|
@@ -90,8 +89,6 @@ export const ActionGadget = z.object({
|
|
|
90
89
|
callId: CallId.nullable(),
|
|
91
90
|
// How many different problems are open, each counted once however often it happened.
|
|
92
91
|
open: z.number().int(),
|
|
93
|
-
// How far the responsible may go: report, repair as a draft, or repair and publish.
|
|
94
|
-
level: GadgetLevel,
|
|
95
92
|
// Nobody is responsible: the row reaches the publisher only to name one.
|
|
96
93
|
hint: z.boolean(),
|
|
97
94
|
});
|
|
@@ -16,6 +16,7 @@ export declare const ConversationStep: z.ZodObject<{
|
|
|
16
16
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
17
17
|
tool: z.ZodString;
|
|
18
18
|
name: z.ZodNullable<z.ZodString>;
|
|
19
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
19
20
|
status: z.ZodEnum<{
|
|
20
21
|
done: "done";
|
|
21
22
|
running: "running";
|
|
@@ -43,6 +44,7 @@ export declare const ConversationMessage: z.ZodObject<{
|
|
|
43
44
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
44
45
|
tool: z.ZodString;
|
|
45
46
|
name: z.ZodNullable<z.ZodString>;
|
|
47
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
46
48
|
status: z.ZodEnum<{
|
|
47
49
|
done: "done";
|
|
48
50
|
running: "running";
|
|
@@ -181,6 +183,7 @@ export declare const ConversationServerMessage: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
181
183
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
182
184
|
tool: z.ZodString;
|
|
183
185
|
name: z.ZodNullable<z.ZodString>;
|
|
186
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
184
187
|
status: z.ZodEnum<{
|
|
185
188
|
done: "done";
|
|
186
189
|
running: "running";
|
|
@@ -228,6 +231,7 @@ export declare const ConversationServerMessage: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
228
231
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
229
232
|
tool: z.ZodString;
|
|
230
233
|
name: z.ZodNullable<z.ZodString>;
|
|
234
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
231
235
|
status: z.ZodEnum<{
|
|
232
236
|
done: "done";
|
|
233
237
|
running: "running";
|
|
@@ -275,6 +279,7 @@ export declare const ConversationServerMessage: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
275
279
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
276
280
|
tool: z.ZodString;
|
|
277
281
|
name: z.ZodNullable<z.ZodString>;
|
|
282
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
278
283
|
status: z.ZodEnum<{
|
|
279
284
|
done: "done";
|
|
280
285
|
running: "running";
|
|
@@ -320,6 +325,7 @@ export declare const ConversationServerMessage: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
320
325
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
321
326
|
tool: z.ZodString;
|
|
322
327
|
name: z.ZodNullable<z.ZodString>;
|
|
328
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
323
329
|
status: z.ZodEnum<{
|
|
324
330
|
done: "done";
|
|
325
331
|
running: "running";
|
|
@@ -341,6 +347,7 @@ export declare const ConversationServerMessage: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
341
347
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
342
348
|
tool: z.ZodString;
|
|
343
349
|
name: z.ZodNullable<z.ZodString>;
|
|
350
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
344
351
|
status: z.ZodEnum<{
|
|
345
352
|
done: "done";
|
|
346
353
|
running: "running";
|
|
@@ -470,6 +477,7 @@ export declare const ConversationGetAnswer: z.ZodObject<{
|
|
|
470
477
|
stepId: z.ZodTemplateLiteral<`step_${string}`>;
|
|
471
478
|
tool: z.ZodString;
|
|
472
479
|
name: z.ZodNullable<z.ZodString>;
|
|
480
|
+
nodeId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
473
481
|
status: z.ZodEnum<{
|
|
474
482
|
done: "done";
|
|
475
483
|
running: "running";
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { idSchema } from "../ids/ids.js";
|
|
3
3
|
import { Flag, Limit } from "../list-input.js";
|
|
4
4
|
import { AttachmentId, attachmentMaxBytes, attachmentsMax, MessageAttachment, } from "../messages/messages.js";
|
|
5
|
+
import { NodeId } from "../nodes/nodes.js";
|
|
5
6
|
import { OperatorRunTokens } from "../operators/operators.js";
|
|
6
7
|
import { IdempotencyKey } from "../primitives/primitives.js";
|
|
7
8
|
import { UserId } from "../users/users.js";
|
|
@@ -28,6 +29,10 @@ export const ConversationStep = z.object({
|
|
|
28
29
|
tool: z.string().max(200),
|
|
29
30
|
// What it touched, in a few words; null where the call names nothing.
|
|
30
31
|
name: z.string().max(200).nullable(),
|
|
32
|
+
// The node it touched (#1222, E271): its resource's id in the input (`skillId` of
|
|
33
|
+
// `intelligence_skill_update`). The browser names it only where its person may read it. Missing
|
|
34
|
+
// on a step stored before.
|
|
35
|
+
nodeId: NodeId.nullable().optional(),
|
|
31
36
|
status: z.enum(["running", "done", "failed"]),
|
|
32
37
|
startedAt: z.iso.datetime(),
|
|
33
38
|
endedAt: z.iso.datetime().nullable(),
|
package/dist/error/error.js
CHANGED
|
@@ -169,9 +169,47 @@ const dotted = (path) => path.length === 0 ? "its top level" : path.map(String).
|
|
|
169
169
|
// `invalid` for an input its tool's schema refused (#678), at `/api` and `/mcp` alike: each issue
|
|
170
170
|
// with the field's path, Zod's sentence and the form the field expects; a key the schema does not
|
|
171
171
|
// know names the fields that are there instead.
|
|
172
|
+
// The largest `expected` an issue carries (#1230): the schema of a whole union of actions ran to
|
|
173
|
+
// 86 KB, 21,000 tokens for one wrong call. Past this the sentence says enough.
|
|
174
|
+
const maxExpected = 800;
|
|
175
|
+
// A union of objects told apart by `type` (#1230): the branch whose `type` fit is the one meant, so
|
|
176
|
+
// its issues stand for the union's; a `type` no branch knows is one issue naming the kinds. Any
|
|
177
|
+
// other union stays as it is.
|
|
178
|
+
function narrowed(issue) {
|
|
179
|
+
if (issue.code !== "invalid_union" || issue.errors.length === 0)
|
|
180
|
+
return [issue];
|
|
181
|
+
const typeIssue = (inner) => inner.path.length === 1 &&
|
|
182
|
+
inner.path[0] === "type" &&
|
|
183
|
+
(inner.code === "invalid_value" || inner.code === "invalid_union");
|
|
184
|
+
const named = issue.errors.some((branch) => branch.some(typeIssue));
|
|
185
|
+
if (!named)
|
|
186
|
+
return [issue];
|
|
187
|
+
const meant = issue.errors.find((branch) => !branch.some(typeIssue));
|
|
188
|
+
if (meant) {
|
|
189
|
+
return meant.flatMap((inner) => narrowed({ ...inner, path: [...issue.path, ...inner.path] }));
|
|
190
|
+
}
|
|
191
|
+
const kinds = [
|
|
192
|
+
...new Set(issue.errors.flatMap((branch) => branch.flatMap((inner) => {
|
|
193
|
+
if (!typeIssue(inner))
|
|
194
|
+
return [];
|
|
195
|
+
if (inner.code === "invalid_value")
|
|
196
|
+
return inner.values.map(String);
|
|
197
|
+
const options = inner.options;
|
|
198
|
+
return Array.isArray(options) ? options.map(String) : [];
|
|
199
|
+
}))),
|
|
200
|
+
];
|
|
201
|
+
return [
|
|
202
|
+
{
|
|
203
|
+
code: "custom",
|
|
204
|
+
path: [...issue.path, "type"],
|
|
205
|
+
message: `Unknown type; it is one of: ${kinds.join(", ")}.`,
|
|
206
|
+
input: undefined,
|
|
207
|
+
},
|
|
208
|
+
];
|
|
209
|
+
}
|
|
172
210
|
export function invalidInput(schema, error) {
|
|
173
211
|
const root = jsonSchemaOf(schema);
|
|
174
|
-
const issues = error.issues.map((issue) => {
|
|
212
|
+
const issues = error.issues.flatMap(narrowed).map((issue) => {
|
|
175
213
|
const path = issue.path.map((part) => (typeof part === "symbol" ? String(part) : part));
|
|
176
214
|
if (issue.code === "unrecognized_keys") {
|
|
177
215
|
const fields = root ? fieldsAt(root, path) : [];
|
|
@@ -182,8 +220,15 @@ export function invalidInput(schema, error) {
|
|
|
182
220
|
: issue.message,
|
|
183
221
|
};
|
|
184
222
|
}
|
|
185
|
-
const expected = root ? schemaAt(root, path) : undefined;
|
|
186
|
-
|
|
223
|
+
const expected = root && issue.code !== "custom" ? schemaAt(root, path) : undefined;
|
|
224
|
+
const fits = expected !== undefined && JSON.stringify(expected).length <= maxExpected;
|
|
225
|
+
// A missing field says so in one sentence (#1230); its form stands in `expected`.
|
|
226
|
+
const missing = issue.code === "invalid_type" && issue.message.endsWith("received undefined");
|
|
227
|
+
return {
|
|
228
|
+
path,
|
|
229
|
+
message: missing ? `${dotted(path)} is missing.` : issue.message,
|
|
230
|
+
...(fits && { expected }),
|
|
231
|
+
};
|
|
187
232
|
});
|
|
188
233
|
const places = [...new Set(issues.map((issue) => dotted(issue.path)))];
|
|
189
234
|
const hint = idKeyHint(root, error);
|