@anchrd/colab-sdk 0.1.32 → 0.1.34

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.
Files changed (52) hide show
  1. package/README.md +3 -1
  2. package/dist/actions/actions.d.ts +46 -17
  3. package/dist/actions/actions.js +10 -0
  4. package/dist/archive/archive.d.ts +10 -0
  5. package/dist/archive/archive.js +9 -0
  6. package/dist/boards/boards.d.ts +29 -25
  7. package/dist/boards/boards.js +3 -2
  8. package/dist/card-kinds/card-kinds.d.ts +5 -5
  9. package/dist/columns/columns.d.ts +2 -2
  10. package/dist/connectors/connectors.d.ts +121 -3
  11. package/dist/connectors/connectors.js +6 -2
  12. package/dist/crawls/crawls.d.ts +3 -3
  13. package/dist/documents/documents.d.ts +4 -0
  14. package/dist/documents/documents.js +3 -2
  15. package/dist/error/error.d.ts +2 -0
  16. package/dist/error/error.js +35 -2
  17. package/dist/files/files.d.ts +4 -0
  18. package/dist/files/files.js +3 -2
  19. package/dist/gadgets/gadgets.d.ts +143 -12
  20. package/dist/gadgets/gadgets.js +60 -12
  21. package/dist/goals/goals.d.ts +19 -0
  22. package/dist/goals/goals.js +10 -5
  23. package/dist/grammar/grammar.d.ts +2 -1
  24. package/dist/grammar/grammar.js +9 -3
  25. package/dist/mcps/mcps.d.ts +41 -3
  26. package/dist/mcps/mcps.js +53 -3
  27. package/dist/nodes/nodes.d.ts +21 -9
  28. package/dist/nodes/nodes.js +16 -2
  29. package/dist/operators/operators.js +1 -1
  30. package/dist/organisation/organisation.d.ts +45 -0
  31. package/dist/organisation/organisation.js +45 -0
  32. package/dist/profile/profile.d.ts +3 -3
  33. package/dist/profile/profile.js +3 -2
  34. package/dist/providers/providers.d.ts +128 -0
  35. package/dist/providers/providers.js +118 -0
  36. package/dist/runs/runs.d.ts +3 -3
  37. package/dist/runtime-config.d.ts +12 -0
  38. package/dist/runtime-config.js +10 -0
  39. package/dist/sdk.d.ts +5 -4
  40. package/dist/sdk.js +5 -4
  41. package/dist/skills/skills.d.ts +4 -0
  42. package/dist/skills/skills.js +3 -2
  43. package/dist/sources/sources.d.ts +47 -4
  44. package/dist/sources/sources.js +8 -3
  45. package/dist/tables/tables.d.ts +4 -0
  46. package/dist/tables/tables.js +3 -2
  47. package/dist/versions/versions.d.ts +13 -13
  48. package/dist/written/written.d.ts +6 -2
  49. package/dist/written/written.js +2 -2
  50. package/package.json +1 -1
  51. package/dist/sso/sso.d.ts +0 -71
  52. package/dist/sso/sso.js +0 -59
@@ -1,6 +1,10 @@
1
1
  import { z } from "zod";
2
2
  export declare const DocumentCreateInput: z.ZodObject<{
3
3
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
4
+ section: z.ZodOptional<z.ZodEnum<{
5
+ own: "own";
6
+ shared: "shared";
7
+ }>>;
4
8
  name: z.ZodString;
5
9
  content: z.ZodString;
6
10
  idempotencyKey: z.ZodString;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ExcerptCursor, TextExcerpt } from "../excerpt/excerpt.js";
3
3
  import { InstructionsRead, Known } from "../instructions/instructions.js";
4
- import { NodeId, NodePath, NodePerson, SecretFields } from "../nodes/nodes.js";
4
+ import { CreateSection, NodeId, NodePath, NodePerson, SecretFields } from "../nodes/nodes.js";
5
5
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
6
6
  // Documents (#39, Nodes › Dokument, E36, E59): the inputs of `intelligence_document_create`, `_get`
7
7
  // and `_update`, and their answer. A document is Markdown and is stored as Markdown, never as editor
@@ -14,7 +14,8 @@ const Content = z
14
14
  .describe("The whole document as Markdown, at most 1 MB in UTF-8. A front matter at the top stays as written. Images only by URL, links to other nodes in the text (`[Name](/n/node_…)`).");
