@deeeed/metamask-harness 0.2.0 → 0.3.1

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 (110) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +47 -17
  3. package/{orchestration → adapters}/core/cleanup.sh +2 -2
  4. package/{orchestration → adapters}/core/inject.sh +8 -8
  5. package/{orchestration → adapters}/extension/cleanup.mjs +1 -1
  6. package/{orchestration → adapters}/extension/console-tail.mjs +3 -0
  7. package/{orchestration → adapters}/extension/ensure-browser.sh +4 -4
  8. package/{orchestration → adapters}/extension/inject.mjs +27 -31
  9. package/{orchestration → adapters}/extension/launch.sh +4 -4
  10. package/{orchestration → adapters}/extension/live.sh +5 -5
  11. package/{orchestration → adapters}/extension/readiness.mjs +12 -2
  12. package/{orchestration → adapters}/extension/refresh-build.sh +1 -1
  13. package/{orchestration → adapters}/extension/seed-fixture.sh +1 -1
  14. package/{orchestration → adapters}/extension/start-watch.sh +7 -7
  15. package/{runner → adapters}/extension/verify.sh +11 -11
  16. package/{orchestration → adapters}/extension/wallet-fixture-state.cjs +2 -2
  17. package/{orchestration → adapters}/manifest.json +96 -96
  18. package/{library/actions → adapters}/mobile/bridge-runtime/cdp-bridge.cjs +5 -5
  19. package/{orchestration → adapters}/mobile/cleanup.sh +3 -3
  20. package/{orchestration → adapters}/mobile/inject.sh +22 -24
  21. package/adapters/mobile/open-device.sh +260 -0
  22. package/{orchestration/compat-overlays → adapters/mobile/overlay/compat}/README.md +13 -4
  23. package/adapters/mobile/prewarm-bundle.sh +95 -0
  24. package/adapters/mobile/start-metro.sh +228 -0
  25. package/{runner → adapters}/mobile/verify.sh +6 -6
  26. package/adapters/mobile/wait-for-bridge.sh +108 -0
  27. package/adapters/mobile/yarn-setup.sh +20 -0
  28. package/{orchestration/lib → adapters/shared}/cli-ux.sh +5 -9
  29. package/{orchestration/lib → adapters/shared}/log-tui.mjs +57 -1
  30. package/{orchestration/lib → adapters/shared}/open-debug.mjs +32 -10
  31. package/{orchestration/lib → adapters/shared}/resolve-farmslot-ports.sh +47 -0
  32. package/adapters/shared/sync-wallet-fixture.sh +78 -0
  33. package/bin/mm-harness +37 -6
  34. package/docs/CLI-SPEC.md +41 -2
  35. package/docs/architecture.md +69 -38
  36. package/docs/runtime-file-conventions.md +3 -3
  37. package/library/actions/core/perps/_controller.mjs +1 -1
  38. package/library/actions/extension/platform/cdp.mjs +2 -2
  39. package/library/actions/extension/wallet/ensure_unlocked.mjs +1 -1
  40. package/library/actions/mobile/platform/bridge.mjs +1 -1
  41. package/library/actions/mobile/wallet/ensure_unlocked.mjs +1 -1
  42. package/library/actions/mobile/wallet/setup.mjs +2 -2
  43. package/library/library.json +1 -1
  44. package/package.json +8 -8
  45. package/{orchestration → src/adapters}/extension/runtime-decision.ts +5 -5
  46. package/{orchestration → src/adapters}/extension/runtime.ts +1 -1
  47. package/src/adapters/mobile/prepare.ts +210 -0
  48. package/{orchestration → src/adapters}/mobile/runtime-decision.ts +105 -5
  49. package/{runner/src → src}/adapters.ts +3 -3
  50. package/{orchestration/lib/cli-color.mjs → src/cli-color.ts} +21 -13
  51. package/{orchestration/lib/cli-commands.mjs → src/cli-commands.ts} +52 -45
  52. package/{orchestration/lib/cli-version.mjs → src/cli-version.ts} +35 -17
  53. package/{runner/src → src}/cli.ts +48 -40
  54. package/src/commands/debug.ts +63 -0
  55. package/src/commands/fixtures.ts +193 -0
  56. package/{runner/src → src}/commands/launch.ts +200 -54
  57. package/src/commands/logs.ts +83 -0
  58. package/{runner/src → src}/commands/shared.ts +40 -30
  59. package/src/commands/update.ts +316 -0
  60. package/{runner/src → src}/harness.ts +119 -16
  61. package/{runner/src → src}/heal-bounds.ts +20 -1
  62. package/src/index.ts +15 -0
  63. package/{runner/src → src}/live-adapter-contract.ts +1 -1
  64. package/{runner/src → src}/mm-harness-cli.ts +64 -3
  65. package/{runner/src → src}/paths.ts +2 -2
  66. package/{orchestration/lib/progress.mjs → src/progress.ts} +31 -21
  67. package/docs/extension-runtime-commands.md +0 -60
  68. package/docs/harness-cli.md +0 -43
  69. package/orchestration/compat-overlays/mobile/README.md +0 -13
  70. package/orchestration/doctor.mjs +0 -72
  71. package/orchestration/lib/cli-home.mjs +0 -354
  72. package/orchestration/lib/recipe-paths.mjs +0 -26
  73. package/orchestration/mobile/launch.sh +0 -137
  74. package/orchestration/mobile/live.sh +0 -125
  75. package/orchestration/porcelain/metamask-recipe +0 -99
  76. package/orchestration/porcelain/mm-recipe +0 -1591
  77. package/orchestration/porcelain/mme-recipe +0 -1181
  78. package/runner/src/commands/debug.ts +0 -44
  79. package/runner/src/commands/fixtures.ts +0 -99
  80. package/runner/src/commands/logs.ts +0 -60
  81. package/runner/src/index.ts +0 -6
  82. /package/{orchestration → adapters}/extension/launch-browser.cjs +0 -0
  83. /package/{orchestration → adapters}/extension/pin-remote-flags.cjs +0 -0
  84. /package/{orchestration → adapters}/extension/sidepanel-toggle.sh +0 -0
  85. /package/{orchestration → adapters}/extension/snapshot-dist.sh +0 -0
  86. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/cdp-eval.cjs +0 -0
  87. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/config.cjs +0 -0
  88. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/issue-capture.cjs +0 -0
  89. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/target-discovery.cjs +0 -0
  90. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/ws-client.cjs +0 -0
  91. /package/{library/actions → adapters}/mobile/bridge-runtime/setup-wallet.sh +0 -0
  92. /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgentStepHud.tsx.patch +0 -0
  93. /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgenticService.ts.patch +0 -0
  94. /package/{orchestration/compat-overlays/mobile → adapters/mobile/overlay/compat}/rn81-message-event-source.patch +0 -0
  95. /package/{orchestration/lib → adapters/shared}/activate-repo-node.sh +0 -0
  96. /package/{orchestration/lib → adapters/shared}/ensure-runner-deps.sh +0 -0
  97. /package/{orchestration/lib → adapters/shared}/harness-path.sh +0 -0
  98. /package/{orchestration/lib → adapters/shared}/hash-helpers.sh +0 -0
  99. /package/{orchestration/lib → adapters/shared}/json-field.sh +0 -0
  100. /package/{orchestration/lib → adapters/shared}/path-defaults.json +0 -0
  101. /package/{orchestration → src/adapters}/extension/ensure-ready.ts +0 -0
  102. /package/{orchestration → src/adapters}/extension/extension-id.ts +0 -0
  103. /package/{orchestration → src/adapters}/mobile/deps-markers.ts +0 -0
  104. /package/{runner/src → src}/completions-cache.ts +0 -0
  105. /package/{runner/src → src}/doctor.ts +0 -0
  106. /package/{runner/src → src}/manifest.ts +0 -0
  107. /package/{runner/src → src}/recording-target.ts +0 -0
  108. /package/{runner/src → src}/run-recording.ts +0 -0
  109. /package/{runner/src → src}/runner.ts +0 -0
  110. /package/{runner/src → src}/types.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1 - 2026-07-03
