waygraph 0.15.10 → 0.15.14

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.
Files changed (53) hide show
  1. package/README.md +10 -8
  2. package/dist/auto-explore.d.ts +7 -6
  3. package/dist/auto-explore.js +43 -32
  4. package/dist/auto-session-ipc.d.ts +13 -0
  5. package/dist/auto-session-ipc.js +119 -7
  6. package/dist/auto-session.d.ts +16 -13
  7. package/dist/auto-session.js +72 -53
  8. package/dist/block-inject.d.ts +15 -0
  9. package/dist/block-inject.js +91 -0
  10. package/dist/browser.d.ts +15 -0
  11. package/dist/browser.js +29 -0
  12. package/dist/cli.d.ts +1 -0
  13. package/dist/cli.js +323 -47
  14. package/dist/coverage-gap.d.ts +11 -0
  15. package/dist/coverage-gap.js +119 -0
  16. package/dist/graph.d.ts +1 -0
  17. package/dist/graph.js +99 -91
  18. package/dist/pilot-overlay.d.ts +7 -1
  19. package/dist/pilot-overlay.js +59 -41
  20. package/dist/pilot.d.ts +7 -2
  21. package/dist/pilot.js +34 -7
  22. package/dist/practices-check.d.ts +14 -0
  23. package/dist/practices-check.js +115 -0
  24. package/examples/saucedemo/.waygraph-auto/0b937f26.log +4 -0
  25. package/examples/saucedemo/.waygraph-auto/2b608ed3.log +0 -0
  26. package/examples/saucedemo/.waygraph-auto/2c13567b.log +0 -0
  27. package/examples/saucedemo/.waygraph-auto/2d9622a5.log +4 -0
  28. package/examples/saucedemo/.waygraph-auto/305f6e5b.log +4 -0
  29. package/examples/saucedemo/.waygraph-auto/418befbf.log +4 -0
  30. package/examples/saucedemo/.waygraph-auto/483bd763.log +4 -0
  31. package/examples/saucedemo/.waygraph-auto/48e3596a.log +0 -0
  32. package/examples/saucedemo/.waygraph-auto/4adfbe91.json +8 -0
  33. package/examples/saucedemo/.waygraph-auto/4adfbe91.log +0 -0
  34. package/examples/saucedemo/.waygraph-auto/4f0e33e7.log +4 -0
  35. package/examples/saucedemo/.waygraph-auto/5bd8fedf.log +4 -0
  36. package/examples/saucedemo/.waygraph-auto/5dde8331.log +4 -0
  37. package/examples/saucedemo/.waygraph-auto/68903903.log +0 -0
  38. package/examples/saucedemo/.waygraph-auto/78bbf43c.log +0 -0
  39. package/examples/saucedemo/.waygraph-auto/7efa646f.log +4 -0
  40. package/examples/saucedemo/.waygraph-auto/9cecb0c8.log +4 -0
  41. package/examples/saucedemo/.waygraph-auto/aae57d51.log +0 -0
  42. package/examples/saucedemo/.waygraph-auto/b61a08d8.log +0 -0
  43. package/examples/saucedemo/.waygraph-auto/c946f66c.log +0 -0
  44. package/examples/saucedemo/.waygraph-auto/cd0d5b50.log +4 -0
  45. package/examples/saucedemo/.waygraph-auto/cd5b203c.log +0 -0
  46. package/examples/saucedemo/.waygraph-auto/ea2df316.log +4 -0
  47. package/examples/saucedemo/.waygraph-auto/ee60ed24.log +0 -0
  48. package/examples/saucedemo/.waygraph-auto/f2b6cb1b.log +0 -0
  49. package/examples/saucedemo/.waygraph-auto/f392cdc8.log +0 -0
  50. package/package.json +2 -2
  51. package/templates/scaffold/package.json +1 -1
  52. package/templates/skills/waygraph-convention.skill.md +11 -1
  53. package/templates/skills/waygraph-pilot.skill.md +104 -10
@@ -0,0 +1,4 @@
1
+ (node:1438409) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1438409) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
@@ -0,0 +1,4 @@
1
+ (node:1424575) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1424575) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ (node:1424626) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1424626) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
@@ -0,0 +1,4 @@
1
+ (node:1434346) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1434346) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
File without changes
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ (node:1434366) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1434366) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
File without changes
@@ -0,0 +1,4 @@
1
+ (node:1429810) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
2
+ (Use `node --trace-warnings ...` to show where the warning was created)
3
+ (node:1429810) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
4
+ (Use `node --trace-warnings ...` to show where the warning was created)
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waygraph",
3
- "version": "0.15.10",
3
+ "version": "0.15.14",
4
4
  "type": "module",
