okengine 0.1.6 → 0.2.1
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 +1 -1
- package/README.md +36 -29
- package/docs/spec/example.md +1187 -0
- package/docs/spec/unified-theory.md +1 -1
- package/package.json +19 -6
- package/src/cli/dev.ts +3 -1
- package/src/cli/doc-drift.ts +54 -21
- package/src/console/index.ts +25 -13
- package/src/console/server/app.ts +44 -7
- package/src/console/server/flows.ts +2 -6
- package/src/console/server/index.ts +2 -1
- package/src/console/server/lazy-panels.test.ts +27 -0
- package/src/console/server/panel-load.ts +28 -0
- package/src/console/server/plugin.ts +1 -1
- package/src/console/server/plugins.ts +7 -6
- package/src/console/server/public-flows.ts +12 -0
- package/src/console/server/state.ts +159 -122
- package/src/console/server/store.ts +13 -10
- package/src/drivers/index.ts +1 -6
- package/src/drivers/vault-sops.ts +20 -1
- package/src/kernel/app.ts +1 -1
- package/src/kernel/boot-bind/ai.ts +31 -0
- package/src/kernel/boot-bind/channel.ts +27 -0
- package/src/kernel/boot-bind/clock.ts +74 -0
- package/src/kernel/boot-bind/gate.ts +28 -0
- package/src/kernel/boot-bind/runs.ts +28 -0
- package/src/kernel/boot-bind/signal.ts +68 -0
- package/src/kernel/boot-bind/store.ts +47 -0
- package/src/kernel/boot-bind/vault.ts +36 -0
- package/src/kernel/boot.test.ts +85 -1
- package/src/kernel/boot.ts +250 -212
- package/src/kernel/index.ts +2 -0
- package/src/mcp/data.ts +1 -0
- package/src/mcp/docs-index.ts +252 -0
- package/src/mcp/docs-mcp.test.ts +176 -0
- package/src/mcp/docs-server.ts +233 -0
- package/src/mcp/docs-tools.ts +143 -0
- package/src/mcp/index.ts +29 -5
- package/src/mcp/protocol.ts +2 -1
- package/src/release/exports.test.ts +71 -0
- package/src/release/exports.ts +156 -0
- package/src/release/index.ts +21 -0
- package/src/release/limits.ts +9 -0
- package/src/release/measure.exports.test.ts +82 -0
- package/src/release/measure.ts +297 -14
- package/src/release/publish.ts +14 -3
- package/src/release/readme.test.ts +61 -0
- package/src/release/readme.ts +13 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/security.test.ts +6 -1
- package/src/runtime/types.ts +6 -0
- package/src/test/create-test-app.ts +2 -0
package/AGENTS.md
CHANGED
|
@@ -76,7 +76,7 @@ A regression fails the build. Claims we cannot measure, we do not make.
|
|
|
76
76
|
|
|
77
77
|
Published packages:
|
|
78
78
|
- `okengine` — framework. Subpath exports: `.`, `./client`, `./test`, `./config`, `./auth`, `./drivers/*`. `"sideEffects": false`. CLI binary: `oke`.
|
|
79
|
-
- `create-oke` — scaffold CLI (`bunx create-oke@latest <name>`). Lives in `packages/create-oke`;
|
|
79
|
+
- `create-oke` — scaffold CLI (`bunx create-oke@latest <name>`). Lives in `packages/create-oke`; clean starters are `templates/*`, teaching apps stay in `examples/*` (`--from-example`).
|
|
80
80
|
|
|
81
81
|
Engine: Bun `>=1.3`.
|
|
82
82
|
|
package/README.md
CHANGED
|
@@ -8,32 +8,15 @@
|
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](https://bun.sh)
|
|
10
10
|
|
|
11
|
-
**Framework:** [`okengine`](https://www.npmjs.com/package/okengine) · **CLI:** `oke` · **Scaffold:** [`create-oke`](https://www.npmjs.com/package/create-oke) · **License:** MIT
|
|
11
|
+
**Framework:** [`okengine`](https://www.npmjs.com/package/okengine) · **CLI:** `oke` · **Scaffold:** [`create-oke`](https://www.npmjs.com/package/create-oke) · **Docs:** [oke.dev](https://oke.dev) · **License:** MIT
|
|
12
12
|
|
|
13
13
|
### Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
bun add okengine # npm (recommended — ships the `oke` CLI)
|
|
17
17
|
bunx jsr add @omqkhafi/okengine # JSR — library API only
|
|
18
|
-
bunx create-oke@latest my-app
|
|
18
|
+
bunx create-oke@latest my-app --template hello # scaffold from npm
|
|
19
19
|
```
|
|
20
|
-
|
|
21
|
-
| Package | npm | JSR |
|
|
22
|
-
|---|---|---|
|
|
23
|
-
| Framework | [`okengine`](https://www.npmjs.com/package/okengine) | [`@omqkhafi/okengine`](https://jsr.io/@omqkhafi/okengine) |
|
|
24
|
-
| Scaffold | [`create-oke`](https://www.npmjs.com/package/create-oke) | [`@omqkhafi/create-oke`](https://jsr.io/@omqkhafi/create-oke) |
|
|
25
|
-
|
|
26
|
-
### npm vs JSR
|
|
27
|
-
|
|
28
|
-
| Surface | npm | JSR |
|
|
29
|
-
|---|---|---|
|
|
30
|
-
| Library imports (`okengine`, `/client`, `/drivers`, …) | yes | yes |
|
|
31
|
-
| Deep drivers (`okengine/drivers/postgres`, …) | yes | no — use `okengine/drivers`, or install from npm |
|
|
32
|
-
| `oke` CLI | yes | no |
|
|
33
|
-
| `create-oke` binary | yes | no — prefer `bunx create-oke@latest` from npm |
|
|
34
|
-
|
|
35
|
-
JSR cannot rewrite the CLI’s dynamic imports of your app entry (`oke dev` / `oke start` / config load). Install `okengine` from npm when you need the binary. Deep driver subpaths use npm `exports` wildcards, which JSR does not support.
|
|
36
|
-
|
|
37
20
|
---
|
|
38
21
|
|
|
39
22
|
## Start here
|
|
@@ -52,14 +35,14 @@ Eight elements cover what a backend needs. Ten exports are the whole public voca
|
|
|
52
35
|
import { on, flow, signal, store, clock, gate, vault, channel, ai, plugin } from "okengine";
|
|
53
36
|
```
|
|
54
37
|
|
|
55
|
-
Batteries included for the Bun era: contract-first APIs, typed client, infrastructure primitives, Console, auth — pure TypeScript, MIT, self-hostable, no cloud lock-in.
|
|
38
|
+
Batteries included for the Bun era: contract-first APIs, typed client, infrastructure primitives, Console, auth — pure TypeScript, MIT, self-hostable, no cloud lock-in. Handbook: [oke.dev/docs](https://oke.dev/docs). Spec depth: [`docs/spec/unified-theory.md`](https://github.com/omqkhafi/okengine/blob/main/docs/spec/unified-theory.md).
|
|
56
39
|
|
|
57
40
|
---
|
|
58
41
|
|
|
59
42
|
## Run something in two minutes
|
|
60
43
|
|
|
61
44
|
```bash
|
|
62
|
-
bunx create-oke@latest my-app
|
|
45
|
+
bunx create-oke@latest my-app --template hello
|
|
63
46
|
cd my-app
|
|
64
47
|
oke dev
|
|
65
48
|
```
|
|
@@ -68,9 +51,13 @@ oke dev
|
|
|
68
51
|
|---|---|
|
|
69
52
|
| `:6530` | your app |
|
|
70
53
|
| `:6533` | Console |
|
|
71
|
-
| `:6535` | MCP |
|
|
54
|
+
| `:6535` | MCP (your live Manifest, for agents) |
|
|
55
|
+
|
|
56
|
+
Mnemonic: **O·K·E = 6·5·3**. Docs MCP for the handbook is a separate surface on `:6536` (search/fetch only — see [Documentation](#documentation)).
|
|
57
|
+
|
|
58
|
+
That scaffolds the **hello** starter — one flow, no Store, the fastest true "it works" moment. Default without `--template` is **standard** (full recommended file layout, empty scaffolding). Open the Console — flows, contracts, effects, and an architecture diagram are already there. Derived, not configured.
|
|
72
59
|
|
|
73
|
-
|
|
60
|
+
Prefer a worked teaching app (business logic + comments)? Use `--from-example notes|linkly|provisions|skyport` instead.
|
|
74
61
|
|
|
75
62
|
### The idea, in one file
|
|
76
63
|
|
|
@@ -144,7 +131,9 @@ The rest of the scaffold is small and ordinary: `oke.config.ts` (drivers by prot
|
|
|
144
131
|
|
|
145
132
|
## How to learn (read in order)
|
|
146
133
|
|
|
147
|
-
|
|
134
|
+
Start on the site if you want the handbook path: [Introduction](https://oke.dev/docs/get-started/introduction) → [Installation](https://oke.dev/docs/get-started/installation) → [Basic usage](https://oke.dev/docs/get-started/basic-usage).
|
|
135
|
+
|
|
136
|
+
Each teaching app adds the smallest next set of ideas. Do not skip ahead.
|
|
148
137
|
|
|
149
138
|
1. **Notes** — `oke`, `on`, `flow`, `http`, `store.sql`, `fx`, typed errors, typed client
|
|
150
139
|
→ [`examples/notes`](examples/notes)
|
|
@@ -158,7 +147,17 @@ Each app adds the smallest next set of ideas. Do not skip ahead.
|
|
|
158
147
|
4. **Skyport** — `ai`, multi-tenancy, SLOs, distributed topology, scaling axes
|
|
159
148
|
→ [`examples/skyport`](examples/skyport)
|
|
160
149
|
|
|
161
|
-
|
|
150
|
+
Same path in the spec: [`docs/spec/four-applications.md`](docs/spec/four-applications.md).
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Documentation
|
|
155
|
+
|
|
156
|
+
- **Site** — [oke.dev](https://oke.dev) (landing) · [oke.dev/docs](https://oke.dev/docs) (handbook) · [changelog](https://oke.dev/changelog)
|
|
157
|
+
- **Agents on the site** — [`/llms.txt`](https://oke.dev/llms.txt) index · [`/llms-full.txt`](https://oke.dev/llms-full.txt) full text · `/llms.mdx/docs/...` per-page markdown
|
|
158
|
+
- **Docs MCP** — `:6536` · tools `oke.docs.search` / `oke.docs.get` (read-only; Host/Origin validated like the other surfaces)
|
|
159
|
+
- **App MCP** — `:6535` · live Manifest, schemas, effects, traces, Console-safe actions (Bearer + confirmation for writes)
|
|
160
|
+
- **Canonical specs in-repo** — [`docs/spec/`](docs/spec) (unified theory, four applications, Console)
|
|
162
161
|
|
|
163
162
|
---
|
|
164
163
|
|
|
@@ -205,7 +204,7 @@ flowchart TD
|
|
|
205
204
|
|
|
206
205
|
Seventeen panels on `:6533` (app `:6530`, MCP `:6535`): Overview, Flows, Signals, Store, Clock, Gates, Vault, Channels, AI, Architecture, Traces, Runs, Manifest Diff, Access, Plugins — plus Privacy and Tenancy when those plugins are plugged.
|
|
207
206
|
|
|
208
|
-
Operator and user planes stay separate. Every Console action is a real flow through `fx`, so the audit log is the trace.
|
|
207
|
+
Operator and user planes stay separate. Every Console action is a real flow through `fx`, so the audit log is the trace. Spec: [`docs/spec/console.md`](docs/spec/console.md) · handbook: [oke.dev/docs/console](https://oke.dev/docs/console/overview).
|
|
209
208
|
|
|
210
209
|
---
|
|
211
210
|
|
|
@@ -327,7 +326,7 @@ Long form is canonical in docs; short form is convenience only. Shared letters f
|
|
|
327
326
|
|
|
328
327
|
`.plug()` attaches a plugin. Scope is the attachment point: `app.plug()` app-wide, `unit.plug()` one unit, `flow.plug()` one flow. No `global: true`, no inheritance rule — [unified theory §14](docs/spec/unified-theory.md#14-plugins--the-extensibility-law).
|
|
329
328
|
|
|
330
|
-
The Console is treated as internet-facing even on localhost. Host header validation, Origin validation, and authentication are mandatory on `:6530`, `:6533`, and `:6535` ([console.md §10](docs/spec/console.md#10-security-posture)): two-plane auth (operator vs user), capability-scoped tokens.
|
|
329
|
+
The Console is treated as internet-facing even on localhost. Host header validation, Origin validation, and authentication are mandatory on `:6530`, `:6533`, and `:6535` ([console.md §10](docs/spec/console.md#10-security-posture)): two-plane auth (operator vs user), capability-scoped tokens. Docs MCP `:6536` uses the same Host/Origin checks and stays read-only (no Bearer writes).
|
|
331
330
|
|
|
332
331
|
---
|
|
333
332
|
|
|
@@ -341,13 +340,21 @@ The Console is treated as internet-facing even on localhost. Host header validat
|
|
|
341
340
|
|
|
342
341
|
---
|
|
343
342
|
|
|
343
|
+
## Budgets
|
|
344
|
+
|
|
345
|
+
Measured size and latency caps — see [`BUDGETS.md`](BUDGETS.md). Refresh with `bun run budgets`.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
344
349
|
## Status
|
|
345
350
|
|
|
346
|
-
Pre-1.0. Published on [npm](https://www.npmjs.com/package/okengine) and [JSR](https://jsr.io/@omqkhafi/okengine) (`okengine` + `create-oke`, lockstep). MIT. No `CONTRIBUTING` yet — issues and PRs welcome.
|
|
351
|
+
Pre-1.0. Published on [npm](https://www.npmjs.com/package/okengine) and [JSR](https://jsr.io/@omqkhafi/okengine) (`okengine` + `create-oke`, lockstep). Docs at [oke.dev](https://oke.dev). MIT. No `CONTRIBUTING` yet — issues and PRs welcome.
|
|
347
352
|
|
|
348
|
-
|
|
|
353
|
+
| Resource | Path |
|
|
349
354
|
|---|---|
|
|
355
|
+
| Docs site | [oke.dev](https://oke.dev) · [handbook](https://oke.dev/docs) · [changelog](https://oke.dev/changelog) |
|
|
350
356
|
| Unified theory | [`docs/spec/unified-theory.md`](https://github.com/omqkhafi/okengine/blob/main/docs/spec/unified-theory.md) |
|
|
351
357
|
| Four applications | [`docs/spec/four-applications.md`](https://github.com/omqkhafi/okengine/blob/main/docs/spec/four-applications.md) |
|
|
352
358
|
| Console | [`docs/spec/console.md`](https://github.com/omqkhafi/okengine/blob/main/docs/spec/console.md) |
|
|
353
359
|
| Scaffold | [`packages/create-oke`](https://github.com/omqkhafi/okengine/tree/main/packages/create-oke) |
|
|
360
|
+
| Changelog source | [`docs/changelog.md`](docs/changelog.md) |
|