@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,177 @@
1
+ import { z } from "zod";
2
+ import { ColumnType, TaskColumn } from "../columns/columns.js";
3
+ import { packages } from "../grammar/grammar.js";
4
+ import { InstructionsLink } from "../instructions/instructions.js";
5
+ import { Limit as PageSize } from "../list-input.js";
6
+ import { MessageAuthor, MessageId } from "../messages/messages.js";
7
+ import { BoardShownKind, NodeId, NodeKind, NodePath } from "../nodes/nodes.js";
8
+ import { RunId, RunStatus } from "../runs/runs.js";
9
+ import { UserId } from "../users/users.js";
10
+ // Actions (#46, Seiten › Actions, E43, E67): one list over every board and chat with what waits on a
11
+ // person. Every row is a node shown live, never a copy, and a node is one row, never two: a task of
12
+ // mine whose chat has something unread is the same row. Every input field carries its description
13
+ // (trap C004).
14
+ export const actionFilters = ["all", "tasks", "chats"];
15
+ export const ActionListInput = z.strictObject({
16
+ filter: z
17
+ .enum(actionFilters)
18
+ .optional()
19
+ .describe("Which rows: all, tasks (tasks, due processes, open runs and dashboard runs with entries assigned to you) or chats (rows with something unread, a task's chat included). Notices of other parts of Colab come only with all. Leaving it out gives all. count always counts all."),
20
+ userId: UserId.optional().describe("Whose Actions to read, `user_…`. Only an admin in admin mode reads another person's, to see where they are stuck; anyone else gets not_found. Leaving it out reads your own."),
21
+ cursor: z
22
+ .string()
23
+ .max(200)
24
+ .optional()
25
+ .describe("The nextCursor of the previous page, unchanged, for the rows after it. Leaving it out starts with the newest."),
26
+ limit: PageSize.optional().describe("How many rows one page holds, 1 to 100. Leaving it out gives 50."),
27
+ });
28
+ // The two sections of the page: waiting (open tasks, chats, a due process) and in progress (tasks
29
+ // in progress, an open run).
30
+ export const ActionSection = z.enum(["waiting", "progress"]);
31
+ export const ActionTask = z.strictObject({
32
+ column: TaskColumn,
33
+ // The columns of type done, discarded and blocked of the task's own board (a run's own columns
34
+ // for a run's task), in their order on the board: the buttons that move it there. Empty when the
35
+ // board has none.
36
+ buttons: z.array(TaskColumn),
37
+ // A machine moved it into its column last: "handed over by the Operator".
38
+ handedOver: z.boolean(),
39
+ });
40
+ export const ActionChat = z.strictObject({
41
+ // The messages of others not read yet, by the person themselves (not their AI).
42
+ unreadCount: z.number().int(),
43
+ lastMessage: z.strictObject({
44
+ messageId: MessageId,
45
+ author: MessageAuthor,
46
+ // The first line of its text that is not empty, at most 200 characters.
47
+ line: z.string(),
48
+ createdAt: z.iso.datetime(),
49
+ }),
50
+ });
51
+ // A process board or a dashboard that is due for its Operator.
52
+ export const ActionProcess = z.strictObject({
53
+ kind: z.enum(["board", "dashboard"]),
54
+ // The moment of the schedule the next run stands for.
55
+ dueAt: z.iso.datetime(),
56
+ });
57
+ export const ActionRun = z.strictObject({
58
+ runId: RunId,
59
+ status: RunStatus,
60
+ // A dashboard run (E78): the keys of the metrics and summaries assigned to the person that they
61
+ // have not written yet, in the configuration's order; null for a process run.
62
+ entries: z.array(z.string()).nullable(),
63
+ });
64
+ // One row: the node, where it waits, since when, and what makes it wait. Exactly one of task,
65
+ // process and run, or none of them on a row that is a chat alone; chat beside any of them.
66
+ export const ActionItem = z.strictObject({
67
+ node: z.strictObject({
68
+ nodeId: NodeId,
69
+ kind: NodeKind,
70
+ name: z.string(),
71
+ // Where it stands, from the first level the person can read; a task's last crumb is its board.
72
+ // A ticket of the validation board (#47) is called after its node, its crumb is the board.
73
+ path: NodePath,
74
+ // The validation status (#47): the type of the column the ticket of a document, table or file
75
+ // stands in, and a ticket's own; null for every other node.
76
+ status: ColumnType.nullable(),
77
+ // What a board is, like `NodeListItem.boardKind` (#227); null for every other kind.
78
+ boardKind: BoardShownKind.nullable(),
79
+ }),
80
+ section: ActionSection,
81
+ // Since when it waits: a task since it came into its column, a chat since its first unread
82
+ // message, a due process since its moment, an open run since it started.
83
+ since: z.iso.datetime(),
84
+ task: ActionTask.nullable(),
85
+ chat: ActionChat.nullable(),
86
+ process: ActionProcess.nullable(),
87
+ run: ActionRun.nullable(),
88
+ });
89
+ // What another package puts into a person's Actions (#334, E81, E82): "access invalid" for every
90
+ // admin, "Operator paused" for its responsible person. Gathered when asked like every row, never
91
+ // stored here: the package stops naming it once the access is replaced or the Operator resumed, and
92
+ // the row is gone. ⚠️ Never a field called `key` (`redactSecrets` strikes it over `/mcp`).
93
+ //
94
+ // Every text is a closed word with its values, never a sentence (#379, E22): the UI words it in the
95
+ // reader's language, and the AI reads the same structure.
96
+ // What the notice is, for its icon: an access that stopped working, a paused Operator.
97
+ export const ActionNoticeKind = z.enum(["credential", "paused"]);
98
+ // Its title: which notice, and the name it is about.
99
+ export const ActionNoticeTitle = z.discriminatedUnion("text", [
100
+ // "Access invalid: <the credential's name>".
101
+ z.strictObject({ text: z.literal("credentialInvalid"), name: z.string() }),
102
+ // "Operator paused: daily limit reached".
103
+ z.strictObject({ text: z.literal("pausedLimit") }),
104
+ // "Operator paused: <failures> failures".
105
+ z.strictObject({ text: z.literal("pausedFailures"), failures: z.number().int().positive() }),
106
+ ]);
107
+ // One step of the grey path below the title: a word the UI translates, or a name shown as it is.
108
+ export const ActionNoticeCrumb = z.union([
109
+ z.strictObject({ word: z.enum(["settings", "operator", "access"]) }),
110
+ z.strictObject({ name: z.string() }),
111
+ ]);
112
+ // The line with the reason, said by the provider of the access or by the Operator.
113
+ export const ActionNoticeReason = z.strictObject({
114
+ author: z.strictObject({ name: z.string(), kind: z.enum(["provider", "machine"]) }),
115
+ line: z.discriminatedUnion("text", [
116
+ // "The token has been refused since <since>. <paused> are paused."
117
+ z.strictObject({
118
+ text: z.literal("credentialRefused"),
119
+ since: z.iso.datetime(),
120
+ // The names of the Operators that run on it, every one of them paused now.
121
+ paused: z.array(z.string()),
122
+ }),
123
+ // "<runs> of <limit> runs today. Without resuming it goes on at <until>."
124
+ z.strictObject({
125
+ text: z.literal("limitReached"),
126
+ runs: z.number().int().nonnegative(),
127
+ limit: z.number().int().positive(),
128
+ until: z.iso.datetime(),
129
+ }),
130
+ // "Last at <at>: <detail>", the last failed run; null without one.
131
+ z.strictObject({
132
+ text: z.literal("lastFailure"),
133
+ at: z.iso.datetime().nullable(),
134
+ detail: z.string().nullable(),
135
+ }),
136
+ ]),
137
+ });
138
+ // A button of the row: its word and where it leads, a path within Colab. The first is the primary.
139
+ export const ActionNoticeButton = z.strictObject({
140
+ label: z.enum(["replaceCredential", "resume", "changeLimit", "viewLog"]),
141
+ href: z.string(),
142
+ });
143
+ export const ActionNotice = z.strictObject({
144
+ // The package that names it.
145
+ package: z.enum(packages),
146
+ // Its identity within the package: one row per package and noticeKey, however often it is named.
147
+ noticeKey: z.string().min(1).max(200),
148
+ kind: ActionNoticeKind,
149
+ title: ActionNoticeTitle,
150
+ path: z.array(ActionNoticeCrumb).max(8),
151
+ reason: ActionNoticeReason,
152
+ // Where the row leads: the page of the access or the Operator, a path within Colab.
153
+ href: z.string(),
154
+ buttons: z.array(ActionNoticeButton).max(3),
155
+ });
156
+ export const ActionNoticeItem = z.strictObject({
157
+ notice: ActionNotice,
158
+ section: ActionSection,
159
+ // Since when the package says it waits.
160
+ since: z.iso.datetime(),
161
+ });
162
+ // A row of the list: a node, or a notice of another package.
163
+ export const ActionRow = z.union([ActionItem, ActionNoticeItem]);
164
+ export function isNodeRow(row) {
165
+ return "node" in row;
166
+ }
167
+ export const ActionList = z.strictObject({
168
+ // Newest first by since, then by node id (a notice by package and noticeKey). The filters tasks
169
+ // and chats leave the notices out.
170
+ items: z.array(ActionRow),
171
+ nextCursor: z.string().nullable(),
172
+ // Every row without the filter, for the number at the Actions icon.
173
+ count: z.number().int(),
174
+ // Only for a machine reading its own Actions over MCP, never over REST: the INSTRUCTIONS of its
175
+ // root folder as one link of #39's chain, empty when there is none (traps P033, P034).
176
+ instructions: InstructionsLink.optional(),
177
+ });
@@ -0,0 +1,2 @@
1
+ export declare const adminModeHeader = "colab-admin-mode";
2
+ export declare const adminModeOn = "on";
@@ -0,0 +1,5 @@
1
+ // The header the UI sends with every request while a person has switched admin mode on (E71, #19).
2
+ // `access` reads it at the door (#24); any other value than `on` means off. Over `/mcp` the same
3
+ // question is the argument `asAdmin`, never this header.
4
+ export const adminModeHeader = "colab-admin-mode";
5
+ export const adminModeOn = "on";
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ export declare const AppId: z.ZodTemplateLiteral<`app_${string}`>;
3
+ export declare const SessionId: z.ZodTemplateLiteral<`session_${string}`>;
4
+ export declare const App: z.ZodObject<{
5
+ appId: z.ZodTemplateLiteral<`app_${string}`>;
6
+ clientId: z.ZodString;
7
+ name: z.ZodNullable<z.ZodString>;
8
+ logo: z.ZodNullable<z.ZodString>;
9
+ lastActiveAt: z.ZodISODateTime;
10
+ registeredAt: z.ZodNullable<z.ZodISODateTime>;
11
+ resource: z.ZodString;
12
+ scopes: z.ZodArray<z.ZodString>;
13
+ connectedAt: z.ZodISODateTime;
14
+ }, z.core.$strict>;
15
+ export type App = z.infer<typeof App>;
16
+ export declare const AppList: z.ZodObject<{
17
+ items: z.ZodArray<z.ZodObject<{
18
+ appId: z.ZodTemplateLiteral<`app_${string}`>;
19
+ clientId: z.ZodString;
20
+ name: z.ZodNullable<z.ZodString>;
21
+ logo: z.ZodNullable<z.ZodString>;
22
+ lastActiveAt: z.ZodISODateTime;
23
+ registeredAt: z.ZodNullable<z.ZodISODateTime>;
24
+ resource: z.ZodString;
25
+ scopes: z.ZodArray<z.ZodString>;
26
+ connectedAt: z.ZodISODateTime;
27
+ }, z.core.$strict>>;
28
+ nextCursor: z.ZodNullable<z.ZodTemplateLiteral<`app_${string}`>>;
29
+ }, z.core.$strict>;
30
+ export type AppList = z.infer<typeof AppList>;
31
+ export declare const AppListInput: z.ZodObject<{
32
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
33
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
34
+ cursor: z.ZodOptional<z.ZodTemplateLiteral<`app_${string}`>>;
35
+ }, z.core.$strict>;
36
+ export type AppListInput = z.infer<typeof AppListInput>;
37
+ export declare const OwnAppListQuery: z.ZodObject<{
38
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
39
+ cursor: z.ZodOptional<z.ZodTemplateLiteral<`app_${string}`>>;
40
+ }, z.core.$strict>;
41
+ export type OwnAppListQuery = z.infer<typeof OwnAppListQuery>;
42
+ export declare const AppRevokeInput: z.ZodObject<{
43
+ appId: z.ZodTemplateLiteral<`app_${string}`>;
44
+ }, z.core.$strict>;
45
+ export type AppRevokeInput = z.infer<typeof AppRevokeInput>;
46
+ export declare const AppRevoked: z.ZodObject<{
47
+ appId: z.ZodTemplateLiteral<`app_${string}`>;
48
+ name: z.ZodNullable<z.ZodString>;
49
+ }, z.core.$strict>;
50
+ export type AppRevoked = z.infer<typeof AppRevoked>;
51
+ export declare const Session: z.ZodObject<{
52
+ sessionId: z.ZodTemplateLiteral<`session_${string}`>;
53
+ current: z.ZodBoolean;
54
+ userAgent: z.ZodNullable<z.ZodString>;
55
+ country: z.ZodNullable<z.ZodString>;
56
+ city: z.ZodNullable<z.ZodString>;
57
+ lastActiveAt: z.ZodISODateTime;
58
+ ip: z.ZodNullable<z.ZodString>;
59
+ signInMethod: z.ZodNullable<z.ZodEnum<{
60
+ password: "password";
61
+ google: "google";
62
+ microsoft: "microsoft";
63
+ passkey: "passkey";
64
+ key: "key";
65
+ }>>;
66
+ signedInAt: z.ZodISODateTime;
67
+ }, z.core.$strict>;
68
+ export type Session = z.infer<typeof Session>;
69
+ export declare const SessionList: z.ZodObject<{
70
+ items: z.ZodArray<z.ZodObject<{
71
+ sessionId: z.ZodTemplateLiteral<`session_${string}`>;
72
+ current: z.ZodBoolean;
73
+ userAgent: z.ZodNullable<z.ZodString>;
74
+ country: z.ZodNullable<z.ZodString>;
75
+ city: z.ZodNullable<z.ZodString>;
76
+ lastActiveAt: z.ZodISODateTime;
77
+ ip: z.ZodNullable<z.ZodString>;
78
+ signInMethod: z.ZodNullable<z.ZodEnum<{
79
+ password: "password";
80
+ google: "google";
81
+ microsoft: "microsoft";
82
+ passkey: "passkey";
83
+ key: "key";
84
+ }>>;
85
+ signedInAt: z.ZodISODateTime;
86
+ }, z.core.$strict>>;
87
+ nextCursor: z.ZodNullable<z.ZodTemplateLiteral<`session_${string}`>>;
88
+ }, z.core.$strict>;
89
+ export type SessionList = z.infer<typeof SessionList>;
90
+ export declare const SessionListInput: z.ZodObject<{
91
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
92
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
93
+ cursor: z.ZodOptional<z.ZodTemplateLiteral<`session_${string}`>>;
94
+ }, z.core.$strict>;
95
+ export type SessionListInput = z.infer<typeof SessionListInput>;
96
+ export declare const OwnSessionListQuery: z.ZodObject<{
97
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
98
+ cursor: z.ZodOptional<z.ZodTemplateLiteral<`session_${string}`>>;
99
+ }, z.core.$strict>;
100
+ export type OwnSessionListQuery = z.infer<typeof OwnSessionListQuery>;
101
+ export declare const SessionRevokeInput: z.ZodObject<{
102
+ sessionId: z.ZodTemplateLiteral<`session_${string}`>;
103
+ }, z.core.$strict>;
104
+ export type SessionRevokeInput = z.infer<typeof SessionRevokeInput>;
105
+ export declare const SessionsRevoked: z.ZodObject<{
106
+ sessionIds: z.ZodArray<z.ZodTemplateLiteral<`session_${string}`>>;
107
+ }, z.core.$strict>;
108
+ export type SessionsRevoked = z.infer<typeof SessionsRevoked>;
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ import { Limit } from "../list-input.js";
4
+ import { SignInMethod, UserId } from "../users/users.js";
5
+ // Connected apps and sessions (Einstellungen › Verbundene Apps, Nutzer › Person › Apps, #27): the
6
+ // inputs of the `access_app_*` and `access_session_*` tools, the doors under `/auth/apps` and
7
+ // `/auth/sessions` a person uses for themselves, and the answers.
8
+ //
9
+ // An app is the pair of a person and a registered OAuth client: its id is the id of that pair's
10
+ // consent, never the `client_id`, which many people share. Claude on the phone and on the computer is
11
+ // one app (the connector reaches Colab from the provider's server); two computers with Claude Code are
12
+ // two apps, because each registers its own client.
13
+ export const AppId = idSchema("app");
14
+ export const SessionId = idSchema("session");
15
+ const Paging = {
16
+ limit: Limit.optional(),
17
+ };
18
+ export const App = z.strictObject({
19
+ appId: AppId,
20
+ // The registration's `client_id`, the same for everybody who connected this client.
21
+ clientId: z.string(),
22
+ // From the registration (`client_name`, `logo_uri`); a client may leave both out.
23
+ name: z.string().nullable(),
24
+ logo: z.string().nullable(),
25
+ // The last time a token was issued or renewed for this pair; before the first one, the consent.
26
+ // Colab removes an app 30 days after it (the UI shows the date in the tooltip).
27
+ lastActiveAt: z.iso.datetime(),
28
+ // The ⓘ: when the client registered, what it may reach, and the last time the person connected it.
29
+ registeredAt: z.iso.datetime().nullable(),
30
+ resource: z.string(),
31
+ scopes: z.array(z.string()),
32
+ connectedAt: z.iso.datetime(),
33
+ });
34
+ export const AppList = z.strictObject({ items: z.array(App), nextCursor: AppId.nullable() });
35
+ // The admin's list for one person; `userId` is mandatory (there is no installation-wide list).
36
+ export const AppListInput = z.strictObject({
37
+ userId: UserId,
38
+ cursor: AppId.optional(),
39
+ ...Paging,
40
+ });
41
+ // The person's own list at `GET /auth/apps`: the same paging, the person from the session.
42
+ export const OwnAppListQuery = z.strictObject({ cursor: AppId.optional(), ...Paging });
43
+ export const AppRevokeInput = z.strictObject({ appId: AppId });
44
+ // What fell, by name (trap P334): after the revocation nothing else can be read about it.
45
+ export const AppRevoked = z.strictObject({ appId: AppId, name: z.string().nullable() });
46
+ export const Session = z.strictObject({
47
+ sessionId: SessionId,
48
+ // The session this request came with ("Diese Sitzung"); always false in an admin's list.
49
+ current: z.boolean(),
50
+ // The browser and device are read from it by the UI ("Chrome auf macOS", "MacBook Pro").
51
+ userAgent: z.string().nullable(),
52
+ // From the sign-in's request, approximate ("Palma, Spanien").
53
+ country: z.string().nullable(),
54
+ city: z.string().nullable(),
55
+ lastActiveAt: z.iso.datetime(),
56
+ // The ⓘ: IP, how the person signed in, and when.
57
+ ip: z.string().nullable(),
58
+ signInMethod: SignInMethod.nullable(),
59
+ signedInAt: z.iso.datetime(),
60
+ });
61
+ export const SessionList = z.strictObject({
62
+ items: z.array(Session),
63
+ nextCursor: SessionId.nullable(),
64
+ });
65
+ export const SessionListInput = z.strictObject({
66
+ userId: UserId,
67
+ cursor: SessionId.optional(),
68
+ ...Paging,
69
+ });
70
+ export const OwnSessionListQuery = z.strictObject({ cursor: SessionId.optional(), ...Paging });
71
+ export const SessionRevokeInput = z.strictObject({ sessionId: SessionId });
72
+ // The sessions that ended: one for `…/:sessionId/revoke`, every other one for `/auth/sessions/revoke`.
73
+ export const SessionsRevoked = z.strictObject({ sessionIds: z.array(SessionId) });
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ export declare const NodeArchiveInput: z.ZodObject<{
3
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
4
+ }, z.core.$strict>;
5
+ export type NodeArchiveInput = z.infer<typeof NodeArchiveInput>;
6
+ export declare const NodeRestoreInput: z.ZodObject<{
7
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
8
+ }, z.core.$strict>;
9
+ export type NodeRestoreInput = z.infer<typeof NodeRestoreInput>;
10
+ export declare const NodeArchived: z.ZodObject<{
11
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
12
+ archivedAt: z.ZodNullable<z.ZodISODateTime>;
13
+ nodes: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ export type NodeArchived = z.infer<typeof NodeArchived>;
16
+ export declare const NodePurgeInput: z.ZodObject<{
17
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
18
+ }, z.core.$strict>;
19
+ export type NodePurgeInput = z.infer<typeof NodePurgeInput>;
20
+ export declare const NodePurged: z.ZodObject<{
21
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
22
+ names: z.ZodArray<z.ZodString>;
23
+ deleted: z.ZodRecord<z.ZodString, z.ZodNumber>;
24
+ }, z.core.$strict>;
25
+ export type NodePurged = z.infer<typeof NodePurged>;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { NodeId } from "../nodes/nodes.js";
3
+ // The archive (#37, Seiten › Archiv, E44, E66): the inputs of `intelligence_node_archive`,
4
+ // `_restore` and `_purge`, and their answers. Archiving takes the whole subtree along and can be
5
+ // undone; only an archived node can be deleted for good, and never by a machine (D124).
6
+ export const NodeArchiveInput = z.strictObject({
7
+ nodeId: NodeId.describe("The node to archive, with everything in it that is not archived yet. A root folder cannot be archived."),
8
+ });
9
+ export const NodeRestoreInput = z.strictObject({
10
+ nodeId: NodeId.describe("The archived node to bring back to its place, with what was archived together with it. Something archived on its own before stays archived; under an archived folder, restore the folder first."),
11
+ });
12
+ // Archive and restore answer the same: the state now, and how many nodes changed with this call.
13
+ export const NodeArchived = z.strictObject({
14
+ nodeId: NodeId,
15
+ archivedAt: z.iso.datetime().nullable(),
16
+ nodes: z.number().int(),
17
+ });
18
+ export const NodePurgeInput = z.strictObject({
19
+ nodeId: NodeId.describe("The archived node to delete for good, with everything archived under it. It cannot be undone."),
20
+ });
21
+ export const NodePurged = z.strictObject({
22
+ nodeId: NodeId,
23
+ // The names of every node that fell, as the protocol records them.
24
+ names: z.array(z.string()),
25
+ // Per table, the rows that fell.
26
+ deleted: z.record(z.string(), z.number().int()),
27
+ });
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ export declare const SignUpInput: z.ZodObject<{
3
+ name: z.ZodString;
4
+ email: z.ZodEmail;
5
+ password: z.ZodString;
6
+ callbackURL: z.ZodOptional<z.ZodString>;
7
+ rememberMe: z.ZodOptional<z.ZodBoolean>;
8
+ locale: z.ZodOptional<z.ZodEnum<{
9
+ en: "en";
10
+ de: "de";
11
+ }>>;
12
+ timezone: z.ZodOptional<z.ZodString>;
13
+ theme: z.ZodOptional<z.ZodEnum<{
14
+ light: "light";
15
+ dark: "dark";
16
+ system: "system";
17
+ }>>;
18
+ }, z.core.$strict>;
19
+ export type SignUpInput = z.infer<typeof SignUpInput>;
20
+ export declare const SetPasswordInput: z.ZodObject<{
21
+ newPassword: z.ZodString;
22
+ }, z.core.$strict>;
23
+ export type SetPasswordInput = z.infer<typeof SetPasswordInput>;
24
+ export declare const PasskeyDeleteInput: z.ZodObject<{
25
+ id: z.ZodString;
26
+ }, z.core.$strict>;
27
+ export type PasskeyDeleteInput = z.infer<typeof PasskeyDeleteInput>;
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { Locale, Name, Theme, TimeZone } from "../profile/profile.js";
3
+ // The sign-in doors under `/auth` that Colab checks itself. The rest of `/auth` is Better Auth's
4
+ // own and validated there.
5
+ // The body of `POST /auth/sign-up/email`. Strict, so a sign-up cannot set a picture or a field the
6
+ // account must not choose for itself (its kind, a lock). The language, zone and theme may come
7
+ // along: the UI sends what the browser says.
8
+ export const SignUpInput = z.strictObject({
9
+ name: Name,
10
+ email: z.email(),
11
+ password: z.string().min(1),
12
+ callbackURL: z.string().optional(),
13
+ rememberMe: z.boolean().optional(),
14
+ locale: Locale.optional(),
15
+ timezone: TimeZone.optional(),
16
+ theme: Theme.optional(),
17
+ });
18
+ // The body of `POST /auth/set-password`, the first password of an account that signs in with
19
+ // Google or Microsoft. Only presence is checked here; the length is Better Auth's rule.
20
+ export const SetPasswordInput = z.strictObject({ newPassword: z.string().min(1) });
21
+ // The body of `POST /auth/passkey/delete-passkey`, Colab's own door in place of Better Auth's.
22
+ export const PasskeyDeleteInput = z.strictObject({ id: z.string().min(1) });
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ export declare const AuthorizationRequest: z.ZodObject<{
3
+ token: z.ZodString;
4
+ }, z.core.$strict>;
5
+ export type AuthorizationRequest = z.infer<typeof AuthorizationRequest>;
6
+ export declare const Identity: z.ZodObject<{
7
+ userId: z.ZodString;
8
+ kind: z.ZodEnum<{
9
+ machine: "machine";
10
+ human: "human";
11
+ }>;
12
+ name: z.ZodString;
13
+ email: z.ZodString;
14
+ image: z.ZodNullable<z.ZodString>;
15
+ locale: z.ZodNullable<z.ZodString>;
16
+ timezone: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type Identity = z.infer<typeof Identity>;
19
+ export declare const Rules: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
20
+ export type Rules = z.infer<typeof Rules>;
21
+ export declare const AuthorizationResponse: z.ZodObject<{
22
+ identity: z.ZodObject<{
23
+ userId: z.ZodString;
24
+ kind: z.ZodEnum<{
25
+ machine: "machine";
26
+ human: "human";
27
+ }>;
28
+ name: z.ZodString;
29
+ email: z.ZodString;
30
+ image: z.ZodNullable<z.ZodString>;
31
+ locale: z.ZodNullable<z.ZodString>;
32
+ timezone: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ rules: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
35
+ }, z.core.$strip>;
36
+ export type AuthorizationResponse = z.infer<typeof AuthorizationResponse>;
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ // `POST /auth/service/authorization` (A22, #26): the runtime door for an outside service. Its key in
3
+ // the `authorization` header says WHICH service asks; the person's token in the body says FOR WHOM
4
+ // (the RFC 7662 shape). The answer is who that is and what they may do at THIS service. Taken from
5
+ // anchrd/gate `packages/sdk/src/contract/contract.ts` (9d8ece3) and reworked to Colab's names.
6
+ export const AuthorizationRequest = z.strictObject({ token: z.string().min(1) });
7
+ // Who the token belongs to. ⚠️ `z.object`, not strict, on purpose: Colab is the trusted sender and
8
+ // may add a field without breaking an older SDK (Postel). The doors that take input stay strict.
9
+ export const Identity = z.object({
10
+ userId: z.string().min(1),
11
+ kind: z.enum(["human", "machine"]),
12
+ name: z.string(),
13
+ email: z.string(),
14
+ // The address of the person's picture in this installation, relative (`/auth/profile-image/…`);
15
+ // null for a machine and for a person without one.
16
+ image: z.string().nullable(),
17
+ locale: z.string().nullable(),
18
+ timezone: z.string().nullable(),
19
+ });
20
+ // What the person may do at the asking service: interface → functions. `can(interface, function)`
21
+ // is a membership question on it, decided locally by the SDK.
22
+ export const Rules = z.record(z.string().min(1), z.array(z.string().min(1)));
23
+ export const AuthorizationResponse = z.object({ identity: Identity, rules: Rules });