okengine 0.18.4 → 0.18.5
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/package.json +1 -1
- package/site/content/docs/ai/index.mdx +25 -6
- package/site/content/docs/elements/index.mdx +42 -11
- package/site/content/docs/get-started/introduction.mdx +66 -54
- package/site/content/docs/get-started/why.mdx +61 -109
- package/site/content/docs/index.mdx +51 -30
- package/site/content/docs/meta.json +7 -5
- package/src/cli/competitor-mention-removal.test.ts +1 -1
- package/src/compiler/extract.test.ts +1 -1
- package/src/console/ui-next/dist/assets/{access-page-De7Lc2JC.js → access-page-3-EFj-2G.js} +1 -1
- package/src/console/ui-next/dist/assets/{flows-page-RGy7VEA_.js → flows-page-cVFnA4HH.js} +1 -1
- package/src/console/ui-next/dist/assets/{index-_rgpdVzo.js → index-CMIgUbD0.js} +3 -3
- package/src/console/ui-next/dist/assets/{observability-page-Ds6pcnh-.js → observability-page-CQ3p34ip.js} +1 -1
- package/src/console/ui-next/dist/assets/{units-page-4rHOePuE.js → units-page-l8FeKfnP.js} +1 -1
- package/src/console/ui-next/dist/assets/{vault-page-DISPgxLM.js → vault-page-CL-d_mLE.js} +1 -1
- package/src/console/ui-next/dist/index.html +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okengine",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "One law. Eight elements. One contract. The backend model stays small; operational surfaces are derived from it instead of maintained separately.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -5,20 +5,39 @@ icon: "Bot"
|
|
|
5
5
|
source: "docs/spec/unified-theory.md"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Resources for AI agents that
|
|
8
|
+
Resources for AI agents that inspect, understand, or operate an OKEngine application.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
<Callout title="Two directions, one model">
|
|
11
|
+
**MCP is a surface of the model, not the model itself.** Gate governs agents calling in; the AI
|
|
12
|
+
element governs applications calling out to models.
|
|
13
|
+
</Callout>
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
External Agents → MCP (:6535) → Gate Check → Flow (inbound)
|
|
17
|
+
Flow → fx.ask / fx.stream → AI Runtime → Models & External Tools (outbound)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## AI & Agent Surfaces
|
|
11
21
|
|
|
12
22
|
<Cards>
|
|
13
|
-
<Card title="MCP" description="Runtime MCP on :6535; docs MCP on :6536." href="/docs/ai/mcp" />
|
|
14
23
|
<Card
|
|
15
|
-
title="
|
|
16
|
-
description="
|
|
24
|
+
title="MCP"
|
|
25
|
+
description="Runtime MCP on :6535 for running apps; Docs MCP on :6536 for handbook search."
|
|
26
|
+
href="/docs/ai/mcp"
|
|
27
|
+
/>
|
|
28
|
+
<Card
|
|
29
|
+
title="Agent Skills"
|
|
30
|
+
description="AGENTS.md contract and autonomous maintenance skills."
|
|
17
31
|
href="/docs/ai/skills"
|
|
18
32
|
/>
|
|
19
33
|
<Card
|
|
20
34
|
title="llms.txt"
|
|
21
|
-
description="
|
|
35
|
+
description="Standardized machine-readable feeds: /llms.txt, /llms.json, /llms-full.txt, and markdown twins."
|
|
22
36
|
href="/docs/ai/llms-txt"
|
|
23
37
|
/>
|
|
38
|
+
<Card
|
|
39
|
+
title="AI Element"
|
|
40
|
+
description="Calling out: models, prompts, agents, and RAG inside your application."
|
|
41
|
+
href="/docs/elements/ai"
|
|
42
|
+
/>
|
|
24
43
|
</Cards>
|
|
@@ -1,45 +1,76 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Elements"
|
|
3
|
-
description: "The eight
|
|
3
|
+
description: "The eight closed semantic primitives of the OKEngine backend model."
|
|
4
4
|
icon: "Boxes"
|
|
5
5
|
source: "docs/spec/unified-theory.md"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Forty backend concerns collapse into eight semantic primitives. An element earns its place only with **irreducible physics**.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
<Callout title="Closed primitive set">
|
|
11
|
+
There is no ninth element. New infrastructure creates a protocol driver or plugin, preserving a
|
|
12
|
+
small mental model.
|
|
13
|
+
</Callout>
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
Elements define the model.
|
|
17
|
+
Plugins extend the model's capabilities.
|
|
18
|
+
Drivers connect the model to infrastructure.
|
|
19
|
+
Providers and Recipes choose where that infrastructure runs.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## The Eight Primitives
|
|
11
23
|
|
|
12
24
|
<Cards>
|
|
13
|
-
<Card
|
|
25
|
+
<Card
|
|
26
|
+
title="Flow"
|
|
27
|
+
description="Behavior — on(Trigger) → Effects via fx."
|
|
28
|
+
href="/docs/elements/flow"
|
|
29
|
+
/>
|
|
14
30
|
<Card
|
|
15
31
|
title="Signal"
|
|
16
|
-
description="Data in motion —
|
|
32
|
+
description="Data in motion — delivery physics as a property (once, broadcast, live)."
|
|
17
33
|
href="/docs/elements/signal"
|
|
18
34
|
/>
|
|
19
35
|
<Card
|
|
20
36
|
title="Store"
|
|
21
|
-
description="Data at rest —
|
|
37
|
+
description="Data at rest — SQL, KV, files with image transforms, and search."
|
|
22
38
|
href="/docs/elements/store"
|
|
23
39
|
/>
|
|
24
40
|
<Card
|
|
25
41
|
title="Clock"
|
|
26
|
-
description="Time — schedules, intervals, durable sleeps."
|
|
42
|
+
description="Time — schedules, intervals, durable sleeps, and time travel."
|
|
27
43
|
href="/docs/elements/clock"
|
|
28
44
|
/>
|
|
29
45
|
<Card
|
|
30
46
|
title="Gate"
|
|
31
|
-
description="Permission to act — auth and rate limits."
|
|
47
|
+
description="Permission to act — auth, tenancy, ABAC, and rate limits at the trigger."
|
|
32
48
|
href="/docs/elements/gate"
|
|
33
49
|
/>
|
|
34
50
|
<Card
|
|
35
51
|
title="Vault"
|
|
36
|
-
description="Protected knowledge —
|
|
52
|
+
description="Protected knowledge — fail-loud secret contracts and redacted values."
|
|
37
53
|
href="/docs/elements/vault"
|
|
38
54
|
/>
|
|
39
55
|
<Card
|
|
40
56
|
title="Channel"
|
|
41
|
-
description="Reaching humans — email, SMS, push."
|
|
57
|
+
description="Reaching humans — email, SMS, WhatsApp, and push with built-in consent."
|
|
42
58
|
href="/docs/elements/channel"
|
|
43
59
|
/>
|
|
44
|
-
<Card
|
|
60
|
+
<Card
|
|
61
|
+
title="AI"
|
|
62
|
+
description="Reaching machine intelligence — models, prompts, agents, and RAG."
|
|
63
|
+
href="/docs/elements/ai"
|
|
64
|
+
/>
|
|
45
65
|
</Cards>
|
|
66
|
+
|
|
67
|
+
## See How They Compose
|
|
68
|
+
|
|
69
|
+
The closed elements compose into full backend capabilities:
|
|
70
|
+
|
|
71
|
+
| Composition Target | Formula | How It Works |
|
|
72
|
+
| ------------------ | ----------------------------------------------- | --------------------------------------------------------- |
|
|
73
|
+
| **Realtime** | Store + Gate + Signal + Flow → Live Query | CDC changes re-checked against Gate RLS, streamed as SSE |
|
|
74
|
+
| **Security** | Gate + Store/RLS + Tenant + fx → Secure runtime | Tenant-isolated queries with least-privilege capability |
|
|
75
|
+
| **Agents** | MCP + Gate + OAuth + Flow → Agent-ready backend | Declared Flows exposed on :6535 behind auth confirmation |
|
|
76
|
+
| **Operations** | Manifest + Effects + Runs → Inspectable backend | Inferred effects feed Console (:6533) and wide-event logs |
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Introduction
|
|
3
|
-
description:
|
|
3
|
+
description: The Law, the eight elements, the fx rule, and the compiled Manifest contract.
|
|
4
4
|
source: docs/spec/unified-theory.md
|
|
5
5
|
icon: BookOpen
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
## The One
|
|
8
|
+
## The One Law
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
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.
|
|
14
|
-
|
|
15
|
-
## Quick Start
|
|
16
|
-
|
|
17
|
-
### Write One Flow
|
|
18
|
-
|
|
19
|
-
Four contracts plus a `do`. This is the standard starter's health check:
|
|
10
|
+
Every backend behavior is a Flow: `on(Trigger) → Effects`.
|
|
20
11
|
|
|
21
12
|
```typescript
|
|
22
13
|
import { on, flow, http } from "okengine/http";
|
|
@@ -24,11 +15,11 @@ import { on, flow, http } from "okengine/http";
|
|
|
24
15
|
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
25
16
|
```
|
|
26
17
|
|
|
27
|
-
|
|
18
|
+
An endpoint, a nightly cleanup cron, a queue consumer, a row-change CDC hook — these are not four frameworks. They are **one species** with one shape. Only the trigger changes.
|
|
28
19
|
|
|
29
|
-
|
|
20
|
+
## Changing Only the Trigger
|
|
30
21
|
|
|
31
|
-
Triggers
|
|
22
|
+
Triggers determine what starts the flow while preserving identical anatomy and effect tracking:
|
|
32
23
|
|
|
33
24
|
| Trigger | Starts when | Replaces |
|
|
34
25
|
| ---------------------------------- | ------------------ | ------------------ |
|
|
@@ -46,9 +37,9 @@ on(orderPlaced, sendReceipt);
|
|
|
46
37
|
on(db.table(users).changed("email"), reverify);
|
|
47
38
|
```
|
|
48
39
|
|
|
49
|
-
## Anatomy
|
|
40
|
+
## Anatomy of a Flow
|
|
50
41
|
|
|
51
|
-
|
|
42
|
+
Every Flow consists of four clear sections:
|
|
52
43
|
|
|
53
44
|
| Piece | Role |
|
|
54
45
|
| ------------- | -------------------------------------------------------------- |
|
|
@@ -57,35 +48,53 @@ One pipeline. Only the trigger changes between an endpoint, a job, a consumer, a
|
|
|
57
48
|
| **`do`** | The body — every read, write, emit, and call goes through `fx` |
|
|
58
49
|
| **Effects** | Inferred from those `fx` calls — not hand-annotated |
|
|
59
50
|
|
|
60
|
-
|
|
51
|
+
```typescript
|
|
52
|
+
export const createOrder = on(
|
|
53
|
+
http.post("/orders"),
|
|
54
|
+
flow("orders.create", {
|
|
55
|
+
in: OrderInput,
|
|
56
|
+
out: OrderResult,
|
|
57
|
+
do: async (input, fx) => {
|
|
58
|
+
const order = await fx.store(db).insert(orders).values(input);
|
|
59
|
+
await fx.emit(orderPlaced, { orderId: order.id });
|
|
60
|
+
return order;
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
```
|
|
61
65
|
|
|
62
66
|
## The `fx` Rule
|
|
63
67
|
|
|
64
|
-
**All world access goes through `fx`.**
|
|
68
|
+
**All world access goes through `fx`.**
|
|
69
|
+
|
|
70
|
+
<Callout title="Single door to the world">
|
|
71
|
+
Nothing in user flows imports `node:fs`, calls global `fetch`, or calls `Date.now()`. Every effect
|
|
72
|
+
is recorded on the effect ledger.
|
|
73
|
+
</Callout>
|
|
65
74
|
|
|
66
|
-
| Inferred
|
|
67
|
-
| ----------------------- |
|
|
68
|
-
| Cache invalidation keys |
|
|
69
|
-
| Live queries |
|
|
70
|
-
| Least-privilege tokens |
|
|
71
|
-
| Deterministic tests |
|
|
72
|
-
| Manifest Diff |
|
|
75
|
+
| Inferred from `fx` | What it powers |
|
|
76
|
+
| ----------------------- | ------------------------------------ |
|
|
77
|
+
| Cache invalidation keys | Invalidation follows the flow writes |
|
|
78
|
+
| Live queries | Realtime CDC subscriptions |
|
|
79
|
+
| Least-privilege tokens | Compiler-derived capability matrix |
|
|
80
|
+
| Deterministic tests | Injected time, clock, and stores |
|
|
81
|
+
| Manifest Diff | Blast-radius checks on every save |
|
|
73
82
|
|
|
74
|
-
##
|
|
83
|
+
## The Compiled Manifest
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
The source of truth is the backend model expressed in code. The **Manifest** is the compiled, versioned contract representing that model.
|
|
77
86
|
|
|
78
|
-
| Surface | Port
|
|
87
|
+
| Surface | Port | You Maintain? |
|
|
79
88
|
| --------------------------------- | ------------------ | ----------------------------- |
|
|
80
|
-
| Typed client (`okengine/client`) | your app code | No
|
|
81
|
-
| Console panels, traces, explorers | `:6533` | No
|
|
82
|
-
| MCP for agents | `:6535` | No
|
|
89
|
+
| Typed client (`okengine/client`) | your app code | No — derived from Manifest |
|
|
90
|
+
| Console panels, traces, explorers | `:6533` | No — reads the Manifest |
|
|
91
|
+
| MCP for agents | `:6535` | No — reads the Manifest |
|
|
83
92
|
| Architecture diagram | Console | No — it _is_ the effect graph |
|
|
84
|
-
| Capability matrix + cache keys | compiler / runtime | No — from `fx`
|
|
93
|
+
| Capability matrix + cache keys | compiler / runtime | No — inferred from `fx` |
|
|
85
94
|
|
|
86
95
|
## The Eight Elements
|
|
87
96
|
|
|
88
|
-
An element earns its place only if it has **irreducible physics**.
|
|
97
|
+
An element earns its place only if it has **irreducible physics**.
|
|
89
98
|
|
|
90
99
|
| Element | Essence | Replaces the Zoo |
|
|
91
100
|
| ----------- | ----------------------------- | --------------------------------------------------------- |
|
|
@@ -98,35 +107,38 @@ An element earns its place only if it has **irreducible physics**. New infrastru
|
|
|
98
107
|
| **Channel** | Reaching humans | email · SMS · WhatsApp · push |
|
|
99
108
|
| **AI** | Reaching machine intelligence | model calls · prompts · embeddings · agents · RAG |
|
|
100
109
|
|
|
110
|
+
New infrastructure becomes a **driver** for an existing element, never a ninth.
|
|
111
|
+
|
|
101
112
|
## Core Programming Vocabulary
|
|
102
113
|
|
|
103
|
-
The core programming vocabulary
|
|
114
|
+
The core programming vocabulary is ten exported names:
|
|
104
115
|
|
|
105
|
-
```
|
|
116
|
+
```typescript
|
|
106
117
|
import { on, flow, signal, store, clock, gate, vault, channel, ai, plugin } from "okengine";
|
|
107
118
|
```
|
|
108
119
|
|
|
109
|
-
For HTTP
|
|
120
|
+
For HTTP runtime essentials, use the slim entry `okengine/http`:
|
|
110
121
|
|
|
111
|
-
```
|
|
122
|
+
```typescript
|
|
112
123
|
import { on, flow, http, gate, oke, createBunRuntime } from "okengine/http";
|
|
113
124
|
```
|
|
114
125
|
|
|
115
|
-
Heavy surfaces (runs, journal factories, compiler extract, the legacy mega-barrel) live on `okengine/runs`, `okengine/journal`, `okengine/compiler`, and `okengine/full`.
|
|
116
|
-
|
|
117
|
-
## Learn More
|
|
118
|
-
|
|
119
|
-
| Topic | Page |
|
|
120
|
-
| ------- | ------------------------------------------------------------------------------- |
|
|
121
|
-
| Why OKE | [Why OKE](/docs/get-started/why) |
|
|
122
|
-
| Folders | [Project structure](/docs/get-started/project-structure) |
|
|
123
|
-
| Flow | [Flow](/docs/elements/flow) |
|
|
124
|
-
| `fx` | [fx](/docs/reference/fx) |
|
|
125
|
-
| Agents | [MCP](/docs/ai/mcp) · [Skills](/docs/ai/skills) · [llms.txt](/docs/ai/llms-txt) |
|
|
126
|
-
|
|
127
126
|
## Next Steps
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
<Cards>
|
|
129
|
+
<Card
|
|
130
|
+
title="Why OKE"
|
|
131
|
+
description="Explore the problem of seams and the smaller model."
|
|
132
|
+
href="/docs/get-started/why"
|
|
133
|
+
/>
|
|
134
|
+
<Card
|
|
135
|
+
title="Installation"
|
|
136
|
+
description="Scaffold a new OKEngine project with create-oke."
|
|
137
|
+
href="/docs/get-started/installation"
|
|
138
|
+
/>
|
|
139
|
+
<Card
|
|
140
|
+
title="Basic Usage"
|
|
141
|
+
description="Write your first flow and verify it with bun test."
|
|
142
|
+
href="/docs/get-started/basic-usage"
|
|
143
|
+
/>
|
|
144
|
+
</Cards>
|
|
@@ -1,162 +1,114 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Why OKE
|
|
3
|
-
description:
|
|
3
|
+
description: The problem of seams across independent backend tools, the insight, and the smaller model.
|
|
4
4
|
source: docs/spec/unified-theory.md
|
|
5
5
|
icon: Compass
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## The Problem: The Seams You Own
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
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.
|
|
10
|
+
Modern backends accumulate many independently adopted systems: router, queue, cron, websockets, cache, secrets, mailer, AI wrappers, and observability.
|
|
14
11
|
|
|
15
12
|
<Callout title="A note on the count">
|
|
16
13
|
'Forty' is a representative illustration of the number of backend concerns developers commonly
|
|
17
|
-
assemble across modern stacks, not a literal
|
|
14
|
+
assemble across modern stacks, not a literal census.
|
|
18
15
|
</Callout>
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Cache that lies
|
|
25
|
-
|
|
26
|
-
You add a column to `orders` and update three writers. The cache key in `checkout` is not one of them. A customer finds it a week later.
|
|
27
|
-
|
|
28
|
-
OKE derives: reads and writes are recorded through `fx`, so cache invalidation follows the Flow — there is no separate key to remember.
|
|
17
|
+
```text
|
|
18
|
+
many systems → many seams → many contracts → many mental models
|
|
19
|
+
```
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
Every TypeScript backend works on day one. The bill arrives later in the seams:
|
|
31
22
|
|
|
32
|
-
|
|
23
|
+
- **Cache that lies:** You update a writer, but forget the cache key in checkout.
|
|
24
|
+
- **Secret that fails at 2am:** Deploy boots fine; the first charge fails because the env var was missed.
|
|
25
|
+
- **Permission checks in the wrong place:** Auth logic scattered across handlers instead of verified at the trigger.
|
|
26
|
+
- **The dashboard that doesn't know you:** Observability tools learn routes from traffic samples instead of the compiled model.
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
## The Insight: One Programming Model
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
These concerns do not need to become separate programming concepts. They collapse into one closed set:
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
```text
|
|
33
|
+
Many backend concerns → One programming model
|
|
34
|
+
```
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
> **One law. Eight elements. One contract.**
|
|
41
37
|
|
|
42
|
-
|
|
38
|
+
## Wrong vs. Right Mental Model
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
Understanding OKE begins by rejecting the conventional feature-pile model:
|
|
45
41
|
|
|
46
|
-
|
|
42
|
+
| ❌ Wrong Mental Model (Feature Bundle) | ✅ OKEngine Model (Unified Primitives) |
|
|
43
|
+
| -------------------------------------- | -------------------------------------- |
|
|
44
|
+
| Router + Queue + Cron + Auth + ORM | `on(Trigger) → Flow` (One species) |
|
|
45
|
+
| Separate mental model per tool | Eight closed semantic elements |
|
|
46
|
+
| Ad-hoc side effects everywhere | Single door to the world: `fx` |
|
|
47
|
+
| Hand-maintained glue & OpenAPI | Compiled Manifest contract |
|
|
48
|
+
| Unchecked runtime drift | Derived, inspectable surfaces |
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
The difference is not how many features OKE has. It is how few concepts you need to understand.
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
## The Law and the `fx` Rule
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
Every backend behavior is a Flow:
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
```typescript
|
|
57
|
+
import { on, flow, http } from "okengine/http";
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
60
|
+
```
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
**All world access goes through `fx`.** A Flow that calls `fetch` directly, imports `node:fs`, or uses `Date.now()` is a defect.
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
```text
|
|
65
|
+
Flow → fx → observable Effects → Compiler → Manifest → Surfaces
|
|
66
|
+
```
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
Because all effects pass through `fx`, the compiler infers cache keys, capability matrices, and trace trees without manual annotations.
|
|
63
69
|
|
|
64
|
-
## One
|
|
70
|
+
## One Contract, Many Surfaces
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
The source of truth is the backend model expressed in code. The **Manifest** is the compiled, versioned contract representing that model.
|
|
67
73
|
|
|
68
|
-
| Surface | Port | You
|
|
74
|
+
| Surface | Port | You Maintain? |
|
|
69
75
|
| --------------------------------- | ------------------ | ----------------------------- |
|
|
70
|
-
| Typed client (`okengine/client`) | your app code | No — derived from
|
|
76
|
+
| Typed client (`okengine/client`) | your app code | No — derived from Manifest |
|
|
71
77
|
| Console panels, traces, explorers | `:6533` | No — reads the Manifest |
|
|
72
78
|
| MCP for agents | `:6535` | No — reads the Manifest |
|
|
73
79
|
| Architecture diagram | Console | No — it _is_ the effect graph |
|
|
74
80
|
| Capability matrix + cache keys | compiler / runtime | No — inferred from `fx` |
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## The `fx` rule — one door to the world
|
|
82
|
+
Operational surfaces are derived, not separately maintained.
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<Callout title="What `fx` records">
|
|
83
|
-
Every read, write, emit, send, ask, secret, and call is captured — so the Manifest knows exactly
|
|
84
|
-
which flows touch `orders` or send PII to a model, without you declaring it.
|
|
85
|
-
</Callout>
|
|
84
|
+
## See the Model Compose
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
| ----------------------- | ------------------------------------ |
|
|
89
|
-
| Cache invalidation keys | Automatic — follows the Flow |
|
|
90
|
-
| Live queries | Built-in subscription model |
|
|
91
|
-
| Least-privilege tokens | Capability matrix from effects |
|
|
92
|
-
| Deterministic tests | Time, clock, and randomness injected |
|
|
93
|
-
| Manifest Diff | Exact change surface on every save |
|
|
86
|
+
OKE does not add new subsystems when new architectural requirements emerge. The eight closed primitives compose naturally:
|
|
94
87
|
|
|
95
|
-
|
|
88
|
+
- **Realtime:** `Store + Gate + Signal + Flow → Live Query` (Global CDC + RLS re-check + SSE).
|
|
89
|
+
- **Security:** `Gate + Store/RLS + Tenant + fx → Secure execution` (Unified user, operator, and agent boundaries).
|
|
90
|
+
- **Agents:** `MCP + Gate + OAuth + Flow → Agent-accessible backend` (Exposing Flows as MCP tools).
|
|
91
|
+
- **Operations:** `Manifest + Effects + Runs → Inspectable backend` (Wide-event telemetry and live graphs).
|
|
96
92
|
|
|
97
|
-
|
|
93
|
+
> **None of these required a ninth primitive.**
|
|
98
94
|
|
|
99
|
-
|
|
100
|
-
| ----------- | ----------------------------- | --------------------------------------------------------- |
|
|
101
|
-
| **Flow** | Behavior | endpoint · handler · consumer · job · workflow · webhook |
|
|
102
|
-
| **Signal** | Data in motion | queue · pub/sub · stream · websocket · SSE · event bus |
|
|
103
|
-
| **Store** | Data at rest | database · cache · KV · file storage · search index |
|
|
104
|
-
| **Clock** | Time | cron · delay · timeout · durable sleep · TTL |
|
|
105
|
-
| **Gate** | Permission to act | auth · session · ABAC · rate limit · quota · feature flag |
|
|
106
|
-
| **Vault** | Protected knowledge | secrets · config · environment |
|
|
107
|
-
| **Channel** | Reaching humans | email · SMS · WhatsApp · push |
|
|
108
|
-
| **AI** | Reaching machine intelligence | model calls · prompts · embeddings · agents · RAG |
|
|
95
|
+
## Core Philosophy
|
|
109
96
|
|
|
110
|
-
|
|
97
|
+
> **Keep the model small. Let the backend grow without growing the mental model.**
|
|
111
98
|
|
|
112
|
-
|
|
99
|
+
Your backend is not just executable. It is inspectable.
|
|
113
100
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
import { on, flow, http } from "okengine/http";
|
|
118
|
-
|
|
119
|
-
export const health = on(http.get().public(), flow({ do: () => ({ ok: true }) }));
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
| Piece | Role |
|
|
123
|
-
| ------------- | -------------------------------------------------------------- |
|
|
124
|
-
| **Trigger** | How work starts — `http`, a signal, `every`, a row change |
|
|
125
|
-
| **Contracts** | `in`, `out`, typed `errors` — validated before and after `do` |
|
|
126
|
-
| **`do`** | The body — every read, write, emit, and call goes through `fx` |
|
|
127
|
-
| **Effects** | Inferred from those `fx` calls — not hand-annotated |
|
|
128
|
-
|
|
129
|
-
Consequence: **one documentation path, one trace shape, one Flow model, one thing for an AI agent to learn.**
|
|
130
|
-
|
|
131
|
-
## Ambition, stated plainly
|
|
132
|
-
|
|
133
|
-
> **Ambition**: The default, most capable TypeScript backend — Bun-first, Web-Standards portable, contract-first
|
|
134
|
-
> **Grounded in**: Eight elements, effect inference through `fx`, Gate and Vault, the official plugin set
|
|
135
|
-
> **Maturity**: **pre-1.0** — published and usable; not independently battle-tested at scale yet
|
|
136
|
-
|
|
137
|
-
## Learn more
|
|
138
|
-
|
|
139
|
-
- [Introduction](/docs/get-started/introduction) — the one law, eight elements, one contract
|
|
140
|
-
- [Flow](/docs/elements/flow) — how effects are recorded and inferred
|
|
141
|
-
- [Vault](/docs/elements/vault) — fail-loud secret contracts
|
|
142
|
-
- [Plugins](/docs/reference/plugins) — the official HTTP glue set
|
|
143
|
-
|
|
144
|
-
## Next
|
|
101
|
+
## Next Steps
|
|
145
102
|
|
|
146
103
|
<Cards>
|
|
147
|
-
<Card
|
|
148
|
-
title="Installation"
|
|
149
|
-
description="Scaffold with create-oke and open the Console."
|
|
150
|
-
href="/docs/get-started/installation"
|
|
151
|
-
/>
|
|
152
|
-
<Card
|
|
153
|
-
title="Basic Usage"
|
|
154
|
-
description="Health Flow, typed client, and bun:test."
|
|
155
|
-
href="/docs/get-started/basic-usage"
|
|
156
|
-
/>
|
|
157
104
|
<Card
|
|
158
105
|
title="Introduction"
|
|
159
|
-
description="The
|
|
106
|
+
description="The Law, Flow anatomy, and the eight elements."
|
|
160
107
|
href="/docs/get-started/introduction"
|
|
161
108
|
/>
|
|
109
|
+
<Card
|
|
110
|
+
title="Installation"
|
|
111
|
+
description="Scaffold your first project with create-oke."
|
|
112
|
+
href="/docs/get-started/installation"
|
|
113
|
+
/>
|
|
162
114
|
</Cards>
|