@anchrd/colab-sdk 0.0.0-stage → 0.1.0

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,54 @@
1
+ import { z } from "zod";
2
+ import { UserId } from "../users/users.js";
3
+ // Sign-in through Google and Microsoft, set up under Einstellungen › SSO (#358, E90): one row per
4
+ // provider, set up or not. The id is the provider's word from the code (`google`), not a ULID, like a
5
+ // connector's id: there are exactly these two, and the sign-in page and Better Auth name them so.
6
+ //
7
+ // ⚠️ The client secret goes in and never comes out: no answer carries it, and no field of an answer
8
+ // is called `secret` (`/mcp` would strike it, `redactSecrets`). The input field is `clientSecret`.
9
+ export const ssoIds = ["google", "microsoft"];
10
+ export const SsoId = z.enum(ssoIds);
11
+ // Where the sign-in page gets a provider from right now: `settings` (set up here, in the database of
12
+ // `access`), `environment` (the installation's variables; locally `.dev.vars`), or null: not offered.
13
+ export const SsoSource = z.enum(["settings", "environment"]);
14
+ export const SsoListInput = z.strictObject({});
15
+ // "Einrichten": both values every time. A new client id with the old secret would not sign anybody
16
+ // in, so the pair is replaced together.
17
+ export const SsoUpdateInput = z.strictObject({
18
+ ssoId: SsoId.describe("The provider: google or microsoft."),
19
+ clientId: z
20
+ .string()
21
+ .trim()
22
+ .min(1)
23
+ .max(512)
24
+ .describe("The client id of the app registered at the provider."),
25
+ clientSecret: z
26
+ .string()
27
+ .trim()
28
+ .min(1)
29
+ .max(1024)
30
+ .describe("The client secret of that app. Stored sealed; no answer ever shows it again."),
31
+ });
32
+ // "Entfernen": the provider's settings are deleted at once and without archive. A provider the
33
+ // installation's variables name stays offered from there.
34
+ export const SsoRemoveInput = z.strictObject({
35
+ ssoId: SsoId.describe("The provider: google or microsoft."),
36
+ });
37
+ export const Sso = z.strictObject({
38
+ ssoId: SsoId,
39
+ // Set up here: the client id, when and by whom. Null while it is not set up here.
40
+ clientId: z.string().nullable(),
41
+ setAt: z.iso.datetime().nullable(),
42
+ setBy: UserId.nullable(),
43
+ source: SsoSource.nullable(),
44
+ // The address to enter at the provider as the redirect URI ("Weiterleitungs-Adresse").
45
+ redirectUrl: z.url(),
46
+ });
47
+ export const SsoList = z.strictObject({
48
+ items: z.array(Sso),
49
+ // Two rows at most: never a further page.
50
+ nextCursor: z.null(),
51
+ });
52
+ // `GET /auth/providers`, public: which buttons the sign-in page shows, in their order. Nothing else
53
+ // of a provider travels here.
54
+ export const SignInProviders = z.strictObject({ providers: z.array(SsoId) });
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ export declare const TableId: z.ZodTemplateLiteral<`node_${string}`>;
3
+ export type TableId = z.infer<typeof TableId>;
4
+ export declare const tableColumnTypes: readonly ["text", "number", "date", "email", "chip"];
5
+ export declare const TableColumnType: z.ZodEnum<{
6
+ number: "number";
7
+ date: "date";
8
+ email: "email";
9
+ text: "text";
10
+ chip: "chip";
11
+ }>;
12
+ export type TableColumnType = z.infer<typeof TableColumnType>;
13
+ export declare const TableColumn: z.ZodObject<{
14
+ name: z.ZodString;
15
+ type: z.ZodEnum<{
16
+ number: "number";
17
+ date: "date";
18
+ email: "email";
19
+ text: "text";
20
+ chip: "chip";
21
+ }>;
22
+ }, z.core.$strict>;
23
+ export type TableColumn = z.infer<typeof TableColumn>;
24
+ export declare const TableColumnChange: z.ZodObject<{
25
+ name: z.ZodString;
26
+ type: z.ZodEnum<{
27
+ number: "number";
28
+ date: "date";
29
+ email: "email";
30
+ text: "text";
31
+ chip: "chip";
32
+ }>;
33
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ }, z.core.$strict>;
35
+ export type TableColumnChange = z.infer<typeof TableColumnChange>;
36
+ export declare const TableCreateInput: z.ZodObject<{
37
+ parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
38
+ name: z.ZodString;
39
+ columns: z.ZodArray<z.ZodObject<{
40
+ name: z.ZodString;
41
+ type: z.ZodEnum<{
42
+ number: "number";
43
+ date: "date";
44
+ email: "email";
45
+ text: "text";
46
+ chip: "chip";
47
+ }>;
48
+ }, z.core.$strict>>;
49
+ rows: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
50
+ csv: z.ZodOptional<z.ZodString>;
51
+ idempotencyKey: z.ZodString;
52
+ }, z.core.$strict>;
53
+ export type TableCreateInput = z.infer<typeof TableCreateInput>;
54
+ export declare const tableFormats: readonly ["rows", "csv"];
55
+ export declare const TableGetInput: z.ZodObject<{
56
+ tableId: z.ZodTemplateLiteral<`node_${string}`>;
57
+ format: z.ZodOptional<z.ZodEnum<{
58
+ rows: "rows";
59
+ csv: "csv";
60
+ }>>;
61
+ }, z.core.$strict>;
62
+ export type TableGetInput = z.infer<typeof TableGetInput>;
63
+ export declare const TableUpdateInput: z.ZodObject<{
64
+ tableId: z.ZodTemplateLiteral<`node_${string}`>;
65
+ rev: z.ZodOptional<z.ZodNumber>;
66
+ editSession: z.ZodOptional<z.ZodString>;
67
+ columns: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
+ name: z.ZodString;
69
+ type: z.ZodEnum<{
70
+ number: "number";
71
+ date: "date";
72
+ email: "email";
73
+ text: "text";
74
+ chip: "chip";
75
+ }>;
76
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ }, z.core.$strict>>>;
78
+ csv: z.ZodOptional<z.ZodString>;
79
+ append: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
80
+ replace: z.ZodOptional<z.ZodArray<z.ZodObject<{
81
+ position: z.ZodNumber;
82
+ cells: z.ZodArray<z.ZodString>;
83
+ }, z.core.$strict>>>;
84
+ remove: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
85
+ }, z.core.$strict>;
86
+ export type TableUpdateInput = z.infer<typeof TableUpdateInput>;
87
+ export declare const TableDetail: z.ZodObject<{
88
+ secret: z.ZodOptional<z.ZodLiteral<true>>;
89
+ locked: z.ZodOptional<z.ZodBoolean>;
90
+ tableId: z.ZodTemplateLiteral<`node_${string}`>;
91
+ name: z.ZodString;
92
+ columns: z.ZodArray<z.ZodObject<{
93
+ name: z.ZodString;
94
+ type: z.ZodEnum<{
95
+ number: "number";
96
+ date: "date";
97
+ email: "email";
98
+ text: "text";
99
+ chip: "chip";
100
+ }>;
101
+ }, z.core.$strict>>;
102
+ rows: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
103
+ csv: z.ZodOptional<z.ZodString>;
104
+ version: z.ZodNumber;
105
+ rev: z.ZodNumber;
106
+ rights: z.ZodObject<{
107
+ write: z.ZodBoolean;
108
+ }, z.core.$strict>;
109
+ updatedAt: z.ZodISODateTime;
110
+ }, z.core.$strict>;
111
+ export type TableDetail = z.infer<typeof TableDetail>;
112
+ export declare const TableSaved: z.ZodObject<{
113
+ tableId: z.ZodTemplateLiteral<`node_${string}`>;
114
+ name: z.ZodString;
115
+ columns: z.ZodArray<z.ZodObject<{
116
+ name: z.ZodString;
117
+ type: z.ZodEnum<{
118
+ number: "number";
119
+ date: "date";
120
+ email: "email";
121
+ text: "text";
122
+ chip: "chip";
123
+ }>;
124
+ }, z.core.$strict>>;
125
+ rowCount: z.ZodNumber;
126
+ version: z.ZodNumber;
127
+ rev: z.ZodNumber;
128
+ removedColumns: z.ZodOptional<z.ZodArray<z.ZodObject<{
129
+ name: z.ZodString;
130
+ rows: z.ZodArray<z.ZodNumber>;
131
+ }, z.core.$strict>>>;
132
+ }, z.core.$strict>;
133
+ export type TableSaved = z.infer<typeof TableSaved>;
@@ -0,0 +1,131 @@
1
+ import { z } from "zod";
2
+ import { NodeId, SecretFields } from "../nodes/nodes.js";
3
+ import { IdempotencyKey, Rev } from "../primitives/primitives.js";
4
+ // Tables (#40, Nodes › Tabelle, E39, E59, E70): the inputs of `intelligence_table_create`, `_get`
5
+ // and `_update`, and their answers. A table is CSV, stored and exported as it is, whose first line is
6
+ // the header; beside it every version keeps the columns with their types. A row has no id: it is
7
+ // addressed by its position, counted from 1 at the first data row, against the state `rev` names.
8
+ // Appending, replacing and removing rows are fields of `_update`, not a resource of their own.
9
+ export const TableId = NodeId.describe("The table's id, a `node_…` of kind table.");
10
+ // The five types of a column (E39). The type only decides how a cell is shown; a cell is never
11
+ // checked against it.
12
+ export const tableColumnTypes = ["text", "number", "date", "email", "chip"];
13
+ export const TableColumnType = z
14
+ .enum(tableColumnTypes)
15
+ .describe("How the column's cells are shown: text; number (right-aligned); date (short); email (a link); chip (pills, several per cell separated by commas). The type is only how a cell looks: a cell is always text and is not checked against it.");
16
+ const ColumnName = z
17
+ .string()
18
+ .max(200)
19
+ .describe("The column's name, the cell of the header line. Not empty, and no two columns of a table share one (letter case ignored).");
20
+ export const TableColumn = z.strictObject({ name: ColumnName, type: TableColumnType });
21
+ // A column of a new column list (`_update` with `columns`): which cells fill it is the only thing a
22
+ // name cannot say when columns are renamed.
23
+ export const TableColumnChange = TableColumn.extend({
24
+ from: z
25
+ .string()
26
+ .max(200)
27
+ .nullable()
28
+ .optional()
29
+ .describe("The current column whose cells fill this one, by its current name: how a column is renamed. Null makes it a new empty column. Left out, a current column of the same name fills it, else it starts empty."),
30
+ });
31
+ const Columns = z.array(TableColumn).min(1).max(64);
32
+ const Cells = z
33
+ .array(z.string())
34
+ .describe("One row: its cells as text, as many as the table has columns, in the order of the columns. A chip cell holds several values separated by commas.");
35
+ const Rows = z.array(Cells).max(10_000);
36
+ const Csv = z
37
+ .string()
38
+ .describe("The whole table as CSV: the header line with the column names first, then one line per row, as intelligence_table_get with format csv answers it. At most 1 MB in UTF-8.");
39
+ // Counted from 1 at the first data row; the header line is no row.
40
+ const Position = z
41
+ .number()
42
+ .int()
43
+ .min(1)
44
+ .describe("A row's position, 1 for the first data row (the header line is not counted), as it stands in the state of the rev you send.");
45
+ const EditSession = z
46
+ .string()
47
+ .min(1)
48
+ .max(100)
49
+ .optional()
50
+ .describe("The editing session the table view keeps while a person stays on the table: saves of one session go into one version. Leaving it out makes every save a version of its own, which is right for an AI.");
51
+ export const TableCreateInput = z.strictObject({
52
+ // ⚠️ Required and nullable (trap C015): null is the top level of Shared.
53
+ parentId: NodeId.nullable().describe("The folder to create the table in, one you can write to; null creates it on the top level of Shared, visible to you until you share it."),
54
+ name: z.string().max(200).describe("The table's name as people read it."),
55
+ columns: Columns.describe("The columns in their order, at least one, each with its name and type. They are the table's header."),
56
+ rows: Rows.optional().describe("The first rows, each a list of cells in the order of the columns. Send rows or csv, not both; leaving both out creates an empty table."),
57
+ csv: Csv.optional().describe("The first content as CSV whose header line holds exactly the names of columns, in their order. Send rows or csv, not both."),
58
+ idempotencyKey: IdempotencyKey,
59
+ });
60
+ export const tableFormats = ["rows", "csv"];
61
+ export const TableGetInput = z.strictObject({
62
+ tableId: TableId,
63
+ format: z
64
+ .enum(tableFormats)
65
+ .optional()
66
+ .describe("rows (the default) answers the rows as lists of cells; csv answers the whole table as CSV text instead, the header line first."),
67
+ });
68
+ export const TableUpdateInput = z.strictObject({
69
+ tableId: TableId,
70
+ rev: Rev.optional().describe("The revision of the table this change is based on, as the last read returned it; the positions of replace and remove are counted in that state. Required for every change except appending rows alone, which collides with nothing. If someone saved in between, the call answers conflict and changes nothing: read the table again and decide."),
71
+ editSession: EditSession,
72
+ columns: z
73
+ .array(TableColumnChange)
74
+ .min(1)
75
+ .max(64)
76
+ .optional()
77
+ .describe("The whole new column list in its new order: names, types, new columns and, by leaving them out, removed ones. A removed column's cells stay only in the table's history; the answer names the rows that had content in it. With csv, it is the header the csv must match instead."),
78
+ csv: Csv.optional().describe("Replace the whole table: CSV whose header line holds exactly the column names, the current ones or those sent in columns alongside."),
79
+ append: Rows.min(1)
80
+ .optional()
81
+ .describe("Rows to add at the end, each a list of cells in the order of the columns. Appending alone needs no rev and no reading of the table first."),
82
+ replace: z
83
+ .array(z.strictObject({
84
+ position: Position,
85
+ cells: Cells.describe("The complete new row: its cells as text, as many as the table has columns."),
86
+ }))
87
+ .min(1)
88
+ .max(10_000)
89
+ .optional()
90
+ .describe("Rows to overwrite whole, each by its position in the state of the rev you send. Applied first, then remove, then append."),
91
+ remove: z
92
+ .array(Position)
93
+ .min(1)
94
+ .max(10_000)
95
+ .optional()
96
+ .describe("Positions of the rows to remove, each counted in the state of the rev you send, so they do not shift while the call runs. Applied after replace and before append."),
97
+ });
98
+ export const TableDetail = z.strictObject({
99
+ tableId: TableId,
100
+ name: z.string(),
101
+ columns: z.array(TableColumn),
102
+ // The data rows, the first is position 1; absent when `format` is csv.
103
+ rows: z.array(z.array(z.string())).optional(),
104
+ // The whole table as CSV, header first; only when `format` is csv.
105
+ csv: z.string().optional(),
106
+ // The current version's number, as people read it ("Version 6").
107
+ version: z.number().int(),
108
+ // The state the next save sends (E70).
109
+ rev: z.number().int(),
110
+ rights: z.strictObject({ write: z.boolean() }),
111
+ updatedAt: z.iso.datetime(),
112
+ // A secret table (#357): no columns and no rows (an empty csv) while it is `locked` for this
113
+ // caller.
114
+ ...SecretFields,
115
+ });
116
+ // The answer of a create and an update: the state after it, without the rows, so appending one row
117
+ // to a large table does not send the table back.
118
+ export const TableSaved = z.strictObject({
119
+ tableId: TableId,
120
+ name: z.string(),
121
+ columns: z.array(TableColumn),
122
+ // How many data rows the table holds now.
123
+ rowCount: z.number().int(),
124
+ version: z.number().int(),
125
+ rev: z.number().int(),
126
+ // Only after a change of the columns: every removed column and the positions (in the new state)
127
+ // of the rows whose content in it now stands only in the history.
128
+ removedColumns: z
129
+ .array(z.strictObject({ name: z.string(), rows: z.array(z.number().int()) }))
130
+ .optional(),
131
+ });
package/dist/tool.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ import type { z } from "zod";
2
+ import type { Package } from "./grammar/grammar.js";
3
+ export type ToolInput = z.ZodObject<z.core.$ZodShape, z.core.$strict>;
4
+ export type Permission = `${Package} / ${string} / ${string}`;
5
+ export type Actor = {
6
+ userId: string;
7
+ kind: "human" | "machine";
8
+ adminMode: boolean;
9
+ client?: string;
10
+ session?: string;
11
+ };
12
+ export type ToolSource = "api" | "mcp";
13
+ export type ToolContext = {
14
+ actor: Actor;
15
+ source?: ToolSource;
16
+ };
17
+ export type ToolAnnotations = {
18
+ readOnlyHint?: boolean;
19
+ openWorldHint?: boolean;
20
+ };
21
+ export type Tool<Input extends ToolInput = ToolInput> = {
22
+ name: string;
23
+ description: string;
24
+ input: Input;
25
+ permission: Permission;
26
+ revealsSecret?: true;
27
+ browserOnly?: true;
28
+ annotations?: ToolAnnotations;
29
+ handler(input: z.output<Input>, context: ToolContext): Promise<unknown>;
30
+ };
31
+ export declare function defineTool<Input extends ToolInput>(tool: Tool<Input>): Tool;
package/dist/tool.js ADDED
@@ -0,0 +1,4 @@
1
+ // Keeps a tool's input type for its handler, and hands it on as a plain `Tool` for the list.
2
+ export function defineTool(tool) {
3
+ return tool;
4
+ }
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ export declare const notifyModes: readonly ["immediate", "daily", "never"];
3
+ export declare const NotifyMode: z.ZodEnum<{
4
+ never: "never";
5
+ daily: "daily";
6
+ immediate: "immediate";
7
+ }>;
8
+ export type NotifyMode = z.infer<typeof NotifyMode>;
9
+ export declare const IntelligenceUserGetInput: z.ZodObject<{
10
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
11
+ }, z.core.$strict>;
12
+ export type IntelligenceUserGetInput = z.infer<typeof IntelligenceUserGetInput>;
13
+ export declare const IntelligenceUserUpdateInput: z.ZodObject<{
14
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
15
+ notify: z.ZodOptional<z.ZodEnum<{
16
+ never: "never";
17
+ daily: "daily";
18
+ immediate: "immediate";
19
+ }>>;
20
+ digestHour: z.ZodOptional<z.ZodNumber>;
21
+ digestZone: z.ZodOptional<z.ZodString>;
22
+ digestLocale: z.ZodOptional<z.ZodEnum<{
23
+ en: "en";
24
+ de: "de";
25
+ }>>;
26
+ baseUpdatedAt: z.ZodNullable<z.ZodISODateTime>;
27
+ }, z.core.$strict>;
28
+ export type IntelligenceUserUpdateInput = z.infer<typeof IntelligenceUserUpdateInput>;
29
+ export declare const UserSettings: z.ZodObject<{
30
+ userId: z.ZodTemplateLiteral<`user_${string}`>;
31
+ notify: z.ZodEnum<{
32
+ never: "never";
33
+ daily: "daily";
34
+ immediate: "immediate";
35
+ }>;
36
+ digestHour: z.ZodNumber;
37
+ digestZone: z.ZodString;
38
+ digestLocale: z.ZodEnum<{
39
+ en: "en";
40
+ de: "de";
41
+ }>;
42
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
43
+ }, z.core.$strict>;
44
+ export type UserSettings = z.infer<typeof UserSettings>;
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ import { Locale, TimeZone } from "../profile/profile.js";
3
+ import { UserId } from "../users/users.js";
4
+ // How new things in Actions reach a person by mail (#50, Einstellungen › Benachrichtigungen, E53):
5
+ // the setting of the resource `user` in `intelligence`, read and changed by the person themselves.
6
+ // "Notification" is no resource. ⚠️ `UserGetInput` and `UserUpdateInput` belong to `access_user_get`
7
+ // and `access_user_update`, so these two carry the package word (`toolSchemaName`, as
8
+ // `IntelligenceUserListInput` beside `UserListInput`). Every input field carries its description
9
+ // (trap C004).
10
+ // Immediately ("New for you"), once a day (the daily summary) or never.
11
+ export const notifyModes = ["immediate", "daily", "never"];
12
+ export const NotifyMode = z.enum(notifyModes);
13
+ export const IntelligenceUserGetInput = z.strictObject({
14
+ userId: UserId.describe("Your own user id, `user_…`. Only your own setting can be read; any other id answers not_found."),
15
+ });
16
+ export const IntelligenceUserUpdateInput = z.strictObject({
17
+ userId: UserId.describe("Your own user id, `user_…`. Only your own setting can be changed; any other id answers not_found."),
18
+ notify: NotifyMode.optional().describe("How something new in your Actions (a task open for you, a mention in a chat) reaches you by mail: immediate sends one mail each time, daily one summary at digestHour, never none. Leaving it out keeps it."),
19
+ digestHour: z
20
+ .number()
21
+ .int()
22
+ .min(0)
23
+ .max(23)
24
+ .optional()
25
+ .describe("The hour of the daily summary, 0 to 23, in digestZone. Leaving it out keeps it; the default is 8."),
26
+ digestZone: TimeZone.optional().describe("The IANA time zone the hour counts in, such as Europe/Berlin. Leaving it out keeps it; the default is the zone of your profile."),
27
+ digestLocale: Locale.optional().describe("The language of your mails, en or de. Leaving it out keeps it; the default is the language of your profile."),
28
+ // ⚠️ Required and nullable (trap C015): a caller that leaves it out could overwrite a newer save.
29
+ baseUpdatedAt: z.iso
30
+ .datetime()
31
+ .nullable()
32
+ .describe("The updatedAt your last read returned, null when it was null (nothing saved yet). If someone saved in between, the call answers conflict and changes nothing: read again and decide."),
33
+ });
34
+ // The answer of both: the values that apply now, stored or the defaults.
35
+ export const UserSettings = z.strictObject({
36
+ userId: UserId,
37
+ // A machine is always `never`: it fetches its tasks and messages over MCP itself.
38
+ notify: NotifyMode,
39
+ digestHour: z.number().int(),
40
+ digestZone: z.string(),
41
+ digestLocale: Locale,
42
+ // The last save, null while nothing is saved and the defaults apply. The next save sends it back.
43
+ updatedAt: z.iso.datetime().nullable(),
44
+ });