waygraph 0.15.52 → 0.15.54

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 (156) hide show
  1. package/README.md +8 -1
  2. package/dist/analysis/graph.d.ts +3 -0
  3. package/dist/analysis/map-check.d.ts +3 -2
  4. package/dist/auto-session/helpers.d.ts +10 -0
  5. package/dist/blocks-select.d.ts +3 -0
  6. package/dist/blocks-select.js +2 -0
  7. package/dist/cli/flags.js +3 -1
  8. package/dist/cli/usage.js +4 -1
  9. package/dist/cli.js +4 -1
  10. package/dist/commands/agent-dive-scaffold.d.ts +0 -20
  11. package/dist/commands/agent-dive-scaffold.js +3 -3
  12. package/dist/commands/init.js +1 -1
  13. package/dist/commands/upgrade.d.ts +1 -1
  14. package/dist/commands/upgrade.js +7 -1
  15. package/dist/config.d.ts +55 -19
  16. package/dist/config.js +55 -13
  17. package/dist/core/block.d.ts +7 -2
  18. package/dist/core/block.js +7 -3
  19. package/dist/core/blocks/api.d.ts +1 -0
  20. package/dist/core/blocks/method.d.ts +2 -0
  21. package/dist/core/blocks/method.js +1 -0
  22. package/dist/core/blocks/nav.d.ts +1 -0
  23. package/dist/core/blocks/page.d.ts +1 -0
  24. package/dist/core/branch-regression.d.ts +1 -0
  25. package/dist/core/compose.d.ts +1 -0
  26. package/dist/core/engine.d.ts +2 -0
  27. package/dist/core/engine.js +3 -1
  28. package/dist/core/flow.d.ts +11 -0
  29. package/dist/core/flow.js +32 -8
  30. package/dist/core/map-builder.d.ts +34 -1
  31. package/dist/core/map-builder.js +42 -4
  32. package/dist/core/run-graph.d.ts +2 -0
  33. package/dist/core/run-graph.js +1 -0
  34. package/dist/errors.d.ts +1 -0
  35. package/dist/extensions.d.ts +1 -0
  36. package/dist/extensions.js +1 -0
  37. package/dist/highlights/demo-pace.d.ts +4 -1
  38. package/dist/highlights/demo-pace.js +28 -3
  39. package/dist/highlights/device.d.ts +2 -0
  40. package/dist/highlights/device.js +2 -0
  41. package/dist/highlights/types.d.ts +6 -0
  42. package/dist/index.d.ts +2 -2
  43. package/dist/pilot-overlay/action-ring.d.ts +0 -9
  44. package/dist/pilot-overlay/action-ring.js +1 -1
  45. package/dist/pilot-overlay/panel.d.ts +2 -1
  46. package/dist/runner/interaction-patch.js +32 -1
  47. package/dist/runner/main.js +5 -2
  48. package/dist/runner/step-mode.js +10 -4
  49. package/dist/session/auto-explore-run.js +6 -0
  50. package/dist/session/auto-explore.d.ts +2 -1
  51. package/dist/session/auto-session-ipc.d.ts +1 -2
  52. package/dist/session/auto-session-ipc.js +1 -1
  53. package/dist/session/block-inject.d.ts +0 -13
  54. package/dist/session/block-inject.js +3 -3
  55. package/dist/session/overlay-beacon.d.ts +7 -0
  56. package/dist/session/overlay-beacon.js +5 -0
  57. package/dist/session/pilot.d.ts +1 -2
  58. package/dist/session/pilot.js +1 -2
  59. package/dist/traverse/coverage.d.ts +4 -4
  60. package/dist/traverse/coverage.js +4 -1
  61. package/dist/traverse/lease.d.ts +1 -0
  62. package/dist/traverse/lease.js +1 -0
  63. package/dist/traverse/run.d.ts +3 -0
  64. package/dist/types.d.ts +1 -1
  65. package/examples/routed-demo/src/flows/routed-demo-map.flow.ts +1 -1
  66. package/examples/routed-demo/src/flows/routed-demo.flow.ts +2 -2
  67. package/examples/saucedemo/README.md +11 -12
  68. package/examples/saucedemo/config/waygraph.config.ts +17 -0
  69. package/examples/saucedemo/docs/CONVENTION.md +1 -2
  70. package/examples/saucedemo/docs/HELPERS.md +1 -1
  71. package/examples/saucedemo/package-lock.json +10 -3
  72. package/examples/saucedemo/package.json +12 -29
  73. package/examples/saucedemo/src/blocks/saucedemo-web/cart/nav-cart.block.ts +0 -49
  74. package/examples/saucedemo/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +22 -25
  75. package/examples/saucedemo/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +0 -6
  76. package/examples/saucedemo/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +38 -96
  77. package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +1 -26
  78. package/examples/saucedemo/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +1 -45
  79. package/examples/saucedemo/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +14 -77
  80. package/examples/saucedemo/src/flows/api-demo.flow.ts +17 -11
  81. package/examples/saucedemo/src/flows/cart-bulk.flow.ts +19 -14
  82. package/examples/saucedemo/src/flows/cart-continue.flow.ts +10 -8
  83. package/examples/saucedemo/src/flows/cart-mem.flow.ts +7 -7
  84. package/examples/saucedemo/src/flows/catalog-logout.flow.ts +13 -8
  85. package/examples/saucedemo/src/flows/checkout-then-browse-again.flow.ts +26 -48
  86. package/examples/saucedemo/src/flows/checkout.flow.ts +70 -86
  87. package/examples/saucedemo/src/flows/device-showcase.flow.ts +24 -25
  88. package/examples/saucedemo/src/flows/login.flow.ts +11 -18
  89. package/examples/saucedemo/src/flows/mem-stub-demo.flow.ts +9 -20
  90. package/examples/saucedemo/src/flows/shop.flow.ts +15 -20
  91. package/examples/saucedemo/src/flows/smoke.flow.ts +12 -27
  92. package/examples/saucedemo/src/flows/stub-on-error.flow.ts +24 -43
  93. package/examples/saucedemo/src/flows/viewer-blocked.flow.ts +26 -34
  94. package/examples/saucedemo/src/states/checkout.mem-stubs.ts +11 -0
  95. package/examples/saucedemo/src/stubs/device-showcase.ts +193 -0
  96. package/examples/saucedemo/src/stubs/login.ts +37 -0
  97. package/examples/saucedemo/tests/chain-flow-episodes.spec.ts +7 -9
  98. package/examples/saucedemo/tests/submit-login-branch.spec.ts +18 -5
  99. package/package.json +12 -5
  100. package/templates/quickstart/README.md +4 -7
  101. package/templates/quickstart/config/waygraph.config.ts +17 -0
  102. package/templates/quickstart/docs/CONVENTION.md +1 -2
  103. package/templates/quickstart/docs/HELPERS.md +1 -1
  104. package/templates/quickstart/package.json +14 -14
  105. package/templates/quickstart/src/blocks/SITE-MAP.md +14 -3
  106. package/templates/quickstart/src/blocks/saucedemo-web/cart/nav-cart.block.ts +0 -49
  107. package/templates/quickstart/src/blocks/saucedemo-web/checkout-step-two/methods/finish-order.method.block.ts +22 -25
  108. package/templates/quickstart/src/blocks/saucedemo-web/inventory/inventory.page.block.ts +0 -6
  109. package/templates/quickstart/src/blocks/saucedemo-web/inventory/methods/add-to-cart.effect.block.ts +38 -96
  110. package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-password.method.block.ts +1 -26
  111. package/templates/quickstart/src/blocks/saucedemo-web/methods/fill-username.method.block.ts +1 -45
  112. package/templates/quickstart/src/blocks/saucedemo-web/methods/submit-login.method.block.ts +14 -77
  113. package/templates/quickstart/src/flows/api-demo.flow.ts +43 -0
  114. package/templates/quickstart/src/flows/cart-bulk.flow.ts +19 -14
  115. package/templates/quickstart/src/flows/cart-continue.flow.ts +10 -8
  116. package/templates/quickstart/src/flows/cart-mem.flow.ts +7 -7
  117. package/templates/quickstart/src/flows/catalog-logout.flow.ts +13 -8
  118. package/templates/quickstart/src/flows/checkout-then-browse-again.flow.ts +26 -48
  119. package/templates/quickstart/src/flows/checkout.flow.ts +70 -63
  120. package/templates/quickstart/src/flows/device-showcase.flow.ts +24 -25
  121. package/templates/quickstart/src/flows/login.flow.ts +11 -18
  122. package/templates/quickstart/src/flows/mem-stub-demo.flow.ts +12 -0
  123. package/templates/quickstart/src/flows/shop.flow.ts +15 -20
  124. package/templates/quickstart/src/flows/smoke.flow.ts +12 -27
  125. package/templates/quickstart/src/flows/stub-on-error.flow.ts +31 -0
  126. package/templates/quickstart/src/flows/viewer-blocked.flow.ts +26 -34
  127. package/templates/quickstart/src/states/checkout.mem-stubs.ts +11 -0
  128. package/templates/quickstart/src/stubs/device-showcase.ts +193 -0
  129. package/templates/quickstart/src/stubs/login.ts +37 -0
  130. package/templates/quickstart/tests/chain-flow.spec.ts +7 -10
  131. package/templates/scaffold/README.md +1 -1
  132. package/templates/scaffold/STRUCTURE.md +5 -2
  133. package/templates/scaffold/config/waygraph.config.ts +24 -5
  134. package/templates/scaffold/package.json +6 -6
  135. package/templates/scaffold/src/flows/(external)/hoppscotch/auth.flow.ts +36 -0
  136. package/templates/scaffold/src/flows/(external)/hoppscotch/get.flow.ts +24 -0
  137. package/templates/scaffold/src/flows/(external)/hoppscotch/post.flow.ts +34 -0
  138. package/templates/scaffold/src/flows/(user-stories)/email-verification.flow.ts +47 -0
  139. package/templates/scaffold/src/flows/README.md +35 -14
  140. package/templates/scaffold/src/flows/{shop.flow.ts → home/cart.flow.ts} +18 -17
  141. package/templates/scaffold/src/flows/{example.flow.ts → home/hello.flow.ts} +12 -13
  142. package/templates/scaffold/tests/example.spec.ts +5 -5
  143. package/templates/scaffold/tests/hoppscotch.spec.ts +3 -3
  144. package/templates/scaffold/tests/mail-verify.spec.ts +7 -7
  145. package/templates/skills/waygraph-convention.skill.md +14 -6
  146. package/examples/saucedemo/playwright.config.ts +0 -19
  147. package/examples/saucedemo/scripts/drive-auto-cli.mjs +0 -93
  148. package/examples/saucedemo/scripts/prove-add-to-cart-menu.mjs +0 -126
  149. package/examples/saucedemo/scripts/prove-auto-graph.mjs +0 -92
  150. package/examples/saucedemo/scripts/prove-wrong-login-runtime.mjs +0 -63
  151. package/templates/quickstart/playwright.config.ts +0 -14
  152. package/templates/quickstart/scripts/drive-auto-cli.mjs +0 -93
  153. package/templates/scaffold/src/flows/hoppscotch-auth.flow.ts +0 -35
  154. package/templates/scaffold/src/flows/hoppscotch-get.flow.ts +0 -23
  155. package/templates/scaffold/src/flows/hoppscotch-post.flow.ts +0 -33
  156. package/templates/scaffold/src/flows/mail-verify.flow.ts +0 -46
