@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.
- package/CHANGELOG.md +33 -0
- package/README.md +47 -17
- package/{orchestration → adapters}/core/cleanup.sh +2 -2
- package/{orchestration → adapters}/core/inject.sh +8 -8
- package/{orchestration → adapters}/extension/cleanup.mjs +1 -1
- package/{orchestration → adapters}/extension/console-tail.mjs +3 -0
- package/{orchestration → adapters}/extension/ensure-browser.sh +4 -4
- package/{orchestration → adapters}/extension/inject.mjs +27 -31
- package/{orchestration → adapters}/extension/launch.sh +4 -4
- package/{orchestration → adapters}/extension/live.sh +5 -5
- package/{orchestration → adapters}/extension/readiness.mjs +12 -2
- package/{orchestration → adapters}/extension/refresh-build.sh +1 -1
- package/{orchestration → adapters}/extension/seed-fixture.sh +1 -1
- package/{orchestration → adapters}/extension/start-watch.sh +7 -7
- package/{runner → adapters}/extension/verify.sh +11 -11
- package/{orchestration → adapters}/extension/wallet-fixture-state.cjs +2 -2
- package/{orchestration → adapters}/manifest.json +96 -96
- package/{library/actions → adapters}/mobile/bridge-runtime/cdp-bridge.cjs +5 -5
- package/{orchestration → adapters}/mobile/cleanup.sh +3 -3
- package/{orchestration → adapters}/mobile/inject.sh +22 -24
- package/adapters/mobile/open-device.sh +260 -0
- package/{orchestration/compat-overlays → adapters/mobile/overlay/compat}/README.md +13 -4
- package/adapters/mobile/prewarm-bundle.sh +95 -0
- package/adapters/mobile/start-metro.sh +228 -0
- package/{runner → adapters}/mobile/verify.sh +6 -6
- package/adapters/mobile/wait-for-bridge.sh +108 -0
- package/adapters/mobile/yarn-setup.sh +20 -0
- package/{orchestration/lib → adapters/shared}/cli-ux.sh +5 -9
- package/{orchestration/lib → adapters/shared}/log-tui.mjs +57 -1
- package/{orchestration/lib → adapters/shared}/open-debug.mjs +32 -10
- package/{orchestration/lib → adapters/shared}/resolve-farmslot-ports.sh +47 -0
- package/adapters/shared/sync-wallet-fixture.sh +78 -0
- package/bin/mm-harness +37 -6
- package/docs/CLI-SPEC.md +41 -2
- package/docs/architecture.md +69 -38
- package/docs/runtime-file-conventions.md +3 -3
- package/library/actions/core/perps/_controller.mjs +1 -1
- package/library/actions/extension/platform/cdp.mjs +2 -2
- package/library/actions/extension/wallet/ensure_unlocked.mjs +1 -1
- package/library/actions/mobile/platform/bridge.mjs +1 -1
- package/library/actions/mobile/wallet/ensure_unlocked.mjs +1 -1
- package/library/actions/mobile/wallet/setup.mjs +2 -2
- package/library/library.json +1 -1
- package/package.json +8 -8
- package/{orchestration → src/adapters}/extension/runtime-decision.ts +5 -5
- package/{orchestration → src/adapters}/extension/runtime.ts +1 -1
- package/src/adapters/mobile/prepare.ts +210 -0
- package/{orchestration → src/adapters}/mobile/runtime-decision.ts +105 -5
- package/{runner/src → src}/adapters.ts +3 -3
- package/{orchestration/lib/cli-color.mjs → src/cli-color.ts} +21 -13
- package/{orchestration/lib/cli-commands.mjs → src/cli-commands.ts} +52 -45
- package/{orchestration/lib/cli-version.mjs → src/cli-version.ts} +35 -17
- package/{runner/src → src}/cli.ts +48 -40
- package/src/commands/debug.ts +63 -0
- package/src/commands/fixtures.ts +193 -0
- package/{runner/src → src}/commands/launch.ts +200 -54
- package/src/commands/logs.ts +83 -0
- package/{runner/src → src}/commands/shared.ts +40 -30
- package/src/commands/update.ts +316 -0
- package/{runner/src → src}/harness.ts +119 -16
- package/{runner/src → src}/heal-bounds.ts +20 -1
- package/src/index.ts +15 -0
- package/{runner/src → src}/live-adapter-contract.ts +1 -1
- package/{runner/src → src}/mm-harness-cli.ts +64 -3
- package/{runner/src → src}/paths.ts +2 -2
- package/{orchestration/lib/progress.mjs → src/progress.ts} +31 -21
- package/docs/extension-runtime-commands.md +0 -60
- package/docs/harness-cli.md +0 -43
- package/orchestration/compat-overlays/mobile/README.md +0 -13
- package/orchestration/doctor.mjs +0 -72
- package/orchestration/lib/cli-home.mjs +0 -354
- package/orchestration/lib/recipe-paths.mjs +0 -26
- package/orchestration/mobile/launch.sh +0 -137
- package/orchestration/mobile/live.sh +0 -125
- package/orchestration/porcelain/metamask-recipe +0 -99
- package/orchestration/porcelain/mm-recipe +0 -1591
- package/orchestration/porcelain/mme-recipe +0 -1181
- package/runner/src/commands/debug.ts +0 -44
- package/runner/src/commands/fixtures.ts +0 -99
- package/runner/src/commands/logs.ts +0 -60
- package/runner/src/index.ts +0 -6
- /package/{orchestration → adapters}/extension/launch-browser.cjs +0 -0
- /package/{orchestration → adapters}/extension/pin-remote-flags.cjs +0 -0
- /package/{orchestration → adapters}/extension/sidepanel-toggle.sh +0 -0
- /package/{orchestration → adapters}/extension/snapshot-dist.sh +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/lib/cdp-eval.cjs +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/lib/config.cjs +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/lib/issue-capture.cjs +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/lib/target-discovery.cjs +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/lib/ws-client.cjs +0 -0
- /package/{library/actions → adapters}/mobile/bridge-runtime/setup-wallet.sh +0 -0
- /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgentStepHud.tsx.patch +0 -0
- /package/{library/actions/mobile/app-overlay → adapters/mobile/overlay}/app/dev-tools/AgenticService/AgenticService.ts.patch +0 -0
- /package/{orchestration/compat-overlays/mobile → adapters/mobile/overlay/compat}/rn81-message-event-source.patch +0 -0
- /package/{orchestration/lib → adapters/shared}/activate-repo-node.sh +0 -0
- /package/{orchestration/lib → adapters/shared}/ensure-runner-deps.sh +0 -0
- /package/{orchestration/lib → adapters/shared}/harness-path.sh +0 -0
- /package/{orchestration/lib → adapters/shared}/hash-helpers.sh +0 -0
- /package/{orchestration/lib → adapters/shared}/json-field.sh +0 -0
- /package/{orchestration/lib → adapters/shared}/path-defaults.json +0 -0
- /package/{orchestration → src/adapters}/extension/ensure-ready.ts +0 -0
- /package/{orchestration → src/adapters}/extension/extension-id.ts +0 -0
- /package/{orchestration → src/adapters}/mobile/deps-markers.ts +0 -0
- /package/{runner/src → src}/completions-cache.ts +0 -0
- /package/{runner/src → src}/doctor.ts +0 -0
- /package/{runner/src → src}/manifest.ts +0 -0
- /package/{runner/src → src}/recording-target.ts +0 -0
- /package/{runner/src → src}/run-recording.ts +0 -0
- /package/{runner/src → src}/runner.ts +0 -0
- /package/{runner/src → src}/types.ts +0 -0
|
@@ -49,12 +49,12 @@ fi
|
|
|
49
49
|
|
|
50
50
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
51
51
|
# shellcheck disable=SC1091
|
|
52
|
-
for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../../
|
|
52
|
+
for _hp in "$SCRIPT_DIR/lib/harness-path.sh" "$SCRIPT_DIR/../../adapters/shared/harness-path.sh" "$SCRIPT_DIR/../shared/harness-path.sh"; do
|
|
53
53
|
[ -f "$_hp" ] && { . "$_hp"; break; }
|
|
54
54
|
done
|
|
55
55
|
unset _hp
|
|
56
56
|
if ! command -v harness_root >/dev/null 2>&1; then
|
|
57
|
-
echo "extension verify: shared lib
|
|
57
|
+
echo "extension verify: shared lib adapters/shared/harness-path.sh not found; reinstall the harness." >&2
|
|
58
58
|
exit 1
|
|
59
59
|
fi
|
|
60
60
|
|
|
@@ -84,7 +84,7 @@ RUNTIME_DIR="$(recipe_runtime_dir)"
|
|
|
84
84
|
HARNESS_ROOT="$(harness_root)"
|
|
85
85
|
HARNESS_REL="$HARNESS_ROOT/extension"
|
|
86
86
|
HARNESS_DIR="$(harness_dir "$TARGET" extension)"
|
|
87
|
-
RUNNER_BIN="$HARNESS_DIR/runner/bin/
|
|
87
|
+
RUNNER_BIN="$HARNESS_DIR/runner/bin/mm-harness"
|
|
88
88
|
# --out (optional): a task-local recipes dir. Resolve it safely within the target
|
|
89
89
|
# (resolve_harness_out rejects absolute/.. escapes) and prefer its smoke recipe so
|
|
90
90
|
# `live --out <dir>` does not silently fall back to the installed default.
|
|
@@ -108,22 +108,22 @@ ARTIFACTS="${ARTIFACTS:-$HARNESS_DIR/verify/$(date -u +%Y%m%dT%H%M%SZ)}"
|
|
|
108
108
|
mkdir -p "$ARTIFACTS/logs"
|
|
109
109
|
EXTENSION_ID_FILE="$TARGET/$RUNTIME_DIR/extension.id"
|
|
110
110
|
# Shared JSON reader: $SCRIPT_DIR/lib when running from the installed copy,
|
|
111
|
-
# else the runner canonical at
|
|
111
|
+
# else the runner canonical at adapters/shared.
|
|
112
112
|
# shellcheck disable=SC1091
|
|
113
|
-
for _lib in "$SCRIPT_DIR/lib/json-field.sh" "$SCRIPT_DIR/../../
|
|
113
|
+
for _lib in "$SCRIPT_DIR/lib/json-field.sh" "$SCRIPT_DIR/../../adapters/shared/json-field.sh"; do
|
|
114
114
|
[ -f "$_lib" ] && { . "$_lib"; break; }
|
|
115
115
|
done
|
|
116
116
|
unset _lib
|
|
117
117
|
# Fail fast with an actionable message if neither path loaded (e.g. an install that
|
|
118
118
|
# predates the lib co-location), instead of a cryptic later `set -e` abort.
|
|
119
119
|
if ! command -v read_runtime_context_field >/dev/null 2>&1; then
|
|
120
|
-
echo "extension verify: json-field helper missing (
|
|
120
|
+
echo "extension verify: json-field helper missing (adapters/shared/json-field.sh). Run mm-harness extension prepare --target $TARGET" >&2
|
|
121
121
|
exit 1
|
|
122
122
|
fi
|
|
123
123
|
# readiness probe is app control: co-located in installed copies, under
|
|
124
|
-
#
|
|
124
|
+
# adapters/extension in a repo checkout.
|
|
125
125
|
READINESS_MJS=""
|
|
126
|
-
for _r in "$SCRIPT_DIR/readiness.mjs" "$SCRIPT_DIR/../../
|
|
126
|
+
for _r in "$SCRIPT_DIR/readiness.mjs" "$SCRIPT_DIR/../../adapters/extension/readiness.mjs"; do
|
|
127
127
|
[ -f "$_r" ] && { READINESS_MJS="$_r"; break; }
|
|
128
128
|
done
|
|
129
129
|
unset _r
|
|
@@ -290,7 +290,7 @@ check_file() {
|
|
|
290
290
|
|
|
291
291
|
check_file "$HARNESS_REL/manifest.json"
|
|
292
292
|
check_file "$HARNESS_REL/action-manifest.json"
|
|
293
|
-
check_file "$HARNESS_REL/runner/bin/
|
|
293
|
+
check_file "$HARNESS_REL/runner/bin/mm-harness"
|
|
294
294
|
check_file "$HARNESS_REL/runner/manifests/extension.action-manifest.json"
|
|
295
295
|
|
|
296
296
|
# dist-freshness + build-health now come from the runner's single source of
|
|
@@ -327,7 +327,7 @@ const blMsg = bl.status === "ok" ? "webpack compiled."
|
|
|
327
327
|
: bl.status === "no-watch" ? "no webpack watch log; build-health n/a (e.g. one-shot build)."
|
|
328
328
|
: bl.status === "building" ? "webpack has not reported a successful compile yet."
|
|
329
329
|
: bl.status === "errors" ? (bl.reason === "stale-cache"
|
|
330
|
-
? "webpack build failing on a stale cache (ENOENT on a deduped module). Run `
|
|
330
|
+
? "webpack build failing on a stale cache (ENOENT on a deduped module). Run `mm-harness runtime-launch --adapter extension --target <repo> --cdp-port <port>` to auto-clear the cache and rebuild."
|
|
331
331
|
: "webpack build has errors; fix the source/build before validating.")
|
|
332
332
|
: "build-health unknown.";
|
|
333
333
|
fs.writeFileSync(dir + "/build-health.json", JSON.stringify({ status: bl.status, reason: bl.reason, excerpt: bl.excerpt, message: blMsg }));
|
|
@@ -399,7 +399,7 @@ if [ "$STATIC_ONLY" = false ]; then
|
|
|
399
399
|
|
|
400
400
|
if (
|
|
401
401
|
cd "$TARGET"
|
|
402
|
-
"$RUNNER_BIN"
|
|
402
|
+
"$RUNNER_BIN" actions --raw --adapter extension
|
|
403
403
|
) > "$ARTIFACTS/logs/runner-manifest.json" 2> "$ARTIFACTS/logs/runner-manifest.err"; then
|
|
404
404
|
checks+=("{\"name\":\"runner manifest\",\"status\":\"pass\"}")
|
|
405
405
|
else
|
|
@@ -41,8 +41,8 @@ function usage() {
|
|
|
41
41
|
function pathDefault(key) {
|
|
42
42
|
for (const candidate of [
|
|
43
43
|
path.join(__dirname, 'lib/path-defaults.json'),
|
|
44
|
-
path.join(__dirname, '../
|
|
45
|
-
path.join(__dirname, '../../
|
|
44
|
+
path.join(__dirname, '../shared/path-defaults.json'),
|
|
45
|
+
path.join(__dirname, '../../adapters/shared/path-defaults.json'),
|
|
46
46
|
]) {
|
|
47
47
|
if (!fs.existsSync(candidate)) continue;
|
|
48
48
|
const value = JSON.parse(fs.readFileSync(candidate, 'utf8'))[key];
|
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"description": "
|
|
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/
|
|
7
|
-
"entry": "
|
|
6
|
+
"id": "mobile/yarn-setup",
|
|
7
|
+
"entry": "adapters/mobile/yarn-setup.sh",
|
|
8
8
|
"kind": "bash",
|
|
9
|
-
"purpose": "
|
|
10
|
-
"inputs": "--target
|
|
11
|
-
"outputs": "
|
|
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/
|
|
15
|
-
"entry": "
|
|
14
|
+
"id": "mobile/start-metro",
|
|
15
|
+
"entry": "adapters/mobile/start-metro.sh",
|
|
16
16
|
"kind": "bash",
|
|
17
|
-
"purpose": "
|
|
18
|
-
"inputs": "--target --
|
|
19
|
-
"outputs": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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
|
|
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": "
|
|
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": "
|
|
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": "
|
|
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
|
|
8
|
-
* node
|
|
9
|
-
* node
|
|
10
|
-
* node
|
|
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
|
|
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/../
|
|
37
|
+
. "$SCRIPT_DIR/../shared/hash-helpers.sh"
|
|
38
38
|
# shellcheck disable=SC1091
|
|
39
|
-
for _hp in "$SCRIPT_DIR/../
|
|
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
|
|
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)"
|