@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,179 @@
1
+ /**
2
+ * Response and request schemas of the content entries (drives, browse, file content, write and mutate, link info, export cache clear, public content), describing what the service's handlers send. Pure.
3
+ *
4
+ * @remarks
5
+ * Field order follows the handlers' output: with strict response
6
+ * validation the service sends the parsed value, so a schema's key order is
7
+ * the body's key order. Fields are plain strings (no formats) because they
8
+ * carry paths, dates and names exactly as the handlers build them.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { z } from 'zod';
13
+ /** One breadcrumb of a file or directory view. */
14
+ export declare const breadcrumbSchema: z.ZodObject<{
15
+ label: z.ZodString;
16
+ path: z.ZodString;
17
+ }, z.core.$strip>;
18
+ /** One `drives` row: a configured root. */
19
+ export declare const driveSchema: z.ZodObject<{
20
+ letter: z.ZodString;
21
+ label: z.ZodString;
22
+ }, z.core.$strip>;
23
+ /** `drives` response: the roots the caller may navigate into. */
24
+ export declare const drivesResponseSchema: z.ZodArray<z.ZodObject<{
25
+ letter: z.ZodString;
26
+ label: z.ZodString;
27
+ }, z.core.$strip>>;
28
+ /** One entry of a directory listing. */
29
+ export declare const directoryEntrySchema: z.ZodObject<{
30
+ name: z.ZodString;
31
+ type: z.ZodEnum<{
32
+ file: "file";
33
+ directory: "directory";
34
+ }>;
35
+ ext: z.ZodString;
36
+ size: z.ZodNullable<z.ZodNumber>;
37
+ mtime: z.ZodNullable<z.ZodString>;
38
+ itemCount: z.ZodNullable<z.ZodNumber>;
39
+ shareUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ }, z.core.$strip>;
41
+ /** `browse` response for a file: its metadata. */
42
+ export declare const fileMetadataSchema: z.ZodObject<{
43
+ type: z.ZodLiteral<"file">;
44
+ path: z.ZodString;
45
+ ext: z.ZodString;
46
+ size: z.ZodNumber;
47
+ mtime: z.ZodString;
48
+ }, z.core.$strip>;
49
+ /** `browse` response for a directory: its listing. */
50
+ export declare const directoryListingSchema: z.ZodObject<{
51
+ path: z.ZodString;
52
+ entries: z.ZodArray<z.ZodObject<{
53
+ name: z.ZodString;
54
+ type: z.ZodEnum<{
55
+ file: "file";
56
+ directory: "directory";
57
+ }>;
58
+ ext: z.ZodString;
59
+ size: z.ZodNullable<z.ZodNumber>;
60
+ mtime: z.ZodNullable<z.ZodString>;
61
+ itemCount: z.ZodNullable<z.ZodNumber>;
62
+ shareUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ }, z.core.$strip>>;
64
+ breadcrumbs: z.ZodArray<z.ZodObject<{
65
+ label: z.ZodString;
66
+ path: z.ZodString;
67
+ }, z.core.$strip>>;
68
+ isInsider: z.ZodBoolean;
69
+ }, z.core.$strip>;
70
+ /** `browse` response: file metadata or a directory listing. */
71
+ export declare const browseResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
72
+ type: z.ZodLiteral<"file">;
73
+ path: z.ZodString;
74
+ ext: z.ZodString;
75
+ size: z.ZodNumber;
76
+ mtime: z.ZodString;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ path: z.ZodString;
79
+ entries: z.ZodArray<z.ZodObject<{
80
+ name: z.ZodString;
81
+ type: z.ZodEnum<{
82
+ file: "file";
83
+ directory: "directory";
84
+ }>;
85
+ ext: z.ZodString;
86
+ size: z.ZodNullable<z.ZodNumber>;
87
+ mtime: z.ZodNullable<z.ZodString>;
88
+ itemCount: z.ZodNullable<z.ZodNumber>;
89
+ shareUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
+ }, z.core.$strip>>;
91
+ breadcrumbs: z.ZodArray<z.ZodObject<{
92
+ label: z.ZodString;
93
+ path: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ isInsider: z.ZodBoolean;
96
+ }, z.core.$strip>]>;
97
+ /** One heading of a rendered Markdown document. */
98
+ export declare const headingSchema: z.ZodObject<{
99
+ level: z.ZodNumber;
100
+ text: z.ZodString;
101
+ slug: z.ZodString;
102
+ }, z.core.$strip>;
103
+ /**
104
+ * `fileContent` response. One shape for every file type: `type` says which
105
+ * fields are present.
106
+ */
107
+ export declare const fileContentResponseSchema: z.ZodObject<{
108
+ type: z.ZodEnum<{
109
+ plantuml: "plantuml";
110
+ text: "text";
111
+ markdown: "markdown";
112
+ mermaid: "mermaid";
113
+ svg: "svg";
114
+ csv: "csv";
115
+ image: "image";
116
+ binary: "binary";
117
+ }>;
118
+ content: z.ZodOptional<z.ZodString>;
119
+ html: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ headings: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ level: z.ZodNumber;
122
+ text: z.ZodString;
123
+ slug: z.ZodString;
124
+ }, z.core.$strip>>>;
125
+ size: z.ZodOptional<z.ZodNumber>;
126
+ fileName: z.ZodString;
127
+ breadcrumbs: z.ZodArray<z.ZodObject<{
128
+ label: z.ZodString;
129
+ path: z.ZodString;
130
+ }, z.core.$strip>>;
131
+ isInsider: z.ZodBoolean;
132
+ mtime: z.ZodOptional<z.ZodNumber>;
133
+ renderAs: z.ZodOptional<z.ZodString>;
134
+ matchedRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ title: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strip>;
137
+ /** `fileContent` query, beside the share parameters. */
138
+ export declare const fileContentQuerySchema: z.ZodObject<{
139
+ raw: z.ZodOptional<z.ZodString>;
140
+ render_diagrams: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strip>;
142
+ /** `fileWrite` body. */
143
+ export declare const fileWriteBodySchema: z.ZodObject<{
144
+ content: z.ZodString;
145
+ }, z.core.$strip>;
146
+ /** `fileWrite` response. */
147
+ export declare const fileWriteResponseSchema: z.ZodObject<{
148
+ ok: z.ZodLiteral<true>;
149
+ path: z.ZodString;
150
+ size: z.ZodNumber;
151
+ }, z.core.$strip>;
152
+ /** `{ ok: true }`. */
153
+ export declare const okResponseSchema: z.ZodObject<{
154
+ ok: z.ZodLiteral<true>;
155
+ }, z.core.$strip>;
156
+ /** One available export of a path. */
157
+ export declare const exportLinkSchema: z.ZodObject<{
158
+ format: z.ZodString;
159
+ url: z.ZodString;
160
+ }, z.core.$strip>;
161
+ /** `linkInfo` response; only `exists` when the path doesn't exist. */
162
+ export declare const linkInfoResponseSchema: z.ZodObject<{
163
+ exists: z.ZodBoolean;
164
+ isDirectory: z.ZodOptional<z.ZodBoolean>;
165
+ pageUrl: z.ZodOptional<z.ZodString>;
166
+ rawUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ downloadUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
168
+ exportLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{
169
+ format: z.ZodString;
170
+ url: z.ZodString;
171
+ }, z.core.$strip>>>;
172
+ }, z.core.$strip>;
173
+ /** `exportCacheClear` response. */
174
+ export declare const exportCacheClearResponseSchema: z.ZodObject<{
175
+ cleared: z.ZodObject<{
176
+ exports: z.ZodNumber;
177
+ diagrams: z.ZodNumber;
178
+ }, z.core.$strip>;
179
+ }, z.core.$strip>;
@@ -0,0 +1,195 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Response and request schemas of the content entries (drives, browse, file content, write and mutate, link info, export cache clear, public content), describing what the service's handlers send. Pure.
5
+ *
6
+ * @remarks
7
+ * Field order follows the handlers' output: with strict response
8
+ * validation the service sends the parsed value, so a schema's key order is
9
+ * the body's key order. Fields are plain strings (no formats) because they
10
+ * carry paths, dates and names exactly as the handlers build them.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ /** One breadcrumb of a file or directory view. */
15
+ const breadcrumbSchema = z.object({
16
+ /** Display label (a root's label or a path segment). */
17
+ label: z.string(),
18
+ /** Browse path of the crumb. */
19
+ path: z.string(),
20
+ });
21
+ /** One `drives` row: a configured root. */
22
+ const driveSchema = z.object({
23
+ /** Root id, the first segment of every browse path below it. */
24
+ letter: z.string(),
25
+ /** Root label (its filesystem path, or the configured label). */
26
+ label: z.string(),
27
+ });
28
+ /** `drives` response: the roots the caller may navigate into. */
29
+ const drivesResponseSchema = z.array(driveSchema);
30
+ /** One entry of a directory listing. */
31
+ const directoryEntrySchema = z.object({
32
+ /** File or directory name. */
33
+ name: z.string(),
34
+ /** Entry type. */
35
+ type: z.enum(['directory', 'file']),
36
+ /** Lowercase extension with its dot, or empty. */
37
+ ext: z.string(),
38
+ /** File size in bytes; null for directories. */
39
+ size: z.number().nullable(),
40
+ /** Modification date (`YYYY-MM-DD`), or null when unreadable. */
41
+ mtime: z.string().nullable(),
42
+ /** Number of children of a directory; null for files. */
43
+ itemCount: z.number().nullable(),
44
+ /**
45
+ * Deep-share listings only: the entry's own share URL, or null when it
46
+ * may not be opened.
47
+ */
48
+ shareUrl: z.string().nullable().optional(),
49
+ });
50
+ /** `browse` response for a file: its metadata. */
51
+ const fileMetadataSchema = z.object({
52
+ /** Always `file`. */
53
+ type: z.literal('file'),
54
+ /** The browse path asked for. */
55
+ path: z.string(),
56
+ /** Lowercase extension with its dot, or empty. */
57
+ ext: z.string(),
58
+ /** Size in bytes. */
59
+ size: z.number(),
60
+ /** Modification date (`YYYY-MM-DD`). */
61
+ mtime: z.string(),
62
+ });
63
+ /** `browse` response for a directory: its listing. */
64
+ const directoryListingSchema = z.object({
65
+ /** The browse path asked for. */
66
+ path: z.string(),
67
+ /** Entries the caller may see, directories first. */
68
+ entries: z.array(directoryEntrySchema),
69
+ /** Breadcrumbs (outsiders see only those inside their share). */
70
+ breadcrumbs: z.array(breadcrumbSchema),
71
+ /** Whether the caller is an insider. */
72
+ isInsider: z.boolean(),
73
+ });
74
+ /** `browse` response: file metadata or a directory listing. */
75
+ const browseResponseSchema = z.union([
76
+ fileMetadataSchema,
77
+ directoryListingSchema,
78
+ ]);
79
+ /** One heading of a rendered Markdown document. */
80
+ const headingSchema = z.object({
81
+ /** Heading level (1-6). */
82
+ level: z.number(),
83
+ /** Heading text. */
84
+ text: z.string(),
85
+ /** Anchor slug. */
86
+ slug: z.string(),
87
+ });
88
+ /**
89
+ * `fileContent` response. One shape for every file type: `type` says which
90
+ * fields are present.
91
+ */
92
+ const fileContentResponseSchema = z.object({
93
+ /** How the file is shown. */
94
+ type: z.enum([
95
+ 'markdown',
96
+ 'mermaid',
97
+ 'plantuml',
98
+ 'svg',
99
+ 'csv',
100
+ 'text',
101
+ 'image',
102
+ 'binary',
103
+ ]),
104
+ /** File text (Markdown, diagram, SVG, CSV and text files). */
105
+ content: z.string().optional(),
106
+ /** Rendered HTML; null when a diagram could not be rendered. */
107
+ html: z.string().nullable().optional(),
108
+ /** Heading outline of rendered Markdown. */
109
+ headings: z.array(headingSchema).optional(),
110
+ /** Size in bytes (binary files). */
111
+ size: z.number().optional(),
112
+ /** File name. */
113
+ fileName: z.string(),
114
+ /** Breadcrumbs (outsiders see only those inside their share). */
115
+ breadcrumbs: z.array(breadcrumbSchema),
116
+ /** Whether the caller is an insider. */
117
+ isInsider: z.boolean(),
118
+ /** Modification time (Unix ms) of rendered Markdown. */
119
+ mtime: z.number().optional(),
120
+ /** Format jeeves-watcher rendered the file as (watcher-rendered files). */
121
+ renderAs: z.string().optional(),
122
+ /** Watcher rules that matched (watcher-rendered files). */
123
+ matchedRules: z.array(z.string()).optional(),
124
+ /**
125
+ * Document title (#262): a Markdown document's front matter `title`, else
126
+ * the file name. `fileContent` always sends it; `publicContent` doesn't.
127
+ */
128
+ title: z.string().optional(),
129
+ });
130
+ /** `fileContent` query, beside the share parameters. */
131
+ const fileContentQuerySchema = z.object({
132
+ /** `1`: send the file text without rendering it. */
133
+ raw: z
134
+ .string()
135
+ .optional()
136
+ .describe('1: return the source without rendering it.'),
137
+ /** `1`: render embedded diagrams into the HTML. */
138
+ render_diagrams: z
139
+ .string()
140
+ .optional()
141
+ .describe('1: render embedded diagrams into the HTML.'),
142
+ });
143
+ /** `fileWrite` body. */
144
+ const fileWriteBodySchema = z.object({
145
+ /** New file content. */
146
+ content: z.string().describe('New file content'),
147
+ });
148
+ /** `fileWrite` response. */
149
+ const fileWriteResponseSchema = z.object({
150
+ /** Always true. */
151
+ ok: z.literal(true),
152
+ /** Filesystem path written. */
153
+ path: z.string(),
154
+ /** Bytes written (UTF-8). */
155
+ size: z.number(),
156
+ });
157
+ /** `{ ok: true }`. */
158
+ const okResponseSchema = z.object({
159
+ /** Always true. */
160
+ ok: z.literal(true),
161
+ });
162
+ /** One available export of a path. */
163
+ const exportLinkSchema = z.object({
164
+ /** Export format (`pdf`, `docx`, `zip`, `svg`, ...). */
165
+ format: z.string(),
166
+ /** Export URL (server-relative). */
167
+ url: z.string(),
168
+ });
169
+ /** `linkInfo` response; only `exists` when the path doesn't exist. */
170
+ const linkInfoResponseSchema = z.object({
171
+ /** Whether the path exists. */
172
+ exists: z.boolean(),
173
+ /** Whether it is a directory. */
174
+ isDirectory: z.boolean().optional(),
175
+ /** Page URL (server-relative). */
176
+ pageUrl: z.string().optional(),
177
+ /** Raw file URL (server-relative); null for directories. */
178
+ rawUrl: z.string().nullable().optional(),
179
+ /** Raw URL that always downloads (`?download=1`); null for directories. */
180
+ downloadUrl: z.string().nullable().optional(),
181
+ /** Available exports. */
182
+ exportLinks: z.array(exportLinkSchema).optional(),
183
+ });
184
+ /** `exportCacheClear` response. */
185
+ const exportCacheClearResponseSchema = z.object({
186
+ /** Entries removed. */
187
+ cleared: z.object({
188
+ /** Cached PDF/DOCX exports removed. */
189
+ exports: z.number(),
190
+ /** Cached diagram renders removed. */
191
+ diagrams: z.number(),
192
+ }),
193
+ });
194
+
195
+ export { breadcrumbSchema, browseResponseSchema, directoryEntrySchema, directoryListingSchema, driveSchema, drivesResponseSchema, exportCacheClearResponseSchema, exportLinkSchema, fileContentQuerySchema, fileContentResponseSchema, fileMetadataSchema, fileWriteBodySchema, fileWriteResponseSchema, headingSchema, linkInfoResponseSchema, okResponseSchema };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Descriptions of jeeves-server's own (non-standard) catalog entries, keyed by entry name: one wording for OpenAPI, the SDK and the plugin's tools. Pure data.
3
+ *
4
+ * @remarks
5
+ * The entries behind today's plugin tools (`browse`, `linkInfo`,
6
+ * `fileWrite`, `fileMutate`, `exportCacheClear`, `drives`, `authStatus`,
7
+ * `resolvePath`) keep the tools' descriptions, so the tools read the same
8
+ * once they are built from the catalog.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ /** Description of each entry, keyed by entry name. */
13
+ export declare const ENTRY_DESCRIPTIONS: {
14
+ readonly health: "Liveness check: returns { ok: true }, with no downstream checks.";
15
+ readonly authStatus: "Check current authentication status. Returns whether authenticated, email, insider status, and key metadata.";
16
+ readonly sendMagicLink: "Request a sign-in link by email. Always answers with a verification URL, whether or not the email belongs to an insider.";
17
+ readonly drives: "List available root drives/labels configured on the server.";
18
+ readonly browse: "Get file or directory metadata. For files: size, mtime, content type, rendered HTML availability. For directories: listing of entries.";
19
+ readonly fileContent: "Get a file with type-specific handling: Markdown, CSV and diagrams rendered to HTML, other text as is, images and binaries by name. `raw=1` skips rendering.";
20
+ readonly fileWrite: "Overwrite the content of an existing file. Insider-only; the file must already exist.";
21
+ readonly fileMutate: "Apply a structured mutation to a .md file. Insider-only. Supports: edit-block, delete-block, insert-block, edit-cell, toggle-checkbox.";
22
+ readonly raw: "Download a file as is, with its own content type. `download=1` always sends it as an attachment.";
23
+ readonly export: "Export a Markdown document as PDF or DOCX, or a directory as a ZIP or Tar archive (archives for insiders only).";
24
+ readonly exportCacheClear: "Clear the export and diagram caches for a given path.";
25
+ readonly exportMermaid: "Export a Mermaid diagram file as SVG, PNG or PDF.";
26
+ readonly exportPlantUml: "Export a PlantUML diagram file in one of the formats the configured renderers support (SVG, PNG, PDF, EPS).";
27
+ readonly linkInfo: "Query available link types for a path (exists, page URL, raw URL, export links for PDF/DOCX/SVG/PNG).";
28
+ readonly diagram: "Get a diagram embedded in a rendered document, as SVG, by its type and content hash.";
29
+ readonly publicContent: "Get one of the public pages of the server (readme, privacy, terms) rendered as Markdown.";
30
+ readonly share: "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.";
31
+ readonly shareFor: "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.";
32
+ readonly contentLink: "Pre-computed share link for one of the pinned content pages of the server (privacy, terms).";
33
+ readonly readmeLink: "Pre-computed share link for the README of the server.";
34
+ readonly resolvePath: "Convert an absolute filesystem path to a server browse path and optional public URL.";
35
+ readonly rotateKey: "Rotate the key of the calling insider. The old insider key and every outsider link the insider signed stop working.";
36
+ readonly pathKey: "Compute the outsider path key for a path from the machine seed sent in X-API-Key.";
37
+ readonly insiderKey: "Compute the insider key for the machine seed sent in X-API-Key.";
38
+ readonly search: "Semantic search through jeeves-watcher, grouped by file and filtered to the scopes of the caller.";
39
+ readonly searchFacets: "Search facets from jeeves-watcher, passed through unchanged.";
40
+ readonly receiveEvent: "Event gateway webhook receiver: matches a JSON object against the configured event schemas and queues the matching command.";
41
+ readonly listEvents: "Recent event log entries, newest last (insiders with no scopes configured; limit capped at 100).";
42
+ readonly oauthStart: "Start an OAuth2 authorization code flow; returns the URL to open in a browser.";
43
+ readonly oauthStatus: "Check whether valid OAuth2 credentials exist for a provider/account.";
44
+ readonly oauthToken: "Get a valid access token for a provider/account, refreshing it when expired.";
45
+ readonly runnerListJobs: "List the jeeves-runner jobs (runner GET /jobs).";
46
+ readonly runnerGetJob: "One jeeves-runner job (runner GET /jobs/:id).";
47
+ readonly runnerListRuns: "A jeeves-runner job's recent runs (runner GET /jobs/:id/runs).";
48
+ readonly runnerRunJob: "Run a jeeves-runner job now (runner POST /jobs/:id/run).";
49
+ readonly runnerEnableJob: "Enable a jeeves-runner job (runner PATCH /jobs/:id/enable).";
50
+ readonly runnerDisableJob: "Disable a jeeves-runner job (runner PATCH /jobs/:id/disable).";
51
+ readonly runnerStatus: "jeeves-runner status (runner GET /status).";
52
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Descriptions of jeeves-server's own (non-standard) catalog entries, keyed by entry name: one wording for OpenAPI, the SDK and the plugin's tools. Pure data.
3
+ *
4
+ * @remarks
5
+ * The entries behind today's plugin tools (`browse`, `linkInfo`,
6
+ * `fileWrite`, `fileMutate`, `exportCacheClear`, `drives`, `authStatus`,
7
+ * `resolvePath`) keep the tools' descriptions, so the tools read the same
8
+ * once they are built from the catalog.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ /** Description of each entry, keyed by entry name. */
13
+ const ENTRY_DESCRIPTIONS = {
14
+ health: 'Liveness check: returns { ok: true }, with no downstream checks.',
15
+ authStatus: 'Check current authentication status. Returns whether authenticated, email, insider status, and key metadata.',
16
+ sendMagicLink: 'Request a sign-in link by email. Always answers with a verification URL, whether or not the email belongs to an insider.',
17
+ drives: 'List available root drives/labels configured on the server.',
18
+ browse: 'Get file or directory metadata. For files: size, mtime, content type, rendered HTML availability. For directories: listing of entries.',
19
+ fileContent: 'Get a file with type-specific handling: Markdown, CSV and diagrams rendered to HTML, other text as is, images and binaries by name. `raw=1` skips rendering.',
20
+ fileWrite: 'Overwrite the content of an existing file. Insider-only; the file must already exist.',
21
+ fileMutate: 'Apply a structured mutation to a .md file. Insider-only. Supports: edit-block, delete-block, insert-block, edit-cell, toggle-checkbox.',
22
+ raw: 'Download a file as is, with its own content type. `download=1` always sends it as an attachment.',
23
+ export: 'Export a Markdown document as PDF or DOCX, or a directory as a ZIP or Tar archive (archives for insiders only).',
24
+ exportCacheClear: 'Clear the export and diagram caches for a given path.',
25
+ exportMermaid: 'Export a Mermaid diagram file as SVG, PNG or PDF.',
26
+ exportPlantUml: 'Export a PlantUML diagram file in one of the formats the configured renderers support (SVG, PNG, PDF, EPS).',
27
+ linkInfo: 'Query available link types for a path (exists, page URL, raw URL, export links for PDF/DOCX/SVG/PNG).',
28
+ diagram: 'Get a diagram embedded in a rendered document, as SVG, by its type and content hash.',
29
+ publicContent: 'Get one of the public pages of the server (readme, privacy, terms) rendered as Markdown.',
30
+ share: '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.',
31
+ shareFor: '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.',
32
+ contentLink: 'Pre-computed share link for one of the pinned content pages of the server (privacy, terms).',
33
+ readmeLink: 'Pre-computed share link for the README of the server.',
34
+ resolvePath: 'Convert an absolute filesystem path to a server browse path and optional public URL.',
35
+ rotateKey: 'Rotate the key of the calling insider. The old insider key and every outsider link the insider signed stop working.',
36
+ pathKey: 'Compute the outsider path key for a path from the machine seed sent in X-API-Key.',
37
+ insiderKey: 'Compute the insider key for the machine seed sent in X-API-Key.',
38
+ search: 'Semantic search through jeeves-watcher, grouped by file and filtered to the scopes of the caller.',
39
+ searchFacets: 'Search facets from jeeves-watcher, passed through unchanged.',
40
+ receiveEvent: 'Event gateway webhook receiver: matches a JSON object against the configured event schemas and queues the matching command.',
41
+ listEvents: 'Recent event log entries, newest last (insiders with no scopes configured; limit capped at 100).',
42
+ oauthStart: 'Start an OAuth2 authorization code flow; returns the URL to open in a browser.',
43
+ oauthStatus: 'Check whether valid OAuth2 credentials exist for a provider/account.',
44
+ oauthToken: 'Get a valid access token for a provider/account, refreshing it when expired.',
45
+ runnerListJobs: 'List the jeeves-runner jobs (runner GET /jobs).',
46
+ runnerGetJob: 'One jeeves-runner job (runner GET /jobs/:id).',
47
+ runnerListRuns: "A jeeves-runner job's recent runs (runner GET /jobs/:id/runs).",
48
+ runnerRunJob: 'Run a jeeves-runner job now (runner POST /jobs/:id/run).',
49
+ runnerEnableJob: 'Enable a jeeves-runner job (runner PATCH /jobs/:id/enable).',
50
+ runnerDisableJob: 'Disable a jeeves-runner job (runner PATCH /jobs/:id/disable).',
51
+ runnerStatus: 'jeeves-runner status (runner GET /status).',
52
+ };
53
+
54
+ export { ENTRY_DESCRIPTIONS };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The event entries of the server catalog: the webhook receiver (`receiveEvent`, any JSON object; Decision 14) and the event log (`listEvents`). Pure.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { z } from 'zod';
7
+ /** `receiveEvent` response. */
8
+ export declare const receiveEventResponseSchema: z.ZodObject<{
9
+ matched: z.ZodNullable<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ /** One event log entry. Entries written by other versions keep their fields. */
12
+ export declare const eventLogEntrySchema: z.ZodObject<{
13
+ ts: z.ZodString;
14
+ event: z.ZodNullable<z.ZodString>;
15
+ matched: z.ZodBoolean;
16
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
17
+ timedOut: z.ZodOptional<z.ZodBoolean>;
18
+ durationMs: z.ZodOptional<z.ZodNumber>;
19
+ bodyPreview: z.ZodOptional<z.ZodString>;
20
+ truncated: z.ZodOptional<z.ZodBoolean>;
21
+ originalBytes: z.ZodOptional<z.ZodNumber>;
22
+ }, z.core.$loose>;
23
+ /** The event entries. */
24
+ export declare const EVENT_ENTRIES: readonly [{
25
+ readonly body: z.ZodObject<{}, z.core.$loose>;
26
+ readonly response: z.ZodObject<{
27
+ matched: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ readonly auth: {
30
+ readonly schemes: readonly [{
31
+ readonly in: "query";
32
+ readonly name: "k";
33
+ }];
34
+ };
35
+ readonly kind: "write";
36
+ readonly name: "receiveEvent";
37
+ readonly method: "POST";
38
+ readonly path: "/event";
39
+ readonly description: "Event gateway webhook receiver: matches a JSON object against the configured event schemas and queues the matching command.";
40
+ }, {
41
+ readonly query: z.ZodObject<{
42
+ limit: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ readonly response: z.ZodArray<z.ZodObject<{
45
+ ts: z.ZodString;
46
+ event: z.ZodNullable<z.ZodString>;
47
+ matched: z.ZodBoolean;
48
+ exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
49
+ timedOut: z.ZodOptional<z.ZodBoolean>;
50
+ durationMs: z.ZodOptional<z.ZodNumber>;
51
+ bodyPreview: z.ZodOptional<z.ZodString>;
52
+ truncated: z.ZodOptional<z.ZodBoolean>;
53
+ originalBytes: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$loose>>;
55
+ readonly auth: {
56
+ readonly schemes: readonly [{
57
+ readonly in: "query";
58
+ readonly name: "k";
59
+ }, {
60
+ readonly in: "cookie";
61
+ readonly name: "jeeves_session";
62
+ }];
63
+ readonly insiderOnly: true;
64
+ };
65
+ readonly kind: "read";
66
+ readonly name: "listEvents";
67
+ readonly method: "GET";
68
+ readonly path: "/api/events";
69
+ readonly description: "Recent event log entries, newest last (insiders with no scopes configured; limit capped at 100).";
70
+ }];
@@ -0,0 +1,59 @@
1
+ import { z } from 'zod';
2
+ import { EVENT_KEY, INSIDER_ONLY, route } from './route.js';
3
+
4
+ /**
5
+ * The event entries of the server catalog: the webhook receiver (`receiveEvent`, any JSON object; Decision 14) and the event log (`listEvents`). Pure.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /** `receiveEvent` response. */
10
+ const receiveEventResponseSchema = z.object({
11
+ /** Name of the event that matched, or null (the body is logged). */
12
+ matched: z.string().nullable(),
13
+ });
14
+ /** One event log entry. Entries written by other versions keep their fields. */
15
+ const eventLogEntrySchema = z.looseObject({
16
+ /** When it was logged (ISO). */
17
+ ts: z.string(),
18
+ /** Matched event name, or null for an unmatched body. */
19
+ event: z.string().nullable(),
20
+ /** Whether the body matched an event. */
21
+ matched: z.boolean(),
22
+ /** Exit code of the event command; null when it was killed by a signal. */
23
+ exitCode: z.number().nullable().optional(),
24
+ /** True when the command timed out (it and its process tree were killed). */
25
+ timedOut: z.boolean().optional(),
26
+ /** Command duration. */
27
+ durationMs: z.number().optional(),
28
+ /** Unmatched body as JSON, capped at 256 KiB. */
29
+ bodyPreview: z.string().optional(),
30
+ /** True when `bodyPreview` was cut at the cap. */
31
+ truncated: z.boolean().optional(),
32
+ /** UTF-8 byte length of the full body, when truncated. */
33
+ originalBytes: z.number().optional(),
34
+ });
35
+ /** The event entries. */
36
+ const EVENT_ENTRIES = [
37
+ {
38
+ ...route('receiveEvent', 'POST', '/event'),
39
+ body: z.looseObject({}),
40
+ response: receiveEventResponseSchema,
41
+ auth: EVENT_KEY,
42
+ kind: 'write',
43
+ },
44
+ {
45
+ ...route('listEvents', 'GET', '/api/events'),
46
+ query: z.object({
47
+ // A string, as today: a value that isn't a number gives the default.
48
+ limit: z
49
+ .string()
50
+ .optional()
51
+ .describe('Entries to return (default 20, at most 100).'),
52
+ }),
53
+ response: z.array(eventLogEntrySchema),
54
+ auth: INSIDER_ONLY,
55
+ kind: 'read',
56
+ },
57
+ ];
58
+
59
+ export { EVENT_ENTRIES, eventLogEntrySchema, receiveEventResponseSchema };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The `fileMutate` request body: one object with an `action` enum and the union of the actions' fields, each action's required fields checked by a refinement (catalog bodies must be Zod objects). Pure.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import { z } from 'zod';
7
+ /** The mutation actions. */
8
+ export declare const FILE_MUTATION_ACTIONS: readonly ["edit-block", "delete-block", "insert-block", "edit-cell", "toggle-checkbox"];
9
+ /** Fields each action requires. */
10
+ export declare const FILE_MUTATION_REQUIRED_FIELDS: {
11
+ readonly 'edit-block': readonly ["startLine", "endLine", "content"];
12
+ readonly 'delete-block': readonly ["startLine", "endLine"];
13
+ readonly 'insert-block': readonly ["atLine", "position", "content"];
14
+ readonly 'edit-cell': readonly ["line", "col", "content"];
15
+ readonly 'toggle-checkbox': readonly ["index", "checked"];
16
+ };
17
+ /** `fileMutate` body. */
18
+ export declare const fileMutateBodySchema: z.ZodObject<{
19
+ action: z.ZodEnum<{
20
+ "edit-block": "edit-block";
21
+ "delete-block": "delete-block";
22
+ "insert-block": "insert-block";
23
+ "edit-cell": "edit-cell";
24
+ "toggle-checkbox": "toggle-checkbox";
25
+ }>;
26
+ startLine: z.ZodOptional<z.ZodNumber>;
27
+ endLine: z.ZodOptional<z.ZodNumber>;
28
+ content: z.ZodOptional<z.ZodString>;
29
+ atLine: z.ZodOptional<z.ZodNumber>;
30
+ position: z.ZodOptional<z.ZodEnum<{
31
+ before: "before";
32
+ after: "after";
33
+ }>>;
34
+ context: z.ZodOptional<z.ZodString>;
35
+ line: z.ZodOptional<z.ZodNumber>;
36
+ col: z.ZodOptional<z.ZodNumber>;
37
+ index: z.ZodOptional<z.ZodNumber>;
38
+ checked: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strip>;
40
+ /** A parsed `fileMutate` body. */
41
+ export type FileMutateBody = z.infer<typeof fileMutateBodySchema>;