@karmaniverous/jeeves-server-core 0.4.0 → 0.5.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 (60) hide show
  1. package/README.md +49 -12
  2. package/dist/openapi.json.js +4038 -0
  3. package/dist/scripts/openapiInfo.d.ts +15 -0
  4. package/dist/src/catalog/browserSafe.test.d.ts +4 -0
  5. package/dist/src/catalog/contentEntries.d.ts +468 -0
  6. package/dist/src/catalog/contentEntries.js +150 -0
  7. package/dist/src/catalog/contentSchemas.d.ts +179 -0
  8. package/dist/src/catalog/contentSchemas.js +195 -0
  9. package/dist/src/catalog/descriptions.d.ts +52 -0
  10. package/dist/src/catalog/descriptions.js +54 -0
  11. package/dist/src/catalog/eventEntries.d.ts +70 -0
  12. package/dist/src/catalog/eventEntries.js +59 -0
  13. package/dist/src/catalog/fileMutateSchema.d.ts +41 -0
  14. package/dist/src/catalog/fileMutateSchema.js +77 -0
  15. package/dist/src/catalog/index.d.ts +15 -0
  16. package/dist/src/catalog/index.js +10 -0
  17. package/dist/src/catalog/oauthEntries.d.ts +125 -0
  18. package/dist/src/catalog/oauthEntries.js +92 -0
  19. package/dist/src/catalog/route.d.ts +137 -0
  20. package/dist/src/catalog/route.js +92 -0
  21. package/dist/src/catalog/runnerEntries.d.ts +145 -0
  22. package/dist/src/catalog/runnerEntries.js +69 -0
  23. package/dist/src/catalog/schemas.test.d.ts +4 -0
  24. package/dist/src/catalog/serverCatalog.d.ts +1143 -0
  25. package/dist/src/catalog/serverCatalog.js +37 -0
  26. package/dist/src/catalog/serverCatalog.test.d.ts +4 -0
  27. package/dist/src/catalog/sharingEntries.d.ts +200 -0
  28. package/dist/src/catalog/sharingEntries.js +146 -0
  29. package/dist/src/catalog/statusSchemas.d.ts +87 -0
  30. package/dist/src/catalog/statusSchemas.js +119 -0
  31. package/dist/src/catalog/utilityEntries.d.ts +151 -0
  32. package/dist/src/catalog/utilityEntries.js +62 -0
  33. package/dist/src/catalog/utilitySchemas.d.ts +98 -0
  34. package/dist/src/catalog/utilitySchemas.js +131 -0
  35. package/dist/src/configAuthSchema.d.ts +100 -0
  36. package/dist/src/configAuthSchema.js +119 -0
  37. package/dist/src/configFeatureSchemas.d.ts +43 -0
  38. package/dist/src/configFeatureSchemas.js +53 -0
  39. package/dist/src/configPrintStyles.d.ts +63 -0
  40. package/dist/src/configPrintStyles.js +98 -0
  41. package/dist/src/configPrintStyles.test.d.ts +1 -0
  42. package/dist/src/crypto.d.ts +6 -13
  43. package/dist/src/crypto.js +7 -32
  44. package/dist/src/crypto.test.d.ts +7 -0
  45. package/dist/src/errors.d.ts +51 -0
  46. package/dist/src/errors.js +97 -0
  47. package/dist/src/errors.test.d.ts +4 -0
  48. package/dist/src/index.d.ts +4 -2
  49. package/dist/src/index.js +17 -3
  50. package/dist/src/openapi.d.ts +13 -0
  51. package/dist/src/openapi.js +17 -0
  52. package/dist/src/openapi.test.d.ts +4 -0
  53. package/dist/src/schema.d.ts +20 -122
  54. package/dist/src/schema.js +17 -153
  55. package/dist/src/types.d.ts +2 -0
  56. package/openapi.json +3934 -0
  57. package/package.json +26 -13
  58. package/dist/src/endpoints.d.ts +0 -34
  59. package/dist/src/endpoints.js +0 -248
  60. /package/dist/src/{endpoints.test.d.ts → configAuthSchema.test.d.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ import { defineCatalog, standardEntries } from '@karmaniverous/jeeves/catalog';
2
+ import { CONTENT_ENTRIES } from './contentEntries.js';
3
+ import { EVENT_ENTRIES } from './eventEntries.js';
4
+ import { OAUTH_ENTRIES } from './oauthEntries.js';
5
+ import { INSIDER_ONLY } from './route.js';
6
+ import { RUNNER_ENTRIES } from './runnerEntries.js';
7
+ import { SHARING_ENTRIES } from './sharingEntries.js';
8
+ import { serverHealthSchema } from './statusSchemas.js';
9
+ import { UTILITY_ENTRIES } from './utilityEntries.js';
10
+
11
+ /**
12
+ * The jeeves-server endpoint catalog (`SERVER_CATALOG`): one Zod-described entry per machine-API route, from which the service's routes and validation, the OpenAPI document, the SDK client and the plugin's tools are derived; plus the types inferred from it. Pure.
13
+ *
14
+ * @remarks
15
+ * jeeves' three standard entries (`status` public; `config` and
16
+ * `configApply` admin), then the content, sharing, utility, event, OAuth and
17
+ * runner entries. Entry names are the SDK method, the plugin tool's base
18
+ * name (`server_` + snake_case) and the OpenAPI `operationId`. Browser
19
+ * routes (the SPA, sign-in, `/oauth/callback`, `/go/:slug`) are not in it.
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+ /** The jeeves-server endpoint catalog. */
24
+ const SERVER_CATALOG = defineCatalog([
25
+ ...standardEntries('server', {
26
+ auth: { config: INSIDER_ONLY },
27
+ healthSchema: serverHealthSchema,
28
+ }),
29
+ ...UTILITY_ENTRIES,
30
+ ...CONTENT_ENTRIES,
31
+ ...SHARING_ENTRIES,
32
+ ...EVENT_ENTRIES,
33
+ ...OAUTH_ENTRIES,
34
+ ...RUNNER_ENTRIES,
35
+ ]);
36
+
37
+ export { SERVER_CATALOG };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * `SERVER_CATALOG` (next-api-catalog.md, Entry inventory): every entry with its method, path, kind and access class, complete descriptions and schemas, the tool names the plugin keeps, the share parameters on content and navigation entries, and the binary entries' content types.
3
+ */
4
+ export {};
@@ -0,0 +1,200 @@
1
+ /**
2
+ * The sharing entries of the server catalog: share, shareFor, contentLink, readmeLink, resolvePath and rotateKey, with their request and response schemas. Pure.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { z } from 'zod';
7
+ /** `share` body. */
8
+ export declare const shareBodySchema: z.ZodObject<{
9
+ path: z.ZodString;
10
+ expiry: z.ZodOptional<z.ZodString>;
11
+ depth: z.ZodOptional<z.ZodNumber>;
12
+ dirs: z.ZodOptional<z.ZodBoolean>;
13
+ }, z.core.$strip>;
14
+ /** `share` response. */
15
+ export declare const shareResponseSchema: z.ZodObject<{
16
+ url: z.ZodString;
17
+ path: z.ZodString;
18
+ exp: z.ZodNullable<z.ZodString>;
19
+ depth: z.ZodNumber;
20
+ dirs: z.ZodBoolean;
21
+ isDirectory: z.ZodBoolean;
22
+ }, z.core.$strip>;
23
+ /** `shareFor` body. */
24
+ export declare const shareForBodySchema: z.ZodObject<{
25
+ path: z.ZodString;
26
+ insiders: z.ZodArray<z.ZodString>;
27
+ depth: z.ZodOptional<z.ZodNumber>;
28
+ dirs: z.ZodOptional<z.ZodBoolean>;
29
+ enforceOutsiderPolicy: z.ZodOptional<z.ZodBoolean>;
30
+ }, z.core.$strip>;
31
+ /** `shareFor` response. */
32
+ export declare const shareForResponseSchema: z.ZodObject<{
33
+ url: z.ZodNullable<z.ZodString>;
34
+ type: z.ZodEnum<{
35
+ insider: "insider";
36
+ "outsider-share": "outsider-share";
37
+ blocked: "blocked";
38
+ "policy-denied": "policy-denied";
39
+ }>;
40
+ reason: z.ZodOptional<z.ZodString>;
41
+ blocked: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ warning: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ /** `{ url }`: a pre-computed share link. */
45
+ export declare const linkResponseSchema: z.ZodObject<{
46
+ url: z.ZodString;
47
+ }, z.core.$strip>;
48
+ /** `resolvePath` response. */
49
+ export declare const resolvePathResponseSchema: z.ZodObject<{
50
+ browsePath: z.ZodString;
51
+ browseUrl: z.ZodString;
52
+ publicUrl: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strip>;
54
+ /** `rotateKey` response. */
55
+ export declare const rotateKeyResponseSchema: z.ZodObject<{
56
+ ok: z.ZodLiteral<true>;
57
+ keyCreatedAt: z.ZodString;
58
+ invalidates: z.ZodArray<z.ZodEnum<{
59
+ insiderKey: "insiderKey";
60
+ outsiderLinks: "outsiderLinks";
61
+ }>>;
62
+ }, z.core.$strip>;
63
+ /** The sharing entries. */
64
+ export declare const SHARING_ENTRIES: readonly [{
65
+ readonly body: z.ZodObject<{
66
+ path: z.ZodString;
67
+ expiry: z.ZodOptional<z.ZodString>;
68
+ depth: z.ZodOptional<z.ZodNumber>;
69
+ dirs: z.ZodOptional<z.ZodBoolean>;
70
+ }, z.core.$strip>;
71
+ readonly response: z.ZodObject<{
72
+ url: z.ZodString;
73
+ path: z.ZodString;
74
+ exp: z.ZodNullable<z.ZodString>;
75
+ depth: z.ZodNumber;
76
+ dirs: z.ZodBoolean;
77
+ isDirectory: z.ZodBoolean;
78
+ }, z.core.$strip>;
79
+ readonly auth: {
80
+ readonly schemes: readonly [{
81
+ readonly in: "query";
82
+ readonly name: "k";
83
+ }, {
84
+ readonly in: "cookie";
85
+ readonly name: "jeeves_session";
86
+ }];
87
+ readonly insiderOnly: true;
88
+ };
89
+ readonly kind: "read";
90
+ readonly name: "share";
91
+ readonly method: "POST";
92
+ readonly path: "/api/share";
93
+ readonly description: "Sign a share link for a path: a path key, optionally expiring, or a deep share (`depth`, `dirs`). The response reports whether the path is a directory.";
94
+ }, {
95
+ readonly body: z.ZodObject<{
96
+ path: z.ZodString;
97
+ insiders: z.ZodArray<z.ZodString>;
98
+ depth: z.ZodOptional<z.ZodNumber>;
99
+ dirs: z.ZodOptional<z.ZodBoolean>;
100
+ enforceOutsiderPolicy: z.ZodOptional<z.ZodBoolean>;
101
+ }, z.core.$strip>;
102
+ readonly response: z.ZodObject<{
103
+ url: z.ZodNullable<z.ZodString>;
104
+ type: z.ZodEnum<{
105
+ insider: "insider";
106
+ "outsider-share": "outsider-share";
107
+ blocked: "blocked";
108
+ "policy-denied": "policy-denied";
109
+ }>;
110
+ reason: z.ZodOptional<z.ZodString>;
111
+ blocked: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
+ warning: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>;
114
+ readonly auth: {
115
+ readonly schemes: readonly [{
116
+ readonly in: "query";
117
+ readonly name: "k";
118
+ }, {
119
+ readonly in: "cookie";
120
+ readonly name: "jeeves_session";
121
+ }];
122
+ readonly insiderOnly: true;
123
+ };
124
+ readonly kind: "read";
125
+ readonly name: "shareFor";
126
+ readonly method: "POST";
127
+ readonly path: "/api/util/share-for";
128
+ readonly description: "Sign a share link for a path aimed at named insiders: an insider link when every recipient is an insider with access, else an outsider share checked against the outsider policy.";
129
+ }, {
130
+ readonly params: z.ZodObject<{
131
+ file: z.ZodString;
132
+ }, z.core.$strip>;
133
+ readonly response: z.ZodObject<{
134
+ url: z.ZodString;
135
+ }, z.core.$strip>;
136
+ readonly auth: "none";
137
+ readonly kind: "read";
138
+ readonly name: "contentLink";
139
+ readonly method: "GET";
140
+ readonly path: "/api/content-link/:file";
141
+ readonly description: "Pre-computed share link for one of the pinned content pages of the server (privacy, terms).";
142
+ }, {
143
+ readonly response: z.ZodObject<{
144
+ url: z.ZodString;
145
+ }, z.core.$strip>;
146
+ readonly auth: "none";
147
+ readonly kind: "read";
148
+ readonly name: "readmeLink";
149
+ readonly method: "GET";
150
+ readonly path: "/api/readme-link";
151
+ readonly description: "Pre-computed share link for the README of the server.";
152
+ }, {
153
+ readonly query: z.ZodObject<{
154
+ fsPath: z.ZodString;
155
+ }, z.core.$strip>;
156
+ readonly response: z.ZodObject<{
157
+ browsePath: z.ZodString;
158
+ browseUrl: z.ZodString;
159
+ publicUrl: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strip>;
161
+ readonly auth: {
162
+ readonly schemes: readonly [{
163
+ readonly in: "query";
164
+ readonly name: "k";
165
+ }, {
166
+ readonly in: "cookie";
167
+ readonly name: "jeeves_session";
168
+ }];
169
+ readonly insiderOnly: true;
170
+ };
171
+ readonly kind: "read";
172
+ readonly name: "resolvePath";
173
+ readonly method: "GET";
174
+ readonly path: "/api/resolve-path";
175
+ readonly description: "Convert an absolute filesystem path to a server browse path and optional public URL.";
176
+ }, {
177
+ readonly response: z.ZodObject<{
178
+ ok: z.ZodLiteral<true>;
179
+ keyCreatedAt: z.ZodString;
180
+ invalidates: z.ZodArray<z.ZodEnum<{
181
+ insiderKey: "insiderKey";
182
+ outsiderLinks: "outsiderLinks";
183
+ }>>;
184
+ }, z.core.$strip>;
185
+ readonly auth: {
186
+ readonly schemes: readonly [{
187
+ readonly in: "query";
188
+ readonly name: "k";
189
+ }, {
190
+ readonly in: "cookie";
191
+ readonly name: "jeeves_session";
192
+ }];
193
+ readonly insiderOnly: true;
194
+ };
195
+ readonly kind: "destructive";
196
+ readonly name: "rotateKey";
197
+ readonly method: "POST";
198
+ readonly path: "/api/rotate-key";
199
+ readonly description: "Rotate the key of the calling insider. The old insider key and every outsider link the insider signed stop working.";
200
+ }];
@@ -0,0 +1,146 @@
1
+ import { z } from 'zod';
2
+ import { INSIDER_ONLY, PUBLIC, route } from './route.js';
3
+
4
+ /**
5
+ * The sharing entries of the server catalog: share, shareFor, contentLink, readmeLink, resolvePath and rotateKey, with their request and response schemas. Pure.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /** `share` body. */
10
+ const shareBodySchema = z.object({
11
+ /** Path to share (`/<root>/<path>`). */
12
+ path: z.string().describe('Path to share (/<root>/<path>).'),
13
+ /** Expiry (Unix ms, as a string); omit for a link that doesn't expire. */
14
+ expiry: z
15
+ .string()
16
+ .optional()
17
+ .describe('Expiry (Unix milliseconds); omit for no expiry.'),
18
+ /** Deep share depth (levels of links the recipient may follow). */
19
+ depth: z.number().int().optional().describe('Deep share depth.'),
20
+ /** Deep share: directories below the path may be listed. */
21
+ dirs: z
22
+ .boolean()
23
+ .optional()
24
+ .describe('Deep share: directories below the path may be opened.'),
25
+ });
26
+ /** `share` response. */
27
+ const shareResponseSchema = z.object({
28
+ /** Share URL (server-relative). */
29
+ url: z.string(),
30
+ /** The shared path. */
31
+ path: z.string(),
32
+ /** Expiry as given, or null. */
33
+ exp: z.string().nullable(),
34
+ /** Deep share depth (0 for a path share). */
35
+ depth: z.number(),
36
+ /** Deep share `dirs`. */
37
+ dirs: z.boolean(),
38
+ /** Whether the path is a directory. */
39
+ isDirectory: z.boolean(),
40
+ });
41
+ /** `shareFor` body. */
42
+ const shareForBodySchema = z.object({
43
+ /** Path to share (`/<root>/<path>`). */
44
+ path: z.string().describe('Path to share (/<root>/<path>).'),
45
+ /** Recipients: insider emails, or anyone else (an outsider). */
46
+ insiders: z
47
+ .array(z.string())
48
+ .describe('Recipients: insider emails; anyone else is an outsider.'),
49
+ /** Deep share depth. */
50
+ depth: z.number().int().optional().describe('Deep share depth.'),
51
+ /** Deep share `dirs`. */
52
+ dirs: z
53
+ .boolean()
54
+ .optional()
55
+ .describe('Deep share: directories below the path may be opened.'),
56
+ /** `false`: sign even where the outsider policy denies (with a warning). */
57
+ enforceOutsiderPolicy: z
58
+ .boolean()
59
+ .optional()
60
+ .describe('false: sign even where the outsider policy denies.'),
61
+ });
62
+ /** `shareFor` response. */
63
+ const shareForResponseSchema = z.object({
64
+ /** The link (absolute when a public URL is configured), or null. */
65
+ url: z.string().nullable(),
66
+ /** What was produced. */
67
+ type: z.enum(['insider', 'outsider-share', 'blocked', 'policy-denied']),
68
+ /** Why no link was produced. */
69
+ reason: z.string().optional(),
70
+ /** Recipients without access to the path (`blocked`). */
71
+ blocked: z.array(z.string()).optional(),
72
+ /** Set when the outsider policy would have denied the link. */
73
+ warning: z.string().optional(),
74
+ });
75
+ /** `{ url }`: a pre-computed share link. */
76
+ const linkResponseSchema = z.object({
77
+ /** Share URL (server-relative). */
78
+ url: z.string(),
79
+ });
80
+ /** `resolvePath` response. */
81
+ const resolvePathResponseSchema = z.object({
82
+ /** Browse path (`<root>/<path>`). */
83
+ browsePath: z.string(),
84
+ /** Page URL (server-relative, encoded). */
85
+ browseUrl: z.string(),
86
+ /** Absolute page URL, when a public URL is configured. */
87
+ publicUrl: z.string().optional(),
88
+ });
89
+ /** `rotateKey` response. */
90
+ const rotateKeyResponseSchema = z.object({
91
+ /** Always true. */
92
+ ok: z.literal(true),
93
+ /** When the new key was created (ISO). */
94
+ keyCreatedAt: z.string(),
95
+ /** What stopped working: the insider key and the insider's outsider links. */
96
+ invalidates: z.array(z.enum(['insiderKey', 'outsiderLinks'])),
97
+ });
98
+ /** The sharing entries. */
99
+ const SHARING_ENTRIES = [
100
+ {
101
+ ...route('share', 'POST', '/api/share'),
102
+ body: shareBodySchema,
103
+ response: shareResponseSchema,
104
+ auth: INSIDER_ONLY,
105
+ kind: 'read',
106
+ },
107
+ {
108
+ ...route('shareFor', 'POST', '/api/util/share-for'),
109
+ body: shareForBodySchema,
110
+ response: shareForResponseSchema,
111
+ auth: INSIDER_ONLY,
112
+ kind: 'read',
113
+ },
114
+ {
115
+ ...route('contentLink', 'GET', '/api/content-link/:file'),
116
+ params: z.object({
117
+ file: z.string().describe('Content page: privacy or terms.'),
118
+ }),
119
+ response: linkResponseSchema,
120
+ auth: PUBLIC,
121
+ kind: 'read',
122
+ },
123
+ {
124
+ ...route('readmeLink', 'GET', '/api/readme-link'),
125
+ response: linkResponseSchema,
126
+ auth: PUBLIC,
127
+ kind: 'read',
128
+ },
129
+ {
130
+ ...route('resolvePath', 'GET', '/api/resolve-path'),
131
+ query: z.object({
132
+ fsPath: z.string().describe('Absolute filesystem path to resolve'),
133
+ }),
134
+ response: resolvePathResponseSchema,
135
+ auth: INSIDER_ONLY,
136
+ kind: 'read',
137
+ },
138
+ {
139
+ ...route('rotateKey', 'POST', '/api/rotate-key'),
140
+ response: rotateKeyResponseSchema,
141
+ auth: INSIDER_ONLY,
142
+ kind: 'destructive',
143
+ },
144
+ ];
145
+
146
+ export { SHARING_ENTRIES, linkResponseSchema, resolvePathResponseSchema, rotateKeyResponseSchema, shareBodySchema, shareForBodySchema, shareForResponseSchema, shareResponseSchema };
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The server's `health` block in `GET /status` (`serverHealthSchema`): today's block plus the 3.16.0 additions (sign-in redirect URIs, `eventQueue`), with the event commands and the Chrome path optional because callers that aren't admin don't get them (Decision 22). Pure.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { z } from 'zod';
7
+ /** A downstream service as `/status` last saw it. */
8
+ export declare const serviceProbeSchema: z.ZodObject<{
9
+ url: z.ZodString;
10
+ reachable: z.ZodBoolean;
11
+ version: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ /** Event queue progress (counts since start; timestamps ISO). */
14
+ export declare const eventQueueHealthSchema: z.ZodObject<{
15
+ offset: z.ZodNumber;
16
+ size: z.ZodNumber;
17
+ pendingBytes: z.ZodNumber;
18
+ parseErrors: z.ZodNumber;
19
+ lastCursorReset: z.ZodOptional<z.ZodString>;
20
+ lastRewind: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ /** The server's `health` details. */
23
+ export declare const serverHealthSchema: z.ZodObject<{
24
+ port: z.ZodNumber;
25
+ chrome: z.ZodObject<{
26
+ configured: z.ZodBoolean;
27
+ path: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ auth: z.ZodObject<{
30
+ modes: z.ZodArray<z.ZodString>;
31
+ insiderCount: z.ZodNumber;
32
+ keyCount: z.ZodNumber;
33
+ googleRedirectUri: z.ZodOptional<z.ZodString>;
34
+ oauthRedirectUri: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ events: z.ZodArray<z.ZodObject<{
37
+ name: z.ZodString;
38
+ cmd: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>>;
40
+ eventQueue: z.ZodObject<{
41
+ offset: z.ZodNumber;
42
+ size: z.ZodNumber;
43
+ pendingBytes: z.ZodNumber;
44
+ parseErrors: z.ZodNumber;
45
+ lastCursorReset: z.ZodOptional<z.ZodString>;
46
+ lastRewind: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ exports: z.ZodObject<{
49
+ documents: z.ZodArray<z.ZodString>;
50
+ directories: z.ZodArray<z.ZodString>;
51
+ diagrams: z.ZodArray<z.ZodString>;
52
+ chromeAvailable: z.ZodBoolean;
53
+ }, z.core.$strip>;
54
+ diagrams: z.ZodObject<{
55
+ mermaid: z.ZodBoolean;
56
+ plantuml: z.ZodObject<{
57
+ localJar: z.ZodBoolean;
58
+ servers: z.ZodArray<z.ZodString>;
59
+ }, z.core.$strip>;
60
+ }, z.core.$strip>;
61
+ services: z.ZodObject<{
62
+ watcher: z.ZodObject<{
63
+ url: z.ZodString;
64
+ reachable: z.ZodBoolean;
65
+ version: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ runner: z.ZodObject<{
68
+ url: z.ZodString;
69
+ reachable: z.ZodBoolean;
70
+ version: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ meta: z.ZodObject<{
73
+ url: z.ZodString;
74
+ reachable: z.ZodBoolean;
75
+ version: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ lastChecked: z.ZodNullable<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ branding: z.ZodObject<{
80
+ name: z.ZodString;
81
+ emoji: z.ZodOptional<z.ZodString>;
82
+ theme: z.ZodOptional<z.ZodObject<{
83
+ light: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
84
+ dark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * The server's `health` block in `GET /status` (`serverHealthSchema`): today's block plus the 3.16.0 additions (sign-in redirect URIs, `eventQueue`), with the event commands and the Chrome path optional because callers that aren't admin don't get them (Decision 22). Pure.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ /** CSS variable overrides of one theme mode. */
9
+ const cssOverridesSchema = z.record(z.string(), z.string());
10
+ /** A downstream service as `/status` last saw it. */
11
+ const serviceProbeSchema = z.object({
12
+ /** Service URL. */
13
+ url: z.string(),
14
+ /** Whether its `/status` or `/health` answered. */
15
+ reachable: z.boolean(),
16
+ /** Version it reported. */
17
+ version: z.string().optional(),
18
+ });
19
+ /** Event queue progress (counts since start; timestamps ISO). */
20
+ const eventQueueHealthSchema = z.object({
21
+ /** Byte offset the processor has reached. */
22
+ offset: z.number(),
23
+ /** Queue file size in bytes. */
24
+ size: z.number(),
25
+ /** Bytes not yet processed. */
26
+ pendingBytes: z.number(),
27
+ /** Queue lines that could not be parsed. */
28
+ parseErrors: z.number(),
29
+ /** Last time the cursor was reset. */
30
+ lastCursorReset: z.string().optional(),
31
+ /** Last time the processor rewound. */
32
+ lastRewind: z.string().optional(),
33
+ });
34
+ /** The server's `health` details. */
35
+ const serverHealthSchema = z.object({
36
+ /** Listening port. */
37
+ port: z.number(),
38
+ /** Chrome (PDF and diagram rendering). */
39
+ chrome: z.object({
40
+ /** Whether a Chrome path is configured. */
41
+ configured: z.boolean(),
42
+ /** Configured Chrome path (admin callers only). */
43
+ path: z.string().optional(),
44
+ }),
45
+ /** Sign-in configuration. */
46
+ auth: z.object({
47
+ /** Enabled sign-in modes. */
48
+ modes: z.array(z.string()),
49
+ /** Configured insiders. */
50
+ insiderCount: z.number(),
51
+ /** Configured machine keys. */
52
+ keyCount: z.number(),
53
+ /** Google sign-in redirect URI (google mode with a public origin). */
54
+ googleRedirectUri: z.string().optional(),
55
+ /** OAuth provider redirect URI (when providers are configured). */
56
+ oauthRedirectUri: z.string().optional(),
57
+ }),
58
+ /** Configured webhook events. */
59
+ events: z.array(z.object({
60
+ /** Event name. */
61
+ name: z.string(),
62
+ /** Command it runs (admin callers only). */
63
+ cmd: z.string().optional(),
64
+ })),
65
+ /** Event queue progress. */
66
+ eventQueue: eventQueueHealthSchema,
67
+ /** Export capabilities. */
68
+ exports: z.object({
69
+ /** Document formats. */
70
+ documents: z.array(z.string()),
71
+ /** Directory archive formats. */
72
+ directories: z.array(z.string()),
73
+ /** Diagram formats. */
74
+ diagrams: z.array(z.string()),
75
+ /** Whether Chrome is configured. */
76
+ chromeAvailable: z.boolean(),
77
+ }),
78
+ /** Diagram rendering. */
79
+ diagrams: z.object({
80
+ /** Mermaid is available. */
81
+ mermaid: z.boolean(),
82
+ /** PlantUML renderers. */
83
+ plantuml: z.object({
84
+ /** A local PlantUML jar is configured. */
85
+ localJar: z.boolean(),
86
+ /** PlantUML servers. */
87
+ servers: z.array(z.string()),
88
+ }),
89
+ }),
90
+ /** Downstream Jeeves services (probed in the background). */
91
+ services: z.object({
92
+ /** jeeves-watcher. */
93
+ watcher: serviceProbeSchema,
94
+ /** jeeves-runner. */
95
+ runner: serviceProbeSchema,
96
+ /** jeeves-meta. */
97
+ meta: serviceProbeSchema,
98
+ /** Last probe (ISO), or null before the first. */
99
+ lastChecked: z.string().nullable(),
100
+ }),
101
+ /** Branding. */
102
+ branding: z.object({
103
+ /** Product name. */
104
+ name: z.string(),
105
+ /** Emoji. */
106
+ emoji: z.string().optional(),
107
+ /** CSS variable overrides per theme mode. */
108
+ theme: z
109
+ .object({
110
+ /** Light mode overrides. */
111
+ light: cssOverridesSchema.optional(),
112
+ /** Dark mode overrides. */
113
+ dark: cssOverridesSchema.optional(),
114
+ })
115
+ .optional(),
116
+ }),
117
+ });
118
+
119
+ export { eventQueueHealthSchema, serverHealthSchema, serviceProbeSchema };