15
15
  export const DocumentCreateInput = z.strictObject({
16
16
  // ⚠️ Required and nullable (trap C015): null is the top level of Shared.
17
- parentId: NodeId.nullable().describe("The folder to create the document in, one you can write to; null creates it on the top level of Shared, visible to you until you share it. An INSTRUCTIONS document needs a folder."),
17
+ parentId: NodeId.nullable().describe("The folder to create the document in, one you can write to; null creates it in your own root folder (Own), or on the top level of Shared with section shared, where only you see it until you share it. An INSTRUCTIONS document needs a folder."),
18
+ section: CreateSection,
18
19
  name: z
19
20
  .string()
20
21
  .max(200)
@@ -86,6 +86,8 @@ export declare const Warning: z.ZodObject<{
86
86
  mail_failed: "mail_failed";
87
87
  unused: "unused";
88
88
  too_long: "too_long";
89
+ goal_link: "goal_link";
90
+ unchanged: "unchanged";
89
91
  }>;
90
92
  message: z.ZodString;
91
93
  }, z.core.$strip>;
@@ -132,6 +132,28 @@ function jsonSchemaOf(schema) {
132
132
  return null;
133
133
  }
134
134
  }
135
+ // The generic id keys an AI sends out of habit, where a tool takes the id under its own name (#959).
136
+ const genericIdKeys = new Set(["nodeId", "id"]);
137
+ const ownIdKey = /^[a-z]+Id$/;
138
+ // "Unknown key nodeId; this tool takes documentId." when the top level got a generic id key and the
139
+ // tool requires exactly one `<resource>Id`. Only the sentence: the input stays refused, there is no
140
+ // silent alias (E64, `z.strictObject`).
141
+ function idKeyHint(root, error) {
142
+ if (!root || !Array.isArray(root.required))
143
+ return null;
144
+ // A tool that takes `nodeId` itself wants it, not its other id (`parentId` of a move, `userId` of
145
+ // a share): a hint there would name the wrong key.
146
+ if (root.required.some((key) => genericIdKeys.has(key)))
147
+ return null;
148
+ const own = root.required.filter((key) => typeof key === "string" && ownIdKey.test(key) && !genericIdKeys.has(key));
149
+ if (own.length !== 1)
150
+ return null;
151
+ const sent = error.issues
152
+ .filter((issue) => issue.code === "unrecognized_keys" && issue.path.length === 0)
153
+ .flatMap((issue) => (issue.code === "unrecognized_keys" ? issue.keys : []))
154
+ .find((key) => genericIdKeys.has(key));
155
+ return sent ? `Unknown key ${sent}; this tool takes ${own[0]}.` : null;
156
+ }
135
157
  const dotted = (path) => path.length === 0 ? "its top level" : path.map(String).join(".");
136
158
  // `invalid` for an input its tool's schema refused (#678), at `/api` and `/mcp` alike: each issue
137
159
  // with the field's path, Zod's sentence and the form the field expects; a key the schema does not
@@ -153,10 +175,11 @@ export function invalidInput(schema, error) {
153
175
  return { path, message: issue.message, ...(expected && { expected }) };
154
176
  });
155
177
  const places = [...new Set(issues.map((issue) => dotted(issue.path)))];
178
+ const hint = idKeyHint(root, error);
156
179
  return {
157
180
  error: {
158
181
  code: "invalid",
159
- message: `The input does not match the schema at ${places.join(", ")}: issues name what each expects. Nothing was done.`,
182
+ message: `${hint ? `${hint} ` : ""}The input does not match the schema at ${places.join(", ")}: issues name what each expects. Nothing was done.`,
160
183
  issues,
161
184
  },
162
185
  };
