okengine 0.2.8 → 0.3.4

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 (180) hide show
  1. package/AGENTS.md +17 -15
  2. package/README.md +59 -31
  3. package/package.json +11 -16
  4. package/site/content/docs/ai/llms-txt.mdx +54 -0
  5. package/site/content/docs/ai/mcp.mdx +123 -0
  6. package/site/content/docs/ai/meta.json +5 -0
  7. package/site/content/docs/ai/skills.mdx +53 -0
  8. package/site/content/docs/console/access.mdx +29 -0
  9. package/site/content/docs/console/ai.mdx +35 -0
  10. package/site/content/docs/console/architecture.mdx +35 -0
  11. package/site/content/docs/console/channels.mdx +37 -0
  12. package/site/content/docs/console/clock.mdx +31 -0
  13. package/site/content/docs/console/flows.mdx +31 -0
  14. package/site/content/docs/console/gates.mdx +35 -0
  15. package/site/content/docs/console/manifest-diff.mdx +34 -0
  16. package/site/content/docs/console/meta.json +23 -0
  17. package/site/content/docs/console/overview.mdx +40 -0
  18. package/site/content/docs/console/plugins.mdx +41 -0
  19. package/site/content/docs/console/privacy.mdx +32 -0
  20. package/site/content/docs/console/runs.mdx +40 -0
  21. package/site/content/docs/console/signals.mdx +31 -0
  22. package/site/content/docs/console/store.mdx +32 -0
  23. package/site/content/docs/console/tenancy.mdx +32 -0
  24. package/site/content/docs/console/traces.mdx +34 -0
  25. package/site/content/docs/console/vault.mdx +37 -0
  26. package/site/content/docs/elements/ai.mdx +180 -0
  27. package/site/content/docs/elements/channel.mdx +167 -0
  28. package/site/content/docs/elements/clock.mdx +182 -0
  29. package/site/content/docs/elements/flow.mdx +288 -0
  30. package/site/content/docs/elements/gate.mdx +171 -0
  31. package/site/content/docs/elements/meta.json +5 -0
  32. package/site/content/docs/elements/signal.mdx +171 -0
  33. package/site/content/docs/elements/store.mdx +320 -0
  34. package/site/content/docs/elements/vault.mdx +263 -0
  35. package/site/content/docs/get-started/basic-usage.mdx +124 -0
  36. package/site/content/docs/get-started/comparison.mdx +65 -0
  37. package/site/content/docs/get-started/installation.mdx +113 -0
  38. package/site/content/docs/get-started/introduction.mdx +123 -0
  39. package/site/content/docs/get-started/meta.json +5 -0
  40. package/site/content/docs/index.mdx +63 -0
  41. package/site/content/docs/meta.json +5 -0
  42. package/site/content/docs/plugins/compression.mdx +60 -0
  43. package/site/content/docs/plugins/cors.mdx +98 -0
  44. package/site/content/docs/plugins/csrf.mdx +96 -0
  45. package/site/content/docs/plugins/ip-allowlist.mdx +93 -0
  46. package/site/content/docs/plugins/maintenance-mode.mdx +101 -0
  47. package/site/content/docs/plugins/meta.json +15 -0
  48. package/site/content/docs/plugins/security-headers.mdx +136 -0
  49. package/site/content/docs/reference/cli.md +101 -0
  50. package/site/content/docs/reference/configuration.mdx +159 -0
  51. package/site/content/docs/reference/environment-variables.mdx +87 -0
  52. package/site/content/docs/reference/errors.mdx +80 -0
  53. package/site/content/docs/reference/fx.mdx +117 -0
  54. package/site/content/docs/reference/meta.json +5 -0
  55. package/site/content/docs/reference/plugins.mdx +249 -0
  56. package/site/content/docs/reference/security.md +63 -0
  57. package/src/auth/auth.test.ts +3 -0
  58. package/src/cli/ask-dev-mode.ts +1 -1
  59. package/src/cli/db.ts +87 -17
  60. package/src/cli/dev-db-push.test.ts +32 -2
  61. package/src/cli/dev-schema-sync.test.ts +66 -0
  62. package/src/cli/dev-schema-sync.ts +139 -0
  63. package/src/cli/dev.test.ts +123 -1
  64. package/src/cli/dev.ts +150 -8
  65. package/src/cli/doc-staleness.test.ts +4 -4
  66. package/src/cli/docker-cli.test.ts +20 -0
  67. package/src/cli/docker.ts +10 -0
  68. package/src/cli/drizzle-env.test.ts +67 -0
  69. package/src/cli/drizzle-env.ts +78 -0
  70. package/src/cli/ensure-drizzle-config.ts +50 -0
  71. package/src/cli/hero-meta.test.ts +1 -1
  72. package/src/cli/load-config.ts +6 -0
  73. package/src/cli/mode.ts +24 -4
  74. package/src/cli/openbao-bootstrap.test.ts +149 -0
  75. package/src/cli/openbao-bootstrap.ts +314 -0
  76. package/src/cli/openbao-restart.integration.test.ts +136 -0
  77. package/src/cli/ports.test.ts +7 -5
  78. package/src/cli/ports.ts +6 -2
  79. package/src/cli/resolve-dev-sql-env.test.ts +48 -0
  80. package/src/cli/resolve-dev-sql-env.ts +42 -0
  81. package/src/cli/stack.ts +7 -4
  82. package/src/cli/vault-cmd.ts +63 -0
  83. package/src/client/types.ts +7 -1
  84. package/src/compiler/extract.test.ts +40 -0
  85. package/src/compiler/extract.ts +123 -1
  86. package/src/compiler/fixtures/skyport/oke.config.ts +2 -2
  87. package/src/compiler/fixtures/skyport.expected.json +1 -1
  88. package/src/compiler/response.ts +12 -0
  89. package/src/config/define-config.test.ts +4 -6
  90. package/src/config/index.ts +2 -15
  91. package/src/console/server/app.ts +2 -0
  92. package/src/console/server/vault.ts +21 -6
  93. package/src/docker/compose.ts +112 -16
  94. package/src/docker/derive.ts +7 -1
  95. package/src/docker/docker.test.ts +103 -0
  96. package/src/docker/index.ts +11 -1
  97. package/src/docker/recipes/index.ts +3 -2
  98. package/src/docker/recipes/openbao.ts +47 -0
  99. package/src/docker/recipes/redis.ts +5 -1
  100. package/src/docker/recipes/rustfs.ts +2 -3
  101. package/src/docker/stack-id.test.ts +43 -8
  102. package/src/docker/stack-id.ts +99 -20
  103. package/src/docker/stack.ts +36 -4
  104. package/src/docker/types.ts +3 -0
  105. package/src/docs-origin.ts +4 -4
  106. package/src/drivers/drizzle-dialect.test.ts +20 -0
  107. package/src/drivers/drizzle-dialect.ts +37 -0
  108. package/src/drivers/index.ts +1 -2
  109. package/src/drivers/memory.ts +278 -39
  110. package/src/drivers/s3.ts +10 -1
  111. package/src/drivers/vault-driver-removal.test.ts +55 -0
  112. package/src/drivers/vault-openbao.test.ts +97 -0
  113. package/src/drivers/vault-openbao.ts +102 -35
  114. package/src/drivers/vault-types.ts +3 -10
  115. package/src/elements/store/declare.ts +4 -1
  116. package/src/elements/store/resource-list-docs.fixture.ts +56 -0
  117. package/src/elements/store/resource-list-docs.test.ts +79 -0
  118. package/src/elements/store/resource.test.ts +253 -0
  119. package/src/elements/store/resource.ts +786 -0
  120. package/src/elements/store/sql-condition.test.ts +132 -0
  121. package/src/elements/store/sql-condition.ts +284 -46
  122. package/src/elements/store/sql-session.test.ts +86 -1
  123. package/src/elements/store/sql-session.ts +187 -27
  124. package/src/elements/store/table.ts +34 -4
  125. package/src/elements/store.ts +16 -0
  126. package/src/elements/vault/runtime.ts +1 -1
  127. package/src/elements/vault.test.ts +1 -28
  128. package/src/elements/vault.ts +1 -1
  129. package/src/kernel/app.ts +59 -25
  130. package/src/kernel/boot-bind/channel.test.ts +60 -0
  131. package/src/kernel/boot-bind/channel.ts +64 -2
  132. package/src/kernel/boot-bind/store.test.ts +10 -1
  133. package/src/kernel/boot-bind/store.ts +49 -2
  134. package/src/kernel/boot.test.ts +0 -1
  135. package/src/kernel/boot.ts +1 -1
  136. package/src/kernel/edge.test.ts +68 -0
  137. package/src/kernel/errors.registry.test.ts +1 -1
  138. package/src/kernel/flow.ts +8 -0
  139. package/src/kernel/fx.test.ts +23 -3
  140. package/src/kernel/fx.ts +115 -18
  141. package/src/kernel/hooks.test.ts +33 -0
  142. package/src/kernel/hooks.ts +22 -0
  143. package/src/kernel/index.ts +7 -0
  144. package/src/kernel/on.ts +44 -3
  145. package/src/kernel/plugin.ts +33 -3
  146. package/src/kernel/registry-isolation.test.ts +74 -0
  147. package/src/kernel/registry.ts +22 -1
  148. package/src/kernel/triggers.ts +59 -0
  149. package/src/manifest/fixtures/skyport.excerpt.json +1 -1
  150. package/src/manifest/fixtures/skyport.manifest.json +1 -1
  151. package/src/manifest/index.ts +1 -1
  152. package/src/manifest/types.ts +1 -1
  153. package/src/manifest/validate.ts +2 -2
  154. package/src/plugins/compression.test.ts +127 -0
  155. package/src/plugins/compression.ts +94 -0
  156. package/src/plugins/config-source.test.ts +204 -0
  157. package/src/plugins/config-source.ts +209 -0
  158. package/src/plugins/cors.test.ts +172 -0
  159. package/src/plugins/cors.ts +153 -0
  160. package/src/plugins/csrf.test.ts +102 -0
  161. package/src/plugins/csrf.ts +86 -0
  162. package/src/plugins/headers.ts +54 -0
  163. package/src/plugins/index.ts +26 -0
  164. package/src/plugins/ip-allowlist.test.ts +139 -0
  165. package/src/plugins/ip-allowlist.ts +129 -0
  166. package/src/plugins/maintenance-mode.test.ts +91 -0
  167. package/src/plugins/maintenance-mode.ts +85 -0
  168. package/src/plugins/security-headers.test.ts +243 -0
  169. package/src/plugins/security-headers.ts +255 -0
  170. package/src/release/measure.ts +1 -2
  171. package/src/test/create-test-app.ts +14 -2
  172. package/docs/spec/console.md +0 -762
  173. package/docs/spec/example.md +0 -1374
  174. package/docs/spec/four-applications.md +0 -1376
  175. package/docs/spec/unified-theory.md +0 -498
  176. package/src/cli/doc-drift.test.ts +0 -147
  177. package/src/cli/doc-drift.ts +0 -401
  178. package/src/cli/doctor-diff-examples.ts +0 -90
  179. package/src/drivers/vault-sops.ts +0 -246
  180. /package/{spec/manifest.v1.schema.json → manifest.v1.schema.json} +0 -0
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # OKE — Agent Contract
2
2
 
