@eloxiv/cli 0.0.0-stage → 0.1.1

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 (294) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/AgentSkills.d.ts +51 -0
  4. package/dist/AgentSkills.d.ts.map +1 -0
  5. package/dist/AgentSkills.js +264 -0
  6. package/dist/AgentSkills.js.map +1 -0
  7. package/dist/AgentWeb.d.ts +83 -0
  8. package/dist/AgentWeb.d.ts.map +1 -0
  9. package/dist/AgentWeb.js +436 -0
  10. package/dist/AgentWeb.js.map +1 -0
  11. package/dist/App.d.ts +213 -0
  12. package/dist/App.d.ts.map +1 -0
  13. package/dist/App.js +357 -0
  14. package/dist/App.js.map +1 -0
  15. package/dist/Blueprint.d.ts +47 -0
  16. package/dist/Blueprint.d.ts.map +1 -0
  17. package/dist/Blueprint.js +241 -0
  18. package/dist/Blueprint.js.map +1 -0
  19. package/dist/Brand.d.ts +42 -0
  20. package/dist/Brand.d.ts.map +1 -0
  21. package/dist/Brand.js +370 -0
  22. package/dist/Brand.js.map +1 -0
  23. package/dist/Changelog.d.ts +22 -0
  24. package/dist/Changelog.d.ts.map +1 -0
  25. package/dist/Changelog.js +117 -0
  26. package/dist/Changelog.js.map +1 -0
  27. package/dist/Cli.d.ts +17 -0
  28. package/dist/Cli.d.ts.map +1 -0
  29. package/dist/Cli.js +810 -0
  30. package/dist/Cli.js.map +1 -0
  31. package/dist/DbAdmin.d.ts +18 -0
  32. package/dist/DbAdmin.d.ts.map +1 -0
  33. package/dist/DbAdmin.js +91 -0
  34. package/dist/DbAdmin.js.map +1 -0
  35. package/dist/Dependencies.d.ts +53 -0
  36. package/dist/Dependencies.d.ts.map +1 -0
  37. package/dist/Dependencies.js +132 -0
  38. package/dist/Dependencies.js.map +1 -0
  39. package/dist/Deploy.d.ts +39 -0
  40. package/dist/Deploy.d.ts.map +1 -0
  41. package/dist/Deploy.js +458 -0
  42. package/dist/Deploy.js.map +1 -0
  43. package/dist/Docs.d.ts +71 -0
  44. package/dist/Docs.d.ts.map +1 -0
  45. package/dist/Docs.js +240 -0
  46. package/dist/Docs.js.map +1 -0
  47. package/dist/Doctor.d.ts +56 -0
  48. package/dist/Doctor.d.ts.map +1 -0
  49. package/dist/Doctor.js +368 -0
  50. package/dist/Doctor.js.map +1 -0
  51. package/dist/Dossier.d.ts +23 -0
  52. package/dist/Dossier.d.ts.map +1 -0
  53. package/dist/Dossier.js +92 -0
  54. package/dist/Dossier.js.map +1 -0
  55. package/dist/Emit.d.ts +26 -0
  56. package/dist/Emit.d.ts.map +1 -0
  57. package/dist/Emit.js +51 -0
  58. package/dist/Emit.js.map +1 -0
  59. package/dist/Errors.d.ts +26 -0
  60. package/dist/Errors.d.ts.map +1 -0
  61. package/dist/Errors.js +17 -0
  62. package/dist/Errors.js.map +1 -0
  63. package/dist/Evals.d.ts +52 -0
  64. package/dist/Evals.d.ts.map +1 -0
  65. package/dist/Evals.js +126 -0
  66. package/dist/Evals.js.map +1 -0
  67. package/dist/Files.d.ts +47 -0
  68. package/dist/Files.d.ts.map +1 -0
  69. package/dist/Files.js +145 -0
  70. package/dist/Files.js.map +1 -0
  71. package/dist/Generate.d.ts +80 -0
  72. package/dist/Generate.d.ts.map +1 -0
  73. package/dist/Generate.js +310 -0
  74. package/dist/Generate.js.map +1 -0
  75. package/dist/Guards.d.ts +45 -0
  76. package/dist/Guards.d.ts.map +1 -0
  77. package/dist/Guards.js +530 -0
  78. package/dist/Guards.js.map +1 -0
  79. package/dist/Inspect.d.ts +125 -0
  80. package/dist/Inspect.d.ts.map +1 -0
  81. package/dist/Inspect.js +270 -0
  82. package/dist/Inspect.js.map +1 -0
  83. package/dist/Keychain.d.ts +57 -0
  84. package/dist/Keychain.d.ts.map +1 -0
  85. package/dist/Keychain.js +73 -0
  86. package/dist/Keychain.js.map +1 -0
  87. package/dist/Lock.d.ts +13 -0
  88. package/dist/Lock.d.ts.map +1 -0
  89. package/dist/Lock.js +145 -0
  90. package/dist/Lock.js.map +1 -0
  91. package/dist/Mcp.d.ts +91 -0
  92. package/dist/Mcp.d.ts.map +1 -0
  93. package/dist/Mcp.js +128 -0
  94. package/dist/Mcp.js.map +1 -0
  95. package/dist/Merge.d.ts +18 -0
  96. package/dist/Merge.d.ts.map +1 -0
  97. package/dist/Merge.js +43 -0
  98. package/dist/Merge.js.map +1 -0
  99. package/dist/Migrate.d.ts +78 -0
  100. package/dist/Migrate.d.ts.map +1 -0
  101. package/dist/Migrate.js +288 -0
  102. package/dist/Migrate.js.map +1 -0
  103. package/dist/Plugins.d.ts +36 -0
  104. package/dist/Plugins.d.ts.map +1 -0
  105. package/dist/Plugins.js +304 -0
  106. package/dist/Plugins.js.map +1 -0
  107. package/dist/Postgres.d.ts +73 -0
  108. package/dist/Postgres.d.ts.map +1 -0
  109. package/dist/Postgres.js +294 -0
  110. package/dist/Postgres.js.map +1 -0
  111. package/dist/Publish.d.ts +23 -0
  112. package/dist/Publish.d.ts.map +1 -0
  113. package/dist/Publish.js +59 -0
  114. package/dist/Publish.js.map +1 -0
  115. package/dist/Registry.d.ts +539 -0
  116. package/dist/Registry.d.ts.map +1 -0
  117. package/dist/Registry.js +340 -0
  118. package/dist/Registry.js.map +1 -0
  119. package/dist/Remote.d.ts +90 -0
  120. package/dist/Remote.d.ts.map +1 -0
  121. package/dist/Remote.js +1006 -0
  122. package/dist/Remote.js.map +1 -0
  123. package/dist/Run.d.ts +120 -0
  124. package/dist/Run.d.ts.map +1 -0
  125. package/dist/Run.js +477 -0
  126. package/dist/Run.js.map +1 -0
  127. package/dist/SyncGen.d.ts +118 -0
  128. package/dist/SyncGen.d.ts.map +1 -0
  129. package/dist/SyncGen.js +392 -0
  130. package/dist/SyncGen.js.map +1 -0
  131. package/dist/Update.d.ts +301 -0
  132. package/dist/Update.d.ts.map +1 -0
  133. package/dist/Update.js +627 -0
  134. package/dist/Update.js.map +1 -0
  135. package/dist/bin.d.ts +3 -0
  136. package/dist/bin.d.ts.map +1 -0
  137. package/dist/bin.js +42 -0
  138. package/dist/bin.js.map +1 -0
  139. package/dist/docs/backlog.md +56 -0
  140. package/dist/docs/ci.md +277 -0
  141. package/dist/docs/cli.md +696 -0
  142. package/dist/docs/connectors/google.md +115 -0
  143. package/dist/docs/connectors/http-openapi.md +7 -0
  144. package/dist/docs/connectors/mcp.md +8 -0
  145. package/dist/docs/connectors/microsoft-graph.md +75 -0
  146. package/dist/docs/connectors/openai.md +25 -0
  147. package/dist/docs/connectors/slack.md +162 -0
  148. package/dist/docs/connectors/workos.md +39 -0
  149. package/dist/docs/contracts/README.md +173 -0
  150. package/dist/docs/contracts/action-consent.md +92 -0
  151. package/dist/docs/contracts/action-registry.md +85 -0
  152. package/dist/docs/contracts/actor.md +100 -0
  153. package/dist/docs/contracts/agent-resources.md +90 -0
  154. package/dist/docs/contracts/agent-runtime.md +257 -0
  155. package/dist/docs/contracts/approvals.md +126 -0
  156. package/dist/docs/contracts/audit.md +75 -0
  157. package/dist/docs/contracts/auth-provider.md +74 -0
  158. package/dist/docs/contracts/calendar-provider.md +46 -0
  159. package/dist/docs/contracts/client-sdk.md +245 -0
  160. package/dist/docs/contracts/collab-document.md +151 -0
  161. package/dist/docs/contracts/command.md +44 -0
  162. package/dist/docs/contracts/connections.md +235 -0
  163. package/dist/docs/contracts/context-accounting.md +50 -0
  164. package/dist/docs/contracts/daemon.md +243 -0
  165. package/dist/docs/contracts/db-tx.md +53 -0
  166. package/dist/docs/contracts/delegation.md +68 -0
  167. package/dist/docs/contracts/device-control.md +103 -0
  168. package/dist/docs/contracts/directory-provider.md +36 -0
  169. package/dist/docs/contracts/directory.md +161 -0
  170. package/dist/docs/contracts/document-source.md +33 -0
  171. package/dist/docs/contracts/files.md +115 -0
  172. package/dist/docs/contracts/flags.md +83 -0
  173. package/dist/docs/contracts/host.md +68 -0
  174. package/dist/docs/contracts/http-api.md +43 -0
  175. package/dist/docs/contracts/ingestion.md +130 -0
  176. package/dist/docs/contracts/ingress.md +141 -0
  177. package/dist/docs/contracts/invocation.md +260 -0
  178. package/dist/docs/contracts/local-client.md +110 -0
  179. package/dist/docs/contracts/locale.md +56 -0
  180. package/dist/docs/contracts/machine-identity.md +117 -0
  181. package/dist/docs/contracts/mail-provider.md +49 -0
  182. package/dist/docs/contracts/memory.md +53 -0
  183. package/dist/docs/contracts/messaging.md +40 -0
  184. package/dist/docs/contracts/metering.md +139 -0
  185. package/dist/docs/contracts/model-provider.md +84 -0
  186. package/dist/docs/contracts/module-manifest.md +213 -0
  187. package/dist/docs/contracts/notification-channel.md +90 -0
  188. package/dist/docs/contracts/notifications.md +123 -0
  189. package/dist/docs/contracts/outbox.md +80 -0
  190. package/dist/docs/contracts/privacy.md +110 -0
  191. package/dist/docs/contracts/progress.md +52 -0
  192. package/dist/docs/contracts/query-surface.md +108 -0
  193. package/dist/docs/contracts/readiness.md +63 -0
  194. package/dist/docs/contracts/release.md +142 -0
  195. package/dist/docs/contracts/result-rendering.md +61 -0
  196. package/dist/docs/contracts/sandbox.md +186 -0
  197. package/dist/docs/contracts/scheduler.md +148 -0
  198. package/dist/docs/contracts/screen-context.md +81 -0
  199. package/dist/docs/contracts/search.md +120 -0
  200. package/dist/docs/contracts/secrets.md +74 -0
  201. package/dist/docs/contracts/settings.md +109 -0
  202. package/dist/docs/contracts/sharing.md +77 -0
  203. package/dist/docs/contracts/slot.md +48 -0
  204. package/dist/docs/contracts/space.md +67 -0
  205. package/dist/docs/contracts/storage-adapter.md +45 -0
  206. package/dist/docs/contracts/storage-backend.md +56 -0
  207. package/dist/docs/contracts/sync.md +213 -0
  208. package/dist/docs/contracts/telemetry.md +80 -0
  209. package/dist/docs/contracts/theme-tokens.md +50 -0
  210. package/dist/docs/contracts/tool-source.md +58 -0
  211. package/dist/docs/contracts/versioning.md +99 -0
  212. package/dist/docs/contracts/view.md +65 -0
  213. package/dist/docs/contracts/work-items.md +99 -0
  214. package/dist/docs/contracts/workflow.md +82 -0
  215. package/dist/docs/decisions.md +163 -0
  216. package/dist/docs/example-app.md +192 -0
  217. package/dist/docs/getting-started.md +927 -0
  218. package/dist/docs/goal.md +54 -0
  219. package/dist/docs/parity.md +29 -0
  220. package/dist/docs/performance.md +129 -0
  221. package/dist/docs/registry/README.md +74 -0
  222. package/dist/docs/registry/app.md +38 -0
  223. package/dist/docs/registry/approvals-ui-foldkit.md +28 -0
  224. package/dist/docs/registry/calendar-ui-foldkit.md +27 -0
  225. package/dist/docs/registry/calendar.md +35 -0
  226. package/dist/docs/registry/chat-ui-foldkit.md +30 -0
  227. package/dist/docs/registry/desktop-rune.md +50 -0
  228. package/dist/docs/registry/desktop.md +32 -0
  229. package/dist/docs/registry/eloxiv-action.md +25 -0
  230. package/dist/docs/registry/eloxiv-connector.md +25 -0
  231. package/dist/docs/registry/eloxiv-module.md +25 -0
  232. package/dist/docs/registry/eloxiv-policy.md +25 -0
  233. package/dist/docs/registry/eloxiv-view.md +25 -0
  234. package/dist/docs/registry/hello-ui-foldkit.md +29 -0
  235. package/dist/docs/registry/hello.md +39 -0
  236. package/dist/docs/registry/home-ui-foldkit.md +27 -0
  237. package/dist/docs/registry/home.md +29 -0
  238. package/dist/docs/registry/inbox-ui-foldkit.md +27 -0
  239. package/dist/docs/registry/mail-ui-foldkit.md +27 -0
  240. package/dist/docs/registry/mail.md +34 -0
  241. package/dist/docs/registry/meeting-prep.md +26 -0
  242. package/dist/docs/registry/members-ui-foldkit.md +28 -0
  243. package/dist/docs/registry/mobile.md +37 -0
  244. package/dist/docs/registry/notes-ui-foldkit.md +27 -0
  245. package/dist/docs/registry/notes.md +26 -0
  246. package/dist/docs/registry/people-ui-foldkit.md +28 -0
  247. package/dist/docs/registry/people.md +38 -0
  248. package/dist/docs/registry/shell-foldkit.md +35 -0
  249. package/dist/docs/registry/theme.md +25 -0
  250. package/dist/docs/registry/ui-conformance.md +30 -0
  251. package/dist/docs/release.md +100 -0
  252. package/dist/docs/scaffold.md +826 -0
  253. package/dist/docs/security/threat-model.md +299 -0
  254. package/dist/docs/upstream/zero-cache-socket-handoff.md +105 -0
  255. package/dist/index.d.ts +8 -0
  256. package/dist/index.d.ts.map +1 -0
  257. package/dist/index.js +8 -0
  258. package/dist/index.js.map +1 -0
  259. package/package.json +48 -3
  260. package/src/AgentSkills.ts +329 -0
  261. package/src/AgentWeb.ts +507 -0
  262. package/src/App.ts +435 -0
  263. package/src/Blueprint.ts +276 -0
  264. package/src/Brand.ts +415 -0
  265. package/src/Changelog.ts +136 -0
  266. package/src/Cli.ts +1458 -0
  267. package/src/DbAdmin.ts +115 -0
  268. package/src/Dependencies.ts +170 -0
  269. package/src/Deploy.ts +563 -0
  270. package/src/Docs.ts +309 -0
  271. package/src/Doctor.ts +424 -0
  272. package/src/Dossier.ts +148 -0
  273. package/src/Emit.ts +68 -0
  274. package/src/Errors.ts +18 -0
  275. package/src/Evals.ts +153 -0
  276. package/src/Files.ts +152 -0
  277. package/src/Generate.ts +402 -0
  278. package/src/Guards.ts +541 -0
  279. package/src/Inspect.ts +358 -0
  280. package/src/Keychain.ts +107 -0
  281. package/src/Lock.ts +174 -0
  282. package/src/Mcp.ts +159 -0
  283. package/src/Merge.ts +70 -0
  284. package/src/Migrate.ts +331 -0
  285. package/src/Plugins.ts +347 -0
  286. package/src/Postgres.ts +353 -0
  287. package/src/Publish.ts +64 -0
  288. package/src/Registry.ts +405 -0
  289. package/src/Remote.ts +1158 -0
  290. package/src/Run.ts +541 -0
  291. package/src/SyncGen.ts +570 -0
  292. package/src/Update.ts +873 -0
  293. package/src/bin.ts +46 -0
  294. package/src/index.ts +7 -0
