@deeeed/metamask-harness 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +20 -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 +250 -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 +5 -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 +11 -3
  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 +25 -18
  54. package/src/commands/debug.ts +61 -0
  55. package/src/commands/fixtures.ts +196 -0
  56. package/{runner/src → src}/commands/launch.ts +185 -41
  57. package/src/commands/logs.ts +86 -0
  58. package/{runner/src → src}/commands/shared.ts +26 -26
  59. package/{runner/src → src}/harness.ts +97 -10
  60. package/src/index.ts +15 -0
  61. package/{runner/src → src}/live-adapter-contract.ts +1 -1
  62. package/{runner/src → src}/mm-harness-cli.ts +19 -3
  63. package/{runner/src → src}/paths.ts +2 -2
  64. package/{orchestration/lib/progress.mjs → src/progress.ts} +31 -21
  65. package/docs/extension-runtime-commands.md +0 -60
  66. package/docs/harness-cli.md +0 -43
  67. package/orchestration/compat-overlays/mobile/README.md +0 -13
  68. package/orchestration/doctor.mjs +0 -72
  69. package/orchestration/lib/cli-home.mjs +0 -354
  70. package/orchestration/lib/recipe-paths.mjs +0 -26
  71. package/orchestration/mobile/launch.sh +0 -137
  72. package/orchestration/mobile/live.sh +0 -125
  73. package/orchestration/porcelain/metamask-recipe +0 -99
  74. package/orchestration/porcelain/mm-recipe +0 -1591
  75. package/orchestration/porcelain/mme-recipe +0 -1181
  76. package/runner/src/commands/debug.ts +0 -44
  77. package/runner/src/commands/fixtures.ts +0 -99
  78. package/runner/src/commands/logs.ts +0 -60
  79. package/runner/src/index.ts +0 -6
  80. /package/{orchestration → adapters}/extension/launch-browser.cjs +0 -0
  81. /package/{orchestration → adapters}/extension/pin-remote-flags.cjs +0 -0
  82. /package/{orchestration → adapters}/extension/sidepanel-toggle.sh +0 -0
  83. /package/{orchestration → adapters}/extension/snapshot-dist.sh +0 -0
  84. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/cdp-eval.cjs +0 -0
  85. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/config.cjs +0 -0
  86. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/issue-capture.cjs +0 -0
  87. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/target-discovery.cjs +0 -0
  88. /package/{library/actions → adapters}/mobile/bridge-runtime/lib/ws-client.cjs +0 -0
  89. /package/{library/actions → adapters}/mobile/bridge-runtime/setup-wallet.sh +0 -0
  90. /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgentStepHud.tsx.patch +0 -0
  91. /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgenticService.ts.patch +0 -0
  92. /package/{orchestration/compat-overlays/mobile → adapters/mobile/overlay/compat}/rn81-message-event-source.patch +0 -0
  93. /package/{orchestration/lib → adapters/shared}/activate-repo-node.sh +0 -0
  94. /package/{orchestration/lib → adapters/shared}/ensure-runner-deps.sh +0 -0
  95. /package/{orchestration/lib → adapters/shared}/harness-path.sh +0 -0
  96. /package/{orchestration/lib → adapters/shared}/hash-helpers.sh +0 -0
  97. /package/{orchestration/lib → adapters/shared}/json-field.sh +0 -0
  98. /package/{orchestration/lib → adapters/shared}/path-defaults.json +0 -0
  99. /package/{orchestration → src/adapters}/extension/ensure-ready.ts +0 -0
  100. /package/{orchestration → src/adapters}/extension/extension-id.ts +0 -0
  101. /package/{orchestration → src/adapters}/mobile/deps-markers.ts +0 -0
  102. /package/{runner/src → src}/completions-cache.ts +0 -0
  103. /package/{runner/src → src}/doctor.ts +0 -0
  104. /package/{runner/src → src}/heal-bounds.ts +0 -0
  105. /package/{runner/src → src}/manifest.ts +0 -0
  106. /package/{runner/src → src}/recording-target.ts +0 -0
  107. /package/{runner/src → src}/run-recording.ts +0 -0
  108. /package/{runner/src → src}/runner.ts +0 -0
  109. /package/{runner/src → src}/types.ts +0 -0