3
- This file is loaded by every later session. It prevents drift. Specs live in `docs/spec/`. **If the spec is silent, stop and ask.**
3
+ This file is loaded by every later session. It prevents drift. Product documentation lives in `site/content/docs/`. **If the documentation is silent, stop and ask.**
4
4
 
5
5
  ## The one law
6
6
 
@@ -53,11 +53,12 @@ A direct `node:` import (or any other side-channel I/O) in element or flow code
53
53
 
54
54
  ## Ports
55
55
 
56
- | Port | Surface |
57
- | -------- | ------- |
58
- | **6530** | App |
59
- | **6533** | Console |
60
- | **6535** | MCP |
56
+ | Port | Surface |
57
+ | -------- | -------------------- |
58
+ | **6530** | App |
59
+ | **6533** | Console |
60
+ | **6535** | MCP |
61
+ | **6536** | Docs MCP (read-only) |
61
62
 
62
63
  Mnemonic: O·K·E = 6·5·3.
63
64
 
@@ -76,17 +77,18 @@ A regression fails the build. Claims we cannot measure, we do not make.
76
77
 
77
78
  Published packages:
78
79
 
79
- - `okengine` — framework. Subpath exports: `.`, `./client`, `./test`, `./config`, `./auth`, `./drivers/*`. `"sideEffects": false`. CLI binary: `oke`.
80
- - `create-oke` — scaffold CLI (`bunx create-oke@latest <name>`). Lives in `packages/create-oke`; clean starters are `templates/*`, teaching apps stay in `examples/*` (`--from-example`).
80
+ - `okengine` — framework. Subpath exports: `.`, `./client`, `./test`, `./config`, `./auth`, `./plugins`, `./drivers/*`. `"sideEffects": false`. CLI binary: `oke`.
81
+ - `create-oke` — scaffold CLI (`bunx create-oke@latest <name>`). Lives in `packages/create-oke` and ships one standard starter from `packages/create-oke/template`.
81
82
 
