dominus-sdk-nodejs 11.0.2 → 11.0.5

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 (66) hide show
  1. package/README.md +351 -371
  2. package/dist/contract/index.d.ts +3 -0
  3. package/dist/contract/index.d.ts.map +1 -0
  4. package/dist/contract/index.js +3 -0
  5. package/dist/contract/index.js.map +1 -0
  6. package/dist/contract/node-envelope.d.ts +12 -0
  7. package/dist/contract/node-envelope.d.ts.map +1 -0
  8. package/dist/contract/node-envelope.js +16 -0
  9. package/dist/contract/node-envelope.js.map +1 -0
  10. package/dist/contract/node-projections.d.ts +15 -0
  11. package/dist/contract/node-projections.d.ts.map +1 -0
  12. package/dist/contract/node-projections.js +4 -0
  13. package/dist/contract/node-projections.js.map +1 -0
  14. package/dist/lib/config.d.ts +3 -2
  15. package/dist/lib/config.d.ts.map +1 -1
  16. package/dist/lib/config.js +4 -3
  17. package/dist/lib/config.js.map +1 -1
  18. package/dist/lib/errors.d.ts +7 -0
  19. package/dist/lib/errors.d.ts.map +1 -1
  20. package/dist/lib/errors.js +53 -0
  21. package/dist/lib/errors.js.map +1 -1
  22. package/dist/lib/recovery-action.d.ts +4 -0
  23. package/dist/lib/recovery-action.d.ts.map +1 -0
  24. package/dist/lib/recovery-action.js +29 -0
  25. package/dist/lib/recovery-action.js.map +1 -0
  26. package/dist/namespaces/portal.d.ts +10 -0
  27. package/dist/namespaces/portal.d.ts.map +1 -1
  28. package/dist/namespaces/portal.js +11 -0
  29. package/dist/namespaces/portal.js.map +1 -1
  30. package/dist/namespaces/secrets.d.ts +5 -1
  31. package/dist/namespaces/secrets.d.ts.map +1 -1
  32. package/dist/namespaces/secrets.js +15 -1
  33. package/dist/namespaces/secrets.js.map +1 -1
  34. package/docs/agent-guide/2026-06-27-0849-sdk-orient/00-reading-order.md +35 -35
  35. package/docs/agent-guide/2026-06-27-0849-sdk-orient/01-purpose-and-boundaries.md +48 -48
  36. package/docs/agent-guide/2026-06-27-0849-sdk-orient/02-repo-map-and-entrypoints.md +46 -46
  37. package/docs/agent-guide/2026-06-27-0849-sdk-orient/03-api-surface.md +59 -59
  38. package/docs/agent-guide/2026-06-27-0849-sdk-orient/04-data-state-and-storage.md +36 -36
  39. package/docs/agent-guide/2026-06-27-0849-sdk-orient/05-integrations-and-runtime.md +40 -40
  40. package/docs/agent-guide/2026-06-27-0849-sdk-orient/06-workflows-commands-and-ci.md +58 -58
  41. package/docs/agent-guide/2026-06-27-0849-sdk-orient/07-operations-release-and-live-proof.md +40 -40
  42. package/docs/agent-guide/2026-06-27-0849-sdk-orient/08-security-privacy-and-secrets.md +38 -38
  43. package/docs/agent-guide/2026-06-27-0849-sdk-orient/09-known-risks-and-debt.md +34 -34
  44. package/docs/agent-guide/2026-06-27-0849-sdk-orient/10-agent-playbook.md +48 -48
  45. package/docs/agent-guide/2026-08-04-sdk-nodejs/00-reading-order.md +11 -11
  46. package/docs/agent-guide/2026-08-04-sdk-nodejs/01-purpose-and-boundaries.md +14 -14
  47. package/docs/agent-guide/2026-08-04-sdk-nodejs/03-api-surface.md +16 -16
  48. package/docs/agent-guide/2026-08-04-sdk-nodejs/10-agent-playbook.md +14 -14
  49. package/docs/agent-guide/INDEX.md +14 -14
  50. package/docs/agent-guide/current.md +22 -22
  51. package/docs/architecture.md +119 -119
  52. package/docs/atlas/2026-07-24-1231-sdk-nodejs-blockers.md +15 -15
  53. package/docs/atlas/2026-07-24-1231-sdk-nodejs-proof-ladder.md +25 -25
  54. package/docs/atlas/2026-07-24-1231-sdk-nodejs-truthmap.md +43 -43
  55. package/docs/atlas/2026-08-04-sdk-nodejs-blockers.md +12 -12
  56. package/docs/atlas/2026-08-04-sdk-nodejs-proof-ladder.md +9 -9
  57. package/docs/atlas/2026-08-04-sdk-nodejs-truthmap.md +21 -21
  58. package/docs/atlas/INDEX.md +26 -26
  59. package/docs/janitor/2026-06-27-0849-sdk-orient-cleanup-audit.md +102 -102
  60. package/docs/janitor/2026-08-04-sdk-nodejs-cleanup-audit.md +14 -14
  61. package/docs/migration-error-base.md +115 -0
  62. package/docs/plans/2026-08-04-pending-work-fruition-summary.md +46 -46
  63. package/docs/routes-services.md +80 -80
  64. package/docs/usage-reference.md +698 -698
  65. package/docs/workflow-hard-cut-release.md +24 -24
  66. package/package.json +55 -55
