@intentius/behold 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +64 -0
- package/README.md +25 -1
- package/dist/cli.js +425 -95
- package/example-writes/README.md +88 -0
- package/example-writes/chant.config.ts +12 -0
- package/example-writes/ops/apply.op.ts +7 -0
- package/example-writes/ops/floci.op.ts +20 -0
- package/example-writes/ops/reconcile.op.ts +6 -0
- package/example-writes/package-lock.json +1249 -0
- package/example-writes/package.json +14 -0
- package/example-writes/src/bucket.ts +54 -0
- package/example-writes/tsconfig.json +1 -0
- package/package.json +4 -2
- package/web/app.js +471 -115
- package/web/index.html +143 -91
- package/web/panel.js +163 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Driving behold (for agents)
|
|
2
|
+
|
|
3
|
+
behold is a **read-only control plane** over a chant estate, with **delegated,
|
|
4
|
+
gated** writes. As an agent you drive it the same way a human does — and the
|
|
5
|
+
mutating capabilities are chant's MCP Op tools, not behold's, so nothing here holds
|
|
6
|
+
apply creds.
|
|
7
|
+
|
|
8
|
+
## The division of labour
|
|
9
|
+
|
|
10
|
+
- **behold** serves the live, mixed-substrate graph (and, later, the deployment-lanes
|
|
11
|
+
timeline). It reads; it never mutates.
|
|
12
|
+
- **chant's MCP** is where the real capabilities live. Prefer it over shelling.
|
|
13
|
+
- Reads: `lifecycle-diff`, `lifecycle-snapshot`, `build`, `lint`.
|
|
14
|
+
- Actions (delegated writes): `op-run` (start an `ApplyOp`/`ReconcileOp`),
|
|
15
|
+
`op-signal` (approve a gate), `op-status` / `op-report` (watch it).
|
|
16
|
+
|
|
17
|
+
## Getting a server
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx @intentius/behold serve <chant-project-dir> --port 4600 # or: preview / demo
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`behold demo` needs no project at all — it copies the bundled example and serves
|
|
24
|
+
it against a local emulator (Docker). A directory that is not a chant project
|
|
25
|
+
gets a structured `{code: "no-project"}` error from `/api/graph`, not a blank
|
|
26
|
+
graph.
|
|
27
|
+
|
|
28
|
+
## The read loop
|
|
29
|
+
|
|
30
|
+
0. **discover** — GET `/api` lists every route with a one-line description,
|
|
31
|
+
plus the server's version and a link back to this guide.
|
|
32
|
+
1. **observe** — GET `/api/graph` (JSON: `{ ir, svg, meta }`). The mixed graph
|
|
33
|
+
of the project, every node with `id`/`kind`/`lexicon`/`attrs`/`sourceLoc`. Drift
|
|
34
|
+
status, when present, is `attrs._status` (`good`=managed, `warn`=foreign,
|
|
35
|
+
`accent`=pending, `neutral`=unobserved, `runtime`=runtime child). With
|
|
36
|
+
`?env=`, `/api/overlay` is the live entity overlay; `/api/diff?env=` slices
|
|
37
|
+
per-node observed state, drift and field ownership; `/api/reconcile?env=`
|
|
38
|
+
summarizes the pending change set; `/api/substrates` reports substrate
|
|
39
|
+
readiness; `/api/events` (SSE) pushes `changed`/`op`/`apply`/`pr`.
|
|
40
|
+
2. **focus** — narrow with chant graph options as query params: `?detail=0..3`,
|
|
41
|
+
`?components=1`, `?logical=1`, `?lens=blast:<id>&down=1`, `?lens=lexicon:aws`,
|
|
42
|
+
`?env=`, `?stack=`, `?tier=`, `?target=`.
|
|
43
|
+
3. **inspect** — a node's `sourceLoc.file` is the typed source that declared it;
|
|
44
|
+
edit there to change the estate (chant is the source of truth, not behold).
|
|
45
|
+
|
|
46
|
+
## The act loop (delegated, never direct)
|
|
47
|
+
|
|
48
|
+
behold does not apply. To change the estate:
|
|
49
|
+
|
|
50
|
+
1. Edit the chant `.ts` source (the node's `sourceLoc`), or
|
|
51
|
+
2. Trigger a committed Op via chant's MCP:
|
|
52
|
+
- `op-run <name>` — start the project's `ApplyOp` (code→cloud) or `ReconcileOp`
|
|
53
|
+
(cloud→code PR).
|
|
54
|
+
- `op-signal <name> <gate>` — approve a gate (e.g. a destructive apply).
|
|
55
|
+
- `op-status <name>` — watch phases; `op-report <name>` — the run report.
|
|
56
|
+
|
|
57
|
+
Every mutation is a gated, durable Temporal workflow with a human-confirmable gate
|
|
58
|
+
and saga rollback. There is no behold endpoint that mutates the cloud.
|
|
59
|
+
|
|
60
|
+
## Invariant
|
|
61
|
+
|
|
62
|
+
If a request would have behold write to a cloud or to source directly, it's wrong.
|
|
63
|
+
behold shows truth and triggers Ops. Authority stays in the committed source and the
|
|
64
|
+
executor.
|
package/README.md
CHANGED
|
@@ -16,11 +16,35 @@ chant source ──build/lint──▶ graph IR ──behold──▶ live graph
|
|
|
16
16
|
(deterministic) (server + browser)
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Quick start (npm)
|
|
20
|
+
|
|
21
|
+
No chant project yet? The bundled demo is the five-minute path — an S3 bucket +
|
|
22
|
+
policy served against a local emulator, no cloud account, no credentials
|
|
23
|
+
(needs Docker):
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @intentius/behold demo # copies the example to ./behold-demo, installs, serves
|
|
27
|
+
# → http://localhost:4600 — blue = declared; click Deploy, watch it turn green
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The copied project is yours: edit its source and watch the graph change live.
|
|
31
|
+
|
|
32
|
+
Already have a chant project?
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
cd my-chant-project
|
|
36
|
+
npx @intentius/behold preview # → http://localhost:4600, this project's graph
|
|
37
|
+
npx @intentius/behold serve . --env prod --poll 30 # live drift overlay
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Driving it from an agent or script? `GET /api` lists every JSON route;
|
|
41
|
+
[AGENTS.md](./AGENTS.md) (shipped in the package) is the read/act contract.
|
|
42
|
+
|
|
19
43
|
## Preview: your project, or the Loom-on-Floci demo (v0.1.0)
|
|
20
44
|
|
|
21
45
|
`behold preview` is the quick way to look at a chant project's graph in a
|
|
22
46
|
browser at one port. Plain, it just opens the project you point it at — no env,
|
|
23
|
-
no emulator
|
|
47
|
+
no emulator. From a repo checkout the same commands run through `npm run dev`:
|
|
24
48
|
|
|
25
49
|
```sh
|
|
26
50
|
npm install
|