82
83
  Engine: Bun `>=1.3`.
83
84
 
84
- ## Spec authority
85
+ ## Documentation authority
85
86
 
86
- | Spec | Path |
87
- | ----------------- | -------------------------------- |
88
- | Unified theory | `docs/spec/unified-theory.md` |
89
- | Four applications | `docs/spec/four-applications.md` |
90
- | Console | `docs/spec/console.md` |
87
+ | Surface | Path |
88
+ | -------- | ------------------------------------ |
89
+ | Theory | `site/content/docs/elements/` |
90
+ | Console | `site/content/docs/console/` |
91
+ | CLI | `site/content/docs/reference/cli.md` |
92
+ | Manifest | `manifest.v1.schema.json` |
91
93
 
92
- **If the spec is silent, stop and ask.**
94
+ **If the documentation is silent, stop and ask.**
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <p align="center">
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="site/public/OKE-W.svg" />
4
- <img alt="OKE" src="site/public/OKE-B.svg" width="220" />
3
+ <source media="(prefers-color-scheme: dark)" srcset="site/public/logo/OKE-W.svg" />
4
+ <img alt="OKE" src="site/public/logo/OKE-B.svg" width="220" />
5
5
  </picture>
6
6
  </p>
7
7
 
@@ -15,7 +15,7 @@ _"Stop gluing APIs, jobs, and queues into one backend. One law collapses them
15
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
16
16
  [![Bun >=1.3](https://img.shields.io/badge/Bun-%3E%3D1.3-black.svg)](https://bun.sh)
17
17
 
18
- **Docs:** [okengine.vercel.app](https://okengine.vercel.app) · **Handbook:** [/docs](https://okengine.vercel.app/docs) · **CLI:** `oke` · **Scaffold:** [`create-oke`](https://www.npmjs.com/package/create-oke)
18
+ **Docs:** [oke.omqkhafi.dev](https://oke.omqkhafi.dev) · **Handbook:** [/docs](https://oke.omqkhafi.dev/docs) · **CLI:** `oke` · **Scaffold:** [`create-oke`](https://www.npmjs.com/package/create-oke)
19
19
 
20
20
  > [!WARNING]
21
21
  > **Early development (`v0.x`) — not production-ready.**
@@ -51,42 +51,70 @@ Mnemonic: **O·K·E = 6·5·3**.
51
51
  Every backend behavior is a Flow: `on(Trigger) → Effects`. World access goes through `fx`.
52
52
 
53
53
  Store apps sync schema with `oke db push|generate|migrate` (local `oke dev`
54
- auto-pushes). Prefer `store.schema.table` + `field.*` (see Linkly) or keep a
54
+ auto-pushes). Prefer `store.schema.table` + `field.*` or keep a
55
55
  hand-written Drizzle `schema.ts`.
56
56
 
57
- ### `examples/notes/src/flows/notes/index.ts`
57
+ ### Resource Flow
58
58
 
59
59
  ```typescript
60
- export const create = on(
61
- http.post("/notes"),
62
- flow({
63
- in: NewNote,
64
- out: NoteId,
65
- do: async (input, fx) => {
66
- const [note] = await fx.store(db).insert(notes).values(input).returning();
67
- return { id: note.id };
68
- },
69
- }),
70
- );
60
+ import { on, http, store } from "okengine";
61
+ import { createInsertSchema, createSelectSchema } from "drizzle-zod";
62
+ import { db } from "../../core";
63
+ import { notes as notesTable } from "../../schema";
64
+
65
+ // Contracts derived from the schema — one source of truth.
66
+ const NewNote = createInsertSchema(notesTable, { title: (s) => s.min(1).max(120) }).omit({
67
+ id: true,
68
+ createdAt: true,
69
+ });
70
+ const Note = createSelectSchema(notesTable);
71
+
72
+ // One declarative resource: list (cursor + search + filters + order +
73
+ // select), create (201), get / update / remove with typed NotFound.
74
+ const notesR = store.resource(db, notesTable, {
75
+ in: NewNote,
76
+ out: Note,
77
+ update: NewNote.partial(),
78
+ list: {
79
+ cursor: [notesTable.createdAt, notesTable.id],
80
+ direction: "desc",
81
+ limit: 20,
82
+ maxLimit: 100,
83
+ search: [notesTable.title],
84
+ filter: "all",
85
+ order: "all",
86
+ },
87
+ unit: "notes",
88
+ breaking: true,
89
+ });
90
+
91
+ // Mount all five verbs: list/create on /notes, get/update/remove on /notes/:id.
92
+ // `on(http.resource(...))` returns the ops bag; spread it into named exports
93
+ // so `adopt({ notes })` registers each flow under the unit.
94
+ const mounted = on(http.resource("/notes", notesR.all()));
95
+
96
+ export const list = mounted.list;
97
+ export const create = mounted.create;
98
+ export const get = mounted.get;
99
+ export const update = mounted.update;
100
+ export const remove = mounted.remove;
71
101
  ```
72
102
 
73
- Full walkthrough: [Basic usage](https://okengine.vercel.app/docs/get-started/basic-usage) · teaching apps: [Learn](https://okengine.vercel.app/docs/learn/notes).
103
+ Full walkthrough: [Basic usage](https://oke.omqkhafi.dev/docs/get-started/basic-usage).
74
104
 
75
105
  ## Documentation
76
106
 
77
- Everything beyond this page lives on the site and in-repo specs:
78
-
79
- | Resource | Link |
80
- | ----------------- | ------------------------------------------------------------------------------------------ |
81
- | Docs site | [okengine.vercel.app](https://okengine.vercel.app) |
82
- | Handbook | [/docs](https://okengine.vercel.app/docs) |
83
- | Changelog | [/changelog](https://okengine.vercel.app/changelog) |
84
- | Agents index | [/llms.txt](https://okengine.vercel.app/llms.txt) |
85
- | Unified theory | [`docs/spec/unified-theory.md`](docs/spec/unified-theory.md) |
86
- | Four applications | [`docs/spec/four-applications.md`](docs/spec/four-applications.md) |
87
- | Console | [`docs/spec/console.md`](docs/spec/console.md) |
88
- | CLI reference | [`docs/cli.md`](docs/cli.md) · [handbook](https://okengine.vercel.app/docs/cli) |
89
- | Budgets | [`BUDGETS.md`](BUDGETS.md) |
90
- | Contributing | [`CONTRIBUTING.md`](CONTRIBUTING.md) · [writing a driver](docs/guides/writing-a-driver.md) |
107
+ Everything beyond this page lives in the site handbook:
108
+
109
+ | Resource | Link |
110
+ | ------------- | ------------------------------------------------------------------ |
111
+ | Docs site | [oke.omqkhafi.dev](https://oke.omqkhafi.dev) |
112
+ | Handbook | [/docs](https://oke.omqkhafi.dev/docs) |
113
+ | Changelog | [/changelog](https://oke.omqkhafi.dev/changelog) |
114
+ | Agents index | [/llms.txt](https://oke.omqkhafi.dev/llms.txt) |
115
+ | CLI reference | [/docs/reference/cli](https://oke.omqkhafi.dev/docs/reference/cli) |
116
+ | Manifest | [`manifest.v1.schema.json`](manifest.v1.schema.json) |
117
+ | Budgets | [`BUDGETS.md`](BUDGETS.md) |
118
+ | Contributing | [`CONTRIBUTING.md`](CONTRIBUTING.md) |
91
119
 
92
120
  Pre-1.0. Published on [npm](https://www.npmjs.com/package/okengine) and [JSR](https://jsr.io/@omqkhafi/okengine). MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okengine",
3
- "version": "0.2.8",
3
+ "version": "0.3.4",
4
4
  "description": "One law. Eight elements. Ten exports. One package. One manifest. Every backend need is derived, never added.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,14 +12,14 @@
12
12
  },
13
13
  "workspaces": [
14
14
  "packages/*",
15
- "examples/*",
16
15
  "site"
17
16
  ],
18
17
  "files": [
19
18
  "src",
20
- "spec",
19
+ "manifest.v1.schema.json",
21
20
  "AGENTS.md",
22
- "docs/spec"
21
+ "README.md",
22
+ "site/content/docs"
23
23
  ],
24
24
  "type": "module",
25
25
  "sideEffects": false,
@@ -31,6 +31,7 @@
31
31
  "./auth": "./src/auth/index.ts",
32
32
  "./console": "./src/console/index.ts",
33
33
  "./mcp": "./src/mcp/index.ts",
34
+ "./plugins": "./src/plugins/index.ts",
34
35
  "./store": "./src/elements/store.ts",
35
36
  "./signal": "./src/elements/signal.ts",
36
37
  "./clock": "./src/elements/clock.ts",
@@ -44,8 +45,8 @@
44
45
  },
45
46
  "scripts": {
46
47
  "typecheck": "tsc --noEmit && bun run --cwd packages/create-oke typecheck",
47
- "lint": "oxlint --type-aware --quiet",
48
- "lint:fix": "oxlint --type-aware --fix",
48
+ "lint": "oxlint --quiet",
49
+ "lint:fix": "oxlint --fix",
49
50
  "fmt": "oxfmt",
50
51
  "fmt:check": "oxfmt --check",
51
52
  "test": "bun test --pass-with-no-tests",
@@ -55,12 +56,11 @@
55
56
  "prepack": "bun run build",
56
57
  "bench": "bun test ./src/runtime/cold-start.bench.ts src/client/budget.test.ts src/console/budget.test.ts src/kernel/budget.test.ts src/kernel/routing-budget.test.ts src/runs/bench.test.ts",
57
58
  "budgets": "bun src/release/publish.ts",
58
- "gate": "bun src/cli/doctor-diff-examples.ts && bun src/cli/doc-drift.ts",
59
- "site:sync": "bun run --cwd site sync",
60
- "site:dev": "bun run --cwd site dev",
59
+ "gate": "bun test src/cli/doc-staleness.test.ts src/drivers/vault-driver-removal.test.ts src/kernel/errors.registry.test.ts src/upgrade/codemods.test.ts",
60
+ "dev": "bun run --cwd site dev",
61
61
  "site:build": "bun run --cwd site build",
62
- "ci": "bun run typecheck && bun run lint && bun run fmt:check && bun run test && bun run budgets -- --dry-run && bun run gate && bun run site:build",
63
- "ci:integration": "CREATE_OKE_INTEGRATION=1 bun run ci",
62
+ "ci:workflow": "bun scripts/ci.ts --workflow",
63
+ "ci": "bun scripts/ci.ts",
64
64
  "bump": "bun run scripts/bump-version.ts",
65
65
  "release": "bun run scripts/publish.ts",
66
66
  "g": "gflows"
@@ -90,7 +90,6 @@
90
90
  "@types/react": "^19.2.17",
91
91
  "@types/react-dom": "^19.2.3",
92
92
  "@vitejs/plugin-react": "^6.0.4",
93
- "age-encryption": "^0.3.0",
94
93
  "arktype": "^2.2.3",
95
94
  "axe-core": "^4.12.1",
96
95
  "clsx": "^2.1.1",
@@ -114,16 +113,12 @@
114
113
  "zod": "^4.4.3"
115
114
  },
116
115
  "peerDependencies": {
117
- "age-encryption": "^0.3.0",
118
116
  "drizzle-kit": ">=1.0.0-rc.0",
119
117
  "drizzle-orm": ">=1.0.0-rc.0",
120
118
  "drizzle-seed": ">=0.3.0",
121
119
  "zod": ">=3.23.0"
122
120
  },
123
121
  "peerDependenciesMeta": {
124
- "age-encryption": {
125
- "optional": true
126
- },
127
122
  "drizzle-kit": {
128
123
  "optional": true
129
124
  },
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: "llms.txt"
3
+ description: "Machine-readable documentation — the index, the full concatenated text, and per-page markdown endpoints this site serves for agents."
4
+ icon: "FileText"
5
+ source: "docs/spec/unified-theory.md"
6
+ ---
7
+
8
+ This documentation site serves machine-readable twins of every page, following the `llms.txt` convention — so an agent can pull exactly the docs it needs (or all of them) instead of scraping HTML. Three endpoints, three granularities:
9
+
10
+ | Endpoint | Contains | Pull it when |
11
+ | ----------------------- | --------------------------------------------------- | --------------------------------------------- |
12
+ | `/llms.txt` | Index of every docs page (title, link, description) | The agent needs the map — what exists, where |
13
+ | `/llms-full.txt` | All pages concatenated as one markdown document | You want the whole docs in one context window |
14
+ | `/llms.mdx/docs/⟨slug⟩` | One page as markdown | The agent needs just the Vault page, say |
15
+
16
+ ## Use them
17
+
18
+ ```bash
19
+ # the map
20
+ curl https://oke.omqkhafi.dev/llms.txt
21
+
22
+ # everything, for stuffing into context
23
+ curl https://oke.omqkhafi.dev/llms-full.txt
24
+
25
+ # one page — e.g. the Vault element
26
+ curl https://oke.omqkhafi.dev/llms.mdx/docs/elements/vault
27
+ ```
28
+
29
+ <Callout title="Which one first?">
30
+ Start with `/llms.txt` — it is small and tells the agent which slugs exist. Fetch `/llms-full.txt`
31
+ only when breadth matters more than tokens; per-page `/llms.mdx` is the precise instrument.
32
+ </Callout>
33
+
34
+ ## How it pairs with the docs MCP
35
+
36
+ These endpoints serve the _published_ docs of the framework. During `oke dev`, the [docs MCP server](/docs/ai/mcp) also runs on :6536 (`oke.docs.search` / `oke.docs.get`), answering from the same content over the MCP protocol — pick the plain HTTP endpoints for one-shot context, the MCP tools when the agent is already connected as a client.
37
+
38
+ ## Learn more
39
+
40
+ - [MCP](/docs/ai/mcp) — runtime and docs MCP servers
41
+ - [Agent contracts](/docs/ai/skills) — teaching agents the vocabulary these pages use
42
+ - [Reference](/docs/reference/configuration) — the most-cited pages for config questions
43
+
44
+ ## Next
45
+
46
+ <Cards>
47
+ <Card title="MCP" description="Runtime :6535 · docs :6536." href="/docs/ai/mcp" />
48
+ <Card
49
+ title="Skills"
50
+ description="AGENTS.md and the shipped agent skills."
51
+ href="/docs/ai/skills"
52
+ />
53
+ <Card title="AI element" description="Models inside your app." href="/docs/elements/ai" />
54
+ </Cards>
@@ -0,0 +1,123 @@
1
+ ---
2
+ title: "MCP"
3
+ description: "The runtime MCP server on :6535 — read tools for Manifest, schemas, effects, and traces, write actions gated by per-call human confirmation — plus the read-only docs MCP on :6536."
4
+ icon: "Plug"
5
+ source: "docs/spec/unified-theory.md"
6
+ ---
7
+
8
+ OKE serves an [MCP](https://modelcontextprotocol.io) endpoint on port **6535** so an AI agent can operate your running app: read its Manifest and traces, and take a small set of safe actions. It speaks JSON-RPC over HTTP (MCP protocol `2024-11-05`), requires a Bearer token **even on localhost**, and never forwards that token upstream — adapters receive structured operator ids instead.
9
+
10
+ <Callout title="The one rule">
11
+ MCP inherits the operator's capability and can never exceed it. Server-level controls alone are
12
+ exactly where the confused-deputy problem lives, so access descends to the tool, the operation,
13
+ and each parameter.
14
+ </Callout>
15
+
16
+ ## Read tools
17
+
18
+ Default-safe — they return inert data envelopes, never live handles:
19
+
20
+ | Tool | Returns | Scope (any of) |
21
+ | ------------------ | ---------------------------------------------- | --------------------------------------------- |
22
+ | `oke.manifest.get` | The current Manifest catalogue | `mcp:manifest:read` · `console:manifest:read` |
23
+ | `oke.schema.get` | In/out/error schemas for one flow (`flowId`) | `mcp:schema:read` · `console:manifest:read` |
24
+ | `oke.effects.get` | Declared effects for one flow (`flowId`) | `mcp:effects:read` · `console:manifest:read` |
25
+ | `oke.traces.list` | Recent runs (`limit` ≤ 200, optional `flowId`) | `mcp:traces:read` · `console:runs:read` |
26
+ | `oke.traces.get` | One run/trace record (`runId`) | `mcp:traces:read` · `console:runs:read` |
27
+
28
+ ## Write tools — confirmed, every single call
29
+
30
+ Two actions are write-class, and each call needs a **fresh, single-use** confirmation — there is no session-level consent cache to leak:
31
+
32
+ | Tool | Does | Scope (any of) |
33
+ | ------------------------------- | ------------------------------------------------------- | ------------------------------------------------------ |
34
+ | `oke.action.invoke` | Invoke a flow by id (sensitive) | `mcp:action:invoke` · `console:flows:invoke` |
35
+ | `oke.action.structural_propose` | Propose a structural diff — reviewable, **not applied** | `mcp:action:structural` · `console:structural:propose` |
36
+
37
+ <Steps>
38
+
39
+ <Step>
40
+ ### Request a confirmation token
41
+
42
+ `oke.action.confirm` with the target `tool`, the exact `args`, and a human `reason` — it returns a single-use token.
43
+
44
+ </Step>
45
+
46
+ <Step>
47
+ ### Call the write tool
48
+
49
+ Pass the token as `confirmToken` plus the phrase `CONFIRM` in `confirmation`. Token, phrase, args, and principal must all match what was confirmed.
50
+
51
+ </Step>
52
+
53
+ <Step>
54
+ ### The token dies
55
+
56
+ Consumed tokens cannot be replayed; the next write needs a new confirmation. A mismatch fails with `write tool requires fresh human confirmation` and the `confirmVia` hint.
57
+
58
+ </Step>
59
+
60
+ </Steps>
61
+
62
+ ## Structural changes arrive as diffs
63
+
64
+ `oke.action.structural_propose` is how an agent suggests a file change: it takes `title`, `relativePath`, and `contents`, and produces a **reviewable diff** for a human — it is never applied to the tree. This is the boundary that lets an agent propose boldly while a human stays the one who merges.
65
+
66
+ ## The security model
67
+
68
+ | Layer | Enforcement |
69
+ | ------------------- | ----------------------------------------------------------- |
70
+ | Authentication | Bearer session token required — even on `127.0.0.1` |
71
+ | Scope inheritance | `console:*` / `mcp:*` expand to every declared tool scope |
72
+ | Per-tool ACL | Each tool declares required scopes + read/write class |
73
+ | Per-parameter rules | `maxLength`, enum allow-lists, forbidden parameters |
74
+ | Token hygiene | Caller token never forwarded — structured operator ids only |
75
+ | Confirmation | Single-use, per call, phrase + token + args bound |
76
+
77
+ ## Docs MCP — a second, docs-only server
78
+
79
+ `oke dev` also boots `okengine-docs-mcp` on port **6536** — the same protocol, but exposing the documentation itself instead of a live Manifest. It is how an agent answers "how do I … in OKE?" from the real pages rather than its training data.
80
+
81
+ | Fact | Value |
82
+ | -------- | -------------------------------------- |
83
+ | Port | `6536` (moves upward when busy) |
84
+ | Auth | None — public documentation, read-only |
85
+ | Endpoint | `POST http://127.0.0.1:6536/mcp` |
86
+ | Health | `GET http://127.0.0.1:6536/health` |
87
+ | Tools | `oke.docs.search` · `oke.docs.get` |
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "okengine-docs": { "url": "http://127.0.0.1:6536/mcp" }
93
+ }
94
+ }
95
+ ```
96
+
97
+ The docs content ships inside the `okengine` package, so the index your agent searches is exactly the version you have installed. If the surface cannot boot (missing content, busy port), `oke dev` prints `Docs MCP skipped — …` and continues — docs search never takes your dev session down.
98
+
99
+ ## Learn more
100
+
101
+ - [Console · Access](/docs/console/access) — how operator tokens and grants work
102
+ - [Agent contracts](/docs/ai/skills) — what agents are taught about the system they operate
103
+ - [Flow](/docs/elements/flow) — the effects the MCP reads back
104
+
105
+ ## Next
106
+
107
+ <Cards>
108
+ <Card
109
+ title="Skills"
110
+ description="AGENTS.md and the shipped agent skills."
111
+ href="/docs/ai/skills"
112
+ />
113
+ <Card
114
+ title="llms.txt"
115
+ description="Machine-readable documentation surfaces."
116
+ href="/docs/ai/llms-txt"
117
+ />
118
+ <Card
119
+ title="AI element"
120
+ description="Models inside your app — the other direction."
121
+ href="/docs/elements/ai"
122
+ />
123
+ </Cards>
@@ -0,0 +1,5 @@
1
+ {
2
+ "title": "AI Resources",
3
+ "icon": "Bot",
4
+ "pages": ["mcp", "skills", "llms-txt"]
5
+ }
@@ -0,0 +1,53 @@
1
+ ---
2
+ title: "Skills"
3
+ description: "What OKE ships to teach AI agents the system — the repo-level AGENTS.md contract and the installable skills under .agents/skills/."
4
+ icon: "GraduationCap"
5
+ source: "docs/spec/unified-theory.md"
6
+ ---
7
+
8
+ Tools alone don't make a good operator — an agent also needs to know the _vocabulary_: what a Flow is, why `fx` is the only door, which driver ids are legal. OKE ships that knowledge as contracts and skills that agents load automatically, so sessions start aligned instead of drifting and getting corrected.
9
+
10
+ ## The three layers
11
+
12
+ | Layer | Path | Loaded when | Teaches |
13
+ | ------------------ | -------------------------- | ------------------------------------------------- | --------------------------------------------------------------------- |
14
+ | **Agent contract** | `AGENTS.md` (repo root) | Every agent session, automatically | The one law, eight elements, ten exports, the fx rule, ports, budgets |
15
+ | **Element skill** | `.agents/skills/oke/` | Building or changing an okengine app | The element contract in depth — declaration patterns per element |
16
+ | **Docs skill** | `.agents/skills/oke-docs/` | Writing or editing docs under `site/content/docs` | The documentation information-architecture standard and its gates |
17
+
18
+ ## AGENTS.md — the root contract
19
+
20
+ Every OKE app's repo carries an `AGENTS.md` that agents (Cursor, Claude Code, and peers) read at session start. It is deliberately short and absolute: every backend behavior is a Flow (`on(Trigger) → Effects`), there are eight elements and ten exports, all world access goes through `fx`, drivers are named after protocols, and the ports/budgets are fixed. Its closing rule is the one that keeps agents honest: **if the documentation is silent, stop and ask** — never invent the API.
21
+
22
+ ## Skills — installable know-how
23
+
24
+ Skills are `SKILL.md` packages an agent loads when the work matches their description. The two OKE ships:
25
+
26
+ | Skill | Use it for | Inside |
27
+ | ---------- | ----------------------------------- | --------------------------------------------------------- |
28
+ | `oke` | App work — flows, elements, drivers | The agent contract, element patterns, the fx invariants |
29
+ | `oke-docs` | Docs work — new pages, rewrites | The page skeleton, verification sources, the density gate |
30
+
31
+ Both live in the repo under `.agents/skills/`, so they travel with the code and stay versioned with what they describe.
32
+
33
+ ## How contracts compose with MCP
34
+
35
+ Contracts teach the _vocabulary_; [MCP](/docs/ai/mcp) grants the _hands_. An agent that knows the eight elements from `AGENTS.md` reads the Manifest through `oke.manifest.get` with the right mental model — and its write attempts still pass through [per-call human confirmation](/docs/ai/mcp), because knowing the system is not the same as being trusted by it.
36
+
37
+ ## Learn more
38
+
39
+ - [MCP](/docs/ai/mcp) — the runtime surface these contracts pair with
40
+ - [Introduction](/docs/get-started/introduction) — the eight elements in human terms
41
+ - [llms.txt](/docs/ai/llms-txt) — feeding an agent the docs themselves
42
+
43
+ ## Next
44
+
45
+ <Cards>
46
+ <Card
47
+ title="llms.txt"
48
+ description="Machine-readable documentation surfaces."
49
+ href="/docs/ai/llms-txt"
50
+ />
51
+ <Card title="MCP" description="Runtime server :6535." href="/docs/ai/mcp" />
52
+ <Card title="AI element" description="Models inside your app." href="/docs/elements/ai" />
53
+ </Cards>
@@ -0,0 +1,29 @@
1
+ ---
2
+ title: "Access"
3
+ description: "Identities, roles, API keys."
4
+ icon: "Users"
5
+ source: "docs/spec/console.md"
6
+ ---
7
+
8
+ Answers: **identities, roles, API keys**
9
+
10
+ <Callout title="Governing rule">
11
+ Granting an application scope to an operator is impossible in the UI — taught by absence, not
12
+ refusal.
13
+ </Callout>
14
+
15
+ ## What this panel shows
16
+
17
+ <Cards>
18
+ <Card title="Two planes" description="Operators and application users never mix." />
19
+ <Card title="Key creation" description="Value shown once; attenuation to creator scopes only." />
20
+ <Card title="Revocation" description="Blast radius plus honest JWT validity delay." />
21
+ <Card title="Hygiene" description="Unused keys, never-signed-in operators, expired invites." />
22
+ </Cards>
23
+
24
+ ## Catalog
25
+
26
+ <Cards>
27
+ <Card title="Dev" description="✓" />
28
+ <Card title="Prod" description="✓ (admin)" />
29
+ </Cards>
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: "AI"
3
+ description: "Prompt versions, eval scores, cost, agent runs."
4
+ icon: "Sparkles"
5
+ source: "docs/spec/console.md"
6
+ ---
7
+
8
+ Answers: **prompt versions, eval scores, cost, agent runs**
9
+
10
+ <Callout title="Governing rule">
11
+ Everything else in the Console is deterministic; this panel is built on distributions, not single
12
+ values.
13
+ </Callout>
14
+
15
+ ## What this panel shows
16
+
17
+ <Cards>
18
+ <Card title="Prompt versions" description="A version bump is Manifest Diff blast radius." />
19
+ <Card title="Eval + shape" description="Schema-validation failure is its own class." />
20
+ <Card
21
+ title="Agent tools"
22
+ description="Tools are the app’s own flows — undeclared reach is denied and shown."
23
+ />
24
+ <Card
25
+ title="Budgets"
26
+ description="Cost, semantic cache, and `allowPii` as standing review surfaces."
27
+ />
28
+ </Cards>
29
+
30
+ ## Catalog
31
+
32
+ <Cards>
33
+ <Card title="Dev" description="full" />
34
+ <Card title="Prod" description="read + budgets" />
35
+ </Cards>
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: "Architecture"
3
+ description: "How it all connects — the diagram that is the code."
4
+ icon: "Network"
5
+ source: "docs/spec/console.md"
6
+ ---
7
+
8
+ Answers: **how it all connects — the diagram that _is_ the code**
9
+
10
+ <Callout title="Governing rule">
11
+ Flows answers “which one”; Architecture answers “what shape”. Never shows the whole system by
12
+ default.
13
+ </Callout>
14
+
15
+ ## What this panel shows
16
+
17
+ <Cards>
18
+ <Card title="Unit clusters" description="Default aggregated edges; focus one or two hops." />
19
+ <Card title="Element layers" description="Toggle data, messaging, time, external edges." />
20
+ <Card
21
+ title="Live traffic"
22
+ description="Edge thickness from real traffic; dashed = never traversed."
23
+ />
24
+ <Card
25
+ title="Pathologies"
26
+ description="Cycles, god nodes, orphan signals, SPOFs — computed from the graph."
27
+ />
28
+ </Cards>
29
+
30
+ ## Catalog
31
+
32
+ <Cards>
33
+ <Card title="Dev" description="✓" />
34
+ <Card title="Prod" description="✓" />
35
+ </Cards>
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: "Channels"
3
+ description: "Templates, delivery receipts, bounces, opt-outs."
4
+ icon: "Mailbox"
5
+ source: "docs/spec/console.md"
6
+ ---
7
+
8
+ Answers: **templates, delivery receipts, bounces, opt-outs, deliverability (SPF/DKIM/DMARC)**
9
+
10
+ <Callout title="Governing rule">
11
+ Suppression is not failure — the taxonomy of “did not arrive” has seven states with verdicts.
12
+ </Callout>
13
+
14
+ ## What this panel shows
15
+
16
+ <Cards>
17
+ <Card title="Dev inbox" description="`console` driver lands every medium locally." />
18
+ <Card
19
+ title="Deliverability"
20
+ description="SPF/DKIM/DMARC, bounces, complaints, suppression list."
21
+ />
22
+ <Card
23
+ title="Fallback chains"
24
+ description="Recorded as chains (e.g. WhatsApp → SMS), not single outcomes."
25
+ />
26
+ <Card
27
+ title="Locale previews"
28
+ description="Template data bound to schema; RTL-accurate previews."
29
+ />
30
+ </Cards>
31
+
32
+ ## Catalog
33
+
34
+ <Cards>
35
+ <Card title="Dev" description="full + console inbox" />
36
+ <Card title="Prod" description="send test, inspect delivery" />
37
+ </Cards>