@anchrd/colab-sdk 0.1.42 → 0.1.44

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 (43) hide show
  1. package/dist/actions/actions.d.ts +83 -61
  2. package/dist/actions/actions.js +12 -6
  3. package/dist/boards/boards.d.ts +72 -167
  4. package/dist/boards/boards.js +30 -23
  5. package/dist/card-kinds/card-kinds.js +1 -1
  6. package/dist/columns/columns.d.ts +4 -4
  7. package/dist/columns/columns.js +3 -3
  8. package/dist/documents/documents.d.ts +0 -2
  9. package/dist/files/files.d.ts +32 -1
  10. package/dist/files/files.js +89 -27
  11. package/dist/grammar/grammar.d.ts +4 -1
  12. package/dist/grammar/grammar.js +17 -0
  13. package/dist/grants/grants.d.ts +12 -4
  14. package/dist/grants/grants.js +23 -8
  15. package/dist/home/home.d.ts +3 -3
  16. package/dist/instructions/instructions.d.ts +0 -4
  17. package/dist/instructions/instructions.js +5 -13
  18. package/dist/invitations/invitations.d.ts +1 -0
  19. package/dist/invitations/invitations.js +8 -0
  20. package/dist/jobs/jobs.d.ts +67 -0
  21. package/dist/jobs/jobs.js +45 -0
  22. package/dist/mcps/mcps.d.ts +3 -3
  23. package/dist/nodes/nodes.d.ts +5 -115
  24. package/dist/nodes/nodes.js +15 -41
  25. package/dist/operators/operators.d.ts +89 -7
  26. package/dist/operators/operators.js +50 -7
  27. package/dist/roles/roles.d.ts +0 -14
  28. package/dist/roles/roles.js +2 -10
  29. package/dist/runs/runs.d.ts +9 -12
  30. package/dist/runs/runs.js +5 -6
  31. package/dist/schedule/schedule.js +1 -1
  32. package/dist/sdk.d.ts +10 -9
  33. package/dist/sdk.js +10 -9
  34. package/dist/sources/sources.d.ts +6 -6
  35. package/dist/teams/teams.d.ts +120 -0
  36. package/dist/teams/teams.js +70 -0
  37. package/dist/versions/versions.d.ts +54 -71
  38. package/dist/versions/versions.js +5 -6
  39. package/dist/written/written.d.ts +62 -2
  40. package/dist/written/written.js +16 -2
  41. package/package.json +1 -1
  42. package/dist/validation/validation.d.ts +0 -60
  43. package/dist/validation/validation.js +0 -26
@@ -3,26 +3,26 @@ export declare const ColumnId: z.ZodTemplateLiteral<`column_${string}`>;
3
3
  export type ColumnId = z.infer<typeof ColumnId>;
4
4
  export declare const columnTypes: readonly ["backlog", "open", "progress", "done", "discarded", "blocked", "archive"];
5
5
  export declare const ColumnType: z.ZodEnum<{
6
+ archive: "archive";
7
+ done: "done";
6
8
  backlog: "backlog";
7
9
  open: "open";
8
10
  progress: "progress";
9
- done: "done";
10
11
  discarded: "discarded";
11
12
  blocked: "blocked";
12
- archive: "archive";
13
13
  }>;
14
14
  export type ColumnType = z.infer<typeof ColumnType>;
15
15
  export declare const TaskColumn: z.ZodObject<{
16
16
  columnId: z.ZodTemplateLiteral<`column_${string}`>;
17
17
  name: z.ZodString;
18
18
  type: z.ZodEnum<{
19
+ archive: "archive";
20
+ done: "done";
19
21
  backlog: "backlog";
20
22
  open: "open";
21
23
  progress: "progress";
22
- done: "done";
23
24
  discarded: "discarded";
24
25
  blocked: "blocked";
25
- archive: "archive";
26
26
  }>;
27
27
  }, z.core.$strip>;
28
28
  export type TaskColumn = z.infer<typeof TaskColumn>;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
- // A board's columns as other domains name them (#42, #47): the id, the seven types and a column as a
3
- // task or a node's validation shows it. A base file of its own, so `nodes.ts` can carry a node's
4
- // validation status without importing `boards.ts`, which imports `nodes.ts` (trap C009).
2
+ // A board's columns as other domains name them (#42): the id, the seven types and a column as a task
3
+ // shows it. A base file of its own, so Actions can name a column without importing `boards.ts`
4
+ // (trap C009).
5
5
  // A ULID in Crockford base32, as `ids.ts` takes it.
6
6
  const ulid = z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/);
7
7
  // `column_…` is no word of the grammar (#42): a row of a board, not a resource.