4
+
5
+ ### Fixed
6
+ - **Customization compose-by-ref**: recipes with `{action:"call",ref:"<lib>.<flow>"}` + `--library <lib>=<dir>` now pass pre-run schema validation AND execute at runtime. `validateRecipeAdapterAware` threads `externalFlowIds` into both `validateRecipeDocument` and `validateRecipeWithManifest`; library resolution also runs at `run` time.
7
+ - **IMP-14: stale metro.log guard** — if `metro.log` is older than the install markers (`node_modules/.yarn-state.yml`, `.yarn/install-state.gz`), it is treated as absent so a stale log cannot drive a false native-module-mismatch decision at launch.
8
+ - **IMP-15: stale overlay shim auto-repair (two modes)** — `ensureOverlay` detects (1) a `.runner-source` pointing to a nonexistent runner dir, and (2) a `.runner-source` whose dir exists but whose `bin/mm-harness` was removed. Both re-install automatically before launch.
9
+ - **IMP-17: deps-staleness fallback (two-layer)** — (1) mtime comparison when no baseline exists: manifest files newer than install markers → `install`; (2) required-dep absence: a top-level `package.json` dep absent from `node_modules` is caught at pre-flight as `deps-partial` → `install`, before Metro discovers it during a long bundle run.
10
+ - **IMP-18: iOS sim scheme-approval pre-write** — `open-device.sh` writes `com.apple.launchservices.schemeapproval` via `xcrun simctl spawn … defaults write` before the first `openurl`, eliminating the "Open in \<App\>?" dialog hang. Scheme derives from `DEV_CLIENT_SCHEME` (overridable via `IOS_DEV_CLIENT_SCHEME`).
11
+
12
+ ## 0.3.0 - 2026-07-03
13
+
14
+ ### Changed
15
+ - Porcelain layer eliminated: the legacy `mm-recipe`/`mme-recipe`/`metamask-recipe` bins are gone; launch/logs/debug/fixtures compose the adapter scripts directly in TypeScript. Repository reorganized into `src/` (all TS), `adapters/` (per-platform runtime glue), `library/` (recipe/action/flow vocabulary).
16
+
17
+ ### Fixed
18
+ - Extension `launch` opens the app directly (composes `live.sh`) instead of a retired command.
19
+ - Mobile `cleanup` resilient to a stale runner-source path.
20
+ - Core run teaches the correct next step when no account is set.
21
+ - Resolved CodeQL alerts (insecure temp dir, file-access-to-http).
22
+
23
+ ## Unreleased
24
+
25
+ ### Added
26
+
27
+ - **`mm-harness update`**: checks the npm registry `dist-tags.latest` for `@deeeed/metamask-harness` and, when newer, runs `npm i -g @deeeed/metamask-harness@latest` and prints `old → new`; already-current exits 0. `--check` reports only (exit 0 up-to-date, exit 1 update available); `--json` carries `{ current, latest, updateAvailable }`. Every failure path (no npm, registry unreachable, permission-denied global dir) exits 3 with the exact escape.
28
+ - **Passive update nudge**: on invocation (throttled to once/day via a cache file, bounded fetch, skipped in CI and when `MM_HARNESS_NO_UPDATE_CHECK=1`), a single `stderr` line announces a newer published version — never on stdout, never blocking, never auto-updating.
29
+ - **`MM_HARNESS_BIN` dev/prod switch**: the entrypoint honors `MM_HARNESS_BIN` as the single override point — when set, the invocation is handed to that dev checkout's `bin/mm-harness`; unset resolves the installed/global bin (prod). A self-path guard prevents an exec loop, and a non-executable value teaches its fix. Documented in `--help` and README.
30
+
31
+ ### Changed
32
+
33
+ - **Teaching errors are type-enforced**: `usageOut` now requires a `userAction` escape argument, so a teaching error without a reachable next step no longer compiles. The repo-type detection failure teaches BOTH escapes (`cd into a checkout / pass --target <path>` and `--adapter <mobile|extension|core>`) consistently across `doctor`, `launch`, `verify`, and the overlay path.
34
+ - **Repository reorganized into `src/`, `adapters/`, `library/` domains**: all TypeScript now lives under `src/` (shared CLI/core plus typed per-adapter logic in `src/adapters/<adapter>/`); everything that executes against or is injected into the app runtime lives under `adapters/` (`adapters/<adapter>/` per-app glue, `adapters/shared/` cross-adapter OS-glue, `adapters/porcelain/` composed entrypoints, `adapters/*/overlay/` the only injected payload); `library/` holds composable vocabulary only. The `runner/` and `orchestration/` trees no longer exist. The surface doctor moved to `scripts/adapter-surface-doctor.mjs` with its index at `adapters/manifest.json`. Placement rules (R1–R11) are documented in `AGENTS.md`. This is a path-only reorganization; runtime behavior is unchanged.
35
+
3
36
  ## 0.2.0 - 2026-07-03
