okengine 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/package.json +76 -10
  2. package/site/content/docs/ai/mcp.mdx +0 -1
  3. package/site/content/docs/deployment/docker-swarm.mdx +48 -111
  4. package/site/content/docs/deployment/docker.mdx +43 -36
  5. package/site/content/docs/deployment/index.mdx +9 -9
  6. package/site/content/docs/deployment/kubernetes.mdx +4 -4
  7. package/site/content/docs/elements/ai.mdx +7 -13
  8. package/site/content/docs/elements/channel.mdx +9 -13
  9. package/site/content/docs/elements/clock.mdx +8 -14
  10. package/site/content/docs/elements/flow.mdx +46 -54
  11. package/site/content/docs/elements/gate.mdx +6 -11
  12. package/site/content/docs/elements/signal.mdx +2 -8
  13. package/site/content/docs/elements/store.mdx +79 -93
  14. package/site/content/docs/elements/vault.mdx +89 -76
  15. package/site/content/docs/get-started/basic-usage.mdx +8 -14
  16. package/site/content/docs/get-started/installation.mdx +36 -36
  17. package/site/content/docs/get-started/introduction.mdx +11 -0
  18. package/site/content/docs/get-started/why.mdx +3 -4
  19. package/site/content/docs/index.mdx +0 -1
  20. package/site/content/docs/meta.json +0 -1
  21. package/site/content/docs/plugins/anonymous.mdx +1 -1
  22. package/site/content/docs/plugins/magic-link.mdx +11 -11
  23. package/site/content/docs/plugins/otp.mdx +2 -2
  24. package/site/content/docs/plugins/passkey.mdx +1 -1
  25. package/site/content/docs/plugins/two-factor.mdx +1 -1
  26. package/site/content/docs/plugins/username.mdx +1 -1
  27. package/site/content/docs/recipes/caddy.mdx +1 -1
  28. package/site/content/docs/recipes/cockroachdb.mdx +2 -2
  29. package/site/content/docs/recipes/dragonfly.mdx +1 -1
  30. package/site/content/docs/recipes/index.mdx +1 -2
  31. package/site/content/docs/recipes/llama-cpp.mdx +21 -23
  32. package/site/content/docs/recipes/mailpit.mdx +11 -11
  33. package/site/content/docs/recipes/meilisearch.mdx +10 -10
  34. package/site/content/docs/recipes/meta.json +0 -1
  35. package/site/content/docs/recipes/ollama.mdx +1 -1
  36. package/site/content/docs/recipes/pgdog.mdx +12 -9
  37. package/site/content/docs/recipes/postgres.mdx +3 -3
  38. package/site/content/docs/recipes/redis.mdx +2 -2
  39. package/site/content/docs/recipes/rustfs.mdx +10 -7
  40. package/site/content/docs/recipes/sglang.mdx +1 -1
  41. package/site/content/docs/recipes/supabase-docker.mdx +1 -1
  42. package/site/content/docs/recipes/timescale.mdx +2 -2
  43. package/site/content/docs/recipes/valkey.mdx +1 -1
  44. package/site/content/docs/recipes/vllm.mdx +1 -1
  45. package/site/content/docs/recipes/yugabytedb.mdx +2 -2
  46. package/site/content/docs/reference/cli.md +61 -38
  47. package/site/content/docs/reference/configuration.mdx +145 -70
  48. package/site/content/docs/reference/environment-variables.mdx +36 -28
  49. package/site/content/docs/reference/errors.mdx +28 -29
  50. package/site/content/docs/reference/fx.mdx +14 -7
  51. package/site/content/docs/reference/i18n.mdx +17 -6
  52. package/site/content/docs/reference/index.mdx +5 -0
  53. package/site/content/docs/reference/meta.json +1 -0
  54. package/site/content/docs/reference/migrating-environments.mdx +158 -0
  55. package/site/content/docs/reference/plugins.mdx +2 -2
  56. package/src/auth/gate-auth.test.ts +12 -10
  57. package/src/cli/ai-setup/ai-setup.test.ts +30 -16
  58. package/src/cli/ai-setup/apply.ts +111 -15
  59. package/src/cli/ai-setup/catalog.ts +3 -3
  60. package/src/cli/ai-setup/index.ts +1 -1
  61. package/src/cli/ai-setup/prompts.ts +1 -1
  62. package/src/cli/ai-setup/recommend.test.ts +1 -1
  63. package/src/cli/ask-seed.test.ts +3 -3
  64. package/src/cli/build.ts +8 -9
  65. package/src/cli/db-auto-push.test.ts +6 -3
  66. package/src/cli/db-auto-push.ts +7 -5
  67. package/src/cli/db-seed.ts +7 -8
  68. package/src/cli/db.test.ts +70 -71
  69. package/src/cli/db.ts +86 -12
  70. package/src/cli/dev-controller.test.ts +35 -0
  71. package/src/cli/dev-controller.ts +298 -0
  72. package/src/cli/dev-controls.ts +11 -65
  73. package/src/cli/dev-db-push.test.ts +47 -15
  74. package/src/cli/dev-schema-sync.test.ts +11 -11
  75. package/src/cli/dev-schema-sync.ts +10 -10
  76. package/src/cli/dev-session-lock.test.ts +106 -0
  77. package/src/cli/dev-session-lock.ts +209 -0
  78. package/src/cli/dev.test.ts +246 -114
  79. package/src/cli/dev.ts +153 -205
  80. package/src/cli/doc-staleness.test.ts +3 -6
  81. package/src/cli/docker-clean.test.ts +33 -1
  82. package/src/cli/docker-clean.ts +28 -33
  83. package/src/cli/docker-cli.test.ts +12 -11
  84. package/src/cli/docker.ts +95 -20
  85. package/src/cli/doctor.test.ts +40 -0
  86. package/src/cli/doctor.ts +142 -9
  87. package/src/cli/drizzle-env.test.ts +11 -13
  88. package/src/cli/drizzle-env.ts +18 -11
  89. package/src/cli/ensure-drizzle-config.ts +11 -14
  90. package/src/cli/hero-meta.test.ts +15 -15
  91. package/src/cli/hero-meta.ts +10 -9
  92. package/src/cli/index.ts +36 -6
  93. package/src/cli/load-config.images.test.ts +44 -10
  94. package/src/cli/load-config.source.test.ts +50 -0
  95. package/src/cli/load-config.ts +35 -29
  96. package/src/cli/meilisearch-local.ts +1 -2
  97. package/src/cli/mode.ts +7 -58
  98. package/src/cli/registry.ts +175 -19
  99. package/src/cli/resolve-dev-sql-env.test.ts +8 -16
  100. package/src/cli/resolve-dev-sql-env.ts +13 -15
  101. package/src/cli/safe-defaults.test.ts +29 -11
  102. package/src/cli/schema.ts +65 -16
  103. package/src/cli/test.ts +58 -0
  104. package/src/cli/tui/App.tsx +252 -0
  105. package/src/cli/tui/DevLive.tsx +116 -0
  106. package/src/cli/tui/components/ConfirmDialog.tsx +48 -0
  107. package/src/cli/tui/components/HeaderBar.tsx +67 -0
  108. package/src/cli/tui/components/LogStream.tsx +47 -0
  109. package/src/cli/tui/components/PanelCard.tsx +39 -0
  110. package/src/cli/tui/components/SelectRow.tsx +37 -0
  111. package/src/cli/tui/components/SlashPalette.tsx +172 -0
  112. package/src/cli/tui/components/Spinner.tsx +32 -0
  113. package/src/cli/tui/components/StatusBar.tsx +51 -0
  114. package/src/cli/tui/components/StatusDot.tsx +37 -0
  115. package/src/cli/tui/components/TabBar.tsx +49 -0
  116. package/src/cli/tui/components/Wordmark.tsx +43 -0
  117. package/src/cli/tui/format.ts +38 -0
  118. package/src/cli/tui/keys.test.ts +18 -0
  119. package/src/cli/tui/keys.ts +26 -0
  120. package/src/cli/tui/launch.test.ts +18 -0
  121. package/src/cli/tui/launch.ts +57 -0
  122. package/src/cli/tui/panels/Dashboard.tsx +201 -0
  123. package/src/cli/tui/panels/Database.tsx +198 -0
  124. package/src/cli/tui/panels/Dev.tsx +257 -0
  125. package/src/cli/tui/panels/Docker.tsx +357 -0
  126. package/src/cli/tui/panels/Navigator.test.ts +22 -0
  127. package/src/cli/tui/panels/Navigator.tsx +213 -0
  128. package/src/cli/tui/slash-catalog.test.ts +31 -0
  129. package/src/cli/tui/slash-catalog.ts +184 -0
  130. package/src/cli/tui/slash-run.ts +54 -0
  131. package/src/cli/tui/state/ports.ts +95 -0
  132. package/src/cli/tui/theme.ts +24 -0
  133. package/src/cli/vault-cmd.test.ts +402 -0
  134. package/src/cli/vault-cmd.ts +727 -69
  135. package/src/cli/vault-secure-input.test.ts +56 -0
  136. package/src/cli/vault-secure-input.ts +124 -0
  137. package/src/compiler/effects-infer.ts +7 -0
  138. package/src/compiler/extract.ts +12 -0
  139. package/src/compiler/fixtures/skyport/oke.config.ts +7 -5
  140. package/src/compiler/fixtures/skyport/src/flows/payments/index.ts +1 -1
  141. package/src/compiler/fixtures/skyport.expected.json +1 -1
  142. package/src/compiler/generate-adopt.ts +27 -1
  143. package/src/compiler-entry.ts +7 -0
  144. package/src/config/define-config.test.ts +111 -47
  145. package/src/config/driver-defaults.test.ts +115 -0
  146. package/src/config/driver-defaults.ts +156 -0
  147. package/src/config/index.ts +246 -131
  148. package/src/config/resolve-driver.test.ts +14 -19
  149. package/src/console/server/app.ts +4 -2
  150. package/src/console/server/console.test.ts +58 -1
  151. package/src/console/server/flows.ts +22 -2
  152. package/src/console/server/index.ts +3 -0
  153. package/src/console/server/operator-db.test.ts +55 -13
  154. package/src/console/server/operator-db.ts +305 -263
  155. package/src/console/server/serve.ts +16 -7
  156. package/src/console/server/state.ts +31 -9
  157. package/src/console/server/vault.test.ts +120 -5
  158. package/src/console/server/vault.ts +208 -12
  159. package/src/console/ui/dist/assets/{index-D-9KFce5.js → index--Y0Uaz-m.js} +2 -2
  160. package/src/console/ui/dist/assets/panel-vault-BkZdJPX8.js +1 -0
  161. package/src/console/ui/dist/assets/style-C3L349iZ.css +3 -0
  162. package/src/console/ui/dist/index.html +2 -2
  163. package/src/console/ui/shell/client.ts +16 -0
  164. package/src/console/ui/shell/panels/vault/VaultPanel.tsx +54 -1
  165. package/src/console/ui/vault/VaultA11yView.tsx +33 -1
  166. package/src/console/ui/vault/backend.test.ts +75 -0
  167. package/src/console/ui/vault/backend.ts +117 -0
  168. package/src/console/ui/vault/fixture.ts +21 -2
  169. package/src/console/ui/vault/index.ts +11 -1
  170. package/src/console/ui/vault/types.ts +26 -0
  171. package/src/docker/compose.ts +164 -61
  172. package/src/docker/derive.ts +106 -12
  173. package/src/docker/docker.test.ts +156 -110
  174. package/src/docker/helpers.ts +98 -0
  175. package/src/docker/images-config.test.ts +163 -0
  176. package/src/docker/index.ts +30 -5
  177. package/src/docker/recipes/index.ts +0 -3
  178. package/src/docker/recipes/llama-cpp.ts +4 -4
  179. package/src/docker/recipes/pgdog.ts +9 -2
  180. package/src/docker/resources.test.ts +71 -0
  181. package/src/docker/resources.ts +176 -0
  182. package/src/docker/stack-id.test.ts +11 -4
  183. package/src/docker/stack-id.ts +42 -32
  184. package/src/docker/stack.integration.test.ts +4 -15
  185. package/src/docker/types.ts +35 -3
  186. package/src/drivers/ai-ollama.integration.test.ts +2 -2
  187. package/src/drivers/conformance.test.ts +11 -12
  188. package/src/drivers/drizzle-dialect.test.ts +0 -4
  189. package/src/drivers/drizzle-dialect.ts +7 -13
  190. package/src/drivers/index.ts +24 -7
  191. package/src/drivers/journal-postgres.test.ts +3 -1
  192. package/src/drivers/journal-postgres.ts +4 -2
  193. package/src/drivers/meilisearch.ts +1 -1
  194. package/src/drivers/pglite.ts +28 -5
  195. package/src/drivers/types.ts +9 -11
  196. package/src/drivers/vault-aws-secrets-manager.test.ts +159 -0
  197. package/src/drivers/vault-aws-secrets-manager.ts +333 -0
  198. package/src/drivers/vault-builtin.test.ts +110 -0
  199. package/src/drivers/vault-builtin.ts +184 -0
  200. package/src/drivers/vault-driver-removal.test.ts +13 -0
  201. package/src/drivers/vault-managed.test.ts +95 -0
  202. package/src/drivers/vault-managed.ts +101 -25
  203. package/src/drivers/vault-types.ts +25 -5
  204. package/src/elements/ai/runtime.ts +1 -1
  205. package/src/elements/clock/chaos.test.ts +4 -1
  206. package/src/elements/clock/durable.ts +57 -4
  207. package/src/elements/clock.test.ts +13 -14
  208. package/src/elements/gate/constants.ts +18 -0
  209. package/src/elements/gate.test.ts +1 -1
  210. package/src/elements/gate.ts +2 -2
  211. package/src/elements/store/domain-ddl.test.ts +5 -12
  212. package/src/elements/store/emit-drizzle.ts +44 -19
  213. package/src/elements/store/index-boot.test.ts +15 -116
  214. package/src/elements/store/load-plugin-tables.ts +1 -1
  215. package/src/elements/store/resource-list-docs.fixture.ts +12 -6
  216. package/src/elements/store/resource-list-docs.test.ts +64 -44
  217. package/src/elements/store/resource.test.ts +17 -10
  218. package/src/elements/store/runtime.ts +9 -12
  219. package/src/elements/store/schema-decl.test.ts +16 -32
  220. package/src/elements/store/seed.test.ts +1 -2
  221. package/src/elements/store/seed.ts +7 -8
  222. package/src/elements/store/sql-condition.test.ts +2 -2
  223. package/src/elements/store/sql-session.test.ts +8 -10
  224. package/src/elements/store/sql-session.ts +10 -2
  225. package/src/elements/store.test.ts +13 -13
  226. package/src/elements/vault/audit.ts +233 -0
  227. package/src/elements/vault/boot-chain.test.ts +78 -0
  228. package/src/elements/vault/boot-chain.ts +43 -39
  229. package/src/elements/vault/builtin-adapter.test.ts +479 -0
  230. package/src/elements/vault/builtin-adapter.ts +1184 -0
  231. package/src/elements/vault/crypto.test.ts +237 -0
  232. package/src/elements/vault/crypto.ts +431 -0
  233. package/src/elements/vault/declare.ts +164 -3
  234. package/src/elements/vault/errors.ts +56 -0
  235. package/src/elements/vault/kms-unseal.test.ts +76 -0
  236. package/src/elements/vault/kms-unseal.ts +181 -0
  237. package/src/elements/vault/path.ts +90 -0
  238. package/src/elements/vault/resilience.test.ts +102 -0
  239. package/src/elements/vault/resilience.ts +107 -0
  240. package/src/elements/vault/runtime.ts +36 -4
  241. package/src/elements/vault/security-checklist.test.ts +130 -0
  242. package/src/elements/vault/storage.ts +448 -0
  243. package/src/elements/vault/types.ts +288 -0
  244. package/src/elements/vault/unseal.ts +150 -0
  245. package/src/elements/vault.test.ts +72 -4
  246. package/src/elements/vault.ts +91 -2
  247. package/src/full.ts +248 -0
  248. package/src/http.ts +41 -0
  249. package/src/i18n/interpolate-simple.ts +37 -0
  250. package/src/i18n/messages.ts +51 -4
  251. package/src/i18n-entry.ts +7 -0
  252. package/src/index.ts +35 -145
  253. package/src/journal-entry.ts +20 -0
  254. package/src/kernel/adopt-barrel-fresh.test.ts +25 -10
  255. package/src/kernel/app.ts +40 -42
  256. package/src/kernel/auto-registry.test.ts +2 -2
  257. package/src/kernel/boot-bind/ai.test.ts +5 -5
  258. package/src/kernel/boot-bind/ai.ts +2 -1
  259. package/src/kernel/boot-bind/channel.test.ts +6 -6
  260. package/src/kernel/boot-bind/channel.ts +5 -4
  261. package/src/kernel/boot-bind/clock.ts +5 -5
  262. package/src/kernel/boot-bind/gate.ts +6 -7
  263. package/src/kernel/boot-bind/honor-config.test.ts +42 -42
  264. package/src/kernel/boot-bind/journal.ts +5 -5
  265. package/src/kernel/boot-bind/signal.ts +3 -1
  266. package/src/kernel/boot-bind/store.test.ts +55 -37
  267. package/src/kernel/boot-bind/store.ts +24 -34
  268. package/src/kernel/boot-bind/vault.ts +19 -4
  269. package/src/kernel/boot.test.ts +12 -4
  270. package/src/kernel/boot.ts +31 -19
  271. package/src/kernel/budget-entry.ts +1 -1
  272. package/src/kernel/compensate.test.ts +288 -1
  273. package/src/kernel/compensate.ts +126 -0
  274. package/src/kernel/concurrency.test.ts +10 -9
  275. package/src/kernel/effects-stamping.test.ts +27 -2
  276. package/src/kernel/element-registries.ts +5 -3
  277. package/src/kernel/flow.ts +4 -2
  278. package/src/kernel/fx.test.ts +119 -3
  279. package/src/kernel/fx.ts +215 -40
  280. package/src/kernel/index.ts +14 -0
  281. package/src/kernel/journal.ts +130 -7
  282. package/src/kernel/pipeline.test.ts +20 -6
  283. package/src/kernel/redacted.test.ts +35 -0
  284. package/src/kernel/redacted.ts +24 -2
  285. package/src/kernel/router/create-default.ts +16 -0
  286. package/src/kernel/router/create-edge.ts +18 -0
  287. package/src/kernel/router/create.ts +23 -0
  288. package/src/kernel/router/index.ts +23 -0
  289. package/src/kernel/router/linear.ts +88 -0
  290. package/src/kernel/router/regexp.ts +188 -0
  291. package/src/kernel/router/smart.ts +120 -0
  292. package/src/kernel/router/trie.ts +108 -0
  293. package/src/kernel/router/types.ts +56 -0
  294. package/src/kernel/router.ts +18 -532
  295. package/src/kernel-entry.ts +43 -0
  296. package/src/manifest/fixtures/skyport.excerpt.json +1 -1
  297. package/src/manifest/fixtures/skyport.manifest.json +1 -1
  298. package/src/plugins/config-source.test.ts +7 -7
  299. package/src/release/build-lib.ts +58 -0
  300. package/src/release/exports.test.ts +4 -2
  301. package/src/release/exports.ts +30 -4
  302. package/src/release/measure.ts +101 -22
  303. package/src/runs/duckdb.ts +7 -2
  304. package/src/shared/optional-peer.ts +41 -0
  305. package/src/term.test.ts +3 -44
  306. package/src/test/create-test-app.ts +12 -0
  307. package/src/test/provisions.integration.test.ts +1 -1
  308. package/src/test/reset-element-registries.ts +2 -0
  309. package/src/upgrade/codemods.test.ts +7 -20
  310. package/src/upgrade/codemods.ts +93 -60
  311. package/site/content/docs/console/access.mdx +0 -29
  312. package/site/content/docs/console/ai.mdx +0 -35
  313. package/site/content/docs/console/architecture.mdx +0 -35
  314. package/site/content/docs/console/channels.mdx +0 -37
  315. package/site/content/docs/console/clock.mdx +0 -51
  316. package/site/content/docs/console/flows.mdx +0 -31
  317. package/site/content/docs/console/gates.mdx +0 -73
  318. package/site/content/docs/console/index.mdx +0 -54
  319. package/site/content/docs/console/manifest-diff.mdx +0 -34
  320. package/site/content/docs/console/meta.json +0 -24
  321. package/site/content/docs/console/overview.mdx +0 -40
  322. package/site/content/docs/console/plugins.mdx +0 -41
  323. package/site/content/docs/console/privacy.mdx +0 -32
  324. package/site/content/docs/console/runs.mdx +0 -50
  325. package/site/content/docs/console/signals.mdx +0 -40
  326. package/site/content/docs/console/store.mdx +0 -32
  327. package/site/content/docs/console/tenancy.mdx +0 -32
  328. package/site/content/docs/console/traces.mdx +0 -38
  329. package/site/content/docs/console/vault.mdx +0 -41
  330. package/site/content/docs/recipes/openbao.mdx +0 -141
  331. package/src/cli/ask-dev-mode.ts +0 -40
  332. package/src/cli/dev-mode.test.ts +0 -45
  333. package/src/cli/dev-mode.ts +0 -78
  334. package/src/cli/openbao-bootstrap.test.ts +0 -150
  335. package/src/cli/openbao-bootstrap.ts +0 -321
  336. package/src/cli/openbao-restart.integration.test.ts +0 -145
  337. package/src/console/ui/dist/assets/panel-vault-Za1GyJfM.js +0 -1
  338. package/src/console/ui/dist/assets/style-C8MxEWPd.css +0 -3
  339. package/src/docker/recipes/openbao.ts +0 -47
  340. package/src/drivers/libsql.ts +0 -179
  341. package/src/drivers/sqlite.ts +0 -44
  342. package/src/drivers/vault-openbao.test.ts +0 -97
  343. package/src/drivers/vault-openbao.ts +0 -143