5
5
  "description": "A typed graph of reusable Blocks for driving a browser through E2E flows.",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsc -p tsconfig.build.json",
38
- "typecheck": "tsc --noEmit",
38
+ "typecheck": "node bin/waygraph typecheck .",
39
39
  "test": "playwright test",
40
40
  "docs:preview": "python3 -m http.server 4173 --directory docs",
41
41
  "example:saucedemo:install": "npm --prefix examples/saucedemo install",
@@ -4,7 +4,7 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "typecheck": "tsc --noEmit",
7
+ "typecheck": "waygraph typecheck .",
8
8
  "test": "playwright test",
9
9
  "fixture": "node scripts/fixture-server.mjs",
10
10
  "list": "waygraph list",
@@ -24,6 +24,14 @@ against a live site, use `--skill-pilot-blind`.
24
24
  an explicit type argument when it sits between two specifically-typed Blocks in a Flow.
25
25
  5. **`requires` = externally supplied.** A key an earlier Block in the same chain produces
26
26
  is never listed under `requires` - preflight checks the whole chain up front.
27
+ 6. **Keep Checkpoints typed — never `Checkpoint<string>`.** Block helpers take concrete
28
+ Checkpoint types from `src/states/` (e.g. `defineMethodBlock<LoginPage, LoginPage>`).
29
+ Wildcard `Checkpoint<string>` compiles but kills graph honesty; `waygraph check` / `waygraph typecheck` warn.
30
+ Same for `defineAssertBlock({…})` without an explicit type arg — use
31
+ `defineAssertBlock<YourCheckpoint>({…})`.
32
+ 7. **One input/action per Method Block.** No block that `.fill()`s two fields or `.fill()` + `.click()` in one
33
+ `act()` — split like saucedemo login (`fill-username`, `fill-password`, `submit-login`). Opt out per file:
34
+ `// waygraph-ignore: multi-input` or `// waygraph-ignore-practices`.
27
35
 
28
36
  ## Block kinds (file convention)
29
37
 
@@ -84,7 +92,9 @@ the site's `*-web/` tree. Browser-driven (DOM / iframe Traits), not the catcher'
84
92
  ## Verify before you call it done
85
93
 
86
94
  ```bash
87
- npx waygraph check . # orphans + nav-escape + inline-selector warnings
95
+ npx waygraph check . # orphans + nav-escape + inline-selector + bad-practice warnings
96
+ npx waygraph typecheck . # tsc --noEmit + bad-practice warnings (npm run typecheck)
97
+ npx waygraph check --no-practices . # skip bad-practice scan only
88
98
  npx waygraph map . # exit 1 if src/map/ folder path != real static url
89
99
  npx waygraph validate . # every .flow.ts loads
90
100
  npx waygraph graph . # nodes/edges/skipped/orphans - counts should make sense
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: waygraph-pilot
3
- description: Drive an existing waygraph Block graph as a real agent - use when a task needs to operate a web app that already has waygraph Blocks written for it (login, checkout, matching, chat, admin flows, etc.), not when writing new Blocks from scratch.
3
+ description: Drive an existing waygraph Block graph as a real agent - use when a task needs to operate a web app that already has waygraph Blocks written for it (login, checkout, matching, chat, admin flows, etc.), not when writing new Blocks from scratch. Includes how to paint demo-parity fixture highlights in Pilot via `auto highlight` (pilot:watch / --non-headless).
4
4
  ---
5
5
 
6
6
  Waygraph Pilot is not a planner you call and get an answer from - `pilot start` only
@@ -9,10 +9,37 @@ the reasoning agent. Every multi-step decision (which Block to run next, when a
9
9
  `reach` vs `send`, when to fall back to raw primitives) is yours to make, turn by turn, by
10
10
  reading each `auto status`/`auto send` response.
11
11
 
12
+ ## auto vs browser vs pilot (do not conflate them)
13
+
14
+ | Layer | Command | What it is |
15
+ |-------|---------|------------|
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 sessions only. |
18
+ | **pilot** | `waygraph pilot start` | Bootstrap only: `browser start` + whole-project `graph` + starting `snapshot` in one JSON payload. Does not plan or act. |
19
+
20
+ Session control (`send`, `status`, `highlight`, `dom`, …) works on **`auto`**, **`browser`**, and **`pilot`** — same socket, same session id:
21
+
22
+ ```
23
+ waygraph browser send <sessionId> "<pick>" # same as auto send / pilot send
24
+ ```
25
+
26
+ **Session lifecycle — list first, then attach or start:**
27
+
28
+ ```
29
+ waygraph browser sessions [project] # what's live right now
30
+ waygraph browser attach <sessionId> # terminal picker on an existing session
31
+ waygraph browser stop <sessionId|--all> # shut one down when done
32
+ waygraph pilot attach <sessionId> # graph + snapshot for an existing session
33
+ ```
34
+
35
+ `browser start` / `pilot start` always open a **new** session. Check `browser sessions` before starting another.
36
+
12
37
  ## Starting a session
13
38
 
14
39
  ```