4
37
 
5
38
  ### Changed
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MetaMask Recipe Runner — `mm-harness`
2
2
 
3
+ Architecture: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
4
+
3
5
  **`mm-harness` is built for the agent but easy for the human to use and
4
6
  understand.** It is the MetaMask recipe harness: one front door to launch the app,
5
7
  prove behavior with recipes, and manage the per-checkout runtime overlay. It is a
@@ -26,8 +28,7 @@ completions (zsh + bash) for commands, targets, and flags.
26
28
  Naming: **"harness" is the tool** (`mm-harness`) and the generic engine package
27
29
  (`@farmslot/recipe-harness`); the files it installs into a checkout are the
28
30
  **runtime overlay**. Read [MENTAL-MODEL.md](docs/MENTAL-MODEL.md) first (the
29
- before→after map), then [CLI-SPEC.md](docs/CLI-SPEC.md) for the full contract
30
- ([harness-cli.md](docs/harness-cli.md) is a short pointer to it).
31
+ before→after map), then [CLI-SPEC.md](docs/CLI-SPEC.md) for the full contract.
31
32
 
32
33
  One package, two responsibilities:
33
34
 
@@ -60,8 +61,8 @@ mm-harness run # runner/proof: actions execute and evidence is saved
60
61
  ```
61
62
 
62
63
  Do not mix those layers. library/ = what recipes ARE (recipes, actions,
63
- manifests — the content). runner/ = what EXECUTES them (engine, verify,
64
- evidence). orchestration/ = what CONTROLS the app and its instances (start,
64
+ manifests — the content). src/ = what EXECUTES them (TypeScript CLI/engine glue,
65
+ typed adapters). adapters/ = what CONTROLS the app and its instances (start,
65
66
  windows, wallet state, health, ports, parallel).
66
67
 
67
68
  ## Useful commands
@@ -83,28 +84,39 @@ mm-harness launch ios # launch (mobile: ios | android)
83
84
  mm-harness logs # tail Metro/webpack + app logs
84
85
  mm-harness debug # open the debug console
85
86
  mm-harness fixtures sync # sync fixtures; `fixtures set` seeds the wallet
87
+
88
+ # Keep the install current
89
+ mm-harness update # upgrade to the published latest (prints old → new)
90
+ mm-harness update --check --json # report only — { current, latest, updateAvailable }
86
91
  ```
87
92
 
93
+ A passive once-a-day nudge prints one `stderr` line when a newer version is
94
+ published (`mm-harness <cur> → <latest> available · run: mm-harness update`). It
95
+ never blocks and never auto-updates. Silence it with `MM_HARNESS_NO_UPDATE_CHECK=1`
96
+ (auto-off in CI).
97
+
88
98
  Set `RECIPE_LOG_UI=compact|full|quiet` (default `compact`) and `RECIPE_LOG_EVENTS=10`
89
99
  to tune the compact log view during launch and Metro/webpack startup.
90
100
 
91
101
  ## Layout
92
102
 
93
103
  ```text
94
- bin/ CLI and platform convenience commands
95
- runner/ what EXECUTES recipes: engine glue (runner/src) +
96
- per-platform verify (engine, verify, evidence)
97
- orchestration/ what CONTROLS the app and its instances: launch/live/
104
+ bin/ the mm-harness entrypoint
105
+ src/ what EXECUTES recipes: TypeScript CLI/engine glue +
106
+ typed per-adapter logic (src/adapters/)
107
+ adapters/ what CONTROLS the app and its instances: launch/live/
98
108
  watch/windows/wallet state/health/inject/cleanup per
99
- platform, shared lib, manifest.json + doctor.mjs
109
+ platform, shared glue, porcelain, overlay payload +
110
+ manifest.json
100
111
  library/ what recipes ARE: recipes/ (recipe JSONs), actions/
101
112
  (per-platform implementations), manifests/ (capability)
102
- scripts/ dev tooling (yarn check, local farmslot link, e2e validation)
113
+ scripts/ dev tooling (yarn check, local farmslot link, e2e
114
+ validation, adapter-surface-doctor)
103
115
  docs/ details when this README is not enough
104
116
  ```
105
117
 
106
118
  Defaults for installed harness/runtime paths live in
107
- `orchestration/lib/path-defaults.json`.
119
+ `adapters/shared/path-defaults.json`.
108
120
 
109
121
  ## Runtime-readiness ownership
110
122
 
@@ -114,12 +126,30 @@ Generic readiness mechanics live in `@farmslot/recipe-harness` (0.3+):
114
126
  - `@farmslot/recipe-harness/runtime/log-analysis` — bundle-log boundaries, unresolved-module scoping
115
127
  - `@farmslot/recipe-harness/runtime/metro-probe` — Metro `/status` reachability
116
128
 
117
- This repo adds **MetaMask adapters only**: `orchestration/mobile/deps-markers.ts`,
118
- `orchestration/mobile/runtime-decision.ts`, `orchestration/extension/runtime-decision.ts`,
119
- and shell launch in `orchestration/porcelain/mm-recipe` / `orchestration/porcelain/mme-recipe`. Do not re-copy harness
120
- primitives into `orchestration/lib/`. CI installs harness from npm — publish
129
+ This repo adds **MetaMask adapters only**: `adapters/mobile/deps-markers.ts`,
130
+ `adapters/mobile/runtime-decision.ts`, `adapters/extension/runtime-decision.ts`,
131
+ and shell launch in `adapters/porcelain/mm-recipe` / `adapters/porcelain/mme-recipe`. Do not re-copy harness
132
+ primitives into `adapters/shared/`. CI installs harness from npm — publish
121
133
  `@farmslot/recipe-harness` before bumping the dependency here.
122
134
 
135
+ ## Dev/prod harness (`MM_HARNESS_BIN`)
136
+
137
+ The global npm install owns the `mm-harness` on `PATH` — that is the **prod**
138
+ harness. To run a **dev** checkout with active pre-release changes alongside it,
139
+ set `MM_HARNESS_BIN` to that checkout's `bin/mm-harness`:
140
+
141
+ ```bash
142
+ export MM_HARNESS_BIN=/path/to/checkout/bin/mm-harness # dev: this checkout owns the run
143
+ unset MM_HARNESS_BIN # prod: the installed/global bin
144
+ ```
145
+
146
+ `MM_HARNESS_BIN` is the single override point: when set, the entrypoint hands the
147
+ whole invocation to that path before doing any dependency work; when unset it
148
+ resolves the installed bin. A dev checkout is never installed globally, so there is
149
+ no `PATH` collision — dev is reached only through `MM_HARNESS_BIN` (or a shell
150
+ alias). A per-farm environment can export it so the dev farm dispatches through the
151
+ dev harness while the prod farm leaves it unset.
152
+
123
153
  ## Runtime notes
