@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,58 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ import { Name } from "../profile/profile.js";
4
+ import { RoleId } from "../roles/roles.js";
5
+ // Invitations (Einstellungen › Nutzer, #25): the inputs of the `access_invitation_*` tools, the
6
+ // doors under `/auth/invitation` the invited person uses, and the answers. An invitation lives seven
7
+ // days, carries one valid token at a time, and its roles become the person's on acceptance.
8
+ export const InvitationId = idSchema("invitation");
9
+ // A role as the list shows it: its id for the next call, its name for the chip.
10
+ export const RoleChip = z.strictObject({ roleId: RoleId, name: z.string() });
11
+ // What `send` of the package `mail` answered: a failed delivery is an answer, not an exception.
12
+ export const Delivery = z.strictObject({ accepted: z.boolean(), cause: z.string().optional() });
13
+ // The roles a new account gets. Without the field, `mitglied` (E9); an empty list invites to no role.
14
+ const RoleIds = z.array(RoleId).max(50);
15
+ export const InvitationCreateInput = z.strictObject({
16
+ email: z.email(),
17
+ roleIds: RoleIds.optional(),
18
+ });
19
+ export const InvitationResendInput = z.strictObject({ invitationId: InvitationId });
20
+ export const InvitationRevokeInput = z.strictObject({ invitationId: InvitationId });
21
+ // `invited` while the link works, `expired` once its seven days passed (a resend restarts them),
22
+ // `revoked` after a withdrawal and `accepted` once the account exists.
23
+ export const InvitationStatus = z.enum(["invited", "expired", "revoked", "accepted"]);
24
+ export const Invitation = z.strictObject({
25
+ invitationId: InvitationId,
26
+ email: z.string(),
27
+ roles: z.array(RoleChip),
28
+ status: InvitationStatus,
29
+ invitedBy: idSchema("user").nullable(),
30
+ expiresAt: z.iso.datetime(),
31
+ createdAt: z.iso.datetime(),
32
+ });
33
+ // The answer of create and resend: the invitation and what the mail transport said. The token itself
34
+ // never: it leaves Colab once, in the mail.
35
+ export const InvitationSent = Invitation.extend({ delivery: Delivery });
36
+ // `GET /auth/invitation?token=…`, read by the page the invitation link opens (auth-invite.png).
37
+ export const InvitationLookupQuery = z.strictObject({ token: z.string().min(1).max(200) });
38
+ export const InvitationLookup = z.strictObject({
39
+ email: z.string(),
40
+ // The display name of whoever invited, or null when that account is gone.
41
+ inviter: z.string().nullable(),
42
+ expired: z.boolean(),
43
+ expiresAt: z.iso.datetime(),
44
+ });
45
+ // `POST /auth/invitation/accept`: the account with name and password. The address and the roles come
46
+ // from the invitation, never from this body.
47
+ export const InvitationAcceptInput = z.strictObject({
48
+ token: z.string().min(1).max(200),
49
+ name: Name,
50
+ password: z.string().min(1),
51
+ });
52
+ // `POST /auth/invitation/social`: the account through Google or Microsoft. Answers like
53
+ // `/auth/sign-in/social`, with the address of the provider to go to.
54
+ export const InvitationSocialInput = z.strictObject({
55
+ token: z.string().min(1).max(200),
56
+ provider: z.enum(["google", "microsoft"]),
57
+ callbackURL: z.string().optional(),
58
+ });
@@ -0,0 +1,76 @@
1
+ import { z } from "zod";
2
+ export declare const LinkId: z.ZodTemplateLiteral<`link_${string}`>;
3
+ export type LinkId = z.infer<typeof LinkId>;
4
+ export declare const maxLinkDays = 90;
5
+ export declare const defaultLinkDays = 7;
6
+ export declare const publicLinkPath = "/api/intelligence/public";
7
+ export declare const NodeLinkListInput: z.ZodObject<{
8
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
9
+ cursor: z.ZodOptional<z.ZodTemplateLiteral<`link_${string}`>>;
10
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
11
+ }, z.core.$strict>;
12
+ export type NodeLinkListInput = z.infer<typeof NodeLinkListInput>;
13
+ export declare const NodeLinkCreateInput: z.ZodObject<{
14
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
15
+ expiresInDays: z.ZodDefault<z.ZodNumber>;
16
+ idempotencyKey: z.ZodString;
17
+ }, z.core.$strict>;
18
+ export type NodeLinkCreateInput = z.infer<typeof NodeLinkCreateInput>;
19
+ export declare const NodeLinkUpdateInput: z.ZodObject<{
20
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
21
+ linkId: z.ZodTemplateLiteral<`link_${string}`>;
22
+ expiresAt: z.ZodISODateTime;
23
+ baseUpdatedAt: z.ZodISODateTime;
24
+ }, z.core.$strict>;
25
+ export type NodeLinkUpdateInput = z.infer<typeof NodeLinkUpdateInput>;
26
+ export declare const NodeLinkRevokeInput: z.ZodObject<{
27
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
28
+ linkId: z.ZodTemplateLiteral<`link_${string}`>;
29
+ }, z.core.$strict>;
30
+ export type NodeLinkRevokeInput = z.infer<typeof NodeLinkRevokeInput>;
31
+ export declare const LinkStatus: z.ZodEnum<{
32
+ expired: "expired";
33
+ revoked: "revoked";
34
+ active: "active";
35
+ inactive: "inactive";
36
+ }>;
37
+ export type LinkStatus = z.infer<typeof LinkStatus>;
38
+ export declare const NodeLink: z.ZodObject<{
39
+ linkId: z.ZodTemplateLiteral<`link_${string}`>;
40
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
41
+ url: z.ZodURL;
42
+ status: z.ZodEnum<{
43
+ expired: "expired";
44
+ revoked: "revoked";
45
+ active: "active";
46
+ inactive: "inactive";
47
+ }>;
48
+ expiresAt: z.ZodISODateTime;
49
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
50
+ createdBy: z.ZodString;
51
+ createdByName: z.ZodNullable<z.ZodString>;
52
+ createdAt: z.ZodISODateTime;
53
+ updatedAt: z.ZodISODateTime;
54
+ }, z.core.$strict>;
55
+ export type NodeLink = z.infer<typeof NodeLink>;
56
+ export declare const NodeLinkList: z.ZodObject<{
57
+ items: z.ZodArray<z.ZodObject<{
58
+ linkId: z.ZodTemplateLiteral<`link_${string}`>;
59
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
60
+ url: z.ZodURL;
61
+ status: z.ZodEnum<{
62
+ expired: "expired";
63
+ revoked: "revoked";
64
+ active: "active";
65
+ inactive: "inactive";
66
+ }>;
67
+ expiresAt: z.ZodISODateTime;
68
+ revokedAt: z.ZodNullable<z.ZodISODateTime>;
69
+ createdBy: z.ZodString;
70
+ createdByName: z.ZodNullable<z.ZodString>;
71
+ createdAt: z.ZodISODateTime;
72
+ updatedAt: z.ZodISODateTime;
73
+ }, z.core.$strict>>;
74
+ nextCursor: z.ZodNullable<z.ZodTemplateLiteral<`link_${string}`>>;
75
+ }, z.core.$strict>;
76
+ export type NodeLinkList = z.infer<typeof NodeLinkList>;
@@ -0,0 +1,73 @@
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
+ import { IdempotencyKey } from "../primitives/primitives.js";
6
+ // Public links (#49, Funktionen › Freigeben und Versionen, E49, E66): the inputs of
7
+ // `intelligence_node_link_list`, `_create`, `_update` and `_revoke`, and their answers. Reworked
8
+ // from anchrd/intel `src/contract/attachment-link.ts` (f4eccd16, I19): documents too, up to 90 days,
9
+ // for whoever may share the node, and the address in the list.
10
+ //
11
+ // ⚠️ A link is the widest share there is: whoever holds the address reads the current version of
12
+ // the node without signing in. That is why it is narrow in every other way: read only, with an
13
+ // expiry, revocable, and alive only while its creator could still share the node.
14
+ export const LinkId = idSchema("link").describe("The link's id, `link_…`, as intelligence_node_link_list names it.");
15
+ // The longest a link opens a node, counted from its creation, and the default of a new one.
16
+ export const maxLinkDays = 90;
17
+ export const defaultLinkDays = 7;
18
+ // The path the public door answers under; the token follows as the last segment. Under `/api`, so
19
+ // the Worker sees it before the static assets (trap P076).
20
+ export const publicLinkPath = "/api/intelligence/public";
21
+ export const NodeLinkListInput = z.strictObject({
22
+ nodeId: NodeId.describe("The document or file whose public links to list. Needs the right to share it."),
23
+ cursor: LinkId.optional().describe("The nextCursor of the previous page, unchanged. Leaving it out starts with the newest link."),
24
+ limit: PageSize.optional().describe("How many links one page holds, 1 to 100. Leaving it out gives 100."),
25
+ });
26
+ export const NodeLinkCreateInput = z.strictObject({
27
+ nodeId: NodeId.describe("The document or file to open to everybody holding the address. Needs the right to share it. The link always serves the version that is current when it is opened."),
28
+ expiresInDays: z
29
+ .number()
30
+ .int()
31
+ .min(1)
32
+ .max(maxLinkDays, { error: `A public link lasts at most ${maxLinkDays} days.` })
33
+ .default(defaultLinkDays)
34
+ .describe(`How many days the link opens the node, 1 to ${maxLinkDays}. Leaving it out gives ${defaultLinkDays}. Ask for no more than the receiving service needs.`),
35
+ idempotencyKey: IdempotencyKey,
36
+ });
37
+ export const NodeLinkUpdateInput = z.strictObject({
38
+ nodeId: NodeId.describe("The document or file the link belongs to."),
39
+ linkId: LinkId,
40
+ expiresAt: z.iso
41
+ .datetime()
42
+ .describe(`The new end of the link, in the future and at most ${maxLinkDays} days after the link was created. Earlier ends it sooner; to end it now, revoke it.`),
43
+ baseUpdatedAt: z.iso
44
+ .datetime()
45
+ .describe("The link's updatedAt as the last list returned it. If someone changed the link in between, the call answers conflict and changes nothing."),
46
+ });
47
+ export const NodeLinkRevokeInput = z.strictObject({
48
+ nodeId: NodeId.describe("The document or file the link belongs to."),
49
+ linkId: LinkId.describe("The link to end now. A revoked link stays in the list and never opens again; revoking it twice answers conflict."),
50
+ });
51
+ // What a link is right now: `revoked` wins over `expired`, `expired` over `inactive`. `inactive` is a
52
+ // link the door refuses because its creator could no longer make it: they lost the right to share the
53
+ // node, or `access` locked or archived them. It opens again once that changes (#199).
54
+ export const LinkStatus = z.enum(["active", "expired", "revoked", "inactive"]);
55
+ // One link. `url` is derived from the id every time it is answered and never stored: the table holds
56
+ // only the hash of its token.
57
+ export const NodeLink = z.strictObject({
58
+ linkId: LinkId,
59
+ nodeId: NodeId,
60
+ url: z.url(),
61
+ status: LinkStatus,
62
+ expiresAt: z.iso.datetime(),
63
+ revokedAt: z.iso.datetime().nullable(),
64
+ // `user_…` of `access`, and the name it has there today; null for an account that is gone.
65
+ createdBy: z.string(),
66
+ createdByName: z.string().nullable(),
67
+ createdAt: z.iso.datetime(),
68
+ updatedAt: z.iso.datetime(),
69
+ });
70
+ export const NodeLinkList = z.strictObject({
71
+ items: z.array(NodeLink),
72
+ nextCursor: LinkId.nullable(),
73
+ });
@@ -0,0 +1,3 @@
1
+ import { z } from "zod";
2
+ export declare const Limit: z.ZodCoercedNumber<unknown>;
3
+ export declare const Flag: z.ZodPreprocess<z.ZodBoolean, unknown>;
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ // The fields of a `list` that are not text. Over REST they arrive in the query string, which carries
3
+ // only text (`?limit=20&archived=true`); over MCP as the JSON value. `mountTools` passes the query
4
+ // on as it came, so the conversion lives here, per field, and a text field holding digits only
5
+ // (`?query=2026`) stays text (#86). The MCP SDK reads the input side of these schemas, so the AI
6
+ // still sees a number and a boolean.
7
+ // The page size of every list.
8
+ export const Limit = z.coerce.number().int().min(1).max(100);
9
+ // A yes or no filter. Only the words `true` and `false`: `z.coerce.boolean()` would read `"false"`
10
+ // as true, like any text that is not empty.
11
+ export const Flag = z.preprocess((value) => (value === "true" ? true : value === "false" ? false : value), z.boolean());
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ export declare const MachineId: z.ZodTemplateLiteral<`user_${string}`>;
3
+ export declare const MachineCreateInput: z.ZodObject<{
4
+ name: z.ZodString;
5
+ roleIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`role_${string}`>>>;
6
+ }, z.core.$strict>;
7
+ export type MachineCreateInput = z.infer<typeof MachineCreateInput>;
8
+ export declare const MachineUpdateInput: z.ZodObject<{
9
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
10
+ responsibleId: z.ZodTemplateLiteral<`user_${string}`>;
11
+ }, z.core.$strict>;
12
+ export type MachineUpdateInput = z.infer<typeof MachineUpdateInput>;
13
+ export declare const MachineRotateInput: z.ZodObject<{
14
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
15
+ }, z.core.$strict>;
16
+ export type MachineRotateInput = z.infer<typeof MachineRotateInput>;
17
+ export declare const MachineArchiveInput: z.ZodObject<{
18
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
19
+ }, z.core.$strict>;
20
+ export type MachineArchiveInput = z.infer<typeof MachineArchiveInput>;
21
+ export declare const MachineRestoreInput: z.ZodObject<{
22
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
23
+ }, z.core.$strict>;
24
+ export type MachineRestoreInput = z.infer<typeof MachineRestoreInput>;
25
+ export declare const MachinePurgeInput: z.ZodObject<{
26
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
27
+ }, z.core.$strict>;
28
+ export type MachinePurgeInput = z.infer<typeof MachinePurgeInput>;
29
+ export declare const MachineKey: z.ZodObject<{
30
+ machine: z.ZodObject<{
31
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
32
+ kind: z.ZodEnum<{
33
+ machine: "machine";
34
+ human: "human";
35
+ }>;
36
+ name: z.ZodString;
37
+ email: z.ZodNullable<z.ZodString>;
38
+ roles: z.ZodArray<z.ZodObject<{
39
+ roleId: z.ZodTemplateLiteral<`role_${string}`>;
40
+ name: z.ZodString;
41
+ }, z.core.$strict>>;
42
+ status: z.ZodNullable<z.ZodEnum<{
43
+ archived: "archived";
44
+ invited: "invited";
45
+ expired: "expired";
46
+ disabled: "disabled";
47
+ }>>;
48
+ machine: z.ZodNullable<z.ZodObject<{
49
+ kind: z.ZodEnum<{
50
+ operator: "operator";
51
+ external: "external";
52
+ }>;
53
+ responsibleId: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
54
+ }, z.core.$strict>>;
55
+ createdAt: z.ZodISODateTime;
56
+ updatedAt: z.ZodISODateTime;
57
+ }, z.core.$strict>;
58
+ key: z.ZodString;
59
+ mcpUrl: z.ZodString;
60
+ tokenUrl: z.ZodString;
61
+ example: z.ZodString;
62
+ docs: z.ZodString;
63
+ }, z.core.$strict>;
64
+ export type MachineKey = z.infer<typeof MachineKey>;
65
+ export declare const MachinePurged: z.ZodObject<{
66
+ machineId: z.ZodTemplateLiteral<`user_${string}`>;
67
+ name: z.ZodString;
68
+ }, z.core.$strict>;
69
+ export type MachinePurged = z.infer<typeof MachinePurged>;
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { RoleId } from "../roles/roles.js";
3
+ import { User, UserId } from "../users/users.js";
4
+ // Machines (Betrieb › Operator und Maschinen, #25, #331): the inputs of the `access_machine_*` tools
5
+ // and their answers. A machine is a row in `users` of kind `machine`, so `machineId` carries its user
6
+ // id (`user_…`); renaming, roles and locking go through the `access_user_*` tools. The tools create
7
+ // an EXTERNAL machine with a key; a Claude-Operator (kind `operator`, no key) comes into being under
8
+ // Einstellungen › Operator, through the package `operator` (E85).
9
+ export const MachineId = UserId;
10
+ export const MachineCreateInput = z.strictObject({
11
+ name: z.string().trim().min(1).max(64),
12
+ // Without the field, no role (E84): the machine can do nothing until it gets one.
13
+ roleIds: z.array(RoleId).max(50).optional(),
14
+ });
15
+ // Hands a machine to another responsible person (E76): the one its disturbances reach.
16
+ export const MachineUpdateInput = z.strictObject({
17
+ machineId: MachineId,
18
+ responsibleId: UserId,
19
+ });
20
+ export const MachineRotateInput = z.strictObject({ machineId: MachineId });
21
+ export const MachineArchiveInput = z.strictObject({ machineId: MachineId });
22
+ export const MachineRestoreInput = z.strictObject({ machineId: MachineId });
23
+ export const MachinePurgeInput = z.strictObject({ machineId: MachineId });
24
+ // The answer of create and rotate: the key, shown ONCE (it is stored hashed), and how to connect the
25
+ // machine ("So verbindest du sie"). ⚠️ These two tools are the only ones whose result carries a key
26
+ // (`revealsSecret` on the tool).
27
+ export const MachineKey = z.strictObject({
28
+ machine: User,
29
+ key: z.string(),
30
+ // `<origin>/mcp`, the one address every machine talks to.
31
+ mcpUrl: z.string(),
32
+ // `<origin>/auth/machine/token`: the key in `x-api-key` against a 15-minute token for `/mcp`.
33
+ tokenUrl: z.string(),
34
+ example: z.string(),
35
+ // The documentation page "Operator einrichten".
36
+ docs: z.string(),
37
+ });
38
+ // What fell, by name (trap P334): after the purge nothing else can be read about it.
39
+ export const MachinePurged = z.strictObject({ machineId: MachineId, name: z.string() });
@@ -0,0 +1,117 @@
1
+ import { z } from "zod";
2
+ export declare const MessageId: z.ZodTemplateLiteral<`message_${string}`>;
3
+ export type MessageId = z.infer<typeof MessageId>;
4
+ export declare const messageMaxLength = 10000;
5
+ export declare const MessageListInput: z.ZodObject<{
6
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
7
+ cursor: z.ZodOptional<z.ZodString>;
8
+ after: z.ZodOptional<z.ZodTemplateLiteral<`message_${string}`>>;
9
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
10
+ }, z.core.$strict>;
11
+ export type MessageListInput = z.infer<typeof MessageListInput>;
12
+ export declare const MessageCreateInput: z.ZodObject<{
13
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
14
+ text: z.ZodString;
15
+ mentions: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`user_${string}`>>>;
16
+ idempotencyKey: z.ZodString;
17
+ }, z.core.$strict>;
18
+ export type MessageCreateInput = z.infer<typeof MessageCreateInput>;
19
+ export declare const ChatUpdateInput: z.ZodObject<{
20
+ chatId: z.ZodTemplateLiteral<`node_${string}`>;
21
+ readUntil: z.ZodTemplateLiteral<`message_${string}`>;
22
+ }, z.core.$strict>;
23
+ export type ChatUpdateInput = z.infer<typeof ChatUpdateInput>;
24
+ export declare const MessageAuthor: z.ZodObject<{
25
+ userId: z.ZodString;
26
+ name: z.ZodNullable<z.ZodString>;
27
+ kind: z.ZodNullable<z.ZodEnum<{
28
+ machine: "machine";
29
+ human: "human";
30
+ }>>;
31
+ machine: z.ZodNullable<z.ZodObject<{
32
+ kind: z.ZodEnum<{
33
+ operator: "operator";
34
+ external: "external";
35
+ }>;
36
+ provider: z.ZodNullable<z.ZodEnum<{
37
+ claude: "claude";
38
+ codex: "codex";
39
+ gemini: "gemini";
40
+ }>>;
41
+ }, z.core.$strict>>;
42
+ appHandle: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strict>;
44
+ export type MessageAuthor = z.infer<typeof MessageAuthor>;
45
+ export declare const Message: z.ZodObject<{
46
+ messageId: z.ZodTemplateLiteral<`message_${string}`>;
47
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
48
+ text: z.ZodString;
49
+ author: z.ZodObject<{
50
+ userId: z.ZodString;
51
+ name: z.ZodNullable<z.ZodString>;
52
+ kind: z.ZodNullable<z.ZodEnum<{
53
+ machine: "machine";
54
+ human: "human";
55
+ }>>;
56
+ machine: z.ZodNullable<z.ZodObject<{
57
+ kind: z.ZodEnum<{
58
+ operator: "operator";
59
+ external: "external";
60
+ }>;
61
+ provider: z.ZodNullable<z.ZodEnum<{
62
+ claude: "claude";
63
+ codex: "codex";
64
+ gemini: "gemini";
65
+ }>>;
66
+ }, z.core.$strict>>;
67
+ appHandle: z.ZodNullable<z.ZodString>;
68
+ }, z.core.$strict>;
69
+ mentions: z.ZodArray<z.ZodObject<{
70
+ userId: z.ZodString;
71
+ name: z.ZodNullable<z.ZodString>;
72
+ }, z.core.$strict>>;
73
+ createdAt: z.ZodISODateTime;
74
+ }, z.core.$strict>;
75
+ export type Message = z.infer<typeof Message>;
76
+ export declare const MessageList: z.ZodObject<{
77
+ items: z.ZodArray<z.ZodObject<{
78
+ messageId: z.ZodTemplateLiteral<`message_${string}`>;
79
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
80
+ text: z.ZodString;
81
+ author: z.ZodObject<{
82
+ userId: z.ZodString;
83
+ name: z.ZodNullable<z.ZodString>;
84
+ kind: z.ZodNullable<z.ZodEnum<{
85
+ machine: "machine";
86
+ human: "human";
87
+ }>>;
88
+ machine: z.ZodNullable<z.ZodObject<{
89
+ kind: z.ZodEnum<{
90
+ operator: "operator";
91
+ external: "external";
92
+ }>;
93
+ provider: z.ZodNullable<z.ZodEnum<{
94
+ claude: "claude";
95
+ codex: "codex";
96
+ gemini: "gemini";
97
+ }>>;
98
+ }, z.core.$strict>>;
99
+ appHandle: z.ZodNullable<z.ZodString>;
100
+ }, z.core.$strict>;
101
+ mentions: z.ZodArray<z.ZodObject<{
102
+ userId: z.ZodString;
103
+ name: z.ZodNullable<z.ZodString>;
104
+ }, z.core.$strict>>;
105
+ createdAt: z.ZodISODateTime;
106
+ }, z.core.$strict>>;
107
+ nextCursor: z.ZodNullable<z.ZodString>;
108
+ unreadCount: z.ZodNumber;
109
+ readUntil: z.ZodNullable<z.ZodTemplateLiteral<`message_${string}`>>;
110
+ }, z.core.$strict>;
111
+ export type MessageList = z.infer<typeof MessageList>;
112
+ export declare const ChatRead: z.ZodObject<{
113
+ chatId: z.ZodTemplateLiteral<`node_${string}`>;
114
+ readUntil: z.ZodNullable<z.ZodTemplateLiteral<`message_${string}`>>;
115
+ unreadCount: z.ZodNumber;
116
+ }, z.core.$strict>;
117
+ export type ChatRead = z.infer<typeof ChatRead>;
@@ -0,0 +1,77 @@
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
+ import { IdempotencyKey } from "../primitives/primitives.js";
6
+ import { MessageMachine } from "../users/users.js";
7
+ // The chat of a node (#45, Funktionen › Chat, E49, E67): the inputs of `intelligence_message_list`,
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
10
+ // appended: no editing, no attachment, no following.
11
+ export const MessageId = idSchema("message").describe("A message's id, `message_…`, as intelligence_message_list returns it.");
12
+ // What a message may hold, in characters of Markdown.
13
+ export const messageMaxLength = 10_000;
14
+ export const MessageListInput = z.strictObject({
15
+ nodeId: NodeId.describe("The node whose chat to read: any node you can read except a folder, which has no chat."),
16
+ cursor: z
17
+ .string()
18
+ .max(200)
19
+ .optional()
20
+ .describe("The nextCursor of the previous page, unchanged, for the messages before it. Leaving it out starts with the newest."),
21
+ after: MessageId.optional().describe("Only the messages after this one, oldest first, to poll for what is new. A full page means there may be more: ask again with the last id. Not together with cursor."),
22
+ limit: PageSize.optional().describe("How many messages one page holds, 1 to 100. Leaving it out gives 50."),
23
+ });
24
+ export const MessageCreateInput = z.strictObject({
25
+ nodeId: NodeId.describe("The node whose chat to write in: any node you can read except a folder. Reading is enough to write."),
26
+ text: z
27
+ .string()
28
+ .trim()
29
+ .min(1)
30
+ .max(messageMaxLength)
31
+ .describe("The message as Markdown, at most 10,000 characters. It cannot be edited afterwards. To point at a file, put it into the tree and link the node."),
32
+ mentions: z
33
+ .array(idSchema("user"))
34
+ .max(50)
35
+ .optional()
36
+ .describe("The people and machines this message mentions, `user_…`; they see the chat in their Actions. Only someone who can read the node: find them with intelligence_user_list and readersOnly. One who cannot read it refuses the whole message."),
37
+ idempotencyKey: IdempotencyKey,
38
+ });
39
+ export const ChatUpdateInput = z.strictObject({
40
+ chatId: NodeId.describe("The chat to mark as read: the id of its node, `node_…`."),
41
+ readUntil: MessageId.describe("The newest message of this chat you have read. Your read state never moves back: an older one changes nothing."),
42
+ });
43
+ // Who wrote a message. A person writing in the browser has no `appHandle`; their AI writing through a
44
+ // connected app carries that app's name. A machine carries its kind and an Operator its provider.
45
+ // The UI makes the sentence of it ("Max Member via Claude Code", "Validierung · Claude", "Lead-Import").
46
+ export const MessageAuthor = z.strictObject({
47
+ userId: z.string(),
48
+ // As `access` names them today; null for an account that is gone.
49
+ name: z.string().nullable(),
50
+ kind: z.enum(["human", "machine"]).nullable(),
51
+ // Only for a machine `access` still knows; null for a person.
52
+ machine: MessageMachine.nullable(),
53
+ appHandle: z.string().nullable(),
54
+ });
55
+ export const Message = z.strictObject({
56
+ messageId: MessageId,
57
+ nodeId: NodeId,
58
+ text: z.string(),
59
+ author: MessageAuthor,
60
+ mentions: z.array(z.strictObject({ userId: z.string(), name: z.string().nullable() })),
61
+ createdAt: z.iso.datetime(),
62
+ });
63
+ export const MessageList = z.strictObject({
64
+ // Oldest first, as a chat reads.
65
+ items: z.array(Message),
66
+ // The page before this one; null when there is none, and always with `after`.
67
+ nextCursor: z.string().nullable(),
68
+ // The caller's own: how many messages of others they have not read here, and the newest they have
69
+ // read (the "Neu" line goes below it). The read state is kept per person and per app.
70
+ unreadCount: z.number().int(),
71
+ readUntil: MessageId.nullable(),
72
+ });
73
+ export const ChatRead = z.strictObject({
74
+ chatId: NodeId,
75
+ readUntil: MessageId.nullable(),
76
+ unreadCount: z.number().int(),
77
+ });