@@ -170,7 +193,17 @@ export function invalidInput(schema, error) {
170
193
  // - `mail_failed`: the mail of an invitation was not accepted (#743); the invitation stands.
171
194
  // - `unused`: a credential that no Operator uses yet (#676).
172
195
  // - `too_long`: an INSTRUCTIONS was saved with more words than an AI follows reliably (E67, #675).
196
+ // - `unchanged`: the call asked for what stands already and wrote nothing; the sentence says what
197
+ // holds and where it comes from (a share, #957).
173
198
  export const Warning = z.object({
174
- code: z.enum(["followup_failed", "test_failed", "mail_failed", "unused", "too_long"]),
199
+ code: z.enum([
200
+ "followup_failed",
201
+ "test_failed",
202
+ "mail_failed",
203
+ "unused",
204
+ "too_long",
205
+ "goal_link",
206
+ "unchanged",
207
+ ]),
175
208
  message: z.string(),
176
209
  });
@@ -10,6 +10,10 @@ export declare const uploadTicketLifetimeMs: number;
10
10
  export declare const SourceUrl: z.ZodString;
11
11
  export declare const FileCreateInput: z.ZodObject<{
12
12
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
13
+ section: z.ZodOptional<z.ZodEnum<{
14
+ own: "own";
15
+ shared: "shared";
16
+ }>>;
13
17
  name: z.ZodOptional<z.ZodString>;
14
18
  mediaType: z.ZodOptional<z.ZodString>;
15
19
  size: z.ZodOptional<z.ZodNumber>;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ExcerptCursor, TextExcerpt } from "../excerpt/excerpt.js";
3
3
  import { idSchema } from "../ids/ids.js";
4
- import { NodeId } from "../nodes/nodes.js";
4
+ import { CreateSection, NodeId } from "../nodes/nodes.js";
5
5
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
6
6
  import { VersionId } from "../versions/versions.js";
7
7
  // Files (#41, Nodes › Datei, E47): the inputs of `intelligence_file_create`, `_get` and `_update`,
@@ -104,7 +104,8 @@ export const SourceUrl = z
104
104
  export const FileCreateInput = z
105
105
  .strictObject({
106
106
  // ⚠️ Required and nullable (trap C015): null is the top level of Shared, like a folder.
107
- parentId: NodeId.nullable().describe("The folder to put the file in, one you can write to; null puts it on the top level of Shared, visible to you until you share it."),
107
+ parentId: NodeId.nullable().describe("The folder to put the file in, one you can write to; null puts it in your own root folder (Own), or on the top level of Shared with section shared, where only you see it until you share it."),
108
+ section: CreateSection,
108
109
  // Required for an upload, optional with `sourceUrl`; the refinement below says so.
109
110
  name: FileName.optional(),
110
111
  mediaType: MediaType.optional(),
@@ -34,6 +34,10 @@ export type GadgetLevel = z.infer<typeof GadgetLevel>;
34
34
  export declare const gadgetLogDays: readonly [7, 14, 30];
35
35
  export declare const GadgetCreateInput: z.ZodObject<{
36
36
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
37
+ section: z.ZodOptional<z.ZodEnum<{
38
+ own: "own";
39
+ shared: "shared";
40
+ }>>;
37
41
  name: z.ZodString;
38
42
  files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
39
43
  idempotencyKey: z.ZodString;
@@ -172,6 +176,18 @@ export declare const GadgetSettings: z.ZodObject<{
172
176
  logDays: z.ZodNumber;
173
177
  }, z.core.$strip>;
174
178
  export type GadgetSettings = z.infer<typeof GadgetSettings>;
179
+ export declare const GadgetToolUse: z.ZodObject<{
180
+ name: z.ZodString;
181
+ durationMs: z.ZodNumber;
182
+ code: z.ZodNullable<z.ZodEnum<{
183
+ not_found: "not_found";
184
+ invalid: "invalid";
185
+ conflict: "conflict";
186
+ unauthenticated: "unauthenticated";
187
+ unavailable: "unavailable";
188
+ }>>;
189
+ }, z.core.$strip>;
190
+ export type GadgetToolUse = z.infer<typeof GadgetToolUse>;
175
191
  export declare const GadgetTestResult: z.ZodObject<{
176
192
  file: z.ZodString;
177
193
  path: z.ZodArray<z.ZodString>;
@@ -187,8 +203,59 @@ export declare const GadgetTestResult: z.ZodObject<{
187
203
  line: z.ZodNumber;
188
204
  column: z.ZodNumber;
189
205
  }, z.core.$strip>>;
206
+ calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
207
+ name: z.ZodString;
208
+ durationMs: z.ZodNumber;
209
+ code: z.ZodNullable<z.ZodEnum<{
210
+ not_found: "not_found";
211
+ invalid: "invalid";
212
+ conflict: "conflict";
213
+ unauthenticated: "unauthenticated";
214
+ unavailable: "unavailable";
215
+ }>>;
216
+ }, z.core.$strip>>>;
190
217
  }, z.core.$strip>;
191
218
  export type GadgetTestResult = z.infer<typeof GadgetTestResult>;
219
+ export declare const GadgetTestHooks: z.ZodObject<{
220
+ file: z.ZodString;
221
+ durationMs: z.ZodNumber;
222
+ calls: z.ZodArray<z.ZodObject<{
223
+ name: z.ZodString;
224
+ durationMs: z.ZodNumber;
225
+ code: z.ZodNullable<z.ZodEnum<{
226
+ not_found: "not_found";
227
+ invalid: "invalid";
228
+ conflict: "conflict";
229
+ unauthenticated: "unauthenticated";
230
+ unavailable: "unavailable";
231
+ }>>;
232
+ }, z.core.$strip>>;
233
+ }, z.core.$strip>;
234
+ export type GadgetTestHooks = z.infer<typeof GadgetTestHooks>;
235
+ export declare const testLimits: {
236
+ readonly testMs: 30000;
237
+ readonly testTools: 50;
238
+ readonly fileMs: 120000;
239
+ readonly fileCpuMs: 10000;
240
+ readonly fileMemoryMb: 128;
241
+ readonly filesAtOnce: 5;
242
+ readonly runMs: 300000;
243
+ readonly hooksMs: 60000;
244
+ readonly hooksTools: 100;
245
+ };
246
+ export declare const TestLimits: z.ZodObject<{
247
+ testMs: z.ZodNumber;
248
+ testTools: z.ZodNumber;
249
+ fileMs: z.ZodNumber;
250
+ fileCpuMs: z.ZodNumber;
251
+ fileMemoryMb: z.ZodNumber;
252
+ filesAtOnce: z.ZodNumber;
253
+ runMs: z.ZodNumber;
254
+ hooksMs: z.ZodNumber;
255
+ hooksTools: z.ZodNumber;
256
+ }, z.core.$strip>;
257
+ export type TestLimits = z.infer<typeof TestLimits>;
258
+ export declare const testLimitsText: string;
192
259
  export declare const GadgetTestRun: z.ZodObject<{
193
260
  version: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"draft">]>;
194
261
  current: z.ZodBoolean;
@@ -228,7 +295,45 @@ export declare const GadgetTestRun: z.ZodObject<{
228
295
  line: z.ZodNumber;
229
296
  column: z.ZodNumber;
230
297
  }, z.core.$strip>>;
298
+ calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
299
+ name: z.ZodString;
300
+ durationMs: z.ZodNumber;
301
+ code: z.ZodNullable<z.ZodEnum<{
302
+ not_found: "not_found";
303
+ invalid: "invalid";
304
+ conflict: "conflict";
305
+ unauthenticated: "unauthenticated";
306
+ unavailable: "unavailable";
307
+ }>>;
308
+ }, z.core.$strip>>>;
231
309
  }, z.core.$strip>>;
310
+ hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
311
+ file: z.ZodString;
312
+ durationMs: z.ZodNumber;
313
+ calls: z.ZodArray<z.ZodObject<{
314
+ name: z.ZodString;
315
+ durationMs: z.ZodNumber;
316
+ code: z.ZodNullable<z.ZodEnum<{
317
+ not_found: "not_found";
318
+ invalid: "invalid";
319
+ conflict: "conflict";
320
+ unauthenticated: "unauthenticated";
321
+ unavailable: "unavailable";
322
+ }>>;
323
+ }, z.core.$strip>>;
324
+ }, z.core.$strip>>>;
325
+ note: z.ZodOptional<z.ZodString>;
326
+ limits: z.ZodObject<{
327
+ testMs: z.ZodNumber;
328
+ testTools: z.ZodNumber;
329
+ fileMs: z.ZodNumber;
330
+ fileCpuMs: z.ZodNumber;
331
+ fileMemoryMb: z.ZodNumber;
332
+ filesAtOnce: z.ZodNumber;
333
+ runMs: z.ZodNumber;
334
+ hooksMs: z.ZodNumber;
335
+ hooksTools: z.ZodNumber;
336
+ }, z.core.$strip>;
232
337
  }, z.core.$strip>;