124
154
 
125
155
  - `tmux` is recommended for long-lived Metro/webpack processes; standalone use
@@ -133,8 +163,8 @@ primitives into `orchestration/lib/`. CI installs harness from npm — publish
133
163
 
134
164
  ```bash
135
165
  yarn check
136
- bash -n bin/mm-harness orchestration/porcelain/{metamask-recipe,mm-recipe,mme-recipe} orchestration/{mobile,extension,core}/*.sh runner/{mobile,extension}/verify.sh
137
- node --check orchestration/extension/inject.mjs orchestration/extension/cleanup.mjs orchestration/extension/readiness.mjs orchestration/extension/launch-browser.cjs orchestration/lib/open-debug.mjs orchestration/lib/cli-home.mjs orchestration/lib/log-tui.mjs orchestration/lib/progress.mjs orchestration/lib/recipe-paths.mjs scripts/check.mjs
166
+ bash -n bin/mm-harness adapters/porcelain/{metamask-recipe,mm-recipe,mme-recipe} adapters/{mobile,extension,core}/*.sh
167
+ node --check adapters/extension/inject.mjs adapters/extension/cleanup.mjs adapters/extension/readiness.mjs adapters/extension/launch-browser.cjs adapters/shared/open-debug.mjs adapters/shared/cli-home.mjs adapters/shared/log-tui.mjs adapters/shared/progress.mjs adapters/shared/recipe-paths.mjs scripts/check.mjs
138
168
  ```
139
169
 
140
170
  More detail: [Architecture](docs/architecture.md), [Package boundaries](docs/package-boundaries.md), [Runtime file conventions](docs/runtime-file-conventions.md).
@@ -23,12 +23,12 @@ done
23
23
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
24
  TARGET="$(cd "$TARGET" && pwd)"
25
25
  # shellcheck disable=SC1091
26
- for _hp in "$SCRIPT_DIR/../lib/harness-path.sh"; do
26
+ for _hp in "$SCRIPT_DIR/../shared/harness-path.sh"; do
27
27
  [ -f "$_hp" ] && { . "$_hp"; break; }
28
28
  done
29
29
  unset _hp
30
30
  if ! command -v harness_root >/dev/null 2>&1; then
31
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
31
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
32
32
  exit 1
33
33
  fi
34
34
  HARNESS_DIR="$(harness_dir "$TARGET" core)"
@@ -27,12 +27,12 @@ done
27
27
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28
28
  RUNNER_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd -P)"
29
29
  # shellcheck disable=SC1091
30
- for _hp in "$SCRIPT_DIR/../lib/harness-path.sh"; do
30
+ for _hp in "$SCRIPT_DIR/../shared/harness-path.sh"; do
31
31
  [ -f "$_hp" ] && { . "$_hp"; break; }
32
32
  done
33
33
  unset _hp
34
34
  if ! command -v harness_root >/dev/null 2>&1; then
35
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
35
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
36
36
  exit 1
37
37
  fi
38
38
  TARGET="$(cd "$TARGET" && pwd)"