@@ -1,26 +1,50 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "description": "Orchestration feature surface: one entry per feature script. orchestration/doctor.mjs verifies every entry point exists, answers --help with exit 0, and that no orchestration script is missing from this manifest.",
3
+ "description": "Adapter feature surface: one entry per feature script. scripts/adapter-surface-doctor.mjs verifies every entry point exists, answers --help with exit 0, and that no adapter script is missing from this manifest.",
4
4
  "features": [
5
5
  {
6
- "id": "mobile/launch",
7
- "entry": "orchestration/mobile/launch.sh",
6
+ "id": "mobile/yarn-setup",
7
+ "entry": "adapters/mobile/yarn-setup.sh",
8
8
  "kind": "bash",
9
- "purpose": "Mobile instance identity intake (port/simulator/adb/runtime-dir tuple) + prepare/preflight launch.",
10
- "inputs": "--target --platform --preflight-mode --port|--watcher-port|--cdp-port --simulator --adb-serial --runtime-dir --wallet-setup/--no-wallet-setup --wallet-fixture --artifacts-dir; env WATCHER_PORT>METRO_PORT>CDP_PORT, IOS_SIMULATOR>SIM_UDID, ADB_SERIAL>ANDROID_SERIAL, RECIPE_RUNTIME_DIR, RECIPE_HARNESS_MOBILE_PREFLIGHT_MODE",
11
- "outputs": "<artifacts>/summary.json, runtime-status.json, logs/prepare.log; exit 0/1/2"
9
+ "purpose": "Install node_modules for a MetaMask Mobile checkout (yarn setup + pod install on iOS).",
10
+ "inputs": "--target <metamask-mobile dir>; env MOBILE_SKIP_POD_INSTALL",
11
+ "outputs": "node_modules + ios/Pods; exit 0/1/2"
12
12
  },
13
13
  {
14
- "id": "mobile/live",
15
- "entry": "orchestration/mobile/live.sh",
14
+ "id": "mobile/start-metro",
15
+ "entry": "adapters/mobile/start-metro.sh",
16
16
  "kind": "bash",
17
- "purpose": "Launch-then-verify chaining for one mobile slot run (verify gets --no-auto-start).",
18
- "inputs": "--target --platform --preflight-mode --artifacts-dir --wallet-setup/--no-wallet-setup --wallet-fixture",
19
- "outputs": "<artifacts>/summary.json + launch/ + verify/; exit 0/1/2"
17
+ "purpose": "Ensure the Metro bundler is running for a MetaMask Mobile checkout (start, restart, or skip if valid).",
18
+ "inputs": "--target --port --clear; env WATCHER_PORT, METRO_PORT, MOBILE_METRO_REQUIRED_ENV, METRO_MAX_WORKERS",
19
+ "outputs": "Metro PID file + log; exit 0 ready / 1 timeout / 2 bad args"
20
+ },
21
+ {
22
+ "id": "mobile/prewarm-bundle",
23
+ "entry": "adapters/mobile/prewarm-bundle.sh",
24
+ "kind": "bash",
25
+ "purpose": "Curl the Metro bundle URL before the dev client opens to pre-compile and cache the bundle.",
26
+ "inputs": "--platform ios|android --target --port; env MOBILE_BUNDLE_PREWARM, MOBILE_BUNDLE_PREWARM_TIMEOUT",
27
+ "outputs": "progress on stderr; exit 0 bundle ready / 1 timeout / 2 bad args"
28
+ },
29
+ {
30
+ "id": "mobile/open-device",
31
+ "entry": "adapters/mobile/open-device.sh",
32
+ "kind": "bash",
33
+ "purpose": "Open the MetaMask Mobile dev client on a simulator or device via expo-development-client deep link.",
34
+ "inputs": "--platform ios|android --target --simulator --adb-serial --preflight-mode --port; env IOS_SIMULATOR, SIM_UDID, ADB_SERIAL, MOBILE_PREFLIGHT_MODE, WATCHER_PORT",
35
+ "outputs": "progress on stderr; exit 0 opened / 1 open failed / 2 bad args"
36
+ },
37
+ {
38
+ "id": "mobile/wait-for-bridge",
39
+ "entry": "adapters/mobile/wait-for-bridge.sh",
40
+ "kind": "bash",
41
+ "purpose": "Poll the CDP bridge (cdp-bridge.cjs status) until a route target registers; progressive diagnostics on failure.",
42
+ "inputs": "--target --port --max-polls; env WATCHER_PORT, MOBILE_BRIDGE_READY_POLLS",
43
+ "outputs": "progress on stderr; exit 0 bridge ready / 1 timeout"
20
44
  },
21
45
  {
22
46
  "id": "mobile/inject",
23
- "entry": "orchestration/mobile/inject.sh",
47
+ "entry": "adapters/mobile/inject.sh",
24
48
  "kind": "bash",
25
49
  "purpose": "Install the mobile harness overlay (delegate + snapshots; full mode adds the app bridge with backups).",
26
50
  "inputs": "--target --allow-dirty-harness-paths --force-overlay --no-git-exclude; env RECIPE_HARNESS_ROOT, METAMASK_RUNNER_PROTOCOL_ROOT>FARMSLOT_ROOT",
@@ -28,15 +52,23 @@
28
52
  },
29
53
  {
30
54
  "id": "mobile/cleanup",
31
- "entry": "orchestration/mobile/cleanup.sh",
55
+ "entry": "adapters/mobile/cleanup.sh",
32
56
  "kind": "bash",
33
57
  "purpose": "Remove the mobile overlay; restore backed-up product files; remove recorded git excludes.",
34
58
  "inputs": "--target --allow-managed-changes; env RECIPE_HARNESS_ROOT",
35
59
  "outputs": "removes <harness>/ + backups; exit 0/1/2"
36
60
  },
61
+ {
62
+ "id": "mobile/verify",
63
+ "entry": "adapters/mobile/verify.sh",
64
+ "kind": "bash",
65
+ "purpose": "Verify the mobile harness/runtime is present and healthy (no app launch).",
66
+ "inputs": "--target --artifacts-dir --static-only --platform ios|android --preflight-mode --no-auto-start",
67
+ "outputs": "verify report + evidence; exit 0/1/2"
68
+ },
37
69
  {
38
70
  "id": "extension/launch",
39
- "entry": "orchestration/extension/launch.sh",
71
+ "entry": "adapters/extension/launch.sh",
40
72
  "kind": "bash",
41
73
  "purpose": "Run the caller-supplied prepare command for one slot, then confirm app-control readiness.",
42
74
  "inputs": "--target --cdp-port --prepare-cmd --artifacts-dir; env RECIPE_HARNESS_EXTENSION_LAUNCH_CMD",
@@ -44,15 +76,23 @@
44
76
  },
45
77
  {
46
78
  "id": "extension/live",
47
- "entry": "orchestration/extension/live.sh",
79
+ "entry": "adapters/extension/live.sh",
48
80
  "kind": "bash",
49
81
  "purpose": "Sequencer: builds the prepare command from the named feature scripts, then launch + verify.",
50
82
  "inputs": "--target --cdp-port --launch-existing-dist|--start-watch|--prepare-cmd --dist-dir --chrome-user-data-dir --out --artifacts-dir; env RECIPE_HARNESS_CHROME_BIN, RECIPE_WALLET_FIXTURE, RECIPE_HARNESS_LIVE_KEEP",
51
83
  "outputs": "<artifacts>/summary.json + launch/ + verify/ + logs/fixture-source.json; exit 0/1/2"
52
84
  },
85
+ {
86
+ "id": "extension/verify",
87
+ "entry": "adapters/extension/verify.sh",
88
+ "kind": "bash",
89
+ "purpose": "Verify the extension harness/runtime is present and healthy (no app launch).",
90
+ "inputs": "--target --out --cdp-port --static-only",
91
+ "outputs": "verify report + evidence; exit 0/1/2"
92
+ },
53
93
  {
54
94
  "id": "extension/start-watch",
55
- "entry": "orchestration/extension/start-watch.sh",
95
+ "entry": "adapters/extension/start-watch.sh",
56
96
  "kind": "bash",
57
97
  "purpose": "Harness-owned webpack watcher: cache clear, dual-writer refusal, compile-marker wait, baseline record.",
58
98
  "inputs": "--target --runtime-dir --runner-bin --summary",
@@ -60,7 +100,7 @@
60
100
  },
61
101
  {
62
102
  "id": "extension/console-tail",
63
- "entry": "orchestration/extension/console-tail.mjs",
103
+ "entry": "adapters/extension/console-tail.mjs",
64
104
  "kind": "node",
65
105
  "purpose": "Live CDP stream of the running extension console (MV3 service worker + UI pages), re-attaching across service-worker churn; hosts the console tmux tab.",
66
106
  "inputs": "--cdp-port [--log <file>]",
@@ -68,7 +108,7 @@
68
108
  },
69
109
  {
70
110
  "id": "extension/snapshot-dist",
71
- "entry": "orchestration/extension/snapshot-dist.sh",
111
+ "entry": "adapters/extension/snapshot-dist.sh",
72
112
  "kind": "bash",
73
113
  "purpose": "Runtime-dist snapshot (rsync, excludes _metadata) with from-git-id freshness guard.",
74
114
  "inputs": "--dist --runtime-dist --wait-iterations --summary",
@@ -76,7 +116,7 @@
76
116
  },
77
117
  {
78
118
  "id": "extension/seed-fixture",
79
- "entry": "orchestration/extension/seed-fixture.sh",
119
+ "entry": "adapters/extension/seed-fixture.sh",
80
120
  "kind": "bash",
81
121
  "purpose": "Wallet fixture resolution chain + generate/prefill (pre-launch) and seed-cdp (post-launch) phases.",
82
122
  "inputs": "resolve|prefill|seed-cdp; --target --cdp-port --fixture --state --profile --extension-dir --extension-id-file --out --source-out --fixture-script --summary; env RECIPE_WALLET_FIXTURE",
@@ -84,7 +124,7 @@
84
124
  },
85
125
  {
86
126
  "id": "extension/launch-browser",
87
- "entry": "orchestration/extension/launch-browser.cjs",
127
+ "entry": "adapters/extension/launch-browser.cjs",
88
128
  "kind": "node",
89
129
  "purpose": "Low-level spawn primitive: detached Chrome with isolated profile, CDP on 127.0.0.1, unpacked dist.",
90
130
  "inputs": "--cdp-port --chrome-bin --profile --extension-dir --chrome-log --chrome-pid",
@@ -92,7 +132,7 @@
92
132
  },
93
133
  {
94
134
  "id": "extension/refresh-build",
95
- "entry": "orchestration/extension/refresh-build.sh",
135
+ "entry": "adapters/extension/refresh-build.sh",
96
136
  "kind": "bash",
97
137
  "purpose": "One-shot rebuild for a frozen slot: yarn start, wait for entry points, kill watcher (fresh AND frozen).",
98
138
  "inputs": "--repo --watcher-port --timeout --clean-timeout",
@@ -100,7 +140,7 @@
100
140
  },
101
141
  {
102
142
  "id": "extension/ensure-browser",
103
- "entry": "orchestration/extension/ensure-browser.sh",
143
+ "entry": "adapters/extension/ensure-browser.sh",
104
144
  "kind": "bash",
105
145
  "purpose": "Ensure the slot's Chromium is running against the existing dist/profile/port (kills + relaunches).",
106
146
  "inputs": "--slot-id --repo --cdp-port --runtime-dir --watcher-port; env CHROME_USER_DATA_DIR, RECIPE_HARNESS_ROOT",
@@ -108,7 +148,7 @@
108
148
  },
109
149
  {
110
150
  "id": "extension/inject",
111
- "entry": "orchestration/extension/inject.mjs",
151
+ "entry": "adapters/extension/inject.mjs",
112
152
  "kind": "node",
113
153
  "purpose": "Install the extension harness overlay (delegate, manifests, recipes, helper scripts).",
114
154
  "inputs": "--target --no-git-exclude; env RECIPE_HARNESS_ROOT, METAMASK_RUNNER_DIR, METAMASK_RUNNER_PROTOCOL_ROOT>FARMSLOT_ROOT",
@@ -116,7 +156,7 @@
116
156
  },
117
157
  {
118
158
  "id": "extension/cleanup",
119
- "entry": "orchestration/extension/cleanup.mjs",
159
+ "entry": "adapters/extension/cleanup.mjs",
120
160
  "kind": "node",
121
161
  "purpose": "Remove the extension overlay and exactly the recorded git-exclude entries.",
122
162
  "inputs": "--target; env RECIPE_HARNESS_ROOT",
@@ -124,7 +164,7 @@
124
164
  },
125
165
  {
126
166
  "id": "extension/sidepanel-toggle",
127
- "entry": "orchestration/extension/sidepanel-toggle.sh",
167
+ "entry": "adapters/extension/sidepanel-toggle.sh",
128
168
  "kind": "bash",
129
169
  "purpose": "Window-mode control for the extension instance: chrome.sidePanel status/open/close/toggle/cycle over the instance's CDP port.",
130
170
  "inputs": "<status|open|close|toggle|cycle> --cdp-port --ext-id --agent-dir --settle-ms; env REPO, CDP_PORT, EXT_ID, SETTLE_MS, AGENT_DIR",
@@ -132,7 +172,7 @@
132
172
  },
133
173
  {
134
174
  "id": "extension/pin-remote-flags",
135
- "entry": "orchestration/extension/pin-remote-flags.cjs",
175
+ "entry": "adapters/extension/pin-remote-flags.cjs",
136
176
  "kind": "lib",
137
177
  "purpose": "Pin A/B remote feature-flag variants into an extension manifest _flags before runtime-dist launch.",
138
178
  "inputs": "<manifest.json> <KEY=VARIANT[,KEY=VARIANT...]>",
@@ -140,7 +180,7 @@
140
180
  },
141
181
  {
142
182
  "id": "extension/readiness",
143
- "entry": "orchestration/extension/readiness.mjs",
183
+ "entry": "adapters/extension/readiness.mjs",
144
184
  "kind": "node",
145
185
  "purpose": "Health probe for one extension instance: dist entry files + live CDP target, repairs <runtime-dir>/extension.id.",
146
186
  "inputs": "--target --cdp-port --json; env RECIPE_RUNTIME_DIR",
@@ -148,7 +188,7 @@
148
188
  },
149
189
  {
150
190
  "id": "extension/wallet-fixture-state",
151
- "entry": "orchestration/extension/wallet-fixture-state.cjs",
191
+ "entry": "adapters/extension/wallet-fixture-state.cjs",
152
192
  "kind": "node",
153
193
  "purpose": "Instance wallet state: generate deterministic state from a fixture, prefill the Chrome profile, seed/validate over CDP.",
154
194
  "inputs": "generate|prefill-profile|seed-cdp + flags per usage(); env RECIPE_RUNTIME_DIR",
@@ -156,7 +196,7 @@
156
196
  },
157
197
  {
158
198
  "id": "extension/extension-id",
159
- "entry": "orchestration/extension/extension-id.ts",
199
+ "entry": "src/adapters/extension/extension-id.ts",
160
200
  "kind": "module",
161
201
  "purpose": "Deterministic CRX id resolution from the loaded dist manifest key (TS module used by the runner CLI).",
162
202
  "inputs": "resolveExtensionId(target)",
@@ -164,7 +204,7 @@
164
204
  },
165
205
  {
166
206
  "id": "extension/ensure-ready",
167
- "entry": "orchestration/extension/ensure-ready.ts",
207
+ "entry": "src/adapters/extension/ensure-ready.ts",
168
208
  "kind": "module",
169
209
  "purpose": "Ensure the extension runtime is attachable (TS module used by the runner CLI).",
170
210
  "inputs": "ensureExtensionReady(...)",
@@ -172,7 +212,7 @@
172
212
  },
173
213
  {
174
214
  "id": "extension/runtime",
175
- "entry": "orchestration/extension/runtime.ts",
215
+ "entry": "src/adapters/extension/runtime.ts",
176
216
  "kind": "module",
177
217
  "purpose": "Extension runtime prepare/health over CDP (TS module used by the runner CLI).",
178
218
  "inputs": "prepareExtensionRuntime/checkExtensionRuntimeHealth",
@@ -180,7 +220,7 @@
180
220
  },
181
221
  {
182
222
  "id": "extension/runtime-decision",
183
- "entry": "orchestration/extension/runtime-decision.ts",
223
+ "entry": "src/adapters/extension/runtime-decision.ts",
184
224
  "kind": "module",
185
225
  "purpose": "Cache/deps baseline + readiness decision (TS module used by the runner CLI).",
186
226
  "inputs": "decideExtensionReadiness(...)",
@@ -188,7 +228,7 @@
188
228
  },
189
229
  {
190
230
  "id": "mobile/runtime-decision",
191
- "entry": "orchestration/mobile/runtime-decision.ts",
231
+ "entry": "src/adapters/mobile/runtime-decision.ts",
192
232
  "kind": "module",
193
233
  "purpose": "Mobile deps + Metro bundle readiness decision (parity with extension runtime-decision).",
194
234
  "inputs": "decideMobileReadiness(...)",
@@ -196,7 +236,7 @@
196
236
  },
197
237
  {
198
238
  "id": "mobile/deps-markers",
199
- "entry": "orchestration/mobile/deps-markers.ts",
239
+ "entry": "src/adapters/mobile/deps-markers.ts",
200
240
  "kind": "module",
201
241
  "purpose": "MetaMask Mobile product/native marker tables for harness deps-readiness.",
202
242
  "inputs": "mobileProductMarkers(platform?)",
@@ -204,7 +244,7 @@
204
244
  },
205
245
  {
206
246
  "id": "core/inject",
207
- "entry": "orchestration/core/inject.sh",
247
+ "entry": "adapters/core/inject.sh",
208
248
  "kind": "bash",
209
249
  "purpose": "Headless core adapter install: overlay metadata + runner delegate only (no product writes).",
210
250
  "inputs": "--target; env RECIPE_HARNESS_ROOT, METAMASK_RUNNER_PROTOCOL_ROOT>FARMSLOT_ROOT",
@@ -212,7 +252,7 @@
212
252
  },
213
253
  {
214
254
  "id": "core/cleanup",
215
- "entry": "orchestration/core/cleanup.sh",
255
+ "entry": "adapters/core/cleanup.sh",
216
256
  "kind": "bash",
217
257
  "purpose": "Remove the core overlay dir (idempotent; nothing to restore).",
218
258
  "inputs": "--target; env RECIPE_HARNESS_ROOT",
@@ -220,7 +260,7 @@
220
260
  },
221
261
  {
222
262
  "id": "lib/harness-path",
223
- "entry": "orchestration/lib/harness-path.sh",
263
+ "entry": "adapters/shared/harness-path.sh",
224
264
  "kind": "lib",
225
265
  "purpose": "THE one sourceable lib: harness root/dir + runtime dir resolution with path validation.",
226
266
  "inputs": "env RECIPE_HARNESS_ROOT, RECIPE_RUNTIME_DIR (validated relative paths)",
@@ -228,7 +268,7 @@
228
268
  },
229
269
  {
230
270
  "id": "lib/hash-helpers",
231
- "entry": "orchestration/lib/hash-helpers.sh",
271
+ "entry": "adapters/shared/hash-helpers.sh",
232
272
  "kind": "lib",
233
273
  "purpose": "Overlay file hash markers (digest_file/digest_stdin/hash_path) for safe re-install/cleanup.",
234
274
  "inputs": "TARGET env var (hash_path)",
@@ -236,23 +276,15 @@
236
276
  },
237
277
  {
238
278
  "id": "lib/json-field",
239
- "entry": "orchestration/lib/json-field.sh",
279
+ "entry": "adapters/shared/json-field.sh",
240
280
  "kind": "lib",
241
281
  "purpose": "read_runtime_context_field: dotted-path JSON reader for harness scripts.",
242
282
  "inputs": "json path + dotted field",
243
283
  "outputs": "field value on stdout"
244
284
  },
245
- {
246
- "id": "lib/recipe-paths",
247
- "entry": "orchestration/lib/recipe-paths.mjs",
248
- "kind": "lib",
249
- "purpose": "ESM mirror of harness-path defaults/validation for node scripts.",
250
- "inputs": "env RECIPE_HARNESS_ROOT, RECIPE_RUNTIME_DIR",
251
- "outputs": "recipeHarnessRoot()/recipeRuntimeDir() exports"
252
- },
253
285
  {
254
286
  "id": "lib/activate-repo-node",
255
- "entry": "orchestration/lib/activate-repo-node.sh",
287
+ "entry": "adapters/shared/activate-repo-node.sh",
256
288
  "kind": "lib",
257
289
  "purpose": "Manager-agnostic Node pin from .nvmrc / .tool-versions for non-interactive yarn/webpack spawns (tmux, nohup).",
258
290
  "inputs": "activate_repo_node [target-dir]; tries asdf, fnm, mise, nvm, then matching node on PATH",
@@ -260,7 +292,7 @@
260
292
  },
261
293
  {
262
294
  "id": "lib/ensure-runner-deps",
263
- "entry": "orchestration/lib/ensure-runner-deps.sh",
295
+ "entry": "adapters/shared/ensure-runner-deps.sh",
264
296
  "kind": "lib",
265
297
  "purpose": "Idempotent install of runner npm deps (@farmslot/recipe-harness) for cloned checkouts with no node_modules; uses npm so parent product .yarnrc.yml does not block install.",
266
298
  "inputs": "ensure-runner-deps.sh [RUNNER_DIR]; env FARMSLOT_ROOT / METAMASK_RUNNER_PROTOCOL_ROOT optional local link target",
@@ -268,55 +300,39 @@
268
300
  },
269
301
  {
270
302
  "id": "lib/resolve-farmslot-ports",
271
- "entry": "orchestration/lib/resolve-farmslot-ports.sh",
303
+ "entry": "adapters/shared/resolve-farmslot-ports.sh",
272
304
  "kind": "lib",
273
305
  "purpose": "Resolve CDP + watcher ports from farmslot pool JSON by repo path, else 6660+N / 9010+N.",
274
306
  "inputs": "resolve_extension_runtime_ports <repo>",
275
307
  "outputs": "CDP_PORT / WATCHER_PORT / SLOT_ID lines on stdout"
276
308
  },
309
+ {
310
+ "id": "lib/sync-wallet-fixture",
311
+ "entry": "adapters/shared/sync-wallet-fixture.sh",
312
+ "kind": "bash",
313
+ "purpose": "Copy wallet fixture to the canonical runtime slot after overlay install.",
314
+ "inputs": "--target <checkout> --slot-id <id> --cdp-port <port>",
315
+ "outputs": "wallet-fixture.json in runtime dir; exit 0 always (non-zero = informational, no source found)"
316
+ },
277
317
  {
278
318
  "id": "lib/path-defaults",
279
- "entry": "orchestration/lib/path-defaults.json",
319
+ "entry": "adapters/shared/path-defaults.json",
280
320
  "kind": "data",
281
321
  "purpose": "Single source for the default harness root and runtime dir.",
282
322
  "inputs": "none",
283
323
  "outputs": "recipeHarnessRoot / recipeRuntimeDir defaults"
284
324
  },
285
- {
286
- "id": "lib/cli-color",
287
- "entry": "orchestration/lib/cli-color.mjs",
288
- "kind": "lib",
289
- "purpose": "Shared ANSI styling for recipe CLI human output (NO_COLOR / TTY aware).",
290
- "inputs": "import { color, colorLogEvent, ... }",
291
- "outputs": "styled strings for home, logs, and progress views"
292
- },
293
- {
294
- "id": "lib/cli-home",
295
- "entry": "orchestration/lib/cli-home.mjs",
296
- "kind": "lib",
297
- "purpose": "Recipe CLI home screen and ports output for mm-recipe / mme-recipe wrappers.",
298
- "inputs": "--adapter extension|mobile --target --cdp-port --watcher-port [--harness-stale] [--json]",
299
- "outputs": "human home/ports screen or JSON payload on stdout"
300
- },
301
325
  {
302
326
  "id": "lib/cli-ux",
303
- "entry": "orchestration/lib/cli-ux.sh",
327
+ "entry": "adapters/shared/cli-ux.sh",
304
328
  "kind": "lib",
305
329
  "purpose": "Shared bash UX helpers: progress, log-tui watch, failure playbooks, harness stale warnings.",
306
- "inputs": "sourced by bin/mm-recipe and bin/mme-recipe",
330
+ "inputs": "sourced by adapters that invoke recipe CLI commands",
307
331
  "outputs": "recipe_progress / recipe_watch_rebuild_log / recipe_failure_playbook functions"
308
332
  },
309
- {
310
- "id": "lib/cli-version",
311
- "entry": "orchestration/lib/cli-version.mjs",
312
- "kind": "node",
313
- "purpose": "Detect stale installed harness scripts vs the active runner revision.",
314
- "inputs": "check --runner-root --manifest [--installed-sha] [--json]",
315
- "outputs": "stale boolean + details on stdout/stderr; exit 0"
316
- },
317
333
  {
318
334
  "id": "lib/log-tui",
319
- "entry": "orchestration/lib/log-tui.mjs",
335
+ "entry": "adapters/shared/log-tui.mjs",
320
336
  "kind": "node",
321
337
  "purpose": "Compact build-log UX: last N significant events plus pointer to full log.",
322
338
  "inputs": "watch|tail|events --log <path> [--events <n>] [--mode compact|full|quiet] [--json]",
@@ -324,31 +340,15 @@
324
340
  },
325
341
  {
326
342
  "id": "lib/open-debug",
327
- "entry": "orchestration/lib/open-debug.mjs",
343
+ "entry": "adapters/shared/open-debug.mjs",
328
344
  "kind": "node",
329
345
  "purpose": "Open human-facing debugger UIs for extension CDP or mobile Metro runtimes.",
330
346
  "inputs": "--adapter extension|mobile [--cdp-port|--port] [--target page|worker] [--json] [--no-open]",
331
347
  "outputs": "debug URL/report on stdout; exit 0/1"
332
348
  },
333
- {
334
- "id": "lib/progress",
335
- "entry": "orchestration/lib/progress.mjs",
336
- "kind": "node",
337
- "purpose": "Structured progress events for long recipe CLI operations (emit/done).",
338
- "inputs": "emit|done --verb --phase|--status --message [--elapsed-ms] [--json]",
339
- "outputs": "human or JSONL progress line on stderr"
340
- },
341
- {
342
- "id": "lib/cli-commands",
343
- "entry": "orchestration/lib/cli-commands.mjs",
344
- "kind": "lib",
345
- "purpose": "Single source of truth for recipe CLI command/flag completion metadata.",
346
- "inputs": "dump|describe|flags|args|global-flags --adapter extension|mobile|shim",
347
- "outputs": "completion tokens on stdout for shell scripts"
348
- },
349
349
  {
350
350
  "id": "compat-overlays/mobile",
351
- "entry": "orchestration/compat-overlays/mobile",
351
+ "entry": "adapters/mobile/overlay/compat",
352
352
  "kind": "compat-overlay",
353
353
  "purpose": "Historical-commit replay support: reversible source overlays (e.g. rn81-message-event-source.patch) applied manually/via the recipe-harness skill so pre-RN-0.81 mobile checkouts boot and bridge under the current toolchain.",
354
354
  "inputs": "manual `git apply` in the historical product checkout (no in-repo apply logic)",
@@ -4,10 +4,10 @@
4
4
  * CDP Bridge — Connect to the running MetaMask app via Hermes Chrome DevTools Protocol.
5
5
  *
6
6
  * Usage:
7
- * node library/actions/mobile/bridge-runtime/cdp-bridge.cjs navigate PerpsMarketListView
8
- * node library/actions/mobile/bridge-runtime/cdp-bridge.cjs get-route
9
- * node library/actions/mobile/bridge-runtime/cdp-bridge.cjs get-state "engine.backgroundState.NetworkController"
10
- * node library/actions/mobile/bridge-runtime/cdp-bridge.cjs eval "1+1"
7
+ * node adapters/mobile/bridge-runtime/cdp-bridge.cjs navigate PerpsMarketListView
8
+ * node adapters/mobile/bridge-runtime/cdp-bridge.cjs get-route
9
+ * node adapters/mobile/bridge-runtime/cdp-bridge.cjs get-state "engine.backgroundState.NetworkController"
10
+ * node adapters/mobile/bridge-runtime/cdp-bridge.cjs eval "1+1"
11
11
  *
12
12
  * Environment:
13
13
  * WATCHER_PORT Metro port (default: 8081, read from .js.env if present)
@@ -597,7 +597,7 @@ async function main() {
597
597
  console.log(`CDP Bridge — interact with the running MetaMask app via Hermes CDP
598
598
 
599
599
  Usage:
600
- node library/actions/mobile/bridge-runtime/cdp-bridge.cjs <command> [args...]
600
+ node adapters/mobile/bridge-runtime/cdp-bridge.cjs <command> [args...]
601
601
 
602
602
  Commands:
603
603
  navigate <RouteName> [params-json] Navigate to a screen
@@ -34,14 +34,14 @@ done
34
34
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
35
35
  TARGET="$(cd "$TARGET" && pwd)"
36
36
  # shellcheck disable=SC1091
37
- . "$SCRIPT_DIR/../lib/hash-helpers.sh"
37
+ . "$SCRIPT_DIR/../shared/hash-helpers.sh"
38
38
  # shellcheck disable=SC1091
39
- for _hp in "$SCRIPT_DIR/../lib/harness-path.sh"; do
39
+ for _hp in "$SCRIPT_DIR/../shared/harness-path.sh"; do
40
40
  [ -f "$_hp" ] && { . "$_hp"; break; }
41
41
  done
42
42
  unset _hp
43
43
  if ! command -v harness_root >/dev/null 2>&1; then
44
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
44
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
45
45
  exit 1
46
46
  fi
47
47
  HARNESS_DIR="$(harness_dir "$TARGET" mobile)"
@@ -42,21 +42,21 @@ done
42
42
 
43
43
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
44
44
  RUNNER_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd -P)"
45
- ADAPTER_DIR="$RUNNER_DIR/library/actions/mobile"
46
- # compat-overlays: NOT applied here. orchestration/compat-overlays/ holds
45
+ ADAPTER_DIR="$RUNNER_DIR/adapters/mobile"
46
+ # compat-overlays: NOT applied here. adapters/mobile/overlay/compat/ holds
47
47
  # reversible patches applied only when injecting into HISTORICAL checkouts
48
48
  # (replay/eval against old product commits, e.g. pre-RN-0.81 mobile); the
49
49
  # operator/recipe-harness skill applies them manually before the rebuild.
50
- # See orchestration/compat-overlays/README.md.
50
+ # See adapters/mobile/overlay/compat/README.md.
51
51
  # shellcheck disable=SC1091
52
- . "$SCRIPT_DIR/../lib/hash-helpers.sh"
52
+ . "$SCRIPT_DIR/../shared/hash-helpers.sh"
53
53
  # shellcheck disable=SC1091
54
- for _hp in "$SCRIPT_DIR/../lib/harness-path.sh"; do
54
+ for _hp in "$SCRIPT_DIR/../shared/harness-path.sh"; do
55
55
  [ -f "$_hp" ] && { . "$_hp"; break; }
56
56
  done
57
57
  unset _hp
58
58
  if ! command -v harness_root >/dev/null 2>&1; then
59
- echo "mm-harness: shared lib orchestration/lib/harness-path.sh not found; reinstall the runner." >&2
59
+ echo "mm-harness: shared lib adapters/shared/harness-path.sh not found; reinstall the runner." >&2
60
60
  exit 1
61
61
  fi
62
62
  TARGET="$(cd "$TARGET" && pwd)"
@@ -134,7 +134,7 @@ install_v1_runner_assets() {
134
134
  # quote — cannot break the generated wrapper or inject at runtime.
135
135
  local runner_protocol_root_q runner_exec_q target_q
136
136
  runner_protocol_root_q="$(printf '%q' "$METAMASK_RUNNER_PROTOCOL_ROOT")"
137
- runner_exec_q="$(printf '%q' "$METAMASK_RUNNER_DIR/orchestration/porcelain/metamask-recipe")"
137
+ runner_exec_q="$(printf '%q' "$METAMASK_RUNNER_DIR/bin/mm-harness")"
138
138
  target_q="$(printf '%q' "$TARGET")"
139
139
  {
140
140
  printf '%s\n' '#!/usr/bin/env bash'
@@ -175,8 +175,8 @@ install_v1_runner_assets() {
175
175
  printf 'export FARMSLOT_ROOT=${FARMSLOT_ROOT:-%s}\n' "$runner_protocol_root_q"
176
176
  fi
177
177
  printf 'exec %s "$@"\n' "$runner_exec_q"
178
- } > "$HARNESS_DIR/runner/bin/metamask-recipe"
179
- chmod +x "$HARNESS_DIR/runner/bin/metamask-recipe"
178
+ } > "$HARNESS_DIR/runner/bin/mm-harness"
179
+ chmod +x "$HARNESS_DIR/runner/bin/mm-harness"
180
180
  if [ -n "$METAMASK_RUNNER_PROTOCOL_ROOT" ]; then
181
181
  printf '%s\n' "$METAMASK_RUNNER_PROTOCOL_ROOT" > "$HARNESS_DIR/runner/.farmslot-root"
182
182
  fi
@@ -199,19 +199,19 @@ install_v1_runner_assets() {
199
199
  # Installed-layout back-compat (INTENTIONAL): targets keep a flat
200
200
  # <harness>/scripts/ subtree assembled from the runner trees, so installed
201
201
  # consumers are unaffected by runner-repo layout changes.
202
- if [ -d "$METAMASK_RUNNER_DIR/orchestration/mobile" ]; then
202
+ if [ -d "$METAMASK_RUNNER_DIR/adapters/mobile" ]; then
203
203
  mkdir -p "$HARNESS_DIR/scripts"
204
- cp "$METAMASK_RUNNER_DIR/orchestration/mobile/launch.sh" "$HARNESS_DIR/scripts/launch.sh"
205
- cp "$METAMASK_RUNNER_DIR/orchestration/mobile/live.sh" "$HARNESS_DIR/scripts/live.sh"
206
- cp "$METAMASK_RUNNER_DIR/runner/mobile/verify.sh" "$HARNESS_DIR/scripts/verify.sh"
204
+ # launch and live orchestration is now in-process (src/harness.ts + src/adapters/mobile/prepare.ts).
205
+ # Remove any copies left by older installs so stale scripts cannot shadow the in-process path.
206
+ rm -f "$HARNESS_DIR/scripts/launch.sh" "$HARNESS_DIR/scripts/live.sh"
207
+ cp "$METAMASK_RUNNER_DIR/adapters/mobile/verify.sh" "$HARNESS_DIR/scripts/verify.sh"
207
208
  mkdir -p "$HARNESS_DIR/scripts/lib"
208
- cp "$METAMASK_RUNNER_DIR/orchestration/lib/harness-path.sh" "$HARNESS_DIR/scripts/lib/harness-path.sh"
209
- cp "$METAMASK_RUNNER_DIR/orchestration/lib/path-defaults.json" "$HARNESS_DIR/scripts/lib/path-defaults.json"
210
- cp "$METAMASK_RUNNER_DIR/orchestration/lib/recipe-paths.mjs" "$HARNESS_DIR/scripts/lib/recipe-paths.mjs"
209
+ cp "$METAMASK_RUNNER_DIR/adapters/shared/harness-path.sh" "$HARNESS_DIR/scripts/lib/harness-path.sh"
210
+ cp "$METAMASK_RUNNER_DIR/adapters/shared/path-defaults.json" "$HARNESS_DIR/scripts/lib/path-defaults.json"
211
211
  chmod -R u+rwX,go+rX "$HARNESS_DIR/scripts"
212
212
  find "$HARNESS_DIR/scripts" -type f \( -name '*.sh' -o -name '*.cjs' -o -name '*.mjs' \) -exec chmod +x {} +
213
213
  fi
214
- if [ ! -x "$HARNESS_DIR/runner/bin/metamask-recipe" ]; then
214
+ if [ ! -x "$HARNESS_DIR/runner/bin/mm-harness" ]; then
215
215
  echo "Refusing mobile recipe harness install: failed to make runner executable." >&2
216
216
  return 1
217
217
  fi
@@ -288,10 +288,8 @@ if [ "$FORCE_OVERLAY" = false ] && has_product_owned_mobile_harness; then
288
288
  target,
289
289
  protocolVersion: "v1",
290
290
  actionManifestPath: harnessRel + "/action-manifest.json",
291
- runnerEntrypoint: harnessRel + "/runner/bin/metamask-recipe",
291
+ runnerEntrypoint: harnessRel + "/runner/bin/mm-harness",
292
292
  runtimeHelpers: {
293
- launch: harnessRel + "/scripts/launch.sh",
294
- live: harnessRel + "/scripts/live.sh",
295
293
  verify: harnessRel + "/scripts/verify.sh"
296
294
  },
297
295
  installedPaths: [],
@@ -527,7 +525,7 @@ install_v1_runner_assets
527
525
 
528
526
  mkdir -p "$TARGET/app/dev-tools/AgenticService"
529
527
  while IFS= read -r -d '' overlay_file; do
530
- rel="${overlay_file#$ADAPTER_DIR/app-overlay/app/dev-tools/AgenticService/}"
528
+ rel="${overlay_file#$ADAPTER_DIR/overlay/app/dev-tools/AgenticService/}"
531
529
  dest_rel="${rel%.patch}"
532
530
  dest="$TARGET/app/dev-tools/AgenticService/$dest_rel"
533
531
  mkdir -p "$(dirname "$dest")"
@@ -537,7 +535,7 @@ while IFS= read -r -d '' overlay_file; do
537
535
  # Exclude overlay *.test.* files: they are source tests for the overlay
538
536
  # templates and must not ship into the product checkout, where the product's
539
537
  # jest could pick them up on local runs.
540
- done < <(find "$ADAPTER_DIR/app-overlay/app/dev-tools/AgenticService" -type f ! -name '*.test.*' -print0)
538
+ done < <(find "$ADAPTER_DIR/overlay/app/dev-tools/AgenticService" -type f ! -name '*.test.*' -print0)
541
539
 
542
540
  node - "$TARGET" <<'NODE'
543
541
  const fs = require('fs');
@@ -654,7 +652,7 @@ node -e '
654
652
  target,
655
653
  protocolVersion: "v1",
656
654
  actionManifestPath: harnessRel + "/action-manifest.json",
657
- runnerEntrypoint: harnessRel + "/runner/bin/metamask-recipe",
655
+ runnerEntrypoint: harnessRel + "/runner/bin/mm-harness",
658
656
  runtimeHelpers: {
659
657
  launch: harnessRel + "/scripts/launch.sh",
660
658
  live: harnessRel + "/scripts/live.sh",
@@ -673,7 +671,7 @@ node -e '
673
671
  fs.writeFileSync(manifestPath, JSON.stringify(m, null, 2) + "\n");
674
672
  ' "$RUNNER_DIR" "$SOURCE_REV" "$METAMASK_RUNNER_DIR" "$METAMASK_RUNNER_REVISION" "$METAMASK_RUNNER_SOURCE_KIND" "$ADAPTER_DIR" "$TARGET" "$BACKUP_DIR" "$SCRIPT_DIR" "$HARNESS_DIR/manifest.json" "${MOBILE_AGENTIC_SOURCE:-}" "$HARNESS_ROOT" "$HARNESS_REL" "$CLEANUP_COMMAND"
675
673
 
676
- ENSURE_DEPS="$SCRIPT_DIR/../lib/ensure-runner-deps.sh"
674
+ ENSURE_DEPS="$SCRIPT_DIR/../shared/ensure-runner-deps.sh"
677
675
  if [ -f "$ENSURE_DEPS" ]; then
678
676
  bash "$ENSURE_DEPS" "$RUNNER_DIR"
679
677
  fi