@@ -4,6 +4,10 @@
4
4
  * `oke upgrade` runs every applicable transform and prints a diff.
5
5
  * Adding a breaking change without a codemod is a process defect; the
6
6
  * registry is the checklist.
7
+ *
8
+ * Environment-model migrations (`local`/`docker` → `dev`, sqlite removal)
9
+ * are documented only — see site docs `reference/migrating-environments`.
10
+ * No soft-compat rewriter for those.
7
11
  */
8
12
 
9
13
  import { readdir } from "node:fs/promises";
@@ -38,49 +42,7 @@ export interface Codemod {
38
42
  }
39
43
 
40
44
  /**
41
- * Rewrite driver-map keys `dev:` `local:` and `stack:` `docker:`.
42
- *
43
- * Vault `dev:` fallbacks are intentionally excluded — callers pass only
44
- * `oke.config.*` paths into this rewriter.
45
- *
46
- * @param source - File contents
47
- */
48
- export function rewriteConfigEnvKeys(source: string): string {
49
- return source
50
- .replace(/(^|[^\w.])dev(\s*:)/gm, "$1local$2")
51
- .replace(/(^|[^\w.])stack(\s*:)/gm, "$1docker$2");
52
- }
53
-
54
- /**
55
- * Rewrite removed vault stack markers to docker equivalents.
56
- *
57
- * @param source - File contents
58
- */
59
- export function rewriteFromStackMarkers(source: string): string {
60
- return source
61
- .replace(/\bfromStack\b/g, "fromDocker")
62
- .replace(/\bFROM_STACK_PREFIX\b/g, "FROM_DOCKER_PREFIX")
63
- .replace(/\bisFromStack\b/g, "isFromDocker")
64
- .replace(/\bfromStackRole\b/g, "fromDockerRole")
65
- .replace(/__oke_from_stack__/g, "__oke_from_docker__");
66
- }
67
-
68
- /**
69
- * Collect `oke.config.*` files under a project root.
70
- *
71
- * @param cwd - Project root
72
- */
73
- async function collectConfigCandidates(cwd: string): Promise<string[]> {
74
- const out: string[] = [];
75
- for (const name of ["oke.config.ts", "oke.config.mts", "oke.config.js"]) {
76
- const path = resolve(cwd, name);
77
- if (await Bun.file(path).exists()) out.push(path);
78
- }
79
- return out;
80
- }
81
-
82
- /**
83
- * Collect TypeScript sources that may reference `fromStack`.
45
+ * Collect TypeScript sources under `src` / `app`.
84
46
  *
85
47
  * @param cwd - Project root
86
48
  */
