okengine 0.17.2 → 0.18.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 +5 -3
- package/README.md +14 -10
- package/manifest.v1.schema.json +61 -2
- package/package.json +19 -5
- package/site/content/docs/ai/index.mdx +1 -1
- package/site/content/docs/ai/mcp.mdx +10 -1
- package/site/content/docs/ai/skills.mdx +9 -9
- package/site/content/docs/elements/ai.mdx +1 -1
- package/site/content/docs/elements/clock.mdx +1 -1
- package/site/content/docs/elements/flow.mdx +25 -1
- package/site/content/docs/elements/gate.mdx +3 -2
- package/site/content/docs/elements/store.mdx +289 -341
- package/site/content/docs/elements/vault.mdx +5 -5
- package/site/content/docs/get-started/basic-usage.mdx +3 -10
- package/site/content/docs/get-started/index.mdx +1 -1
- package/site/content/docs/get-started/installation.mdx +2 -3
- package/site/content/docs/get-started/introduction.mdx +58 -121
- package/site/content/docs/get-started/meta.json +9 -1
- package/site/content/docs/get-started/project-structure.mdx +4 -11
- package/site/content/docs/get-started/testing.mdx +328 -0
- package/site/content/docs/get-started/why.mdx +93 -71
- package/site/content/docs/index.mdx +44 -11
- package/site/content/docs/meta.json +8 -5
- package/site/content/docs/plugins/apple.mdx +151 -0
- package/site/content/docs/plugins/discord.mdx +139 -0
- package/site/content/docs/plugins/facebook.mdx +134 -0
- package/site/content/docs/plugins/figma.mdx +138 -0
- package/site/content/docs/plugins/github.mdx +138 -0
- package/site/content/docs/plugins/google.mdx +153 -0
- package/site/content/docs/plugins/index.mdx +47 -1
- package/site/content/docs/plugins/meta.json +10 -0
- package/site/content/docs/plugins/microsoft.mdx +151 -0
- package/site/content/docs/plugins/oauth.mdx +188 -0
- package/site/content/docs/plugins/x.mdx +125 -0
- package/site/content/docs/providers/index.mdx +2 -0
- package/site/content/docs/recipes/index.mdx +2 -0
- package/site/content/docs/reference/cli.md +3 -2
- package/site/content/docs/reference/client.mdx +58 -1
- package/site/content/docs/reference/configuration.mdx +2 -4
- package/site/content/docs/reference/fx.mdx +3 -1
- package/site/content/docs/reference/index.mdx +0 -5
- package/site/content/docs/reference/meta.json +2 -2
- package/site/content/docs/reference/okid.mdx +137 -0
- package/src/auth/bindings.ts +1 -1
- package/src/auth/config.ts +9 -0
- package/src/auth/identity-sql.ts +314 -0
- package/src/auth/identity.ts +140 -2
- package/src/auth/index.ts +17 -1
- package/src/auth/method-context.ts +3 -0
- package/src/auth/oauth-as/cimd.ts +132 -0
- package/src/auth/oauth-as/crypto.test.ts +101 -0
- package/src/auth/oauth-as/crypto.ts +393 -0
- package/src/auth/oauth-as/errors.ts +68 -0
- package/src/auth/oauth-as/http.test.ts +419 -0
- package/src/auth/oauth-as/http.ts +842 -0
- package/src/auth/oauth-as/stores.ts +61 -0
- package/src/auth/oauth-as/tables.ts +142 -0
- package/src/auth/tables.ts +0 -11
- package/src/bench/README.md +83 -0
- package/src/bench/REPORT.md +176 -0
- package/src/bench/g01-rls-stamp.bench.ts +194 -0
- package/src/bench/g02-clock-per-tenant.bench.ts +158 -0
- package/src/bench/g03-signal-once.bench.ts +157 -0
- package/src/bench/g03-signal-reconnect.bench.ts +254 -0
- package/src/bench/g03-signal-sse-memory.bench.ts +191 -0
- package/src/bench/g04-auth-vault-hotpath.bench.ts +170 -0
- package/src/bench/g05-sustained-full.bench.ts +265 -0
- package/src/bench/g06-mixed-load.bench.ts +260 -0
- package/src/bench/g07-vault-crypto.bench.ts +100 -0
- package/src/bench/g07-vault-rotate-under-read.bench.ts +285 -0
- package/src/bench/g08-conn-oversubscribe.bench.ts +194 -0
- package/src/bench/g08-store-kv-durable.bench.ts +133 -0
- package/src/bench/g08-store-sql.bench.ts +178 -0
- package/src/bench/g09-journal-sustained.bench.ts +203 -0
- package/src/bench/g10-observability-contention.bench.ts +246 -0
- package/src/bench/g11-cold-start-cycle.bench.ts +164 -0
- package/src/bench/g13-elements.bench.ts +427 -0
- package/src/bench/g14-graceful-shutdown.bench.ts +244 -0
- package/src/bench/g15-postgres-degradation.bench.ts +264 -0
- package/src/bench/g16-live-query-fanout.bench.ts +206 -0
- package/src/bench/lib/event-loop-lag.ts +26 -0
- package/src/bench/lib/infra.ts +60 -0
- package/src/bench/lib/report.ts +52 -0
- package/src/bench/lib/rss-sampler.ts +61 -0
- package/src/bench/lib/signal-pg.ts +88 -0
- package/src/bench/load-app.ts +337 -0
- package/src/bench/load-child.ts +108 -0
- package/src/bench/smoke.bench.ts +43 -0
- package/src/cli/competitor-mention-removal.test.ts +28 -0
- package/src/cli/doctor-fd.ts +117 -0
- package/src/cli/doctor.test.ts +192 -0
- package/src/cli/doctor.ts +129 -1
- package/src/client/create.ts +95 -1
- package/src/client/index.ts +9 -2
- package/src/client/transport.ts +11 -4
- package/src/client/use-live-query.ts +154 -0
- package/src/client-react/index.ts +15 -1
- package/src/client-react/live-resource.ts +246 -0
- package/src/client-react/use-live-query.test.ts +475 -0
- package/src/client-react/use-live-query.ts +530 -0
- package/src/compiler/extract.test.ts +518 -0
- package/src/compiler/extract.ts +386 -19
- package/src/console/server/invoke-user-flow.ts +2 -1
- package/src/console/ui-next/dist/assets/{access-page-DnWbnGzq.js → access-page-De7Lc2JC.js} +1 -1
- package/src/console/ui-next/dist/assets/{flows-page-BiZ4-6yQ.js → flows-page-RGy7VEA_.js} +1 -1
- package/src/console/ui-next/dist/assets/{index-C8NRK2R-.js → index-_rgpdVzo.js} +3 -3
- package/src/console/ui-next/dist/assets/{observability-page-CrB6vd1T.js → observability-page-Ds6pcnh-.js} +1 -1
- package/src/console/ui-next/dist/assets/{store-page-CS5-aETQ.js → store-page-02xOiqIK.js} +3 -3
- package/src/console/ui-next/dist/assets/{units-page-CjtdlW8l.js → units-page-4rHOePuE.js} +1 -1
- package/src/console/ui-next/dist/assets/{vault-page-C6Xxm9SA.js → vault-page-DISPgxLM.js} +1 -1
- package/src/console/ui-next/dist/index.html +1 -1
- package/src/console/ui-next/src/features/store/lib/fields-from-table.ts +36 -2
- package/src/drivers/cdc-outbox.ts +389 -0
- package/src/drivers/memory.ts +20 -0
- package/src/drivers/oauth-apple.ts +156 -0
- package/src/drivers/oauth-discord.ts +79 -0
- package/src/drivers/oauth-facebook.ts +80 -0
- package/src/drivers/oauth-figma.ts +116 -0
- package/src/drivers/oauth-github.ts +92 -0
- package/src/drivers/oauth-google.ts +142 -0
- package/src/drivers/oauth-microsoft.ts +174 -0
- package/src/drivers/oauth-oidc.ts +293 -0
- package/src/drivers/oauth-shared.ts +326 -0
- package/src/drivers/oauth-types.ts +159 -0
- package/src/drivers/oauth-x.ts +77 -0
- package/src/drivers/oauth2-common.ts +95 -0
- package/src/drivers/oauth2-token.ts +61 -0
- package/src/drivers/pg-rls-row-passes.ts +251 -0
- package/src/drivers/pg-rls.ts +2 -0
- package/src/drivers/postgres.ts +45 -2
- package/src/drivers/signal-postgres.ts +2 -1
- package/src/elements/channel/runtime.ts +29 -2
- package/src/elements/channel.test.ts +52 -0
- package/src/elements/gate/boot.ts +29 -2
- package/src/elements/store/emit-drizzle.ts +147 -14
- package/src/elements/store/field-ddl.test.ts +118 -0
- package/src/elements/store/field-types.test.ts +455 -0
- package/src/elements/store/list-query.golden.json +777 -0
- package/src/elements/store/list-query.parity.test.ts +396 -0
- package/src/elements/store/list-query.ts +792 -0
- package/src/elements/store/live-default.test.ts +136 -0
- package/src/elements/store/live-http.test.ts +160 -0
- package/src/elements/store/live-isolation.test.ts +291 -0
- package/src/elements/store/live-query-runtime.test.ts +323 -0
- package/src/elements/store/live-query-runtime.ts +403 -0
- package/src/elements/store/live-query-server.test.ts +377 -0
- package/src/elements/store/live-query-server.ts +102 -0
- package/src/elements/store/live-query.ts +97 -0
- package/src/elements/store/resource.ts +189 -680
- package/src/elements/store/rls-row-passes-policies.parity.test.ts +665 -0
- package/src/elements/store/schema-decl.ts +539 -41
- package/src/elements/store/sql-rls-stamp.test.ts +27 -0
- package/src/elements/store/sql-session.ts +297 -35
- package/src/elements/store/table.ts +102 -21
- package/src/elements/store.test.ts +3 -1
- package/src/elements/store.ts +12 -1
- package/src/elements/vault/chaos-child.ts +74 -1
- package/src/elements/vault/chaos.test.ts +4 -2
- package/src/elements/vault/storage.ts +4 -2
- package/src/index.ts +5 -2
- package/src/kernel/app-auth.ts +1 -0
- package/src/kernel/app.ts +116 -2
- package/src/kernel/auth-sharing.test.ts +196 -0
- package/src/kernel/boot.test.ts +3 -3
- package/src/kernel/errors.ts +8 -0
- package/src/kernel/fx.test.ts +1 -0
- package/src/kernel/fx.ts +14 -2
- package/src/kernel/horizontal-child.ts +2 -1
- package/src/kernel/http-resource.ts +33 -7
- package/src/kernel/identity-host-persist.test.ts +119 -0
- package/src/kernel/instance-id.ts +4 -2
- package/src/kernel/journal.ts +2 -1
- package/src/kernel/mcp-tool.test.ts +95 -0
- package/src/kernel/on.ts +9 -0
- package/src/kernel/realtime-bind.ts +326 -0
- package/src/kernel/resource-live.ts +117 -0
- package/src/kernel/triggers.ts +86 -4
- package/src/manifest/diff.ts +37 -0
- package/src/manifest/types.ts +64 -2
- package/src/okid.bench.test.ts +64 -0
- package/src/okid.test.ts +338 -0
- package/src/okid.ts +245 -0
- package/src/plugins/anonymous.ts +19 -1
- package/src/plugins/auth/shared.ts +15 -0
- package/src/plugins/index.ts +2 -0
- package/src/plugins/magic-link.ts +10 -8
- package/src/plugins/mcp-oauth.ts +208 -0
- package/src/plugins/oauth/flow-store.ts +117 -0
- package/src/plugins/oauth/link.ts +69 -0
- package/src/plugins/oauth/shared.ts +108 -0
- package/src/plugins/oauth/token-vault.ts +100 -0
- package/src/plugins/oauth.security.test.ts +535 -0
- package/src/plugins/oauth.ts +532 -0
- package/src/plugins/otp.ts +48 -6
- package/src/plugins/passkey.ts +20 -1
- package/src/plugins/two-factor.ts +11 -0
- package/src/plugins/username.ts +40 -7
- package/src/release/build-lib.ts +7 -1
- package/src/release/measure.ts +1 -0
- package/src/release/official-plugins.ts +4 -1
- package/src/runs/collect.ts +2 -1
- package/src/runs/drivers/files.ts +2 -1
- package/src/test/create-test-app.ts +114 -5
- package/src/test/export-bundle.test.ts +33 -0
- package/src/test/live-signals.test.ts +83 -0
- package/src/test/tenant-isolation.test.ts +175 -0
- package/src/testing.ts +26 -0
- package/src/upgrade/codemods.ts +1 -1
- package/site/content/docs/reference/migrating-environments.mdx +0 -158
|
@@ -173,8 +173,8 @@ A value already in the vault / managed backend wins over a leftover env pin.
|
|
|
173
173
|
If every layer misses a contract, boot **fails** before any request is served:
|
|
174
174
|
|
|
175
175
|
```text
|
|
176
|
-
|
|
177
|
-
STRIPE_KEY
|
|
176
|
+
vault boot failed — 1 missing secret(s):
|
|
177
|
+
- STRIPE_KEY: Payments gateway key
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
<Callout title="Good to know">
|
|
@@ -242,9 +242,9 @@ Backup stays on the CLI (`oke vault backup` / `restore`). The Console never
|
|
|
242
242
|
accepts a master key in the HTTP body — unseal via `OKE_VAULT_MASTER_KEY`.
|
|
243
243
|
|
|
244
244
|
<Callout title="Builtin concurrency (rotate / audit / backup)">
|
|
245
|
-
`rotate-master`
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
`rotate-master` holds a lease (`FOR UPDATE` + lease TTL) so exactly one batch runs at a time; a
|
|
246
|
+
busy audit append briefly waits rather than being misread as "lease held". Audit appends serialize
|
|
247
|
+
under a transactional write lock; backups use temp → fsync → rename with end marker + checksum.
|
|
248
248
|
</Callout>
|
|
249
249
|
|
|
250
250
|
<Callout title="Builtin master keys and expired rows">
|
|
@@ -46,16 +46,9 @@ lists HTTP routes — static GET paths are links. `curl` still gets `{ data, err
|
|
|
46
46
|
The standard starter already exports a named health Flow:
|
|
47
47
|
|
|
48
48
|
```typescript title="flows/main/health.ts"
|
|
49
|
-
import { on, flow, http } from "okengine";
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export const health = on(
|
|
53
|
-
http.get().public(),
|
|
54
|
-
flow({
|
|
55
|
-
out: z.object({ ok: z.literal(true) }),
|
|
56
|
-
do: () => ({ ok: true as const }),
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
49
|
+
import { on, flow, http } from "okengine/http";
|
|
50
|
+
|
|
51
|
+
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
59
52
|
```
|
|
60
53
|
|
|
61
54
|
`main` omits the URL prefix, so this file is `GET /health` named `main.health`. See [Project structure](/docs/get-started/project-structure).
|
|
@@ -12,7 +12,7 @@ Learn the shape once, install on Bun, then write your first Flow from the standa
|
|
|
12
12
|
<Cards>
|
|
13
13
|
<Card
|
|
14
14
|
title="Introduction"
|
|
15
|
-
description="One law, eight elements,
|
|
15
|
+
description="One law, eight elements, one contract."
|
|
16
16
|
href="/docs/get-started/introduction"
|
|
17
17
|
/>
|
|
18
18
|
<Card
|
|
@@ -146,7 +146,7 @@ Uncommented supported controls in the generated compose env are preserved when
|
|
|
146
146
|
`oke dev` regenerates the file.
|
|
147
147
|
|
|
148
148
|
Migrating from `local` / `docker` maps or `oke mode`?
|
|
149
|
-
|
|
149
|
+
Rename the env keys in `oke.config.ts` to `dev` / `test` / `prod`.
|
|
150
150
|
|
|
151
151
|
## Troubleshooting
|
|
152
152
|
|
|
@@ -198,7 +198,6 @@ See [Migrating environments](/docs/reference/migrating-environments).
|
|
|
198
198
|
- [CLI Reference](/docs/reference/cli) — `oke`, `create-oke`, `oke test`, and db commands
|
|
199
199
|
- [Environment variables](/docs/reference/environment-variables) — protocol-shaped env
|
|
200
200
|
- [Configuration](/docs/reference/configuration) — `oke.config.ts` drivers and `db.autoPush`
|
|
201
|
-
- [Migrating environments](/docs/reference/migrating-environments) — four-key maps → three
|
|
202
201
|
|
|
203
202
|
## Next
|
|
204
203
|
|
|
@@ -210,7 +209,7 @@ See [Migrating environments](/docs/reference/migrating-environments).
|
|
|
210
209
|
/>
|
|
211
210
|
<Card
|
|
212
211
|
title="Introduction"
|
|
213
|
-
description="The one law, eight elements,
|
|
212
|
+
description="The one law, eight elements, one contract."
|
|
214
213
|
href="/docs/get-started/introduction"
|
|
215
214
|
/>
|
|
216
215
|
<Card
|
|
@@ -1,82 +1,54 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Introduction
|
|
3
|
-
description: Learn the one idea behind okengine — then the eight elements and
|
|
3
|
+
description: Learn the one idea behind okengine — then the eight elements and core programming vocabulary you will use everywhere.
|
|
4
4
|
source: docs/spec/unified-theory.md
|
|
5
5
|
icon: BookOpen
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
most stacks those are four frameworks. In OKE they are **one species** with one
|
|
10
|
-
shape. Learn the shape once; only the trigger changes.
|
|
8
|
+
## The One Idea
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
**Every backend behavior is a Flow:** `on(Trigger) → Effects`. There are no separate species
|
|
14
|
-
called endpoints, handlers, consumers, jobs, or workflows.
|
|
15
|
-
</Callout>
|
|
10
|
+
A booking API, a nightly cleanup job, a receipt email, a row-change hook — in most stacks those are four frameworks. In OKE they are **one species** with one shape. Learn the shape once; only the trigger changes.
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
> **The one rule**
|
|
13
|
+
> Every backend behavior is a **Flow**: `on(Trigger) → Effects`. There are no separate species called endpoints, handlers, consumers, jobs, or workflows.
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
## Quick Start
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
### Write one Flow
|
|
17
|
+
### Write One Flow
|
|
23
18
|
|
|
24
19
|
Four contracts plus a `do`. This is the standard starter's health check:
|
|
25
20
|
|
|
26
|
-
```typescript
|
|
27
|
-
import { on, flow, http } from "okengine";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const health = on(
|
|
31
|
-
http.get().public(),
|
|
32
|
-
flow({
|
|
33
|
-
out: z.object({ ok: z.literal(true) }),
|
|
34
|
-
do: () => ({ ok: true as const }),
|
|
35
|
-
}),
|
|
36
|
-
);
|
|
21
|
+
```typescript
|
|
22
|
+
import { on, flow, http } from "okengine/http";
|
|
23
|
+
|
|
24
|
+
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
37
25
|
```
|
|
38
26
|
|
|
39
27
|
`main` omits the URL prefix, so this file is `GET /health` named `main.health`. See [Project structure](/docs/get-started/project-structure). Explicit `http.get("/health")` and `flow("main.health")` still win.
|
|
40
28
|
|
|
41
|
-
|
|
29
|
+
### Change Only the Trigger
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
### Change only the trigger
|
|
31
|
+
Triggers define what starts the flow. Changing the trigger replaces the entire behavior while keeping the same structure:
|
|
45
32
|
|
|
46
33
|
| Trigger | Starts when | Replaces |
|
|
47
34
|
| ---------------------------------- | ------------------ | ------------------ |
|
|
48
|
-
| `http.post("/bookings")` |
|
|
49
|
-
| `every("10m")` |
|
|
50
|
-
| `orderPlaced` (a signal) |
|
|
51
|
-
| `db.table(users).changed("email")` |
|
|
35
|
+
| `http.post("/bookings")` | A request arrives | Endpoint · handler |
|
|
36
|
+
| `every("10m")` | Time passes | Cron job |
|
|
37
|
+
| `orderPlaced` (a signal) | Another flow emits | Queue consumer |
|
|
38
|
+
| `db.table(users).changed("email")` | A row changes | CDC pipeline |
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { on, flow, http } from "okengine";
|
|
52
42
|
|
|
53
|
-
```typescript title="triggers"
|
|
54
43
|
on(http.post("/bookings"), createBooking);
|
|
55
44
|
on(every("10m"), expireStale);
|
|
56
45
|
on(orderPlaced, sendReceipt);
|
|
57
46
|
on(db.table(users).changed("email"), reverify);
|
|
58
47
|
```
|
|
59
48
|
|
|
60
|
-
</Step>
|
|
61
|
-
|
|
62
|
-
<Step>
|
|
63
|
-
### See what was derived
|
|
64
|
-
|
|
65
|
-
Run `oke dev`. Four surfaces come up together — nothing configured by hand in
|
|
66
|
-
a separate dashboard.
|
|
67
|
-
|
|
68
|
-
<Surfaces />
|
|
69
|
-
|
|
70
|
-
</Step>
|
|
71
|
-
|
|
72
|
-
</Steps>
|
|
73
|
-
|
|
74
49
|
## Anatomy
|
|
75
50
|
|
|
76
|
-
One pipeline. Only the trigger changes between an endpoint, a job, a consumer,
|
|
77
|
-
and a row hook.
|
|
78
|
-
|
|
79
|
-
<FlowShape />
|
|
51
|
+
One pipeline. Only the trigger changes between an endpoint, a job, a consumer, and a row hook.
|
|
80
52
|
|
|
81
53
|
| Piece | Role |
|
|
82
54
|
| ------------- | -------------------------------------------------------------- |
|
|
@@ -85,33 +57,25 @@ and a row hook.
|
|
|
85
57
|
| **`do`** | The body — every read, write, emit, and call goes through `fx` |
|
|
86
58
|
| **Effects** | Inferred from those `fx` calls — not hand-annotated |
|
|
87
59
|
|
|
88
|
-
|
|
89
|
-
| ---------------------------------- | -------------- |
|
|
90
|
-
| One documentation path | One species |
|
|
91
|
-
| One trace shape | One Flow model |
|
|
92
|
-
| One thing for an AI agent to learn | One law |
|
|
93
|
-
|
|
94
|
-
## The `fx` rule
|
|
60
|
+
Consequence: One documentation path, one trace shape, one Flow model, one thing for an AI agent to learn.
|
|
95
61
|
|
|
96
|
-
|
|
97
|
-
`fetch` directly, or uses `Date.now()` is a defect.
|
|
62
|
+
## The `fx` Rule
|
|
98
63
|
|
|
99
|
-
|
|
100
|
-
| -------------------------- | ------------------------ |
|
|
101
|
-
| Cache invalidation keys | Yes |
|
|
102
|
-
| Live queries | Yes |
|
|
103
|
-
| Least-privilege tokens | Yes |
|
|
104
|
-
| Deterministic tests | Yes |
|
|
105
|
-
| Manifest Diff | Yes |
|
|
64
|
+
**All world access goes through `fx`.** A Flow that imports `node:fs`, calls `fetch` directly, or uses `Date.now()` is a defect.
|
|
106
65
|
|
|
107
|
-
|
|
66
|
+
| Inferred From | With `fx` |
|
|
67
|
+
| ----------------------- | --------- |
|
|
68
|
+
| Cache invalidation keys | Yes |
|
|
69
|
+
| Live queries | Yes |
|
|
70
|
+
| Least-privilege tokens | Yes |
|
|
71
|
+
| Deterministic tests | Yes |
|
|
72
|
+
| Manifest Diff | Yes |
|
|
108
73
|
|
|
109
|
-
|
|
110
|
-
your system. You do not maintain a second source of truth.
|
|
74
|
+
## What the Manifest Derives
|
|
111
75
|
|
|
112
|
-
|
|
76
|
+
At build time OKE extracts a **Manifest** — a machine-readable description of your system. You do not maintain a second source of truth.
|
|
113
77
|
|
|
114
|
-
| Surface | Port /
|
|
78
|
+
| Surface | Port / Place | You Maintain? |
|
|
115
79
|
| --------------------------------- | ------------------ | ----------------------------- |
|
|
116
80
|
| Typed client (`okengine/client`) | your app code | No separate codegen |
|
|
117
81
|
| Console panels, traces, explorers | `:6533` | No |
|
|
@@ -119,47 +83,38 @@ your system. You do not maintain a second source of truth.
|
|
|
119
83
|
| Architecture diagram | Console | No — it _is_ the effect graph |
|
|
120
84
|
| Capability matrix + cache keys | compiler / runtime | No — from `fx` |
|
|
121
85
|
|
|
122
|
-
## Eight
|
|
86
|
+
## The Eight Elements
|
|
123
87
|
|
|
124
|
-
An element earns its place only if it has **irreducible physics**. New
|
|
125
|
-
infrastructure becomes a new **driver** — never a ninth element.
|
|
88
|
+
An element earns its place only if it has **irreducible physics**. New infrastructure becomes a new **driver** — never a ninth element.
|
|
126
89
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
| Element | Essence | Replaces the zoo of |
|
|
90
|
+
| Element | Essence | Replaces the Zoo |
|
|
130
91
|
| ----------- | ----------------------------- | --------------------------------------------------------- |
|
|
131
|
-
| **Flow** |
|
|
132
|
-
| **Signal** |
|
|
133
|
-
| **Store** |
|
|
134
|
-
| **Clock** |
|
|
135
|
-
| **Gate** |
|
|
136
|
-
| **Vault** |
|
|
137
|
-
| **Channel** |
|
|
138
|
-
| **AI** |
|
|
92
|
+
| **Flow** | Behavior | endpoint · handler · consumer · job · workflow · webhook |
|
|
93
|
+
| **Signal** | Data in motion | queue · pub/sub · stream · websocket · SSE · event bus |
|
|
94
|
+
| **Store** | Data at rest | database · cache · KV · file storage · search index |
|
|
95
|
+
| **Clock** | Time | cron · delay · timeout · durable sleep · TTL |
|
|
96
|
+
| **Gate** | Permission to act | auth · session · ABAC · rate limit · quota · feature flag |
|
|
97
|
+
| **Vault** | Protected knowledge | secrets · config · environment |
|
|
98
|
+
| **Channel** | Reaching humans | email · SMS · WhatsApp · push |
|
|
99
|
+
| **AI** | Reaching machine intelligence | model calls · prompts · embeddings · agents · RAG |
|
|
139
100
|
|
|
140
|
-
##
|
|
101
|
+
## Core Programming Vocabulary
|
|
141
102
|
|
|
142
|
-
The
|
|
143
|
-
derived from these ten names:
|
|
103
|
+
The core programming vocabulary fits in one import. Everything else in the docs is derived from these names:
|
|
144
104
|
|
|
145
|
-
```ts
|
|
105
|
+
```ts
|
|
146
106
|
import { on, flow, signal, store, clock, gate, vault, channel, ai, plugin } from "okengine";
|
|
147
107
|
```
|
|
148
108
|
|
|
149
|
-
For HTTP-only apps, prefer the slim entry so the cold graph stays on the edge
|
|
150
|
-
router:
|
|
109
|
+
For HTTP-only apps, prefer the slim entry so the cold graph stays on the edge:
|
|
151
110
|
|
|
152
|
-
```ts
|
|
111
|
+
```ts
|
|
153
112
|
import { on, flow, http, gate, oke, createBunRuntime } from "okengine/http";
|
|
154
113
|
```
|
|
155
114
|
|
|
156
|
-
Heavy surfaces (
|
|
157
|
-
mega-barrel) live on `okengine/runs`, `okengine/journal`, `okengine/compiler`,
|
|
158
|
-
and `okengine/full`.
|
|
159
|
-
|
|
160
|
-
<Vocabulary />
|
|
115
|
+
Heavy surfaces (runs, journal factories, compiler extract, the legacy mega-barrel) live on `okengine/runs`, `okengine/journal`, `okengine/compiler`, and `okengine/full`.
|
|
161
116
|
|
|
162
|
-
## Learn
|
|
117
|
+
## Learn More
|
|
163
118
|
|
|
164
119
|
| Topic | Page |
|
|
165
120
|
| ------- | ------------------------------------------------------------------------------- |
|
|
@@ -169,27 +124,9 @@ and `okengine/full`.
|
|
|
169
124
|
| `fx` | [fx](/docs/reference/fx) |
|
|
170
125
|
| Agents | [MCP](/docs/ai/mcp) · [Skills](/docs/ai/skills) · [llms.txt](/docs/ai/llms-txt) |
|
|
171
126
|
|
|
172
|
-
## Next
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
href="/docs/get-started/why"
|
|
179
|
-
/>
|
|
180
|
-
<Card
|
|
181
|
-
title="Installation"
|
|
182
|
-
description="Scaffold with create-oke and open the Console."
|
|
183
|
-
href="/docs/get-started/installation"
|
|
184
|
-
/>
|
|
185
|
-
<Card
|
|
186
|
-
title="Basic Usage"
|
|
187
|
-
description="Health Flow, typed client, and bun:test."
|
|
188
|
-
href="/docs/get-started/basic-usage"
|
|
189
|
-
/>
|
|
190
|
-
<Card
|
|
191
|
-
title="Project structure"
|
|
192
|
-
description="Folders are the URL; unit plus export is the name."
|
|
193
|
-
href="/docs/get-started/project-structure"
|
|
194
|
-
/>
|
|
195
|
-
</Cards>
|
|
127
|
+
## Next Steps
|
|
128
|
+
|
|
129
|
+
- [Why OKE](/docs/get-started/why)
|
|
130
|
+
- [Installation](/docs/get-started/installation)
|
|
131
|
+
- [Basic Usage](/docs/get-started/basic-usage)
|
|
132
|
+
- [Project Structure](/docs/get-started/project-structure)
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "Get Started",
|
|
3
3
|
"icon": "Rocket",
|
|
4
|
-
"pages": [
|
|
4
|
+
"pages": [
|
|
5
|
+
"index",
|
|
6
|
+
"why",
|
|
7
|
+
"introduction",
|
|
8
|
+
"installation",
|
|
9
|
+
"basic-usage",
|
|
10
|
+
"testing",
|
|
11
|
+
"project-structure"
|
|
12
|
+
]
|
|
5
13
|
}
|
|
@@ -561,10 +561,7 @@ export const archive = on(
|
|
|
561
561
|
<Tab value="(public)">
|
|
562
562
|
|
|
563
563
|
```typescript title="flows/main/(public)/health.ts"
|
|
564
|
-
export const health = on(
|
|
565
|
-
http.get().public(),
|
|
566
|
-
flow({ out: z.object({ ok: z.literal(true) }), do: () => ({ ok: true as const }) }),
|
|
567
|
-
);
|
|
564
|
+
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
568
565
|
// still GET /health named main.health
|
|
569
566
|
```
|
|
570
567
|
|
|
@@ -635,13 +632,9 @@ Do not put `index.ts` next to `health.ts` — that mix is a generate error. Use
|
|
|
635
632
|
<Tab value="health.ts">
|
|
636
633
|
|
|
637
634
|
```typescript title="flows/main/health.ts"
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
out: z.object({ ok: z.literal(true) }),
|
|
642
|
-
do: () => ({ ok: true as const }),
|
|
643
|
-
}),
|
|
644
|
-
);
|
|
635
|
+
import { on, flow, http } from "okengine/http";
|
|
636
|
+
|
|
637
|
+
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
645
638
|
// GET /health name main.health
|
|
646
639
|
```
|
|
647
640
|
|