waygraph 0.15.14 → 0.15.15
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/README.md
CHANGED
|
@@ -296,6 +296,13 @@ nothing is blocked, nothing fails to build. `waygraph check [project]` is the
|
|
|
296
296
|
complementary whole-project sweep for contexts with no editor watching (CI, generated
|
|
297
297
|
code, an autonomous agent authoring Blocks) - it warns, never fails the process.
|
|
298
298
|
|
|
299
|
+
**`waygraph typecheck [project]`** runs `tsc --noEmit` then the same **bad-practice** scan
|
|
300
|
+
(wildcard `Checkpoint<string>`, assert blocks missing type args, multi-`.fill()` Methods,
|
|
301
|
+
fill+click in one Method). Practices warn only unless `tsc` fails; use `--no-practices` to
|
|
302
|
+
skip the scan. Opt out per file: `// waygraph-ignore-practices` or
|
|
303
|
+
`// waygraph-ignore: multi-input, combined-action`. Print full agent guidance:
|
|
304
|
+
`waygraph --skill-convention`.
|
|
305
|
+
|
|
299
306
|
### Demo narration
|
|
300
307
|
|
|
301
308
|
Automation rings are gray; authored stubs/slides can use
|
|
@@ -662,27 +669,52 @@ space is constrained to this project's own pre-verified Blocks (each with a real
|
|
|
662
669
|
already checked) instead of freeform DOM/pixel guessing - narrower, but far more accurate and
|
|
663
670
|
deterministic.
|
|
664
671
|
|
|
672
|
+
### auto vs browser vs pilot
|
|
673
|
+
|
|
674
|
+
| Layer | Command | What it is |
|
|
675
|
+
|-------|---------|------------|
|
|
676
|
+
| **auto** | `waygraph auto` | Interactive explore (picker / `--cli` menu). **Not** a persistent agent browser. |
|
|
677
|
+
| **browser** | `waygraph browser start` | New persistent Playwright session — **headful by default**, **about:blank by default**. |
|
|
678
|
+
| **pilot** | `waygraph pilot start` | Bootstrap only: `browser start` + whole-project `graph` + starting `snapshot` in one JSON payload. Does not plan or act. |
|
|
679
|
+
|
|
680
|
+
Session control (`send`, `status`, `highlight`, `dom`, …) works on **`auto`**, **`browser`**, and
|
|
681
|
+
**`pilot`** — same socket, same session id. Prefer the `browser`/`pilot` prefix when driving a
|
|
682
|
+
detached session; `auto` remains for the interactive picker and legacy `--cli --detach`.
|
|
683
|
+
|
|
684
|
+
**Session lifecycle is explicit** — list what's live before opening another:
|
|
685
|
+
|
|
665
686
|
```bash
|
|
666
|
-
waygraph
|
|
687
|
+
waygraph browser # show browser subcommands
|
|
688
|
+
waygraph browser sessions [--json] # list live sessions; --json for agents
|
|
689
|
+
waygraph browser start # always opens a new session
|
|
690
|
+
waygraph browser stop <sessionId> # shut one down
|
|
691
|
+
waygraph browser stop --all # shut every session for this project
|
|
692
|
+
waygraph browser attach <sessionId> # terminal picker on an existing session
|
|
693
|
+
waygraph pilot attach <sessionId> # graph + snapshot, no new browser
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
```bash
|
|
697
|
+
waygraph pilot start
|
|
667
698
|
# {"sessionId":"bb65d74c","socketPath":"...","headless":false,"graph":{...},"snapshot":{...}}
|
|
668
699
|
```
|
|
669
700
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
session
|
|
675
|
-
before Pilot did:
|
|
701
|
+
`pilot start` is one round trip for agents that need the whole graph immediately. For browser-only
|
|
702
|
+
work (no graph payload), use `browser start`. `auto --cli --detach` still works but is the older
|
|
703
|
+
explore entry point — prefer `browser start` for agent-driven sessions.
|
|
704
|
+
|
|
705
|
+
From a live session, drive one pick at a time:
|
|
676
706
|
|
|
677
707
|
```bash
|
|
678
|
-
waygraph
|
|
679
|
-
waygraph
|
|
680
|
-
waygraph
|
|
681
|
-
waygraph
|
|
682
|
-
waygraph
|
|
683
|
-
waygraph
|
|
708
|
+
waygraph browser status <sessionId> # read the current menu (no side effects)
|
|
709
|
+
waygraph browser send <sessionId> "<pick>" # run one pick, get the resulting menu back
|
|
710
|
+
waygraph browser dom <sessionId> # inspect the live DOM/ARIA tree
|
|
711
|
+
waygraph browser trace <sessionId> # read the Checkpoint/Block history so far
|
|
712
|
+
waygraph browser reach <sessionId> <Checkpoint> # run a whole multi-step route in one call
|
|
713
|
+
waygraph browser resync <sessionId> # force here to re-detect from the real page
|
|
684
714
|
```
|
|
685
715
|
|
|
716
|
+
(`auto …` and `pilot …` accept the same subcommands with the same `<sessionId>`.)
|
|
717
|
+
|
|
686
718
|
Worked example (run for real against `examples/saucedemo`, no new execution code involved): an
|
|
687
719
|
agent gets a plain request - "log me in and buy the backpack" - reads the graph and the starting
|
|
688
720
|
`status`, reasons out login -> add-to-cart -> cart -> checkout info -> submit -> finish as the
|
|
@@ -1023,17 +1055,24 @@ Flows are files (0.10.5+):
|
|
|
1023
1055
|
| Ad-hoc Blocks | `waygraph run --blocks "login then nav-cart" --data '{...}'` |
|
|
1024
1056
|
| Headed execute | `waygraph run --blocks shopFlow --non-headless --video` |
|
|
1025
1057
|
| Explore | `waygraph auto` / `waygraph auto --cli` |
|
|
1058
|
+
| Browser command reference | `waygraph browser` |
|
|
1059
|
+
| List live browser sessions | `waygraph browser sessions [--json]` |
|
|
1060
|
+
| Open a new persistent browser | `waygraph browser start` (headful, about:blank by default) |
|
|
1061
|
+
| Stop a browser session | `waygraph browser stop <sessionId>` / `stop --all` |
|
|
1062
|
+
| Pilot bootstrap (browser + graph + snapshot) | `waygraph pilot start` |
|
|
1063
|
+
| Attach to existing session (graph only) | `waygraph pilot attach <sessionId>` |
|
|
1026
1064
|
| Path-find | `waygraph auto --blocks LoginPage OrderComplete` |
|
|
1027
|
-
| Run `--cli` as a background session | `waygraph auto --cli --detach` -> `{sessionId, socketPath}` |
|
|
1028
|
-
| Drive a detached session (no TTY) | `waygraph
|
|
1029
|
-
| Read a detached session's state | `waygraph
|
|
1030
|
-
| Reattach a terminal to a detached session | `waygraph
|
|
1065
|
+
| Run `--cli` as a background session (legacy) | `waygraph auto --cli --detach` -> `{sessionId, socketPath}` |
|
|
1066
|
+
| Drive a detached session (no TTY) | `waygraph browser send <sessionId> "<pick>"` -> JSON state |
|
|
1067
|
+
| Read a detached session's state | `waygraph browser status <sessionId>` (no side effects) |
|
|
1068
|
+
| Reattach a terminal to a detached session | `waygraph browser attach <sessionId>` |
|
|
1031
1069
|
| Read the live page (aria, small/default) | `waygraph auto dom <sessionId>` |
|
|
1032
1070
|
| Read the live page (raw DOM, bounded) | `waygraph auto dom <sessionId> --mode full` |
|
|
1033
1071
|
| Scope either to one element | `waygraph auto dom <sessionId> --selector ".inventory_list"` |
|
|
1034
1072
|
| Detached session with a real visible browser | `waygraph auto --cli --detach --non-headless` |
|
|
1035
1073
|
| Read the session's Checkpoint/Block history | `waygraph auto trace <sessionId>` |
|
|
1036
1074
|
| Whole-project nav-escape + inline-selector + orphan sweep | `waygraph check [project]` |
|
|
1075
|
+
| `tsc --noEmit` + bad-practice warnings | `waygraph typecheck [project]` (`--no-practices` to skip scan) |
|
|
1037
1076
|
| Waygraph Map enforcement (verbatim url-vs-folder, exits 1 on a violation) | `waygraph map [project]` |
|
|
1038
1077
|
| Graph crawl | `waygraph traverse [project] --parallel N --min-edge-coverage 80%` |
|
|
1039
1078
|
| Coding-agent defs | `waygraph agent-dive --loop claude` |
|
|
@@ -1167,7 +1206,7 @@ it out from under you.
|
|
|
1167
1206
|
git clone git@github.com:deviate-dv8/waygraph.git
|
|
1168
1207
|
cd waygraph
|
|
1169
1208
|
npm install
|
|
1170
|
-
npm run typecheck # tsc --noEmit
|
|
1209
|
+
npm run typecheck # waygraph typecheck . (tsc --noEmit + practice warnings)
|
|
1171
1210
|
npm run test # playwright test
|
|
1172
1211
|
npm run build # tsc -p tsconfig.build.json, emits dist/
|
|
1173
1212
|
```
|
package/dist/cli.js
CHANGED
|
@@ -7186,6 +7186,24 @@ async function expandSpecFlowFiles(projectDir, spec) {
|
|
|
7186
7186
|
}
|
|
7187
7187
|
const args = process.argv.slice(2);
|
|
7188
7188
|
const command = args[0];
|
|
7189
|
+
function printBrowserUsage() {
|
|
7190
|
+
console.log(`waygraph browser — persistent Playwright sessions (headful by default)
|
|
7191
|
+
|
|
7192
|
+
waygraph browser start [--inject preset|path] [--goto <url>] [--blank] [--headless] [--cli] [project]
|
|
7193
|
+
Open a new session (about:blank by default)
|
|
7194
|
+
waygraph browser sessions [--json] [project]
|
|
7195
|
+
List live sessions for a project
|
|
7196
|
+
waygraph browser stop <sessionId|--all> [project]
|
|
7197
|
+
waygraph browser attach <sessionId> Terminal picker on a live session
|
|
7198
|
+
|
|
7199
|
+
waygraph browser status <sessionId> Current menu (no side effects)
|
|
7200
|
+
waygraph browser send <sessionId> "<pick>"
|
|
7201
|
+
waygraph browser reach <sessionId> <Checkpoint>
|
|
7202
|
+
waygraph browser dom|trace|console|storage|highlight <sessionId> …
|
|
7203
|
+
waygraph browser click|type|press|goto|upload|reload|resync <sessionId> …
|
|
7204
|
+
|
|
7205
|
+
auto send|status|… and pilot send|status|… use the same session ids.`);
|
|
7206
|
+
}
|
|
7189
7207
|
function printBrowserSessionsList(sessions, projectDir) {
|
|
7190
7208
|
if (sessions.length === 0) {
|
|
7191
7209
|
console.log(`No live browser sessions for ${projectDir}.`);
|
|
@@ -7278,7 +7296,7 @@ Primary (less is more):
|
|
|
7278
7296
|
label,tone?,size?,weight?}], todos[], todoIndex?,
|
|
7279
7297
|
todoTitle?, holdMs? (0=until next), clear:true.
|
|
7280
7298
|
Missing selectors listed in response, not fatal.
|
|
7281
|
-
waygraph browser
|
|
7299
|
+
waygraph browser Show browser subcommands
|
|
7282
7300
|
waygraph browser start Open a new session (headful by default, about:blank)
|
|
7283
7301
|
--inject preset|path Merge an external Block library (e.g. saucedemo)
|
|
7284
7302
|
--goto <url> Navigate on start (disables blank page)
|
|
@@ -7784,8 +7802,7 @@ Agents shipped: waygraph-planner, waygraph-author, waygraph-healer.
|
|
|
7784
7802
|
break;
|
|
7785
7803
|
}
|
|
7786
7804
|
if (!sub) {
|
|
7787
|
-
|
|
7788
|
-
printBrowserSessionsList(listBrowserSessions(proj), proj);
|
|
7805
|
+
printBrowserUsage();
|
|
7789
7806
|
break;
|
|
7790
7807
|
}
|
|
7791
7808
|
if (sub === "start" || sub.startsWith("-")) {
|
|
@@ -7839,12 +7856,8 @@ Agents shipped: waygraph-planner, waygraph-author, waygraph-healer.
|
|
|
7839
7856
|
sub !== "reach" &&
|
|
7840
7857
|
sub !== "resync" &&
|
|
7841
7858
|
sub !== "highlight") {
|
|
7842
|
-
console.error("waygraph browser: usage
|
|
7843
|
-
|
|
7844
|
-
" waygraph browser start [--inject preset|path] [--goto <url>] [--blank] [--headless] [--cli] [project]\n" +
|
|
7845
|
-
" waygraph browser sessions [--json] [project]\n" +
|
|
7846
|
-
" waygraph browser stop <sessionId|--all> [project]\n" +
|
|
7847
|
-
" waygraph browser send|status|attach|highlight|dom|… <sessionId> … (same as auto)");
|
|
7859
|
+
console.error("waygraph browser: unknown subcommand — run `waygraph browser` for usage");
|
|
7860
|
+
printBrowserUsage();
|
|
7848
7861
|
process.exit(1);
|
|
7849
7862
|
}
|
|
7850
7863
|
}
|
package/package.json
CHANGED
|
@@ -4,16 +4,29 @@ description: Cold-start a waygraph project against a real site with zero existin
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Blind Pilot is the same session mechanism as `waygraph-pilot`, minus the requirement of any
|
|
7
|
-
pre-existing Blocks.
|
|
8
|
-
`
|
|
7
|
+
pre-existing Blocks. A project with zero `.block.ts` files still gets a live session —
|
|
8
|
+
`browser click/type/goto/press/upload` act on the real page before any Block exists to cover it.
|
|
9
9
|
This package generates **no Block content for you** - you write real `.block.ts`/`*Sel`/
|
|
10
10
|
mem-key files by hand as you go. That's the whole point: turn one-off exploration into
|
|
11
11
|
permanent, reusable, typed coverage instead of leaving nothing behind.
|
|
12
12
|
|
|
13
|
+
## Session lifecycle (list first)
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
waygraph browser # show browser subcommands
|
|
17
|
+
waygraph browser sessions # list live sessions (cwd)
|
|
18
|
+
waygraph browser start [--goto <url>] # new headful session (about:blank by default)
|
|
19
|
+
waygraph browser attach <sessionId> # terminal picker on existing session
|
|
20
|
+
waygraph browser stop <sessionId|--all> # shut down when done
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`browser start` always opens a **new** session. Check `browser sessions` before starting another.
|
|
24
|
+
Session control works as `browser …` or `auto …` with the same `<sessionId>`.
|
|
25
|
+
|
|
13
26
|
## The real loop
|
|
14
27
|
|
|
15
|
-
1. `
|
|
16
|
-
2. `
|
|
28
|
+
1. `browser goto <sessionId> <url>` / `browser click` / `browser type` to explore the real page.
|
|
29
|
+
2. `browser dom <sessionId> --mode full --selector <sel>` to read real structure before writing
|
|
17
30
|
a selector - never guess a selector, confirm it against the real DOM first. `--mode aria`
|
|
18
31
|
is faster for a first pass but can show stale/hidden responsive-duplicate content in some
|
|
19
32
|
real apps (confirmed live: a hidden `lg:hidden` panel's heading text showed up in an aria
|
|
@@ -24,19 +37,20 @@ permanent, reusable, typed coverage instead of leaving nothing behind.
|
|
|
24
37
|
then `Nav`/`Page`/`Method` Blocks, following `templates/scaffold`'s own folder convention
|
|
25
38
|
(`(group)/<page-slug>/page.block.ts` + `nav.block.ts` + `methods/*.block.ts` + one `*.sel.ts`)
|
|
26
39
|
so the result becomes part of the Waygraph Map, not a scattered one-off file.
|
|
27
|
-
4. `
|
|
28
|
-
5. Optionally narrate for a headful watcher: `
|
|
29
|
-
|
|
40
|
+
4. `browser reload <sessionId>` to pick up the newly-written Block(s) without restarting.
|
|
41
|
+
5. Optionally narrate for a headful watcher: `browser highlight <sessionId> '{"rings":[...],"todos":[...]}'`
|
|
42
|
+
Raw ops show **`Running (no Block): …`** in the bottom-left toast; Block runs show **`Running (Block): …`**.
|
|
43
|
+
6. Run the new Block for real via `browser send` - prove it works before moving to the next
|
|
30
44
|
pattern, exactly like any other real Block.
|
|
31
|
-
|
|
45
|
+
7. Ask the user a clarifying question only when something genuinely can't be resolved from
|
|
32
46
|
the DOM alone (is this instance local or published? does a downstream integration exist?)
|
|
33
|
-
- don't ask about things `
|
|
47
|
+
- don't ask about things `browser dom` can just answer.
|
|
34
48
|
|
|
35
49
|
## Real gotchas specific to cold-start authoring
|
|
36
50
|
|
|
37
51
|
- **`discoverGraph`'s per-file import errors are mostly silent.** A malformed newly-written
|
|
38
52
|
Block file can simply vanish from the graph with no error printed anywhere obvious - if a
|
|
39
|
-
Block you just wrote doesn't show up after `
|
|
53
|
+
Block you just wrote doesn't show up after `browser reload`, check `waygraph graph`'s own
|
|
40
54
|
`skipped` list and the file's syntax directly, don't assume it just needs more time.
|
|
41
55
|
- **`defineAssertBlock` needs no `<In, Out>` generic to type-check** (`checkpoint: "X"` alone
|
|
42
56
|
is enough for TypeScript to infer it) - but older/naive static-graph discovery logic may
|
|
@@ -47,9 +61,9 @@ permanent, reusable, typed coverage instead of leaving nothing behind.
|
|
|
47
61
|
- **A `<p>`/text-based selector often needs scoping**, not just a class name - a sibling
|
|
48
62
|
"chat list item" and "message preview" frequently share the exact same CSS classes in real
|
|
49
63
|
apps, distinguished only by DOM position (first vs second child of a specific wrapper).
|
|
50
|
-
Confirm via `
|
|
64
|
+
Confirm via `browser dom --mode full` before assuming a class alone is unique enough.
|
|
51
65
|
- **Confirm a selector count, not just its first match**, when building anything the menu
|
|
52
|
-
will expand into multiple live rows (an `instanceOptions`-driven Block) - `
|
|
66
|
+
will expand into multiple live rows (an `instanceOptions`-driven Block) - `browser dom`'s
|
|
53
67
|
default read can silently show only one match even when several exist; check the real
|
|
54
68
|
page count (e.g. via a scoped debug script) before assuming a plain `.first()` is safe
|
|
55
69
|
long-term. A `.first()`-shaped Block is a legitimate STARTING point for a page that only
|
|
@@ -57,6 +71,7 @@ permanent, reusable, typed coverage instead of leaving nothing behind.
|
|
|
57
71
|
`defineEffectBlock` (see the `waygraph-pilot` skill and
|
|
58
72
|
`examples/saucedemo/.../nav-item-detail.block.ts` for the real pattern) once a second real
|
|
59
73
|
row genuinely exists to pick between, not before.
|
|
60
|
-
- **Prefer the real Pilot overlay over ad hoc status output** when driving a
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
- **Prefer the real Pilot overlay over ad hoc status output** when driving a headful session
|
|
75
|
+
someone might be watching - badge/panel on `about:blank` and after every navigation; raw
|
|
76
|
+
ops toast **`Running (no Block): …`**. Point a human at the badge instead of re-inventing
|
|
77
|
+
status reporting.
|
|
@@ -14,7 +14,7 @@ reading each `auto status`/`auto send` response.
|
|
|
14
14
|
| Layer | Command | What it is |
|
|
15
15
|
|-------|---------|------------|
|
|
16
16
|
| **auto** | `waygraph auto` | Interactive explore (picker / `--cli` menu). **Not** a persistent agent browser. |
|
|
17
|
-
| **browser** | `waygraph browser start` | New persistent Playwright session — **headful by default**, **about:blank by default**. `waygraph browser` lists live
|
|
17
|
+
| **browser** | `waygraph browser start` | New persistent Playwright session — **headful by default**, **about:blank by default**. `waygraph browser` prints subcommands; `browser sessions` lists live ones. |
|
|
18
18
|
| **pilot** | `waygraph pilot start` | Bootstrap only: `browser start` + whole-project `graph` + starting `snapshot` in one JSON payload. Does not plan or act. |
|
|
19
19
|
|
|
20
20
|
Session control (`send`, `status`, `highlight`, `dom`, …) works on **`auto`**, **`browser`**, and **`pilot`** — same socket, same session id:
|