@anchrd/colab-sdk 0.0.0-stage → 0.1.1

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 (94) hide show
  1. package/README.md +65 -2
  2. package/dist/actions/actions.d.ts +810 -0
  3. package/dist/actions/actions.js +177 -0
  4. package/dist/admin-mode.d.ts +2 -0
  5. package/dist/admin-mode.js +5 -0
  6. package/dist/apps/apps.d.ts +108 -0
  7. package/dist/apps/apps.js +73 -0
  8. package/dist/archive/archive.d.ts +25 -0
  9. package/dist/archive/archive.js +27 -0
  10. package/dist/auth/auth.d.ts +27 -0
  11. package/dist/auth/auth.js +22 -0
  12. package/dist/authorization/authorization.d.ts +36 -0
  13. package/dist/authorization/authorization.js +23 -0
  14. package/dist/boards/boards.d.ts +612 -0
  15. package/dist/boards/boards.js +289 -0
  16. package/dist/columns/columns.d.ts +28 -0
  17. package/dist/columns/columns.js +28 -0
  18. package/dist/connections/connections.d.ts +149 -0
  19. package/dist/connections/connections.js +74 -0
  20. package/dist/connectors/connectors.d.ts +148 -0
  21. package/dist/connectors/connectors.js +83 -0
  22. package/dist/dashboards/dashboards.d.ts +221 -0
  23. package/dist/dashboards/dashboards.js +520 -0
  24. package/dist/directory/directory.d.ts +20 -0
  25. package/dist/directory/directory.js +18 -0
  26. package/dist/documents/documents.d.ts +61 -0
  27. package/dist/documents/documents.js +58 -0
  28. package/dist/error/error.d.ts +34 -0
  29. package/dist/error/error.js +30 -0
  30. package/dist/events/events.d.ts +104 -0
  31. package/dist/events/events.js +69 -0
  32. package/dist/files/files.d.ts +60 -0
  33. package/dist/files/files.js +139 -0
  34. package/dist/functions/functions.d.ts +26 -0
  35. package/dist/functions/functions.js +28 -0
  36. package/dist/grammar/grammar.d.ts +62 -0
  37. package/dist/grammar/grammar.js +197 -0
  38. package/dist/grants/grants.d.ts +93 -0
  39. package/dist/grants/grants.js +66 -0
  40. package/dist/ids/ids.d.ts +5 -0
  41. package/dist/ids/ids.js +12 -0
  42. package/dist/instructions/instructions.d.ts +19 -0
  43. package/dist/instructions/instructions.js +35 -0
  44. package/dist/interfaces/interfaces.d.ts +41 -0
  45. package/dist/interfaces/interfaces.js +52 -0
  46. package/dist/invitations/invitations.d.ts +98 -0
  47. package/dist/invitations/invitations.js +58 -0
  48. package/dist/links/links.d.ts +76 -0
  49. package/dist/links/links.js +73 -0
  50. package/dist/list-input.d.ts +3 -0
  51. package/dist/list-input.js +11 -0
  52. package/dist/machines/machines.d.ts +69 -0
  53. package/dist/machines/machines.js +39 -0
  54. package/dist/messages/messages.d.ts +117 -0
  55. package/dist/messages/messages.js +77 -0
  56. package/dist/nodes/nodes.d.ts +673 -0
  57. package/dist/nodes/nodes.js +354 -0
  58. package/dist/operators/operators.d.ts +898 -0
  59. package/dist/operators/operators.js +398 -0
  60. package/dist/pages/pages.d.ts +89 -0
  61. package/dist/pages/pages.js +62 -0
  62. package/dist/primitives/primitives.d.ts +5 -0
  63. package/dist/primitives/primitives.js +19 -0
  64. package/dist/profile/profile.d.ts +37 -0
  65. package/dist/profile/profile.js +43 -0
  66. package/dist/roles/roles.d.ts +135 -0
  67. package/dist/roles/roles.js +87 -0
  68. package/dist/runs/runs.d.ts +244 -0
  69. package/dist/runs/runs.js +137 -0
  70. package/dist/runtime-config.d.ts +12 -0
  71. package/dist/runtime-config.js +18 -0
  72. package/dist/sdk.d.ts +45 -0
  73. package/dist/sdk.js +48 -0
  74. package/dist/secrets/secrets.d.ts +65 -0
  75. package/dist/secrets/secrets.js +57 -0
  76. package/dist/service-client/service-client.d.ts +35 -0
  77. package/dist/service-client/service-client.js +90 -0
  78. package/dist/services/services.d.ts +122 -0
  79. package/dist/services/services.js +89 -0
  80. package/dist/sso/sso.d.ts +70 -0
  81. package/dist/sso/sso.js +54 -0
  82. package/dist/tables/tables.d.ts +133 -0
  83. package/dist/tables/tables.js +131 -0
  84. package/dist/tool.d.ts +31 -0
  85. package/dist/tool.js +4 -0
  86. package/dist/user-settings/user-settings.d.ts +44 -0
  87. package/dist/user-settings/user-settings.js +44 -0
  88. package/dist/users/users.d.ts +254 -0
  89. package/dist/users/users.js +125 -0
  90. package/dist/validation/validation.d.ts +106 -0
  91. package/dist/validation/validation.js +41 -0
  92. package/dist/versions/versions.d.ts +100 -0
  93. package/dist/versions/versions.js +70 -0
  94. package/package.json +27 -4
