@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
package/README.md CHANGED
@@ -1,9 +1,42 @@
1
1
  # @karmaniverous/jeeves-server-core
2
2
 
3
- Shared workspace package providing cryptographic utilities and API types consumed by `@karmaniverous/jeeves-server` (service) and `@karmaniverous/jeeves-server-openclaw` (plugin).
3
+ Shared workspace package consumed by `@karmaniverous/jeeves-server` (service) and `@karmaniverous/jeeves-server-openclaw` (plugin): the endpoint catalog with its schemas and error codes, the OpenAPI document, the config schema and the key utilities.
4
+
5
+ ## Entry points
6
+
7
+ | Import | Contents |
8
+ | --- | --- |
9
+ | `@karmaniverous/jeeves-server-core` | Everything below, including the Node-only key functions |
10
+ | `@karmaniverous/jeeves-server-core/catalog` | Browser-safe: `SERVER_CATALOG`, its schemas and types, `shareQuerySchema` and the error codes. Imports only `zod` and `@karmaniverous/jeeves/catalog` (a test walks its import graph), so the SDK and the web client can bundle it |
11
+ | `@karmaniverous/jeeves-server-core/openapi.json` | The OpenAPI 3.1 document generated from the catalog |
4
12
 
5
13
  ## Exports
6
14
 
15
+ ### Endpoint Catalog
16
+
17
+ `SERVER_CATALOG` is built with `defineCatalog` from `@karmaniverous/jeeves/catalog`: jeeves' standard `status`, `config` and `configApply` entries, then one entry per machine-API route (39 in all), grouped in `src/catalog/*Entries.ts`. Each entry names its method, path, description, request schemas (`params`, `query`, `body`), response schema, `auth` and `kind`; binary entries (`raw`, `export`, `exportMermaid`, `exportPlantUml`, `diagram`) declare a `contentType`. The entry name is the SDK method, the OpenAPI `operationId` and the plugin tool's base name (`server_` + snake_case: `browse` is `server_browse`, `linkInfo` is `server_link_info`). Browser routes (the SPA, sign-in, `/oauth/callback`, `/go/:slug`) are not in the catalog.
18
+
19
+ | Export | Description |
20
+ | --- | --- |
21
+ | `SERVER_CATALOG` | The catalog |
22
+ | `ServerEntryName`, `ServerEntry<N>`, `ServerInput<N>`, `ServerResponse<N>` | Entry names, an entry, its request input and its success response |
23
+ | `ServerHealth` / `serverHealthSchema` | The `health` block of `GET /status` (`cmd` and `chrome.path` optional: callers that aren't admin don't get them) |
24
+ | `shareQuerySchema` | The share-link parameters (`exp`, `d`, `dirs`, `s`, legacy `key`), in the query of every content and navigation entry |
25
+ | `*Schema` | Every request and response schema, e.g. `fileContentResponseSchema`, `fileMutateBodySchema`, `shareResponseSchema` |
26
+
27
+ `auth` is descriptive; the service enforces access itself. Content and navigation entries list the `k` query parameter and the `jeeves_session` cookie; insider and admin entries add `insiderOnly`; public entries are `'none'`; `pathKey` and `insiderKey` take the raw machine seed in `X-API-Key`; `receiveEvent` takes an event key as `k`.
28
+
29
+ ### Error Codes
30
+
31
+ | Export | Description |
32
+ | --- | --- |
33
+ | `SERVER_ERROR_CODES` | Every `SERVER_*` code an error body (`{ statusCode, code?, error, message }`) can carry |
34
+ | `SERVER_ERROR_STATUS` | The HTTP status each code is sent with |
35
+
36
+ ### OpenAPI Document
37
+
38
+ `openapi.json` is generated from `SERVER_CATALOG` with `buildOpenApiDocument` from `@karmaniverous/jeeves/openapi` and committed. After changing the catalog, run `npm run openapi` in `packages/core`: a test fails while the committed document differs (and checks it is valid OpenAPI 3.1). The document is also exported as `SERVER_OPENAPI_DOCUMENT`.
39
+
7
40
  ### Crypto Functions