233
338
  export type GadgetTestRun = z.infer<typeof GadgetTestRun>;
234
339
  export declare const GadgetDetail: z.ZodObject<{
@@ -332,7 +437,45 @@ export declare const GadgetDetail: z.ZodObject<{
332
437
  line: z.ZodNumber;
333
438
  column: z.ZodNumber;
334
439
  }, z.core.$strip>>;
440
+ calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
441
+ name: z.ZodString;
442
+ durationMs: z.ZodNumber;
443
+ code: z.ZodNullable<z.ZodEnum<{
444
+ not_found: "not_found";
445
+ invalid: "invalid";
446
+ conflict: "conflict";
447
+ unauthenticated: "unauthenticated";
448
+ unavailable: "unavailable";
449
+ }>>;
450
+ }, z.core.$strip>>>;
335
451
  }, z.core.$strip>>;
452
+ hooks: z.ZodOptional<z.ZodArray<z.ZodObject<{
453
+ file: z.ZodString;
454
+ durationMs: z.ZodNumber;
455
+ calls: z.ZodArray<z.ZodObject<{
456
+ name: z.ZodString;
457
+ durationMs: z.ZodNumber;
458
+ code: z.ZodNullable<z.ZodEnum<{
459
+ not_found: "not_found";
460
+ invalid: "invalid";
461
+ conflict: "conflict";
462
+ unauthenticated: "unauthenticated";
463
+ unavailable: "unavailable";
464
+ }>>;
465
+ }, z.core.$strip>>;
466
+ }, z.core.$strip>>>;
467
+ note: z.ZodOptional<z.ZodString>;
468
+ limits: z.ZodObject<{
469
+ testMs: z.ZodNumber;
470
+ testTools: z.ZodNumber;
471
+ fileMs: z.ZodNumber;
472
+ fileCpuMs: z.ZodNumber;
473
+ fileMemoryMb: z.ZodNumber;
474
+ filesAtOnce: z.ZodNumber;
475
+ runMs: z.ZodNumber;
476
+ hooksMs: z.ZodNumber;
477
+ hooksTools: z.ZodNumber;
478
+ }, z.core.$strip>;
336
479
  }, z.core.$strip>>;