@@ -81,7 +81,7 @@ install_v1_runner_assets() {
81
81
  # break the generated wrapper or inject at runtime.
82
82
  local runner_protocol_root_q runner_exec_q
83
83
  runner_protocol_root_q="$(printf '%q' "$METAMASK_RUNNER_PROTOCOL_ROOT")"
84
- runner_exec_q="$(printf '%q' "$METAMASK_RUNNER_DIR/orchestration/porcelain/metamask-recipe")"
84
+ runner_exec_q="$(printf '%q' "$METAMASK_RUNNER_DIR/bin/mm-harness")"
85
85
  {
86
86
  printf '%s\n' '#!/usr/bin/env bash'
87
87
  printf '%s\n' 'set -euo pipefail'
@@ -89,8 +89,8 @@ install_v1_runner_assets() {
89
89
  printf 'export FARMSLOT_ROOT=${FARMSLOT_ROOT:-%s}\n' "$runner_protocol_root_q"
90
90
  fi
91
91
  printf 'exec %s "$@"\n' "$runner_exec_q"
92
- } > "$HARNESS_DIR/runner/bin/metamask-recipe"
93
- chmod +x "$HARNESS_DIR/runner/bin/metamask-recipe"
92
+ } > "$HARNESS_DIR/runner/bin/mm-harness"
93
+ chmod +x "$HARNESS_DIR/runner/bin/mm-harness"
94
94
  if [ -n "$METAMASK_RUNNER_PROTOCOL_ROOT" ]; then
95
95
  printf '%s\n' "$METAMASK_RUNNER_PROTOCOL_ROOT" > "$HARNESS_DIR/runner/.farmslot-root"
96
96
  fi
@@ -113,7 +113,7 @@ install_v1_runner_assets() {
113
113
  if [ -f "$METAMASK_RUNNER_DIR/library/library.json" ]; then
114
114
  cp "$METAMASK_RUNNER_DIR/library/library.json" "$HARNESS_DIR/runner/library.json"
115
115
  fi
116
- if [ ! -x "$HARNESS_DIR/runner/bin/metamask-recipe" ]; then
116
+ if [ ! -x "$HARNESS_DIR/runner/bin/mm-harness" ]; then
117
117
  echo "Refusing core recipe harness install: failed to make runner executable." >&2
118
118
  return 1
119
119
  fi
@@ -121,7 +121,7 @@ install_v1_runner_assets() {
121
121
 
122
122
  install_v1_runner_assets
123
123
 
124
- ENSURE_DEPS="$SCRIPT_DIR/../lib/ensure-runner-deps.sh"
124
+ ENSURE_DEPS="$SCRIPT_DIR/../shared/ensure-runner-deps.sh"
125
125
  if [ -f "$ENSURE_DEPS" ]; then
126
126
  bash "$ENSURE_DEPS" "$RUNNER_DIR"
127
127
  fi
@@ -142,7 +142,7 @@ node -e '
142
142
  target,
143
143
  protocolVersion: "v1",
144
144
  actionManifestPath: harnessRel + "/action-manifest.json",
145
- runnerEntrypoint: harnessRel + "/runner/bin/metamask-recipe",
145
+ runnerEntrypoint: harnessRel + "/runner/bin/mm-harness",
146
146
  runtimeHelpers: {},
147
147
  installedPaths: [harnessRel + "/runner"],
148
148
  patchedFiles: [],
@@ -18,7 +18,7 @@ import fs from 'node:fs';
18
18
  import path from 'node:path';
19
19
  import { spawnSync } from 'node:child_process';
20
20
  import process from 'node:process';
21
- import { recipeHarnessRoot } from '../lib/recipe-paths.mjs';
21
+ import { recipeHarnessRoot } from '../../src/paths.ts';
22
22
 
23
23
  function usage() { console.error('Usage: cleanup-extension-harness.mjs [--target <metamask-extension>]'); }
24
24
  let target = process.cwd();
@@ -62,6 +62,9 @@ const attached = new Map();
62
62
  // before ever connecting, so a dead/non-debuggable target is not retried every poll).
63
63
  const cooldown = new Map();
64
64
 
65
+ // Writes formatted console-event strings (never raw HTTP response bodies) to
66
+ // stdout and optionally to a caller-supplied log file. The source is the local
67
+ // Chrome CDP WebSocket (127.0.0.1:<cdpPort>) — a trusted-local endpoint.
65
68
  function out(line) {
66
69
  process.stdout.write(`${line}\n`);
67
70
  if (args.log) appendFileSync(args.log, `${line}\n`);
@@ -58,12 +58,12 @@ done
58
58
  # Script lives at <repo>/<runtime_dir>/reopen-browser.sh
59
59
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
60
60
  # shellcheck disable=SC1091
61
- for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../lib/harness-path.sh"; do
61
+ for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
62
62
  [ -f "$_hp" ] && { . "$_hp"; break; }
63
63
  done
64
64
  unset _hp
65
65
  if ! command -v harness_root >/dev/null 2>&1; then
66
- echo "reopen-browser: shared lib orchestration/lib/harness-path.sh missing; reinstall the harness." >&2
66
+ echo "reopen-browser: shared lib adapters/shared/harness-path.sh missing; reinstall the harness." >&2
67
67
  exit 1
68
68
  fi
69
69
  if [[ -z "$RUNTIME_DIR" ]]; then
@@ -118,7 +118,7 @@ WALLET_FIXTURE="${AGENT_DIR}/wallet-fixture.json"
118
118
  # single source of truth (deterministic id from the loaded dist's manifest key).
119
119
  # Honor the configured recipe harness root.
120
120
  HARNESS_ROOT="$(harness_root)"
121
- RUNNER_BIN="${REPO}/${HARNESS_ROOT}/extension/runner/bin/metamask-recipe"
121
+ RUNNER_BIN="${REPO}/${HARNESS_ROOT}/extension/runner/bin/mm-harness"
122
122
 
123
123
  # --- Preflight checks ---
124
124
  if [ ! -f "${EXTENSION}/manifest.json" ]; then
@@ -134,7 +134,7 @@ fi
134
134
 
135
135
  if [ ! -f "${PROFILE}/Default/Preferences" ]; then
136
136
  echo "FAIL: existing browser profile not found at ${PROFILE}"
137
- echo " Reopen only reuses an already-prepared profile. Run: metamask-recipe runtime-launch --adapter extension --target ${REPO} --cdp-port ${CDP_PORT} --chrome-user-data-dir ${PROFILE} --json"
137
+ echo " Reopen only reuses an already-prepared profile. Run: mm-harness runtime-launch --adapter extension --target ${REPO} --cdp-port ${CDP_PORT} --chrome-user-data-dir ${PROFILE} --json"
138
138
  exit 1
139
139
  fi
140
140
 
@@ -23,7 +23,7 @@ import fs from 'node:fs';
23
23
  import path from 'node:path';
24
24
  import { spawnSync } from 'node:child_process';
25
25
  import process from 'node:process';
26
- import { recipeHarnessRoot } from '../lib/recipe-paths.mjs';
26
+ import { recipeHarnessRoot } from '../../src/paths.ts';
27
27
 
28
28
  function usage() {
29
29
  console.error('Usage: inject-extension-harness.mjs [--target <metamask-extension>] [--no-git-exclude]');
@@ -72,9 +72,9 @@ const delegate = [
72
72
  '#!/usr/bin/env bash',
73
73
  'set -euo pipefail',
74
74
  protocolRoot ? `export FARMSLOT_ROOT=\${FARMSLOT_ROOT:-${shellQuote(protocolRoot)}}` : null,
75
- `exec ${shellQuote(path.join(runnerDir, 'orchestration/porcelain/metamask-recipe'))} "$@"`,
75
+ `exec ${shellQuote(path.join(runnerDir, 'bin/mm-harness'))} "$@"`,
76
76
  ].filter(Boolean).join('\n') + '\n';
77
- fs.writeFileSync(path.join(harnessDir, 'runner/bin/metamask-recipe'), delegate, { mode: 0o755 });
77
+ fs.writeFileSync(path.join(harnessDir, 'runner/bin/mm-harness'), delegate, { mode: 0o755 });
78
78
  if (protocolRoot) fs.writeFileSync(path.join(harnessDir, 'runner/.farmslot-root'), `${protocolRoot}\n`);
79
79
  fs.writeFileSync(path.join(harnessDir, 'runner/.runner-source'), `${runnerDir}\n`);
80
80
  copyFile(path.join(runnerDir, 'library/manifests/mobile.action-manifest.json'), path.join(harnessDir, 'runner/manifests/mobile.action-manifest.json'));
@@ -89,36 +89,32 @@ copyDir(path.join(runnerDir, 'library/flows'), path.join(harnessDir, 'runner/flo
89
89
  // Installed-layout back-compat (INTENTIONAL): targets keep a flat
90
90
  // <harness>/scripts/ subtree assembled from the runner trees, so installed
91
91
  // consumers are unaffected by runner-repo layout changes.
92
- copyFile(path.join(runnerDir, 'orchestration/extension/launch-browser.cjs'), path.join(harnessDir, 'scripts/launch-browser.cjs'));
92
+ copyFile(path.join(runnerDir, 'adapters/extension/launch-browser.cjs'), path.join(harnessDir, 'scripts/launch-browser.cjs'));
93
93
  // installed back-compat alias: callers of the pre-rename installed name
94
- copyFile(path.join(runnerDir, 'orchestration/extension/launch-browser.cjs'), path.join(harnessDir, 'scripts/launch-chrome-detached.cjs'));
95
- copyFile(path.join(runnerDir, 'orchestration/extension/console-tail.mjs'), path.join(harnessDir, 'scripts/console-tail.mjs'));
96
- copyFile(path.join(runnerDir, 'orchestration/extension/launch.sh'), path.join(harnessDir, 'scripts/launch.sh'));
97
- copyFile(path.join(runnerDir, 'orchestration/extension/live.sh'), path.join(harnessDir, 'scripts/live.sh'));
98
- copyFile(path.join(runnerDir, 'orchestration/extension/start-watch.sh'), path.join(harnessDir, 'scripts/start-watch.sh'));
99
- copyFile(path.join(runnerDir, 'orchestration/extension/snapshot-dist.sh'), path.join(harnessDir, 'scripts/snapshot-dist.sh'));
100
- copyFile(path.join(runnerDir, 'orchestration/extension/pin-remote-flags.cjs'), path.join(harnessDir, 'scripts/pin-remote-flags.cjs'));
101
- copyFile(path.join(runnerDir, 'orchestration/extension/seed-fixture.sh'), path.join(harnessDir, 'scripts/seed-fixture.sh'));
102
- copyFile(path.join(runnerDir, 'orchestration/extension/sidepanel-toggle.sh'), path.join(harnessDir, 'scripts/sidepanel-toggle.sh'));
103
- copyFile(path.join(runnerDir, 'orchestration/extension/readiness.mjs'), path.join(harnessDir, 'scripts/readiness.mjs'));
104
- copyFile(path.join(runnerDir, 'orchestration/extension/wallet-fixture-state.cjs'), path.join(harnessDir, 'scripts/wallet-fixture-state.cjs'));
105
- copyFile(path.join(runnerDir, 'runner/extension/verify.sh'), path.join(harnessDir, 'scripts/verify.sh'));
106
- copyFile(path.join(runnerDir, 'orchestration/extension/refresh-build.sh'), path.join(harnessDir, 'scripts/refresh-build.sh'));
107
- copyFile(path.join(runnerDir, 'orchestration/extension/ensure-browser.sh'), path.join(harnessDir, 'scripts/reopen-browser.sh'));
108
- copyFile(path.join(runnerDir, 'orchestration/lib/harness-path.sh'), path.join(harnessDir, 'scripts/lib/harness-path.sh'));
109
- copyFile(path.join(runnerDir, 'orchestration/lib/activate-repo-node.sh'), path.join(harnessDir, 'scripts/lib/activate-repo-node.sh'));
110
- copyFile(path.join(runnerDir, 'orchestration/lib/resolve-farmslot-ports.sh'), path.join(harnessDir, 'scripts/lib/resolve-farmslot-ports.sh'));
111
- copyFile(path.join(runnerDir, 'orchestration/lib/path-defaults.json'), path.join(harnessDir, 'scripts/lib/path-defaults.json'));
112
- copyFile(path.join(runnerDir, 'orchestration/lib/recipe-paths.mjs'), path.join(harnessDir, 'scripts/lib/recipe-paths.mjs'));
113
- copyFile(path.join(runnerDir, 'orchestration/lib/json-field.sh'), path.join(harnessDir, 'scripts/lib/json-field.sh'));
114
- copyFile(path.join(runnerDir, 'orchestration/lib/cli-color.mjs'), path.join(harnessDir, 'scripts/lib/cli-color.mjs'));
115
- copyFile(path.join(runnerDir, 'orchestration/lib/log-tui.mjs'), path.join(harnessDir, 'scripts/lib/log-tui.mjs'));
116
- copyFile(path.join(runnerDir, 'orchestration/lib/progress.mjs'), path.join(harnessDir, 'scripts/lib/progress.mjs'));
117
- copyFile(path.join(runnerDir, 'orchestration/lib/cli-version.mjs'), path.join(harnessDir, 'scripts/lib/cli-version.mjs'));
94
+ copyFile(path.join(runnerDir, 'adapters/extension/launch-browser.cjs'), path.join(harnessDir, 'scripts/launch-chrome-detached.cjs'));
95
+ copyFile(path.join(runnerDir, 'adapters/extension/console-tail.mjs'), path.join(harnessDir, 'scripts/console-tail.mjs'));
96
+ copyFile(path.join(runnerDir, 'adapters/extension/launch.sh'), path.join(harnessDir, 'scripts/launch.sh'));
97
+ copyFile(path.join(runnerDir, 'adapters/extension/live.sh'), path.join(harnessDir, 'scripts/live.sh'));
98
+ copyFile(path.join(runnerDir, 'adapters/extension/start-watch.sh'), path.join(harnessDir, 'scripts/start-watch.sh'));
99
+ copyFile(path.join(runnerDir, 'adapters/extension/snapshot-dist.sh'), path.join(harnessDir, 'scripts/snapshot-dist.sh'));
100
+ copyFile(path.join(runnerDir, 'adapters/extension/pin-remote-flags.cjs'), path.join(harnessDir, 'scripts/pin-remote-flags.cjs'));
101
+ copyFile(path.join(runnerDir, 'adapters/extension/seed-fixture.sh'), path.join(harnessDir, 'scripts/seed-fixture.sh'));
102
+ copyFile(path.join(runnerDir, 'adapters/extension/sidepanel-toggle.sh'), path.join(harnessDir, 'scripts/sidepanel-toggle.sh'));
103
+ copyFile(path.join(runnerDir, 'adapters/extension/readiness.mjs'), path.join(harnessDir, 'scripts/readiness.mjs'));
104
+ copyFile(path.join(runnerDir, 'adapters/extension/wallet-fixture-state.cjs'), path.join(harnessDir, 'scripts/wallet-fixture-state.cjs'));
105
+ copyFile(path.join(runnerDir, 'adapters/extension/verify.sh'), path.join(harnessDir, 'scripts/verify.sh'));
106
+ copyFile(path.join(runnerDir, 'adapters/extension/refresh-build.sh'), path.join(harnessDir, 'scripts/refresh-build.sh'));
107
+ copyFile(path.join(runnerDir, 'adapters/extension/ensure-browser.sh'), path.join(harnessDir, 'scripts/reopen-browser.sh'));
108
+ copyFile(path.join(runnerDir, 'adapters/shared/harness-path.sh'), path.join(harnessDir, 'scripts/lib/harness-path.sh'));
109
+ copyFile(path.join(runnerDir, 'adapters/shared/activate-repo-node.sh'), path.join(harnessDir, 'scripts/lib/activate-repo-node.sh'));
110
+ copyFile(path.join(runnerDir, 'adapters/shared/resolve-farmslot-ports.sh'), path.join(harnessDir, 'scripts/lib/resolve-farmslot-ports.sh'));
111
+ copyFile(path.join(runnerDir, 'adapters/shared/path-defaults.json'), path.join(harnessDir, 'scripts/lib/path-defaults.json'));
112
+ copyFile(path.join(runnerDir, 'adapters/shared/json-field.sh'), path.join(harnessDir, 'scripts/lib/json-field.sh'));
113
+ copyFile(path.join(runnerDir, 'adapters/shared/log-tui.mjs'), path.join(harnessDir, 'scripts/lib/log-tui.mjs'));
118
114
  makeExecutableTree(path.join(harnessDir, 'scripts'));
119
115
  fs.writeFileSync(path.join(harnessDir, 'installed-scripts.sha256'), `${dirContentHash(path.join(harnessDir, 'scripts'))}\n`);
120
116
 
121
- const cleanupScript = path.join(runnerDir, 'orchestration/extension/cleanup.mjs');
117
+ const cleanupScript = path.join(runnerDir, 'adapters/extension/cleanup.mjs');
122
118
  const cleanupCommand = `RECIPE_HARNESS_ROOT=${harnessRoot} ${shellQuote(cleanupScript)} --target ${shellQuote(target)}`;
123
119
  const manifest = {
124
120
  adapter: 'extension',
@@ -132,7 +128,7 @@ const manifest = {
132
128
  target,
133
129
  protocolVersion: 'v1',
134
130
  actionManifestPath: `${harnessRel}/action-manifest.json`,
135
- runnerEntrypoint: `${harnessRel}/runner/bin/metamask-recipe`,
131
+ runnerEntrypoint: `${harnessRel}/runner/bin/mm-harness`,
136
132
  installedPaths: [`${harnessRel}/scripts`, `${harnessRel}/runner`, `${harnessRel}/action-manifest.json`, `${harnessRel}/manifest.json`],
137
133
  runtimeHelpers: {
138
134
  live: `${harnessRel}/scripts/live.sh`,
@@ -149,7 +145,7 @@ fs.writeFileSync(path.join(harnessDir, 'manifest.json'), `${JSON.stringify(manif
149
145
 
150
146
  if (gitExclude) addGitExclude(target, `${harnessRoot}/`, harnessDir);
151
147
 
152
- const ensureDeps = path.join(runnerDir, 'orchestration/lib/ensure-runner-deps.sh');
148
+ const ensureDeps = path.join(runnerDir, 'adapters/shared/ensure-runner-deps.sh');
153
149
  if (fs.existsSync(ensureDeps)) {
154
150
  const ensured = spawnSync('bash', [ensureDeps, runnerDir], { stdio: 'inherit' });
155
151
  if (ensured.status !== 0) process.exit(ensured.status ?? 1);
@@ -45,12 +45,12 @@ fi
45
45
 
46
46
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
47
47
  # shellcheck disable=SC1091
48
- for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../lib/harness-path.sh"; do
48
+ for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
49
49
  [ -f "$_hp" ] && { . "$_hp"; break; }
50
50
  done
51
51
  unset _hp
52
52
  if ! command -v harness_root >/dev/null 2>&1; then
53
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
53
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
54
54
  exit 1
55
55
  fi
56
56
  READINESS_MJS="$SCRIPT_DIR/readiness.mjs"
@@ -64,12 +64,12 @@ ARTIFACTS="${ARTIFACTS:-$HARNESS_DIR/launch/$(date -u +%Y%m%dT%H%M%SZ)}"
64
64
  mkdir -p "$ARTIFACTS/logs"
65
65
 
66
66
  if [ ! -f "$HARNESS_DIR/manifest.json" ]; then
67
- echo "Extension recipe harness is not installed in $TARGET. Run metamask-recipe extension prepare --target $TARGET first." >&2
67
+ echo "Extension recipe harness is not installed in $TARGET. Run mm-harness install --adapter extension --target $TARGET first." >&2
68
68
  exit 1
69
69
  fi
70
70
 
71
71
  LIB_DIR=""
72
- for _lib in "$SCRIPT_DIR/lib" "$SCRIPT_DIR/../lib"; do
72
+ for _lib in "$SCRIPT_DIR/lib" "$SCRIPT_DIR/../shared"; do
73
73
  [ -f "$_lib/log-tui.mjs" ] && LIB_DIR="$_lib" && break
74
74
  done
75
75
  unset _lib
@@ -68,18 +68,18 @@ esac
68
68
 
69
69
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
70
70
  # shellcheck disable=SC1091
71
- for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../lib/harness-path.sh"; do
71
+ for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
72
72
  [ -f "$_hp" ] && { . "$_hp"; break; }
73
73
  done
74
74
  unset _hp
75
75
  if ! command -v harness_root >/dev/null 2>&1; then
76
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
76
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
77
77
  exit 1
78
78
  fi
79
79
  # verify.sh is a recipe-tree feature: co-located in installed copies, under
80
- # runner/extension in a repo checkout.
80
+ # adapters/extension in a repo checkout.
81
81
  VERIFY_SH=""
82
- for _v in "$SCRIPT_DIR/verify.sh" "$SCRIPT_DIR/../../runner/extension/verify.sh"; do
82
+ for _v in "$SCRIPT_DIR/verify.sh" "$SCRIPT_DIR/../../adapters/extension/verify.sh"; do
83
83
  [ -f "$_v" ] && { VERIFY_SH="$_v"; break; }
84
84
  done
85
85
  unset _v
@@ -92,7 +92,7 @@ RUNTIME_DIR="$(recipe_runtime_dir)"
92
92
  # Runner bin (installed wrapper → source runner). Used by the watch prepare path
93
93
  # to defer the cache-clear DECISION to `runtime-decision` (single source) and to
94
94
  # record the deps/cache baseline after a confirmed-good build.
95
- RUNNER_BIN="$(harness_dir "$TARGET" extension)/runner/bin/metamask-recipe"
95
+ RUNNER_BIN="$(harness_dir "$TARGET" extension)/runner/bin/mm-harness"
96
96
  OUT="${OUT:-$(harness_root)/extension/runner/recipes}"
97
97
  ARTIFACTS="${ARTIFACTS:-$(harness_dir "$TARGET" extension)/live/$(date -u +%Y%m%dT%H%M%SZ)}"
98
98
  mkdir -p "$ARTIFACTS/logs"
@@ -26,8 +26,8 @@ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
26
26
  function pathDefault(key) {
27
27
  for (const candidate of [
28
28
  path.join(scriptDir, 'lib/path-defaults.json'),
29
- path.join(scriptDir, '../lib/path-defaults.json'),
30
- path.join(scriptDir, '../../orchestration/lib/path-defaults.json'),
29
+ path.join(scriptDir, '../shared/path-defaults.json'),
30
+ path.join(scriptDir, '../../adapters/shared/path-defaults.json'),
31
31
  ]) {
32
32
  if (!fs.existsSync(candidate)) continue;
33
33
  const value = JSON.parse(fs.readFileSync(candidate, 'utf8'))[key];
@@ -110,7 +110,16 @@ function writeExtensionId(target, extensionId) {
110
110
  return true;
111
111
  }
112
112
 
113
+ // All callers target the local Chrome CDP endpoint (127.0.0.1:<cdpPort>).
114
+ // Validate before requesting so file-derived data cannot redirect to a remote host.
115
+ function assertLocalUrl(url) {
116
+ if (!/^http:\/\/127\.0\.0\.1:\d+\//u.test(url)) {
117
+ throw new Error(`readiness: refusing non-local URL: ${url}`);
118
+ }
119
+ }
120
+
113
121
  function httpJson(url, timeoutMs = 3000) {
122
+ assertLocalUrl(url);
114
123
  return new Promise((resolve, reject) => {
115
124
  const req = http.get(url, (res) => {
116
125
  let data = '';
@@ -134,6 +143,7 @@ function httpJson(url, timeoutMs = 3000) {
134
143
  }
135
144
 
136
145
  function httpJsonRequest(method, url, timeoutMs = 3000) {
146
+ assertLocalUrl(url);
137
147
  return new Promise((resolve, reject) => {
138
148
  const req = http.request(url, { method }, (res) => {
139
149
  let data = '';
@@ -85,7 +85,7 @@ fi
85
85
 
86
86
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
87
87
  # shellcheck disable=SC1091
88
- for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../lib/activate-repo-node.sh"; do
88
+ for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../shared/activate-repo-node.sh"; do
89
89
  [ -f "$_arn" ] && { . "$_arn"; break; }
90
90
  done
91
91
  unset _arn
@@ -115,7 +115,7 @@ resolve_fixture_script() {
115
115
  if [ "$SUBCOMMAND" = resolve ]; then
116
116
  RUNTIME_DIR=""
117
117
  # shellcheck disable=SC1091
118
- for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../lib/harness-path.sh"; do
118
+ for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
119
119
  [ -f "$_hp" ] && { . "$_hp"; break; }
120
120
  done
121
121
  unset _hp
@@ -9,7 +9,7 @@
9
9
  #
10
10
  # Inputs (flags / env):
11
11
  # --target <metamask-extension> (default $PWD; becomes the working dir)
12
- # --runtime-dir <rel> (default from orchestration/lib path-defaults)
12
+ # --runtime-dir <rel> (default from adapters/shared path-defaults)
13
13
  # --watcher-port <port> (default env WATCHER_PORT/RECIPE_WATCHER_PORT,
14
14
  # runtime json, or slot suffix e.g. metamask-extension-1 => 9011)
15
15
  # --runner-bin <path> (optional; records deps/cache baseline best-effort)
@@ -48,18 +48,18 @@ done
48
48
 
49
49
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
50
50
  # shellcheck disable=SC1091
51
- for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../lib/activate-repo-node.sh"; do
51
+ for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../shared/activate-repo-node.sh"; do
52
52
  [ -f "$_arn" ] && { . "$_arn"; break; }
53
53
  done
54
54
  unset _arn
55
55
  if [ -z "$RUNTIME_DIR" ]; then
56
56
  # shellcheck disable=SC1091
57
- for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../lib/harness-path.sh"; do
57
+ for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
58
58
  [ -f "$_hp" ] && { . "$_hp"; break; }
59
59
  done
60
60
  unset _hp
61
61
  if ! command -v recipe_runtime_dir >/dev/null 2>&1; then
62
- echo "start-watch: shared lib orchestration/lib/harness-path.sh not found; pass --runtime-dir." >&2
62
+ echo "start-watch: shared lib adapters/shared/harness-path.sh not found; pass --runtime-dir." >&2
63
63
  exit 1
64
64
  fi
65
65
  RUNTIME_DIR="$(recipe_runtime_dir)"
@@ -67,7 +67,7 @@ fi
67
67
 
68
68
  cd "$TARGET"
69
69
  REPO_NODE_PATH_PREFIX=""
70
- for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../lib/activate-repo-node.sh"; do
70
+ for _arn in "$SCRIPT_DIR/lib/activate-repo-node.sh" "$SCRIPT_DIR/../shared/activate-repo-node.sh"; do
71
71
  [ -f "$_arn" ] && { # shellcheck disable=SC1090
72
72
  . "$_arn"
73
73
  break
@@ -182,7 +182,7 @@ slot_number() {
182
182
 
183
183
  # Explicit clean-build path: clear the target-scoped webpack cache before
184
184
  # starting the harness-owned watcher. Faster incremental refresh stays on
185
- # `mme-recipe refresh`; this script is for proving a clean build works.
185
+ # `mm-harness refresh`; this script is for proving a clean build works.
186
186
  echo '[recipe-harness] clean build: clearing webpack cache + harness watcher'
187
187
  rm -rf node_modules/.cache/webpack
188
188
  killed_harness_pid=""
@@ -228,7 +228,7 @@ watch_log="$RUNTIME_DIR/recipe-harness-webpack.log"
228
228
  rm -f "$watch_pid_file"
229
229
  : > "$watch_log"
230
230
  LIB_DIR=""
231
- for _lib in "$SCRIPT_DIR/lib" "$SCRIPT_DIR/../lib"; do
231
+ for _lib in "$SCRIPT_DIR/lib" "$SCRIPT_DIR/../shared"; do
232
232
  [ -f "$_lib/log-tui.mjs" ] && LIB_DIR="$_lib" && break
233
233
  done
234
234
  unset _lib