8
41
 
9
42
  | Function | Description |
@@ -14,6 +47,8 @@ Shared workspace package providing cryptographic utilities and API types consume
14
47
  | `computeDeepShareKey(seed, path, params)` | HMAC-SHA256 key for deep directory shares with depth/dirs/stack/expiry |
15
48
  | `timingSafeEqual(a, b)` | Constant-time string comparison to prevent timing attacks |
16
49
 
50
+ `computePathKey`, `computeInsiderKey` and `computeOutsiderKeyWithExpiry` are re-exported from `@karmaniverous/jeeves`, which holds the one implementation; known-vector tests (`src/crypto.test.ts`) pin their output to what this package computed before. `computeDeepShareKey` and `timingSafeEqual` are this package's own.
51
+
17
52
  ### URL Key Parameter
18
53
 
19
54
  | Export | Description |
@@ -30,13 +65,6 @@ Shared workspace package providing cryptographic utilities and API types consume
30
65
  | `LoggingConfig` | Inferred TypeScript type from `loggingConfigSchema` |
31
66
  | `jeevesConfigSchema` | Full server config Zod schema (includes `logging`, `oauth`, `publicUrl`, `trustProxyHeaders` and all other fields; requires `publicUrl` or `trustProxyHeaders: true` when email, Google or OAuth login is configured) |
32
67
 
33
- ### Endpoint Catalog
34
-
35
- | Export | Description |
36
- | --- | --- |
37
- | `EndpointEntry` | Interface describing a single API operation (method, path, description, auth flags) |
38
- | `serverEndpoints` | Complete declarative catalog of all jeeves-server API endpoints (39 entries) |
39
-
40
68
  ### API Types
41
69
 
42
70
  | Type | Description |
@@ -59,14 +87,23 @@ Shared workspace package providing cryptographic utilities and API types consume
59
87
  import {
60
88
  computeInsiderKey,
61
89
  computePathKey,
62
- serverEndpoints,
63
- type EndpointEntry,
64
90
  type LoggingConfig,
65
91
  type ShareRequest,
66
92
  } from '@karmaniverous/jeeves-server-core';
93
+
94
+ // Browser bundles: the catalog only.
95
+ import {
96
+ SERVER_CATALOG,
97
+ type ServerResponse,
98
+ } from '@karmaniverous/jeeves-server-core/catalog';
67
99
  ```
68
100
 
69
101
  ## How Packages Consume It
70
102
 
71
- - **Service** (`packages/service`) — re-exports crypto functions from `src/util/crypto.ts` and uses API types for route handlers.
72
- - **Plugin** (`packages/openclaw`) — imports crypto functions directly for key derivation and types for tool payloads.
103
+ - **Service** (`packages/service`) — registers its routes from `SERVER_CATALOG`, validates config with `jeevesConfigSchema`, throws the `SERVER_*` errors and serves `openapi.json`; its [API Reference](../service/guides/api-reference.md) is generated from the catalog.
104
+ - **SDK** (`packages/sdk`) — builds its typed client from the browser-safe `./catalog` entry.
105
+ - **Plugin** (`packages/openclaw`) — derives its key with `computeInsiderKey` and builds its catalog tools from `SERVER_CATALOG`.
106
+
107
+ ## Upgrading from 0.4
108
+
109
+ 0.5.0 replaces the `serverEndpoints` table with `SERVER_CATALOG` (built with `defineCatalog` from `@karmaniverous/jeeves`) and adds the error codes, the OpenAPI document and the `./catalog` entry. Code that read `serverEndpoints` uses `SERVER_CATALOG`, or calls the server through `@karmaniverous/jeeves-server-sdk`. See [Migrating to 3.16](../service/guides/migrating-to-3.16.md).