337
480
  usage: z.ZodNullable<z.ZodObject<{
338
481
  calls: z.ZodNumber;
@@ -362,18 +505,6 @@ export declare const GadgetDetail: z.ZodObject<{
362
505
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
363
506
  }, z.core.$strip>;
364
507
  export type GadgetDetail = z.infer<typeof GadgetDetail>;
365
- export declare const GadgetToolUse: z.ZodObject<{
366
- name: z.ZodString;
367
- durationMs: z.ZodNumber;
368
- code: z.ZodNullable<z.ZodEnum<{
369
- not_found: "not_found";
370
- invalid: "invalid";
371
- conflict: "conflict";
372
- unauthenticated: "unauthenticated";
373
- unavailable: "unavailable";
374
- }>>;
375
- }, z.core.$strip>;
376
- export type GadgetToolUse = z.infer<typeof GadgetToolUse>;
377
508
  export declare const GadgetConsoleLine: z.ZodObject<{
378
509
  level: z.ZodEnum<{
379
510
  error: "error";
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { ErrorCode } from "../error/error.js";
3
3
  import { idSchema } from "../ids/ids.js";
4
4
  import { Limit } from "../list-input.js";
5
- import { NodeId, NodePath, NodePerson } from "../nodes/nodes.js";
5
+ import { CreateSection, NodeId, NodePath, NodePerson } from "../nodes/nodes.js";
6
6
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
7
7
  import { UserId } from "../users/users.js";
8
8
  // Gadgets (#642, E118, Nodes › Gadget): a small application an AI builds and Colab runs. Its files
@@ -59,8 +59,9 @@ const LogDays = z
59
59
  .describe("How many days the log keeps a call: 7, 14 or 30.");
60
60
  const FileContent = z.string().describe("The file's whole text.");
61
61
  export const GadgetCreateInput = z.strictObject({
62
- // ⚠️ Required and nullable (trap C015): null is the top level of Shared.
63
- parentId: NodeId.nullable().describe("The folder to create the gadget in, one you can write to; null creates it on the top level of Shared, visible to you until you share it."),
62
+ // ⚠️ Required and nullable (trap C015): null is the caller's own root folder (#791).
63
+ parentId: NodeId.nullable().describe("The folder to create the gadget in, one you can write to; null creates it in your own root folder (Own), or on the top level of Shared with section shared, where only you see it until you share it."),
64
+ section: CreateSection,
64
65
  name: z
65
66
  .string()
66
67
  .max(200)
@@ -112,7 +113,7 @@ export const GadgetPublishInput = z.strictObject({
112
113
  force: z
113
114
  .literal(true)
114
115
  .optional()
115
- .describe("Publish although tests fail. Never for a machine: an Operator publishes only with every test green. A draft with tests needs a run of exactly its state first (intelligence_gadget_test); without one the publish starts the tests and refuses until they ended."),
116
+ .describe("Publish although tests fail. Never for a machine: an Operator publishes only with every test green. A draft with tests needs a run of exactly its state first (intelligence_gadget_test); without one the publish starts the tests and refuses until they ended. Follow a running one with intelligence_gadget_get."),
116
117
  rev: Rev,
117
118
  });
118
119
  export const GadgetTestInput = z.strictObject({
@@ -120,7 +121,7 @@ export const GadgetTestInput = z.strictObject({
120
121
  version: z
121
122
  .enum(["live", "draft"])
122
123
  .optional()
123
- .describe("Which state to test: draft (the default when there is one) or live. Tests run with your own rights against a storage of their own, never live's. The answer is the run once it ended within 20 seconds, else the run as running: it goes on in the background, and intelligence_gadget_get shows it under test once it ended."),
124
+ .describe("Which state to test: draft (the default when there is one) or live. Tests run with your own rights against a storage of their own, never live's. The answer is the run once it ended within 20 seconds, else the run as running: it goes on in the background, and intelligence_gadget_get shows it under test once it ended. Follow it there, not with another test, which after the end starts a new run."),
124
125
  });
125
126
  // The log's filters (#643, Nodes › Gadget › Konsole › Log).
126
127
  export const GadgetCallStatus = z.enum(["succeeded", "failed"]);
@@ -192,6 +193,13 @@ export const GadgetSettings = z.object({
192
193
  level: GadgetLevel,
193
194
  logDays: z.number().int(),
194
195
  });
196
+ // One use of the `colab` binding during a call: which tool, how long, and the error code it answered
197
+ // with (null when it answered).
198
+ export const GadgetToolUse = z.object({
199
+ name: z.string(),
200
+ durationMs: z.number().int(),
201
+ code: ErrorCode.nullable(),
202
+ });
195
203
  // One test of a run (#643): where it stands (its file and the names of the describes around it), how
196
204
  // it ended, and for a failure the message and the place in the test file.
197
205
  export const GadgetTestResult = z.object({
@@ -204,7 +212,48 @@ export const GadgetTestResult = z.object({
204
212
  location: z
205
213
  .object({ file: z.string(), line: z.number().int(), column: z.number().int() })
206
214
  .nullable(),
215
+ // A gadget's test (#949): the tools it called, each with its duration, as the log of a call has
216
+ // them. A connector's or a source's test has none.
217
+ calls: z.array(GadgetToolUse).optional(),
218
+ });
219
+ // The `beforeAll` and `afterAll` of one test file of a gadget (#949): how long they took together
220
+ // and the tools they called. Only for a file that has either.
221
+ export const GadgetTestHooks = z.object({
222
+ file: z.string(),
223
+ durationMs: z.number().int(),
224
+ calls: z.array(GadgetToolUse),
225
+ });
226
+ // The limits of a run of the tests of a gadget, a connector or a source (#937): the one place they
227
+ // stand. Every test file runs as a job of its own in a fresh isolate; the hosts, the descriptions of
228
+ // the three test tools, the field `limits` of every run and the customer pages read them from here.
229
+ // `testTools` counts for a gadget's tests only, whose `colab` has the budget of a live call (E150).
230
+ // `hooksMs` and `hooksTools` are the budget of a file's `beforeAll` and `afterAll` together (#949),
231
+ // apart from every test's: a file builds its data once instead of in every test.
232
+ // The memory is Cloudflare's per isolate and set nowhere in Colab; it stands here so it is named.
233
+ export const testLimits = {
234
+ testMs: 30_000,
235
+ testTools: 50,
236
+ fileMs: 120_000,
237
+ fileCpuMs: 10_000,
238
+ fileMemoryMb: 128,
239
+ filesAtOnce: 5,
240
+ runMs: 300_000,
241
+ hooksMs: 60_000,
242
+ hooksTools: 100,
243
+ };
244
+ export const TestLimits = z.object({
245
+ testMs: z.number().int(),
246
+ testTools: z.number().int(),
247
+ fileMs: z.number().int(),
248
+ fileCpuMs: z.number().int(),
249
+ fileMemoryMb: z.number().int(),
250
+ filesAtOnce: z.number().int(),
251
+ runMs: z.number().int(),
252
+ hooksMs: z.number().int(),
253
+ hooksTools: z.number().int(),
207
254
  });
255
+ // The limits in one sentence, for the descriptions of the test tools (#937).
256
+ export const testLimitsText = `Every test file runs on its own, in a fresh isolate with ${testLimits.fileMemoryMb} MB, at most ${testLimits.fileMs / 1000} seconds and ${testLimits.fileCpuMs / 1000} seconds of CPU; ${testLimits.filesAtOnce} files run at once, the whole run at most ${testLimits.runMs / 1000} seconds. Each test has ${testLimits.testMs / 1000} seconds, a gadget's test ${testLimits.testTools} tools. beforeAll and afterAll of a file have ${testLimits.hooksMs / 1000} seconds together, in a gadget ${testLimits.hooksTools} tools, apart from the tests'. A file that breaks off is red with its reason; the others still count. The answer names these limits under limits.`;
208
257
  // A run of a gadget's tests (#643, Nodes › Gadget › Konsole › Tests). `running` (#888, E150): the run
209
258
  // goes on in the queue after `intelligence_gadget_test` answered; `at` is when it started, the
210
259
  // counts are 0 and `tests` empty until `intelligence_gadget_get` shows it ended.
@@ -222,6 +271,12 @@ export const GadgetTestRun = z.object({
222
271
  // The run itself broke: a test file did not load, or the run took too long.
223
272
  error: z.object({ message: z.string(), stack: z.string().optional() }).nullable(),
224
273
  tests: z.array(GadgetTestResult),
274
+ // A gadget's files with `beforeAll` or `afterAll` (#949).
275
+ hooks: z.array(GadgetTestHooks).optional(),
276
+ // Only in the answer of `intelligence_gadget_test` to a run still going (#913): where to follow it.
277
+ note: z.string().optional(),
278
+ // The limits the run is held to (#937), the same for a gadget, a connector and a source.
279
+ limits: TestLimits,
225
280
  });
226
281
  export const GadgetDetail = z.object({
227
282
  gadgetId: GadgetId,
@@ -272,13 +327,6 @@ export const GadgetDetail = z.object({
272
327
  rev: z.number().int(),
273
328
  archivedAt: z.iso.datetime().nullable(),
274
329
  });
275
- // One use of the `colab` binding during a call: which tool, how long, and the error code it answered
276
- // with (null when it answered).
277
- export const GadgetToolUse = z.object({
278
- name: z.string(),
279
- durationMs: z.number().int(),
280
- code: ErrorCode.nullable(),
281
- });
282
330
  export const GadgetConsoleLine = z.object({
283
331
  level: z.enum(["log", "info", "warn", "error", "debug"]),
284
332
  text: z.string(),
@@ -62,6 +62,10 @@ export declare const GoalCreateInput: z.ZodObject<{
62
62
  }>>;
63
63
  reportToId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>>;
64
64
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
65
+ section: z.ZodOptional<z.ZodEnum<{
66
+ own: "own";
67
+ shared: "shared";
68
+ }>>;
65
69
  name: z.ZodString;
66
70
  content: z.ZodString;
67
71
  }, z.core.$strict>;
@@ -195,6 +199,10 @@ export declare const GoalCheck: z.ZodObject<{
195
199
  name: z.ZodString;
196
200
  tools: z.ZodArray<z.ZodString>;
197
201
  }, z.core.$strip>>;
202
+ via: z.ZodNullable<z.ZodObject<{
203
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
204
+ name: z.ZodString;
205
+ }, z.core.$strip>>;
198
206
  }, z.core.$strip>;
199
207
  export type GoalCheck = z.infer<typeof GoalCheck>;
200
208
  export declare const GoalReady: z.ZodObject<{
@@ -266,6 +274,10 @@ export declare const GoalReady: z.ZodObject<{
266
274
  name: z.ZodString;
267
275
  tools: z.ZodArray<z.ZodString>;
268
276
  }, z.core.$strip>>;
277
+ via: z.ZodNullable<z.ZodObject<{
278
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
279
+ name: z.ZodString;
280
+ }, z.core.$strip>>;
269
281
  }, z.core.$strip>>;
270
282
  questionCostUsd: z.ZodNullable<z.ZodNumber>;
271
283
  }, z.core.$strip>;
@@ -311,6 +323,7 @@ export declare const GoalSession: z.ZodObject<{
311
323
  mention: "mention";
312
324
  play: "play";
313
325
  followup: "followup";
326
+ reminder: "reminder";
314
327
  }>;
315
328
  at: z.ZodISODateTime;
316
329
  by: z.ZodNullable<z.ZodObject<{
@@ -504,6 +517,7 @@ export declare const GoalRunDetail: z.ZodObject<{
504
517
  mention: "mention";
505
518
  play: "play";
506
519
  followup: "followup";
520
+ reminder: "reminder";
507
521
  }>;
508
522
  at: z.ZodISODateTime;
509
523
  by: z.ZodNullable<z.ZodObject<{
@@ -787,6 +801,10 @@ export declare const GoalDetail: z.ZodObject<{
787
801
  name: z.ZodString;
788
802
  tools: z.ZodArray<z.ZodString>;
789
803
  }, z.core.$strip>>;
804
+ via: z.ZodNullable<z.ZodObject<{
805
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
806
+ name: z.ZodString;
807
+ }, z.core.$strip>>;
790
808
  }, z.core.$strip>>;
791
809
  questionCostUsd: z.ZodNullable<z.ZodNumber>;
792
810
  }, z.core.$strip>;
@@ -860,6 +878,7 @@ export declare const GoalDetail: z.ZodObject<{
860
878
  mention: "mention";
861
879
  play: "play";
862
880
  followup: "followup";
881
+ reminder: "reminder";
863
882
  }>;
864
883
  at: z.ZodISODateTime;
865
884
  by: z.ZodNullable<z.ZodObject<{
@@ -3,7 +3,7 @@ import { idSchema } from "../ids/ids.js";
3
3
  import { Limit } from "../list-input.js";
4
4
  import { Message } from "../messages/messages.js";
5
5
  import { Missing } from "../missing/missing.js";
6
- import { NodeId, NodeKind, NodePath, NodePerson } from "../nodes/nodes.js";
6
+ import { CreateSection, NodeId, NodeKind, NodePath, NodePerson } from "../nodes/nodes.js";
7
7
  import { IdempotencyKey, Rev } from "../primitives/primitives.js";
8
8
  import { Schedule } from "../schedule/schedule.js";
9
9
  import { UserId } from "../users/users.js";
@@ -51,8 +51,9 @@ const GoalFieldsInput = {
51
51
  .describe("Who gets the report of every run, someone who can read the goal; null for nobody."),
52
52
  };
53
53
  export const GoalCreateInput = z.strictObject({
54
- // ⚠️ Required and nullable (trap C015): null is the top level of Shared.
55
- parentId: NodeId.nullable().describe("The folder to create the goal in, one you can write to; null creates it on the top level of Shared."),
54
+ // ⚠️ Required and nullable (trap C015): null is the caller's own root folder (#791).
55
+ parentId: NodeId.nullable().describe("The folder to create the goal in, one you can write to; null creates it in your own root folder (Own), or on the top level of Shared with section shared, where only you see it until you share it."),
56
+ section: CreateSection,
56
57
  name: z.string().max(200).describe("The name as people read it, like `Monatsbericht`."),
57
58
  content: Content,
58
59
  ...GoalFieldsInput,
@@ -97,6 +98,9 @@ export const GoalCheck = z.object({
97
98
  connector: z
98
99
  .object({ connectorId: z.string(), name: z.string(), tools: z.array(z.string()) })
99
100
  .nullable(),
101
+ // A reference a skill links rather than the goal (#956): that skill, which the goal links or the
102
+ // Operator runs every goal by. Null for everything the goal names itself.
103
+ via: z.object({ nodeId: NodeId, name: z.string() }).nullable(),
100
104
  });
101
105
  export const GoalReady = z.object({
102
106
  // Green: nothing is red, Play may start a run.
@@ -141,10 +145,11 @@ export const GoalFollowUp = z.object({
141
145
  by: NodePerson,
142
146
  });
143
147
  // One time the Operator was woken for the run: by the rhythm or Play that started it, a mention in
144
- // the goal's chat, or its follow-up.
148
+ // the goal's chat, its follow-up, or Colab's reminder that the run has no plan or is not closed
149
+ // (#914).
145
150
  export const GoalSession = z.object({
146
151
  number: z.int(),
147
- trigger: z.enum(["rhythm", "play", "mention", "followup"]),
152
+ trigger: z.enum(["rhythm", "play", "mention", "followup", "reminder"]),
148
153
  at: z.iso.datetime(),
149
154
  // Who mentioned the Operator, or started the run; null for the rhythm and the follow-up.
150
155
  by: NodePerson.nullable(),
@@ -32,7 +32,7 @@ export declare const resources: {
32
32
  readonly event: "events";
33
33
  readonly page: "pages";
34
34
  readonly credential: "credentials";
35
- readonly sso: "sso";
35
+ readonly provider: "providers";
36
36
  readonly secret: "secrets";
37
37
  readonly step: "steps";
38
38
  readonly crawl: "crawls";
@@ -40,6 +40,7 @@ export declare const resources: {
40
40
  readonly source: "sources";
41
41
  readonly query: "queries";
42
42
  readonly item: "items";
43
+ readonly organisation: "organisations";
43
44
  };
44
45
  export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
45
46
  export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel"];
@@ -55,9 +55,9 @@ export const resources = {
55
55
  // a package word (every word stands in one list only), and not `account`, the prefix of Better
56
56
  // Auth's linked sign-in accounts in `access` (`account_…`, PR #351).
57
57
  credential: "credentials",
58
- // A sign-in provider set up under Einstellungen › SSO (#358, E90): `access_sso_*`, named by the
59
- // ticket. An abbreviation without a plural, so the URL keeps it: `/api/access/sso/:ssoId`.
60
- sso: "sso",
58
+ // The app of a provider set up under Einstellungen › Anbieter (E153, #925; before it `sso`, #358):
59
+ // `access_provider_*`, for the sign-in and the employees' MCPs. Named by the ticket.
60
+ provider: "providers",
61
61
  // The password of a secret document or table (#357, E94), a sub-resource of the node, decided by
62
62
  // the orchestrator: `intelligence_node_secret_create` makes a node secret, `_update` changes the
63
63
  // password, `_get` shows it to an admin in admin mode, `_remove` makes the node public again. One
@@ -78,6 +78,9 @@ export const resources = {
78
78
  source: "sources",
79
79
  query: "queries",
80
80
  item: "items",
81
+ // The company as a whole (#930, Organisation › System): its default time zone and language,
82
+ // `access_organisation_get` and `_update`. One per installation, so its routes carry no id.
83
+ organisation: "organisations",
81
84
  };
82
85
  // The closed list of actions with a route of their own shape.
83
86
  export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
@@ -238,6 +241,9 @@ const routeExceptions = {
238
241
  // The limits of personal Operators (E143, #804): without `userId` the company's defaults, with it
239
242
  // one person's own values. The defaults are no person, so there is no one `userId` for the path.
240
243
  operator_user_update: { method: "PATCH", path: "/api/operator/users" },
244
+ // The one organisation of an installation (#930): there is no `organisationId` to name.
245
+ access_organisation_get: { method: "GET", path: "/api/access/organisation" },
246
+ access_organisation_update: { method: "PATCH", path: "/api/access/organisation" },
241
247
  };
242
248
  // `access_user_invite` → `POST /api/access/users/:userId/invite`.
243
249
  export function toolRoute(name) {