@delurio/cli 0.9.0 → 0.11.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/CHANGELOG.md +24 -0
- package/NOTICE +7 -0
- package/README.md +16 -15
- package/SPEC.md +37 -11
- package/js/changes.d.ts +17 -0
- package/js/cli.js +6 -0
- package/{dist → js}/edges.d.ts +2 -2
- package/js/edges.js +40 -0
- package/js/expr.js +25 -0
- package/js/graph.js +59 -0
- package/{dist → js}/html.d.ts +6 -6
- package/js/html.js +13 -0
- package/js/internal.js +408 -0
- package/js/kit.js +54 -0
- package/{dist → js}/model.d.ts +2 -2
- package/js/model.js +136 -0
- package/js/native.cjs +46 -0
- package/js/native.d.cts +322 -0
- package/{dist → js}/nav.d.ts +1 -1
- package/js/nav.js +70 -0
- package/{dist → js}/needs.d.ts +3 -2
- package/js/needs.js +30 -0
- package/{dist → js}/spine.d.ts +3 -3
- package/js/spine.js +22 -0
- package/{dist → js}/starts.d.ts +1 -3
- package/{dist → js}/story.d.ts +2 -2
- package/js/story.js +22 -0
- package/{dist → js}/wireframe.d.ts +4 -2
- package/js/wireframe.js +29 -0
- package/js/yaml.d.ts +20 -0
- package/js/yaml.js +40 -0
- package/package.json +41 -25
- package/schemas/domain.schema.json +3 -0
- package/dist/changes.d.ts +0 -25
- package/dist/changes.js +0 -101
- package/dist/check.d.ts +0 -23
- package/dist/check.js +0 -574
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -194
- package/dist/compare.d.ts +0 -34
- package/dist/compare.js +0 -143
- package/dist/diff-flow.d.ts +0 -33
- package/dist/diff-flow.js +0 -547
- package/dist/diff-nav.d.ts +0 -20
- package/dist/diff-nav.js +0 -401
- package/dist/diff.d.ts +0 -25
- package/dist/diff.js +0 -331
- package/dist/domain-names.d.ts +0 -18
- package/dist/domain-names.js +0 -124
- package/dist/domain.d.ts +0 -25
- package/dist/domain.js +0 -110
- package/dist/edges.js +0 -120
- package/dist/expr.js +0 -157
- package/dist/graph.js +0 -236
- package/dist/html.js +0 -311
- package/dist/index-page.d.ts +0 -12
- package/dist/index-page.js +0 -50
- package/dist/invokes.d.ts +0 -10
- package/dist/invokes.js +0 -67
- package/dist/kit.js +0 -710
- package/dist/mermaid.d.ts +0 -3
- package/dist/mermaid.js +0 -50
- package/dist/model.js +0 -608
- package/dist/nav-page.d.ts +0 -15
- package/dist/nav-page.js +0 -283
- package/dist/nav.js +0 -578
- package/dist/needs.js +0 -311
- package/dist/pan.d.ts +0 -2
- package/dist/pan.js +0 -252
- package/dist/schemas.d.ts +0 -10
- package/dist/schemas.js +0 -266
- package/dist/spine.js +0 -156
- package/dist/starts.js +0 -88
- package/dist/story.js +0 -109
- package/dist/tutorial-check.d.ts +0 -9
- package/dist/tutorial-check.js +0 -297
- package/dist/ui-check.d.ts +0 -8
- package/dist/ui-check.js +0 -136
- package/dist/watch.d.ts +0 -5
- package/dist/watch.js +0 -114
- package/dist/wireframe.js +0 -273
- package/dist/yaml.d.ts +0 -19
- package/dist/yaml.js +0 -134
- /package/{dist → js}/expr.d.ts +0 -0
- /package/{dist → js}/graph.d.ts +0 -0
- /package/{dist → js}/kit.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
While the version is 0.x, a release that can judge the same graphs differently (a new check, a stricter schema) bumps the minor; a fix that judges nothing differently bumps the patch.
|
|
4
4
|
|
|
5
|
+
## 0.11.0 (2026-11-16)
|
|
6
|
+
|
|
7
|
+
- The checker is written in Rust: `check`, `page` and `diff`, and every module the package exports, are the TypeScript checker's ported one module at a time (crates/delurio-core, crates/delurio-page, the `delurio` binary in crates/delurio, and the addon in crates/delurio-node). It judges every graph as 0.10.0 does: on the examples, on delurio's, QAuth's and Medaris's own graphs, and in the 35 behaviour cases of the CI, every finding (its rule, level, file, line, words and fingerprint), the SARIF, the exit codes, every page, diagram and Mermaid file, and every diff are those 0.10.0 gives. Where 0.10.0 stopped with a JavaScript TypeError on a value of the wrong type, 0.11.0 reads the value as absent (the `schema` rule already reports it), and a baseline or a file it cannot read is an `error:` line, not a stack trace.
|
|
8
|
+
- It reads YAML as 0.10.0 did: the yaml library 2.9.1's lexer, parser and composer are ported, so a refusal (SPEC.md §1), a YAML error and a key are found at the same place and in the same words. The `schema` rule gives Ajv 8.20's findings: Ajv's evaluation of the keywords the schemas use is reproduced. A flow's diagram is still laid out by elkjs 0.12.1 itself, now run inside the binary (QuickJS-NG), so its places are the same to the last digit as before and as the dashboard's.
|
|
9
|
+
- Faster and smaller: on Medaris's 179 graphs, `check --strict --baseline` takes 34 s and 299 MB, where 0.10.0 took 87 s and 1 GB; `page` takes 96 s, where 0.10.0 took 15 minutes. On delurio's own graphs `check` takes 56 s and 0.56 GB, where 0.10.0 took 228 s and 4.2 GB (more than Node's default heap): the explorer keeps each (state, context) pair as packed words, 16 bytes a pair, so delurio's billing.plan (16.76 million pairs) explores in 21 s and 0.54 GB.
|
|
10
|
+
- One new limit: a context variable may hold up to 65,536 values.
|
|
11
|
+
- For installers: `delurio` is one static binary, from the GitHub release of each tag (Linux x64 and arm64, glibc and musl, macOS arm64, Windows x64, with SHA256SUMS), from `cargo install --locked --git https://github.com/delurio-labs/delurio --tag v0.11.0 delurio`, and in the image `ghcr.io/delurio-labs/delurio`, which is now the binary alone `FROM scratch`. `npm install @delurio/cli` installs the same command (`npx delurio`) and the same entry points with their types, on a prebuilt addon of the platform: npm picks one of six packages `@delurio/cli-<platform>` (no install script). The package needs Node 26 or later and depends only on elkjs. A process that loads the library under Node's permission model needs `--allow-addons`, and a bundler must leave `@delurio/cli` external.
|
|
12
|
+
- The library: `renderPage` and `callLine` (`@delurio/cli/html`) are gone; `delurio page` writes a flow's page. An `Exploration` must come from `explore`, and a graph, a navigation graph or a kit is read once per object (a copy is read again).
|
|
13
|
+
|
|
14
|
+
## 0.10.0 (2026-11-16)
|
|
15
|
+
|
|
16
|
+
- New warning of `check`, which fails nothing: `role-missing`, a node of type `field` or `action` that gives no `role` (SPEC.md §4). A screen reader, a replay and `kit check` find a control by its WAI-ARIA role; before, `kit check` expected such a node's type (`field`, `action`) as its role, which no drawn element can have, so every such node was a mismatch. `@delurio/cli/wireframe`'s `Expectation` says so with `roleGiven`, so a kit check holds that node's name and state only.
|
|
17
|
+
- A kit's CSS may say `scroll-behavior` and `overscroll-behavior`. The check of script-like CSS took any `behavior:` for old Internet Explorer's script binding, so a kit made from a product's own CSS was refused for scrolling smoothly. `behavior:` itself is still refused.
|
|
18
|
+
- New rule of `check`, which fails `--strict` (SPEC.md §9): `source-unresolved`, a `source:` anchor whose file is not there, is a folder, or whose line is 0 or past the file's end, at the anchor. Every anchor is held, in a flow, its screens, a navigation graph and a domain: each `source` that the file's schema gives as an anchor (`sourceAnchor`), so a key `source` that means something else (a nav graph's own `source`, a sample value or a parameter of `ui.yaml`, a field of a record) is none. The path is read from the application's repository root, `--app` or the folder `check` runs in, as a need's evidence is; an anchor of a navigation graph too, and where the path is there under its `source.app` the finding says so. Before, only a need's evidence was resolved: of Medaris's 18,843 anchors, the 125 of its navigation pages written from the app folder (`app/page.tsx`) passed, and so did 34 of QAuth's 556 that are past their file's end. A project whose graphs give such anchors can record them with `--baseline`: they are then printed as warnings until they are fixed, and a new one fails.
|
|
19
|
+
- New rule of `check`, a warning, which fails nothing (SPEC.md §9): `citation-unresolved`, a `path:line` in a graph's words (a `description`, a `say`, a `note`, a `rule`, a need's `missing`) whose file is not there or whose line, or a range's last line, is past its end. Only a token that reads as a path from the repository's root is looked at: a folder of the root first, a file with an extension last. Sample values, an entity's records and a need's evidence are not words.
|
|
20
|
+
- A need's `source` evidence is resolved as an anchor is: a folder is now said to be a folder, and a line 0 does not resolve.
|
|
21
|
+
- `check --no-app` checks a project's graphs without its code (SPEC.md §10), as the panel checks a graphs folder alone: the anchors, the citations in words, and a need's `source`, `test`, `setting` and a `scenario` whose binding is named by its path are not looked for, and the output says once how many were not, on a line before the summary (`delurio check: note: --no-app: …`) and as a notification of the run at the level `note` in SARIF (`invocations[0].toolExecutionNotifications`). A need's `state` and `node`, a scenario of the flow's own `binding.yaml` and every other rule are checked as before. `--app` and `--no-app` together are refused (exit 1). Before, such a check gave an `evidence-unresolved` error for every path.
|
|
22
|
+
- SPEC.md §13: a missing need's `state` and `node` name only what is not built yet, as a replay leaves out every state and node that only missing needs name; a gap that is about something built names it in its `need` or `note`. New rule of `check`, a warning: `need-names-built`, at a missing need's `state` that names a state of a captured flow that names its code. Medaris's captured graphs had named 110 built states so, before they were moved to notes. A state of a captured flow that only missing needs name is not built, and `source-missing` no longer asks it for a `source` (SPEC.md §9).
|
|
23
|
+
- An entity may carry `note` (SPEC.md §5), as an action, a refusal and an invariant do. Before, the `schema` rule refused it.
|
|
24
|
+
- Decided on 16 Nov 2026 (SPEC.md §5): an entity or an action written before its code says `planned: <why>`, which a captured domain, whose `status` is given once, could not say of its parts. New rule of `check`, which fails `--strict`: `planned-built`, at the `planned` of an entity or an action that also names its code, with a note where its `source` is. Graphs without `planned` are judged as before.
|
|
25
|
+
- SPEC.md §1: a tool that reads or writes graph files with a YAML 1.1 library, such as PyYAML, reads `on`, `off`, `yes` and `no` as booleans, where the CLI reads YAML 1.2 strings: quote such a name, or read YAML 1.2.
|
|
26
|
+
- The toolchain is current: Node 26 (`engines.node` `>=26`, CI and the release on Node 26, the image on `node:26.13.1-alpine3.24` pinned by its digest), `@types/node` 26.6.6, elkjs 0.12.1, npm 12.2.2 for the staged release, docker/login-action 4.8.0 and sigstore/cosign-installer 4.1.3, each pinned by its commit. TypeScript 7.0.2, ajv 8.20.0, ajv-formats 3.0.1 and yaml 2.9.1 are already the newest stable releases more than 7 days old. The examples give the same findings, SARIF and pages as on Node 22 with elkjs 0.12.0. A project that runs the CLI on Node 22 or 24 is warned by npm that it wants 26.
|
|
27
|
+
- The examples give the same findings as before: none.
|
|
28
|
+
|
|
5
29
|
## 0.9.0 (2026-11-16)
|
|
6
30
|
|
|
7
31
|
- `check` parses each file once however many graphs read it. Before, it parsed a flow's domain again for every flow that names it, and every flow again for every flow that starts another: on delurio's own 41 flows it took 12.7 s, of which more than half was parsing the same files again; it now takes 5.8 s. It judges nothing differently: the same graphs give the same findings, in text and in SARIF, as 0.8.0 gives.
|
package/NOTICE
CHANGED
|
@@ -3,3 +3,10 @@ Copyright 2026 delurio Labs
|
|
|
3
3
|
|
|
4
4
|
This product includes software developed by delurio Labs
|
|
5
5
|
and its contributors.
|
|
6
|
+
|
|
7
|
+
The delurio binary and the npm package's addons include:
|
|
8
|
+
- elkjs 0.12.1 (https://github.com/kieler/elkjs), the Eclipse Layout Kernel compiled to JavaScript, under the
|
|
9
|
+
Eclipse Public License 2.0: crates/delurio-page/vendor/elkjs/ holds it unchanged with its LICENSE.md and SOURCE;
|
|
10
|
+
- QuickJS-NG (https://github.com/quickjs-ng/quickjs), through the rquickjs crate, under the MIT License, which runs it.
|
|
11
|
+
Each Rust crate they are built from keeps its own licence (cargo metadata lists them; all are MIT, Apache-2.0 or both,
|
|
12
|
+
or similarly permissive).
|
package/README.md
CHANGED
|
@@ -6,26 +6,25 @@ This package is the part a project's own CI runs: it reads graph files and nothi
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`delurio` is one program with no runtime of its own to install. Pin an exact version in a project, in whichever way it
|
|
10
|
+
already installs its tools:
|
|
10
11
|
|
|
11
12
|
```sh
|
|
12
|
-
|
|
13
|
+
npm install --save-dev --save-exact @delurio/cli # then: npx delurio check graphs --strict
|
|
14
|
+
cargo install --locked --git https://github.com/delurio-labs/delurio --tag v<x.y.z> delurio # then: delurio check graphs --strict
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
or
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
npm install --save-dev --save-exact @delurio/cli
|
|
19
|
-
npx delurio check graphs --strict
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
or the container image, pinned by its digest:
|
|
17
|
+
or download the binary of your platform from the [releases](https://github.com/delurio-labs/delurio/releases) (Linux
|
|
18
|
+
x64 and arm64, glibc and musl; macOS arm64; Windows x64; each release lists their SHA-256 in `SHA256SUMS`), or
|
|
19
|
+
run the container image, pinned by its digest (the binary alone, `FROM scratch`):
|
|
23
20
|
|
|
24
21
|
```sh
|
|
25
22
|
docker run --rm -v "$PWD:/work" -w /work ghcr.io/delurio-labs/delurio@sha256:<digest> check graphs --strict
|
|
26
23
|
```
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
The npm package installs a prebuilt addon of your platform (one of the `@delurio/cli-<platform>` packages, chosen by
|
|
26
|
+
npm, with no install script) and needs Node 26 or later. Running it once without installing works too:
|
|
27
|
+
`npx @delurio/cli@<x.y.z> check graphs --strict`.
|
|
29
28
|
|
|
30
29
|
## Check every graph
|
|
31
30
|
|
|
@@ -50,7 +49,7 @@ Several folders may be given (`check graphs examples`); a graph under two of the
|
|
|
50
49
|
|---|---|
|
|
51
50
|
| 0 | every graph loads, and under `--strict` nothing is wrong |
|
|
52
51
|
| 1 | a graph cannot be loaded, or is written for a newer format than this version reads |
|
|
53
|
-
| 2 | under `--strict`: a guarantee is broken, a state cannot be reached or has no way out, a catalog key is missing from a locale or a sample is missing, the main story cannot be walked, a tutorial no longer matches its flow, a writing flow has no changes note, a domain names an entity or a field it does not have, a flow invokes an action or lists a failure code its domain does not have, a policy names one, a need's evidence is not there or a product's gaps and its needs disagree… |
|
|
52
|
+
| 2 | under `--strict`: a guarantee is broken, a state cannot be reached or has no way out, a catalog key is missing from a locale or a sample is missing, the main story cannot be walked, a tutorial no longer matches its flow, a writing flow has no changes note, a domain names an entity or a field it does not have, a flow invokes an action or lists a failure code its domain does not have, a policy names one, a `source:` anchor names a file or a line that is not there, a need's evidence is not there or a product's gaps and its needs disagree… |
|
|
54
53
|
|
|
55
54
|
## What a product must have: needs and gaps
|
|
56
55
|
|
|
@@ -61,7 +60,7 @@ examples/notes/restore/needs.yaml:47:5: note: need says-when-it-is-erased is mis
|
|
|
61
60
|
delurio check: 5 graphs, 0 errors, 0 warnings, 1 gap of 4 needs; exit 0
|
|
62
61
|
```
|
|
63
62
|
|
|
64
|
-
`check --strict` fails where evidence names what is not there (a file, a line, a name, a scenario, a state, a node), where a missing need is not in the gaps, and where the gaps list a need that is met or that no flow has. A gap that is listed fails nothing: it is counted, and given as a note. So a product built in phases is written whole, the planned parts included, while its CI stays green, and the gaps only shrink: a need that is met must leave the list, and a new gap is a line added to it, which a review reads. Evidence paths are relative to the repository root, the folder `check` runs in; `--app <dir>` names another.
|
|
63
|
+
`check --strict` fails where evidence names what is not there (a file, a line, a name, a scenario, a state, a node), where a missing need is not in the gaps, and where the gaps list a need that is met or that no flow has. A gap that is listed fails nothing: it is counted, and given as a note. So a product built in phases is written whole, the planned parts included, while its CI stays green, and the gaps only shrink: a need that is met must leave the list, and a new gap is a line added to it, which a review reads. Evidence paths, and every `source:` anchor, are relative to the repository root, the folder `check` runs in; `--app <dir>` names another, and `--no-app` checks the graphs without the code: what they name of it is not looked for, and the output says how much that was.
|
|
65
64
|
|
|
66
65
|
## A graph's page
|
|
67
66
|
|
|
@@ -135,7 +134,7 @@ This prints Markdown for a pull request. It covers what the flow does differentl
|
|
|
135
134
|
|
|
136
135
|
## As a library
|
|
137
136
|
|
|
138
|
-
A tool built on the format can use the same loader and checker the CLI uses:
|
|
137
|
+
A tool built on the format can use the same loader and checker the CLI uses, from Node:
|
|
139
138
|
|
|
140
139
|
```ts
|
|
141
140
|
import { load } from '@delurio/cli/graph';
|
|
@@ -145,7 +144,9 @@ const g = load('graphs/billing/billing.payment');
|
|
|
145
144
|
const configurations = explore(new Model(g.flow)).configs.length;
|
|
146
145
|
```
|
|
147
146
|
|
|
148
|
-
The entry points are `graph`, `model`, `story`, `wireframe`, `kit`, `edges`, `html`, `nav`, `expr`, `yaml` and `needs`, each with its types. `yaml` reads a graph file's text as the CLI does (`readYaml`), refusing what SPEC.md §1 rules out before the text is resolved; a server that reads graphs it was sent should read them with it. `needs` reads a flow's needs (`readNeeds`) and gives the states and nodes that only missing needs are drawn as (`planned`), which a tool that walks the flow on the app leaves out. While the version is 0.x their API may change in any minor release: pin an exact version.
|
|
147
|
+
The entry points are `graph`, `model`, `story`, `wireframe`, `kit`, `edges`, `html`, `nav`, `expr`, `spine`, `yaml` and `needs`, each with its types. They run the checker's Rust code in a native addon: values go in and come out as plain JavaScript objects, callbacks (`load`'s readers, `explore`'s `keep`, `evaluate`'s lookup, the warnings) are called as the code reaches them, and errors are real `GraphError`, `ModelError` and `KitError` instances. `renderSpine` lays the diagram out with the package's own elkjs. Under Node's permission model a process that imports them needs `--allow-addons`, and a bundler must leave `@delurio/cli` (and `@delurio/cli-*`) external. `yaml` reads a graph file's text as the CLI does (`readYaml`), refusing what SPEC.md §1 rules out before the text is resolved; a server that reads graphs it was sent should read them with it. `needs` reads a flow's needs (`readNeeds`) and gives the states and nodes that only missing needs are drawn as (`planned`), which a tool that walks the flow on the app leaves out. While the version is 0.x their API may change in any minor release: pin an exact version.
|
|
148
|
+
|
|
149
|
+
The Rust crates are the same code for a Rust program: `delurio-core` (the graph, the model, every rule of `check`, `diff`), `delurio-page` (the page) and `delurio` (the command line).
|
|
149
150
|
|
|
150
151
|
## Licence
|
|
151
152
|
|
package/SPEC.md
CHANGED
|
@@ -32,7 +32,7 @@ id: learning.enrollment
|
|
|
32
32
|
|
|
33
33
|
A flow directory holds `flow.yaml`; a flow with screens also holds `ui.yaml` and the catalog that `ui.yaml` names. It may hold `domain.yaml`, `binding.yaml`, `tutorial.yaml` and `needs.yaml`; a product's `needs.gaps.yaml` sits at the root of its graphs (§13). A domain shared by several flows sits in its own directory and each flow names it by id (`domain: learning.api`). A directory holds one domain and a domain sits in one directory, in `domain.yaml` or split across several files (§5). A navigation graph is a directory with `nav.yaml` and its catalog.
|
|
34
34
|
|
|
35
|
-
A graph file is YAML 1.2 without anchors (`&name`), aliases (`*name`), tags (`!name`) or keys that are lists or maps: a value is written where it is used, and a key is a string. No graph needs them, and a YAML reader can take minutes over a small file that uses them, so a file with one cannot be loaded ("unsupported YAML", at its line). `@delurio/cli/yaml` reads a file this way.
|
|
35
|
+
A graph file is YAML 1.2 without anchors (`&name`), aliases (`*name`), tags (`!name`) or keys that are lists or maps: a value is written where it is used, and a key is a string. No graph needs them, and a YAML reader can take minutes over a small file that uses them, so a file with one cannot be loaded ("unsupported YAML", at its line). `@delurio/cli/yaml` reads a file this way. A tool that writes or reads graph files with a YAML 1.1 library, such as PyYAML, reads a bare `on`, `off`, `yes` or `no` (in any case: `On`, `NO`) as `true` or `false`, where YAML 1.2 reads a string: a state or a value so named is quoted (`"off"`), or the tool uses a YAML 1.2 reader such as ruamel.yaml.
|
|
36
36
|
|
|
37
37
|
A flow with no screen (an HTTP endpoint, a webhook, an MCP tool, a CI job) has no `ui.yaml`: it loads and is checked without one, and its page draws no screens. What such a step answers the outside world is written on its state as `response` (§2).
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ A flow with no screen (an HTTP endpoint, a webhook, an MCP tool, a CI job) has n
|
|
|
41
41
|
| Key | Meaning |
|
|
42
42
|
|---|---|
|
|
43
43
|
| `title`, `summary` | the graph in plain words, for people |
|
|
44
|
-
| `status` | `proposed`: written before or apart from the code, nobody has approved it. `captured`: read from existing code (capture mode, every element carries `source:`, §9). `approved`: the owner reviewed and accepted it |
|
|
44
|
+
| `status` | `proposed`: written before or apart from the code, nobody has approved it. `captured`: read from existing code (capture mode, every element carries `source:`, §9). `approved`: the owner reviewed and accepted it. A graph gives it once, a domain in one of its files; an entity or an action written before its code, inside a captured domain, says `planned` (§5), and a planned state of a captured flow is a missing need's (§13) |
|
|
45
45
|
| `source` | on any element: `<repo-relative path>:<line>` or a bare `<path>`, the code that makes the element true. See §9 |
|
|
46
46
|
|
|
47
47
|
### Text
|
|
@@ -193,7 +193,7 @@ An app may have no such message yet, and a captured graph describes the app as i
|
|
|
193
193
|
|
|
194
194
|
**A `GET` that a policy lists** writes only when it does more than record its call. A policy names everything its actor may do, reads and writes together, so its `write` says what some of the actions of its `do` write, not that each of them does; and a `GET` reads (§5). Such a `GET` writes when one of its `sideEffects` is other than an audit record, `audit:<event>`. An audit record is what the service keeps of the call itself, who read what and when, as a server keeps its access log (RFC 9110 §9.2.1): it is no change that the flow's users make or are told of. So a flow that only reads, through a `GET` that writes an audit record each time it is called, needs no changes note, and one whose `GET` also writes something else, such as the session a sign-in callback opens (`sideEffects: ["a session for the person"]`), still does. An action whose method is not `GET`, and a step inside the service, write as before, whatever their side effects: an audit record beside a write is still a write. Decided on 16 Nov 2026 (d-1116-12).
|
|
195
195
|
|
|
196
|
-
A `role` is a WAI-ARIA 1.2 role, and `name` is the accessible name that Accessible Name and Description Computation 1.2 gives the node; `kit check` reads both from the browser's accessibility tree.
|
|
196
|
+
A `role` is a WAI-ARIA 1.2 role, and `name` is the accessible name that Accessible Name and Description Computation 1.2 gives the node; `kit check` reads both from the browser's accessibility tree. A node of type `field` or `action` with no `role` is a warning of `check` (`role-missing`): a screen reader, a replay and `kit check` find a control by its role, and `kit check` holds such a node's name and state but cannot hold its role.
|
|
197
197
|
|
|
198
198
|
A node is shown in a state when the state is in `in`, not in `unless`, and `when` holds. `edges` records relations the page and the checks use: a node labelled by another, an action that leads to a state, the node a dialog gives the focus back to. `rules` are written but no tool reads them yet; checking them, together with labelled dialogs, confirmation before a destructive action and events handled where shown, is [#3](https://github.com/delurio-labs/delurio/issues/3). The focus return of #3 is partly answered: a dialog says where the focus returns with `returnsFocus` (below), and `check` holds that it starts at a dialog and gives the focus to a node shown where the dialog closes. That every dialog says it is still #3.
|
|
199
199
|
|
|
@@ -275,7 +275,7 @@ invariants:
|
|
|
275
275
|
|
|
276
276
|
A capture may carry more words of its own on a field (`owner`, `note`, `editableBy`, `matching`, `opaque`). They are kept and compared, and no tool reads them.
|
|
277
277
|
|
|
278
|
-
An action, a refusal and an invariant may carry `note`: the author's own words, which no tool reads. An invariant the code does not keep is still written, with `holds: false` and the `finding` that reports it: the finding's id in the graph's report, such as `MS-7`. A capture describes the code, so the invariant says what should hold and the finding says where it does not. Decided on 25 Oct 2026.
|
|
278
|
+
An entity, an action, a refusal and an invariant may carry `note`: the author's own words, which no tool reads. An invariant the code does not keep is still written, with `holds: false` and the `finding` that reports it: the finding's id in the graph's report, such as `MS-7`. A capture describes the code, so the invariant says what should hold and the finding says where it does not. Decided on 25 Oct 2026.
|
|
279
279
|
|
|
280
280
|
**The API.** An action with a `route` (`METHOD /path`) is one OpenAPI 3.1 operation: its name is the `operationId`, `needs` its security requirement, `query` (a JSON Schema object) its query parameters, `body` its request body, `result` its response (`returns` an entity, a `redirect`, a `status`, or a JSON Schema), and each refusal one more response. When a refusal has a body, it is RFC 9457 problem details with the refusal code as its `type`. So a domain can be written out as an OpenAPI document, and an app that already publishes one names it at the top (`openapi: <file>`) and each action's operation by `operationId`, instead of copying them. An action with `serverFn` is a server function (below), and an action with neither is a step inside the service. `needs`, `policies`, `sideEffects`, `refusals.<code>.redirect` and `invariants` are delurio's own: no standard says who may do what to which data, or what must always hold.
|
|
281
281
|
|
|
@@ -304,6 +304,17 @@ This form was decided on 22 Oct 2026. Graphs captured before it may still give f
|
|
|
304
304
|
|
|
305
305
|
A value given in two files is an error of `check` at the second one's line (`domain-twice`); so is a file whose id is not its directory's domain, and a domain whose files sit in two directories (`domain-place`). A split keeps a large domain one entity per file, and lets a part generated from the code ([#6](https://github.com/delurio-labs/delurio/issues/6)) and a part written by hand sit side by side; how a generator marks the files it owns is decided there. Decided on 1 Nov 2026.
|
|
306
306
|
|
|
307
|
+
**Planned parts** (decided on 16 Nov 2026, d-1116-19). A domain gives its `status` once, so a captured domain, read from the code, cannot say `proposed` of the part that is written before its code: an action that no route answers yet, an entity that no table holds. Such an entity or action says `planned`, with why or where that is tracked, as a missing need says `missing` (§13):
|
|
308
|
+
|
|
309
|
+
```yaml
|
|
310
|
+
actions:
|
|
311
|
+
registerInPerson:
|
|
312
|
+
route: POST /lessons/{id}/in-person/registration
|
|
313
|
+
planned: the second phase builds it (#12)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
`planned` is on the entity or the action itself, wherever it is given in a split domain, so it says what is not built however the files are cut, and it goes when the part is built, where its `source:` comes. A planned entity or action names no code: one that gives both is an error of `check` at its `planned` (`planned-built`), with a note where its `source` is, so the mark cannot outlive the code. What a planned action holds (its refusals, its fields) is planned with it; a refusal of it that shared code already answers may still name that code. Any domain may give `planned`; in a domain that is `proposed` as a whole it says nothing more. A field, a refusal or a policy cannot say it.
|
|
317
|
+
|
|
307
318
|
`check` validates every file of a domain against its schema and reads its files as one, the `changes` rule (§4) reads its actions (one writes when its route or its server function is not a `GET`, when a policy lets someone `write` with it, or when it is a step inside the service that returns an entity; a `GET` that a policy lists writes only when it does more than record its call, §4), the revision diff compares it, anchors lock its `source:` keys, and the page of a flow that names it lists what each of its steps calls and how: an HTTP operation and its route, a server function and its method, or a step inside the service. `check` also reads the domain a flow names, and holds the names the flow gives to it (The names a flow gives, below). Checking secrets (`sensitivity`) and what a policy lets each actor do is [#5](https://github.com/delurio-labs/delurio/issues/5). Generating it from Drizzle and Zod is [#6](https://github.com/delurio-labs/delurio/issues/6); a registry that every API operation and route is covered by a graph is [#7](https://github.com/delurio-labs/delurio/issues/7).
|
|
308
319
|
|
|
309
320
|
**The names it gives.** A domain's names are its own: `check` holds each name a domain gives to what the domain has, all its files read as one, and gives each finding in the file that gives the name, at its line. An action's `result.returns`, and a `references` on a field of an entity or anywhere in a `body`, a `query`, a `result` or a refusal's `body`, name an entity of the domain, as the keywords above say; one that names no entity of it is an error (`entity-unknown`). Where another domain among the graphs checked has an entity of that name, a note says where: a domain does not name another one's entities, and a large one is split across the files of its directory instead (Several files, above). So a name that only another domain has is an error too, with that note (decided on 16 Nov 2026, d-1116-13). An entity's `key` and `required` name its own fields; one that is not a field of the entity is an error (`field-unknown`), and an entity none of whose files gives `fields` yet is not held to them. A policy's `do` names actions of the domain, and its `read` and `write` name entities; one that names what the domain does not have is an error (`policy-unknown`).
|
|
@@ -397,9 +408,13 @@ A kit says how the components of `ui.yaml` look in one product: `tokens` and `da
|
|
|
397
408
|
|
|
398
409
|
## 9. Source anchors
|
|
399
410
|
|
|
400
|
-
`source: <path>:<line>` on a state, a transition, a guard, a node, an entity or an action names the code that makes it true, relative to the application's repository root. A bare `<path>` anchors a whole file. In capture mode every element carries one; in create mode an element carries one when the code already exists. `check` reports a state of a captured flow that names no code (`source-missing`). An exit may leave it out: the transition into it names the code, and an exit such as the person leaving the page has no code of its own.
|
|
411
|
+
`source: <path>:<line>` on a state, a transition, a guard, a node, an entity or an action names the code that makes it true, relative to the application's repository root. A bare `<path>` anchors a whole file. In capture mode every element carries one; in create mode an element carries one when the code already exists. `check` reports a state of a captured flow that names no code (`source-missing`). An exit may leave it out: the transition into it names the code, and an exit such as the person leaving the page has no code of its own. So may a state that only missing needs name (§13), which is drawn before it is built.
|
|
412
|
+
|
|
413
|
+
**Every anchor resolves.** `check` holds every anchor to the code, wherever it is written: the file it names exists and is a file, and its line, when it names one, is within the file, from 1 to the file's last line. One that does not is an error (`source-unresolved`), at the anchor: a file that is not there, a folder, or a line past the file's end, as a writer's line number that was off gives. The path is read from the application's repository root, as a need's evidence is (§13): the folder `check --app` names, or else the folder `check` runs in, as a CI runs it at the root of the repository it checked out. An anchor of a navigation graph is read from that root too, whatever its `source.app` says; where the path is there under `source.app`, the finding says so. An anchor is a `source` that a graph file's schema gives as one (`sourceAnchor` in `schemas/`), in a flow, its screens, a navigation graph or a domain: a key `source` that means something else, such as a navigation graph's own `source`, a sample value or a field of a record, is none. A need's evidence is held by its own rule (`evidence-unresolved`, §13).
|
|
401
414
|
|
|
402
|
-
`anchors.lock.yaml`, generated beside the graph, records what each anchor pointed at (the line, its neighbours' hashes, the commit). The check finds every line again and says whether it is unchanged, moved, changed, gone or ambiguous.
|
|
415
|
+
`anchors.lock.yaml`, generated beside the graph, records what each anchor pointed at (the line, its neighbours' hashes, the commit). The check finds every line again and says whether it is unchanged, moved, changed, gone or ambiguous.
|
|
416
|
+
|
|
417
|
+
**Citations in words.** A `path:line` in a graph's words (a `description`, a `say`, a `note`, a `rule`, a need's `missing`) is not an anchor: no tool keeps it in step with the code, and `anchors.lock.yaml` does not record it. It still cites the code, so `check` holds it to the code as a warning (`citation-unresolved`), which fails nothing: a file that is not there, or a line past its end. Words are not parsed, so only a token that reads as a path from the repository's root is looked at: a folder that the root has, any folders below it, a file with an extension, then `:` and the line, or a range `:<first>-<last>`, whose last line is held. `app/page.tsx:12`, which names no folder of the root, is not looked at, nor is an address or a comment. A sample value, a record of an entity and a need's evidence are not words.
|
|
403
418
|
|
|
404
419
|
## 10. Checks and findings
|
|
405
420
|
|
|
@@ -407,7 +422,15 @@ A kit says how the components of `ui.yaml` look in one product: `tokens` and `da
|
|
|
407
422
|
|---|---|
|
|
408
423
|
| 0 | the graph loads and, under `--strict`, nothing is wrong |
|
|
409
424
|
| 1 | the graph cannot be loaded: a YAML error, unsupported YAML (§1), an unknown state, an unknown name in an expression or one that does not parse, a non-exhaustive `always`, an unsupported construct, a `ui.yaml` that names no catalog or a catalog that is not there or not JSON (§4) |
|
|
410
|
-
| 2 | under `--strict`: an assertion is violated, a state no situation reaches or a state that is no exit and has no way out (§2), a catalog key is missing from a locale's catalog or a sample value from the samples, a component has no renderer, the kit does not cover a component, the main story cannot be walked, the focus goes to a node that is not shown or a `returnsFocus` does not start at a dialog (§4), a domain's files clash, a server function has what only a route has, a domain names an entity or a field it does not have, a policy names an action or an entity its domain does not have, or a flow invokes an action its domain does not have, names a domain that is not found, or lists a failure code that is neither a refusal of its action nor a transport code (§5), a tutorial no longer matches its flow (§7), a state of a captured flow names no code (§9), or a need's evidence does not resolve, a need that is not missing names none, or a product's gaps and its needs disagree (§13) |
|
|
425
|
+
| 2 | under `--strict`: an assertion is violated, a state no situation reaches or a state that is no exit and has no way out (§2), a catalog key is missing from a locale's catalog or a sample value from the samples, a component has no renderer, the kit does not cover a component, the main story cannot be walked, the focus goes to a node that is not shown or a `returnsFocus` does not start at a dialog (§4), a domain's files clash, a server function has what only a route has, a domain names an entity or a field it does not have, a policy names an action or an entity its domain does not have, or a flow invokes an action its domain does not have, names a domain that is not found, or lists a failure code that is neither a refusal of its action nor a transport code, or a planned entity or action names its code (§5), a tutorial no longer matches its flow (§7), a state of a captured flow names no code or an anchor does not resolve (§9), or a need's evidence does not resolve, a need that is not missing names none, or a product's gaps and its needs disagree (§13) |
|
|
426
|
+
|
|
427
|
+
**Where the code is.** What a graph names of the application is read from the application's repository root: the folder `check --app <dir>` names, or else the folder `check` runs in, as a CI runs it at the root of the repository it checked out. That is every `source:` anchor and every citation in words (§9), and a need's `source`, `test` and `setting`, and a `scenario` whose binding is named by its path (§13). A check that has a project's graphs without its code, such as the panel's check of a graphs folder alone, says `--no-app`: none of these is looked for, and rather than a finding for each, the output says once how many were not, on a line before the summary in text and as a notification of the run (`toolExecutionNotifications`, at the level `note`) in SARIF, as `check examples --no-app` gives it:
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
delurio check: note: --no-app: 0 source anchors, 0 citations in words and 7 pieces of evidence name files of the application, which are not here, and were not looked for (SPEC.md §10)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Everything else is checked as before, the graph's own evidence included: a need's `state` and `node`, and a scenario of the flow's own `binding.yaml`. `--app` and `--no-app` are not given together.
|
|
411
434
|
|
|
412
435
|
A graph that cannot be loaded is a finding of the rule `load`, at its place: the file and the line of what it is about (the transition that goes to a state that does not exist, the guard that does not parse, the `catalog` of `ui.yaml`), or the line and column a parser gave. The other graphs are checked as usual.
|
|
413
436
|
|
|
@@ -439,7 +462,7 @@ graphs/product/flow.yaml:88:7: note: step 2: CODE_CHANGED from developing, with
|
|
|
439
462
|
| a mechanical fix, such as an anchor's new line | `fixes` |
|
|
440
463
|
| the finding's page in the panel; the issue it was sent to | `hostedViewerUri`; `workItemUris` |
|
|
441
464
|
| the files read, with their hashes; the repository and the commit | `artifacts`; `versionControlProvenance` |
|
|
442
|
-
| the exit code; a file that cannot be loaded | `invocations` with `exitCode`; a result of the rule `load` and a `toolExecutionNotification` |
|
|
465
|
+
| the exit code; a file that cannot be loaded; what `--no-app` did not look for | `invocations` with `exitCode`; a result of the rule `load` and a `toolExecutionNotification`; a `toolExecutionNotification` at `note` |
|
|
443
466
|
| which graph and which check, so that uploads stay apart | `automationDetails.id` |
|
|
444
467
|
| the messages in Turkish (`--locale tr`) | `run.language` and a `translations` component |
|
|
445
468
|
|
|
@@ -529,7 +552,9 @@ A flow's needs are in `needs.yaml`, in the flow's folder beside `flow.yaml`, and
|
|
|
529
552
|
| `missing` | that it does not exist yet, and why or where that is tracked: words, an issue, a finding's id |
|
|
530
553
|
| `note` | the author's own words, which no tool reads |
|
|
531
554
|
|
|
532
|
-
A need without `missing` is met, and its evidence names at least one thing outside the graph: a `source`, a `test`, a `scenario` or a `setting`. What the graph draws (`state`, `node`) says where the need is drawn, and alone shows nothing built. A need with `missing` is a gap. It may name evidence too: where it is drawn, and what exists of it so far.
|
|
555
|
+
A need without `missing` is met, and its evidence names at least one thing outside the graph: a `source`, a `test`, a `scenario` or a `setting`. What the graph draws (`state`, `node`) says where the need is drawn, and alone shows nothing built. A need with `missing` is a gap. It may name evidence too: where it is drawn, and what exists of it so far.
|
|
556
|
+
|
|
557
|
+
A missing need's `state` and `node` name only what is not built yet: the states and the nodes that will be drawn for it, such as the page that is planned. A tool that walks the flow on the app leaves out every state and node that only missing needs name (below), so a built one named there would not be walked. A gap that is about something built, such as an error page that has no `<main>` yet, names it in its `need` or its `note` (`note: the error page, errorPage, has no main landmark`), not as its evidence. A state of a captured flow that names its code (`source:`, §9) is built, and `check` warns at a missing need's `state` that names one (`need-names-built`). A state of a captured flow that only missing needs name is not built: it names no code, and `source-missing` (§9) does not ask it for one (decided on 16 Nov 2026, d-1116-20). Needs are written from what the flow's users need, never from what the product does today, so a need the product does not meet yet is written all the same, with `missing`. A list is therefore `proposed` or `approved`, never `captured` (§1).
|
|
533
558
|
|
|
534
559
|
| Evidence | What it says | It resolves when |
|
|
535
560
|
|---|---|---|
|
|
@@ -540,7 +565,7 @@ A need without `missing` is met, and its evidence names at least one thing outsi
|
|
|
540
565
|
| `node: <node>` | a node of the flow's screens the need is drawn as | the flow's `ui.yaml` has that node |
|
|
541
566
|
| `setting: <NAME>` | an environment variable a deployment sets for the need | a line of the file `in` names sets it and is not commented out: `NAME=` or `export NAME=`, as a dotenv file has it, or `NAME:` or `- NAME=`, as the `environment` of a Compose file has it |
|
|
542
567
|
|
|
543
|
-
A `source` or a `test` may say what its file holds (`name`), and a `scenario` which binding it is in (`binding: <path>`); a `setting` names the file that sets it (`in: <path>`). A file holds a name when the name is in it and is not part of a longer word. Every path is relative to the application's repository root, as a `source:` anchor's is (§9): the folder `check --app` names, or else the folder `check` runs in, as a CI runs it at the root of the repository it checked out. A piece of evidence is of one kind; a need names as many as it has.
|
|
568
|
+
A `source` or a `test` may say what its file holds (`name`), and a `scenario` which binding it is in (`binding: <path>`); a `setting` names the file that sets it (`in: <path>`). A file holds a name when the name is in it and is not part of a longer word. Every path is relative to the application's repository root, as a `source:` anchor's is (§9): the folder `check --app` names, or else the folder `check` runs in, as a CI runs it at the root of the repository it checked out. Under `--no-app` (§10) the evidence that names a file by its path, a `source`, a `test`, a `setting` and a `scenario` with `binding`, is not looked for. A piece of evidence is of one kind; a need names as many as it has.
|
|
544
569
|
|
|
545
570
|
Evidence shows that something exists, not that it is right or that it passes. A test is run, and a scenario replayed, by the CI that runs them. Whoever writes and approves the list names only a test or a scenario that walks the need as its users meet it.
|
|
546
571
|
|
|
@@ -562,11 +587,12 @@ gaps:
|
|
|
562
587
|
|
|
563
588
|
- `evidence-unresolved`, at a piece of evidence that does not resolve: a file that is not there, a line past the file's end, a name the file does not hold, a binding that is not there or binds another flow, a scenario it does not have, a state or a node the flow does not have, a setting no line of its file sets. So evidence that goes away takes its need with it.
|
|
564
589
|
- `need-no-evidence`, at a need that is not missing and whose evidence names only what the graph draws.
|
|
590
|
+
- `need-names-built`, a warning, at a missing need's `state` that names a state of a captured flow that names its code (`source:`), so is built.
|
|
565
591
|
- `need-unlisted`, at a need that is missing and that its gaps file does not list, or that has no gaps file above it.
|
|
566
592
|
- `gap-met`, at an entry of a gaps file whose need is met now; `gap-unknown`, at an entry that names a flow or a need that no `needs.yaml` under the file's folder has.
|
|
567
593
|
- `need-twice`, at a need whose id is given earlier in its file; `needs-place`, at a `needs.yaml` that is beside no flow, or whose `id` is not the id of the flow beside it.
|
|
568
594
|
|
|
569
|
-
Each is an error, and fails `--strict` (exit 2). A gap that is listed fails nothing: it is a finding of its own, `need-gap`, at the need's `missing`, with its words, at the level `note` in text and in SARIF. Once a flow has needs, the summary line counts the gaps among them:
|
|
595
|
+
Each but `need-names-built`, a warning, is an error, and fails `--strict` (exit 2). A gap that is listed fails nothing: it is a finding of its own, `need-gap`, at the need's `missing`, with its words, at the level `note` in text and in SARIF. Once a flow has needs, the summary line counts the gaps among them:
|
|
570
596
|
|
|
571
597
|
```
|
|
572
598
|
examples/notes/restore/needs.yaml:47:5: note: need says-when-it-is-erased is missing: archived notes are not erased yet; … [need-gap]
|
package/js/changes.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// types only, for html.d.ts: the domain a flow names (the module is internal to the checker)
|
|
2
|
+
export interface DomainAction {
|
|
3
|
+
route?: string;
|
|
4
|
+
serverFn?: string;
|
|
5
|
+
result?: {
|
|
6
|
+
returns?: string;
|
|
7
|
+
};
|
|
8
|
+
sideEffects?: unknown[];
|
|
9
|
+
}
|
|
10
|
+
export interface Domain {
|
|
11
|
+
id?: string;
|
|
12
|
+
actions?: Record<string, DomainAction | null>;
|
|
13
|
+
policies?: Array<{
|
|
14
|
+
do?: string[];
|
|
15
|
+
write?: string[];
|
|
16
|
+
}>;
|
|
17
|
+
}
|
package/js/cli.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// delurio: the open checker and page of delurio-graph/0 (SPEC.md). The command line is the Rust one, run in this
|
|
3
|
+
// process by the addon; it writes to this process's stdout and stderr and gives the exit code.
|
|
4
|
+
import native from './native.cjs';
|
|
5
|
+
|
|
6
|
+
process.exitCode = native.runCli(process.argv.slice(2));
|
package/{dist → js}/edges.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Graph, State } from './graph.
|
|
2
|
-
import type { Exploration } from './model.
|
|
1
|
+
import type { Graph, State } from './graph.js';
|
|
2
|
+
import type { Exploration } from './model.js';
|
|
3
3
|
export type EdgeKind = 'user' | 'system' | 'route' | 'fail';
|
|
4
4
|
export interface VizEdge {
|
|
5
5
|
from: string;
|
package/js/edges.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The edges a flow's diagrams draw, merged by their ends, and the words of their nodes: what a person presses, where
|
|
2
|
+
// an exit leaves them, a step's response in one line. The checker is the Rust one (crates/delurio-core/src/edges.rs).
|
|
3
|
+
import { json, native, nativeExploration, nativeGraph } from './internal.js';
|
|
4
|
+
|
|
5
|
+
export const BY = JSON.parse(native.edgesConstants());
|
|
6
|
+
|
|
7
|
+
export function kindOf(g, name) {
|
|
8
|
+
return native.kindOf(nativeGraph(g), String(name));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function exitLine(st) {
|
|
12
|
+
return native.exitLine(st === undefined ? undefined : json(st));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// a step's `response` in one line: the status, the code and the redirect first, then the other fields
|
|
16
|
+
export function responseLine(r) {
|
|
17
|
+
return native.responseLine(json(r ?? {}));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function nodeLine(g, name) {
|
|
21
|
+
return native.nodeLine(nativeGraph(g), String(name));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// visible text for a catalog key, with {placeholders} filled from the samples
|
|
25
|
+
export function plain(g, key) {
|
|
26
|
+
return native.plain(nativeGraph(g), String(key));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// the button or link text a person presses to send `event` while in `state`, if there is one
|
|
30
|
+
export function pressLabel(g, state, event) {
|
|
31
|
+
return native.pressLabel(nativeGraph(g), String(state), String(event)) ?? null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function wrap(text, max) {
|
|
35
|
+
return native.wrap(String(text), Number(max));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function collectEdges(g, ex) {
|
|
39
|
+
return JSON.parse(native.collectEdges(nativeGraph(g), nativeExploration(ex)));
|
|
40
|
+
}
|
package/js/expr.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// The guard and assertion language: a small, fixed subset, interpreted without eval.
|
|
2
|
+
// or / and / not, == / != / in / not in, parentheses, [lists], 'strings', numbers, true / false / null, names.
|
|
3
|
+
// The checker is the Rust one (crates/delurio-core/src/expr.rs).
|
|
4
|
+
import { Trap, call, native } from './internal.js';
|
|
5
|
+
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
|
|
8
|
+
export function parseExpr(src) {
|
|
9
|
+
const hit = cache.get(src);
|
|
10
|
+
if (hit !== undefined) return hit;
|
|
11
|
+
const e = JSON.parse(call(null, () => native.parseExpr(String(src))));
|
|
12
|
+
cache.set(src, e);
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// `lookup` is called for each name the expression reads, as it reads them; what it throws reaches the caller
|
|
17
|
+
export function evaluate(e, lookup) {
|
|
18
|
+
const t = new Trap();
|
|
19
|
+
return JSON.parse(call(t, () => native.evaluate(JSON.stringify(e), t.lookup(lookup))));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function identifiers(e, out = new Set()) {
|
|
23
|
+
for (const name of native.identifiers(JSON.stringify(e))) out.add(name);
|
|
24
|
+
return out;
|
|
25
|
+
}
|
package/js/graph.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// A graph as `load` reads it from its folder: flow.yaml, ui.yaml and the catalog ui.yaml names (SPEC.md §2-§4), and
|
|
2
|
+
// the readers of its parts. The checker is the Rust one (crates/delurio-core/src/graph.rs), run in the addon.
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { GraphError, Trap, call, json, native, nativeValue, placed, rememberGraph, warnings } from './internal.js';
|
|
6
|
+
|
|
7
|
+
export { GraphError, placed };
|
|
8
|
+
|
|
9
|
+
const constants = JSON.parse(native.graphConstants());
|
|
10
|
+
|
|
11
|
+
// in a returnsFocus, the node that was pressed to open the dialog (SPEC.md §4)
|
|
12
|
+
export const OPENER = constants.OPENER;
|
|
13
|
+
|
|
14
|
+
// the roles whose node may say whether it is `checked`
|
|
15
|
+
export const CHECKABLE = constants.CHECKABLE;
|
|
16
|
+
|
|
17
|
+
export const isDialog = (n) => native.isDialogNode(n === undefined ? undefined : JSON.stringify(n));
|
|
18
|
+
|
|
19
|
+
// the place of a transition in flow.yaml: `on.<event>`, the item of a list of alternatives, or an item of `always`
|
|
20
|
+
export function transitionPath(state, st, event, i) {
|
|
21
|
+
return native.transitionPathOf(String(state), json(st ?? {}), event === null || event === undefined ? undefined : String(event), i);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 'silentRedirect' -> 'Silent redirect'; used only when the graph gives no title
|
|
25
|
+
export function humanize(id) {
|
|
26
|
+
return native.humanize(String(id));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function titleOf(flow, state) {
|
|
30
|
+
return native.titleOfState(nativeValue(flow), String(state));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// a node is shown in a state when the state is in its `in` and not in its `unless`
|
|
34
|
+
export function shownIn(n, state) {
|
|
35
|
+
return native.shownInState(json(n ?? {}), String(state));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// The node that has focus once the flow has moved from the state `from` (null when it starts) into another state `to`
|
|
39
|
+
// (SPEC.md §4, Focus). `ui` is read as it is at the call.
|
|
40
|
+
export function focusAfter(ui, from, to, pressed) {
|
|
41
|
+
return JSON.parse(native.focusAfterStep(json(ui), from ?? undefined, String(to), pressed ?? undefined));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function alternatives(spec) {
|
|
45
|
+
if (spec === undefined) return [undefined];
|
|
46
|
+
return JSON.parse(native.alternativesOf(json(spec)));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// `read` and `exists` take a path relative to `dir`; the revision diff passes ones that read a git revision instead of the disk
|
|
50
|
+
export function load(dir, read = (file) => readFileSync(join(dir, file), 'utf8'), exists = (file) => existsSync(join(dir, file))) {
|
|
51
|
+
const t = new Trap();
|
|
52
|
+
try {
|
|
53
|
+
const n = call(t, () => native.load(String(dir), t.reader(read), t.exister(exists)));
|
|
54
|
+
return rememberGraph(JSON.parse(n.json()), n);
|
|
55
|
+
} finally {
|
|
56
|
+
warnings();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
package/{dist → js}/html.d.ts
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Graph } from './graph.
|
|
2
|
-
import type { AssertionResult, Exploration, FinalPath, Model } from './model.
|
|
3
|
-
import type { Story } from './story.
|
|
4
|
-
import type { Kit } from './kit.
|
|
5
|
-
import type { HandOver } from './starts.
|
|
6
|
-
import type { Domain, DomainAction } from './changes.
|
|
1
|
+
import type { Graph } from './graph.js';
|
|
2
|
+
import type { AssertionResult, Exploration, FinalPath, Model } from './model.js';
|
|
3
|
+
import type { Story } from './story.js';
|
|
4
|
+
import type { Kit } from './kit.js';
|
|
5
|
+
import type { HandOver } from './starts.js';
|
|
6
|
+
import type { Domain, DomainAction } from './changes.js';
|
|
7
7
|
export declare const CSS = "\n:root { --bg:#fafaf9; --surface:#ffffff; --ink:#1c1917; --muted:#6b6560; --line:#d6d3d1; --accent:#1d4ed8; --accent-bg:#eef3ff; --ok:#15803d; --bad:#b91c1c; --server:#eeeeec; --focus:#1d4ed8; --ai:#7e22ce; --ai-bg:#f5edff; --agent:#c2410c; --agent-bg:#fff1e8; --ci:#0f766e; --ci-bg:#e6f6f3; --ok-bg:#eaf7ee; }\n@media (prefers-color-scheme: dark) { :root { --bg:#161513; --surface:#1f1d1b; --ink:#f2efec; --muted:#a8a29e; --line:#44403c; --accent:#8fb0ff; --accent-bg:#1c2438; --ok:#5fcf85; --bad:#f08080; --server:#2a2826; --focus:#8fb0ff; --ai:#c99bff; --ai-bg:#2a2135; --agent:#ff9a66; --agent-bg:#33241b; --ci:#5fd4c4; --ci-bg:#1a2e2b; --ok-bg:#16291d; } }\n* { box-sizing: border-box; }\nbody { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, \"Segoe UI\", sans-serif; }\nmain { max-width: 1000px; margin: 0 auto; padding: 28px 16px 80px; }\nh1 { font-size: 30px; line-height: 1.2; margin: 6px 0 8px; } h2 { font-size: 21px; margin: 44px 0 12px; } h3 { font-size: 16px; margin: 0; }\ncode, pre, .mono { font-family: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace; font-size: 13px; }\n.muted { color: var(--muted); } .label { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }\n.eyebrow { margin: 0; color: var(--muted); } .lede { font-size: 18px; max-width: 46em; margin: 0; }\n.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; color: var(--muted); vertical-align: middle; }\n.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }\ntable { border-collapse: collapse; width: 100%; } th, td { text-align: left; vertical-align: top; padding: 8px 12px; border-bottom: 1px solid var(--line); } th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); } tr:last-child td { border-bottom: 0; }\ntd ol { margin: 0; padding-left: 20px; }\n.ok { color: var(--ok); font-weight: 600; } .bad { color: var(--bad); font-weight: 600; }\n.story { margin-top: 28px; padding: 18px 22px; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 10px; background: var(--surface); }\n.story h2 { margin: 0 0 6px; } .story .given { margin: 0 0 8px; } .story ol { margin: 0; padding-left: 26px; } .story li { margin: 5px 0; padding-left: 4px; } .story .result { margin: 10px 0 0; font-weight: 600; }\n.views input { margin-right: 8px; accent-color: var(--accent); } .views label { display: inline-block; margin: 0 0 10px; cursor: pointer; }\n.views .panel-full { display: none; } .views input:checked ~ .panel-main { display: none; } .views input:checked ~ .panel-full { display: block; }\nsvg.spine { display: block; width: 100%; height: auto; padding: 8px; background: var(--surface); margin: 0 auto; }\n.spine .edge { fill: none; stroke-width: 1.5; } .spine .edge-user { stroke: var(--muted); } .spine .edge-system { stroke: var(--muted); } .spine .edge-route { stroke: var(--muted); stroke-dasharray: 2 4; } .spine .edge-fail { stroke: var(--bad); stroke-dasharray: 7 4; } .spine .edge-unused { stroke: var(--line); }\n.spine .edge-main { stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: none; }\n.spine .arrow { fill: var(--muted); } .spine .arrow-fail { fill: var(--bad); } .spine .arrow-main { fill: var(--accent); }\n.spine .elabel rect { fill: var(--surface); stroke: var(--line); } .spine .elabel text { fill: var(--ink); font: 13px system-ui, sans-serif; } .spine .elabel-fail text { fill: var(--bad); } .spine .elabel-main rect { stroke: var(--accent); }\n.spine .node rect { fill: var(--surface); stroke: var(--ink); stroke-width: 1.6; } .spine .node-server rect { fill: var(--server); stroke: var(--muted); stroke-dasharray: 5 3; }\n.spine .node-subflow rect { stroke: var(--accent); } .spine .node-subflow rect.inner { fill: none; stroke-width: 1; }\n.spine .on-main rect { stroke-width: 3; } .spine .node-server.on-main rect { stroke: var(--accent); }\n.spine .exit-never rect { stroke: var(--bad); stroke-width: 3; } .spine .exit-error rect { stroke-dasharray: 6 3; } .spine .exit-left rect { stroke-dasharray: 2 3; stroke: var(--muted); } .spine .exit-success rect { stroke: var(--ok); stroke-width: 3; }\n.spine .node.by-human rect { fill: var(--surface); stroke: var(--ink); stroke-dasharray: none; }\n.spine .node.by-ai rect { fill: var(--ai-bg); stroke: var(--ai); stroke-dasharray: none; }\n.spine .node.by-agent rect { fill: var(--agent-bg); stroke: var(--agent); stroke-dasharray: none; } .spine .node.by-agent rect.inner { fill: none; stroke-width: 1; }\n.spine .node.by-ci rect { fill: var(--ci-bg); stroke: var(--ci); stroke-dasharray: none; }\n.spine .node.goal rect { fill: var(--ok-bg); stroke: var(--ok); stroke-width: 3.5; stroke-dasharray: none; }\n.spine .node.on-main rect { stroke-width: 3.5; }\n.spine .nmore { fill: var(--muted); font: 600 11px system-ui, sans-serif; }\n.legend .sw { display: inline-flex; align-items: center; gap: 6px; } .legend svg { flex: none; }\n.legend .sw-node rect { stroke-width: 1.6; }\n.legend .sw-human rect { fill: var(--surface); stroke: var(--ink); } .legend .sw-ai rect { fill: var(--ai-bg); stroke: var(--ai); } .legend .sw-agent rect { fill: var(--agent-bg); stroke: var(--agent); } .legend .sw-agent rect.inner { fill: none; stroke-width: 1; }\n.legend .sw-ci rect { fill: var(--ci-bg); stroke: var(--ci); } .legend .sw-goal rect { fill: var(--ok-bg); stroke: var(--ok); stroke-width: 3; } .legend .sw-server rect { fill: var(--server); stroke: var(--muted); stroke-dasharray: 4 2; }\n.legend .sw-screen rect { fill: var(--surface); stroke: var(--ink); } .legend .sw-subflow rect { fill: var(--surface); stroke: var(--accent); }\n.legend .sw-node.sw-fail rect { fill: var(--surface); stroke: var(--bad); stroke-width: 3; }\n.legend .sw-line path { fill: none; stroke-width: 3; } .legend .sw-main path { stroke: var(--accent); stroke-width: 3.5; } .legend .sw-fail path { stroke: var(--bad); stroke-dasharray: 6 3; } .legend .sw-route path { stroke: var(--muted); stroke-dasharray: 2 3; }\n.covers { display: grid; gap: 10px; } .covers .cv { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 14px; } .covers ul { margin: 4px 0 0; padding-left: 20px; }\n.spine .node-unreachable rect { stroke: var(--bad); fill: none; }\n.spine .nname { fill: var(--ink); font: 600 14.5px system-ui, sans-serif; } .spine .nline { fill: var(--muted); font: 11.5px ui-monospace, Menlo, Consolas, monospace; } .spine .start { fill: var(--ink); }\n.spine a:focus-visible .node rect, .spine a:hover .node rect { stroke: var(--focus); stroke-width: 3; }\n.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 0; font-size: 14px; color: var(--muted); }\n.screens { display: grid; gap: 18px; }\n.screen { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 14px 16px 16px; scroll-margin-top: 16px; }\n.screen:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }\n.screen header { display: flex; align-items: center; gap: 10px; } .screen > p { margin: 4px 0 10px; }\n.wf { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 10px; background: var(--bg); max-width: 560px; }\n.wf-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 2px; border-radius: 4px; }\n.wf-cond { outline: 1.5px dashed var(--muted); outline-offset: 2px; } .wf-focus { outline: 2.5px solid var(--focus); outline-offset: 2px; }\n.wf-h { margin: 0; font-size: 17px; } .wf-t { margin: 0; color: var(--muted); }\n.wf-row { display: flex; flex-wrap: wrap; gap: 10px; }\n.wf-btn, .wf-link { font: inherit; border-radius: 6px; padding: 6px 14px; border: 1px solid var(--ink); background: var(--surface); color: var(--ink); }\n.wf-confirm { background: var(--ink); color: var(--bg); } .wf-link { border: 0; background: none; color: var(--accent); text-decoration: underline; padding: 0; }\n.wf button:disabled { opacity: .45; }\n.wf-list { margin: 0; padding-left: 20px; display: grid; gap: 2px; }\n.wf-status { color: var(--muted); font-style: italic; } .wf-alert { border: 1.5px solid var(--bad); border-radius: 6px; padding: 6px 10px; }\n.wf-check { display: flex; gap: 8px; align-items: center; } .wf-field { display: grid; gap: 4px; } .wf-input { font: inherit; border: 1px solid var(--muted); border-radius: 6px; padding: 6px 10px; background: var(--surface); color: var(--ink); }\n.wf-unmapped { border: 1.5px solid var(--bad); padding: 6px 10px; }\n.chip { font: 11px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }\ndetails { margin-top: 12px; } summary { cursor: pointer; color: var(--muted); }\ndetails.ax-wrap { margin-top: 10px; } pre.ax { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); line-height: 1.55; }\ndl.guards { margin: 10px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; } dl.guards dt { font-weight: 600; } dl.guards dd { margin: 0; }\nul.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } ul.checks li { padding-left: 26px; position: relative; } ul.checks li::before { content: \"\u2713\"; position: absolute; left: 4px; color: var(--ok); font-weight: 700; } ul.checks li.fail::before { content: \"\u2717\"; color: var(--bad); }\nfooter { margin-top: 56px; color: var(--muted); font-size: 13px; }\n";
|
|
8
8
|
export interface PageInput {
|
|
9
9
|
g: Graph;
|
package/js/html.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The page of a flow: its styles, shared with the index and the navigation pages, and the page itself
|
|
2
|
+
// (crates/delurio-page). renderPage and callLine answer with an error until the port of html.ts is in this build.
|
|
3
|
+
import { call, native } from './internal.js';
|
|
4
|
+
|
|
5
|
+
export const CSS = native.pageCss();
|
|
6
|
+
|
|
7
|
+
export function callLine(_a) {
|
|
8
|
+
return call(null, () => native.pageNotPorted('callLine'));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function renderPage(_p) {
|
|
12
|
+
return call(null, () => native.pageNotPorted('renderPage'));
|
|
13
|
+
}
|