@@ -0,0 +1,197 @@
1
+ // The naming grammar `package · resource · action` (E54, E64, E66): the word lists in one place, and
2
+ // everything a tool name decides. A new word is proposed to the orchestrator, never invented here.
3
+ //
4
+ // ⚠️ Every word is a single word: no hyphen, no underscore. That is what lets a tool name split at
5
+ // `_` into exactly one reading.
6
+ // The packages that carry tools. `sdk` and `shared` are packages too, but no tool starts with them.
7
+ export const packages = [
8
+ "intelligence",
9
+ "access",
10
+ "connectors",
11
+ "documentation",
12
+ "mail",
13
+ "operator",
14
+ ];
15
+ // Singular in tool name and right, plural in the URL. Written out on purpose: a plural rule in code
16
+ // would one day produce a word nobody chose.
17
+ export const resources = {
18
+ node: "nodes",
19
+ folder: "folders",
20
+ document: "documents",
21
+ table: "tables",
22
+ board: "boards",
23
+ task: "tasks",
24
+ dashboard: "dashboards",
25
+ file: "files",
26
+ run: "runs",
27
+ version: "versions",
28
+ chat: "chats",
29
+ message: "messages",
30
+ action: "actions",
31
+ grant: "grants",
32
+ link: "links",
33
+ user: "users",
34
+ role: "roles",
35
+ machine: "machines",
36
+ app: "apps",
37
+ session: "sessions",
38
+ service: "services",
39
+ interface: "interfaces",
40
+ function: "functions",
41
+ invitation: "invitations",
42
+ connector: "connectors",
43
+ connection: "connections",
44
+ call: "calls",
45
+ event: "events",
46
+ page: "pages",
47
+ // An Operator's credential at its provider (#336, "Zugang"): `operator_credential_*`. Not `access`,
48
+ // a package word (every word stands in one list only), and not `account`, the prefix of Better
49
+ // Auth's linked sign-in accounts in `access` (`account_…`, PR #351).
50
+ credential: "credentials",
51
+ // A sign-in provider set up under Einstellungen › SSO (#358, E90): `access_sso_*`, named by the
52
+ // ticket. An abbreviation without a plural, so the URL keeps it: `/api/access/sso/:ssoId`.
53
+ sso: "sso",
54
+ // The password of a secret document or table (#357, E94), a sub-resource of the node, decided by
55
+ // the orchestrator: `intelligence_node_secret_create` makes a node secret, `_update` changes the
56
+ // password, `_get` shows it to an admin in admin mode, `_remove` makes the node public again. One
57
+ // per node, with an id of its own like every sub-resource (`secret_…`).
58
+ secret: "secrets",
59
+ };
60
+ // The closed list of actions with a route of their own shape.
61
+ export const actions = ["list", "get", "create", "update", "archive", "restore", "purge"];
62
+ // Domain verbs: always `POST /<resources>/:<resource>Id/<verb>`. `revoke` ends at once and without
63
+ // archive, `remove` takes out an entry without archive (E66).
64
+ export const verbs = [
65
+ "invite",
66
+ "resend",
67
+ "disable",
68
+ "enable",
69
+ "rotate",
70
+ "share",
71
+ "move",
72
+ "start",
73
+ "complete",
74
+ "test",
75
+ "revoke",
76
+ "remove",
77
+ // Opening a secret document or table with its password for this browser session, 15 minutes
78
+ // (#357, E94), decided by the orchestrator: `intelligence_node_unlock`. Not `get` (it changes who
79
+ // may read) and not `create` of a resource (the release is no thing anybody lists or names).
80
+ "unlock",
81
+ ];
82
+ export function isPackage(word) {
83
+ return packages.includes(word);
84
+ }
85
+ function isResource(word) {
86
+ // `hasOwn`, not `in`: `constructor` must not pass as a resource.
87
+ return Object.hasOwn(resources, word);
88
+ }
89
+ export function isAction(word) {
90
+ return (actions.includes(word) || verbs.includes(word));
91
+ }
92
+ // One word of a name: lowercase, starting with a letter, no hyphen, no underscore (E64). A connector's
93
+ // id and its provider's resources are held to it although they stand in no list here.
94
+ export function isWord(word) {
95
+ return /^[a-z][a-z0-9]*$/.test(word);
96
+ }
97
+ // A connector's function, the key of its `tools` (`order-list`, `order-line-list`): its provider's
98
+ // resources, each a single word but in no list (they are the provider's, not Colab's), and the
99
+ // action last, from the lists above (#5). The tool is `<id>_<resources>_<action>`
100
+ // (`shopify_order_list`), the right `connectors / <id> / <function>`.
101
+ export function parseConnectorFunction(key) {
102
+ const words = key.split("-");
103
+ const action = words.pop() ?? "";
104
+ if (words.length === 0)
105
+ throw new Error(`"${key}": needs a resource and an action, "order-list"`);
106
+ const bad = words.find((word) => !isWord(word));
107
+ if (bad !== undefined)
108
+ throw new Error(`"${key}": "${bad}" is not a single lowercase word (E64)`);
109
+ if (!isAction(action))
110
+ throw new Error(`"${key}": "${action}" is not an action`);
111
+ return { resources: words, action };
112
+ }
113
+ // Whether a tool has a REST route. A name that does not start with a package word is a connector's
114
+ // tool (`shopify_order_list`): only an AI calls it, the UI never does, so it has no route under
115
+ // `/api` (#5). The structure test holds that only `connectors` delivers such names, each starting
116
+ // with the id of a connector in the installation's list.
117
+ export function hasRoute(name) {
118
+ return isPackage(name.split("_")[0] ?? "");
119
+ }
120
+ // Throws with the reason when the name is not a sentence of the grammar.
121
+ export function parseToolName(name) {
122
+ const parts = name.split("_");
123
+ const hyphenated = parts.find((part) => part.includes("-"));
124
+ if (hyphenated !== undefined) {
125
+ throw new Error(`${name}: "${hyphenated}" contains "-", every word is one word (E64)`);
126
+ }
127
+ const [first = "", ...rest] = parts;
128
+ const last = rest.pop() ?? "";
129
+ if (rest.length === 0) {
130
+ throw new Error(`${name}: needs package, at least one resource and an action`);
131
+ }
132
+ if (!isPackage(first)) {
133
+ throw new Error(`${name}: "${first}" is not a package`);
134
+ }
135
+ if (!isAction(last)) {
136
+ throw new Error(`${name}: "${last}" is not an action`);
137
+ }
138
+ const unknown = rest.find((word) => !isResource(word));
139
+ if (unknown !== undefined) {
140
+ throw new Error(`${name}: "${unknown}" is not a resource`);
141
+ }
142
+ return { package: first, resources: rest, action: last };
143
+ }
144
+ // The tools whose route the rule below cannot derive, each with its reason. Written here and nowhere
145
+ // else, so the route test and the guard in front of `/api` read the same answer.
146
+ const routeExceptions = {
147
+ // A revoke of a SET of grants, named by a right or the prefix of a level in the body
148
+ // (`intelligence / document`), and the answer is the set that fell (#24, trap P334). There is no
149
+ // one `grantId` to put into the path.
150
+ access_role_grant_revoke: { method: "POST", path: "/api/access/roles/:roleId/grants/revoke" },
151
+ };
152
+ // `access_user_invite` → `POST /api/access/users/:userId/invite`.
153
+ export function toolRoute(name) {
154
+ const exception = routeExceptions[name];
155
+ if (exception)
156
+ return exception;
157
+ const { package: owner, resources: chain, action } = parseToolName(name);
158
+ const collection = action === "list" || action === "create";
159
+ const path = chain
160
+ .map((resource, index) => {
161
+ const plural = `/${resources[resource]}`;
162
+ const last = index === chain.length - 1;
163
+ return last && collection ? plural : `${plural}/:${resource}Id`;
164
+ })
165
+ .join("");
166
+ const base = `/api/${owner}${path}`;
167
+ switch (action) {
168
+ case "list":
169
+ case "get":
170
+ return { method: "GET", path: base };
171
+ case "create":
172
+ return { method: "POST", path: base };
173
+ case "update":
174
+ return { method: "PATCH", path: base };
175
+ case "purge":
176
+ return { method: "DELETE", path: base };
177
+ default:
178
+ // archive, restore and every domain verb.
179
+ return { method: "POST", path: `${base}/${action}` };
180
+ }
181
+ }
182
+ // `access_user_invite` → `access / user / invite`.
183
+ export function toolPermission(name) {
184
+ const { package: owner, resources: chain, action } = parseToolName(name);
185
+ return [owner, ...chain, action].join(" / ");
186
+ }
187
+ // `access_user_invite` → `user.invite`.
188
+ export function toolEvent(name) {
189
+ const { resources: chain, action } = parseToolName(name);
190
+ return [...chain, action].join(".");
191
+ }
192
+ // `access_user_invite` → `UserInviteInput`.
193
+ export function toolSchemaName(name) {
194
+ const { resources: chain, action } = parseToolName(name);
195
+ const words = [...chain, action].map((word) => word.charAt(0).toUpperCase() + word.slice(1));
196
+ return `${words.join("")}Input`;
197
+ }
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ export declare const GrantId: z.ZodTemplateLiteral<`grant_${string}`>;
3
+ export type GrantId = z.infer<typeof GrantId>;
4
+ export declare const GrantRight: z.ZodEnum<{
5
+ share: "share";
6
+ write: "write";
7
+ read: "read";
8
+ }>;
9
+ export type GrantRight = z.infer<typeof GrantRight>;
10
+ export declare const NodeGrantListInput: z.ZodObject<{
11
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
12
+ cursor: z.ZodOptional<z.ZodString>;
13
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
14
+ }, z.core.$strict>;
15
+ export type NodeGrantListInput = z.infer<typeof NodeGrantListInput>;
16
+ export declare const NodeGrant: z.ZodObject<{
17
+ grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
18
+ userId: z.ZodString;
19
+ name: z.ZodNullable<z.ZodString>;
20
+ kind: z.ZodNullable<z.ZodEnum<{
21
+ machine: "machine";
22
+ human: "human";
23
+ }>>;
24
+ email: z.ZodNullable<z.ZodString>;
25
+ right: z.ZodEnum<{
26
+ share: "share";
27
+ write: "write";
28
+ read: "read";
29
+ }>;
30
+ creator: z.ZodBoolean;
31
+ inheritedFrom: z.ZodNullable<z.ZodObject<{
32
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
33
+ name: z.ZodString;
34
+ }, z.core.$strict>>;
35
+ }, z.core.$strict>;
36
+ export type NodeGrant = z.infer<typeof NodeGrant>;
37
+ export declare const NodeGrantList: z.ZodObject<{
38
+ items: z.ZodArray<z.ZodObject<{
39
+ grantId: z.ZodNullable<z.ZodTemplateLiteral<`grant_${string}`>>;
40
+ userId: z.ZodString;
41
+ name: z.ZodNullable<z.ZodString>;
42
+ kind: z.ZodNullable<z.ZodEnum<{
43
+ machine: "machine";
44
+ human: "human";
45
+ }>>;
46
+ email: z.ZodNullable<z.ZodString>;
47
+ right: z.ZodEnum<{
48
+ share: "share";
49
+ write: "write";
50
+ read: "read";
51
+ }>;
52
+ creator: z.ZodBoolean;
53
+ inheritedFrom: z.ZodNullable<z.ZodObject<{
54
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
55
+ name: z.ZodString;
56
+ }, z.core.$strict>>;
57
+ }, z.core.$strict>>;
58
+ nextCursor: z.ZodNullable<z.ZodString>;
59
+ }, z.core.$strict>;
60
+ export type NodeGrantList = z.infer<typeof NodeGrantList>;
61
+ export declare const NodeShareInput: z.ZodObject<{
62
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
63
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
64
+ right: z.ZodEnum<{
65
+ share: "share";
66
+ write: "write";
67
+ read: "read";
68
+ }>;
69
+ }, z.core.$strict>;
70
+ export type NodeShareInput = z.infer<typeof NodeShareInput>;
71
+ export declare const NodeShared: z.ZodObject<{
72
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
73
+ grantId: z.ZodTemplateLiteral<`grant_${string}`>;
74
+ userId: z.ZodString;
75
+ right: z.ZodEnum<{
76
+ share: "share";
77
+ write: "write";
78
+ read: "read";
79
+ }>;
80
+ parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
81
+ }, z.core.$strict>;
82
+ export type NodeShared = z.infer<typeof NodeShared>;
83
+ export declare const NodeGrantRevokeInput: z.ZodObject<{
84
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
85
+ grantId: z.ZodTemplateLiteral<`grant_${string}`>;
86
+ }, z.core.$strict>;
87
+ export type NodeGrantRevokeInput = z.infer<typeof NodeGrantRevokeInput>;
88
+ export declare const NodeGrantRevoked: z.ZodObject<{
89
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
90
+ grantId: z.ZodTemplateLiteral<`grant_${string}`>;
91
+ parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
92
+ }, z.core.$strict>;
93
+ export type NodeGrantRevoked = z.infer<typeof NodeGrantRevoked>;
@@ -0,0 +1,66 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ import { Limit as PageSize } from "../list-input.js";
4
+ import { NodeId } from "../nodes/nodes.js";
5
+ // Sharing a node (#37, Funktionen › Freigeben und Versionen, D138): the inputs of
6
+ // `intelligence_node_grant_list`, `intelligence_node_share` and `intelligence_node_grant_revoke`,
7
+ // and their answers. Like Google Drive: three rights, a grant on a folder reaches everything in it,
8
+ // and the creator's right is no grant and cannot be taken.
9
+ export const GrantId = idSchema("grant").describe("The grant's id, `grant_…`, as intelligence_node_grant_list names it.");
10
+ // Each includes the ones before it: write reads, share writes.
11
+ export const GrantRight = z.enum(["read", "write", "share"]);
12
+ export const NodeGrantListInput = z.strictObject({
13
+ nodeId: NodeId,
14
+ cursor: z
15
+ .string()
16
+ .max(1000)
17
+ .optional()
18
+ .describe("The nextCursor of the previous page, unchanged. Leaving it out starts at the top."),
19
+ limit: PageSize.optional().describe("How many people one page holds, 1 to 100. Leaving it out gives 100."),
20
+ });
21
+ // One person who reaches the node, with the strongest right they hold and where it comes from.
22
+ export const NodeGrant = z.strictObject({
23
+ // The grant to revoke: on this node, or on the folder `inheritedFrom`. Null for the creator of the
24
+ // node or of a folder above it, whose right is no grant.
25
+ grantId: GrantId.nullable(),
26
+ userId: z.string(),
27
+ // As `access` names them today; null for an account that is gone.
28
+ name: z.string().nullable(),
29
+ kind: z.enum(["human", "machine"]).nullable(),
30
+ // The person's address, shown under the name (#150); null for a machine and for an account that
31
+ // is gone.
32
+ email: z.string().nullable(),
33
+ right: GrantRight,
34
+ // Made this node: holds every right, and nobody takes it.
35
+ creator: z.boolean(),
36
+ // The folder the right comes from; null when it stands on this node.
37
+ inheritedFrom: z.strictObject({ nodeId: NodeId, name: z.string() }).nullable(),
38
+ });
39
+ export const NodeGrantList = z.strictObject({
40
+ items: z.array(NodeGrant),
41
+ nextCursor: z.string().nullable(),
42
+ });
43
+ export const NodeShareInput = z.strictObject({
44
+ 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."),
47
+ });
48
+ export const NodeShared = z.strictObject({
49
+ nodeId: NodeId,
50
+ grantId: GrantId,
51
+ userId: z.string(),
52
+ right: GrantRight,
53
+ // Where the node stands now: null is the top level of Shared.
54
+ parentId: NodeId.nullable(),
55
+ });
56
+ export const NodeGrantRevokeInput = z.strictObject({
57
+ nodeId: NodeId,
58
+ grantId: GrantId.describe("The grant to take back, as intelligence_node_grant_list names it for this node. One on the node itself falls; one on a folder above stays there, and the node moves out of that folder to the top level of Shared with only its own grants."),
59
+ });
60
+ export const NodeGrantRevoked = z.strictObject({
61
+ nodeId: NodeId,
62
+ grantId: GrantId,
63
+ // Where the node stands now: null is the top level of Shared; its creator's root folder when its
64
+ // last grant fell there.
65
+ parentId: NodeId.nullable(),
66
+ });
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ import type { Resource } from "../grammar/grammar.js";
3
+ export type Id<R extends Resource> = `${R}_${string}`;
4
+ export declare function createId<R extends Resource>(resource: R): Id<R>;
5
+ export declare function idSchema<R extends Resource>(resource: R): z.ZodTemplateLiteral<[z.ZodLiteral<R>, z.ZodLiteral<"_">] extends infer T ? T extends [z.ZodLiteral<R>, z.ZodLiteral<"_">] ? T extends z.core.$ZodTemplateLiteralPart[] ? `${z.core.$PartsToTemplateLiteral<T>}${string}` : never : never : never>;
@@ -0,0 +1,12 @@
1
+ import { ulid } from "ulid";
2
+ import { z } from "zod";
3
+ // A ULID in Crockford base32, as `ulid()` writes it: 26 characters, no I, L, O or U.
4
+ const ULID = /^[0-9A-HJKMNP-TV-Z]{26}$/;
5
+ export function createId(resource) {
6
+ return `${resource}_${ulid()}`;
7
+ }
8
+ // `idSchema("user")` takes `user_01J…` and rejects `node_01J…`. A template literal rather than a
9
+ // refinement, so the JSON Schema an MCP client reads carries the pattern too.
10
+ export function idSchema(resource) {
11
+ return z.templateLiteral([z.literal(resource), z.literal("_"), z.string().regex(ULID)]);
12
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export declare const validationSection = "Validation";
3
+ export declare const instructionsNames: readonly ["INSTRUCTIONS", ".INSTRUCTIONS"];
4
+ export declare function isInstructionsName(name: string): boolean;
5
+ export declare const InstructionsLink: z.ZodObject<{
6
+ path: z.ZodString;
7
+ status: z.ZodNullable<z.ZodString>;
8
+ markdown: z.ZodString;
9
+ }, z.core.$strict>;
10
+ export type InstructionsLink = z.infer<typeof InstructionsLink>;
11
+ export declare const Instructions: z.ZodObject<{
12
+ chain: z.ZodArray<z.ZodObject<{
13
+ path: z.ZodString;
14
+ status: z.ZodNullable<z.ZodString>;
15
+ markdown: z.ZodString;
16
+ }, z.core.$strict>>;
17
+ hint: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strict>;
19
+ export type Instructions = z.infer<typeof Instructions>;
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
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
6
+ // 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";
12
+ // The two names an INSTRUCTIONS document may carry in a folder: hidden by default, visible only in a
13
+ // machine's root folder. A folder holds at most one of them.
14
+ export const instructionsNames = ["INSTRUCTIONS", ".INSTRUCTIONS"];
15
+ export function isInstructionsName(name) {
16
+ return instructionsNames.includes(name);
17
+ }
18
+ // One link of the chain, top down.
19
+ export const InstructionsLink = z.strictObject({
20
+ // Where it stands, as the caller can read it, from the first readable folder below a root folder
21
+ // down to the document itself: `Vertrieb/Leads/.INSTRUCTIONS`.
22
+ 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
+ // 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.
29
+ markdown: z.string(),
30
+ });
31
+ export const Instructions = z.strictObject({
32
+ chain: z.array(InstructionsLink),
33
+ // Only when the whole chain holds more than 3,000 words (E67): one English sentence.
34
+ hint: z.string().optional(),
35
+ });
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ export declare const FunctionNames: z.ZodArray<z.ZodString>;
3
+ export declare const ServiceInterfaceCreateInput: z.ZodObject<{
4
+ serviceId: z.ZodTemplateLiteral<`service_${string}`>;
5
+ name: z.ZodString;
6
+ functions: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ }, z.core.$strict>;
8
+ export type ServiceInterfaceCreateInput = z.infer<typeof ServiceInterfaceCreateInput>;
9
+ export declare const ServiceInterfaceUpdateInput: z.ZodObject<{
10
+ serviceId: z.ZodTemplateLiteral<`service_${string}`>;
11
+ interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
12
+ name: z.ZodString;
13
+ }, z.core.$strict>;
14
+ export type ServiceInterfaceUpdateInput = z.infer<typeof ServiceInterfaceUpdateInput>;
15
+ export declare const ServiceInterfaceRemoveInput: z.ZodObject<{
16
+ serviceId: z.ZodTemplateLiteral<`service_${string}`>;
17
+ interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
18
+ }, z.core.$strict>;
19
+ export type ServiceInterfaceRemoveInput = z.infer<typeof ServiceInterfaceRemoveInput>;
20
+ export declare const InterfaceRemoved: z.ZodObject<{
21
+ interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
22
+ name: z.ZodString;
23
+ functions: z.ZodArray<z.ZodString>;
24
+ permissions: z.ZodArray<z.ZodString>;
25
+ }, z.core.$strict>;
26
+ export type InterfaceRemoved = z.infer<typeof InterfaceRemoved>;
27
+ export declare const ServiceInterfaceDeclareInput: z.ZodObject<{
28
+ functions: z.ZodArray<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ export type ServiceInterfaceDeclareInput = z.infer<typeof ServiceInterfaceDeclareInput>;
31
+ export declare const ServiceInterfaceDeclared: z.ZodObject<{
32
+ name: z.ZodString;
33
+ functions: z.ZodArray<z.ZodString>;
34
+ removed: z.ZodArray<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ export type ServiceInterfaceDeclared = z.infer<typeof ServiceInterfaceDeclared>;
37
+ export declare const ServiceInterfaceUndeclared: z.ZodObject<{
38
+ removed: z.ZodBoolean;
39
+ permissions: z.ZodArray<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export type ServiceInterfaceUndeclared = z.infer<typeof ServiceInterfaceUndeclared>;
@@ -0,0 +1,52 @@
1
+ import { z } from "zod";
2
+ import { InterfaceId, RightWord, ServiceId } from "../services/services.js";
3
+ // The interfaces of an outside service (#26): the admin's tools in `access`, and the service's own
4
+ // door that declares them with its key.
5
+ // A function list as the caller wants it to be. Each name once: a list that names one twice is a
6
+ // mistake, not a wish.
7
+ export const FunctionNames = z
8
+ .array(RightWord)
9
+ .max(200)
10
+ .refine((names) => new Set(names).size === names.length, "Each function once");
11
+ export const ServiceInterfaceCreateInput = z.strictObject({
12
+ serviceId: ServiceId,
13
+ name: RightWord,
14
+ functions: FunctionNames.optional(),
15
+ });
16
+ // Renames the interface and its rights in every role, in one step. A name the service already
17
+ // carries is `conflict`: joining two sets of rights under one name would widen them.
18
+ export const ServiceInterfaceUpdateInput = z.strictObject({
19
+ serviceId: ServiceId,
20
+ interfaceId: InterfaceId,
21
+ name: RightWord,
22
+ });
23
+ export const ServiceInterfaceRemoveInput = z.strictObject({
24
+ serviceId: ServiceId,
25
+ interfaceId: InterfaceId,
26
+ });
27
+ // What fell with a removed interface: its functions and the rights the roles held on them (trap
28
+ // P334: the answer names what fell, so the caller can read it).
29
+ export const InterfaceRemoved = z.strictObject({
30
+ interfaceId: InterfaceId,
31
+ name: z.string(),
32
+ functions: z.array(z.string()),
33
+ permissions: z.array(z.string()),
34
+ });
35
+ // The body of `PUT /auth/service/interfaces/:interface`: the target state of the service's own
36
+ // interface. A function missing from the list goes, with its rights.
37
+ export const ServiceInterfaceDeclareInput = z.strictObject({ functions: FunctionNames });
38
+ // ⚠️ The two answers of the service's own door are `z.object`, not strict, on purpose, like
39
+ // `AuthorizationResponse`: an outside service reads them with the SDK it installed, and Colab, the
40
+ // trusted sender, may add a field without breaking an older SDK (Postel). The inputs stay strict.
41
+ export const ServiceInterfaceDeclared = z.object({
42
+ name: z.string(),
43
+ functions: z.array(z.string()),
44
+ // The functions this declaration dropped, with their rights; empty when nothing fell.
45
+ removed: z.array(z.string()),
46
+ });
47
+ // The answer of `POST /auth/service/interfaces/:interface/remove`. A service declares its target
48
+ // state and may repeat it: `removed: false` is no error, and `permissions` names what fell.
49
+ export const ServiceInterfaceUndeclared = z.object({
50
+ removed: z.boolean(),
51
+ permissions: z.array(z.string()),
52
+ });
@@ -0,0 +1,98 @@
1
+ import { z } from "zod";
2
+ export declare const InvitationId: z.ZodTemplateLiteral<`invitation_${string}`>;
3
+ export declare const RoleChip: z.ZodObject<{
4
+ roleId: z.ZodTemplateLiteral<`role_${string}`>;
5
+ name: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export type RoleChip = z.infer<typeof RoleChip>;
8
+ export declare const Delivery: z.ZodObject<{
9
+ accepted: z.ZodBoolean;
10
+ cause: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strict>;
12
+ export type Delivery = z.infer<typeof Delivery>;
13
+ export declare const InvitationCreateInput: z.ZodObject<{
14
+ email: z.ZodEmail;
15
+ roleIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`role_${string}`>>>;
16
+ }, z.core.$strict>;
17
+ export type InvitationCreateInput = z.infer<typeof InvitationCreateInput>;
18
+ export declare const InvitationResendInput: z.ZodObject<{
19
+ invitationId: z.ZodTemplateLiteral<`invitation_${string}`>;
20
+ }, z.core.$strict>;
21
+ export type InvitationResendInput = z.infer<typeof InvitationResendInput>;
22
+ export declare const InvitationRevokeInput: z.ZodObject<{
23
+ invitationId: z.ZodTemplateLiteral<`invitation_${string}`>;
24
+ }, z.core.$strict>;
25
+ export type InvitationRevokeInput = z.infer<typeof InvitationRevokeInput>;
26
+ export declare const InvitationStatus: z.ZodEnum<{
27
+ accepted: "accepted";
28
+ invited: "invited";
29
+ expired: "expired";
30
+ revoked: "revoked";
31
+ }>;
32
+ export type InvitationStatus = z.infer<typeof InvitationStatus>;
33
+ export declare const Invitation: z.ZodObject<{
34
+ invitationId: z.ZodTemplateLiteral<`invitation_${string}`>;
35
+ email: z.ZodString;
36
+ roles: z.ZodArray<z.ZodObject<{
37
+ roleId: z.ZodTemplateLiteral<`role_${string}`>;
38
+ name: z.ZodString;
39
+ }, z.core.$strict>>;
40
+ status: z.ZodEnum<{
41
+ accepted: "accepted";
42
+ invited: "invited";
43
+ expired: "expired";
44
+ revoked: "revoked";
45
+ }>;
46
+ invitedBy: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
47
+ expiresAt: z.ZodISODateTime;
48
+ createdAt: z.ZodISODateTime;
49
+ }, z.core.$strict>;
50
+ export type Invitation = z.infer<typeof Invitation>;
51
+ export declare const InvitationSent: z.ZodObject<{
52
+ invitationId: z.ZodTemplateLiteral<`invitation_${string}`>;
53
+ email: z.ZodString;
54
+ roles: z.ZodArray<z.ZodObject<{
55
+ roleId: z.ZodTemplateLiteral<`role_${string}`>;
56
+ name: z.ZodString;
57
+ }, z.core.$strict>>;
58
+ status: z.ZodEnum<{
59
+ accepted: "accepted";
60
+ invited: "invited";
61
+ expired: "expired";
62
+ revoked: "revoked";
63
+ }>;
64
+ invitedBy: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
65
+ expiresAt: z.ZodISODateTime;
66
+ createdAt: z.ZodISODateTime;
67
+ delivery: z.ZodObject<{
68
+ accepted: z.ZodBoolean;
69
+ cause: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strict>;
71
+ }, z.core.$strict>;
72
+ export type InvitationSent = z.infer<typeof InvitationSent>;
73
+ export declare const InvitationLookupQuery: z.ZodObject<{
74
+ token: z.ZodString;
75
+ }, z.core.$strict>;
76
+ export type InvitationLookupQuery = z.infer<typeof InvitationLookupQuery>;
77
+ export declare const InvitationLookup: z.ZodObject<{
78
+ email: z.ZodString;
79
+ inviter: z.ZodNullable<z.ZodString>;
80
+ expired: z.ZodBoolean;
81
+ expiresAt: z.ZodISODateTime;
82
+ }, z.core.$strict>;
83
+ export type InvitationLookup = z.infer<typeof InvitationLookup>;
84
+ export declare const InvitationAcceptInput: z.ZodObject<{
85
+ token: z.ZodString;
86
+ name: z.ZodString;
87
+ password: z.ZodString;
88
+ }, z.core.$strict>;
89
+ export type InvitationAcceptInput = z.infer<typeof InvitationAcceptInput>;
90
+ export declare const InvitationSocialInput: z.ZodObject<{
91
+ token: z.ZodString;
92
+ provider: z.ZodEnum<{
93
+ google: "google";
94
+ microsoft: "microsoft";
95
+ }>;
96
+ callbackURL: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strict>;
98
+ export type InvitationSocialInput = z.infer<typeof InvitationSocialInput>;