@@ -1,93 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Drive `waygraph auto --cli` through login -> add-all -> remove-all -> quit.
4
- * Waits for each Choose: prompt so picks are not sent early.
5
- *
6
- * Usage (from examples/saucedemo):
7
- * node scripts/drive-auto-cli.mjs
8
- */
9
- import { spawn } from "node:child_process";
10
- import { createInterface } from "node:readline";
11
- import { fileURLToPath } from "node:url";
12
- import { dirname, join } from "node:path";
13
-
14
- const root = join(dirname(fileURLToPath(import.meta.url)), "..");
15
- const waygraphBin = join(root, "../../bin/waygraph");
16
- const DATA =
17
- process.env.WAYGRAPH_DATA ??
18
- '{"saucedemo.credentials":{"username":"standard_user","password":"secret_sauce"}}';
19
-
20
- function pickByLabel(menuText, label) {
21
- const re = new RegExp(`\\[(\\d+)\\]\\s+${label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`);
22
- const m = menuText.match(re);
23
- if (!m) throw new Error(`menu missing "${label}"\n${menuText}`);
24
- return m[1];
25
- }
26
-
27
- async function main() {
28
- const child = spawn(waygraphBin, ["auto", "--cli", "--data", DATA, "."], {
29
- cwd: root,
30
- stdio: ["pipe", "pipe", "pipe"],
31
- env: process.env,
32
- });
33
-
34
- let buf = "";
35
- const dump = (chunk, stream) => {
36
- const s = chunk.toString();
37
- buf += s;
38
- process[stream].write(s);
39
- };
40
- child.stdout.on("data", (c) => dump(c, "stdout"));
41
- child.stderr.on("data", (c) => dump(c, "stderr"));
42
-
43
- const waitChoose = () =>
44
- new Promise((resolve, reject) => {
45
- const start = Date.now();
46
- const tick = () => {
47
- if (buf.includes("Choose:")) {
48
- const i = buf.lastIndexOf("Choose:");
49
- const slice = buf.slice(Math.max(0, i - 4000), i + 8);
50
- resolve(slice);
51
- return;
52
- }
53
- if (Date.now() - start > 120_000) {
54
- reject(new Error(`timeout waiting for Choose:\n${buf.slice(-2000)}`));
55
- return;
56
- }
57
- setTimeout(tick, 100);
58
- };
59
- tick();
60
- });
61
-
62
- const send = (line) => {
63
- console.error(`\n>> pick ${line.trim()}`);
64
- buf = buf.replace(/Choose:/g, "Choose(done):");
65
- child.stdin.write(line);
66
- };
67
-
68
- try {
69
- let menu = await waitChoose();
70
- send("1\n"); // submit-login
71
- menu = await waitChoose();
72
- if (!/LoggedIn|Add all to cart/.test(menu)) {
73
- throw new Error(`expected inventory after login, got:\n${menu}`);
74
- }
75
- send(`${pickByLabel(menu, "Add all to cart")}\n`);
76
- menu = await waitChoose();
77
- send(`${pickByLabel(menu, "Remove all from cart")}\n`);
78
- menu = await waitChoose();
79
- if (!/Add all to cart/.test(menu)) {
80
- throw new Error(`expected Add all again after remove-all, got:\n${menu}`);
81
- }
82
- send("q\n");
83
- const code = await new Promise((res) => child.on("exit", res));
84
- if (code !== 0 && code !== null) process.exitCode = code;
85
- else console.error("\ndrive-auto-cli: PASS login -> add-all -> remove-all -> quit");
86
- } catch (err) {
87
- console.error(err instanceof Error ? err.message : String(err));
88
- child.kill("SIGTERM");
89
- process.exitCode = 1;
90
- }
91
- }
92
-
93
- main();
@@ -1,35 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetQueryParamsBlock } from "../map/(external)/hoppscotch/_methods/set-query-params.method.block.js";
7
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
8
- import { SetBearerTokenBlock } from "../map/(external)/hoppscotch/_methods/set-bearer-token.method.block.js";
9
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
10
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
11
- import { ReadResponseHeadersBlock } from "../map/(external)/hoppscotch/_methods/read-response-headers.method.block.js";
12
- import { AssertResponseHeaderBlock } from "../map/(external)/hoppscotch/_methods/assert-response-header.method.block.js";
13
- import { ReadResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/read-response-body.method.block.js";
14
- import { AssertResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/assert-response-body.method.block.js";
15
- import "../map/(external)/hoppscotch/_page.block.js";
16
-
17
- const engine = new Engine(config);
18
-
19
- /** GET with query params and a bearer token, check the status, that the API received them, and a response header. Needs `extensions: ["hoppscotch"]`. */
20
- export const hoppscotchAuthFlow = engine
21
- .map()
22
- .start()
23
- .gotoExternal(NavHoppscotchSettingsBlock)
24
- .method(PickExtensionInterceptorBlock)
25
- .gotoExternal(NavHoppscotchRestBlock)
26
- .method(SetUrlBlock)
27
- .method(SetQueryParamsBlock)
28
- .method(SetBearerTokenBlock)
29
- .method(SendRequestBlock)
30
- .assert(AssertStatusBlock)
31
- .method(ReadResponseBodyBlock)
32
- .assert(AssertResponseBodyBlock)
33
- .method(ReadResponseHeadersBlock)
34
- .assert(AssertResponseHeaderBlock)
35
- .end({ title: "Scaffold: Hoppscotch GET with query params and bearer token" });
@@ -1,23 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
7
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
8
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
9
- import "../map/(external)/hoppscotch/_page.block.js";
10
-
11
- const engine = new Engine(config);
12
-
13
- /** GET a URL and check the status. Needs `extensions: ["hoppscotch"]` in waygraph.config.ts. */
14
- export const hoppscotchGetFlow = engine
15
- .map()
16
- .start()
17
- .gotoExternal(NavHoppscotchSettingsBlock)
18
- .method(PickExtensionInterceptorBlock)
19
- .gotoExternal(NavHoppscotchRestBlock)
20
- .method(SetUrlBlock)
21
- .method(SendRequestBlock)
22
- .assert(AssertStatusBlock)
23
- .end({ title: "Scaffold: Hoppscotch GET" });
@@ -1,33 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavHoppscotchSettingsBlock } from "../map/(external)/hoppscotch/settings/_nav.block.js";
4
- import { PickExtensionInterceptorBlock } from "../map/(external)/hoppscotch/_methods/pick-extension-interceptor.method.block.js";
5
- import { NavHoppscotchRestBlock } from "../map/(external)/hoppscotch/_nav.block.js";
6
- import { SetMethodBlock } from "../map/(external)/hoppscotch/_methods/set-method.method.block.js";
7
- import { SetUrlBlock } from "../map/(external)/hoppscotch/_methods/set-url.method.block.js";
8
- import { SetHeadersBlock } from "../map/(external)/hoppscotch/_methods/set-headers.method.block.js";
9
- import { SetJsonBodyBlock } from "../map/(external)/hoppscotch/_methods/set-json-body.method.block.js";
10
- import { SendRequestBlock } from "../map/(external)/hoppscotch/_methods/send-request.method.block.js";
11
- import { AssertStatusBlock } from "../map/(external)/hoppscotch/_methods/assert-status.method.block.js";
12
- import { ReadResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/read-response-body.method.block.js";
13
- import { AssertResponseBodyBlock } from "../map/(external)/hoppscotch/_methods/assert-response-body.method.block.js";
14
- import "../map/(external)/hoppscotch/_page.block.js";
15
-
16
- const engine = new Engine(config);
17
-
18
- /** POST JSON with a header, check the status and the response body. Needs `extensions: ["hoppscotch"]`. */
19
- export const hoppscotchPostFlow = engine
20
- .map()
21
- .start()
22
- .gotoExternal(NavHoppscotchSettingsBlock)
23
- .method(PickExtensionInterceptorBlock)
24
- .gotoExternal(NavHoppscotchRestBlock)
25
- .method(SetMethodBlock)
26
- .method(SetUrlBlock)
27
- .method(SetHeadersBlock)
28
- .method(SetJsonBodyBlock)
29
- .method(SendRequestBlock)
30
- .assert(AssertStatusBlock)
31
- .method(ReadResponseBodyBlock)
32
- .assert(AssertResponseBodyBlock)
33
- .end({ title: "Scaffold: Hoppscotch POST with header and JSON body" });
@@ -1,46 +0,0 @@
1
- import { Engine } from "waygraph";
2
- import config from "../../config/waygraph.config.js";
3
- import { NavMailpitInboxBlock } from "../map/(external)/mailpit/_nav.block.js";
4
- import { AssertEmailReceivedBlock } from "../map/(external)/mailpit/_methods/assert-email-received.method.block.js";
5
- import { OpenMessageBlock } from "../map/(external)/mailpit/_methods/open-message.method.block.js";
6
- import { AssertEmailContentBlock } from "../map/(external)/mailpit/_methods/assert-email-content.method.block.js";
7
- import { ExtractEmailLinkBlock } from "../map/(external)/mailpit/_methods/extract-email-link.method.block.js";
8
- import { NavVerificationLinkBlock } from "../map/(app_base)/home/nav-verification-link.block.js";
9
- import "../map/(external)/mailpit/_page.block.js";
10
- import { MailpitSel } from "../map/(external)/mailpit/_sel.js";
11
-
12
- const engine = new Engine(config);
13
-
14
- /** Needs a Mailpit at WAYGRAPH_MAIL_URL (default http://127.0.0.1:8025); tests/mail-verify.spec.ts starts one. */
15
- export const mailVerifyFlow = engine
16
- .map()
17
- .start()
18
- .gotoExternal(NavMailpitInboxBlock)
19
- .assert(
20
- AssertEmailReceivedBlock.stubAfter((ctx) => {
21
- ctx.ring("note", {
22
- selector: MailpitSel.messageRow,
23
- label: "AC · email arrived",
24
- detail: "Confirmed before opening anything.",
25
- tag: "AC",
26
- });
27
- }),
28
- )
29
- .method(OpenMessageBlock)
30
- .assert(
31
- AssertEmailContentBlock.stubAfter((ctx) => {
32
- ctx.ring("note", { selector: MailpitSel.previewIframe, label: "AC · email body matches expected copy", tag: "AC" });
33
- }),
34
- )
35
- .method(
36
- ExtractEmailLinkBlock.stubAfter((ctx) => {
37
- ctx.ring("note", {
38
- selector: MailpitSel.previewIframe,
39
- label: "AC · link found",
40
- detail: "Read from the message preview iframe.",
41
- tag: "AC",
42
- });
43
- }),
44
- )
45
- .gotoPage(NavVerificationLinkBlock)
46
- .end({ title: "Scaffold: Cross-origin mail verification (QA-rich)" });