@anchrd/colab-sdk 0.1.54 → 0.1.55

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 (46) hide show
  1. package/dist/action-blocks/action-blocks.d.ts +1 -0
  2. package/dist/action-blocks/action-blocks.js +22 -0
  3. package/dist/actions/actions.d.ts +356 -3
  4. package/dist/actions/actions.js +21 -3
  5. package/dist/boards/boards.d.ts +0 -14
  6. package/dist/boards/boards.js +3 -18
  7. package/dist/documents/documents.d.ts +2 -0
  8. package/dist/flows/flow-runs.d.ts +34 -0
  9. package/dist/flows/flow-runs.js +48 -4
  10. package/dist/flows/flows.d.ts +5 -0
  11. package/dist/flows/flows.js +3 -0
  12. package/dist/gadgets/gadgets.d.ts +4 -0
  13. package/dist/gadgets/gadgets.js +5 -0
  14. package/dist/goals/goals.d.ts +1 -0
  15. package/dist/goals/goals.js +2 -2
  16. package/dist/grammar/grammar.d.ts +1 -2
  17. package/dist/grammar/grammar.js +5 -7
  18. package/dist/home/home.d.ts +2 -0
  19. package/dist/links/links.d.ts +15 -2
  20. package/dist/links/links.js +25 -13
  21. package/dist/messages/messages.js +5 -4
  22. package/dist/nodes/nodes.d.ts +11 -6
  23. package/dist/nodes/nodes.js +11 -7
  24. package/dist/operators/operators.d.ts +87 -4
  25. package/dist/operators/operators.js +55 -2
  26. package/dist/processes/processes.d.ts +1999 -0
  27. package/dist/processes/processes.js +417 -0
  28. package/dist/runs/runs.d.ts +1 -200
  29. package/dist/runs/runs.js +3 -64
  30. package/dist/schedule/schedule.js +3 -3
  31. package/dist/sdk.d.ts +10 -11
  32. package/dist/sdk.js +10 -11
  33. package/dist/skills/skills.d.ts +1 -0
  34. package/dist/sources/sources.d.ts +4 -3
  35. package/dist/tables/tables.d.ts +114 -1
  36. package/dist/tables/tables.js +86 -2
  37. package/dist/tool.d.ts +1 -0
  38. package/dist/users/users.d.ts +30 -0
  39. package/dist/users/users.js +32 -0
  40. package/dist/written/written.d.ts +2 -4
  41. package/dist/written/written.js +2 -5
  42. package/package.json +2 -1
  43. package/dist/relations/relations.d.ts +0 -342
  44. package/dist/relations/relations.js +0 -129
  45. package/dist/types/types.d.ts +0 -181
  46. package/dist/types/types.js +0 -124