@@ -0,0 +1,63 @@
1
+ # Readiness
2
+
3
+ Liveness and readiness for a kernel process: whether it answers at all, and whether it should get traffic, with the reason for every verdict.
4
+
5
+ - Kind: kernel service. Version 1.2.0 (1.1.0 adds the `storage` check; 1.2.0 the `model-provider` and `connectors` checks).
6
+ - Schema: [`packages/contracts/schema/contracts/Readiness.json`](../../packages/contracts/schema/contracts/Readiness.json) (source [`Readiness.ts`](../../packages/contracts/src/contracts/Readiness.ts)).
7
+ - Implementation: the `Readiness` service in [`packages/kernel/src/Readiness.ts`](../../packages/kernel/src/Readiness.ts); routes `GET /health` and `GET /ready` in [`Server.ts`](../../packages/kernel/src/Server.ts); the dispatcher's heartbeat (`DispatcherHeartbeat`) in [`Outbox.ts`](../../packages/kernel/src/Outbox.ts).
8
+ - Kit: `@eloxiv/testing/conformance/Readiness` ([source](../../packages/testing/src/conformance/Readiness.ts)).
9
+
10
+ ## Operations
11
+
12
+ | Operation | Route | Output | What it does |
13
+ | --- | --- | --- | --- |
14
+ | `live` | `GET /health` | `{ status: "ok", version }`, always 200 | Liveness: the process serves requests. It checks nothing else, so an orchestrator restarts only a process that stopped answering |
15
+ | `check` | `GET /ready` | `ReadinessReport`: `status` and `checks`; 200 when `ready` or `degraded`, 503 when `not-ready` | Runs every check now |
16
+
17
+ Both routes are unauthenticated. The report names modules, migrations and counts, never data.
18
+
19
+ ## Records
20
+
21
+ - **`ReadinessReport`**: `status` (`ready`, `degraded` or `not-ready`) and `checks`, in the order below.
22
+ - **`ReadinessCheck`**: `name`, `status` (`ok`, `degraded`, `not-ready`, `skipped`), and `detail`, a sentence an operator can act on.
23
+
24
+ The report's status is `not-ready` if any check is not ready, else `degraded` if any is degraded, else `ready` (`skipped` counts as fine).
25
+
26
+ ## Checks
27
+
28
+ | Check | `ok` | `degraded` | `not-ready` | `skipped` |
29
+ | --- | --- | --- | --- | --- |
30
+ | `database` | the kernel's pool answers | | it does not answer in 2 s (every other check is then reported not ready, "not checked") | |
31
+ | `migrations` | nothing pending, no drift ([Release](release.md) `status`) | the schema of a module changed outside setup (drift), or setup never recorded its snapshot | a module's security state (row-level security, policies, privileges, triggers, functions, its roles and what they may do outside its schema) changed outside setup, its owner role can log in outside setup, a failed setup left it closed, the kernel's own schemas changed outside setup (module `eloxiv`), or zero-cache's DDL triggers were left disabled with no setup running (`zero-cache`; `insecure`): the detail names the modules and says to run setup, which repairs it; or a migration this build ships is not applied: the detail lists each as `<module>/<migration>` and says to run setup | |
32
+ | `cluster-runner` | this process's runner address (`ELOXIV_RUNNER_HOST:ELOXIV_RUNNER_PORT`) is registered and healthy | | not registered, or marked unhealthy | the process is a durable-work client |
33
+ | `outbox-dispatcher` | this process's dispatcher finished a pass recently | | it has not finished one yet, or its last finished longer ago than `ELOXIV_DISPATCHER_STALE_MS` (default the larger of 5 s and 20 poll intervals) | the process runs no dispatcher |
34
+ | `dead-letters` | open [dead letters](outbox.md) across organisations are at most the threshold | more are open than `ELOXIV_DEAD_LETTER_THRESHOLD` (default 0: any) | | |
35
+ | `storage` | the [storage backend](storage-backend.md) answers a listing | | it fails or does not answer in 2 s | the app has no storage backend (it does not install Files) |
36
+ | `model-provider` | the agent's default model (`ELOXIV_AGENT_MODEL`, else the app's `agent.defaultModel`, else the first provider's first model) is installed and offered | none is configured, or it names a provider or model the deployment does not have: the agent cannot answer, everything else works | | the app does not install the agent |
37
+ | `connectors` | every connector the app installs has its settings (its OAuth client and API origins build from `ELOXIV_CONNECTOR_<NAME>__<KEY>`) | one does not: the detail names each and the setting and variable it needs, never a value; a connector that fails reading its settings otherwise is named with fixed words (its own message, which could quote what it failed to parse, is not published) | | the app has no connectors |
38
+
39
+ Each check is bounded by a 2 s timeout; one that does not finish is not ready.
40
+
41
+ ## Guarantees
42
+
43
+ 1. **Liveness is independent of dependencies.** `/health` answers 200 whenever the process serves HTTP, whatever the database's state. From the moment the server listens until the kernel's routes are served, every request (`/health` included) answers `503 Starting` with `Retry-After: 1`, on Bun and on Node, never a 404 for a route the kernel is about to serve ([`starting-server.test.ts`](../../packages/kernel/test/starting-server.test.ts)).
44
+ 2. **Not ready while the database is behind the build, or its security drifted.** A kernel started against a database with pending migrations reports `not-ready` (503), naming them, until setup has applied them; then `ready`. A module whose row-level security, policies, privileges, triggers or roles were changed outside setup, or that a failed setup left closed ([Release](release.md), guarantee 2), takes the kernel out of service the same way until setup has repaired it.
45
+ 3. **Dead letters degrade, they do not take the kernel out of service.** Above the threshold the report is `degraded` (still 200) with the count; it returns to `ready` once they are retried or discarded below it.
46
+ 4. **Every verdict has a reason** in `detail`.
47
+
48
+ ## How an implementation is checked
49
+
50
+ `readinessConformance(start)` registers, with a subject that runs a kernel over the conformance fixture app (dispatcher and runner on) and can start one whose build is ahead of its database:
51
+
52
+ - `/health` answers `{ status: "ok", version }`;
53
+ - on a database set up for its build, `/ready` answers 200 `ready`, with the eight checks in order, each `ok` or `skipped` and with a reason;
54
+ - a kernel installing `stage` 2.0.0 over a database set up for 1.0.0 answers 503 `not-ready`, its `migrations` check naming `stage/0001_extra` and setup; after setup it is `ready`; once row-level security on `stage.item` is disabled outside setup it answers 503 again, naming `stage` and setup, and after setup it is ready;
55
+ - two poison deliveries dead-lettered (the Outbox fixture's `docs.poison`) make it `degraded` with "2 dead letters are open (threshold 0)", still 200, no other check failing; once an administrator discards them it is `ready` again.
56
+
57
+ The Eloxiv kernel runs it in `packages/testing/test/readiness.test.ts`, which also checks that a process without a dispatcher reports it as skipped and is ready, and that an app whose default model names a provider it does not have and one of whose connectors lacks its client id is `degraded` (200), naming the provider and the connector's variable and no setting's value; `packages/testing/test/agent-readiness.test.ts` that a default model set up is `ok`.
58
+
59
+ ## Not yet guaranteed
60
+
61
+ - **Configuration, not reachability, for external services**: a connector's settings and the default model are checked as configured, without calling the provider (an organisation's model credentials are [AgentRuntime](agent-runtime.md) `readiness`'s); zero-cache is not checked (it has its own health endpoints).
62
+ - **The checks are this process's**: another process's stopped dispatcher or runner shows only in its own report.
63
+ - **Drift detection reads the catalogue on every check**; for very large schemas, probe `/ready` less often than `/health`.
@@ -0,0 +1,142 @@
1
+ # Release
2
+
3
+ How one deployment's kernel is released and migrated: migration ownership under a lease, module migrations on their owner's own session with the hardening after them, schema snapshots, security drift, client/server version skew, and the deployment topologies the kernel supports.
4
+
5
+ - Kind: kernel service. Version 1.1.0 (1.1.0 adds `SetupReport.repaired` and `ReleaseStatus.insecure`).
6
+ - Schema: [`packages/contracts/schema/contracts/Release.json`](../../packages/contracts/schema/contracts/Release.json) (source [`Release.ts`](../../packages/contracts/src/contracts/Release.ts)); `ClientOutdated` is in the standard error set ([`Errors.ts`](../../packages/contracts/src/Errors.ts)).
7
+ - Implementation: [`packages/kernel/src/Release.ts`](../../packages/kernel/src/Release.ts) (lease, migrate-and-harden, snapshots, the `Release` service), `setup` in [`Server.ts`](../../packages/kernel/src/Server.ts), bootstrap, owner sessions (`connectOwner`), closing (`closeModule`), hardening, role hygiene and the security state in [`db/Bootstrap.ts`](../../packages/kernel/src/db/Bootstrap.ts), the migration preflight in [`db/MigrationCheck.ts`](../../packages/kernel/src/db/MigrationCheck.ts), the version check in [`Invocation.ts`](../../packages/kernel/src/Invocation.ts). Tables `eloxiv.module_migration`, `eloxiv.release_lease`, `eloxiv.release_history`, `eloxiv.schema_snapshot`, and `eloxiv.module_hardening` (each module's hardening fingerprint and security state, kernel migration `0026_hardening_state`); the function `eloxiv_setup.record_migration` (kernel migration `0025_owner_migrations`), through which an owner session records its module's migrations.
8
+ - Kit: `@eloxiv/testing/conformance/Release` ([source](../../packages/testing/src/conformance/Release.ts)), with its fixture modules `stage` and `drift` ([`fixture/release`](../../packages/testing/src/conformance/fixture/release)).
9
+
10
+ ## Operations
11
+
12
+ | Operation | Input | Output | What it does |
13
+ | --- | --- | --- | --- |
14
+ | `setup` | `{ owner?, waitMs? }` | `SetupReport` | Bootstrap and restore the module roles, take the lease, migrate each module on a session logged in as its owner, then in one transaction apply Better Auth's and the kernel's migrations and harden every module, repairing security drift; record snapshots and history; release the lease (guarantee 2). `repaired` lists the modules whose security state or roles had drifted and were restored. Fails with `ReleaseLeaseHeld` or `MigrationFailed` |
15
+ | `status` | `{}` | `ReleaseStatus` | `pending` migrations this build ships that the database has not applied (`<module>/<migration>`), `drifted` modules (the live schema differs from the recorded snapshot), `unrecorded` modules (never set up), `insecure` modules (security drift: the security state differs from what their last hardening left, including a module left closed by a failed setup) |
16
+ | `snapshots` | `{}` | `SchemaSnapshotRecord[]` | The snapshot fingerprint setup recorded per module, with the migrations it covered |
17
+ | `info` | `{}` | `ReleaseInfo` | What `GET /release` advertises: `kernelVersion`, `appVersion`, `minClientVersion`, each module's contract version and recorded schema fingerprint |
18
+ | `lease` | `{}` | `ReleaseLease` or null | Who holds the migration lease now |
19
+ | `history` | `{}` | `ReleaseRecord[]` | Every finished setup: owner, start and finish (database time), outcome, error, migrations applied |
20
+
21
+ In the kernel, `setup(app, options)` (run by `server/main.ts setup` through `runSetup`) is the operation, and the `Release` service (`status`, `snapshots`, `info`, `lease`, `history`) runs inside every kernel. `GET /release` is unauthenticated: it reveals versions and fingerprints, nothing about data.
22
+
23
+ ### Errors
24
+
25
+ - **`ReleaseLeaseHeld`** `{ message, owner, acquiredAt, expiresAt }`: another setup holds the lease and did not release it within `waitMs` (default 120 s), or its lease expired while its session still holds the lock (a stuck setup; the message gives its backend pid). Nothing was changed.
26
+ - **`MigrationFailed`** `{ message, module, migration }`: a migration failed (`migration` names it, `module` is `eloxiv` for the kernel's own and `auth` for Better Auth's), a migration is refused by the preflight or is not declared as it must be, the checks or the hardening refused what the migrations left (`migration` is null), security drift that hardening cannot restore (`migration` is null), or the lease was lost. What the failure leaves is in guarantee 2.
27
+ - **`ClientOutdated`** `{ message, action, clientVersion, minClientVersion }` (HTTP 426), on every surface: an invocation that writes, from a client older than the minimum.
28
+
29
+ ## Guarantees
30
+
31
+ 1. **One setup at a time, and its work never outlives its lease.** Setup holds a session-level PostgreSQL advisory lock on the app's database for its whole run, and records itself in `eloxiv.release_lease` (owner, backend pid, acquired, expires). Everything setup does in the database itself after taking the lock (bootstrap, Better Auth's, the kernel's and Effect cluster's migrations, hardening, snapshots, history) runs on that one session, which never reconnects: if it is lost (for example terminated as a stuck setup), its transaction ends with it, before another setup can take the lock, and every later statement of the first setup fails. Every transaction on it, and every non-transactional migration, first checks that the session still holds the lock and is the recorded holder. A module's migrations run on an owner session of their own (guarantee 2), which checks, just before it commits, that the lease session's backend (its pid, passed from the lease) still holds the lock; and a setup that takes the lock first ends every session left in the database that logged in as an owner role (an owner role logs in only while a setup connects it, so each is a setup's; matched by role, since a migration can change its application name) and waits for them to go, before it records itself. So an owner transaction commits only if the lease session held the lock just before (a commit already sent when the lease is lost is the one race, and what it commits is closed and recorded, so the next setup carries on from it), and once a second setup holds the lease, no migration transaction of the first is still running. The expiry is renewed every third of its time to live (30 s by default) from a second connection, only while the holder's session is alive and still recorded. A second setup waits, polling, up to `waitMs`, then fails with `ReleaseLeaseHeld` naming the holder. A lock whose recorded lease has expired belongs to a stuck setup: the waiter reports it at once instead of waiting. The lock is released with its session, so a setup that crashes never blocks the next. The cluster-wide steps before the lease (roles, `CREATE DATABASE`) are idempotent and serialised by their own advisory locks.
32
+ 2. **Module migrations run as their owner, and never open a module unhardened.** A module's migrations are not trusted with more than its owner role (agent-made MAKE modules use the same manifest and migrations), so they never run on setup's own session (a superuser's, or the setup role's on a managed host: [Database hosts](#database-hosts)). Each module with pending migrations gets a connection that logs in as its owner role: under the cluster's role lock (and that role's own login lock, which `status` reads), setup checks the role is still plain, gives it LOGIN and a fresh random password held only in memory, connects, and removes both again before releasing the lock (a failure to remove them fails the setup; the next setup removes them before anything logs in), so nothing else can log in as it with a password and no credential is stored. The password never leaves the process: setup sends PostgreSQL a SCRAM-SHA-256 verifier it computes itself (`ALTER ROLE ... PASSWORD 'SCRAM-SHA-256$...'`), in a statement it does not trace (a host that takes only plaintext passwords gets the password itself: [Database hosts](#database-hosts)). On that session there is no more privileged role to return to: `RESET ROLE`, `set_config('role', 'none', ...)` (directly, in a `DO` block or in a function the migration creates) and `SET SESSION AUTHORIZATION` all end at the owner. Module roles may not create temporary objects (`TEMPORARY` is revoked from `PUBLIC` on the database), and before anything runs every migration is parsed with PostgreSQL's own grammar (libpg-query, PostgreSQL 17), refusing transaction control (`BEGIN`, `START TRANSACTION`, `COMMIT`, `END`, `ROLLBACK`, `ABORT`, `SAVEPOINT`, `RELEASE`, `ROLLBACK TO`, `PREPARE TRANSACTION`, `COMMIT`/`ROLLBACK PREPARED`, `SET TRANSACTION`), changes of role or session (`SET`/`RESET ROLE`, `SET SESSION AUTHORIZATION`, `RESET ALL`, `DISCARD`) and SQL that does not parse, naming the module and migration; after each migration the owner session must still be in the same transaction (`txid_current()`) as the owner role. Setup runs in these steps, under the lease:
33
+ 0. on setup's session, committed, after checking the kernel's own schemas are as the last setup left them (guarantee 5): each module's schema (empty until its migrations run, owned by its owner role, closed to everyone else; a schema that exists already but belongs to anyone else is never taken over, setup fails instead), anything the module's roles were given outside it revoked (privileges in the kernel's and Better Auth's schemas, `CREATE` and `TEMPORARY` on the database, per-role settings), and the migration plan: each module's pending migrations, the only names its owner session may record (`eloxiv_setup.record_migration` records a name once, for the module whose owner the session logged in as, and refuses any other, such as a `9999_future` that would make a later version skip it, and records only the migration setup is applying now, which setup marks before each one, so a migration cannot record a later one of its own module either);
34
+ 1. for each module with pending migrations, one after another, on its owner session, in that session's own transaction: its published views dropped, each pending migration, recorded in the same transaction, then the module **closed** (row-level security enabled and forced on every table with every policy dropped, every privilege on the schema itself and on its tables, views, sequences, functions and procedures revoked from everyone but the owner, the runtime role included, every trigger enabled), checked for unsafe objects (guarantee 5), its views created and checked, and the lease confirmed; anything refused rolls the module's whole transaction back;
35
+ 2. on setup's session, in one transaction: Better Auth's pending migrations (read through Better Auth's own migration planner, applied as the kernel role), the kernel's migrations (as the kernel role) and Effect cluster's storage migrations, then the hardening of every module (unsafe objects checked again, on a connection no migration touched; privileges, generated row-level security policies, write-log and key-guard triggers; the security state compared, repaired and recorded; the module roles held to their fixed state), the published views (granted, and checked again for the modules just migrated, before each module's state is recorded), the sync publication, the schema snapshots and the kernel's security state.
36
+
37
+ Statements run one at a time (each migration file's statements split with PostgreSQL's grammar). In a database zero-cache replicates, its DDL event triggers would run as the owner or kernel role and fail on zero-cache's own schema, so setup disables them for its run and enables its own instead, `eloxiv_setup_announce_ddl` (`ddl_command_end`, the command tags zero-cache's trigger handles), whose function runs as the setup role (a superuser, or on a managed host its administrative role) and does what zero-cache's trigger would have done, at each command's real position: inside a `DO` block, a function or a trigger fired by a write too, so zero-cache learns of each new table and column before any row written under it. It takes zero-cache's DDL serialisation lock first, as zero-cache's trigger does, and refuses a shard schema, or `update_schemas` function, that a trusted owner (a superuser or the setup role) does not own (setup refuses such a database before anything runs). When setup ends, however it ends, it disables its trigger and enables zero-cache's again on a fresh connection (the lease session may be the one that was lost), logging any failure; the next setup does it too, and `status` reports zero-cache's triggers disabled while no setup holds the lease (`insecure` names `zero-cache`). See [`db/ZeroDdl.ts`](../../packages/kernel/src/db/ZeroDdl.ts) and the evidence in [spikes/sync-and-rpc.md](../spikes/sync-and-rpc.md).
38
+
39
+ Every check reads the catalogue by qualified names (`pg_catalog.pg_cast`) with `pg_temp` last on the search path, so nothing in a session can shadow what it reads.
40
+
41
+ **What holds when setup fails.** Step 1 cannot be part of step 2's transaction: it runs on other sessions, and step 2 must see what step 1 committed to check and harden it. So each module's step 1 commits before step 2, and step 2 does no DDL until every step 1 has committed: an event trigger that serialises DDL (zero-cache's takes a transaction-level advisory lock on every `CREATE` or `ALTER TABLE`) would otherwise make an owner session wait for setup's own open transaction. Precisely:
42
+ - a migration the preflight refuses, or a failure in step 0, changes nothing (step 0 changes nothing a runtime role can reach: an empty, closed schema);
43
+ - a failure in a module's step 1 leaves that module exactly as it was, and nothing of step 2 applied (Better Auth's and the kernel's migrations included, also on a fresh database). Modules whose step 1 committed earlier in the same setup stay migrated and closed until a setup succeeds;
44
+ - a failure in step 2 (a kernel or Better Auth migration, a recheck that disagrees, a hardening statement, a lost lease, a crash) rolls step 2 back and leaves every module migrated in this setup applied, recorded and closed: row-level security forced with no policy, no privilege for anyone but the owner role (which cannot log in), no published view. Its runtime role reads and writes nothing; `status` reports it `insecure` and Readiness not ready, until a setup succeeds and hardens it.
45
+
46
+ At no time can a module's runtime role reach a table that migrations changed but hardening has not covered: the owner transaction that changes it also closes it, and only step 2's hardening, committed atomically with the recheck, opens it. The price: between a module's step 1 commit and step 2's commit (normally well under a second) the module is closed to running kernels as well, so their calls into it fail rather than see unhardened data. When no module migration is pending, step 2 is the only transaction. Every failure is recorded in the history.
47
+ 3. **Non-transactional migrations are declared.** A module migration whose first line is `-- eloxiv:no-transaction` runs outside the transaction: after the round holding every migration before it has committed (with its hardening), on its own, statement by statement on the module's owner session (after the same lease check), and is recorded once all its statements succeed; a further round then applies the migrations after it and hardens again. Such a migration may hold only `CREATE [UNIQUE] INDEX CONCURRENTLY`, `DROP INDEX CONCURRENTLY` and `REINDEX ... CONCURRENTLY`. An undeclared migration with a statement PostgreSQL refuses in a transaction (anything `CONCURRENTLY`, `VACUUM`, `ALTER SYSTEM`, database, tablespace or subscription DDL, `REINDEX SYSTEM`/`DATABASE`, `CLUSTER` without a table), or a declared one with anything else, fails setup before anything runs. Both are decided from the parse tree, not the text.
48
+ 4. **Schema snapshots.** After hardening, setup describes each module's schema (and the kernel's: `eloxiv`, `eloxiv_ctx`, `eloxiv_setup`, `eloxiv_cluster`) from the catalogue: relations with columns, owners and sorted privileges, constraints, indexes, views, triggers, policies and functions, with no object ids, and records it with its sha256 fingerprint and the migrations it covers. The same migrations give the same snapshot whether a database was built from scratch or upgraded step by step. `status` reports a schema changed outside setup as drifted.
49
+ 5. **Unsafe objects are refused, and security drift is repaired, never recorded.** On the owner session and again on setup's session, setup refuses what would escape row-level security in a module schema: deferred or constraint triggers, `BEFORE UPDATE` row triggers other than the kernel's key guard, `SECURITY DEFINER` functions, rules, materialised views, views that are not `security_invoker`, foreign tables, foreign keys whose referential actions rewrite rows, casts to or from the module's types or through its functions, base types with their own I/O; and beyond the schema, event triggers calling a function in the module's schema or owned by its roles, and default privileges in its schema or for its roles (other software's event triggers, zero-cache's, are not affected). With each module's hardening, setup records the module's security state from the catalogue: the schema's and every relation's owner and privileges (column privileges included), row-level security enabled and forced, every policy (roles, command, expressions), every trigger and whether it is enabled, every function's owner, privileges, `SECURITY DEFINER`, body (hashed) and settings (`proconfig`), what the runtime role may use of `eloxiv_ctx`, the module's two roles' attributes and memberships in both directions, and the event triggers and default privileges that touch the module's schema or roles. Every setup compares the live state with it, even when nothing else changed (one catalogue query per module; no DDL when nothing drifted). If the state drifted, setup hardens the module again (it also revokes every privilege held by anyone but the owner and the runtime role, and re-enables its triggers) and reports it in `repaired`; if hardening cannot restore the recorded state (an object it does not manage changed: an owner, a trigger, a function), setup fails with `MigrationFailed` and changes nothing. **Role hygiene:** the module's roles are held to fixed values on every setup, whatever was recorded: no `SUPERUSER`, `BYPASSRLS`, `CREATEROLE`, `CREATEDB` or `REPLICATION`, no password, no `LOGIN` (`MODULE_ROLE_LOGIN`: the runtime role never logs in; the owner role only for the moment setup connects its migration session, under the cluster's role lock), and exactly one membership, the kernel role's in the runtime role (`INHERIT FALSE, SET TRUE`). Before the lease, under the role lock, setup restores all of it (`ALTER ROLE`, `REVOKE ... GRANTED BY`, `GRANT`) before any session logs in as the owner, and again in step 2's transaction (all but the owner's `LOGIN`, which only the role lock may change, since another database's setup may be connecting the same owner role); repairs are reported in `repaired`. The owner role's `LOGIN` is therefore not part of the recorded state. The module's state also records what its roles may do outside its schema, all held to nothing: privileges in the kernel's and Better Auth's schemas beyond what setup gives (the runtime role's use of `eloxiv_ctx`, the owner role's of `record_migration` and `announce_schema`), `CREATE` and `TEMPORARY` on the database (a temporary object would shadow the catalogue in the owner's session), and per-role settings (`ALTER ROLE ... SET`); setup revokes or resets them before any owner session connects (step 0) and reports the module in `repaired`. Its published views are recorded with it, so a module with views is not re-hardened on every setup. `status` also reports a module whose owner role can log in while no setup is connecting it (it reads the role's login lock). **The kernel's own schemas** (`eloxiv`, `eloxiv_ctx`, `eloxiv_setup`, `eloxiv_cluster`, and Better Auth's `auth`) are checked the same way against the state the last setup recorded, kept in `eloxiv_release.kernel_state`, which only the setup role can write (the kernel role reads it), with the host's profile (which protections setup applied): owners and privileges of anyone but module roles on schemas, relations, columns and routines, row-level security, every view's definition, every routine's body (hashed), settings and `SECURITY DEFINER`, every trigger on their tables, default privileges in them or of the kernel role, and that PUBLIC still may not run the catalogue functions setup revokes (below). Nothing but setup changes them, so a difference is refused before setup changes anything, naming each object, and is never recorded as the expected state; `status` reports it as `insecure` module `eloxiv`. A database that was set up before but has no record, or one in another format, is refused the same way: an operator who has checked the kernel's schemas re-baselines (setup's `rebaselineKernelState`, or `ELOXIV_SETUP_REBASELINE=1`), and setup records them as they are, logging what differed. **Catalogue functions:** PostgreSQL lets every role run some functions that no module needs and that reach beyond the module; setup revokes them from PUBLIC in the app's database (`REVOKED_CATALOG_FUNCTIONS`): `pg_logical_emit_message` (both forms; a forged `<app>/<shard>/ddl` message made zero-cache drop a kernel table from every replica) and the large-object constructors `lo_create`, `lo_creat` and `lo_from_bytea` (data stored outside the module's schema escapes its row-level security, hardening and snapshot). `status` reports drifted security as `insecure`, and [Readiness](readiness.md) as not ready.
50
+ 6. **Version skew.** The kernel advertises `kernelVersion`, the app's `appVersion` and `minClientVersion` at `GET /release`. A client sends its version as `x-eloxiv-client-version` (the client SDK's `clientVersion` option). On MCP, an Eloxiv client (its MCP `initialize` names it `clientInfo.name` `eloxiv:<app or package>`, `MCP_CLIENT_NAME_PREFIX`) may instead declare it as `clientInfo.version`: the kernel uses it for that session's calls that send no header (the header wins). Other MCP clients' `clientInfo.version` is their own product's version and is ignored. An invocation of an action that is not `readOnly`, from a client whose version is older than `minClientVersion` (or is not a version), is refused with `ClientOutdated` before anything else runs, and audited as `denied`. Reads keep working: sync queries and read-only actions are not gated. Versions compare numerically by dot-separated parts; a prerelease is older than its release.
51
+
52
+ `KernelApp.release` declares `{ version, minClientVersion }`; `ELOXIV_APP_VERSION` and `ELOXIV_MIN_CLIENT_VERSION` override them at deployment. Without a minimum, nothing is refused.
53
+
54
+ ## Deployment topologies
55
+
56
+ | Topology | What it is | What Release guarantees |
57
+ | --- | --- | --- |
58
+ | **Single process** | One kernel process (`server/main.ts`) with PostgreSQL; `setup` (or `prepare`) before it starts | Everything above. Run setup before starting the new version: a kernel started against a database with pending migrations reports not ready ([Readiness](readiness.md)) |
59
+ | **Several kernel processes, one PostgreSQL** | Any number of kernels behind a load balancer, each a cluster runner (unique `ELOXIV_RUNNER_HOST`/`ELOXIV_RUNNER_PORT`) and an outbox dispatcher, on one database | One setup at a time however many processes or deploy jobs run it (the lease). Running kernels see a module either with its old schema and hardening, or closed (while its migrations are committed and step 2 has not, guarantee 2), or with its new schema and hardening; never migrated and open. Rolling deploys: run setup once, then replace kernels; migrations must stay compatible with the previous kernel version until every process runs the new one, and raising `minClientVersion` refuses writes from tabs built for the old schema while their reads keep working. Outbox dispatchers share work (`FOR UPDATE SKIP LOCKED`); cluster shards are spread over runners |
60
+ | **zero-cache placement** | zero-cache (Node only) next to the kernel or as its own service, replicating from the same PostgreSQL through the `eloxiv_sync` publication, calling the kernel's `/zero/query` | Setup changes the publication only when the set of module schemas changes, in step 2's transaction, so zero-cache sees one publication change per release. zero-cache must reach the kernel's query endpoint (any kernel process) and PostgreSQL's replication; with several zero-cache replicas keep lag reporting on. Replicas follow the organisation each client acts in; clients older than the minimum still sync |
61
+
62
+ ### Under a base path
63
+
64
+ A kernel can serve under a path of its host (`https://app.example/eloxiv`) rather than at its root ([`BasePath.ts`](../../packages/kernel/src/BasePath.ts), ledger A-001):
65
+
66
+ - **`ELOXIV_BASE_URL` carries the path.** It is the URL clients use, and every absolute URL the kernel hands out is built from it: OAuth's issuer, endpoints and resources (`<base>/mcp`, `<base>/api`), the MCP challenge's `resource_metadata`, file part and download URLs, unsubscribe links, Connection callbacks, device pairing links. Paths it returns to clients (`make.view`'s `url`) are relative to it.
67
+ - **`ELOXIV_MOUNT_PATH`** is where requests arrive: by default the base URL's path, so the kernel itself serves under `/eloxiv`, and a request outside it reaches no route (`404`). Behind a proxy that strips the prefix, set it to `/`. Every route, guard and inventory sees the path without it.
68
+ - **Better Auth** routes `<base>/auth/*` (its base URL is `<ELOXIV_BASE_URL>/auth`); its cookies stay host-wide.
69
+ - **OAuth discovery**: the documents are served at `<base>/.well-known/...`, and also at the RFC 8414 and RFC 9728 places, the path after the well-known segment at the origin's root (`/.well-known/oauth-authorization-server/eloxiv`, `/.well-known/oauth-protected-resource/eloxiv/mcp`), which MCP clients look for. When a proxy fronts the kernel, route those to it too. The kernel's sign-in, consent and device pages post to and redirect under the base path.
70
+ - **zero-cache** calls `<ELOXIV_BASE_URL>/zero/query` and `/zero/mutate`; configure its URLs with the path.
71
+ - **Clients**: the client SDK's `baseUrl`, the CLI's `--url` and the shell's `VITE_ELOXIV_URL` are the base URL with its path and no trailing slash. Serving the shell itself under a sub-path is Vite's `base`, independent of the kernel's.
72
+
73
+ At root (the default) nothing changes. `packages/testing/test/base-path.test.ts` runs every surface under `/eloxiv`, nothing outside it, and the edge's rewrite for root, mounted and proxy-stripped deployments.
74
+
75
+ Setup also connects to the app's database as each module's owner role, at the admin URL's host and port with a one-time password. **Requirement:** the host must accept password logins (`scram-sha-256`) for the `eloxiv_own_*` roles from where setup runs, and nothing may let them in by anything but their password (`trust`, `peer`, `ident`, `cert`, `gss`, `sspi`, `ldap`, `pam`, `radius`, `bsd`, anything else): while setup lets an owner role log in, such a rule would let any process that can connect that way log in as it. Where setup can read `pg_hba.conf`'s rules (`pg_hba_file_rules`, a superuser's cluster) it checks them before each login window: with `ELOXIV_ENV=production` it refuses such a rule, naming its line; otherwise (local clusters trust local connections) it warns; `md5` and `password` still need the password but are weaker: setup warns about them. Where it cannot (a managed host), it tests the window instead, over the live connection: while the owner role can log in, setup tries to log in as it with a wrong password, from where setup runs, and a login that succeeds is refused in production and warned about otherwise. That proves what it can: the rules that apply to setup's own address and method. Rules for other addresses (another network, a Unix socket) cannot be seen from there and remain the operator's to keep, as this requirement says. Where the host accepts a SCRAM verifier as a password, only the verifier reaches the server, so a server that logs every statement logs no password.
76
+
77
+ ### Database hosts
78
+
79
+ Setup runs as the role in `ELOXIV_ADMIN_DATABASE_URL`, the **setup role**. On a cluster the operator controls it is a superuser and everything above applies as written. A managed host (Neon, among others) has no superuser for its customers: its most privileged role is an ordinary role. Setup works with that role, without weakening any guarantee for untrusted code ([`db/Host.ts`](../../packages/kernel/src/db/Host.ts)):
80
+
81
+ - **What setup requires** of a setup role that is no superuser, refusing to start without it, before it changes anything: `CREATEROLE`, `CREATEDB`, `BYPASSRLS`, and reading `pg_authid` (whether a role has a password; `pg_read_all_data` gives it). Neon's `neondb_owner` has all four.
82
+ - **What setup detects**, on the admin connection, before anything changes: whether the host lets it revoke catalogue functions from PUBLIC, create event triggers (tried in a rolled-back transaction), store a SCRAM verifier as a role's password (tried on a throwaway role, unless `ELOXIV_DATABASE_ROLE_PASSWORDS` says; see below), read `pg_hba.conf`'s rules, and create schema-wide publications (a superuser only). It keeps every protection the host allows and records which it applied with the kernel's security state (`host` in `eloxiv_release.kernel_state`). A later setup on a host that allows less than the one recorded, or that runs as another setup role, is refused like any other kernel drift, until an operator re-baselines knowingly (`ELOXIV_SETUP_REBASELINE=1`): a protection never goes away quietly, for example when a database moves to another host.
83
+ - **The trusted owner.** What a superuser owned before, the setup role owns: setup's `SECURITY DEFINER` functions in `eloxiv_setup` (zero-cache's announcements and sync's push bookkeeping), its event trigger, and the kernel's recorded state (`eloxiv_release`). Where setup checked that something was a superuser's, it now checks that it is a **trusted owner's**: a superuser or the setup role, which could run that code itself with the same privileges, so running it confers nothing. zero-cache's shard schema and its `update_schemas` functions must be a trusted owner's for setup to run them (so on a managed host zero-cache runs as the setup role, as on Neon where it runs as `neondb_owner`); setup's own objects above must be a trusted owner's, or setup refuses to start (even when re-baselined). The trust rests on two checks, under the role lock, before setup changes any role: none of the kernel, query, platform and module roles is a member of the setup role, directly or not; and the kernel role is not the setup role, has no `SUPERUSER`, `CREATEROLE`, `CREATEDB` or `REPLICATION`, and is a member of no privileged role (one with those attributes or `BYPASSRLS`, a predefined `pg_*` role, the setup role), directly or through another role. A role created in Neon's console is a member of `neon_superuser` and is refused as the kernel role: create the kernel role through SQL, or let setup create it.
84
+ - **How setup acts as the roles it created.** Without a superuser, PostgreSQL lets setup act on an object only as its owner. Setup's role is therefore made a member of the kernel, platform-read and modules' roles it creates (`INHERIT TRUE, SET TRUE`; PostgreSQL also makes it a member with `ADMIN OPTION`, which it cannot revoke). The membership goes one way: those roles gain nothing from it, role hygiene accepts it (and only it, besides the kernel's in the runtime role), and the check above forbids the other direction. Giving a view or function to the runtime or platform role, which PostgreSQL allows a non-superuser only while the new owner may create in the schema, grants `CREATE` for that statement and revokes it in the same transaction.
85
+
86
+ | Protection | Where the host allows it | Where it does not (Neon, as of PostgreSQL 17.11, 2026-11-09) |
87
+ | --- | --- | --- |
88
+ | Catalogue functions revoked from PUBLIC (`REVOKED_CATALOG_FUNCTIONS`) | Revoked, the revocation verified (PostgreSQL only warns when a `REVOKE` revokes nothing), held as kernel state | PUBLIC keeps `EXECUTE` (the bootstrap superuser owns them). The only SQL a module role runs that the app did not write is MAKE's, and MAKE's SQL guard (an allowlist of statements and functions) and migration rules (only `CREATE TABLE`, `ADD COLUMN`, `CREATE INDEX`, a five-function allowlist in defaults) admit none of them; registry modules are trusted app code |
89
+ | Setup's own event trigger, announcing its DDL to zero-cache at each command's position | As above | Neon allows event triggers, so this applies there. A host that allows none (the local emulation, vanilla PostgreSQL) gets no trigger from setup, and zero-cache installs none either: it resets its replica on a schema change (a full resync of the replica and its clients; `zero-upgrade.test.ts` proves it on the emulation: zero-cache gives up its replica on the migration and, started again, serves the upgraded schema). Availability degrades, not access. Setup refuses a database whose zero-cache triggers it could not pause |
90
+ | SCRAM verifier as the owner's one-time password and MAKE roles' passwords | Only the verifier reaches the server | Neon takes only plaintext passwords ("Neon only supports being given plaintext passwords"). **Setup refuses to start** on such a host until the operator chooses plaintext (`ELOXIV_DATABASE_ROLE_PASSWORDS=plaintext`), and records the choice with the host's profile. What the choice means, below the table |
91
+ | `pg_hba.conf`'s rules for owner roles checked | Checked before each login window | Not readable (Neon revokes `pg_hba_file_rules`): the window is tested live (a wrong password must be refused); the requirement above stands for what setup cannot see |
92
+ | Sync publication over the modules' schemas | `FOR TABLES IN SCHEMA` | Neon creates but does not alter a schema publication without a superuser: the publication lists every table of the synced modules' schemas, as each setup leaves them; a table a migration creates joins it where it is created, through setup's event trigger, before its rows are written, so zero-cache follows it in order as it would a schema publication (added only after its rows, zero-cache had to backfill it, and refused a client meanwhile: found on Neon) |
93
+ | Owner session with no stored credential, no more privileged role to return to, the module closed until hardened | Applies | Applies unchanged: the owner role is still plain, logs in only for the moment setup connects it, and its session has no other role to reach |
94
+
95
+ **Plaintext role passwords: what an operator accepts.** Two kinds of password reach the server as text, over the setup connection (TLS), and from there whatever records statements: the host's `pg_stat_statements` (Neon keeps the statement's text), statement logs, and anything those are exported to.
96
+
97
+ - **Each module owner role's one-time password**, sent whenever setup migrates the module. Setup removes the owner's login and password before it lets go of the role lock, so a password read afterwards lets no one in.
98
+ - **Each MAKE module's runtime-role password, which is persistent.** It is derived from `ELOXIV_MAKE_ROLE_KEY` and the role's name, and kernels log in with it for every MAKE call. Closing the owner's window does nothing to it: whoever reads it can log in as that runtime role until the password changes. That includes roles that may read statement statistics (`pg_read_all_stats`, through `pg_monitor`) without administering roles, and whoever can read exported logs. The role reaches only its module's own tables, under row-level security that reads an invocation context only the kernel writes, so a direct login sees none of its rows (`make-sandbox.test.ts`), but it is a login all the same. To limit the exposure, setup sends a MAKE password only when the role does not already log in with it (a first install, or a new key), not on every setup.
99
+ - **Rotating MAKE passwords:** set a new `ELOXIV_MAKE_ROLE_KEY`, run setup (it sets every MAKE role's new password), then restart the kernels with the new key. Then clear what recorded the old text where you can: `SELECT pg_stat_statements_reset()` (on Neon, a role with `neon_superuser`), and the retention of exported logs.
100
+
101
+ On a host that takes SCRAM verifiers none of this applies: only the verifier reaches the server.
102
+
103
+ **Neon, in practice:** enable logical replication on the project; set `ELOXIV_DATABASE_ROLE_PASSWORDS=plaintext` once you accept the plaintext row above; point `ELOXIV_ADMIN_DATABASE_URL` at `neondb_owner` on the **direct** (not pooled) endpoint, with an explicit port (`:5432`; clients otherwise take `PGPORT` from the environment), since setup's lease and owner sessions need sessions of their own; let setup create the kernel role (`ELOXIV_DATABASE_URL` names a role that does not exist yet, with a password Neon accepts); run zero-cache as `neondb_owner` on the direct endpoint too. Neon's proxy drops every startup parameter it does not know, silently, and keeps `options`: the kernel therefore starts sessions that need settings (Effect cluster's search path; a MAKE session's search path and time limits) with `options=-c ...` ([`db/Startup.ts`](../../packages/kernel/src/db/Startup.ts)), and refuses a MAKE session that did not get its settings. zero-cache's `TimeZone=UTC` in its URL is such a parameter and is dropped there; Neon's sessions are in GMT already. Neon's control plane records each role setup creates (owner roles, kernel and module roles appear in the console). On Neon, `CREATE EVENT TRIGGER` also updates the creating role's own `pg_authid` row (measured: no other event-trigger, role or publication statement does), so two transactions creating an event trigger as `neondb_owner`, in any two of the project's databases, collide: the later waits for the earlier and fails with `tuple concurrently updated` (SQLSTATE `XX000`) once it commits. zero-cache creates its DDL triggers as that role, and another app's setup creates its own; setup's event-trigger probe (always rolled back) and the transaction that installs its trigger (which replaces what it creates) therefore run again on exactly that failure, a few times (`retryConcurrentCatalogUpdate`, [`db/SqlState.ts`](../../packages/kernel/src/db/SqlState.ts)). The CI job `live postgres (neon)` runs `packages/testing/test/managed-postgres.test.ts`, `setup.test.ts`, zero-cache's upgrade test (`zero-upgrade.test.ts`, with Neon's event triggers) and MAKE's lifecycle (`make-lifecycle.test.ts`) against a fresh Neon branch.
104
+
105
+ Not supported: several databases per app, PostgreSQL connection poolers in transaction mode for setup's connections (session advisory locks need a session; point the admin URL at PostgreSQL directly), and hosts without long-running processes.
106
+
107
+ ## How an implementation is checked
108
+
109
+ `releaseConformance(start)` registers, with a subject that sets up fresh databases and serves the conformance fixture app with a minimum client version:
110
+
111
+ - setup applies pending migrations with their hardening (a table added by an upgrade is hardened as it commits), records the snapshot, and changes nothing the second time;
112
+ - **a migration that fails halfway** (`stage.broken`: its first statement succeeds, its second fails) leaves the module's schema, its privileges, policies, triggers and functions, what is pending and the recorded snapshots exactly as before; the failure names the module and migration and is in the history; the database still upgrades afterwards;
113
+ - **hardening that refuses** what a migration left (`stage.rogue`, a `SECURITY DEFINER` function) leaves everything exactly as before;
114
+ - **a migration that would `COMMIT` setup's transaction** (`stage.escape`: `CREATE TABLE`, `COMMIT`, then a failing statement) is refused before anything runs, naming transaction control; no table is left behind;
115
+ - **module identity** (`module-identity.test.ts`, in the kernel's own tests): a schema of PostgreSQL, Better Auth or the kernel, a module name `eloxiv`/`eloxiv_*`/`pg_*` or too long for its roles, two modules sharing a schema, and an entity outside its module's schema are refused before setup runs; an existing schema owned by someone else is never taken over; an owner session cannot record a migration its module does not ship;
116
+ - **a failure after a module's migrations committed** (`stage.misnamed`: a migration renames the column the generated policies filter on, so the hardening in step 2 fails) leaves the migration applied and recorded and the module closed (forced row-level security, no policy, no grantee but the owner, no view): its runtime role is denied every read and write, holds nothing at all on the schema (not the `USAGE` and `CREATE` the migration granted it), on its relations or on its routines (not the procedure the migration granted it), and `status` reports it `insecure`; the next setup that succeeds (`stage.renamed`) reopens it under its policies, without that `CREATE` or procedure;
117
+ - an undeclared `CREATE INDEX CONCURRENTLY` fails before anything runs, naming the declaration; a declared one runs on its own between the transactions around it, and the index is valid;
118
+ - **two concurrent setups serialise**: both succeed, one applies the migrations, the other applies nothing, and the second started after the first finished;
119
+ - a setup waits for a held lease and then fails with `ReleaseLeaseHeld` naming the holder; a waiting setup proceeds once the lease is released; a stuck holder (expired lease, lock still held) is reported at once;
120
+ - a database built from scratch and one upgraded step by step record the same snapshot fingerprints (the module's and the kernel's); a schema changed outside setup is reported as drifted;
121
+ - **security drift** (row-level security disabled or no longer forced, a policy dropped or a permissive one added, a privilege granted, the write-log trigger disabled) is reported as `insecure`, and the next setup, with nothing else to do, repairs it (`repaired`), leaves the schema exactly as hardened and records the hardened snapshot; a setup with nothing drifted repairs nothing;
122
+ - **role drift** on the fixture module `drift` (its own roles, since role state is cluster-wide): `BYPASSRLS`, `CREATEROLE`/`CREATEDB` or `LOGIN` given to a module role, the runtime role made a member of the owner role or of `pg_read_all_data`, the owner made a member of the runtime role, a kernel table or function or a Better Auth table granted to a module role, `TEMPORARY` and `CREATE` on the database granted to the owner role, a setting on a module role (for every database, or this one), the owner role left able to log in with a password: reported as `insecure`, repaired by the next setup;
123
+ - **kernel drift**: a kernel function's body replaced (`eloxiv_ctx.has_role`) is reported as `insecure` module `eloxiv`, setup refuses it naming the function, and it stays reported;
124
+ - a module with published query views records them with its state: a second setup repairs nothing; a migration that tries to become the superuser in a `DO` block to give the runtime role `BYPASSRLS` and the owner's membership fails (its session has no superuser to become) and leaves neither behind;
125
+ - a module function's body or settings changed, an event trigger calling a function owned by a module role, and default privileges for the owner role are reported as `insecure`, and setup refuses them;
126
+ - `GET /release` advertises the minimum client version; **a stale client's write is refused** with `ClientOutdated` through the typed client (RPC) and HTTP (426), nothing is written, and each refusal is audited as denied, **while its sync query is answered**; current, newer and unversioned clients write; a client version that is not a version is refused.
127
+
128
+ The Eloxiv kernel runs it in `packages/testing/test/release.test.ts`, which also checks that a fresh database records exactly the committed kernel snapshot ([`packages/kernel/src/db/schema.snapshot.json`](../../packages/kernel/src/db/schema.snapshot.json)) and that kernel migrations 0024 to 0026 change nothing when they run again under other recorded names; `registry/test/schema-snapshots.test.ts` does the same for the registry's modules (`registry/test/__snapshots__/`). After adding a migration, regenerate them with `vitest -u` and review the diff. `packages/testing/test/release-atomic.test.ts` is the backlog 11 reproduction, which fails against the earlier setup; it also checks that Better Auth's tables roll back with a fresh database's failed first setup. `packages/testing/test/release-lease-loss.test.ts` terminates the backend the lease records while the first setup's migration is held open on its owner session (`stage.blocking`) and requires that, once a second setup holds the lease, the first one's migration transaction has already ended. `packages/testing/test/migration-session.test.ts` proves that a migration cannot leave its owner role (`RESET ROLE`, `set_config` in a `DO` block or a created function, `SET SESSION AUTHORIZATION`), that the owner role holds nothing privileged and cannot log in after setup, and that temporary shadows of the catalogue blind none of the checks. `packages/kernel/test/migration-check.test.ts` covers the preflight statement by statement. `packages/testing/test/zero-upgrade.test.ts` upgrades a module (a new column and a new table, filled in the same migration), a kernel migration and Better Auth's DDL in a database zero-cache replicates, with zero-cache running and stopped, and requires a syncing client to receive what the migration wrote. `packages/testing/test/zero-ddl.test.ts` checks, against a stand-in shard, that each DDL command (a `DO` block's too) is announced where it happens under zero-cache's DDL lock, that a shard schema a superuser does not own is refused before any of its code runs, and that a setup that lost its lease still enables zero-cache's triggers again (with `status` reporting them while they were left disabled); `zero-upgrade.test.ts` proves the `DO` block live. `catalog-privileges.test.ts` refuses a migration that forges a logical message and holds the revoked functions as kernel state; `kernel-state.test.ts` covers the record's place, a missing record and re-baselining, column and default privileges and view definitions. `packages/testing/test/owner-login.test.ts` requires that no traced statement carries a password, that the SCRAM verifier is PostgreSQL's, and that production refuses a `trust` rule for owner roles. `packages/testing/test/managed-postgres.test.ts` covers [Database hosts](#database-hosts) on every profile: the host's profile recorded and each protection applied exactly where allowed (catalogue functions, setup's event trigger, the publication's form), module roles plain and the owner's window closed; a host that allows less, or another setup role, refused unless re-baselined; a kernel role that is the setup role or a member of `pg_read_all_data` refused; setup's own function given to the kernel role refused even when re-baselined; sync's push refusing a shard the kernel role owns and accepting one the setup role owns; the live test of the owner's window (refused on the local cluster's `trust` rules, passing where passwords are required); MAKE's guard and migration rules refusing every function a host may leave to PUBLIC; a setup role without `CREATEDB`, `BYPASSRLS` and `pg_authid` refused before any database exists. **The managed-host profile:** `tools/scripts/neon-emulate.sh` gives a local PostgreSQL 17 cluster Neon's privilege model (`neondb_owner` with `CREATEROLE`, `CREATEDB`, `REPLICATION`, `BYPASSRLS` and `neon_superuser`'s grants, SCRAM passwords for every role but the bootstrap superuser), and `ELOXIV_TEST_ADMIN_URL` runs the tests, setup and zero-cache as that role, never a superuser; the CI job `managed postgres (emulated)` runs the setup, release, sync, MAKE and privacy suites there on Bun and Node, and `live postgres (neon)` runs against a fresh branch of a real Neon project. What the emulation cannot reproduce (Neon's event triggers for its administrative role, its refusal of SCRAM verifiers) is covered by the real run; tests that stage a scenario only a superuser can (an event trigger, `pg_hba.conf`'s `trust` rules) skip on the emulation, saying why.
129
+
130
+ ## Not yet guaranteed
131
+
132
+ - **Atomicity across a module's migrations and step 2**: they commit in separate transactions (guarantee 2); a failure in between leaves the module closed, not open, until a setup succeeds. Across modules, one module's committed step 1 stays (closed) when a later module's step 1 fails.
133
+ - **Compatibility of a migration with the previous kernel version** during a rolling deploy is the migration author's responsibility; setup does not check it.
134
+ - **Snapshots of the `auth` schema** (Better Auth's) are not recorded.
135
+ - **A failed non-transactional migration** may leave an invalid index behind (PostgreSQL's `CONCURRENTLY` semantics); it is not recorded, so the next setup runs it again, which is why it should start with `DROP INDEX CONCURRENTLY IF EXISTS`.
136
+ - **Clients that send no version** are not gated: an app that wants every client gated must send `clientVersion` from all of them (on MCP, the header or an `eloxiv:` `clientInfo`). An MCP client that is not an Eloxiv client and sends no header is not gated.
137
+ - **Security drift in the kernel's own schemas** (`eloxiv`, `eloxiv_ctx`, `eloxiv_setup`, `eloxiv_cluster`) shows as schema drift only; only module schemas are checked and repaired as security state.
138
+ - **Drift in objects hardening does not manage** (an owner, an extra trigger or function, a function's body or settings, an event trigger, default privileges) is refused, not repaired: an operator undoes it, then runs setup again.
139
+ - **A password given to an owner role outside setup without `LOGIN`** is not reported by `status` (the kernel role cannot read passwords; without `LOGIN` it lets no one in); the next setup removes it before anything logs in as the role, and reports the module in `repaired`. A `LOGIN` is reported.
140
+ - **zero-cache's DDL triggers while setup runs:** they are disabled for setup's run, and setup's own trigger announces all DDL in the database in that time, whoever runs it; DDL by anything but setup is not expected. If setup's process dies before it could enable them again (and the fresh connection that does it with it), they stay disabled until the next setup, and `status` reports `zero-cache`.
141
+ - **What every role may still do in the database:** `NOTIFY` (a statement, not a privilege: any session can notify any channel; the outbox dispatcher's channel only wakes it to look for work, so a spurious notification costs a poll), advisory locks (a migration or handler could take the lease's or the directory's lock and stall setup or directory writes for as long as it runs, no more than a `pg_sleep` could; handlers use them legitimately), `pg_terminate_backend` and `pg_cancel_backend` (only sessions of the same login role: an owner session's own), `set_config` (its own session), and catalogue functions guarded by their own checks (replication slots and origins need `REPLICATION` or superuser; `binary_upgrade_*` only work in binary-upgrade mode).
142
+ - **Module roles are cluster-wide**: a module role serves one kernel role per cluster (setup revokes any other role's membership in it), and two apps on one cluster with a module of the same name share its roles.
@@ -0,0 +1,61 @@
1
+ # ResultRendering
2
+
3
+ How action results and query-view rows are shown to people and to agents, with no UI in the kernel (decisions.md "Kernel contracts"; the ledger's A-114, B-035).
4
+
5
+ - Kind: kernel service. Version 1.1.0 (1.1.0 adds chart, metric, change and file renderers).
6
+ - Schema: [`packages/contracts/schema/contracts/ResultRendering.json`](../../packages/contracts/schema/contracts/ResultRendering.json) (source [`ResultRendering.ts`](../../packages/contracts/src/contracts/ResultRendering.ts); the declarations and pure functions in [`Render.ts`](../../packages/contracts/src/Render.ts)).
7
+ - Implementation: the manifest checks (`renderProblems` in `manifestProblems`), `moduleToJson`, and the agent surface's compact text ([`surfaces/Agent.ts`](../../packages/kernel/src/surfaces/Agent.ts)).
8
+ - Kit: `@eloxiv/testing/conformance/ResultRendering` ([source](../../packages/testing/src/conformance/ResultRendering.ts)).
9
+
10
+ ## Declaring a renderer
11
+
12
+ A module declares a renderer per output schema: `render` on an action (its output) or on a published query view (its rows):
13
+
14
+ ```ts
15
+ defineAction({
16
+ name: "journal.find",
17
+ output: Schema.Struct({ entries: Schema.Array(Entry), total: Schema.Number }),
18
+ render: { kind: "table", title: "Journal", rows: "entries", columns: [{ field: "title" }, { field: "id", label: "Entry", format: "id" }] },
19
+ ...
20
+ })
21
+ ```
22
+
23
+ | Kind | Fields | Shows |
24
+ | --- | --- | --- |
25
+ | `table` | `rows` (the output's list field; omitted: the output is the list), `columns` (`{ field, label?, format? }`), `title?` | one row per record, the named columns only |
26
+ | `card` | `title`, `subtitle?`, `fields` | one record |
27
+ | `list` | `items?`, `title`, `subtitle?` | one line per item |
28
+ | `markdown` | `field` | the field's text |
29
+ | `chart` | `chart` (`bar`, `line`, `pie`), `rows?`, `x` (`{ field, label? }`), `series` (1 to 10 numeric fields), `title?` | one point per record: its `x` as text, each series as a number (null when the value is not one) |
30
+ | `metric` | `label`, `value`, `delta?`, `unit?` | one number that matters (an insight) and how it moved |
31
+ | `change` | `before`, `after`, `title?` | what changed |
32
+ | `file` | `file` (the field holding a Files id), `name?`, `mediaType?` | a file by reference: a UI shows or downloads it only through Files, under its read policy; an `image/*` one (but SVG) as an image |
33
+ | `progress` | `task` (the field holding a Progress task id), `label?` | work in progress: the UI follows the task through the [Progress](progress.md) contract |
34
+
35
+ Formats: `text`, `number`, `date`, `datetime`, `boolean`, `id`, `json`. The kernel checks every renderer against its schema at startup (`renderProblems`): a field the output (or each row) does not have, `rows` or `items` that is not a list of records, or an unknown kind refuses the app. Declared renderers are published in the module's manifest JSON (`render` on the action or query view).
36
+
37
+ ## The headless view
38
+
39
+ `renderResult(declaration, encodedOutput, { maxRows? })` turns an output (as every surface returns it, inside the result envelope) into a `ResultView`: `table` (`columns` with labels and formats, `rows` with only the named fields, `totalRows`, `truncated`), `card`, `list`, `markdown` (`text`, `truncated`), `chart` (`x`, `series`, `points`, `totalPoints`, `truncated`), `metric`, `change`, `file` (`fileId`, `name`), or `json` when no renderer is declared or the output has another shape. A view only selects and labels what the output already holds, so rendering can neither show a caller more than the output nor fail a call. The shell and the chat UI draw views with their own components (registry UI); the kernel has none. The function is in `@eloxiv/contracts`, so the kernel, the client SDK and any UI share it.
40
+
41
+ ## For agents
42
+
43
+ `compactResult(view, { maxChars?, maxRows? })` gives compact text: a markdown table, `Title — subtitle` lines, a card's `label: value` lines, or the markdown, never longer than `maxChars` (default 2,000) and at most `maxRows` rows (default 20), saying how much it left out (`(10 more rows not shown; 30 in all)`, `(cut at 2000 characters of …)`). The kernel's agent tools return it as `rendered` beside the full envelope for every action with a renderer, so the model reads the compact form first.
44
+
45
+ ## Operations
46
+
47
+ | Operation | Where | Input | Output |
48
+ | --- | --- | --- | --- |
49
+ | `describe` | the module's manifest JSON (`render`) | an action or query view | its `RenderDeclaration`, or none |
50
+ | `render` | `renderResult` | a declaration and an encoded output | `ResultView` |
51
+ | `compact` | `compactResult`; the agent tool result's `rendered` | a view and a budget | text |
52
+
53
+ ## How an implementation is checked
54
+
55
+ `resultRenderingConformance(start)` takes a `ServicesSubject` (see [Progress](progress.md#how-an-implementation-is-checked)); `journal.find` declares a table, `journal.summary` markdown, `journal.write` a card. The kit checks: renderers that do not fit (unknown column, a non-list `rows`, an unknown card field, an unknown kind) refused at startup and a fitting one accepted; renderers published in the manifest; the same view from the in-process, HTTP, RPC and MCP envelopes, with only the named fields (the entries' bodies never in it), bounded rows and the total; an output of another shape shown as JSON; the agent tool's compact text with its header, rows, the count of what was left out and no undeclared field, the envelope complete beside it, none for an action without a renderer, and the character budget held. The Eloxiv kernel runs it in [`packages/testing/test/result-rendering.test.ts`](../../packages/testing/test/result-rendering.test.ts).
56
+
57
+ ## Not yet guaranteed
58
+
59
+ - **Extension results** are not a renderer kind (extensions are deferred). Chart, metric, change and file kinds are checked in [`result-rendering-kinds.test.ts`](../../packages/testing/test/result-rendering-kinds.test.ts).
60
+ - **MCP** clients get the structured result and the manifest's declaration, not the compact text.
61
+ - **The registry renderers** (shell and chat components drawing views) are registry UI, not built here.