@@ -1,35 +1,35 @@
1
- # 00 Reading Order
2
-
3
- Snapshot: 2026-06-27-0849-sdk-orient. Source-backed at SDK v6.6.0, branch
4
- `production`. Code is authority; this guide is a map.
5
-
6
- ## Read These First (docs)
7
-
8
- 1. This pack, in INDEX order.
9
- 2. `docs/architecture.md` — request lifecycle, layering, Two-Layer Storage Rule.
10
- 3. `docs/routes-services.md` — service/endpoint matrix and route-prefix mapping.
11
- 4. `docs/usage-reference.md` — exhaustive per-command reference (large; grep it,
12
- do not read top-to-bottom).
13
- 5. `CLAUDE.md` — repo conventions and the public-API change checklist.
14
-
15
- ## Open Source Only For Specific Tasks
16
-
17
- - Changing a namespace command → the one file in `src/namespaces/<name>.ts`.
18
- - Transport / auth / retries / streaming / binary → `src/lib/client.ts`.
19
- - New public type or root shortcut → `src/index.ts`.
20
- - Env / gateway resolution → `src/lib/config.ts`.
21
- - Error classification → `src/lib/errors.ts`.
22
-
23
- ## Stale / Dangerous
24
-
25
- - `docs/architecture.md` §10 and `CLAUDE.md` Validation note previously said "no
26
- committed automated tests". STALE — `tests/` has 24 files run by `npm test`.
27
- Corrected in this pass; if you see the old claim re-appear, fix it.
28
- - `dist/` is generated build output (gitignored). Never use it for design
29
- decisions or treat it as source.
30
-
31
- ## Related Surfaces
32
-
33
- - Janitor cleanup audit:
34
- `docs/janitor/2026-06-27-0849-sdk-orient-cleanup-audit.md`.
35
- - No `docs/atlas/` exists yet; run `kyle-atlas` if truth scatters.
1
+ # 00 Reading Order
2
+
3
+ Snapshot: 2026-06-27-0849-sdk-orient. Source-backed at SDK v6.6.0, branch
4
+ `production`. Code is authority; this guide is a map.
5
+
6
+ ## Read These First (docs)
7
+
8
+ 1. This pack, in INDEX order.
9
+ 2. `docs/architecture.md` — request lifecycle, layering, Two-Layer Storage Rule.
10
+ 3. `docs/routes-services.md` — service/endpoint matrix and route-prefix mapping.
11
+ 4. `docs/usage-reference.md` — exhaustive per-command reference (large; grep it,
12
+ do not read top-to-bottom).
13
+ 5. `CLAUDE.md` — repo conventions and the public-API change checklist.
14
+
15
+ ## Open Source Only For Specific Tasks
16
+
17
+ - Changing a namespace command → the one file in `src/namespaces/<name>.ts`.
18
+ - Transport / auth / retries / streaming / binary → `src/lib/client.ts`.
19
+ - New public type or root shortcut → `src/index.ts`.
20
+ - Env / gateway resolution → `src/lib/config.ts`.
21
+ - Error classification → `src/lib/errors.ts`.
22
+
23
+ ## Stale / Dangerous
24
+
25
+ - `docs/architecture.md` §10 and `CLAUDE.md` Validation note previously said "no
26
+ committed automated tests". STALE — `tests/` has 24 files run by `npm test`.
27
+ Corrected in this pass; if you see the old claim re-appear, fix it.
28
+ - `dist/` is generated build output (gitignored). Never use it for design
29
+ decisions or treat it as source.
30
+
31
+ ## Related Surfaces
32
+
33
+ - Janitor cleanup audit:
34
+ `docs/janitor/2026-06-27-0849-sdk-orient-cleanup-audit.md`.
35
+ - No `docs/atlas/` exists yet; run `kyle-atlas` if truth scatters.
@@ -1,48 +1,48 @@
1
- # 01 Purpose And Boundaries
2
-
3
- ## Purpose
4
-
5
- `dominus-sdk-nodejs` is the TypeScript/ESM client SDK for the Dominus
6
- gateway-first platform (`package.json` `description`). It exposes a singleton
7
- `dominus` (`src/index.ts`) with namespace-based APIs for auth, data, storage,
8
- AI/runtime, workflow execution, jobs, and platform administration. Application
9
- code uses this SDK rather than calling gateway routes directly.
10
-
11
- ## What This Repo Owns
12
-
13
- - The public client surface: namespaces (`src/namespaces/*.ts`), root shortcuts,
14
- and exported types/utilities (`src/index.ts`).
15
- - The request/transport contract: base64 wire protocol, JWT mint+cache, retries,
16
- circuit breaker, SSE streaming, binary upload/download (`src/lib/client.ts`).
17
- - Ergonomic parameter normalization and the mapping from SDK calls to `/api/*`
18
- routes that the gateway transforms to `/svc/*`.
19
-
20
- ## What It Does Not Own
21
-
22
- - Backend behavior or route definitions — those live in the individual Dominus
23
- workers (gateway, guardian, authority, workflow-manager, agent-runtime, etc.).
24
- This SDK only describes how to call them.
25
- - Kernel contracts (identity families, error envelope, deployment lanes). It
26
- must conform to them, not define them.
27
-
28
- ## Dominus/CareBridge Boundary
29
-
30
- This is a Dominus platform repo (`dominus_active/`). It is product-agnostic: it
31
- carries the platform client, not CareBridge product logic. Per workspace policy,
32
- project↔gateway calls use this SDK with project identity; never forward user or
33
- machine JWTs to admin-only planes.
34
-
35
- ## Runtime / Deployment Class
36
-
37
- - Published npm library (`name: dominus-sdk-nodejs`), single export entry
38
- (`dist/index.js` / `dist/index.d.ts`); no subpath exports.
39
- - ESM only (`"type": "module"`), Node `>=18` (`engines`).
40
- - Released by pushing to the `production` branch (npm publish). Per workspace
41
- convention this repo's production branch is `production`, NOT
42
- `dominus-production`.
43
-
44
- ## PHI / Secrets / Safety
45
-
46
- - Service auth is a PSK in `DOMINUS_TOKEN`, exchanged for a short-lived JWT.
47
- - Never write PHI, secrets, tokens, cookies, or raw response bodies into these
48
- docs or into logs.
1
+ # 01 Purpose And Boundaries
2
+
3
+ ## Purpose
4
+
5
+ `dominus-sdk-nodejs` is the TypeScript/ESM client SDK for the Dominus
6
+ gateway-first platform (`package.json` `description`). It exposes a singleton
7
+ `dominus` (`src/index.ts`) with namespace-based APIs for auth, data, storage,
8
+ AI/runtime, workflow execution, jobs, and platform administration. Application
9
+ code uses this SDK rather than calling gateway routes directly.
10
+
11
+ ## What This Repo Owns
12
+
13
+ - The public client surface: namespaces (`src/namespaces/*.ts`), root shortcuts,
14
+ and exported types/utilities (`src/index.ts`).
15
+ - The request/transport contract: base64 wire protocol, JWT mint+cache, retries,
16
+ circuit breaker, SSE streaming, binary upload/download (`src/lib/client.ts`).
17
+ - Ergonomic parameter normalization and the mapping from SDK calls to `/api/*`
18
+ routes that the gateway transforms to `/svc/*`.
19
+
20
+ ## What It Does Not Own
21
+
22
+ - Backend behavior or route definitions — those live in the individual Dominus
23
+ workers (gateway, guardian, authority, workflow-manager, agent-runtime, etc.).
24
+ This SDK only describes how to call them.
25
+ - Kernel contracts (identity families, error envelope, deployment lanes). It
26
+ must conform to them, not define them.
27
+
28
+ ## Dominus/CareBridge Boundary
29
+
30
+ This is a Dominus platform repo (`dominus_active/`). It is product-agnostic: it
31
+ carries the platform client, not CareBridge product logic. Per workspace policy,
32
+ project↔gateway calls use this SDK with project identity; never forward user or
33
+ machine JWTs to admin-only planes.
34
+
35
+ ## Runtime / Deployment Class
36
+
37
+ - Published npm library (`name: dominus-sdk-nodejs`), single export entry
38
+ (`dist/index.js` / `dist/index.d.ts`); no subpath exports.
39
+ - ESM only (`"type": "module"`), Node `>=18` (`engines`).
40
+ - Released by pushing to the `production` branch (npm publish). Per workspace
41
+ convention this repo's production branch is `production`, NOT
42
+ `dominus-production`.
43
+
44
+ ## PHI / Secrets / Safety
45
+
46
+ - Service auth is a PSK in `DOMINUS_TOKEN`, exchanged for a short-lived JWT.
47
+ - Never write PHI, secrets, tokens, cookies, or raw response bodies into these
48
+ docs or into logs.
@@ -1,46 +1,46 @@
1
- # 02 Repo Map And Entrypoints
2
-
3
- ## Directory Map
4
-
5
- | Path | Purpose |
6
- |---|---|
7
- | `src/index.ts` | Singleton construction, 27 namespace wiring, root shortcuts, public type/util re-exports. |
8
- | `src/lib/client.ts` | Transport: base64 wire protocol, JWT mint/cache, retries, circuit breaker, SSE, binary IO. |
9
- | `src/lib/cache.ts` | Encrypted in-memory cache + circuit breaker primitives. |
10
- | `src/lib/config.ts` | Env/config resolution (gateway/proxy). |
11
- | `src/lib/errors.ts` | Typed SDK error hierarchy. |
12
- | `src/lib/console-capture.ts` | Optional console forwarding to the logs namespace. |
13
- | `src/lib/page-rules.ts`, `src/lib/user-session.ts` | Portal JWT / page-access local caches. |
14
- | `src/lib/crypto.ts`, `schema-builder.ts`, `trace.ts`, `conversation-format.ts` | Helpers (crypto, schema-builder normalization, trace, conversation format). |
15
- | `src/namespaces/*.ts` | One file per namespace (27 files). |
16
- | `src/contracts/versioned-storage.ts` | Versioned-storage contract types. |
17
- | `tests/` | 24 test files (`.test.js`, `.test.ts`, `.typecheck.ts`). |
18
- | `docs/` | `architecture.md`, `routes-services.md`, `usage-reference.md`, `workflow-hard-cut-release.md`, plus this `agent-guide/` and `janitor/`. |
19
- | `.github/workflows/` | npm publish workflows by branch (dev/staging/production). |
20
- | `dist/` | Generated build output (gitignored). Not source. |
21
- | `node_modules/` | Installed deps (gitignored). |
22
-
23
- ## Main Entrypoints
24
-
25
- - Public API: import `{ dominus }` from `dominus-sdk-nodejs` (resolves to
26
- `dist/index.js`; source is `src/index.ts`).
27
- - Source-of-truth surface: `src/index.ts` constructor wires each
28
- `public readonly <name>` namespace; a second wiring block builds a
29
- token-scoped client subset.
30
-
31
- ## Test Entrypoints
32
-
33
- - `npm test` builds, runs type tests, then runs the explicit node:test file list
34
- in `package.json` `scripts.test`.
35
- - `npm run test:types` runs `tsc -p tsconfig.type-tests.json` for the
36
- `*.typecheck.ts` files.
37
-
38
- ## Config / Build / Deploy Entrypoints
39
-
40
- - `tsconfig.json` (build), `tsconfig.type-tests.json` (type tests).
41
- - `npm run build` (`tsc`) → `dist/`.
42
- - `.github/workflows/publish-production.yml` on push to `production`.
43
-
44
- ## Avoid
45
-
46
- - `dist/` and `node_modules/` — generated; never edit, never cite as source.
1
+ # 02 Repo Map And Entrypoints
2
+
3
+ ## Directory Map
4
+
5
+ | Path | Purpose |
6
+ |---|---|
7
+ | `src/index.ts` | Singleton construction, 27 namespace wiring, root shortcuts, public type/util re-exports. |
8
+ | `src/lib/client.ts` | Transport: base64 wire protocol, JWT mint/cache, retries, circuit breaker, SSE, binary IO. |
9
+ | `src/lib/cache.ts` | Encrypted in-memory cache + circuit breaker primitives. |
10
+ | `src/lib/config.ts` | Env/config resolution (gateway/proxy). |
11
+ | `src/lib/errors.ts` | Typed SDK error hierarchy. |
12
+ | `src/lib/console-capture.ts` | Optional console forwarding to the logs namespace. |
13
+ | `src/lib/page-rules.ts`, `src/lib/user-session.ts` | Portal JWT / page-access local caches. |
14
+ | `src/lib/crypto.ts`, `schema-builder.ts`, `trace.ts`, `conversation-format.ts` | Helpers (crypto, schema-builder normalization, trace, conversation format). |
15
+ | `src/namespaces/*.ts` | One file per namespace (27 files). |
16
+ | `src/contracts/versioned-storage.ts` | Versioned-storage contract types. |
17
+ | `tests/` | 24 test files (`.test.js`, `.test.ts`, `.typecheck.ts`). |
18
+ | `docs/` | `architecture.md`, `routes-services.md`, `usage-reference.md`, `workflow-hard-cut-release.md`, plus this `agent-guide/` and `janitor/`. |
19
+ | `.github/workflows/` | npm publish workflows by branch (dev/staging/production). |
20
+ | `dist/` | Generated build output (gitignored). Not source. |
21
+ | `node_modules/` | Installed deps (gitignored). |
22
+
23
+ ## Main Entrypoints
24
+
25
+ - Public API: import `{ dominus }` from `dominus-sdk-nodejs` (resolves to
26
+ `dist/index.js`; source is `src/index.ts`).
27
+ - Source-of-truth surface: `src/index.ts` constructor wires each
28
+ `public readonly <name>` namespace; a second wiring block builds a
29
+ token-scoped client subset.
30
+
31
+ ## Test Entrypoints
32
+
33
+ - `npm test` builds, runs type tests, then runs the explicit node:test file list
34
+ in `package.json` `scripts.test`.
35
+ - `npm run test:types` runs `tsc -p tsconfig.type-tests.json` for the
36
+ `*.typecheck.ts` files.
37
+
38
+ ## Config / Build / Deploy Entrypoints
39
+
40
+ - `tsconfig.json` (build), `tsconfig.type-tests.json` (type tests).
41
+ - `npm run build` (`tsc`) → `dist/`.
42
+ - `.github/workflows/publish-production.yml` on push to `production`.
43
+
44
+ ## Avoid
45
+
46
+ - `dist/` and `node_modules/` — generated; never edit, never cite as source.
@@ -1,59 +1,59 @@
1
- # 03 API Surface
2
-
3
- The public surface is the `dominus` singleton (`src/index.ts`). Each namespace is
4
- a `public readonly` property backed by one file in `src/namespaces/`. The
5
- authoritative, exhaustive per-command reference is `docs/usage-reference.md`;
6
- the service/endpoint matrix is `docs/routes-services.md`. This page is the map.
7
-
8
- ## Namespaces (27, wired in `src/index.ts`)
9
-
10
- | Namespace | File | Backend / role (see routes-services.md) |
11
- |---|---|---|
12
- | `dominus.secrets` | `secrets.ts` | warden (selected-scope grants). |
13
- | `dominus.db` | `db.ts` | db-worker. |
14
- | `dominus.secure` | `secure.ts` | scribe (audited secure-table access). |
15
- | `dominus.redis` | `redis.ts` | redis-worker (ephemera building block). |
16
- | `dominus.files` | `files.ts` | b2-worker / admin-worker. |
17
- | `dominus.auth` | `auth.ts` | guardian + local JWT helpers. |
18
- | `dominus.ddl` | `ddl.ts` | smith / db-worker (schema builder + provisioning). |
19
- | `dominus.logs` | `logs.ts` | logs-worker (tail supports `machine_id`). |
20
- | `dominus.portal` | `portal.ts` | portal-worker. |
21
- | `dominus.courier` | `courier.ts` | courier-worker. |
22
- | `dominus.health` | `health.ts` | gateway-local (`/health`, `/v1/ping`). |
23
- | `dominus.admin` | `admin.ts` | admin-worker. |
24
- | `dominus.ai` (+ `.rag`, `.tools`, `.workflow`, `.results`, `.artifacts`) | `ai.ts` | agent-runtime. |
25
- | `dominus.workflow` | `workflow.ts` | workflow-manager (`ensure()` is the public launch path). |
26
- | `dominus.sync` | `sync.ts` | sync-worker. |
27
- | `dominus.jobs` | `jobs.ts` | job-worker. |
28
- | `dominus.processor` | `processor.ts` | processor-service. |
29
- | `dominus.artifacts` | `artifacts.ts` | artifact-worker (Artifact V2 `ar://`). |
30
- | `dominus.authority` | `authority.ts` | authority (app/org/env cutover surface). |
31
- | `dominus.browser` | `browser.ts` | browser-worker via `/svc/browser/*`. |
32
- | `dominus.deployer` | `deployer.ts` | deploy surface. |
33
- | `dominus.warden` | `warden.ts` | warden. |
34
- | `dominus.stash` | `stash.ts` | **primary storage surface** (kind registry routes to backend). |
35
- | `dominus.recipes` | `recipes.ts` | recipe-worker. |
36
- | `dominus.platform` | `platform.ts` | platform-worker via `/svc/platform/*`. |
37
- | `dominus.coder` | `coder.ts` | coder-runtime via `/svc/coder/*`. |
38
- | `dominus.publisher` | `publisher.ts` | publisher. |
39
-
40
- (`ai` sub-namespaces and `auth` local helpers are extra surfaces beyond the 27
41
- top-level files; see routes-services.md for the full service matrix.)
42
-
43
- ## Root Shortcuts And Utilities
44
-
45
- - Root shortcuts on the singleton: `get`, `upsert`, `listTables`, `queryTable`,
46
- `insertRow`, `addTable`, etc. (`src/index.ts`).
47
- - Exported utilities/types: error classes, crypto helpers
48
- (`hashPassword`, `hashPsk`, `generateToken`), cache utilities, JWT helpers
49
- (`verifyJwtLocally`, `isJwtValid`, `mintSelectedScopeJwt`),
50
- `normalizeSchemaBuilderMigration`, console-capture controls.
51
-
52
- ## Auth / Scope Per Call
53
-
54
- - Default: service JWT minted from `DOMINUS_TOKEN` PSK via `/jwt/mint`, cached
55
- 55 min (`JWT_CACHE_TTL = 3300000`) vs the worker's 1h `JWT_EXPIRY_SECONDS`.
56
- - Optional `userToken` passes a caller JWT through unchanged where backend
57
- semantics require user context.
58
- - `mintSelectedScopeJwt(targetOrgId, targetEnv)` is the canonical selected-scope
59
- mint helper.
1
+ # 03 API Surface
2
+
3
+ The public surface is the `dominus` singleton (`src/index.ts`). Each namespace is
4
+ a `public readonly` property backed by one file in `src/namespaces/`. The
5
+ authoritative, exhaustive per-command reference is `docs/usage-reference.md`;
6
+ the service/endpoint matrix is `docs/routes-services.md`. This page is the map.
7
+
8
+ ## Namespaces (27, wired in `src/index.ts`)
9
+
10
+ | Namespace | File | Backend / role (see routes-services.md) |
11
+ |---|---|---|
12
+ | `dominus.secrets` | `secrets.ts` | warden (selected-scope grants). |
13
+ | `dominus.db` | `db.ts` | db-worker. |
14
+ | `dominus.secure` | `secure.ts` | scribe (audited secure-table access). |
15
+ | `dominus.redis` | `redis.ts` | redis-worker (ephemera building block). |
16
+ | `dominus.files` | `files.ts` | b2-worker / admin-worker. |
17
+ | `dominus.auth` | `auth.ts` | guardian + local JWT helpers. |
18
+ | `dominus.ddl` | `ddl.ts` | smith / db-worker (schema builder + provisioning). |
19
+ | `dominus.logs` | `logs.ts` | logs-worker (tail supports `machine_id`). |
20
+ | `dominus.portal` | `portal.ts` | portal-worker. |
21
+ | `dominus.courier` | `courier.ts` | courier-worker. |
22
+ | `dominus.health` | `health.ts` | gateway-local (`/health`, `/v1/ping`). |
23
+ | `dominus.admin` | `admin.ts` | admin-worker. |
24
+ | `dominus.ai` (+ `.rag`, `.tools`, `.workflow`, `.results`, `.artifacts`) | `ai.ts` | agent-runtime. |
25
+ | `dominus.workflow` | `workflow.ts` | workflow-manager (`ensure()` is the public launch path). |
26
+ | `dominus.sync` | `sync.ts` | sync-worker. |
27
+ | `dominus.jobs` | `jobs.ts` | job-worker. |
28
+ | `dominus.processor` | `processor.ts` | processor-service. |
29
+ | `dominus.artifacts` | `artifacts.ts` | artifact-worker (Artifact V2 `ar://`). |
30
+ | `dominus.authority` | `authority.ts` | authority (app/org/env cutover surface). |
31
+ | `dominus.browser` | `browser.ts` | browser-worker via `/svc/browser/*`. |
32
+ | `dominus.deployer` | `deployer.ts` | deploy surface. |
33
+ | `dominus.warden` | `warden.ts` | warden. |
34
+ | `dominus.stash` | `stash.ts` | **primary storage surface** (kind registry routes to backend). |
35
+ | `dominus.recipes` | `recipes.ts` | recipe-worker. |
36
+ | `dominus.platform` | `platform.ts` | platform-worker via `/svc/platform/*`. |
37
+ | `dominus.coder` | `coder.ts` | coder-runtime via `/svc/coder/*`. |
38
+ | `dominus.publisher` | `publisher.ts` | publisher. |
39
+
40
+ (`ai` sub-namespaces and `auth` local helpers are extra surfaces beyond the 27
41
+ top-level files; see routes-services.md for the full service matrix.)
42
+
43
+ ## Root Shortcuts And Utilities
44
+
45
+ - Root shortcuts on the singleton: `get`, `upsert`, `listTables`, `queryTable`,
46
+ `insertRow`, `addTable`, etc. (`src/index.ts`).
47
+ - Exported utilities/types: error classes, crypto helpers
48
+ (`hashPassword`, `hashPsk`, `generateToken`), cache utilities, JWT helpers
49
+ (`verifyJwtLocally`, `isJwtValid`, `mintSelectedScopeJwt`),
50
+ `normalizeSchemaBuilderMigration`, console-capture controls.
51
+
52
+ ## Auth / Scope Per Call
53
+
54
+ - Default: service JWT minted from `DOMINUS_TOKEN` PSK via `/jwt/mint`, cached
55
+ 55 min (`JWT_CACHE_TTL = 3300000`) vs the worker's 1h `JWT_EXPIRY_SECONDS`.
56
+ - Optional `userToken` passes a caller JWT through unchanged where backend
57
+ semantics require user context.
58
+ - `mintSelectedScopeJwt(targetOrgId, targetEnv)` is the canonical selected-scope
59
+ mint helper.
@@ -1,36 +1,36 @@
1
- # 04 Data, State, And Storage
2
-
3
- This SDK is a stateless client; it does not own backend storage. It exposes
4
- storage-facing namespaces and keeps a few in-process caches. Backends own the
5
- durable state.
6
-
7
- ## Storage Surfaces (client-facing)
8
-
9
- Per `docs/architecture.md` §2a (Two-Layer Storage Rule):
10
-
11
- | Surface | Namespace | Role |
12
- |---|---|---|
13
- | Named, durable data of a registered kind | `dominus.stash.*` | **Primary** — kind registry routes to the right backend + policy. |
14
- | Direct `ar://`-addressed Artifact V2 workflow | `dominus.artifacts.*` | Escape hatch when you already hold a canonical ref. |
15
- | Locks, queues, counters, short-lived cache | `dominus.redis.*` | Ephemera building block. |
16
- | Tables / SQL | `dominus.db.*`, `dominus.ddl.*` | db-worker / smith building blocks. |
17
- | Object/file storage | `dominus.files.*` | b2-worker building block. |
18
- | New kernel backend / documented fallback | primitives | Lowest layer only. |
19
-
20
- Rule: application data → Stash. Primitives only for ephemera or when building a
21
- kernel backend.
22
-
23
- ## In-Process Client State (this repo)
24
-
25
- - **Service JWT cache** — `src/lib/client.ts`, cached 55 min, refreshed via
26
- `ensureValidJwt` mutex to avoid thundering herd.
27
- - **Encrypted in-memory cache** — `src/lib/cache.ts`; encryption key seeded from
28
- `DOMINUS_TOKEN` in `src/index.ts`.
29
- - **Portal/session caches** — `src/lib/page-rules.ts`, `src/lib/user-session.ts`
30
- for portal JWT / page-access acceleration.
31
- - **JWKS cache** — `auth.getJwks` caches public signing keys.
32
-
33
- ## Migrations
34
-
35
- - None in this repo. Schema/migration helpers (`ddl`, `normalizeSchemaBuilderMigration`)
36
- build requests for the db/smith workers; the migrations themselves run there.
1
+ # 04 Data, State, And Storage
2
+
3
+ This SDK is a stateless client; it does not own backend storage. It exposes
4
+ storage-facing namespaces and keeps a few in-process caches. Backends own the
5
+ durable state.
6
+
7
+ ## Storage Surfaces (client-facing)
8
+
9
+ Per `docs/architecture.md` §2a (Two-Layer Storage Rule):
10
+
11
+ | Surface | Namespace | Role |
12
+ |---|---|---|
13
+ | Named, durable data of a registered kind | `dominus.stash.*` | **Primary** — kind registry routes to the right backend + policy. |
14
+ | Direct `ar://`-addressed Artifact V2 workflow | `dominus.artifacts.*` | Escape hatch when you already hold a canonical ref. |
15
+ | Locks, queues, counters, short-lived cache | `dominus.redis.*` | Ephemera building block. |
16
+ | Tables / SQL | `dominus.db.*`, `dominus.ddl.*` | db-worker / smith building blocks. |
17
+ | Object/file storage | `dominus.files.*` | b2-worker building block. |
18
+ | New kernel backend / documented fallback | primitives | Lowest layer only. |
19
+
20
+ Rule: application data → Stash. Primitives only for ephemera or when building a
21
+ kernel backend.
22
+
23
+ ## In-Process Client State (this repo)
24
+
25
+ - **Service JWT cache** — `src/lib/client.ts`, cached 55 min, refreshed via
26
+ `ensureValidJwt` mutex to avoid thundering herd.
27
+ - **Encrypted in-memory cache** — `src/lib/cache.ts`; encryption key seeded from
28
+ `DOMINUS_TOKEN` in `src/index.ts`.
29
+ - **Portal/session caches** — `src/lib/page-rules.ts`, `src/lib/user-session.ts`
30
+ for portal JWT / page-access acceleration.
31
+ - **JWKS cache** — `auth.getJwks` caches public signing keys.
32
+
33
+ ## Migrations
34
+
35
+ - None in this repo. Schema/migration helpers (`ddl`, `normalizeSchemaBuilderMigration`)
36
+ build requests for the db/smith workers; the migrations themselves run there.
@@ -1,40 +1,40 @@
1
- # 05 Integrations And Runtime
2
-
3
- ## External Dependencies
4
-
5
- - Runtime deps (`package.json`): `jose` (JWT verify/mint helpers), `bcryptjs`
6
- (password/PSK hashing).
7
- - Dev deps: `typescript`, `@types/node`, `@types/bcryptjs`.
8
-
9
- ## Cross-Repo / Gateway Calls
10
-
11
- The SDK is a client to the Dominus gateway. Namespace code targets `/api/*`
12
- paths; when a method sets `useGateway: true` the client transforms `/api/*` to
13
- gateway `/svc/*` dispatch paths (`docs/architecture.md` §4,
14
- `docs/routes-services.md`). Backends reached include guardian, authority,
15
- workflow-manager, agent-runtime, db/redis/b2/logs workers, platform-worker,
16
- coder-runtime, browser-worker, and others — see the service matrix in
17
- `docs/routes-services.md`.
18
-
19
- Notable routing facts (from `CLAUDE.md` / routes-services.md):
20
-
21
- - `dominus.browser.*` must use `/api/browser/*` with `useGateway: true`
22
- (gateway exposes `/svc/browser/*`); do not point at worker-local `/runs/*`.
23
- - `dominus.platform.*` and `dominus.coder.*` call `/svc/*` via `gatewayFetch`
24
- and forward `X-Actor-Type` / `X-Actor-Id`.
25
- - `dominus.coder.ensureRun()` requires exactly one of `workflowRecipeRef` or
26
- `pipelineRecipeRef`.
27
- - `dominus.ai.stt` → `POST /api/agent/stt` (batch; legacy WebSocket STT retired).
28
-
29
- ## Runtime Assumptions
30
-
31
- - ESM only (`"type": "module"`), Node `>=18`.
32
- - Single published entry point; import from `'dominus-sdk-nodejs'` only.
33
-
34
- ## Environment Variables (by category, no values)
35
-
36
- - **Auth:** `DOMINUS_TOKEN` (PSK; also seeds the in-memory cache encryption key).
37
- - **Gateway/config:** resolved in `src/lib/config.ts` (gateway base URL / proxy
38
- config). Read that file for the exact variable names before relying on one.
39
-
40
- Never write secret values into docs or logs.
1
+ # 05 Integrations And Runtime
2
+
3
+ ## External Dependencies
4
+
5
+ - Runtime deps (`package.json`): `jose` (JWT verify/mint helpers), `bcryptjs`
6
+ (password/PSK hashing).
7
+ - Dev deps: `typescript`, `@types/node`, `@types/bcryptjs`.
8
+
9
+ ## Cross-Repo / Gateway Calls
10
+
11
+ The SDK is a client to the Dominus gateway. Namespace code targets `/api/*`
12
+ paths; when a method sets `useGateway: true` the client transforms `/api/*` to
13
+ gateway `/svc/*` dispatch paths (`docs/architecture.md` §4,
14
+ `docs/routes-services.md`). Backends reached include guardian, authority,
15
+ workflow-manager, agent-runtime, db/redis/b2/logs workers, platform-worker,
16
+ coder-runtime, browser-worker, and others — see the service matrix in
17
+ `docs/routes-services.md`.
18
+
19
+ Notable routing facts (from `CLAUDE.md` / routes-services.md):
20
+
21
+ - `dominus.browser.*` must use `/api/browser/*` with `useGateway: true`
22
+ (gateway exposes `/svc/browser/*`); do not point at worker-local `/runs/*`.
23
+ - `dominus.platform.*` and `dominus.coder.*` call `/svc/*` via `gatewayFetch`
24
+ and forward `X-Actor-Type` / `X-Actor-Id`.
25
+ - `dominus.coder.ensureRun()` requires exactly one of `workflowRecipeRef` or
26
+ `pipelineRecipeRef`.
27
+ - `dominus.ai.stt` → `POST /api/agent/stt` (batch; legacy WebSocket STT retired).
28
+
29
+ ## Runtime Assumptions
30
+
31
+ - ESM only (`"type": "module"`), Node `>=18`.
32
+ - Single published entry point; import from `'dominus-sdk-nodejs'` only.
33
+
34
+ ## Environment Variables (by category, no values)
35
+
36
+ - **Auth:** `DOMINUS_TOKEN` (PSK; also seeds the in-memory cache encryption key).
37
+ - **Gateway/config:** resolved in `src/lib/config.ts` (gateway base URL / proxy
38
+ config). Read that file for the exact variable names before relying on one.
39
+
40
+ Never write secret values into docs or logs.