15
40
  waygraph pilot start # bootstraps: {sessionId, socketPath, headless, graph, snapshot}
41
+ waygraph browser start [--inject path] [--goto <url>] [--cli] # new browser session; --cli opens terminal picker
42
+ waygraph pilot start [--cli] # --cli opens terminal picker after bootstrap JSON
16
43
  waygraph auto status <sessionId> # re-read the live menu, no side effects
17
44
  waygraph auto send <sessionId> "<pick>" # run exactly one Block (by menu index or name)
18
45
  waygraph auto reach <sessionId> <Checkpoint> # path-find + run a whole route in one call
@@ -23,15 +50,83 @@ waygraph auto highlight <sessionId> '<json>' # paint rings/todos on the live pa
23
50
  just what's reachable from here - use it to plan several steps ahead before you start
24
51
  sending picks.
25
52
 
26
- ## Highlight fixtures (agent-sent narration)
53
+ ## Bad practices (`waygraph check` / `waygraph typecheck`)
54
+
55
+ Run `waygraph typecheck .` (or `npm run typecheck`) — runs `tsc --noEmit` then bad-practice warnings.
56
+ `waygraph check` includes the same practice scan plus nav/orphan/selector hygiene.
57
+ Use `--no-practices` on either command to skip the practice scan.
58
+
59
+ Patterns warned (does not fail `check`; fails `typecheck` only when `tsc` fails):
60
+
61
+ - **`Checkpoint<string>` in Block generics** — e.g. `defineMethodBlock<Checkpoint<string>, …>` instead of a project Checkpoint type from `src/states/`.
62
+ - **`defineAssertBlock({…})` without an explicit type arg** — use `defineAssertBlock<YourCheckpoint>({…})` so `defineFlow` typing stays honest.
63
+ - **Multiple `.fill()` in one Method** — split into one Block per input (fill-username, fill-password, …).
64
+ - **`.fill()` + `.click()` in one Method** — split fill and submit into separate Blocks.
65
+
66
+ Opt out per file: `// waygraph-ignore-practices` or `// waygraph-ignore: multi-input, combined-action`.
67
+
68
+ Fix these before adding more Blocks; wildcard Checkpoints hide real graph edges from the type checker.
69
+
70
+ ## Coverage gaps on the live page (`auto console`)
71
+
72
+ After `auto status` / `auto send`, read `waygraph auto console <sessionId>` — the session warns once per page load about:
73
+
74
+ - **Unmapped hrefs** — same-origin `<a href>` paths with no `defineNavBlock` URL.
75
+ - **Unmapped buttons** — visible `button` / `[role=button]` / submit inputs with no Method or NavClick selector in the Block library.
27
76
 
28
- Block `stubBefore` / `withHighlightFixtures` only paint in `waygraph demo`. In Pilot they
29
- land in `auto trace` as metadata but do **not** draw on the page. When a human is watching
30
- a headful session (or you want to narrate intent before a send), paint yourself with the
31
- same fixture surface:
77
+ Example warnings:
32
78
 