@@ -116,30 +78,101 @@ async function walkTs(dir: string, out: string[]): Promise<void> {
116
78
  }
117
79
 
118
80
  /**
119
- * Built-in transforms.
81
+ * Rewrite deep `okengine` imports that left the thin root to subpaths.
82
+ *
83
+ * @param source - File contents
120
84
  */
85
+ export function rewriteThinRootImports(source: string): string {
86
+ const movers: readonly { readonly names: readonly string[]; readonly from: string }[] = [
87
+ {
88
+ names: [
89
+ "createRunsRuntime",
90
+ "collectWideEvent",
91
+ "createRunTelemetry",
92
+ "explainOutliers",
93
+ "filesRunsDriver",
94
+ "memoryRunsDriver",
95
+ "postgresRunsDriver",
96
+ "clickhouseRunsDriver",
97
+ "openDuckDB",
98
+ "duckQuery",
99
+ ],
100
+ from: "okengine/runs",
101
+ },
102
+ {
103
+ names: [
104
+ "createJournal",
105
+ "createMemoryJournalStore",
106
+ "createFileJournalStore",
107
+ "hasJournalLease",
108
+ "JOURNAL_DEFAULT_LEASE_MS",
109
+ ],
110
+ from: "okengine/journal",
111
+ },
112
+ {
113
+ names: ["compileAot", "compileDynamic", "compileRoute", "sucrose", "extractManifest"],
114
+ from: "okengine/compiler",
115
+ },
116
+ {
117
+ names: ["formatMessage", "clearMessageFormatCache", "resolveFailureMessage"],
118
+ from: "okengine/i18n",
119
+ },
120
+ {
121
+ names: [
122
+ "bootApplication",
123
+ "mintCapabilities",
124
+ "createFx",
125
+ "createRouter",
126
+ "CONSOLE_PORT",
127
+ "MCP_PORT",
128
+ ],
129
+ from: "okengine/full",
130
+ },
131
+ ];
132
+
133
+ let text = source;
134
+ for (const mover of movers) {
135
+ const re = new RegExp(`import\\s*\\{([^}]*)\\}\\s*from\\s*(["'])okengine\\2`, "g");
136
+ text = text.replace(re, (full, body: string, quote: string) => {
137
+ const parts = body
138
+ .split(",")
139
+ .map((p) => p.trim())
140
+ .filter(Boolean);
141
+ const keep: string[] = [];
142
+ const move: string[] = [];
143
+ for (const part of parts) {
144
+ const base =
145
+ part
146
+ .replace(/^type\s+/, "")
147
+ .split(/\s+as\s+/)[0]
148
+ ?.trim() ?? part;
149
+ if (mover.names.includes(base)) move.push(part);
150
+ else keep.push(part);
151
+ }
152
+ if (move.length === 0) return full;
153
+ const lines: string[] = [];
154
+ if (keep.length > 0) {
155
+ lines.push(`import { ${keep.join(", ")} } from ${quote}okengine${quote}`);
156
+ }
157
+ lines.push(`import { ${move.join(", ")} } from ${quote}${mover.from}${quote}`);
158
+ return lines.join(";\n");
159
+ });
160
+ }
161
+ return text;
162
+ }
163
+
121
164
  export const CODEMODS: readonly Codemod[] = [
122
165
  {
123
- id: "0.2.7-config-env-local-docker",
124
- from: "0.2.6",
125
- to: "0.2.7",
126
- description: "Rename driver-map keys dev→local, stack→docker; fromStack→fromDocker",
166
+ id: "0.10.3-thin-root-subpaths",
167
+ from: "0.10.2",
168
+ to: "0.10.3",
169
+ description:
170
+ "Move deep okengine imports (runs/journal/compiler/i18n/boot helpers) to okengine/* subpaths after thin root",
127
171
  async apply(cwd) {
128
172
  const changes: CodemodChange[] = [];
129
- for (const path of await collectConfigCandidates(cwd)) {
130
- const before = await Bun.file(path).text();
131
- const after = rewriteConfigEnvKeys(before);
132
- if (after !== before) {
133
- changes.push({
134
- path: relative(cwd, path) || path,
135
- before,
136
- after,
137
- });
138
- }
139
- }
140
173
  for (const path of await collectVaultCandidates(cwd)) {
141
174
  const before = await Bun.file(path).text();
142
- const after = rewriteFromStackMarkers(before);
175
+ const after = rewriteThinRootImports(before);
143
176
  if (after !== before) {
144
177
  changes.push({
145
178
  path: relative(cwd, path) || path,
@@ -1,29 +0,0 @@
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>
@@ -1,35 +0,0 @@
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>
@@ -1,35 +0,0 @@
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>
@@ -1,37 +0,0 @@
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>
@@ -1,51 +0,0 @@
1
- ---
2
- title: "Clock"
3
- description: "Upcoming crons, sleeping durable flows, journal."
4
- icon: "Clock"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- Answers: **upcoming crons, sleeping durable flows, journal**
9
-
10
- <Callout title="Governing rule">
11
- Looks like time — a forward timeline for schedules and pending wakes, not a flat grid.
12
- </Callout>
13
-
14
- ## What this panel shows
15
-
16
- <Cards>
17
- <Card title="Schedules" description="Drift, overdue, missed runs · catch-up one, lease holder." />
18
- <Card title="Pending wakes" description="Every sleeping durable flow and when it wakes." />
19
- <Card
20
- title="DST warnings"
21
- description="Gap or overlap badge — detect only, no schedule rewrite."
22
- />
23
- <Card title="Actions" description="Run now, wake early, pause; edit when overridable." />
24
- </Cards>
25
-
26
- ## Health numbers
27
-
28
- Each cron row projects four numbers plus the lease holder:
29
-
30
- | Field | Meaning |
31
- | --------------- | ----------------------------------------------------------------- |
32
- | Drift | How far the last run sat from the expected slot |
33
- | Overdue | Whether the schedule is past due |
34
- | Missed + policy | Slot count while down · always catch-up `"one"` (one fire, not N) |
35
- | Lease | Which instance holds the leader lease (empty when none) |
36
-
37
- ## Actions
38
-
39
- | Action | When |
40
- | ------------- | ---------------------------------------------------------------------- |
41
- | Pause | Any cron — not gated by `overridable` |
42
- | Edit schedule | Only when the declaration has `overridable: true`; else loud refuse |
43
- | Wake early | Sleeping durable run — advances `wakeAt` and can resume the journal |
44
- | Run now | Still requires the leader lease across replicas that share a CronStore |
45
-
46
- ## Catalog
47
-
48
- <Cards>
49
- <Card title="Dev" description="full" />
50
- <Card title="Prod" description="trigger/pause; edit if `overridable`" />
51
- </Cards>
@@ -1,31 +0,0 @@
1
- ---
2
- title: "Flows"
3
- description: "What exists; call it; read its contract."
4
- icon: "GitBranch"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- Answers: **what exists; call it; read its contract**
9
-
10
- <Callout title="Governing rule">
11
- Renders the one law as three columns: `Causes ← Flows → Effects` — not a tree.
12
- </Callout>
13
-
14
- ## What this panel shows
15
-
16
- <Cards>
17
- <Card title="Causes column" description="Triggers and callers — what runs this." />
18
- <Card title="Flows column" description="Context-adaptive centre with contracts and invoke." />
19
- <Card title="Effects column" description="What changes — store, signal, channel, AI, vault." />
20
- <Card
21
- title="Flow drawer"
22
- description="Workshop peek/expand — save as bun:test from a real response."
23
- />
24
- </Cards>
25
-
26
- ## Catalog
27
-
28
- <Cards>
29
- <Card title="Dev" description="full + source links" />
30
- <Card title="Prod" description="read + invoke per gates" />
31
- </Cards>
@@ -1,73 +0,0 @@
1
- ---
2
- title: "Gates"
3
- description: "Permission inquiry, rate counters, and continuous audit of unguarded vs explicitly public flows."
4
- icon: "Shield"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- The Gates panel answers **who may do what** without dumping a giant roles×permissions matrix as
9
- the home screen. Inquire from a principal or from a flow; the simulator shows the chain in
10
- evaluation order.
11
-
12
- <Callout title="The one rule">
13
- Refuse the giant roles×permissions matrix as the entry point — inquire from principal or from
14
- flow.
15
- </Callout>
16
-
17
- ## What this panel shows
18
-
19
- <Cards>
20
- <Card title="Simulator" description="Gate chain in evaluation order — where a denial stopped." />
21
- <Card
22
- title="Unguarded vs public"
23
- description="Empty chain (missing posture) vs gate.public (intentional)."
24
- />
25
- <Card title="Deploy diff" description="Permission widening caught from Manifest Diff." />
26
- <Card
27
- title="Plane separation"
28
- description="Operator holding an application scope is a violation."
29
- />
30
- </Cards>
31
-
32
- ## Unguarded vs explicit public
33
-
34
- | Flag | Meaning |
35
- | --------------- | ---------------------------------------------------------------------------- |
36
- | Unguarded | User-plane flow with an **empty** gate chain — missing auth posture |
37
- | Explicit public | Chain includes the reserved `public` sentinel (`gate.public` on the trigger) |
38
-
39
- App boot fails on unguarded HTTP triggers (`GateBootError`) unless `env === "test"` and
40
- `gate: { unguardedHttp: "allow" }`. Prefer fixing the flow: attach a policy, or attach
41
- `gate.public` when the surface is intentionally open.
42
-
43
- App authors configure Gate under `oke({ gate: { policies, auth, unguardedHttp } })` — see
44
- [Gate](/docs/elements/gate). Builtin `/auth/*` Flows from `gate.auth` are audited the same way.
45
-
46
- ## Catalog
47
-
48
- Policies, rates, and `/auth/*` Bindings from the Manifest — inquire and audit, not a live
49
- rate editor. Rate `overridable` is a catalog flag; schedule edits live under
50
- [Clock](/docs/console/clock).
51
-
52
- <Cards>
53
- <Card title="Dev" description="full catalog + simulator" />
54
- <Card title="Prod" description="same inquire surface; no silent ungated HTTP" />
55
- </Cards>
56
-
57
- ## Learn more
58
-
59
- - [Gate](/docs/elements/gate) — policies, rate limits, `gate.auth`, posture
60
- - [Plugins](/docs/plugins) — plugged sign-in method plugins
61
- - [Access](/docs/console/access) — roles and API keys
62
-
63
- ## Next
64
-
65
- <Cards>
66
- <Card title="Gate" description="Declare policies and auth." href="/docs/elements/gate" />
67
- <Card title="Access" description="Roles and API keys." href="/docs/console/access" />
68
- <Card
69
- title="Overview"
70
- description="Console panels from the Manifest."
71
- href="/docs/console/overview"
72
- />
73
- </Cards>
@@ -1,54 +0,0 @@
1
- ---
2
- title: "Console"
3
- description: "Manifest-derived operator panels on :6533 — health, elements, traces, access, and more."
4
- icon: "LayoutDashboard"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- The Console is derived from your Manifest. Each panel answers one operator question.
9
-
10
- ## Pages
11
-
12
- <Cards>
13
- <Card
14
- title="Overview"
15
- description="Is the system healthy right now?"
16
- href="/docs/console/overview"
17
- />
18
- <Card
19
- title="Flows"
20
- description="What exists; call it; read its contract."
21
- href="/docs/console/flows"
22
- />
23
- <Card title="Signals" description="Queue depth, in-flight, DLQ." href="/docs/console/signals" />
24
- <Card title="Store" description="Browse sql/kv/files/index." href="/docs/console/store" />
25
- <Card title="Clock" description="Crons, sleeps, journal." href="/docs/console/clock" />
26
- <Card
27
- title="Gates"
28
- description="Permission matrix and rate counters."
29
- href="/docs/console/gates"
30
- />
31
- <Card title="Vault" description="Secret contracts and rotation." href="/docs/console/vault" />
32
- <Card
33
- title="Channels"
34
- description="Templates, receipts, opt-outs."
35
- href="/docs/console/channels"
36
- />
37
- <Card title="AI" description="Prompts, evals, cost, agents." href="/docs/console/ai" />
38
- <Card title="Architecture" description="How it all connects." href="/docs/console/architecture" />
39
- <Card title="Traces" description="One timeline across effects." href="/docs/console/traces" />
40
- <Card title="Runs" description="Wide events per execution." href="/docs/console/runs" />
41
- <Card
42
- title="Manifest Diff"
43
- description="Blast radius of a deploy."
44
- href="/docs/console/manifest-diff"
45
- />
46
- <Card title="Access" description="Identities, roles, API keys." href="/docs/console/access" />
47
- <Card title="Plugins" description="Installed plugins and panels." href="/docs/console/plugins" />
48
- <Card title="Privacy" description="Where PII lives (conditional)." href="/docs/console/privacy" />
49
- <Card
50
- title="Tenancy"
51
- description="Per-tenant usage (conditional)."
52
- href="/docs/console/tenancy"
53
- />
54
- </Cards>
@@ -1,34 +0,0 @@
1
- ---
2
- title: "Manifest Diff"
3
- description: "Blast radius of a deploy: new effects, widened permissions."
4
- icon: "Diff"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- Answers: **blast radius of a deploy: new effects, widened permissions**
9
-
10
- <Callout title="Governing rule">
11
- Compares meaning rather than lines — behaviour change, sorted by blast radius.
12
- </Callout>
13
-
14
- ## What this panel shows
15
-
16
- <Cards>
17
- <Card title="Contract breaking" description="Existing clients will fail." />
18
- <Card
19
- title="Permission widening"
20
- description="Attack surface grew — gate removed or scope widened."
21
- />
22
- <Card title="Effect widening" description="New write, external effect, or secret read." />
23
- <Card
24
- title="CI gate"
25
- description="Blocks undeclared breaks; intended breaks need `breaking: true`."
26
- />
27
- </Cards>
28
-
29
- ## Catalog
30
-
31
- <Cards>
32
- <Card title="Dev" description="✓" />
33
- <Card title="Prod" description="✓" />
34
- </Cards>
@@ -1,24 +0,0 @@
1
- {
2
- "title": "Console",
3
- "icon": "LayoutDashboard",
4
- "pages": [
5
- "index",
6
- "overview",
7
- "flows",
8
- "signals",
9
- "store",
10
- "clock",
11
- "gates",
12
- "vault",
13
- "channels",
14
- "ai",
15
- "architecture",
16
- "traces",
17
- "runs",
18
- "manifest-diff",
19
- "access",
20
- "plugins",
21
- "privacy",
22
- "tenancy"
23
- ]
24
- }
@@ -1,40 +0,0 @@
1
- ---
2
- title: "Overview"
3
- description: "Is the system healthy right now?"
4
- icon: "Activity"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- Answers: **is the system healthy right now?**
9
-
10
- <Callout title="Governing rule">
11
- Built on declared objectives — burn rate and ranked findings, not a wall of charts nobody reads.
12
- </Callout>
13
-
14
- ## What this panel shows
15
-
16
- <Cards>
17
- <Card
18
- title="Declared SLOs"
19
- description="Objectives enter the Manifest; lowering a target is a reviewable code change."
20
- />
21
- <Card
22
- title="Burn rate"
23
- description="Error rate over tolerable rate — pages and investigates with clear thresholds."
24
- />
25
- <Card
26
- title="Journeys"
27
- description="Causal paths, not service lists — impossible compositions rejected at compile."
28
- />
29
- <Card
30
- title="Ranked findings"
31
- description="Union of panel findings: user harm first, then irreversibility, then trend."
32
- />
33
- </Cards>
34
-
35
- ## Catalog
36
-
37
- <Cards>
38
- <Card title="Dev" description="✓" />
39
- <Card title="Prod" description="✓" />
40
- </Cards>
@@ -1,41 +0,0 @@
1
- ---
2
- title: "Plugins"
3
- description: "Installed plugins and their contributed panels."
4
- icon: "Puzzle"
5
- source: "docs/spec/console.md"
6
- ---
7
-
8
- Answers: **installed plugins and their contributed panels**
9
-
10
- <Callout title="Governing rule">
11
- Scope is the attachment point — `app.plug()` / `unit.plug()` / `flow.plug()`. The Console never
12
- installs anything.
13
- </Callout>
14
-
15
- ## What this panel shows
16
-
17
- <Cards>
18
- <Card
19
- title="Origin × state"
20
- description="Core / Local / Community; state derived from code, not a flag."
21
- />
22
- <Card
23
- title="Declares vs intercepts"
24
- description="Boot contributions vs per-request hooks with measured cost."
25
- />
26
- <Card
27
- title="Supply chain"
28
- description="No lifecycle scripts; capability widening hits Manifest Diff."
29
- />
30
- <Card
31
- title="Install path"
32
- description="Shows state and hands you the command — no browser install."
33
- />
34
- </Cards>
35
-
36
- ## Catalog
37
-
38
- <Cards>
39
- <Card title="Dev" description="✓" />
40
- <Card title="Prod" description="✓" />
41
- </Cards>