@@ -58,7 +58,6 @@ export declare const DocumentDetail: z.ZodObject<{
58
58
  instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
59
59
  chain: z.ZodArray<z.ZodObject<{
60
60
  path: z.ZodString;
61
- status: z.ZodNullable<z.ZodString>;
62
61
  markdown: z.ZodString;
63
62
  }, z.core.$strip>>;
64
63
  hint: z.ZodOptional<z.ZodString>;
@@ -103,7 +102,6 @@ export declare const DocumentExcerpt: z.ZodObject<{
103
102
  instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
104
103
  chain: z.ZodArray<z.ZodObject<{
105
104
  path: z.ZodString;
106
- status: z.ZodNullable<z.ZodString>;
107
105
  markdown: z.ZodString;
108
106
  }, z.core.$strip>>;
109
107
  hint: z.ZodOptional<z.ZodString>;
@@ -8,6 +8,9 @@ export declare function fileFormatOf(name: string): FileFormat | null;
8
8
  export declare const uploadTicketHeader = "x-colab-upload-ticket";
9
9
  export declare const uploadTicketLifetimeMs: number;
10
10
  export declare const SourceUrl: z.ZodString;
11
+ export declare const maxContentFileBytes: number;
12
+ export declare const fileEncodings: readonly ["utf8", "base64"];
13
+ export type FileEncoding = (typeof fileEncodings)[number];
11
14
  export declare const FileCreateInput: z.ZodObject<{
12
15
  parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
13
16
  section: z.ZodOptional<z.ZodEnum<{
@@ -17,6 +20,11 @@ export declare const FileCreateInput: z.ZodObject<{
17
20
  name: z.ZodOptional<z.ZodString>;
18
21
  mediaType: z.ZodOptional<z.ZodString>;
19
22
  size: z.ZodOptional<z.ZodNumber>;
23
+ content: z.ZodOptional<z.ZodString>;
24
+ encoding: z.ZodOptional<z.ZodEnum<{
25
+ base64: "base64";
26
+ utf8: "utf8";
27
+ }>>;
20
28
  sourceUrl: z.ZodOptional<z.ZodString>;
21
29
  idempotencyKey: z.ZodString;
22
30
  }, z.core.$strict>;
@@ -25,7 +33,12 @@ export declare const FileUpdateInput: z.ZodObject<{
25
33
  fileId: z.ZodTemplateLiteral<`node_${string}`>;
26
34
  name: z.ZodString;
27
35
  mediaType: z.ZodString;
28
- size: z.ZodNumber;
36
+ size: z.ZodOptional<z.ZodNumber>;
37
+ content: z.ZodOptional<z.ZodString>;
38
+ encoding: z.ZodOptional<z.ZodEnum<{
39
+ base64: "base64";
40
+ utf8: "utf8";
41
+ }>>;
29
42
  rev: z.ZodNumber;
30
43
  }, z.core.$strict>;
31
44
  export type FileUpdateInput = z.infer<typeof FileUpdateInput>;
@@ -34,6 +47,24 @@ export declare const FileGetInput: z.ZodObject<{
34
47
  cursor: z.ZodOptional<z.ZodString>;
35
48
  }, z.core.$strict>;
36
49
  export type FileGetInput = z.infer<typeof FileGetInput>;
50
+ export declare const maxDescribeQuestionChars = 2000;
51
+ export declare const maxDescribeBytes: number;
52
+ export declare const FileDescribeInput: z.ZodObject<{
53
+ fileId: z.ZodTemplateLiteral<`node_${string}`>;
54
+ question: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strict>;
56
+ export type FileDescribeInput = z.infer<typeof FileDescribeInput>;
57
+ export declare const FileDescription: z.ZodObject<{
58
+ fileId: z.ZodTemplateLiteral<`node_${string}`>;
59
+ version: z.ZodObject<{
60
+ versionId: z.ZodTemplateLiteral<`version_${string}`>;
61
+ number: z.ZodNumber;
62
+ }, z.core.$strip>;
63
+ description: z.ZodString;
64
+ stored: z.ZodBoolean;
65
+ answer: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ export type FileDescription = z.infer<typeof FileDescription>;
37
68
  export declare const UploadTicket: z.ZodObject<{
38
69
  url: z.ZodURL;
39
70
  ticket: z.ZodString;
@@ -101,6 +101,56 @@ export const SourceUrl = z
101
101
  .min(1)
102
102
  .max(2048)
103
103
  .describe("The https address of a public document on the web, like a PDF of a study. Colab downloads it itself and stores it like an upload; leave name optional and send no mediaType or size, Colab reads both from the answer. Only public hosts, at most 100 MB.");
104
+ // The largest file sent with its content in the call (E245, #1137): 5 MB after decoding, decimal
105
+ // like `maxFileBytes`. The content passes through the caller's context, so anything larger goes
106
+ // through the upload ticket.
107
+ export const maxContentFileBytes = 5 * 1000 * 1000;
108
+ // Base64 of `maxContentFileBytes` bytes, padded: the longest string the schema takes before the
109
+ // handler decodes and counts. A text in UTF-8 is never longer in characters than in bytes.
110
+ const maxContentChars = Math.ceil(maxContentFileBytes / 3) * 4;
111
+ export const fileEncodings = ["utf8", "base64"];
112
+ const Content = z
113
+ .string()
114
+ .max(maxContentChars, {
115
+ error: `Content can be at most ${maxContentFileBytes} bytes (5 MB); for a larger file leave content out and send size for an upload ticket.`,
116
+ })
117
+ .describe(`The file's content in the call, at most ${maxContentFileBytes} bytes (5 MB) after decoding: text as it is with encoding utf8 (the default), bytes such as a PNG as Base64 with encoding base64. For a gadget or an AI without a shell; Colab counts the size itself, so send no size. A larger file goes through the upload ticket.`);
118
+ const Encoding = z
119
+ .enum(fileEncodings)
120
+ .describe("How content is written: utf8 (the default) for text, base64 for bytes (standard alphabet, padded with =).");
121
+ // What the three ways of a file share (E245, #1137): exactly one of `content`, an upload (`size`)
122
+ // and, on a new file, `sourceUrl`.
123
+ function exactlyOneWay(input, ctx, call) {
124
+ const issue = (path, message) => ctx.addIssue({ code: "custom", path: [path], message });
125
+ if (input.content === undefined && input.encoding !== undefined) {
126
+ issue("encoding", "encoding goes with content; leave it out.");
127
+ }
128
+ if (input.sourceUrl !== undefined) {
129
+ for (const field of ["mediaType", "size", "content"]) {
130
+ if (input[field] !== undefined) {
131
+ issue(field, `With sourceUrl Colab reads ${field} from the answer; leave it out.`);
132
+ }
133
+ }
134
+ return;
135
+ }
136
+ if (input.content !== undefined) {
137
+ if (input.size !== undefined) {
138
+ issue("size", "With content Colab counts the size itself; leave size out.");
139
+ }
140
+ for (const field of ["name", "mediaType"]) {
141
+ if (input[field] === undefined)
142
+ issue(field, `A file sent with content needs ${field}.`);
143
+ }
144
+ return;
145
+ }
146
+ for (const field of ["name", "mediaType", "size"]) {
147
+ if (input[field] === undefined) {
148
+ issue(field, call === "create"
149
+ ? `An upload needs ${field}; or send content (at most 5 MB), or sourceUrl and Colab fetches the file itself.`
150
+ : `An upload needs ${field}; or send content (at most 5 MB).`);
151
+ }
152
+ }
153
+ }
104
154
  export const FileCreateInput = z
105
155
  .strictObject({
106
156
  // ⚠️ Required and nullable (trap C015): null is the top level of Shared, like a folder.
@@ -110,41 +160,53 @@ export const FileCreateInput = z
110
160
  name: FileName.optional(),
111
161
  mediaType: MediaType.optional(),
112
162
  size: Size.optional(),
163
+ content: Content.optional(),
164
+ encoding: Encoding.optional(),
113
165
  sourceUrl: SourceUrl.optional(),
114
166
  idempotencyKey: IdempotencyKey,
115
167
  })
116
- // An upload names its file, type and size; a file from an address is measured by Colab (#556).
117
- .superRefine((input, ctx) => {
118
- if (input.sourceUrl === undefined) {
119
- for (const field of ["name", "mediaType", "size"]) {
120
- if (input[field] === undefined) {
121
- ctx.addIssue({
122
- code: "custom",
123
- path: [field],
124
- message: `An upload needs ${field}; or send sourceUrl and Colab fetches the file itself.`,
125
- });
126
- }
127
- }
128
- return;
129
- }
130
- for (const field of ["mediaType", "size"]) {
131
- if (input[field] !== undefined) {
132
- ctx.addIssue({
133
- code: "custom",
134
- path: [field],
135
- message: `With sourceUrl Colab reads ${field} from the answer; leave it out.`,
136
- });
137
- }
138
- }
139
- });
140
- export const FileUpdateInput = z.strictObject({
168
+ // An upload names its file, type and size; content names file and type, Colab counts it (#1137);
169
+ // a file from an address is measured by Colab (#556).
170
+ .superRefine((input, ctx) => exactlyOneWay(input, ctx, "create"));
171
+ export const FileUpdateInput = z
172
+ .strictObject({
141
173
  fileId: FileId.describe("The file to upload a new version of."),
142
174
  name: FileName,
143
175
  mediaType: MediaType,
144
- size: Size,
176
+ // An upload ticket's size, or the content itself (#1137): exactly one of them.
177
+ size: Size.optional(),
178
+ content: Content.optional(),
179
+ encoding: Encoding.optional(),
145
180
  rev: Rev,
146
- });
181
+ })
182
+ .superRefine((input, ctx) => exactlyOneWay(input, ctx, "update"));
147
183
  export const FileGetInput = z.strictObject({ fileId: FileId, cursor: ExcerptCursor.optional() });
184
+ // Viewing an image (#1126, E244): `intelligence_file_describe`. Without `question` the stored
185
+ // description of the current version (made on the first call), with one the model is asked again
186
+ // and its answer is not stored.
187
+ export const maxDescribeQuestionChars = 2000;
188
+ // The largest image Colab describes; the bytes go to the model whole, as Base64.
189
+ export const maxDescribeBytes = 10 * 1000 * 1000;
190
+ export const FileDescribeInput = z.strictObject({
191
+ fileId: FileId.describe("The image to describe, a file whose current version is a raster image."),
192
+ question: z
193
+ .string()
194
+ .trim()
195
+ .min(1)
196
+ .max(maxDescribeQuestionChars)
197
+ .optional()
198
+ .describe(`A question about the image, such as whether it fits a brief, at most ${maxDescribeQuestionChars} characters. Its answer comes as answer and is not stored.`),
199
+ });
200
+ export const FileDescription = z.object({
201
+ fileId: FileId,
202
+ version: z.object({ versionId: VersionId, number: z.number().int() }),
203
+ // The general description of this version, stored at it and found by the search.
204
+ description: z.string(),
205
+ // True when the description came from storage and no model was asked for it.
206
+ stored: z.boolean(),
207
+ // Only with a question: the model's answer to it, never stored.
208
+ answer: z.string().optional(),
209
+ });
148
210
  // What `_create` and `_update` answer: the door, the ticket and the whole command. ⚠️ `ticket` is a
149
211
  // credential, and it is in this answer on purpose: it opens ONE upload for ONE person for fifteen
150
212
  // minutes. It appears nowhere else, never in an error and never in a log.
@@ -19,6 +19,8 @@ export declare const resources: {
19
19
  readonly link: "links";
20
20
  readonly user: "users";
21
21
  readonly role: "roles";
22
+ readonly team: "teams";
23
+ readonly member: "members";
22
24
  readonly machine: "machines";
23
25
  readonly app: "apps";
24
26
  readonly session: "sessions";
@@ -43,9 +45,10 @@ export declare const resources: {
43
45
  readonly item: "items";
44
46
  readonly organisation: "organisations";
45
47
  readonly home: "homes";
48
+ readonly job: "jobs";
46
49
  };
47
50
  export declare const actions: readonly ["list", "get", "create", "update", "archive", "restore", "purge"];
48
- export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel"];
51
+ export declare const verbs: readonly ["invite", "resend", "disable", "enable", "rotate", "share", "move", "start", "complete", "test", "revoke", "remove", "unlock", "publish", "schedule", "unpublish", "cancel", "describe"];
49
52
  export type Package = (typeof packages)[number];
50
53
  export type Resource = keyof typeof resources;
51
54
  export type Action = (typeof actions)[number] | (typeof verbs)[number];
@@ -39,6 +39,13 @@ export const resources = {
39
39
  link: "links",
40
40
  user: "users",
41
41
  role: "roles",
42
+ // A named group of people and Operators that carries roles and can be given a node (#1121, E243):
43
+ // `access_team_*`. Decided by the orchestrator.
44
+ team: "teams",
45
+ // A user, person or machine, in a team (#1121, E243), a sub-resource of the team:
46
+ // `access_team_member_create` and `_remove`. Not `user`, because `access_team_user_*` would read
47
+ // like the user resource itself. Decided by the orchestrator.
48
+ member: "members",
42
49
  machine: "machines",
43
50
  app: "apps",
44
51
  session: "sessions",
@@ -89,6 +96,11 @@ export const resources = {
89
96
  // gadget stands under `/`, the setup steps and Colab's news. One per installation like
90
97
  // `organisation`, so its route carries no id. The word the orchestrator gave the start for #993.
91
98
  home: "homes",
99
+ // A run over many archive entries that the server works off in the queue, entry by entry (#1129,
100
+ // E236): `intelligence_job_create` deletes for good or restores the entries it names, `_get` says
101
+ // how far it is, `_list` the person's jobs still running. Only a person in the browser starts or
102
+ // reads one; no AI (D124). Decided by the orchestrator.
103
+ job: "jobs",
92
104
  };
93
105
  // The closed list of actions with a route of their own shape.
94
106
  export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
@@ -122,6 +134,9 @@ export const verbs = [
122
134
  // stays to restore, and a cancelled run may still be billed. An Operator run stopped by hand is
123
135
  // the same (E112): `operator_run_cancel`.
124
136
  "cancel",
137
+ // Colab describes an image to the AI that asks (#1126, E244): `intelligence_file_describe`. Not
138
+ // `get`: the first call makes the description with a model and stores it at the version.
139
+ "describe",
125
140
  ];
126
141
  const reads = { readOnlyHint: true };
127
142
  // Takes nothing away for good. `archive`, `disable` and `unpublish` have their way back (`restore`,
@@ -170,6 +185,8 @@ const actionAnnotations = {
170
185
  schedule: writes,
171
186
  unpublish: writes,
172
187
  cancel: destroys,
188
+ // Stores the description of a version on the first call; takes nothing away.
189
+ describe: writes,
173
190
  };
174
191
  export function isPackage(word) {
175
192
  return packages.includes(word);
@@ -15,12 +15,15 @@ export declare const NodeGrantListInput: z.ZodObject<{
15
15
  export type NodeGrantListInput = z.infer<typeof NodeGrantListInput>;
16
16
  export declare const NodeGrant: z.ZodObject<{
17
17
  grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
18
- userId: z.ZodString;
18
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
19
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
19
20
  name: z.ZodNullable<z.ZodString>;
20
21
  kind: z.ZodNullable<z.ZodEnum<{
22
+ team: "team";
21
23
  machine: "machine";
22
24
  human: "human";
23
25
  }>>;
26
+ members: z.ZodNullable<z.ZodNumber>;
24
27
  email: z.ZodNullable<z.ZodString>;
25
28
  right: z.ZodEnum<{
26
29
  share: "share";
@@ -37,12 +40,15 @@ export type NodeGrant = z.infer<typeof NodeGrant>;
37
40
  export declare const NodeGrantList: z.ZodObject<{
38
41
  items: z.ZodArray<z.ZodObject<{
39
42
  grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
40
- userId: z.ZodString;
43
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
44
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
41
45
  name: z.ZodNullable<z.ZodString>;
42
46
  kind: z.ZodNullable<z.ZodEnum<{
47
+ team: "team";
43
48
  machine: "machine";
44
49
  human: "human";
45
50
  }>>;
51
+ members: z.ZodNullable<z.ZodNumber>;
46
52
  email: z.ZodNullable<z.ZodString>;
47
53
  right: z.ZodEnum<{
48
54
  share: "share";
@@ -60,7 +66,8 @@ export declare const NodeGrantList: z.ZodObject<{
60
66
  export type NodeGrantList = z.infer<typeof NodeGrantList>;
61
67
  export declare const NodeShareInput: z.ZodObject<{
62
68
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
63
- userId: z.ZodTemplateLiteral<`user_${string}`>;
69
+ userId: z.ZodOptional<z.ZodTemplateLiteral<`user_${string}`>>;
70
+ teamId: z.ZodOptional<z.ZodTemplateLiteral<`team_${string}`>>;
64
71
  right: z.ZodEnum<{
65
72
  share: "share";
66
73
  write: "write";
@@ -71,7 +78,8 @@ export type NodeShareInput = z.infer<typeof NodeShareInput>;
71
78
  export declare const NodeShared: z.ZodObject<{
72
79
  nodeId: z.ZodTemplateLiteral<`node_${string}`>;
73
80
  grantId: z.ZodTemplateLiteral<`grant_${string}`>;
74
- userId: z.ZodString;
81
+ userId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
82
+ teamId: z.ZodNullable<z.ZodTemplateLiteral<`team_${string}`>>;
75
83
  right: z.ZodEnum<{
76
84
  share: "share";
77
85
  write: "write";
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { idSchema } from "../ids/ids.js";
3
3
  import { Limit as PageSize } from "../list-input.js";
4
4
  import { NodeId } from "../nodes/nodes.js";
5
+ import { TeamId } from "../teams/teams.js";
5
6
  // Sharing a node (#37, Funktionen › Freigeben und Versionen, D138): the inputs of
6
7
  // `intelligence_node_grant_list`, `intelligence_node_share` and `intelligence_node_grant_revoke`,
7
8
  // and their answers. Like Google Drive: three rights, a grant on a folder reaches everything in it,
@@ -18,15 +19,20 @@ export const NodeGrantListInput = z.strictObject({
18
19
  .describe("The nextCursor of the previous page, unchanged. Leaving it out starts at the top."),
19
20
  limit: PageSize.optional().describe("How many people one page holds, 1 to 100. Leaving it out gives 100."),
20
21
  });
21
- // One person who reaches the node, with the strongest right they hold and where it comes from.
22
+ // One person, or one team (#1121, E243), who reaches the node, with the strongest right they hold
23
+ // and where it comes from. A team stands as itself, never as its members.
22
24
  export const NodeGrant = z.object({
23
25
  // The grant to revoke: on this node, or on the folder `inheritedFrom`. Null for the creator of the
24
26
  // node or of a folder above it, whose right is no grant.
25
27
  grantId: GrantId.nullable(),
26
- userId: z.string(),
27
- // As `access` names them today; null for an account that is gone.
28
+ // The holder, exactly one of the two (#1121): a person or machine, or a team.
29
+ userId: idSchema("user").nullable(),
30
+ teamId: TeamId.nullable(),
31
+ // As `access` names them today; null for an account or a team that is gone.
28
32
  name: z.string().nullable(),
29
- kind: z.enum(["human", "machine"]).nullable(),
33
+ kind: z.enum(["human", "machine", "team"]).nullable(),
34
+ // A team's members today; null for a person or machine.
35
+ members: z.number().int().nullable(),
30
36
  // The person's address, shown under the name (#150); null for a machine and for an account that
31
37
  // is gone.
32
38
  email: z.string().nullable(),
@@ -40,15 +46,24 @@ export const NodeGrantList = z.object({
40
46
  items: z.array(NodeGrant),
41
47
  nextCursor: z.string().nullable(),
42
48
  });
43
- export const NodeShareInput = z.strictObject({
49
+ export const NodeShareInput = z
50
+ .strictObject({
44
51
  nodeId: NodeId,
45
- userId: idSchema("user").describe("The person or machine to share with, `user_…`, as intelligence_user_list finds them. A locked account cannot be given a right."),
46
- right: GrantRight.describe("read sees the node, write also changes it, share also shares it further. Sharing again with someone who holds a grant sets their right to this one. A node in its creator's own area moves to the top level of Shared."),
52
+ userId: idSchema("user")
53
+ .optional()
54
+ .describe("The person or machine to share with, `user_…`, as intelligence_user_list finds them. A locked account cannot be given a right. Give userId or teamId."),
55
+ teamId: TeamId.optional().describe("The team to share with, `team_…`, as access_team_list finds it: every member reaches the node, and loses it on leaving the team (#1121). Only read or write. The node stays where it is. Give userId or teamId."),
56
+ right: GrantRight.describe("read sees the node, write also changes it, share also shares it further (not for a team). Sharing again with someone who holds a grant sets their right to this one. A node in its creator's own area moves to the top level of Shared, unless it goes to a machine or a team."),
57
+ })
58
+ .refine((input) => (input.userId === undefined) !== (input.teamId === undefined), {
59
+ message: "Give exactly one of userId and teamId.",
47
60
  });
48
61
  export const NodeShared = z.object({
49
62
  nodeId: NodeId,
50
63
  grantId: GrantId,
51
- userId: z.string(),
64
+ // The holder, exactly one of the two (#1121): a person or machine, or a team.
65
+ userId: idSchema("user").nullable(),
66
+ teamId: TeamId.nullable(),
52
67
  right: GrantRight,
53
68
  // Where the node stands now: null is the top level of Shared.
54
69
  parentId: NodeId.nullable(),
@@ -3,12 +3,12 @@ export declare const homeSetupSteps: readonly ["profile", "ai", "operator", "goa
3
3
  export declare const HomeSetupStep: z.ZodEnum<{
4
4
  operator: "operator";
5
5
  goal: "goal";
6
+ team: "team";
6
7
  connector: "connector";
7
8
  credential: "credential";
8
9
  signin: "signin";
9
10
  profile: "profile";
10
11
  ai: "ai";
11
- team: "team";
12
12
  }>;
13
13
  export type HomeSetupStep = z.infer<typeof HomeSetupStep>;
14
14
  export declare const homePersonSteps: ReadonlySet<HomeSetupStep>;
@@ -32,12 +32,12 @@ export declare const HomeSetupState: z.ZodObject<{
32
32
  step: z.ZodEnum<{
33
33
  operator: "operator";
34
34
  goal: "goal";
35
+ team: "team";
35
36
  connector: "connector";
36
37
  credential: "credential";
37
38
  signin: "signin";
38
39
  profile: "profile";
39
40
  ai: "ai";
40
- team: "team";
41
41
  }>;
42
42
  scope: z.ZodEnum<{
43
43
  organisation: "organisation";
@@ -52,12 +52,12 @@ export declare const Home: z.ZodObject<{
52
52
  step: z.ZodEnum<{
53
53
  operator: "operator";
54
54
  goal: "goal";
55
+ team: "team";
55
56
  connector: "connector";
56
57
  credential: "credential";
57
58
  signin: "signin";
58
59
  profile: "profile";
59
60
  ai: "ai";
60
- team: "team";
61
61
  }>;
62
62
  scope: z.ZodEnum<{
63
63
  organisation: "organisation";
@@ -1,17 +1,14 @@
1
1
  import { z } from "zod";
2
- export declare const validationSection = "Validation";
3
2
  export declare const instructionsNames: readonly ["INSTRUCTIONS", ".INSTRUCTIONS"];
4
3
  export declare function isInstructionsName(name: string): boolean;
5
4
  export declare const InstructionsLink: z.ZodObject<{
6
5
  path: z.ZodString;
7
- status: z.ZodNullable<z.ZodString>;
8
6
  markdown: z.ZodString;
9
7
  }, z.core.$strip>;
10
8
  export type InstructionsLink = z.infer<typeof InstructionsLink>;
11
9
  export declare const Instructions: z.ZodObject<{
12
10
  chain: z.ZodArray<z.ZodObject<{
13
11
  path: z.ZodString;
14
- status: z.ZodNullable<z.ZodString>;
15
12
  markdown: z.ZodString;
16
13
  }, z.core.$strip>>;
17
14
  hint: z.ZodOptional<z.ZodString>;
@@ -43,7 +40,6 @@ export type InstructionRead = z.infer<typeof InstructionRead>;
43
40
  export declare const InstructionsRead: z.ZodUnion<readonly [z.ZodObject<{
44
41
  chain: z.ZodArray<z.ZodObject<{
45
42
  path: z.ZodString;
46
- status: z.ZodNullable<z.ZodString>;
47
43
  markdown: z.ZodString;
48
44
  }, z.core.$strip>>;
49
45
  hint: z.ZodOptional<z.ZodString>;
@@ -1,14 +1,10 @@
1
1
  import { z } from "zod";
2
2
  // The INSTRUCTIONS a person or machine gets over MCP (#39, Nodes › Ordner › INSTRUCTIONS, E31, E67,
3
- // E93): every INSTRUCTIONS on the way from the top down to a folder, each with its status, and of
4
- // each only the part meant for the caller (#356). Only text, a path and a status reach a model
5
- // (trap P033): never an id, an owner or a right. HTTP carries none of it; a person reads the
3
+ // E93): every INSTRUCTIONS on the way from the top down to a folder, and of each only the part meant
4
+ // for the caller (#356). Only text and a path reach a model (trap P033): never an id, an owner or a right. HTTP carries none of it; a person reads the
6
5
  // documents themselves.
7
- // The one fixed heading (E93, #356): `## Validation` tells the holder of `validator` how this area is
8
- // checked, and nobody else gets it. English, never translated. The headings per node type and
9
- // `## Operator` of E30 are gone; besides it, only a level-one heading `# @name` opens a section, one
10
- // machine's own. Everything else counts for every AI.
11
- export const validationSection = "Validation";
6
+ // The one kind of section (E93, #356): a level-one heading `# @name` opens a section, one machine's
7
+ // own. Everything else counts for every AI.
12
8
  // The two names an INSTRUCTIONS document may carry in a folder: hidden by default, visible only in a
13
9
  // machine's root folder. A folder holds at most one of them.
14
10
  export const instructionsNames = ["INSTRUCTIONS", ".INSTRUCTIONS"];
@@ -20,12 +16,8 @@ export const InstructionsLink = z.object({
20
16
  // Where it stands, as the caller can read it, from the first readable folder below a root folder
21
17
  // down to the document itself: `Vertrieb/Leads/.INSTRUCTIONS`.
22
18
  path: z.string(),
23
- // Its validation status, the type of the column its ticket stands in (#47); null without a
24
- // ticket. Every link is handed over, whatever its status (E31).
25
- status: z.string().nullable(),
26
19
  // The document's Markdown as its current version holds it, cut to what the caller gets (#356):
27
- // the text under no heading, `## Validation` for the holder of `validator`, a machine's own
28
- // `# @name` sections.
20
+ // the text under no heading and a machine's own `# @name` sections.
29
21
  markdown: z.string(),
30
22
  });
31
23
  export const Instructions = z.object({
@@ -13,6 +13,7 @@ export type Delivery = z.infer<typeof Delivery>;
13
13
  export declare const InvitationCreateInput: z.ZodObject<{
14
14
  email: z.ZodEmail;
15
15
  roleIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`role_${string}`>>>;
16
+ teamIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`team_${string}`>>>;
16
17
  }, z.core.$strict>;
17
18
  export type InvitationCreateInput = z.infer<typeof InvitationCreateInput>;
18
19
  export declare const InvitationResendInput: z.ZodObject<{
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { idSchema } from "../ids/ids.js";
3
3
  import { Name } from "../profile/profile.js";
4
4
  import { RoleId } from "../roles/roles.js";
5
+ import { TeamId } from "../teams/teams.js";
5
6
  // Invitations (Einstellungen › Nutzer, #25): the inputs of the `access_invitation_*` tools, the
6
7
  // doors under `/auth/invitation` the invited person uses, and the answers. An invitation lives seven
7
8
  // days, carries one valid token at a time, and its roles become the person's on acceptance.
@@ -15,6 +16,13 @@ const RoleIds = z.array(RoleId).max(50);
15
16
  export const InvitationCreateInput = z.strictObject({
16
17
  email: z.email(),
17
18
  roleIds: RoleIds.optional(),
19
+ // The teams the account joins on acceptance (#1121, E243), besides "Gesamte Firma", which every
20
+ // new person joins; without the field none besides it.
21
+ teamIds: z
22
+ .array(TeamId)
23
+ .max(50)
24
+ .optional()
25
+ .describe('The teams the new account joins on acceptance. Every new person joins "Gesamte Firma" anyway. Without the field no other.'),
18
26
  });
19
27
  export const InvitationResendInput = z.strictObject({ invitationId: InvitationId });
20
28
  export const InvitationRevokeInput = z.strictObject({ invitationId: InvitationId });
@@ -0,0 +1,67 @@
1
+ import { z } from "zod";
2
+ export declare const JobId: z.ZodTemplateLiteral<`job_${string}`>;
3
+ export type JobId = z.infer<typeof JobId>;
4
+ export declare const JobKind: z.ZodEnum<{
5
+ restore: "restore";
6
+ purge: "purge";
7
+ }>;
8
+ export type JobKind = z.infer<typeof JobKind>;
9
+ export declare const maxJobEntries = 2000;
10
+ export declare const maxJobRefusedNamed = 100;
11
+ export declare const JobCreateInput: z.ZodObject<{
12
+ kind: z.ZodEnum<{
13
+ restore: "restore";
14
+ purge: "purge";
15
+ }>;
16
+ nodeIds: z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>;
17
+ idempotencyKey: z.ZodString;
18
+ }, z.core.$strict>;
19
+ export type JobCreateInput = z.infer<typeof JobCreateInput>;
20
+ export declare const JobGetInput: z.ZodObject<{
21
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
22
+ }, z.core.$strict>;
23
+ export type JobGetInput = z.infer<typeof JobGetInput>;
24
+ export declare const JobListInput: z.ZodObject<{}, z.core.$strict>;
25
+ export type JobListInput = z.infer<typeof JobListInput>;
26
+ export declare const JobRefused: z.ZodObject<{
27
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
28
+ name: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export type JobRefused = z.infer<typeof JobRefused>;
31
+ export declare const Job: z.ZodObject<{
32
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
33
+ kind: z.ZodEnum<{
34
+ restore: "restore";
35
+ purge: "purge";
36
+ }>;
37
+ total: z.ZodNumber;
38
+ done: z.ZodNumber;
39
+ refused: z.ZodNumber;
40
+ refusedEntries: z.ZodArray<z.ZodObject<{
41
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
42
+ name: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>>;
44
+ createdAt: z.ZodString;
45
+ completedAt: z.ZodNullable<z.ZodString>;
46
+ }, z.core.$strip>;
47
+ export type Job = z.infer<typeof Job>;
48
+ export declare const JobList: z.ZodObject<{
49
+ items: z.ZodArray<z.ZodObject<{
50
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
51
+ kind: z.ZodEnum<{
52
+ restore: "restore";
53
+ purge: "purge";
54
+ }>;
55
+ total: z.ZodNumber;
56
+ done: z.ZodNumber;
57
+ refused: z.ZodNumber;
58
+ refusedEntries: z.ZodArray<z.ZodObject<{
59
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
60
+ name: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strip>>;
62
+ createdAt: z.ZodString;
63
+ completedAt: z.ZodNullable<z.ZodString>;
64
+ }, z.core.$strip>>;
65
+ nextCursor: z.ZodNull;
66
+ }, z.core.$strip>;
67
+ export type JobList = z.infer<typeof JobList>;