33
79
  ```
80
+ [waygraph] unmapped nav link on this page: /settings - no NavBlock covers this URL; add defineNavBlock
81
+ [waygraph] unmapped button on this page: #save-draft - no Method/NavClick Block selector matches; consider defineMethodBlock or defineNavClickBlock
82
+ ```
83
+
84
+ When you see these, author the missing Block — do not keep clicking raw primitives.
85
+
86
+ ## Session reachability (multi-pane / wrong cwd)
87
+
88
+ Session ids are registered globally under `/tmp/waygraph-auto/` as well as `<project>/.waygraph-auto/`. If `auto status` says unreachable:
89
+
90
+ 1. Run `waygraph pilot sessions` from the project that started the browser — reuse the id, do not spawn again.
91
+ 2. Or `waygraph pilot attach <sessionId>` for graph + snapshot without a new browser.
92
+ 3. Stale metadata (crashed pid) is pruned automatically — start fresh only when the pid is actually gone.
93
+
94
+ ## Highlight fixtures (Pilot supports them — use `auto highlight`)
95
+
96
+ **Yes, Pilot paints rings/todos/zoom/device on the live page.** That is what
97
+ `waygraph auto highlight` is for. It works on headful `pilot start --non-headless`
98
+ (consumer `pilot:watch`) and on headless sessions alike. Same fixture surface as
99
+ `waygraph demo` (rings, todos, focus veil, zoom badge, device viewport) — proven in
100
+ `tests/cli/auto-session.spec.ts` ("auto highlight: paints agent fixture rings…").
101
+
102
+ **Do not claim Pilot "doesn't support fixture highlights."** That is wrong. The only
103
+ thing that differs from demo is *who* triggers the paint:
104
+
105
+ | Mode | Who paints | How |
106
+ |------|------------|-----|
107
+ | `waygraph demo` | Engine, automatically | Block `stubBefore` / `stubAfter` / `withHighlightFixtures` run each step |
108
+ | Pilot / `auto --detach` | **You (the agent)** | `waygraph auto highlight <sessionId> '<json>'` before (or between) sends |
109
+
110
+ Block-authored `stubBefore` / `withHighlightFixtures` still exist on Blocks in Pilot —
111
+ they show up in `auto trace` as metadata — but they do **not** auto-draw. You re-express
112
+ the same intent with `auto highlight` (copy selectors/labels from the Block stubs or from
113
+ `auto dom`). Paint, then `auto send` the real Block. Clear when done.
114
+
115
+ ```
116
+ # Headful watch session (rings visible to a human audience):
117
+ waygraph pilot start --non-headless
118
+ # → note sessionId from the bootstrap JSON
119
+
34
120
  waygraph auto highlight <sessionId> '{"rings":[{"selector":"#user-name","label":"Username","tone":"planned","focus":true},{"selector":"#password","label":"Password","tone":"info","detail":"secret"}],"todos":["Fill username","Fill password","Submit"],"todoIndex":0,"zoom":1.5,"holdMs":0}'
121
+ waygraph auto send <sessionId> fill-username
122
+ waygraph auto highlight <sessionId> '{"rings":[{"selector":"#password","label":"Password","tone":"planned","focus":true}],"todoIndex":1,"holdMs":0}'
123
+ waygraph auto send <sessionId> fill-password
124
+ waygraph auto highlight <sessionId> '{"clear":true}'
125
+ ```
126
+
127
+ More shapes:
128
+
129
+ ```
35
130
  waygraph auto highlight <sessionId> '{"device":"mobile","rings":[{"selector":".inventory_item:last-child","label":"Last item","zoom":1.6,"focus":true}],"holdMs":30000}'
36
131
  waygraph auto highlight <sessionId> '{"clear":true}'
37
132
  ```
@@ -46,7 +141,7 @@ Supported fields (demo parity):
46
141
  - `clear`: true drops rings/todos/focus/zoom badge
47
142
 
48
143
  - `tone`: all demo tones - `planned` | `auto` | `info` | `warning` | `danger` | `success` | `orange` (aliases like `error`/`blue`/`green` work too)
49
- - Bottom-left toast shows `Highlighting: …` (same strip as `Running (Dom): …`)
144
+ - Bottom-left toast shows `Highlighting: …` (same strip as `Running (no Block): …` for raw ops)
50
145
  - Missing selectors are listed in the JSON response (`missing`) - not a hard failure
51
146
  - Does not replace `auto send` - paint, then run the real Block
52
147
 
@@ -73,9 +168,8 @@ only ever be as good as the project's own Block coverage: if two Checkpoints sha
73
168
  and nothing in their `verify` arrays tells them apart, `resync` will confidently report the
74
169
  wrong one. This is a coverage gap in the project's Blocks, not a `resync` bug - if you hit
75
170
  one, fix the ambiguity (add a second, concrete `Trait.visible` condition that's only true in
76
- one of the two states - see `AppHomePageBlock`/`InPoolPageBlock` in a real veciro-waygraph
77
- example of exactly this: the same `/app` route, split by presence of a "Join Pool" vs
78
- "Leave pool" button).
171
+ one of the two states — e.g. the same route with different visible buttons that distinguish
172
+ pool membership vs home).
79
173
 
80
174
  ## Rule 3: mem is intent, Checkpoint is reality - never blur them
81
175