@@ -20,15 +20,6 @@ export const TaskId = idSchema("node").describe("The task's id, its node id `nod
20
20
  export const LabelId = z
21
21
  .templateLiteral([z.literal("label"), z.literal("_"), ulid])
22
22
  .describe("A label of this board, `label_…`, as intelligence_board_get returned it.");
23
- // A run of a process (#43). The same id `runs.ts` names `RunId`; written here again because
24
- // `runs.ts` builds on this file and the graph between the files stays acyclic (trap C009).
25
- const RunRef = idSchema("run");
26
- // What a caller makes a board (#43, #847): a board. The kind process is switched off (E139); a process
27
- // from before stays readable and is turned back into a board, never made anew.
28
- export const boardKinds = ["board"];
29
- export const BoardKind = z
30
- .enum(boardKinds)
31
- .describe("board: a board people work on. A process from before goals is made a board again with it; no board becomes a process any more, a goal does what a process did.");
32
23
  const Name = z.string().max(200);
33
24
  // A column's description (#624), Markdown for every AI working on the board.
34
25
  const ColumnDescription = z.string().max(20_000);
@@ -63,7 +54,6 @@ const BoardInstruction = z.string().max(200_000);
63
54
  export const BoardUpdateInput = z.strictObject({
64
55
  boardId: BoardId,
65
56
  rev: Rev,
66
- kind: BoardKind.optional().describe("Make a process from before goals a board again. Its runs stay readable with intelligence_run_list."),
67
57
  instruction: BoardInstruction.optional().describe("The board's instruction, Markdown: what the board is about and how every AI working on it goes about it. It comes along with every read of the board and its tasks over MCP, as only its digest where the read sends that digest under known. An empty text removes it; leaving it out keeps it."),
68
58
  columns: Columns.optional(),
69
59
  cardKinds: CardKindsInput.optional(),
@@ -113,7 +103,6 @@ export const compactTaskLimit = 50;
113
103
  export const maxBulkTasks = 100;
114
104
  export const BoardTaskListInput = z.strictObject({
115
105
  boardId: BoardId,
116
- runId: RunRef.optional().describe("The run of a process from before goals whose tasks and columns to read, as intelligence_run_list names it. Leaving it out lists the board itself."),
117
106
  columnId: ColumnId.optional().describe("Only the tasks in this column."),
118
107
  type: ColumnType.optional().describe("Only the tasks in columns of this type. The archive column's tasks are listed only with type archive."),
119
108
  assigneeId: idSchema("user").optional().describe("Only the tasks assigned to this person."),
@@ -123,7 +112,7 @@ export const BoardTaskListInput = z.strictObject({
123
112
  taskIds: z
124
113
  .preprocess((value) => (typeof value === "string" ? value.split(",") : value), z.array(TaskId).min(1).max(maxBulkTasks))
125
114
  .optional()
126
- .describe("Only these tasks of the board (of the run, with runId), 1 to 100, also from the archive column: one you cannot read or that is not there is left out without a note."),
115
+ .describe("Only these tasks of the board, 1 to 100, also from the archive column: one you cannot read or that is not there is left out without a note."),
127
116
  content: Flag.optional().describe("true: every task comes whole, with its dates, labels, subtask depth, readiness, images, card kind and fields, and its Markdown text as content, so you check a whole board without reading task by task. A page then holds at most 100 tasks. Without it each task is compact: taskId, title, column, assignee and rev."),
128
117
  cursor: z
129
118
  .string()
@@ -283,9 +272,6 @@ export const TaskImage = z.union([
283
272
  ]);
284
273
  export const BoardTaskItem = z.object({
285
274
  taskId: NodeId,
286
- // The run of a process from before goals the task belongs to, read only (#852); null for a task
287
- // of the board itself.
288
- runId: RunRef.nullable(),
289
275
  title: z.string(),
290
276
  column: TaskColumn,
291
277
  assignee: NodePerson,
@@ -313,10 +299,10 @@ export const BoardTaskItem = z.object({
313
299
  export const BoardTaskList = z.object({
314
300
  items: z.array(BoardTaskItem),
315
301
  nextCursor: z.string().nullable(),
316
- // Over MCP only (E87, #354): the board's instruction, a run's copy of it with `runId`; null
302
+ // Over MCP only (E87, #354): the board's instruction; null
317
303
  // without one, the reference when known (E123, #677).
318
304
  instruction: InstructionRead.optional(),
319
- // Over MCP only (#624): every column of the board (of the run, with `runId`) in order, with its
305
+ // Over MCP only (#624): every column of the board in order, with its
320
306
  // description, once per page.
321
307
  columns: z.array(BoardColumn).optional(),
322
308
  });
@@ -349,7 +335,6 @@ export const TaskRule = z.object({
349
335
  export const TaskDetail = z.object({
350
336
  taskId: NodeId,
351
337
  boardId: NodeId,
352
- runId: RunRef.nullable(),
353
338
  title: z.string(),
354
339
  content: z.string(),
355
340
  column: TaskColumn,
@@ -39,6 +39,7 @@ export declare const DocumentDetail: z.ZodObject<{
39
39
  items: z.ZodArray<z.ZodObject<{
40
40
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
41
41
  name: z.ZodString;
42
+ process: z.ZodBoolean;
42
43
  }, z.core.$strip>>;
43
44
  }, z.core.$strip>;
44
45
  content: z.ZodString;
@@ -84,6 +85,7 @@ export declare const DocumentExcerpt: z.ZodObject<{
84
85
  items: z.ZodArray<z.ZodObject<{
85
86
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
86
87
  name: z.ZodString;
88
+ process: z.ZodBoolean;
87
89
  }, z.core.$strip>>;
88
90
  }, z.core.$strip>;
89
91
  content: z.ZodString;
@@ -2272,9 +2272,35 @@ export declare const FlowLiveServerMessage: z.ZodDiscriminatedUnion<[z.ZodObject
2272
2272
  }, z.core.$strip>, z.ZodObject<{
2273
2273
  type: z.ZodLiteral<"refused">;
2274
2274
  message: z.ZodString;
2275
+ code: z.ZodOptional<z.ZodEnum<{
2276
+ frame: "frame";
2277
+ }>>;
2275
2278
  }, z.core.$strip>], "type">;
2276
2279
  export type FlowLiveServerMessage = z.infer<typeof FlowLiveServerMessage>;
2280
+ export declare const flowViewportDefault: {
2281
+ readonly width: 1024;
2282
+ readonly height: 640;
2283
+ };
2284
+ export declare const flowViewportMin: {
2285
+ readonly width: 1024;
2286
+ readonly height: 480;
2287
+ };
2288
+ export declare const flowViewportMax: {
2289
+ readonly width: 2560;
2290
+ readonly height: 1600;
2291
+ };
2292
+ export declare function flowViewportOf(area: {
2293
+ width: number;
2294
+ height: number;
2295
+ }): {
2296
+ width: number;
2297
+ height: number;
2298
+ };
2277
2299
  export declare const FlowLiveClientMessage: z.ZodDiscriminatedUnion<[z.ZodObject<{
2300
+ type: z.ZodLiteral<"size">;
2301
+ width: z.ZodInt;
2302
+ height: z.ZodInt;
2303
+ }, z.core.$strict>, z.ZodObject<{
2278
2304
  type: z.ZodLiteral<"take">;
2279
2305
  }, z.core.$strict>, z.ZodObject<{
2280
2306
  type: z.ZodLiteral<"give">;
@@ -2282,6 +2308,10 @@ export declare const FlowLiveClientMessage: z.ZodDiscriminatedUnion<[z.ZodObject
2282
2308
  type: z.ZodLiteral<"click">;
2283
2309
  x: z.ZodNumber;
2284
2310
  y: z.ZodNumber;
2311
+ frame: z.ZodOptional<z.ZodObject<{
2312
+ width: z.ZodInt;
2313
+ height: z.ZodInt;
2314
+ }, z.core.$strict>>;
2285
2315
  }, z.core.$strict>, z.ZodObject<{
2286
2316
  type: z.ZodLiteral<"text">;
2287
2317
  text: z.ZodString;
@@ -2300,6 +2330,10 @@ export declare const FlowLiveClientMessage: z.ZodDiscriminatedUnion<[z.ZodObject
2300
2330
  x: z.ZodNumber;
2301
2331
  y: z.ZodNumber;
2302
2332
  deltaY: z.ZodNumber;
2333
+ frame: z.ZodOptional<z.ZodObject<{
2334
+ width: z.ZodInt;
2335
+ height: z.ZodInt;
2336
+ }, z.core.$strict>>;
2303
2337
  }, z.core.$strict>, z.ZodObject<{
2304
2338
  type: z.ZodLiteral<"open">;
2305
2339
  url: z.ZodString;
@@ -383,15 +383,58 @@ export const FlowLiveServerMessage = z.discriminatedUnion("type", [
383
383
  // the bar only orients; the address a step opens stays whole in its `open` action.
384
384
  z.object({ type: z.literal("page"), url: z.string() }),
385
385
  // A message of this socket was refused, with why (not steering, a host outside the flow's, …).
386
- z.object({ type: z.literal("refused"), message: z.string() }),
386
+ // `code: "frame"` (#1251): a click or scroll pointed into a picture of another size than the
387
+ // window has now; the view says so in the person's language, and nothing happened in the page.
388
+ z.object({
389
+ type: z.literal("refused"),
390
+ message: z.string(),
391
+ code: z.enum(["frame"]).optional(),
392
+ }),
387
393
  ]);
388
- // What a viewer sends (#1233, "Selbst steuern"), only while it steers, except `take`. Coordinates
389
- // are in the pixels of the picture (1024 x 640, the browser's viewport).
394
+ // The size of a run's browser window (#1251): 1024 x 640 without anything else; at least
395
+ // 1024 x 480, so a portal never turns into its phone view and a strip of an area never makes a
396
+ // window a few pixels high, and at most 2560 x 1600 against excessive values.
397
+ export const flowViewportDefault = { width: 1024, height: 640 };
398
+ export const flowViewportMin = { width: 1024, height: 480 };
399
+ export const flowViewportMax = { width: 2560, height: 1600 };
400
+ // The window for an area of the live view: the area itself, or, narrower than 1024, 1024 wide with
401
+ // the height following the area's aspect ratio; within the bounds above. A window of another aspect
402
+ // ratio than the area is drawn whole into it.
403
+ export function flowViewportOf(area) {
404
+ const min = flowViewportMin.width;
405
+ const width = Math.max(min, Math.round(area.width));
406
+ const height = area.width < min ? Math.round((min * area.height) / area.width) : Math.round(area.height);
407
+ return {
408
+ width: Math.min(flowViewportMax.width, width),
409
+ height: Math.min(flowViewportMax.height, Math.max(flowViewportMin.height, height)),
410
+ };
411
+ }
412
+ // The size of the picture a point was taken in (#1251), which is the window's size at that frame:
413
+ // a point from a picture of another size than the window has now is refused, not turned.
414
+ const FlowLiveFrameSize = z.strictObject({
415
+ width: z.int().min(flowViewportMin.width).max(flowViewportMax.width),
416
+ height: z.int().min(flowViewportMin.height).max(flowViewportMax.height),
417
+ });
418
+ // What a viewer sends (#1233, "Selbst steuern"), only while it steers, except `take` and `size`.
419
+ // Coordinates are in the pixels of the picture, the browser's window as the last frame names it.
390
420
  export const FlowLiveClientMessage = z.discriminatedUnion("type", [
421
+ // The size of the area the live view draws in, in CSS pixels (#1251), on opening and after every
422
+ // change: the window follows it for whoever steers, or nobody steering, for the first viewer.
423
+ // An area may be smaller than the window's minimum (a phone): `flowViewportOf` keeps the bounds.
424
+ z.strictObject({
425
+ type: z.literal("size"),
426
+ width: z.int().min(1).max(flowViewportMax.width),
427
+ height: z.int().min(1).max(flowViewportMax.height),
428
+ }),
391
429
  // Take the browser over; the AI's tools wait. And give it back; the same run goes on.
392
430
  z.strictObject({ type: z.literal("take") }),
393
431
  z.strictObject({ type: z.literal("give") }),
394
- z.strictObject({ type: z.literal("click"), x: z.number(), y: z.number() }),
432
+ z.strictObject({
433
+ type: z.literal("click"),
434
+ x: z.number(),
435
+ y: z.number(),
436
+ frame: FlowLiveFrameSize.optional(),
437
+ }),
395
438
  // Typed text, inserted where the cursor is; recorded as one fill with the field's last value.
396
439
  z.strictObject({ type: z.literal("text"), text: z.string().min(1).max(2000) }),
397
440
  z.strictObject({
@@ -403,6 +446,7 @@ export const FlowLiveClientMessage = z.discriminatedUnion("type", [
403
446
  x: z.number(),
404
447
  y: z.number(),
405
448
  deltaY: z.number(),
449
+ frame: FlowLiveFrameSize.optional(),
406
450
  }),
407
451
  // An address typed into the address bar: on the flow's hosts only.
408
452
  z.strictObject({ type: z.literal("open"), url: z.string().max(2000) }),
@@ -1781,6 +1781,7 @@ export declare const FlowDetail: z.ZodObject<{
1781
1781
  items: z.ZodArray<z.ZodObject<{
1782
1782
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
1783
1783
  name: z.ZodString;
1784
+ process: z.ZodBoolean;
1784
1785
  }, z.core.$strip>>;
1785
1786
  }, z.core.$strip>;
1786
1787
  hosts: z.ZodArray<z.ZodString>;
@@ -2296,6 +2297,10 @@ export declare const FlowDetail: z.ZodObject<{
2296
2297
  }, z.core.$strip>;
2297
2298
  rev: z.ZodNumber;
2298
2299
  archivedAt: z.ZodNullable<z.ZodISODateTime>;
2300
+ viewport: z.ZodNullable<z.ZodObject<{
2301
+ width: z.ZodInt;
2302
+ height: z.ZodInt;
2303
+ }, z.core.$strip>>;
2299
2304
  }, z.core.$strip>;
2300
2305
  export type FlowDetail = z.infer<typeof FlowDetail>;
2301
2306
  export declare const FlowVersionContent: z.ZodObject<{
@@ -464,6 +464,9 @@ export const FlowDetail = z.object({
464
464
  rights: z.object({ write: z.boolean() }),
465
465
  rev: Rev,
466
466
  archivedAt: z.iso.datetime().nullable(),
467
+ // The size of the run's browser window at the last recording (#1251): a fixed run opens its window
468
+ // in it, so recorded steps run at the size they were made at; null runs at 1024 x 640.
469
+ viewport: z.object({ width: z.int(), height: z.int() }).nullable(),
467
470
  });
468
471
  // A published version's content, the JSON `versions.content` holds: the steps as they were.
469
472
  export const FlowVersionContent = z.object({ steps: z.array(FlowStep) });
@@ -11,6 +11,7 @@ export declare const GadgetFunction: z.ZodObject<{
11
11
  description: z.ZodString;
12
12
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
13
  requires: z.ZodOptional<z.ZodString>;
14
+ cache: z.ZodOptional<z.ZodBoolean>;
14
15
  }, z.core.$strict>;
15
16
  export type GadgetFunction = z.infer<typeof GadgetFunction>;
16
17
  export declare const GadgetAccess: z.ZodObject<{
@@ -41,6 +42,7 @@ export declare const GadgetManifest: z.ZodObject<{
41
42
  description: z.ZodString;
42
43
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
43
44
  requires: z.ZodOptional<z.ZodString>;
45
+ cache: z.ZodOptional<z.ZodBoolean>;
44
46
  }, z.core.$strict>>;
45
47
  }, z.core.$strict>;
46
48
  export type GadgetManifest = z.infer<typeof GadgetManifest>;
@@ -399,6 +401,7 @@ export declare const GadgetDetail: z.ZodObject<{
399
401
  items: z.ZodArray<z.ZodObject<{
400
402
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
401
403
  name: z.ZodString;
404
+ process: z.ZodBoolean;
402
405
  }, z.core.$strip>>;
403
406
  }, z.core.$strip>;
404
407
  version: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"draft">]>>;
@@ -417,6 +420,7 @@ export declare const GadgetDetail: z.ZodObject<{
417
420
  description: z.ZodString;
418
421
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
419
422
  requires: z.ZodOptional<z.ZodString>;
423
+ cache: z.ZodOptional<z.ZodBoolean>;
420
424
  }, z.core.$strict>>;
421
425
  }, z.core.$strict>>;
422
426
  files: z.ZodArray<z.ZodObject<{
@@ -48,6 +48,11 @@ export const GadgetFunction = z.strictObject({
48
48
  .optional()
49
49
  .describe("A JSON Schema of the function's input, an object; Colab checks every call against it. Leaving it out takes any object."),
50
50
  requires: GadgetRequires.optional(),
51
+ // #1274, E282: the page keeps the last answer of `load` in the browser, only where this says so.
52
+ cache: z
53
+ .boolean()
54
+ .optional()
55
+ .describe("true for a function that only reads: the screen's load shows its last answer from the browser at once, then the fresh one. Never for a function that writes."),
51
56
  });
52
57
  // Rights per person over a service of Access (#790, E162): the gadget names a service an admin set
53
58
  // up, and every function names the function of that service it requires.
@@ -703,6 +703,7 @@ export declare const GoalDetail: z.ZodObject<{
703
703
  items: z.ZodArray<z.ZodObject<{
704
704
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
705
705
  name: z.ZodString;
706
+ process: z.ZodBoolean;
706
707
  }, z.core.$strip>>;
707
708
  }, z.core.$strip>;
708
709
  content: z.ZodString;
@@ -13,7 +13,7 @@ import { UserId } from "../users/users.js";
13
13
  // the line like on a card, the goal itself below it in Markdown. A run is an object of its own at the
14
14
  // goal, frozen once it ends.
15
15
  export const GoalId = NodeId.describe("The goal's id, a `node_…` of kind goal.");
16
- // A run of a goal is the resource `run` (`run_…`) like a run of a process board; defined here, not
16
+ // A run of a goal is the resource `run` (`run_…`) like a run of a source or a flow; defined here, not
17
17
  // imported from `runs.ts`, which `versions.ts` reaches through this file.
18
18
  const RunId = idSchema("run").describe("The run's id, `run_…`, as intelligence_goal_run_list names it.");
19
19
  export const goalPlannings = ["short", "detailed"];
@@ -36,7 +36,7 @@ const MaxHours = z
36
36
  .min(1)
37
37
  .max(24 * 90)
38
38
  .describe("How long one run may take at most, in hours; a run past it ends as missed.");
39
- const Rhythm = Schedule.describe("When a run starts, on the rhythm's clock: daily, weekly, monthly or on dates, like a process board's schedule; whileOpen does not apply, because a moment that falls due while a run is open is always skipped. manual or null starts runs only by hand.");
39
+ const Rhythm = Schedule.describe("When a run starts, on the rhythm's clock: daily, weekly, monthly or on dates; whileOpen does not apply, because a moment that falls due while a run is open is always skipped. manual or null starts runs only by hand.");
40
40
  // The fields above the line. Every one optional on a change: only what is sent changes.
41
41
  const GoalFieldsInput = {
42
42
  operatorId: UserId.nullable()
@@ -49,9 +49,8 @@ export declare const resources: {
49
49
  readonly organisation: "organisations";
50
50
  readonly home: "homes";
51
51
  readonly job: "jobs";
52
- readonly type: "types";
53
- readonly relation: "relations";
54
52
  readonly conversation: "conversations";
53
+ readonly process: "processes";
55
54
  };
56
55
  export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
57
56
  export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel", "describe"];
@@ -112,17 +112,15 @@ export const resources = {
112
112
  // how far it is, `_list` the person's jobs still running. Only a person in the browser starts or
113
113
  // reads one; no AI (D124). Decided by the orchestrator.
114
114
  job: "jobs",
115
- // The ontology (#1124, E250): a type describes what something is (an object, a relation, an action
116
- // or an actor), `intelligence_type_*`, and changing types is a right of its own
117
- // (`intelligence / type / update`). A relation connects two things, computed from a rule or set by
118
- // somebody, `intelligence_relation_*`; "Beziehung" in the UI. Not `link`, which is the public link.
119
- // Both named by the ticket.
120
- type: "types",
121
- relation: "relations",
122
115
  // A person's conversation with one of their personal Operators (E267, #1212, Funktionen ›
123
116
  // KI-Chat): `operator_conversation_*`. Not `chat`, a node's chat in `intelligence`. Confirmed by the
124
117
  // orchestrator.
125
118
  conversation: "conversations",
119
+ // A folder that is a process (#1258, Nodes › Ordner › Prozess): steps, actors, actions with a start
120
+ // and connections, a micro per action, a draft and versions, `intelligence_process_*`. Not `run`
121
+ // (a run of a goal or flow), not `flow` (a browser's steps), not `board`, and not `action`, `step`, `link` or `connection`, which name other things.
122
+ // Named by the ticket.
123
+ process: "processes",
126
124
  };
127
125
  // The closed list of actions with a route of their own shape.
128
126
  export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
@@ -85,6 +85,7 @@ export declare const Home: z.ZodObject<{
85
85
  items: z.ZodArray<z.ZodObject<{
86
86
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
87
87
  name: z.ZodString;
88
+ process: z.ZodBoolean;
88
89
  }, z.core.$strip>>;
89
90
  }, z.core.$strip>;
90
91
  version: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"draft">]>>;
@@ -103,6 +104,7 @@ export declare const Home: z.ZodObject<{
103
104
  description: z.ZodString;
104
105
  input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
105
106
  requires: z.ZodOptional<z.ZodString>;
107
+ cache: z.ZodOptional<z.ZodBoolean>;
106
108
  }, z.core.$strict>>;
107
109
  }, z.core.$strict>>;
108
110
  files: z.ZodArray<z.ZodObject<{
@@ -79,6 +79,7 @@ export declare const gadgetLinkLimits: {
79
79
  readonly linkDay: 2000;
80
80
  };
81
81
  export declare const gadgetLinkPath = "/l";
82
+ export declare const gadgetLinkOpens: readonly ["password", "mail", "account"];
82
83
  export declare const GadgetLinkCreateInput: z.ZodObject<{
83
84
  gadgetId: z.ZodTemplateLiteral<`node_${string}`>;
84
85
  name: z.ZodOptional<z.ZodString>;
@@ -89,6 +90,7 @@ export declare const GadgetLinkCreateInput: z.ZodObject<{
89
90
  opensWith: z.ZodOptional<z.ZodEnum<{
90
91
  mail: "mail";
91
92
  password: "password";
93
+ account: "account";
92
94
  }>>;
93
95
  functions: z.ZodArray<z.ZodString>;
94
96
  expiresInDays: z.ZodOptional<z.ZodNumber>;
@@ -121,6 +123,7 @@ export declare const GadgetLink: z.ZodObject<{
121
123
  opensWith: z.ZodNullable<z.ZodEnum<{
122
124
  mail: "mail";
123
125
  password: "password";
126
+ account: "account";
124
127
  }>>;
125
128
  url: z.ZodString;
126
129
  functions: z.ZodArray<z.ZodString>;
@@ -158,6 +161,7 @@ export declare const GadgetLinkList: z.ZodObject<{
158
161
  opensWith: z.ZodNullable<z.ZodEnum<{
159
162
  mail: "mail";
160
163
  password: "password";
164
+ account: "account";
161
165
  }>>;
162
166
  url: z.ZodString;
163
167
  functions: z.ZodArray<z.ZodString>;
@@ -196,6 +200,7 @@ export declare const GadgetLinkVisitInput: z.ZodObject<{
196
200
  address: z.ZodOptional<z.ZodEmail>;
197
201
  code: z.ZodOptional<z.ZodString>;
198
202
  turnstile: z.ZodOptional<z.ZodString>;
203
+ entry: z.ZodOptional<z.ZodString>;
199
204
  }, z.core.$strict>;
200
205
  export type GadgetLinkVisitInput = z.infer<typeof GadgetLinkVisitInput>;
201
206
  export declare const GadgetLinkCodeInput: z.ZodObject<{
@@ -204,16 +209,23 @@ export declare const GadgetLinkCodeInput: z.ZodObject<{
204
209
  export type GadgetLinkCodeInput = z.infer<typeof GadgetLinkCodeInput>;
205
210
  export declare const GadgetLinkVisit: z.ZodObject<{
206
211
  visit: z.ZodString;
212
+ leave: z.ZodOptional<z.ZodString>;
207
213
  expiresAt: z.ZodISODateTime;
208
214
  gadget: z.ZodObject<{
209
215
  name: z.ZodString;
210
216
  files: z.ZodRecord<z.ZodString, z.ZodString>;
211
217
  }, z.core.$strip>;
212
- viewer: z.ZodObject<{
218
+ viewer: z.ZodDiscriminatedUnion<[z.ZodObject<{
213
219
  kind: z.ZodLiteral<"external">;
214
220
  linkId: z.ZodString;
215
221
  rights: z.ZodArray<z.ZodString>;
216
- }, z.core.$strip>;
222
+ }, z.core.$strip>, z.ZodObject<{
223
+ kind: z.ZodLiteral<"human">;
224
+ userId: z.ZodString;
225
+ name: z.ZodString;
226
+ linkId: z.ZodString;
227
+ rights: z.ZodArray<z.ZodString>;
228
+ }, z.core.$strip>], "kind">;
217
229
  }, z.core.$strip>;
218
230
  export type GadgetLinkVisit = z.infer<typeof GadgetLinkVisit>;
219
231
  export declare const GadgetLinkPage: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -234,6 +246,7 @@ export declare const GadgetLinkPage: z.ZodDiscriminatedUnion<[z.ZodObject<{
234
246
  opensWith: z.ZodNullable<z.ZodEnum<{
235
247
  mail: "mail";
236
248
  password: "password";
249
+ account: "account";
237
250
  }>>;
238
251
  gadgetName: z.ZodString;
239
252
  linkName: z.ZodString;
@@ -78,6 +78,8 @@ export const NodeLinkList = z.object({
78
78
  export const gadgetLinkLimits = { visitorHour: 60, linkDay: 2000 };
79
79
  // The path of the door a visitor reaches (`/l/<code>`), its code 12 letters and digits.
80
80
  export const gadgetLinkPath = "/l";
81
+ // How a link opens (E164, E295): with a password, a code by mail, or the sign-in of an account.
82
+ export const gadgetLinkOpens = ["password", "mail", "account"];
81
83
  const GadgetLinkFunction = z
82
84
  .string()
83
85
  .regex(/^[a-z][a-z0-9]*\.[a-z][a-z0-9]*$/)
@@ -116,11 +118,11 @@ export const GadgetLinkCreateInput = z.strictObject({
116
118
  .describe("The link's name for the people who share it; leaving it out gives the gadget's name."),
117
119
  kind: z
118
120
  .enum(["link", "embed"])
119
- .describe("link: opened with a password or a code by mail, at most 90 days. embed: on the allowed domains only, without an end."),
121
+ .describe("link: opened with a password or a code by mail (at most 90 days), or with sign-in by any account of this installation (without an end unless one is given). embed: on the allowed domains only, without an end."),
120
122
  opensWith: z
121
- .enum(["password", "mail"])
123
+ .enum(gadgetLinkOpens)
122
124
  .optional()
123
- .describe("How a link opens: password (the default) or mail, a code the visitor gets by mail. Not for an embed."),
125
+ .describe("How a link opens: password (the default), mail (a code the visitor gets by mail) or account (the visitor signs in with an account of this installation, and the gadget sees who it is). Not for an embed."),
124
126
  functions: z
125
127
  .array(GadgetLinkFunction)
126
128
  .min(1)
@@ -132,7 +134,7 @@ export const GadgetLinkCreateInput = z.strictObject({
132
134
  .min(1)
133
135
  .max(maxLinkDays)
134
136
  .optional()
135
- .describe("A link's days, 1 to 90; leaving it out gives 7. An embed has no end."),
137
+ .describe("A link's days, 1 to 90; leaving it out gives 7, and for a link that opens with account no end. An embed has no end."),
136
138
  password: z
137
139
  .string()
138
140
  .min(8)
@@ -155,14 +157,14 @@ export const GadgetLink = z.object({
155
157
  kind: z.enum(["link", "embed"]),
156
158
  name: z.string(),
157
159
  // How a link opens; null for an embed.
158
- opensWith: z.enum(["password", "mail"]).nullable(),
160
+ opensWith: z.enum(gadgetLinkOpens).nullable(),
159
161
  // Derived every time, never stored: `<installation>/l/<code>`.
160
162
  url: z.string(),
161
163
  functions: z.array(z.string()),
162
164
  domains: z.array(z.string()),
163
165
  password: z.boolean(),
164
166
  limits: z.object({ visitorHour: z.number().int(), linkDay: z.number().int() }),
165
- // Null for an embed.
167
+ // Null for an embed and for a link without an end.
166
168
  expiresAt: z.iso.datetime().nullable(),
167
169
  status: LinkStatus,
168
170
  // The calls the link took in the last seven days, counted by its daily brake.
@@ -179,7 +181,7 @@ export const GadgetLinkCallInput = z.strictObject({
179
181
  function: z.string().min(1).max(64),
180
182
  input: z.record(z.string(), z.unknown()).optional(),
181
183
  password: z.string().max(200).optional(),
182
- visit: z.string().max(200).optional(),
184
+ visit: z.string().max(400).optional(),
183
185
  });
184
186
  // How the visitor's page opens a link (`POST /l/<code>/visits`, #820, E164): with the password, with
185
187
  // the address and the code that came by mail, or for an embed with the token of the bot check.
@@ -188,6 +190,8 @@ export const GadgetLinkVisitInput = z.strictObject({
188
190
  address: z.email().max(254).optional(),
189
191
  code: z.string().max(20).optional(),
190
192
  turnstile: z.string().max(4096).optional(),
193
+ // A link that opens with sign-in (E295): the entry the page at `/l/<code>` was served with.
194
+ entry: z.string().max(400).optional(),
191
195
  });
192
196
  // A code by mail asked for (`POST /l/<code>/codes`).
193
197
  export const GadgetLinkCodeInput = z.strictObject({ address: z.email().max(254) });
@@ -195,13 +199,21 @@ export const GadgetLinkCodeInput = z.strictObject({ address: z.email().max(254)
195
199
  // client files only, never `server.js` or its tests).
196
200
  export const GadgetLinkVisit = z.object({
197
201
  visit: z.string(),
202
+ // Only for a link that opens with sign-in (E295): what the page's sign-out carries in its address.
203
+ leave: z.string().optional(),
198
204
  expiresAt: z.iso.datetime(),
199
205
  gadget: z.object({ name: z.string(), files: z.record(z.string(), z.string()) }),
200
- viewer: z.object({
201
- kind: z.literal("external"),
202
- linkId: z.string(),
203
- rights: z.array(z.string()),
204
- }),
206
+ // An outside visitor, or for a link that opens with sign-in (E295) the person who signed in.
207
+ viewer: z.discriminatedUnion("kind", [
208
+ z.object({ kind: z.literal("external"), linkId: z.string(), rights: z.array(z.string()) }),
209
+ z.object({
210
+ kind: z.literal("human"),
211
+ userId: z.string(),
212
+ name: z.string(),
213
+ linkId: z.string(),
214
+ rights: z.array(z.string()),
215
+ }),
216
+ ]),
205
217
  });
206
218
  // What the page at `/l/<code>` is (#820): which screen it opens with. `unknown` names nothing.
207
219
  export const GadgetLinkPage = z.discriminatedUnion("status", [
@@ -214,7 +226,7 @@ export const GadgetLinkPage = z.discriminatedUnion("status", [
214
226
  z.object({
215
227
  status: z.literal("active"),
216
228
  kind: z.enum(["link", "embed"]),
217
- opensWith: z.enum(["password", "mail"]).nullable(),
229
+ opensWith: z.enum(gadgetLinkOpens).nullable(),
218
230
  gadgetName: z.string(),
219
231
  linkName: z.string(),
220
232
  domains: z.array(z.string()),
@@ -6,7 +6,8 @@ import { IdempotencyKey } from "../primitives/primitives.js";
6
6
  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
- // folder has a chat; it has no row of its own, and its `chatId` is the node's id. Messages are only
9
+ // folder has a chat, and a folder that is a process has one too (E284, #1259); it has no row of its
10
+ // own, and its `chatId` is the node's id. Messages are only
10
11
  // appended: no editing, no following. A message carries up to ten attachments (#1210, E265), each
11
12
  // uploaded into the chat first and named by the message that sends it.
12
13
  export const MessageId = idSchema("message").describe("A message's id, `message_…`, as intelligence_message_list returns it.");
@@ -28,7 +29,7 @@ export function topicOf(name) {
28
29
  return generalNames.has(trimmed.toLowerCase()) ? null : trimmed;
29
30
  }
30
31
  export const MessageListInput = z.strictObject({
31
- nodeId: NodeId.describe("The node whose chat to read: any node you can read except a folder, which has no chat."),
32
+ nodeId: NodeId.describe("The node whose chat to read: any node you can read except a folder, which has no chat unless it is a process."),
32
33
  cursor: z
33
34
  .string()
34
35
  .max(200)
@@ -47,7 +48,7 @@ export const attachmentMaxBytes = 20 * 1024 * 1024;
47
48
  // The Base64 of the largest attachment, padded: what the input's length is held to.
48
49
  const attachmentMaxBase64 = Math.ceil(attachmentMaxBytes / 3) * 4;
49
50
  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
+ chatId: NodeId.describe("The chat to attach the file in: the id of its node, `node_…`, any node you can read except a folder that is no process."),
51
52
  name: z
52
53
  .string()
53
54
  .trim()
@@ -94,7 +95,7 @@ export const ChatAttachmentRead = z.object({
94
95
  });
95
96
  export const MessageCreateInput = z
96
97
  .strictObject({
97
- nodeId: NodeId.describe("The node whose chat to write in: any node you can read except a folder. Reading is enough to write."),
98
+ nodeId: NodeId.describe("The node whose chat to write in: any node you can read except a folder that is no process. Reading is enough to write."),
98
99
  text: z
99
100
  .string()
100
101
  .trim()