okengine 0.1.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.
- package/AGENTS.md +91 -0
- package/README.md +327 -0
- package/docs/spec/complete-example.md +1188 -0
- package/docs/spec/console.md +739 -0
- package/docs/spec/four-applications.md +1188 -0
- package/docs/spec/unified-theory.md +489 -0
- package/package.json +152 -0
- package/spec/manifest.v1.schema.json +624 -0
- package/src/auth/api-keys.ts +168 -0
- package/src/auth/attenuation.ts +116 -0
- package/src/auth/auth.test.ts +273 -0
- package/src/auth/cross-plane.ts +98 -0
- package/src/auth/index.ts +112 -0
- package/src/auth/invites.ts +66 -0
- package/src/auth/invoke-as.ts +49 -0
- package/src/auth/operator.ts +178 -0
- package/src/auth/planes.ts +102 -0
- package/src/auth/plugin.ts +44 -0
- package/src/auth/roles.ts +84 -0
- package/src/auth/sessions.ts +418 -0
- package/src/auth/tables.ts +131 -0
- package/src/cli/args.ts +50 -0
- package/src/cli/branch.ts +75 -0
- package/src/cli/build.ts +86 -0
- package/src/cli/client-add.test.ts +140 -0
- package/src/cli/client-add.ts +164 -0
- package/src/cli/completion.test.ts +58 -0
- package/src/cli/completion.ts +296 -0
- package/src/cli/dev-app-runner.ts +77 -0
- package/src/cli/dev.test.ts +435 -0
- package/src/cli/dev.ts +594 -0
- package/src/cli/doc-drift.test.ts +146 -0
- package/src/cli/doc-drift.ts +397 -0
- package/src/cli/docker-cli.test.ts +221 -0
- package/src/cli/docker.ts +127 -0
- package/src/cli/doctor-diff-examples.ts +92 -0
- package/src/cli/doctor-diff.test.ts +91 -0
- package/src/cli/doctor-diff.ts +274 -0
- package/src/cli/doctor-pii.test.ts +98 -0
- package/src/cli/doctor-pii.ts +151 -0
- package/src/cli/doctor.test.ts +150 -0
- package/src/cli/doctor.ts +223 -0
- package/src/cli/eval.ts +122 -0
- package/src/cli/exit.ts +19 -0
- package/src/cli/gates-list.test.ts +47 -0
- package/src/cli/gates-list.ts +84 -0
- package/src/cli/images.ts +277 -0
- package/src/cli/index.ts +99 -0
- package/src/cli/json-out.test.ts +129 -0
- package/src/cli/load-config.ts +71 -0
- package/src/cli/mcp-from-console.ts +50 -0
- package/src/cli/privacy-erase.ts +73 -0
- package/src/cli/registry.ts +455 -0
- package/src/cli/safe-defaults.test.ts +92 -0
- package/src/cli/schema.ts +196 -0
- package/src/cli/stack.ts +82 -0
- package/src/cli/start.ts +106 -0
- package/src/cli/upgrade.ts +105 -0
- package/src/cli/vault-cmd.ts +140 -0
- package/src/client/budget-entry.ts +34 -0
- package/src/client/budget.test.ts +17 -0
- package/src/client/create.test.ts +159 -0
- package/src/client/create.ts +152 -0
- package/src/client/errors.ts +60 -0
- package/src/client/index.ts +35 -0
- package/src/client/notes-contract.test.ts +289 -0
- package/src/client/transport.test.ts +123 -0
- package/src/client/transport.ts +254 -0
- package/src/client/types.ts +282 -0
- package/src/compiler/aot.test.ts +248 -0
- package/src/compiler/aot.ts +182 -0
- package/src/compiler/differential.test.ts +241 -0
- package/src/compiler/dynamic.ts +54 -0
- package/src/compiler/effects-infer.ts +541 -0
- package/src/compiler/emit.ts +40 -0
- package/src/compiler/extract.test.ts +177 -0
- package/src/compiler/extract.ts +1368 -0
- package/src/compiler/fixtures/raw/raw-unannotated.ts +28 -0
- package/src/compiler/fixtures/skyport/oke.config.ts +24 -0
- package/src/compiler/fixtures/skyport/src/ai.ts +15 -0
- package/src/compiler/fixtures/skyport/src/app.ts +10 -0
- package/src/compiler/fixtures/skyport/src/channels.ts +6 -0
- package/src/compiler/fixtures/skyport/src/core.ts +3 -0
- package/src/compiler/fixtures/skyport/src/flows/bookings/index.ts +57 -0
- package/src/compiler/fixtures/skyport/src/flows/bookings/signals.ts +11 -0
- package/src/compiler/fixtures/skyport/src/flows/payments/index.ts +14 -0
- package/src/compiler/fixtures/skyport/src/flows/support/index.ts +20 -0
- package/src/compiler/fixtures/skyport/src/gates.ts +14 -0
- package/src/compiler/fixtures/skyport/src/journeys.ts +9 -0
- package/src/compiler/fixtures/skyport/src/schema.ts +3 -0
- package/src/compiler/fixtures/skyport/src/vault.ts +6 -0
- package/src/compiler/fixtures/skyport.expected.json +241 -0
- package/src/compiler/fixtures/triggers/five-triggers.ts +69 -0
- package/src/compiler/http-parse.ts +214 -0
- package/src/compiler/index.ts +67 -0
- package/src/compiler/response.ts +89 -0
- package/src/compiler/sucrose.ts +238 -0
- package/src/config/index.ts +167 -0
- package/src/console/budget.test.ts +73 -0
- package/src/console/index.ts +30 -0
- package/src/console/server/access.test.ts +370 -0
- package/src/console/server/access.ts +777 -0
- package/src/console/server/ai.test.ts +172 -0
- package/src/console/server/ai.ts +632 -0
- package/src/console/server/app.ts +294 -0
- package/src/console/server/auth-rate.test.ts +81 -0
- package/src/console/server/auth-rate.ts +72 -0
- package/src/console/server/bind.ts +25 -0
- package/src/console/server/channels.test.ts +179 -0
- package/src/console/server/channels.ts +469 -0
- package/src/console/server/claim.test.ts +66 -0
- package/src/console/server/claim.ts +134 -0
- package/src/console/server/clock.test.ts +239 -0
- package/src/console/server/clock.ts +390 -0
- package/src/console/server/console.test.ts +338 -0
- package/src/console/server/diff.test.ts +299 -0
- package/src/console/server/diff.ts +352 -0
- package/src/console/server/dry-run.audit.test.ts +118 -0
- package/src/console/server/flows-invoke.test.ts +148 -0
- package/src/console/server/flows.ts +3633 -0
- package/src/console/server/gates.test.ts +360 -0
- package/src/console/server/gates.ts +869 -0
- package/src/console/server/index.ts +141 -0
- package/src/console/server/live.test.ts +30 -0
- package/src/console/server/live.ts +109 -0
- package/src/console/server/plugin.ts +50 -0
- package/src/console/server/plugins.test.ts +131 -0
- package/src/console/server/plugins.ts +429 -0
- package/src/console/server/runs-pii.ts +98 -0
- package/src/console/server/security-headers.ts +97 -0
- package/src/console/server/security.gate.test.ts +286 -0
- package/src/console/server/serve.ts +319 -0
- package/src/console/server/signals.test.ts +88 -0
- package/src/console/server/signals.ts +282 -0
- package/src/console/server/state.ts +982 -0
- package/src/console/server/store.test.ts +233 -0
- package/src/console/server/store.ts +861 -0
- package/src/console/server/structural.ts +95 -0
- package/src/console/server/vault.test.ts +251 -0
- package/src/console/server/vault.ts +430 -0
- package/src/console/ui/access/AccessA11yView.tsx +237 -0
- package/src/console/ui/access/a11y.test.tsx +122 -0
- package/src/console/ui/access/acknowledgement.test.ts +13 -0
- package/src/console/ui/access/acknowledgement.ts +35 -0
- package/src/console/ui/access/blast-radius.test.ts +26 -0
- package/src/console/ui/access/blast-radius.ts +40 -0
- package/src/console/ui/access/confirmation.test.ts +38 -0
- package/src/console/ui/access/confirmation.ts +36 -0
- package/src/console/ui/access/fixture.ts +203 -0
- package/src/console/ui/access/grantable.test.ts +17 -0
- package/src/console/ui/access/grantable.ts +36 -0
- package/src/console/ui/access/hygiene.test.ts +12 -0
- package/src/console/ui/access/hygiene.ts +39 -0
- package/src/console/ui/access/index.ts +54 -0
- package/src/console/ui/access/provenance.test.ts +12 -0
- package/src/console/ui/access/provenance.ts +29 -0
- package/src/console/ui/access/search.test.ts +17 -0
- package/src/console/ui/access/search.ts +72 -0
- package/src/console/ui/access/types.ts +111 -0
- package/src/console/ui/ai/AiA11yView.tsx +265 -0
- package/src/console/ui/ai/a11y.test.tsx +99 -0
- package/src/console/ui/ai/findings.ts +41 -0
- package/src/console/ui/ai/fixture.ts +182 -0
- package/src/console/ui/ai/format.ts +90 -0
- package/src/console/ui/ai/group.test.ts +37 -0
- package/src/console/ui/ai/group.ts +88 -0
- package/src/console/ui/ai/index.ts +66 -0
- package/src/console/ui/ai/promotion.test.ts +77 -0
- package/src/console/ui/ai/promotion.ts +150 -0
- package/src/console/ui/ai/search.test.ts +40 -0
- package/src/console/ui/ai/search.ts +89 -0
- package/src/console/ui/ai/types.ts +139 -0
- package/src/console/ui/architecture/ArchitectureA11yView.tsx +163 -0
- package/src/console/ui/architecture/a11y.test.tsx +97 -0
- package/src/console/ui/architecture/boundary.ts +42 -0
- package/src/console/ui/architecture/declared.ts +165 -0
- package/src/console/ui/architecture/fixture.ts +74 -0
- package/src/console/ui/architecture/index.ts +84 -0
- package/src/console/ui/architecture/layers.ts +64 -0
- package/src/console/ui/architecture/layout.ts +68 -0
- package/src/console/ui/architecture/pathologies.ts +260 -0
- package/src/console/ui/architecture/search.ts +145 -0
- package/src/console/ui/architecture/traffic.ts +102 -0
- package/src/console/ui/architecture/types.ts +144 -0
- package/src/console/ui/architecture/view.test.ts +165 -0
- package/src/console/ui/architecture/view.ts +516 -0
- package/src/console/ui/channels/ChannelsA11yView.tsx +180 -0
- package/src/console/ui/channels/a11y.test.tsx +96 -0
- package/src/console/ui/channels/confirmation.test.ts +37 -0
- package/src/console/ui/channels/confirmation.ts +27 -0
- package/src/console/ui/channels/fallback.test.ts +15 -0
- package/src/console/ui/channels/fallback.ts +20 -0
- package/src/console/ui/channels/findings.ts +38 -0
- package/src/console/ui/channels/fixture.ts +134 -0
- package/src/console/ui/channels/group.ts +25 -0
- package/src/console/ui/channels/index.ts +57 -0
- package/src/console/ui/channels/locale.test.ts +17 -0
- package/src/console/ui/channels/locale.ts +31 -0
- package/src/console/ui/channels/mask.test.ts +14 -0
- package/src/console/ui/channels/mask.ts +12 -0
- package/src/console/ui/channels/search.ts +58 -0
- package/src/console/ui/channels/taxonomy.test.ts +17 -0
- package/src/console/ui/channels/taxonomy.ts +49 -0
- package/src/console/ui/channels/types.ts +117 -0
- package/src/console/ui/clock/ClockA11yView.tsx +182 -0
- package/src/console/ui/clock/a11y.test.tsx +99 -0
- package/src/console/ui/clock/confirmation.test.ts +32 -0
- package/src/console/ui/clock/confirmation.ts +34 -0
- package/src/console/ui/clock/findings.ts +40 -0
- package/src/console/ui/clock/fixture.ts +111 -0
- package/src/console/ui/clock/health.test.ts +25 -0
- package/src/console/ui/clock/health.ts +61 -0
- package/src/console/ui/clock/index.ts +49 -0
- package/src/console/ui/clock/search.test.ts +39 -0
- package/src/console/ui/clock/search.ts +76 -0
- package/src/console/ui/clock/timeline.test.ts +44 -0
- package/src/console/ui/clock/timeline.ts +41 -0
- package/src/console/ui/clock/types.ts +78 -0
- package/src/console/ui/clock/waiting-on.test.ts +34 -0
- package/src/console/ui/clock/waiting-on.ts +83 -0
- package/src/console/ui/confirmation.unify.test.ts +92 -0
- package/src/console/ui/diff/DiffA11yView.tsx +85 -0
- package/src/console/ui/diff/a11y.test.tsx +99 -0
- package/src/console/ui/diff/fixture.ts +85 -0
- package/src/console/ui/diff/group.test.ts +58 -0
- package/src/console/ui/diff/group.ts +97 -0
- package/src/console/ui/diff/index.ts +38 -0
- package/src/console/ui/diff/search.test.ts +32 -0
- package/src/console/ui/diff/search.ts +75 -0
- package/src/console/ui/diff/summary.ts +74 -0
- package/src/console/ui/diff/types.ts +48 -0
- package/src/console/ui/dist/assets/index-B71Yl_SS.js +10 -0
- package/src/console/ui/dist/assets/panel-access-Dd37LU2c.js +64 -0
- package/src/console/ui/dist/assets/panel-ai-CC7LR6-J.js +1 -0
- package/src/console/ui/dist/assets/panel-architecture-B5b3iKCz.js +1 -0
- package/src/console/ui/dist/assets/panel-channels-CeNjTKXp.js +1 -0
- package/src/console/ui/dist/assets/panel-clock-DgFTLoHV.js +1 -0
- package/src/console/ui/dist/assets/panel-diff-DxehccqB.js +1 -0
- package/src/console/ui/dist/assets/panel-flows-BtrVn-Eg.js +45 -0
- package/src/console/ui/dist/assets/panel-gates-Z9MKRGdH.js +1 -0
- package/src/console/ui/dist/assets/panel-overview-Bd48d9km.js +1 -0
- package/src/console/ui/dist/assets/panel-plugins-DWd0TowH.js +1 -0
- package/src/console/ui/dist/assets/panel-runs-BwsWqKeB.js +1 -0
- package/src/console/ui/dist/assets/panel-signals-9najbZY2.js +1 -0
- package/src/console/ui/dist/assets/panel-store-OHkP2pDp.js +1 -0
- package/src/console/ui/dist/assets/panel-traces-tn2JoY8U.js +1 -0
- package/src/console/ui/dist/assets/panel-vault-BbfWdox0.js +1 -0
- package/src/console/ui/dist/assets/rolldown-runtime-CNC7AqOf.js +1 -0
- package/src/console/ui/dist/assets/style-Cnl7WLya.css +3 -0
- package/src/console/ui/dist/index.html +14 -0
- package/src/console/ui/flows/FlowsA11yView.tsx +155 -0
- package/src/console/ui/flows/a11y.test.tsx +105 -0
- package/src/console/ui/flows/buffer.test.ts +91 -0
- package/src/console/ui/flows/buffer.ts +118 -0
- package/src/console/ui/flows/confirmation.ts +131 -0
- package/src/console/ui/flows/contract.test.ts +89 -0
- package/src/console/ui/flows/contract.ts +353 -0
- package/src/console/ui/flows/fixture.ts +81 -0
- package/src/console/ui/flows/graph.test.ts +101 -0
- package/src/console/ui/flows/graph.ts +549 -0
- package/src/console/ui/flows/index.ts +87 -0
- package/src/console/ui/flows/save-as-test.test.ts +47 -0
- package/src/console/ui/flows/save-as-test.ts +99 -0
- package/src/console/ui/flows/search.ts +255 -0
- package/src/console/ui/flows/tiers.ts +140 -0
- package/src/console/ui/gates/GatesA11yView.tsx +192 -0
- package/src/console/ui/gates/a11y.test.tsx +116 -0
- package/src/console/ui/gates/audit.test.ts +40 -0
- package/src/console/ui/gates/audit.ts +63 -0
- package/src/console/ui/gates/denial.test.ts +36 -0
- package/src/console/ui/gates/denial.ts +51 -0
- package/src/console/ui/gates/findings.ts +19 -0
- package/src/console/ui/gates/fixture.ts +189 -0
- package/src/console/ui/gates/group.test.ts +30 -0
- package/src/console/ui/gates/group.ts +102 -0
- package/src/console/ui/gates/index.ts +47 -0
- package/src/console/ui/gates/search.test.ts +49 -0
- package/src/console/ui/gates/search.ts +115 -0
- package/src/console/ui/gates/types.ts +121 -0
- package/src/console/ui/overview/OverviewA11yView.tsx +152 -0
- package/src/console/ui/overview/a11y.test.tsx +113 -0
- package/src/console/ui/overview/busiest.ts +26 -0
- package/src/console/ui/overview/compose.ts +133 -0
- package/src/console/ui/overview/cost.test.ts +39 -0
- package/src/console/ui/overview/cost.ts +138 -0
- package/src/console/ui/overview/fixture.ts +161 -0
- package/src/console/ui/overview/golden.ts +57 -0
- package/src/console/ui/overview/index.ts +59 -0
- package/src/console/ui/overview/rank.test.ts +136 -0
- package/src/console/ui/overview/rank.ts +210 -0
- package/src/console/ui/overview/slo.test.ts +73 -0
- package/src/console/ui/overview/slo.ts +229 -0
- package/src/console/ui/overview/types.ts +121 -0
- package/src/console/ui/overview/verdict.ts +131 -0
- package/src/console/ui/plugins/PluginsA11yView.tsx +227 -0
- package/src/console/ui/plugins/a11y.test.tsx +97 -0
- package/src/console/ui/plugins/command.test.ts +22 -0
- package/src/console/ui/plugins/command.ts +27 -0
- package/src/console/ui/plugins/findings.ts +39 -0
- package/src/console/ui/plugins/fixture.ts +233 -0
- package/src/console/ui/plugins/group.test.ts +38 -0
- package/src/console/ui/plugins/group.ts +67 -0
- package/src/console/ui/plugins/index.ts +40 -0
- package/src/console/ui/plugins/search.ts +67 -0
- package/src/console/ui/plugins/types.ts +115 -0
- package/src/console/ui/runs/RunsA11yView.tsx +267 -0
- package/src/console/ui/runs/a11y.test.tsx +99 -0
- package/src/console/ui/runs/explain.test.ts +23 -0
- package/src/console/ui/runs/explain.ts +32 -0
- package/src/console/ui/runs/fixture.ts +189 -0
- package/src/console/ui/runs/group.test.ts +24 -0
- package/src/console/ui/runs/group.ts +85 -0
- package/src/console/ui/runs/histogram.test.ts +31 -0
- package/src/console/ui/runs/histogram.ts +85 -0
- package/src/console/ui/runs/index.ts +75 -0
- package/src/console/ui/runs/project.ts +122 -0
- package/src/console/ui/runs/query.test.ts +50 -0
- package/src/console/ui/runs/query.ts +283 -0
- package/src/console/ui/runs/search.test.ts +45 -0
- package/src/console/ui/runs/search.ts +141 -0
- package/src/console/ui/runs/trace-link.test.ts +30 -0
- package/src/console/ui/runs/trace-link.ts +99 -0
- package/src/console/ui/runs/types.ts +137 -0
- package/src/console/ui/shell/App.tsx +56 -0
- package/src/console/ui/shell/client.ts +1715 -0
- package/src/console/ui/shell/components/ui.tsx +110 -0
- package/src/console/ui/shell/index.html +12 -0
- package/src/console/ui/shell/layout/Shell.tsx +95 -0
- package/src/console/ui/shell/main.tsx +281 -0
- package/src/console/ui/shell/panels/Access.tsx +5 -0
- package/src/console/ui/shell/panels/Ai.tsx +5 -0
- package/src/console/ui/shell/panels/Architecture.tsx +5 -0
- package/src/console/ui/shell/panels/Channels.tsx +5 -0
- package/src/console/ui/shell/panels/Clock.tsx +5 -0
- package/src/console/ui/shell/panels/Diff.tsx +5 -0
- package/src/console/ui/shell/panels/Flows.tsx +5 -0
- package/src/console/ui/shell/panels/Gates.tsx +5 -0
- package/src/console/ui/shell/panels/Overview.tsx +6 -0
- package/src/console/ui/shell/panels/Plugins.tsx +5 -0
- package/src/console/ui/shell/panels/Runs.tsx +5 -0
- package/src/console/ui/shell/panels/Signals.tsx +5 -0
- package/src/console/ui/shell/panels/Store.tsx +5 -0
- package/src/console/ui/shell/panels/Traces.tsx +5 -0
- package/src/console/ui/shell/panels/Vault.tsx +5 -0
- package/src/console/ui/shell/panels/access/AccessPanel.tsx +813 -0
- package/src/console/ui/shell/panels/ai/AiPanel.tsx +563 -0
- package/src/console/ui/shell/panels/architecture/ArchitecturePanel.tsx +377 -0
- package/src/console/ui/shell/panels/channels/ChannelsPanel.tsx +454 -0
- package/src/console/ui/shell/panels/clock/ClockPanel.tsx +479 -0
- package/src/console/ui/shell/panels/diff/DiffPanel.tsx +275 -0
- package/src/console/ui/shell/panels/flows/ContractEditor.tsx +301 -0
- package/src/console/ui/shell/panels/flows/FlowDrawer.tsx +350 -0
- package/src/console/ui/shell/panels/flows/FlowsPanel.tsx +502 -0
- package/src/console/ui/shell/panels/gates/GatesPanel.tsx +482 -0
- package/src/console/ui/shell/panels/overview/OverviewPanel.tsx +428 -0
- package/src/console/ui/shell/panels/plugins/PluginsPanel.tsx +413 -0
- package/src/console/ui/shell/panels/runs/RunsPanel.tsx +649 -0
- package/src/console/ui/shell/panels/signals/SignalsPanel.tsx +840 -0
- package/src/console/ui/shell/panels/store/StorePanel.tsx +787 -0
- package/src/console/ui/shell/panels/traces/TracesPanel.tsx +539 -0
- package/src/console/ui/shell/panels/vault/VaultPanel.tsx +449 -0
- package/src/console/ui/shell/plugin/Sandbox.tsx +29 -0
- package/src/console/ui/shell/setup/Wizard.tsx +189 -0
- package/src/console/ui/shell/styles.css +75 -0
- package/src/console/ui/signals/SignalsA11yView.tsx +276 -0
- package/src/console/ui/signals/a11y.test.tsx +99 -0
- package/src/console/ui/signals/confirmation.test.ts +39 -0
- package/src/console/ui/signals/confirmation.ts +63 -0
- package/src/console/ui/signals/dry-run.test.ts +18 -0
- package/src/console/ui/signals/dry-run.ts +36 -0
- package/src/console/ui/signals/durable.test.ts +22 -0
- package/src/console/ui/signals/durable.ts +41 -0
- package/src/console/ui/signals/findings.ts +33 -0
- package/src/console/ui/signals/fixture.ts +242 -0
- package/src/console/ui/signals/group.test.ts +32 -0
- package/src/console/ui/signals/group.ts +49 -0
- package/src/console/ui/signals/index.ts +52 -0
- package/src/console/ui/signals/monitor.test.ts +30 -0
- package/src/console/ui/signals/monitor.ts +79 -0
- package/src/console/ui/signals/schema-form.test.ts +34 -0
- package/src/console/ui/signals/schema-form.ts +112 -0
- package/src/console/ui/signals/search.ts +102 -0
- package/src/console/ui/signals/types.ts +71 -0
- package/src/console/ui/store/StoreA11yView.tsx +199 -0
- package/src/console/ui/store/a11y.test.tsx +99 -0
- package/src/console/ui/store/cache-view.test.ts +13 -0
- package/src/console/ui/store/cache-view.ts +36 -0
- package/src/console/ui/store/confirmation.test.ts +38 -0
- package/src/console/ui/store/confirmation.ts +55 -0
- package/src/console/ui/store/dry-run.test.ts +15 -0
- package/src/console/ui/store/dry-run.ts +29 -0
- package/src/console/ui/store/fixture.ts +163 -0
- package/src/console/ui/store/group.test.ts +21 -0
- package/src/console/ui/store/group.ts +41 -0
- package/src/console/ui/store/index.ts +40 -0
- package/src/console/ui/store/search.ts +78 -0
- package/src/console/ui/store/types.ts +65 -0
- package/src/console/ui/store/will-not-fire.test.ts +19 -0
- package/src/console/ui/store/will-not-fire.ts +40 -0
- package/src/console/ui/traces/TracesA11yView.tsx +200 -0
- package/src/console/ui/traces/a11y.test.tsx +97 -0
- package/src/console/ui/traces/chain.test.ts +61 -0
- package/src/console/ui/traces/chain.ts +144 -0
- package/src/console/ui/traces/critical-path.test.ts +24 -0
- package/src/console/ui/traces/critical-path.ts +59 -0
- package/src/console/ui/traces/filter.test.ts +78 -0
- package/src/console/ui/traces/filter.ts +112 -0
- package/src/console/ui/traces/fixture.ts +126 -0
- package/src/console/ui/traces/fold.test.ts +67 -0
- package/src/console/ui/traces/fold.ts +170 -0
- package/src/console/ui/traces/index.ts +64 -0
- package/src/console/ui/traces/mini.ts +65 -0
- package/src/console/ui/traces/replay.test.ts +24 -0
- package/src/console/ui/traces/replay.ts +35 -0
- package/src/console/ui/traces/sampling.test.ts +26 -0
- package/src/console/ui/traces/sampling.ts +66 -0
- package/src/console/ui/traces/search.ts +148 -0
- package/src/console/ui/traces/tier.ts +72 -0
- package/src/console/ui/traces/types.ts +125 -0
- package/src/console/ui/tsconfig.json +20 -0
- package/src/console/ui/vault/VaultA11yView.tsx +177 -0
- package/src/console/ui/vault/a11y.test.tsx +97 -0
- package/src/console/ui/vault/blast-radius.test.ts +35 -0
- package/src/console/ui/vault/blast-radius.ts +55 -0
- package/src/console/ui/vault/confirmation.test.ts +41 -0
- package/src/console/ui/vault/confirmation.ts +39 -0
- package/src/console/ui/vault/dormant.test.ts +37 -0
- package/src/console/ui/vault/dormant.ts +28 -0
- package/src/console/ui/vault/export-safe.test.ts +30 -0
- package/src/console/ui/vault/export-safe.ts +65 -0
- package/src/console/ui/vault/fixture.ts +75 -0
- package/src/console/ui/vault/group.test.ts +25 -0
- package/src/console/ui/vault/group.ts +50 -0
- package/src/console/ui/vault/index.ts +45 -0
- package/src/console/ui/vault/search.ts +62 -0
- package/src/console/ui/vault/types.ts +57 -0
- package/src/console/ui/vite.config.ts +84 -0
- package/src/console/xss.gate.test.ts +118 -0
- package/src/docker/compose.ts +226 -0
- package/src/docker/credentials.ts +25 -0
- package/src/docker/derive.ts +83 -0
- package/src/docker/docker.test.ts +185 -0
- package/src/docker/dockerfile.integration.test.ts +170 -0
- package/src/docker/dockerfile.ts +39 -0
- package/src/docker/helpers.ts +103 -0
- package/src/docker/index.ts +52 -0
- package/src/docker/pin.ts +90 -0
- package/src/docker/recipes/index.ts +33 -0
- package/src/docker/recipes/postgres.ts +18 -0
- package/src/docker/recipes/redis.ts +18 -0
- package/src/docker/stack.integration.test.ts +140 -0
- package/src/docker/stack.ts +62 -0
- package/src/docker/types.ts +134 -0
- package/src/drivers/ai-anthropic.ts +128 -0
- package/src/drivers/ai-mock.ts +82 -0
- package/src/drivers/ai-openai-compatible.ts +139 -0
- package/src/drivers/ai-providers.test.ts +163 -0
- package/src/drivers/ai-types.ts +83 -0
- package/src/drivers/bun-native-completeness.test.ts +155 -0
- package/src/drivers/channel-console.ts +118 -0
- package/src/drivers/channel-fcm.ts +96 -0
- package/src/drivers/channel-resend.ts +27 -0
- package/src/drivers/channel-smtp.ts +33 -0
- package/src/drivers/channel-types.ts +160 -0
- package/src/drivers/channel-unifonic.ts +79 -0
- package/src/drivers/channel-wa-cloud.ts +84 -0
- package/src/drivers/channel-webpush.ts +317 -0
- package/src/drivers/conformance.test.ts +89 -0
- package/src/drivers/conformance.ts +162 -0
- package/src/drivers/fs.ts +73 -0
- package/src/drivers/index.ts +194 -0
- package/src/drivers/kv-lua.ts +222 -0
- package/src/drivers/memory.ts +472 -0
- package/src/drivers/pgvector.ts +130 -0
- package/src/drivers/postgres.ts +221 -0
- package/src/drivers/redis.ts +254 -0
- package/src/drivers/s3.ts +129 -0
- package/src/drivers/signal-engine.ts +690 -0
- package/src/drivers/signal-memory.ts +27 -0
- package/src/drivers/signal-nats.ts +131 -0
- package/src/drivers/signal-postgres.ts +1089 -0
- package/src/drivers/signal-redis.ts +275 -0
- package/src/drivers/signal-types.ts +328 -0
- package/src/drivers/sqlite.ts +53 -0
- package/src/drivers/types.ts +334 -0
- package/src/drivers/vault-dotenv-parse.ts +56 -0
- package/src/drivers/vault-env.ts +101 -0
- package/src/drivers/vault-infisical.ts +61 -0
- package/src/drivers/vault-managed.ts +42 -0
- package/src/drivers/vault-memory.ts +38 -0
- package/src/drivers/vault-openbao.ts +80 -0
- package/src/drivers/vault-sops.ts +252 -0
- package/src/drivers/vault-types.ts +84 -0
- package/src/elements/ai/declare.ts +206 -0
- package/src/elements/ai/eval.ts +113 -0
- package/src/elements/ai/pii.ts +108 -0
- package/src/elements/ai/runtime.ts +540 -0
- package/src/elements/ai/schema.ts +194 -0
- package/src/elements/ai.test.ts +393 -0
- package/src/elements/ai.ts +56 -0
- package/src/elements/channel/consent.ts +81 -0
- package/src/elements/channel/costs.test.ts +62 -0
- package/src/elements/channel/costs.ts +130 -0
- package/src/elements/channel/declare.ts +141 -0
- package/src/elements/channel/email-auth.test.ts +47 -0
- package/src/elements/channel/email-auth.ts +109 -0
- package/src/elements/channel/locale.ts +97 -0
- package/src/elements/channel/mask.test.ts +19 -0
- package/src/elements/channel/mask.ts +60 -0
- package/src/elements/channel/mime.ts +23 -0
- package/src/elements/channel/outcomes.test.ts +40 -0
- package/src/elements/channel/outcomes.ts +126 -0
- package/src/elements/channel/receipts.ts +121 -0
- package/src/elements/channel/runtime.ts +500 -0
- package/src/elements/channel/suppression.ts +136 -0
- package/src/elements/channel.test.ts +232 -0
- package/src/elements/channel.ts +109 -0
- package/src/elements/clock/actions.ts +170 -0
- package/src/elements/clock/declare.ts +58 -0
- package/src/elements/clock/dst.ts +197 -0
- package/src/elements/clock/durable.ts +140 -0
- package/src/elements/clock/duration.ts +29 -0
- package/src/elements/clock/health.test.ts +103 -0
- package/src/elements/clock/health.ts +112 -0
- package/src/elements/clock/leader.ts +127 -0
- package/src/elements/clock/reconcile.ts +241 -0
- package/src/elements/clock/runtime.ts +243 -0
- package/src/elements/clock/schedule.ts +262 -0
- package/src/elements/clock/time-travel.ts +53 -0
- package/src/elements/clock.test.ts +365 -0
- package/src/elements/clock.ts +80 -0
- package/src/elements/gate/declare.ts +134 -0
- package/src/elements/gate/permissions.ts +104 -0
- package/src/elements/gate/runtime.ts +177 -0
- package/src/elements/gate/strategies.ts +388 -0
- package/src/elements/gate.test.ts +145 -0
- package/src/elements/gate.ts +41 -0
- package/src/elements/index.ts +169 -0
- package/src/elements/signal/chaos-child.ts +47 -0
- package/src/elements/signal/declare.ts +77 -0
- package/src/elements/signal/dry-run-replay.test.ts +95 -0
- package/src/elements/signal/dry-run-write-isolation.test.ts +94 -0
- package/src/elements/signal/reconcile.test.ts +23 -0
- package/src/elements/signal/reconcile.ts +122 -0
- package/src/elements/signal/runtime.ts +94 -0
- package/src/elements/signal.test.ts +457 -0
- package/src/elements/signal.ts +26 -0
- package/src/elements/store/cache.ts +197 -0
- package/src/elements/store/classify.ts +125 -0
- package/src/elements/store/declare.ts +200 -0
- package/src/elements/store/files-policy.test.ts +31 -0
- package/src/elements/store/files-policy.ts +70 -0
- package/src/elements/store/replica.ts +68 -0
- package/src/elements/store/runtime.ts +393 -0
- package/src/elements/store/sql-condition.ts +205 -0
- package/src/elements/store/sql-session.ts +579 -0
- package/src/elements/store/table.ts +282 -0
- package/src/elements/store.test.ts +370 -0
- package/src/elements/store.ts +99 -0
- package/src/elements/vault/declare.ts +143 -0
- package/src/elements/vault/fingerprint.ts +30 -0
- package/src/elements/vault/redact.ts +52 -0
- package/src/elements/vault/runtime.ts +461 -0
- package/src/elements/vault.test.ts +296 -0
- package/src/elements/vault.ts +44 -0
- package/src/index.ts +183 -0
- package/src/kernel/adopt-routes.ts +194 -0
- package/src/kernel/app.ts +1068 -0
- package/src/kernel/auth-resolve.ts +93 -0
- package/src/kernel/boot.test.ts +173 -0
- package/src/kernel/boot.ts +439 -0
- package/src/kernel/budget-entry.ts +55 -0
- package/src/kernel/budget.test.ts +19 -0
- package/src/kernel/call.test.ts +83 -0
- package/src/kernel/capability.ts +113 -0
- package/src/kernel/dry-run.test.ts +64 -0
- package/src/kernel/dry-run.ts +171 -0
- package/src/kernel/effects.test.ts +89 -0
- package/src/kernel/effects.ts +140 -0
- package/src/kernel/errors.registry.test.ts +39 -0
- package/src/kernel/errors.ts +225 -0
- package/src/kernel/flow.test.ts +154 -0
- package/src/kernel/flow.ts +290 -0
- package/src/kernel/fx.test.ts +245 -0
- package/src/kernel/fx.ts +996 -0
- package/src/kernel/hook-timing.test.ts +72 -0
- package/src/kernel/hook-timing.ts +190 -0
- package/src/kernel/hooks.test.ts +181 -0
- package/src/kernel/hooks.ts +275 -0
- package/src/kernel/index.ts +278 -0
- package/src/kernel/journal.ts +405 -0
- package/src/kernel/journey.ts +75 -0
- package/src/kernel/on.ts +74 -0
- package/src/kernel/pipeline.test.ts +349 -0
- package/src/kernel/pipeline.ts +245 -0
- package/src/kernel/plug.ts +82 -0
- package/src/kernel/plugin/capabilities.test.ts +84 -0
- package/src/kernel/plugin/conflicts.test.ts +106 -0
- package/src/kernel/plugin/decorate.test.ts +111 -0
- package/src/kernel/plugin/scoping.test.ts +138 -0
- package/src/kernel/plugin.ts +485 -0
- package/src/kernel/rate-limit.ts +25 -0
- package/src/kernel/registry.ts +398 -0
- package/src/kernel/router.test.ts +114 -0
- package/src/kernel/router.ts +556 -0
- package/src/kernel/routing-budget.test.ts +19 -0
- package/src/kernel/run-telemetry.ts +70 -0
- package/src/kernel/triggers.ts +324 -0
- package/src/kernel/unit.ts +88 -0
- package/src/manifest/diff.test.ts +866 -0
- package/src/manifest/diff.ts +1670 -0
- package/src/manifest/fixtures/base.manifest.json +112 -0
- package/src/manifest/fixtures/skyport.excerpt.json +51 -0
- package/src/manifest/fixtures/skyport.manifest.json +153 -0
- package/src/manifest/index.ts +27 -0
- package/src/manifest/types.ts +358 -0
- package/src/manifest/undeclared.test.ts +82 -0
- package/src/manifest/undeclared.ts +65 -0
- package/src/manifest/validate.test.ts +105 -0
- package/src/manifest/validate.ts +174 -0
- package/src/mcp/authorization.ts +340 -0
- package/src/mcp/confirmation.ts +174 -0
- package/src/mcp/data.ts +90 -0
- package/src/mcp/index.ts +80 -0
- package/src/mcp/injection.gate.test.ts +176 -0
- package/src/mcp/mcp.test.ts +348 -0
- package/src/mcp/protocol.ts +172 -0
- package/src/mcp/server.ts +283 -0
- package/src/mcp/session.ts +139 -0
- package/src/mcp/tools.ts +391 -0
- package/src/plugins/catalogue.test.ts +48 -0
- package/src/plugins/catalogue.ts +113 -0
- package/src/plugins/node-import-scan.test.ts +28 -0
- package/src/plugins/node-import-scan.ts +98 -0
- package/src/plugins/supply-chain.test.ts +48 -0
- package/src/plugins/supply-chain.ts +460 -0
- package/src/release/index.ts +30 -0
- package/src/release/limits.ts +20 -0
- package/src/release/measure.ts +443 -0
- package/src/release/publish.ts +56 -0
- package/src/runs/bench.test.ts +93 -0
- package/src/runs/collect.ts +144 -0
- package/src/runs/drivers/clickhouse.ts +108 -0
- package/src/runs/drivers/files.ts +201 -0
- package/src/runs/drivers/memory.ts +94 -0
- package/src/runs/drivers/postgres.ts +110 -0
- package/src/runs/duckdb.ts +99 -0
- package/src/runs/index.ts +82 -0
- package/src/runs/outlier.ts +180 -0
- package/src/runs/parquet.ts +210 -0
- package/src/runs/privacy.ts +49 -0
- package/src/runs/runs.test.ts +324 -0
- package/src/runs/runtime.ts +229 -0
- package/src/runs/shred.ts +243 -0
- package/src/runs/telemetry.ts +10 -0
- package/src/runs/types.ts +179 -0
- package/src/runtime/bun.ts +140 -0
- package/src/runtime/cold-start.bench.ts +20 -0
- package/src/runtime/index.ts +46 -0
- package/src/runtime/primitives.ts +242 -0
- package/src/runtime/security.test.ts +170 -0
- package/src/runtime/security.ts +168 -0
- package/src/runtime/serve.test.ts +223 -0
- package/src/runtime/types.ts +217 -0
- package/src/runtime/web-standard.ts +77 -0
- package/src/test/create-test-app.test.ts +161 -0
- package/src/test/create-test-app.ts +533 -0
- package/src/test/index.ts +21 -0
- package/src/test/provisions.integration.test.ts +174 -0
- package/src/upgrade/codemods.test.ts +58 -0
- package/src/upgrade/codemods.ts +83 -0
- package/src/validation/index.ts +23 -0
- package/src/validation/standard-schema.test.ts +96 -0
- package/src/validation/standard-schema.ts +316 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
# OKE — The Unified Theory of Backend
|
|
2
|
+
|
|
3
|
+
**Package:** `okengine` · **CLI:** `oke` · **License:** MIT · **Status:** design closed, ready for implementation
|
|
4
|
+
|
|
5
|
+
> One law. Eight elements. Ten exports. One package. One manifest.
|
|
6
|
+
> Every backend need is **derived**, never added.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Part I — The Idea
|
|
11
|
+
|
|
12
|
+
## 1. The problem with every framework that came before
|
|
13
|
+
|
|
14
|
+
Hono, Elysia, Encore, iii, NestJS, Nitro — and everything before them — share one hidden flaw: **they are collections of separate inventions bundled behind a single logo.** A router, plus a queue library, plus a cron library, plus a websocket layer, plus a tracing integration. The concepts don't derive from one another; they merely ship together.
|
|
15
|
+
|
|
16
|
+
That is why frameworks bloat, why their documentation sprawls into dozens of unrelated pages, and why none of them survives a decade intact. Each new infrastructure fashion adds a *concept*, and concepts never get removed.
|
|
17
|
+
|
|
18
|
+
## 2. The move
|
|
19
|
+
|
|
20
|
+
Stop adding concepts. **Find the smallest set of laws from which everything else follows** — the way physics reduced a thousand phenomena to a few equations.
|
|
21
|
+
|
|
22
|
+
If the laws are right, the framework stays complete for a hundred years regardless of how infrastructure changes, because new technology becomes a **driver**, never a **new concept**.
|
|
23
|
+
|
|
24
|
+
## 3. Positioning
|
|
25
|
+
|
|
26
|
+
> **OKE is the batteries-included TypeScript backend for the Bun era:** contract-first APIs with end-to-end type safety, declarative infrastructure primitives, an OpenTelemetry-native Console, secure-by-default auth and ABAC — pure TypeScript, Web-Standards portable, MIT-licensed, self-hostable with zero cloud lock-in.
|
|
27
|
+
|
|
28
|
+
*"Encore's batteries and dashboard, Elysia's speed and DX, Hono's portability — without the Rust lock-in, the cloud gravity, or the source-available license."*
|
|
29
|
+
|
|
30
|
+
| | Hono | Elysia | Encore.ts | iii | **OKE** |
|
|
31
|
+
|---|---|---|---|---|---|
|
|
32
|
+
| Primary runtime | Multi (Web Std) | Bun-first | Node + Rust core | Rust engine, polyglot | **Bun-first, Web-Std portable** |
|
|
33
|
+
| License | MIT | MIT | MPL-2.0 | ELv2 engine | **MIT** |
|
|
34
|
+
| Typed client | hc RPC | Eden Treaty | generated | SDK | **contract-first + live queries** |
|
|
35
|
+
| DB · queue · cron · storage | ❌ | ❌ | ✅ | ✅ | **✅ (7 elements)** |
|
|
36
|
+
| Durable workflows | ❌ | ❌ | ❌ | partial | **✅ (a flag)** |
|
|
37
|
+
| Local Console | ❌ | ❌ | ✅ | ✅ | **✅ (dev + prod)** |
|
|
38
|
+
| Auto cache invalidation | ❌ | ❌ | ❌ | ❌ | **✅ (from effects)** |
|
|
39
|
+
| Least-privilege by compiler | ❌ | ❌ | ❌ | ❌ | **✅** |
|
|
40
|
+
| Human channels (email/SMS/WA) | ❌ | ❌ | ❌ | ❌ | **✅ (7th element)** |
|
|
41
|
+
| AI in the application (models, prompts, agents) | ❌ | ❌ | ❌ | ❌ | **✅ (8th element)** |
|
|
42
|
+
| Self-host, no lock-in | ✅ | ✅ | ✅ (Cloud optional) | ⚠️ | **✅ first-class** |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# Part II — The Laws
|
|
47
|
+
|
|
48
|
+
## 4. The One Law
|
|
49
|
+
|
|
50
|
+
> **Every backend behavior is a Flow: `on(Trigger) → Effects`.**
|
|
51
|
+
|
|
52
|
+
There are no separate species called "endpoints", "handlers", "consumers", "jobs", "subscribers", or "workflows". There is one species — the **Flow** — and triggers are typed values:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
on(http.post("/bookings"), createBooking); // "an API endpoint"
|
|
56
|
+
on(every("10m"), expireStale); // "a cron job"
|
|
57
|
+
on(orderPlaced, sendReceipt); // "a queue consumer"
|
|
58
|
+
on(db.table(users).changed("email"), reverify); // "a CDC trigger"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
One law → one mental model → one documentation page → one hook pipeline → one trace shape → one thing for an AI agent to learn.
|
|
62
|
+
|
|
63
|
+
**Learning OKE is learning one sentence.**
|
|
64
|
+
|
|
65
|
+
## 5. The Eight Elements
|
|
66
|
+
|
|
67
|
+
Everything a backend has ever needed reduces to eight typed elements. An element earns its place **only if it has irreducible physics.** New infrastructure becomes a new driver for an existing element — never a ninth element.
|
|
68
|
+
|
|
69
|
+
| Element | Replaces the zoo of | Essence |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| **Flow** | endpoint · handler · consumer · job · workflow · webhook | behavior |
|
|
72
|
+
| **Signal** | queue · pub/sub · stream · websocket · SSE · event bus | data in motion |
|
|
73
|
+
| **Store** | database · cache · KV · file storage · search index | data at rest (`sql` · `kv` · `files` · `index`) |
|
|
74
|
+
| **Clock** | cron · delay · timeout · durable sleep · TTL | time |
|
|
75
|
+
| **Gate** | auth · session · ABAC · rate limit · quota · feature flag | permission to act |
|
|
76
|
+
| **Vault** | secrets · config · environment | protected knowledge |
|
|
77
|
+
| **Channel** | email · SMS · WhatsApp · push | reaching humans |
|
|
78
|
+
| **AI** | model calls · prompts · embeddings · agents · RAG | reaching machine intelligence |
|
|
79
|
+
|
|
80
|
+
### Why queue, pub/sub, and stream collapse into one Signal
|
|
81
|
+
|
|
82
|
+
They were always the same object with different **delivery physics**. So delivery becomes an option, not three ecosystems:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
export const orderPlaced = signal("order-placed", {
|
|
86
|
+
schema: z.object({ orderId: z.string() }),
|
|
87
|
+
delivery: "once", // "once" → queue semantics: competing consumers, retries, DLQ
|
|
88
|
+
// "broadcast" → pub/sub semantics: fan-out to every subscriber
|
|
89
|
+
// "live" → stream semantics: client-subscribable, replayable
|
|
90
|
+
retries: 5, deadLetter: true,
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`delivery` is **mandatory with no default.** Delivery physics is a semantic decision; guessing it produces silent, expensive bugs.
|
|
95
|
+
|
|
96
|
+
### Why Channel is an element and not a library
|
|
97
|
+
|
|
98
|
+
Reaching a human has physics that machine messaging does not: localized templates, consent and opt-out, delivery receipts and bounces, and fallback chains across mediums. A Signal cannot express any of it. Hence the seventh element — and no eighth.
|
|
99
|
+
|
|
100
|
+
### Why AI is an element and not a library
|
|
101
|
+
|
|
102
|
+
Apply the same test — does it have physics no existing element expresses?
|
|
103
|
+
|
|
104
|
+
| What an AI-powered backend needs | Covered by an existing element? |
|
|
105
|
+
|---|---|
|
|
106
|
+
| streaming tokens to the client | ✅ `Signal` with `delivery: "live"` |
|
|
107
|
+
| an agent loop with steps | ✅ `Flow` with `durable: true` |
|
|
108
|
+
| vector search for RAG | ✅ `Store` facet `index` |
|
|
109
|
+
| provider fallback chains | ✅ same pattern as `Channel` |
|
|
110
|
+
| **non-determinism** (same input ≠ same output) | ❌ breaks caching, testing, and replay |
|
|
111
|
+
| **cost as a first-class dimension** | ❌ no element has a concept of price per call |
|
|
112
|
+
| **prompts as versioned, evaluated artifacts** | ❌ neither a template nor a schema |
|
|
113
|
+
| **egress privacy boundaries** to third parties | ❌ Gates guard entry, not exit |
|
|
114
|
+
| **testing a non-deterministic output** | ❌ entirely different test physics |
|
|
115
|
+
|
|
116
|
+
Five properties are irreducible, so AI earns the eighth slot.
|
|
117
|
+
|
|
118
|
+
**On the tension with our own rule.** "New technology is a driver, not a concept" still holds — Anthropic → Bedrock → a 2030 provider are all drivers. But probabilistic inference is not new *infrastructure*; it is a new *category of interaction*. The symmetry is exact: **Channel reaches humans, AI reaches machine intelligence.** Neither can be expressed by Store or Signal.
|
|
119
|
+
|
|
120
|
+
## 6. Ten exports
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { on, flow, signal, store, clock, gate, vault, channel, ai, plugin } from "okengine";
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
That is the entire vocabulary. Everything else in this document is derived from it.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
# Part III — The Engine
|
|
131
|
+
|
|
132
|
+
## 7. The Effect System — where the magic compounds
|
|
133
|
+
|
|
134
|
+
Every Flow's **effects are part of its type**, inferred by the compiler from what it touches through `fx` — the single door to the outside world.
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const createBooking = flow({
|
|
138
|
+
in: CreateBooking, out: BookingId, errors: { FlightFull },
|
|
139
|
+
do: async (input, fx) => {
|
|
140
|
+
const left = await fx.store(db).countAvailable(input.flightId);
|
|
141
|
+
if (left < input.seats) return fx.fail("FlightFull", { seatsLeft: left });
|
|
142
|
+
const id = fx.id();
|
|
143
|
+
await fx.store(db).insert(bookings).values({ id, ...input });
|
|
144
|
+
await fx.emit(orderPlaced, { orderId: id });
|
|
145
|
+
return { id };
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
// inferred → effects: { reads: [sql:bookings], writes: [sql:bookings], emits: [order-placed] }
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Because effects are known statically, the following are **derived with zero extra code** — no framework has combined them before:
|
|
152
|
+
|
|
153
|
+
| # | Capability | How it falls out |
|
|
154
|
+
|---|---|---|
|
|
155
|
+
| 1 | **Automatic cache invalidation** | The compiler knows which writes touch the same keys a read used. Invalidation is *computed*, never hand-written. |
|
|
156
|
+
| 2 | **Live queries** | Mark a read `.live()`; clients re-render on exactly the writes that affect it. Realtime stops being a separate system. |
|
|
157
|
+
| 3 | **Durability as a flag** | `durable: true` journals every effect call; `fx.clock.sleep("7d")` survives deploys. Workflows are ordinary Flows with one option. |
|
|
158
|
+
| 4 | **Least privilege by construction** | Each Flow receives a capability token for only its declared effects. A compromised handler cannot touch what it never declared. |
|
|
159
|
+
| 5 | **Provably true architecture diagrams** | Edges *are* the declared effects. "What breaks if I change this table?" becomes a compiler query. |
|
|
160
|
+
| 6 | **Deterministic tests** | `fx` is the only door — swap it wholesale: memory drivers, frozen clock, recorded effects, golden effect-stream diffs. |
|
|
161
|
+
| 7 | **Semantic tree-shaking** | The manifest lists exactly which elements and drivers are used; the build emits only those. |
|
|
162
|
+
| 8 | **Transactional messaging** | `fx.emit()` enrolls in the same transaction as `fx.store()` writes — the dual-write bug is eliminated by default. |
|
|
163
|
+
| 9 | **Automatic replica routing** | Read-only flows route to read replicas without annotations. |
|
|
164
|
+
| 10 | **Time as a dimension** | Journaled effects enable `oke branch prod --at "yesterday"` and replay of a single flow against fixed code. |
|
|
165
|
+
| 11 | **Compile-time AI data governance** | Fields tagged `pii` cannot reach a third-party model: the build **fails** unless the flow masks them or declares `allowPii` explicitly. |
|
|
166
|
+
| 12 | **Provably bounded agents** | An agent's tools are your own flows, carrying their own gates and capabilities — so an agent physically cannot exceed what the code declares. Safety by structure, not by trusting the model. |
|
|
167
|
+
| 13 | **Cost as a visible effect** | The compiler knows which paths call a model, enabling per-flow and per-tenant budgets, cost per endpoint in the Console, and a Manifest Diff that warns *before* deploy: "this release adds ~$0.02 per request." |
|
|
168
|
+
|
|
169
|
+
Any one of these would headline a framework launch. All ten follow from one decision: **effects live in the types.**
|
|
170
|
+
|
|
171
|
+
## 8. The Manifest — the 100-year artifact
|
|
172
|
+
|
|
173
|
+
Code dies. Frameworks die. **Data formats survive** — SQL is from 1974, HTTP from 1991. So OKE's true product is not the runtime; it is the **Manifest**: a versioned, runtime-neutral, machine-readable description of your entire system, extracted from your TypeScript at build time.
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
your code ──compile──▶ manifest.oke.json ──▶ everything else is DERIVED
|
|
177
|
+
│
|
|
178
|
+
├─ typed client (+ live queries)
|
|
179
|
+
├─ OpenAPI + AsyncAPI + documentation
|
|
180
|
+
├─ architecture diagram (provably accurate — it IS the system)
|
|
181
|
+
├─ Console panels, traces, explorers
|
|
182
|
+
├─ MCP surface for AI agents
|
|
183
|
+
├─ least-privilege capability matrix
|
|
184
|
+
├─ cache invalidation keys
|
|
185
|
+
├─ replica read-routing plan
|
|
186
|
+
├─ Dockerfile + per-role compose files
|
|
187
|
+
├─ tree-shaken bundle contents
|
|
188
|
+
└─ test harness wiring
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The Manifest schema is a small formal spec, versioned independently of the runtime (`"oke": "1.0"`). **A runtime that does not exist yet can read a 2026 manifest and serve the system.** That is the honest meaning of "built for a hundred years": the description outlives every implementation.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
# Part IV — Governance
|
|
196
|
+
|
|
197
|
+
## 9. Adopt, don't reinvent — but bind natively
|
|
198
|
+
|
|
199
|
+
> **We never rebuild software that already exists at high quality. We bind to it through the runtime's native clients, and we name our drivers after protocols, not vendors.**
|
|
200
|
+
|
|
201
|
+
Two things get called "native." We mean the first, never the second:
|
|
202
|
+
|
|
203
|
+
| ✅ Native = runtime clients (what we do) | ❌ Native = our own reimplementation (what we don't) |
|
|
204
|
+
|---|---|
|
|
205
|
+
| `Bun.sql` · `bun:sqlite` · `Bun.redis` · `Bun.S3` · `Bun.password` · `node:crypto` | writing our own cache server, broker, object store, or secrets manager |
|
|
206
|
+
| zero npm client dependencies, maximum speed, one runtime API | duplicated effort, worse quality, a decade of other people's bugs to re-fix |
|
|
207
|
+
|
|
208
|
+
**We build only what genuinely does not exist:** the effect system, the Manifest and its derivations, the Console, the AoT compiler, the plugin engine, and the thin adapters connecting eight elements to real software.
|
|
209
|
+
|
|
210
|
+
**Everything else is adopted:** Postgres · Redis/Valkey · NATS · S3-compatible storage · SOPS/age · OpenBao · Infisical · SMTP · OpenTelemetry · Drizzle.
|
|
211
|
+
|
|
212
|
+
## 10. Drivers are named after protocols; images after vendors
|
|
213
|
+
|
|
214
|
+
Welding a vendor name into the architecture is a design bug. `kv: "dragonfly"` is wrong; `kv: "redis"` is right — it is a protocol, and Valkey, Dragonfly, KeyDB, and Upstash all speak it.
|
|
215
|
+
|
|
216
|
+
| Element | Driver (protocol / standard) | Any of these work, unchanged |
|
|
217
|
+
|---|---|---|
|
|
218
|
+
| `store.sql` | `sqlite` · `postgres` | Postgres · Neon · Supabase · RDS · Timescale · pgvector |
|
|
219
|
+
| `store.kv` | `memory` · `redis` | Redis · Valkey · Dragonfly · KeyDB · Upstash |
|
|
220
|
+
| `store.files` | `fs` · `s3` | AWS S3 · R2 · MinIO · SeaweedFS · RustFS · Garage · Backblaze |
|
|
221
|
+
| `signal` | `memory` · `postgres` · `redis` · `nats` · `kafka` | the matching servers, any vendor |
|
|
222
|
+
| `clock` | `memory` · `postgres` | — |
|
|
223
|
+
| `vault` | `env` · `sops` · `openbao` · `infisical` · managed | — |
|
|
224
|
+
| `channel.*` | `smtp` · `resend` · `ses` · `unifonic` · `twilio` · `wa-cloud` · `fcm` | any SMTP server |
|
|
225
|
+
| `store.index` | `pgvector` · `qdrant` · `meilisearch` · `typesense` | vector + full-text search for RAG |
|
|
226
|
+
| `ai` | `mock` · `anthropic` · `openai-compatible` · `bedrock` · `vertex` · `ollama` | `openai-compatible` covers vLLM, Groq, Together, LM Studio, and most self-hosted servers |
|
|
227
|
+
|
|
228
|
+
Vendor choice lives in `images`, keyed by **role**:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
images: { "store.sql": "pgvector/pgvector:pg17", "store.kv": "valkey/valkey:8-alpine" }
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 11. Always latest — in three tiers
|
|
235
|
+
|
|
236
|
+
| Tier | Rule | Why |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| **Our own toolchain** | latest always (TypeScript 7, Bun, oxc) | greenfield, no legacy; speed is part of the promise |
|
|
239
|
+
| **What we require of users** | conservative floor + day-one support for new majors | a framework demanding bleeding edge loses adoption |
|
|
240
|
+
| **Adopted infrastructure** | latest **stable**, pinned by digest | `latest` tags destroy reproducibility |
|
|
241
|
+
|
|
242
|
+
**Toolchain decision with teeth:** TypeScript 7 went GA on 8 July 2026 (Go-native, 8–12× faster builds) but ships **without a stable programmatic API until 7.1**. Therefore the Manifest extractor **never uses the TypeScript compiler API** — it uses **oxc** (Rust parser). We gain independence from TypeScript's release cycle, higher speed, and zero exposure to that gap. `tsc` is used for type-checking only.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
# Part V — Architecture
|
|
247
|
+
|
|
248
|
+
## 12. Layers
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
252
|
+
│ App = oke() + plugins (services, auth, panels — all plugins)│
|
|
253
|
+
├──────────────────────────────────────────────────────────────┤
|
|
254
|
+
│ Hooks: onRequest → onParse → onAuth → beforeHandle → │
|
|
255
|
+
│ handler → afterHandle → onError → onResponse │
|
|
256
|
+
├──────────────────────────────────────────────────────────────┤
|
|
257
|
+
│ Eight elements, reached only through `fx` │
|
|
258
|
+
├──────────────────────────────────────────────────────────────┤
|
|
259
|
+
│ Drivers (protocol-named) → real software │
|
|
260
|
+
├──────────────────────────────────────────────────────────────┤
|
|
261
|
+
│ Runtime adapters: Bun (primary) · Node · Edge (Web Standards) │
|
|
262
|
+
├──────────────────────────────────────────────────────────────┤
|
|
263
|
+
│ Observability: OpenTelemetry, always on │
|
|
264
|
+
└──────────────────────────────────────────────────────────────┘
|
|
265
|
+
▲ Manifest → client · Console · docs · infra · MCP
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 13. Core design decisions
|
|
269
|
+
|
|
270
|
+
| Layer | Decision |
|
|
271
|
+
|---|---|
|
|
272
|
+
| **Runtime** | Bun-first via `Bun.serve`; Web-Standards adapters for Node/Deno/Edge; target WinterTC Minimum Common Web API |
|
|
273
|
+
| **Router** | compiled RegExp matching with a Trie fallback (Hono's SmartRouter idea), linear preset for cold-start edge |
|
|
274
|
+
| **Validation** | Standard Schema — bring Zod 4, Valibot, ArkType, TypeBox |
|
|
275
|
+
| **AoT compiler** | Sucrose-style static analysis generates a minimal per-route parse/validate handler; **`aot: false` dynamic fallback** for `eval`-restricted runtimes |
|
|
276
|
+
| **Context** | per-request `fx` object with typed composition (`derive`/`decorate`); no decorator DI |
|
|
277
|
+
| **Infrastructure** | driver model (Nitro/unstorage-style): dev = memory/sqlite/fs ⇄ prod = real software |
|
|
278
|
+
| **Contracts** | schema in / schema out / typed errors → end-to-end types, OpenAPI, AsyncAPI, typed client |
|
|
279
|
+
| **Auth** | built-in flagship (hybrid JWT + revocable refresh, ABAC, MFA); provider seam for better-auth, Clerk, Supabase, Auth0, Kinde |
|
|
280
|
+
| **AI** | MCP server exposing catalog, schemas, effects, traces, and safe runtime actions |
|
|
281
|
+
|
|
282
|
+
## 14. Plugins — the extensibility law
|
|
283
|
+
|
|
284
|
+
A plugin is a function that receives the app, adds capabilities, and returns it **with accumulated types.** A plugin may contribute: flows, hooks, context decorations, elements, drivers, image recipes, DB schema, typed errors, client extensions, CLI commands, and Console panels.
|
|
285
|
+
|
|
286
|
+
> **Guarantee:** every built-in feature — auth, Console, docker derivation, channels — uses only the public plugin API. If the core team ever needs a private hook, the API is broken and gets fixed.
|
|
287
|
+
|
|
288
|
+
## 15. The Console (`:6533`)
|
|
289
|
+
|
|
290
|
+
Reads truth from the Manifest + OpenTelemetry. Runs in **development and production** (production behind authentication).
|
|
291
|
+
|
|
292
|
+
| Panel | Answers |
|
|
293
|
+
|---|---|
|
|
294
|
+
| **Catalog** | what exists — every flow, trigger, gate, schema, effect |
|
|
295
|
+
| **Architecture** | how it connects — a diagram that *is* the code |
|
|
296
|
+
| **API Explorer** | typed request forms; impersonate any scope set |
|
|
297
|
+
| **Traces** | one OTel trace across http → store → signal → durable steps |
|
|
298
|
+
| **Store** | DB explorer, files browser, replica lag, computed cache keys |
|
|
299
|
+
| **Signals** | queue depth, in-flight, DLQ contents, live-feed monitors |
|
|
300
|
+
| **Clock** | upcoming crons, sleeping durable flows ("wakes in 6d 22h") |
|
|
301
|
+
| **Gates** | permission matrix, rate-limit counters, MFA enforcement |
|
|
302
|
+
| **Channels** | outbound messages, delivery receipts, bounces, opt-outs |
|
|
303
|
+
| **Manifest Diff** | blast radius of a deploy: new effects, widened permissions |
|
|
304
|
+
|
|
305
|
+
**The constitutional rule:** the Console **reads truth and writes only through git.** Runtime actions (replay a DLQ message, trigger a cron, wake a durable flow) execute directly. Structural changes (add an index, raise retries) are emitted as **reviewable diffs into your working tree** — you approve, git records. Every element deep-links to the exact line in Cursor.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
# Part VI — Defaults
|
|
310
|
+
|
|
311
|
+
## 16. The default table
|
|
312
|
+
|
|
313
|
+
| Area | Default | Alternatives | Rationale |
|
|
314
|
+
|---|---|---|---|
|
|
315
|
+
| Runtime | Bun | Node · Deno · Edge | speed, native clients |
|
|
316
|
+
| Language | TypeScript 7, ESM only, strict | — | no CJS, no compromise |
|
|
317
|
+
| Manifest parser | oxc | SWC | independent of the TS release cycle |
|
|
318
|
+
| Validation | Standard Schema (Zod 4 in templates) | Valibot (edge) · ArkType · TypeBox | familiarity; AoT neutralizes runtime differences |
|
|
319
|
+
| ORM | Drizzle (peer dependency) | adapters later | never bundled, always yours |
|
|
320
|
+
| `store.sql` | dev `sqlite` · prod `postgres` | Neon · Supabase · RDS | `Bun.sql`, `bun:sqlite` |
|
|
321
|
+
| `store.kv` | dev `memory` · prod `redis` | Valkey · Dragonfly · KeyDB | protocol, not vendor |
|
|
322
|
+
| `store.files` | dev `fs` · prod `s3` | SeaweedFS · RustFS (beta) · MinIO · R2 | `Bun.S3` |
|
|
323
|
+
| `signal` | dev `memory` · prod **`postgres`** | `redis` · `nats` · `kafka` (explicit) | transactional with your data |
|
|
324
|
+
| `clock` | `postgres` | — | durability needs transactional storage |
|
|
325
|
+
| `vault` | dev `.env.local` · prod `sops`/age | OpenBao · Infisical · managed | existing standard, no invented format |
|
|
326
|
+
| `channel.email` | dev `console` · prod `smtp` | Resend · SES | no vendor lock-in |
|
|
327
|
+
| `delivery` | **none — must be declared** | — | semantic decision, never guessed |
|
|
328
|
+
| `store.index` | `pgvector` | Qdrant · Meilisearch · Typesense | RAG without another service |
|
|
329
|
+
| `ai` | dev `mock` · prod **none — must be declared** | Anthropic · openai-compatible · Bedrock · Vertex · Ollama | model choice is never guessed; `mock` keeps dev deterministic |
|
|
330
|
+
| AI + `pii` | **denied** | explicit `allowPii` | egress governance enforced at build time |
|
|
331
|
+
| AI caching | off (semantic cache opt-in) | — | non-deterministic output must not be silently reused |
|
|
332
|
+
| Auth | built-in, hybrid session, argon2id | better-auth · Clerk · Supabase · Auth0 · Kinde | works with zero config |
|
|
333
|
+
| Topology | `monolith` | `services` | start simple |
|
|
334
|
+
| Tenancy | off | row · schema · database | no complexity without need |
|
|
335
|
+
| Cache | automatic for live/read flows only | flag · manual | no surprises |
|
|
336
|
+
| Rate limit | `sliding-window-counter` | fixed-window · sliding-log · token-bucket · leaky-bucket | best accuracy/cost balance |
|
|
337
|
+
| i18n | `en` (configurable) | any locale | global default, user overrides |
|
|
338
|
+
| Errors | `{ data, error }` values | — | errors are values |
|
|
339
|
+
| Telemetry | on; dev 100%, prod 10% + all errors | any ratio | observability without cost |
|
|
340
|
+
| Migrations | manual in production | auto in dev | never touches your data |
|
|
341
|
+
| Console | dev on · prod on **behind auth** | off | it is your eyes in production |
|
|
342
|
+
| Ports | 6530 app · 6533 Console · 6535 MCP | configurable | O·K·E = 6·5·3 |
|
|
343
|
+
| License | MIT | — | no BSL/SSPL |
|
|
344
|
+
|
|
345
|
+
## 17. Why `signal` defaults to Postgres
|
|
346
|
+
|
|
347
|
+
Not performance — **correctness.** The dual-write bug is the most common distributed-systems mistake: you write the booking, then publish the message; a crash in between loses the message, or a rollback after publishing sends mail about a booking that does not exist.
|
|
348
|
+
|
|
349
|
+
With Postgres, `fx.emit()` runs **inside the same transaction** as `fx.store()`, and the effect system wires it automatically. Redis and NATS cannot offer this — the standard remedy is an outbox table, which lives in Postgres anyway.
|
|
350
|
+
|
|
351
|
+
When you explicitly choose `redis` or `nats` for throughput, the driver keeps the outbox relay internally, so semantics do not regress. Upgrading is a pure performance decision.
|
|
352
|
+
|
|
353
|
+
| | Postgres | Redis Streams | NATS JetStream |
|
|
354
|
+
|---|---|---|---|
|
|
355
|
+
| Throughput | ~1k–10k/s | 100k+/s | millions/s |
|
|
356
|
+
| **Transactional with your data** | **yes** | no | no |
|
|
357
|
+
| Extra service | no | yes | yes |
|
|
358
|
+
| Fan-out / live | weak | excellent | excellent |
|
|
359
|
+
| DLQ inspection | plain SQL | tooling | tooling |
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
# Part VII — Scale, Safety, Longevity
|
|
364
|
+
|
|
365
|
+
## 18. Three scaling axes (never conflated)
|
|
366
|
+
|
|
367
|
+
| Axis | Question | Mechanism |
|
|
368
|
+
|---|---|---|
|
|
369
|
+
| **Split** (`topology`) | one deployable, or one per unit? | `monolith` = in-process calls · `services` = one container per unit, `fx.call` becomes network — code unchanged |
|
|
370
|
+
| **Clone** (horizontal) | how many copies of the app? | run N instances: `once` signals deliver to exactly one, crons leader-elect, live queries fan out. `oke docker --prod` emits `deploy.replicas` |
|
|
371
|
+
| **Data replicas** | how many copies of the data? | `replicas:` on the driver; read-only flows auto-route (derived from effects) |
|
|
372
|
+
|
|
373
|
+
## 19. Multi-tenancy as a dimension of `fx`
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
oke({ tenancy: { resolve: (ctx) => ctx.auth.orgId, isolation: "row" } }) // row | schema | database
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Because every store call passes through `fx`, tenant scoping applies automatically — no forgotten `WHERE org_id`. Rate limits, caches, secrets, and channel branding become per-tenant for free. **`oke doctor` fails the build** if any flow reads a tenant-scoped table without a tenant in context. Cross-tenant leaks become structurally hard.
|
|
380
|
+
|
|
381
|
+
## 20. Compliance derived (PDPL / GDPR)
|
|
382
|
+
|
|
383
|
+
Tag fields once in the schema (`pii`, `sensitive`, `retain: "7y"`). From the effect graph OKE derives: automatic redaction in logs and traces, retention jobs as clock flows, `oke privacy export --subject <id>` and `oke privacy erase --subject <id>` assembled across every store touching that subject, and a per-release data-flow report for auditors.
|
|
384
|
+
|
|
385
|
+
Compliance becomes a property of the code, not an annual project.
|
|
386
|
+
|
|
387
|
+
## 21. Errors that carry a fix
|
|
388
|
+
|
|
389
|
+
```
|
|
390
|
+
OKE1042 Flow "bookings.create" emits signal "order-placed" with no subscriber.
|
|
391
|
+
→ Add `on(orderPlaced, …)` or mark the signal `{ optional: true }`.
|
|
392
|
+
https://oke.dev/e/1042
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Stable, permanent, searchable codes with a cause, a suggested fix, and a docs link. The Console links each code to the exact line.
|
|
396
|
+
|
|
397
|
+
## 22. The stability contract
|
|
398
|
+
|
|
399
|
+
- Manifest spec versioned independently (`"oke": "1.0"`)
|
|
400
|
+
- Semver on the runtime; **codemods ship with every breaking change** (`oke upgrade` rewrites your code and prints a diff)
|
|
401
|
+
- One LTS line supported for three years
|
|
402
|
+
- Flows declare `since` / `deprecated`; the client warns; the Console shows real usage per deprecated flow, so APIs retire on evidence
|
|
403
|
+
|
|
404
|
+
## 23. Adoption on-ramps
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
mount(honoApp) // existing app runs inside OKE, untouched
|
|
408
|
+
mount(elysiaApp) // new work uses flows; old routes keep serving; one deployable
|
|
409
|
+
mount(expressApp)
|
|
410
|
+
```
|
|
411
|
+
Plus `oke import express|hono|elysia` codemods for the mechanical parts. Migration becomes incremental — the only kind that actually happens.
|
|
412
|
+
|
|
413
|
+
## 24. Budgets enforced in CI, published per release
|
|
414
|
+
|
|
415
|
+
| Budget | Limit |
|
|
416
|
+
|---|---|
|
|
417
|
+
| Kernel (edge profile) | < 15 kB |
|
|
418
|
+
| Client runtime | < 3 kB |
|
|
419
|
+
| Cold start on Bun | < 75 ms |
|
|
420
|
+
| p99 routing overhead | < 1 ms |
|
|
421
|
+
|
|
422
|
+
A regression fails OKE's own build. Claims we cannot measure, we do not make.
|
|
423
|
+
|
|
424
|
+
## 25. The AI contract
|
|
425
|
+
|
|
426
|
+
`AGENTS.md` + MCP (`:6535`) expose the Manifest, schemas, effects, traces, and the Console's safe runtime actions. Because capabilities are least-privilege and structural edits arrive as reviewable diffs, an agent can operate the system **without the ability to exceed what the code declares**.
|
|
427
|
+
|
|
428
|
+
OKE is the first backend an AI can fully read, safely operate, and provably not break.
|
|
429
|
+
|
|
430
|
+
**Two directions, one design.** §25 covers AI *for the developer* (agents operating your system through MCP). The AI element (§5) covers AI *inside the application* (models, prompts, agents your users trigger). Both rest on the same foundation — declared effects and least-privilege capabilities — which is why an agent in either direction is bounded by construction rather than by policy.
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
# Part VIII — Execution
|
|
435
|
+
|
|
436
|
+
## 26. Roadmap
|
|
437
|
+
|
|
438
|
+
| Phase | Contents |
|
|
439
|
+
|---|---|
|
|
440
|
+
| **MVP (0.1–0.4)** | Bun adapter · router · Standard Schema + AoT (with dynamic fallback) · `fx` and the effect system · `on`/`flow` · typed errors · typed client · OTel baseline · plugin engine · `create-oke` |
|
|
441
|
+
| **v1 (0.5–1.0)** | all eight elements + drivers · Manifest + derivations · Console · auth + ABAC · schema generation · docker/compose derivation · durability · live queries · i18n · MCP · Node + Edge adapters |
|
|
442
|
+
| **Ecosystem (1.x)** | more drivers and image recipes · `mount()` adapters and import codemods · tenancy · privacy tooling · `@oke/react` · community plugin registry |
|
|
443
|
+
|
|
444
|
+
## 27. Package structure (one published package)
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
okengine/ # ONE npm package, subpath exports, "sideEffects": false
|
|
448
|
+
├── src/
|
|
449
|
+
│ ├── kernel/ # on · flow · fx · effect system · hooks · router
|
|
450
|
+
│ ├── elements/ # signal · store · clock · gate · vault · channel · ai
|
|
451
|
+
│ ├── drivers/ # protocol-named, tree-shaken by manifest
|
|
452
|
+
│ ├── compiler/ # oxc-based manifest extraction · AoT · semantic shaking
|
|
453
|
+
│ ├── runtime/ # bun · node · edge adapters
|
|
454
|
+
│ ├── auth/ # built-in + provider seam
|
|
455
|
+
│ ├── client/ # typed client (+ live)
|
|
456
|
+
│ ├── console/ # dev/prod UI (Vite + React)
|
|
457
|
+
│ ├── docker/ # image recipes, compose derivation
|
|
458
|
+
│ ├── mcp/ # AI surface
|
|
459
|
+
│ ├── test/ # createTestApp harness
|
|
460
|
+
│ └── cli/ # oke
|
|
461
|
+
└── examples/skyport/ # the reference application
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## 28. Risks, honestly
|
|
465
|
+
|
|
466
|
+
| Risk | Mitigation |
|
|
467
|
+
|---|---|
|
|
468
|
+
| `eval`-based AoT blocked on some edge runtimes | first-class `aot: false` dynamic mode; AoT is a Bun/Node optimization, not a requirement |
|
|
469
|
+
| TypeScript inference depth at scale | budget inference performance work early; codegen fallback for very large apps |
|
|
470
|
+
| Scope is enormous for a small team | driver model keeps each element small; adopt rather than build; sequence ruthlessly |
|
|
471
|
+
| Raw throughput below Encore's Rust runtime | accepted — compete on DX, portability, license, batteries, and derived capabilities |
|
|
472
|
+
| Ecosystem cold start | `mount()` interop so Hono/Elysia middleware remains usable from day one |
|
|
473
|
+
| Auto cache invalidation edge cases | raw SQL requires explicit effect annotation, otherwise that flow opts out of auto-caching; correctness never silently breaks |
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## 29. Why this survives a hundred years
|
|
478
|
+
|
|
479
|
+
1. **Laws, not features.** Eight elements cover the *categories* of backend need. The future changes drivers, never elements.
|
|
480
|
+
2. **The Manifest outlives runtimes.** A versioned, runtime-neutral description; the kernel compiles to WASM for hosts that do not exist yet.
|
|
481
|
+
3. **Effects-in-types is a ratchet.** Every future capability derives from the same static knowledge instead of adding API surface.
|
|
482
|
+
4. **One package, one law, ten exports** — small enough to be *finished*. Finished software can be maintained for a century; sprawling software cannot.
|
|
483
|
+
5. **Adopt, don't reinvent.** We inherit the longevity of Postgres, Redis, S3, SOPS, and OpenTelemetry instead of competing with it.
|
|
484
|
+
6. **MIT, self-host first, drivers as the community surface.** No company's death can kill it.
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
**One law · eight elements · ten exports · one package · one manifest.**
|
|
489
|
+
*Adopt what exists. Build only what doesn't. Name things after standards.*
|
package/package.json
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "okengine",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "One law. Eight elements. Ten exports. One package. One manifest. Every backend need is derived, never added.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/omqkhafi/okengine.git"
|
|
11
|
+
},
|
|
12
|
+
"workspaces": [
|
|
13
|
+
"examples/*"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "bun test --pass-with-no-tests",
|
|
18
|
+
"test:manifest": "bun test --coverage src/manifest",
|
|
19
|
+
"test:runtime": "bun test src/runtime",
|
|
20
|
+
"test:compiler": "bun test src/validation src/compiler/aot src/compiler/differential src/compiler/extract",
|
|
21
|
+
"test:client": "bun test src/client src/cli/client-add.test.ts",
|
|
22
|
+
"test:store": "bun test src/elements/store src/drivers",
|
|
23
|
+
"test:signal": "bun test src/elements/signal",
|
|
24
|
+
"test:clock": "bun test src/elements/clock",
|
|
25
|
+
"test:gate": "bun test src/elements/gate",
|
|
26
|
+
"test:vault": "bun test src/elements/vault",
|
|
27
|
+
"test:channel": "bun test src/elements/channel",
|
|
28
|
+
"test:ai": "bun test src/elements/ai",
|
|
29
|
+
"test:auth": "bun test src/auth",
|
|
30
|
+
"test:runs": "bun test src/runs",
|
|
31
|
+
"test:cli": "bun test src/cli src/docker",
|
|
32
|
+
"test:console": "bun test src/console/server && bun test src/console/ui/flows && bun test src/console/ui/traces && bun test src/console/ui/runs && bun test src/console/ui/signals && bun test src/console/ui/architecture && bun test src/console/xss.gate.test.ts src/console/budget.test.ts",
|
|
33
|
+
"test:mcp": "bun test src/mcp",
|
|
34
|
+
"test:console:smoke": "bunx playwright test tests/console/smoke.spec.ts",
|
|
35
|
+
"build:console": "bunx vite build --config src/console/ui/vite.config.ts",
|
|
36
|
+
"bench:cold-start": "bun test ./src/runtime/cold-start.bench.ts",
|
|
37
|
+
"bench:client": "bun test src/client/budget.test.ts",
|
|
38
|
+
"bench:console": "bun test src/console/budget.test.ts",
|
|
39
|
+
"bench:kernel": "bun test src/kernel/budget.test.ts",
|
|
40
|
+
"bench:routing": "bun test src/kernel/routing-budget.test.ts",
|
|
41
|
+
"bench:runs": "bun test src/runs/bench.test.ts",
|
|
42
|
+
"budgets": "bun src/release/publish.ts",
|
|
43
|
+
"gate:doctor-diff": "bun src/cli/doctor-diff-examples.ts",
|
|
44
|
+
"gate:errors": "bun test src/kernel/errors.registry.test.ts",
|
|
45
|
+
"gate:codemods": "bun test src/upgrade/codemods.test.ts",
|
|
46
|
+
"test:examples": "bun test examples/notes && bun test examples/linkly && bun test examples/provisions && bun test examples/skyport",
|
|
47
|
+
"test:create-oke": "bun run --cwd packages/create-oke typecheck && bun test packages/create-oke/src && CREATE_OKE_INTEGRATION=1 bun test packages/create-oke/tests/scaffold.integration.test.ts packages/create-oke/tests/dev.integration.test.ts",
|
|
48
|
+
"test:doc-drift": "bun src/cli/doc-drift.ts",
|
|
49
|
+
"test:skyport-docker": "bun test examples/skyport/tests/docker.test.ts",
|
|
50
|
+
"ci": "bun run bench:cold-start && bun run typecheck && bun run test && bun run budgets && bun run gate:doctor-diff && bun run gate:errors && bun run gate:codemods && bun run test:doc-drift && bun run test:examples && bun run test:skyport-docker && bun run test:create-oke",
|
|
51
|
+
"gate:publish": "bun test scripts/publish.gate.test.ts",
|
|
52
|
+
"bump": "bun run scripts/bump-version.ts",
|
|
53
|
+
"publish:all": "bun run scripts/publish.ts",
|
|
54
|
+
"publish:npm": "bun run scripts/publish.ts -- --npm-only",
|
|
55
|
+
"publish:jsr": "bun run scripts/publish.ts -- --jsr-only",
|
|
56
|
+
"publish:all:dry": "bun run scripts/publish.ts -- --dry-run",
|
|
57
|
+
"publish:npm:dry": "bun run scripts/publish.ts -- --dry-run --npm-only",
|
|
58
|
+
"publish:jsr:dry": "bun run scripts/publish.ts -- --dry-run --jsr-only",
|
|
59
|
+
"g": "gflows"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@duckdb/node-api": "^1.5.5-r.1",
|
|
63
|
+
"age-encryption": "^0.3.0",
|
|
64
|
+
"ajv": "^8.20.0",
|
|
65
|
+
"ajv-formats": "^3.0.1",
|
|
66
|
+
"oxc-parser": "^0.141.0",
|
|
67
|
+
"sently": "^0.8.0"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@base-ui/react": "^1.6.0",
|
|
71
|
+
"@codemirror/commands": "^6.10.4",
|
|
72
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
73
|
+
"@codemirror/state": "^6.7.1",
|
|
74
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
75
|
+
"@codemirror/view": "^6.43.6",
|
|
76
|
+
"@oxc-project/types": "^0.141.0",
|
|
77
|
+
"@playwright/test": "^1.62.0",
|
|
78
|
+
"@sinclair/typebox": "^0.34.52",
|
|
79
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
80
|
+
"@tanstack/react-query": "^5.101.4",
|
|
81
|
+
"@tanstack/react-router": "^1.170.18",
|
|
82
|
+
"@types/bun": "latest",
|
|
83
|
+
"@types/react": "^19.2.17",
|
|
84
|
+
"@types/react-dom": "^19.2.3",
|
|
85
|
+
"@vitejs/plugin-react": "^6.0.4",
|
|
86
|
+
"arktype": "^2.2.3",
|
|
87
|
+
"axe-core": "^4.12.1",
|
|
88
|
+
"clsx": "^2.1.1",
|
|
89
|
+
"drizzle-kit": "^1.0.0-rc.4",
|
|
90
|
+
"drizzle-orm": "^1.0.0-rc.4",
|
|
91
|
+
"drizzle-seed": "^0.3.1",
|
|
92
|
+
"drizzle-zod": "^0.8.3",
|
|
93
|
+
"gflows": "^1.2.1",
|
|
94
|
+
"happy-dom": "^20.11.1",
|
|
95
|
+
"mermaid": "^11.16.0",
|
|
96
|
+
"playwright": "^1.62.0",
|
|
97
|
+
"react": "^19.2.8",
|
|
98
|
+
"react-dom": "^19.2.8",
|
|
99
|
+
"tailwindcss": "^4.3.3",
|
|
100
|
+
"typescript": "^7.0.2",
|
|
101
|
+
"valibot": "^1.4.2",
|
|
102
|
+
"vite": "^8.1.5",
|
|
103
|
+
"zod": "^4.4.3"
|
|
104
|
+
},
|
|
105
|
+
"peerDependencies": {
|
|
106
|
+
"drizzle-kit": ">=1.0.0-rc.0",
|
|
107
|
+
"drizzle-orm": ">=1.0.0-rc.0",
|
|
108
|
+
"drizzle-seed": ">=0.3.0"
|
|
109
|
+
},
|
|
110
|
+
"peerDependenciesMeta": {
|
|
111
|
+
"drizzle-kit": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"drizzle-orm": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
117
|
+
"drizzle-seed": {
|
|
118
|
+
"optional": true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"engines": {
|
|
122
|
+
"bun": ">=1.3"
|
|
123
|
+
},
|
|
124
|
+
"bin": {
|
|
125
|
+
"oke": "./src/cli/index.ts"
|
|
126
|
+
},
|
|
127
|
+
"exports": {
|
|
128
|
+
".": "./src/index.ts",
|
|
129
|
+
"./client": "./src/client/index.ts",
|
|
130
|
+
"./test": "./src/test/index.ts",
|
|
131
|
+
"./config": "./src/config/index.ts",
|
|
132
|
+
"./auth": "./src/auth/index.ts",
|
|
133
|
+
"./console": "./src/console/index.ts",
|
|
134
|
+
"./mcp": "./src/mcp/index.ts",
|
|
135
|
+
"./store": "./src/elements/store.ts",
|
|
136
|
+
"./signal": "./src/elements/signal.ts",
|
|
137
|
+
"./clock": "./src/elements/clock.ts",
|
|
138
|
+
"./gate": "./src/elements/gate.ts",
|
|
139
|
+
"./vault": "./src/elements/vault.ts",
|
|
140
|
+
"./channel": "./src/elements/channel.ts",
|
|
141
|
+
"./ai": "./src/elements/ai.ts",
|
|
142
|
+
"./runs": "./src/runs/index.ts",
|
|
143
|
+
"./drivers": "./src/drivers/index.ts",
|
|
144
|
+
"./drivers/*": "./src/drivers/*"
|
|
145
|
+
},
|
|
146
|
+
"files": [
|
|
147
|
+
"src",
|
|
148
|
+
"spec",
|
|
149
|
+
"AGENTS.md",
|
|
150
|
+
"docs/spec"
|
|
151
|
+
]
|
|
152
|
+
}
|