@deeeed/metamask-harness 0.33.2 → 0.34.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.
- package/CHANGELOG.md +31 -0
- package/adapters/mobile/bridge-runtime/cdp-bridge.cjs +18 -2
- package/adapters/mobile/bridge-runtime/lib/target-discovery.cjs +83 -23
- package/dist/adapters/mobile/prepare.js +14 -0
- package/dist/adapters/mobile/video-recorder.js +282 -0
- package/dist/adapters.js +225 -35
- package/dist/command-contract.js +1 -0
- package/dist/commands/device-target.js +17 -6
- package/dist/commands/launch/index.js +27 -5
- package/dist/commands/launch/mobile.js +9 -2
- package/dist/commands/run-engine.js +34 -2
- package/dist/devices.js +9 -2
- package/dist/heal-bounds.js +10 -0
- package/dist/mm-harness-cli.js +4 -2
- package/dist/recipe-security.js +1 -0
- package/dist/recording-target.js +23 -5
- package/dist/runner.js +107 -6
- package/dist/runtime-context.js +33 -1
- package/docs/RECIPES.md +41 -0
- package/library/actions/mobile/app/network-control.mjs +135 -0
- package/library/actions/mobile/app/network.mjs +4 -0
- package/library/actions/mobile/perps/capture_performance.mjs +4 -0
- package/library/actions/mobile/perps/performance-capture.mjs +383 -0
- package/library/actions/mobile/perps/perps.mjs +16 -0
- package/library/actions/mobile/platform/bridge.mjs +229 -13
- package/library/actions/mobile/wallet/ensure_unlocked.mjs +27 -6
- package/library/actions/mobile/wallet/select_account.mjs +21 -17
- package/library/manifests/mobile.action-manifest.json +130 -1
- package/library/recipes/mobile/perps/performance.homepage.android-background-reconnect.recipe.json +159 -0
- package/library/recipes/mobile/perps/performance.homepage.android-background-short.recipe.json +157 -0
- package/library/recipes/mobile/perps/performance.homepage.android-cold-disk-cache.recipe.json +147 -0
- package/library/recipes/mobile/perps/performance.homepage.android-cold-no-cache.recipe.json +137 -0
- package/library/recipes/mobile/perps/performance.homepage.android-network-recovery.recipe.json +149 -0
- package/library/recipes/mobile/perps/performance.homepage.ios-background-reconnect.recipe.json +110 -0
- package/library/recipes/mobile/perps/performance.homepage.ios-background-short.recipe.json +108 -0
- package/library/recipes/mobile/perps/performance.homepage.ios-cold-disk-cache.recipe.json +122 -0
- package/library/recipes/mobile/perps/performance.homepage.ios-cold-no-cache.recipe.json +95 -0
- package/package.json +1 -1
- package/scripts/site-contrast.mjs +34 -1
- package/site/architecture.html +12 -2
- package/site/assets/style.css +20 -1
- package/site/cheatsheet.html +7 -6
- package/site/index.html +119 -77
- package/site/perps.html +195 -0
- package/site/recipes.html +23 -1
- package/site/reviewers.html +2 -1
- package/site/tutorials/index.html +2 -1
- package/site/tutorials/v1.html +3 -2
- package/site/tutorials/v2.html +6 -5
- package/site/tutorials/v3.html +43 -2
- package/site/tutorials/v4.html +2 -1
- package/site/tutorials/v5.html +2 -1
- package/site/tutorials/v6.html +2 -1
- package/site/tutorials/v7.html +2 -1
package/site/index.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="index.html" aria-current="page">Start Here</a>
|
|
21
21
|
<a href="recipes.html">Recipes</a>
|
|
22
|
+
<a href="perps.html">Perps</a>
|
|
22
23
|
<a href="cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="architecture.html">Architecture</a>
|
|
24
25
|
<a href="tutorials/index.html">Tutorials</a>
|
|
@@ -39,30 +40,118 @@
|
|
|
39
40
|
|
|
40
41
|
<main>
|
|
41
42
|
<section class="wrap hero">
|
|
42
|
-
<span class="eyebrow">
|
|
43
|
+
<span class="eyebrow">A proposed agentic workflow at MetaMask</span>
|
|
43
44
|
<h1>Drive the wallet. Prove what happened.</h1>
|
|
44
45
|
<p class="lede">
|
|
45
46
|
<code>mm-harness</code> launches a real MetaMask build — Extension, Mobile, or Core — drives it
|
|
46
47
|
through typed actions, and writes evidence a reviewer can check without taking your word for it.
|
|
47
|
-
|
|
48
|
+
Paste one prompt and let your agent do it, or walk the eight steps yourself.
|
|
48
49
|
</p>
|
|
49
50
|
<div class="hero-meta">
|
|
50
|
-
<span>requires mm-harness 0.
|
|
51
|
+
<span>requires mm-harness 0.33+</span>
|
|
51
52
|
<span>~20 minutes</span>
|
|
52
53
|
<span>progress saves in this browser</span>
|
|
53
54
|
</div>
|
|
55
|
+
<p style="margin-top:.9rem;opacity:.7;font-size:.9rem;max-width:60ch">
|
|
56
|
+
A proposal for how agents can code at MetaMask — offered for teams to try, not an official standard.
|
|
57
|
+
</p>
|
|
54
58
|
</section>
|
|
55
59
|
|
|
56
60
|
<section class="wrap">
|
|
57
|
-
<
|
|
61
|
+
<div class="agent-card">
|
|
62
|
+
<h2 style="margin-top:0">Just want to try it? Paste this into your agent.</h2>
|
|
63
|
+
<p>
|
|
64
|
+
Start your agent in or near a MetaMask checkout. This installs the harness, proves control of a
|
|
65
|
+
real build, runs a recipe, and re-runs it — end to end, without reading the rest of this page.
|
|
66
|
+
</p>
|
|
67
|
+
<div class="cmd cmd-hero"><pre><code>Task: set me up with the MetaMask recipe workflow and prove it works end to end.
|
|
68
|
+
Follow these steps in order. When a command fails, its message names the exact
|
|
69
|
+
next command — run that instead of improvising.
|
|
70
|
+
|
|
71
|
+
1. Install the harness: `npm i -g @deeeed/metamask-harness@latest`, then
|
|
72
|
+
`mm-harness --version` to confirm it resolved.
|
|
73
|
+
2. Checkout: if I started you inside a MetaMask product checkout
|
|
74
|
+
(metamask-extension, metamask-mobile, or core), use it. If not, run
|
|
75
|
+
`mm-harness setup-base --dry-run` to show me the layout it would create,
|
|
76
|
+
and ask me before running it for real.
|
|
77
|
+
3. From inside the checkout, run `mm-harness doctor` and fix every finding by
|
|
78
|
+
following its own instructions until doctor passes. `mm-harness doctor --fix`
|
|
79
|
+
repairs harness-owned runtime state; it will not invent credentials or pick
|
|
80
|
+
a wallet fixture for me.
|
|
81
|
+
4. Run `mm-harness fixtures`. If no fixture exists, run
|
|
82
|
+
`mm-harness fixtures init --dev`; this creates a disposable public test
|
|
83
|
+
wallet that must never receive real funds.
|
|
84
|
+
5. Launch and wait for readiness:
|
|
85
|
+
- Extension: `mm-harness launch --verify`.
|
|
86
|
+
- Android: `mm-harness launch android --verify`; if more than one device is
|
|
87
|
+
listed, choose one serial and repeat it with `--device <serial>`.
|
|
88
|
+
- iOS: run `xcrun simctl list devices available`, choose ONE available iPhone
|
|
89
|
+
UUID (ask me if the choice is ambiguous), and use that literal UUID in all
|
|
90
|
+
three commands below — never substitute the simulator name:
|
|
91
|
+
`mm-harness provision runway ios --device '<UUID>' --force`
|
|
92
|
+
`xcrun simctl get_app_container '<UUID>' io.metamask.MetaMask app`
|
|
93
|
+
`mm-harness launch ios --device '<UUID>' --verify`
|
|
94
|
+
- Core: `mm-harness verify`; it has no app to launch.
|
|
95
|
+
`--preflight-mode` is an internal adapter flag, not a public launch flag.
|
|
96
|
+
6. On Extension run `mm-harness fixtures set`. On Mobile include the same
|
|
97
|
+
`--device <UUID-or-serial>` used for launch. Wait for it to succeed.
|
|
98
|
+
7. Discover before acting: run `mm-harness actions`. That list is the ONLY set
|
|
99
|
+
of capabilities you may use, now and in every later session. Never invent an
|
|
100
|
+
action or a flag. If you need something not listed, stop and tell me.
|
|
101
|
+
8. Prove control with two calls. On Extension or Mobile, run
|
|
102
|
+
`mm-harness call read_state` and one listed visible UI action. On Core, run
|
|
103
|
+
`mm-harness call read_positions mode=all` and
|
|
104
|
+
`mm-harness call command cmd="echo core-ready"`. Show me both outputs.
|
|
105
|
+
9. Prove a whole task: pick a smoke recipe from `mm-harness run --list`, then
|
|
106
|
+
`mm-harness run <recipe> --artifacts-dir ./first-recipe-artifacts`.
|
|
107
|
+
Show me the status from summary.json, the per-node results from trace.json,
|
|
108
|
+
and the artifact paths.
|
|
109
|
+
10. Without starting a new session, run that same recipe again and confirm it
|
|
110
|
+
still passes. Checking your own work in the context you did it in is the
|
|
111
|
+
point; from here on, replay it after every change you make.
|
|
112
|
+
11. Tell me in three sentences: what a recipe proves, where the evidence lives,
|
|
113
|
+
and which command lists what I can do next.
|
|
114
|
+
|
|
115
|
+
Not optional: evidence comes only from executed actions — never fabricate a
|
|
116
|
+
result or edit state to manufacture one. If the harness reports a capability as
|
|
117
|
+
unsupported, stop and tell me rather than working around it. If a step fails
|
|
118
|
+
twice after following its error's instructions, stop and show me the exact
|
|
119
|
+
error.</code></pre></div>
|
|
120
|
+
<p style="margin-bottom:0">
|
|
121
|
+
Prefer to go step by step? <a href="#steps">Every piece is below.</a>
|
|
122
|
+
</p>
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
|
|
126
|
+
<section class="wrap">
|
|
127
|
+
<h2 id="why">Why a recipe</h2>
|
|
58
128
|
<p>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
129
|
+
<strong>Proof.</strong> The agent drives a real build, asserts what should be true, and leaves a
|
|
130
|
+
trace: which actions ran, what they returned, how many times. On-device evidence, not a claim in a
|
|
131
|
+
pull request description.
|
|
132
|
+
</p>
|
|
133
|
+
<p>
|
|
134
|
+
<strong>Checked before you ever see it.</strong> Replaying a recipe needs no fresh session, no
|
|
135
|
+
human, and no wait for CI. The agent does it mid-task, in the same context it made the change in —
|
|
136
|
+
so what arrives at your review has already been verified by the thing that wrote it.
|
|
137
|
+
</p>
|
|
138
|
+
<p>
|
|
139
|
+
<strong>Prevents regressions.</strong> The recipe outlives the change it was written for. Every
|
|
140
|
+
later change has to pass it too, so the same bug cannot quietly come back: a one-time check becomes
|
|
141
|
+
a permanent guard.
|
|
142
|
+
</p>
|
|
143
|
+
<p>
|
|
144
|
+
<strong>Trust.</strong> Proven, self-checked, and still proving — so review reads evidence instead
|
|
145
|
+
of extending credit, and every gate stays yours to steer.
|
|
64
146
|
</p>
|
|
147
|
+
</section>
|
|
148
|
+
|
|
149
|
+
<section class="wrap">
|
|
150
|
+
<h2 id="model">Two words</h2>
|
|
65
151
|
<p>
|
|
152
|
+
An <strong>action</strong> is one typed operation: unlock the wallet, press a button, read the
|
|
153
|
+
account state. A <strong>recipe</strong> is a JSON graph of actions. The steps below follow
|
|
154
|
+
<strong>discover → drive → prove</strong>, which is also the order you will work in from here on.
|
|
66
155
|
<code>mm-harness</code> implements the farmslot specification —
|
|
67
156
|
<a href="architecture.html#spec">see Architecture</a>.
|
|
68
157
|
</p>
|
|
@@ -78,64 +167,8 @@
|
|
|
78
167
|
</section>
|
|
79
168
|
|
|
80
169
|
<section class="wrap">
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
<p>
|
|
84
|
-
Start your agent in (or near) a MetaMask checkout and paste the prompt below. It walks the same
|
|
85
|
-
eight steps, following each error's own instructions rather than improvising.
|
|
86
|
-
</p>
|
|
87
|
-
<p>
|
|
88
|
-
Do them by hand once anyway — you will be reviewing this workflow's output later, and a bundle
|
|
89
|
-
you produced yourself is much easier to trust.
|
|
90
|
-
</p>
|
|
91
|
-
<details class="prompt">
|
|
92
|
-
<summary>Show the copyable prompt</summary>
|
|
93
|
-
<div class="prompt-body">
|
|
94
|
-
<div class="cmd"><pre><code>Task: set me up with the MetaMask recipe workflow and prove it works end-to-end.
|
|
95
|
-
Follow these steps exactly. Where a tool prints an error, its message contains the
|
|
96
|
-
exact next command — follow that instead of improvising.
|
|
97
|
-
|
|
98
|
-
1. Install or update the harness: `npm i -g @deeeed/metamask-harness@latest`,
|
|
99
|
-
then `mm-harness --version` to confirm it resolved.
|
|
100
|
-
2. Repo: use the product checkout I started you in (metamask-extension,
|
|
101
|
-
metamask-mobile, or core). If I started you outside one, ask me which ONE
|
|
102
|
-
product to clone and clone just that — do not clone multiples.
|
|
103
|
-
3. Run `mm-harness doctor` from the checkout and fix everything it reports by
|
|
104
|
-
following each finding's own instructions until doctor passes. `mm-harness
|
|
105
|
-
doctor --fix` repairs harness-owned runtime state; it will not invent
|
|
106
|
-
credentials or choose a wallet fixture for me.
|
|
107
|
-
4. Launch the app under harness control: `mm-harness launch` (add `ios` or
|
|
108
|
-
`android` for mobile; core is headless and has nothing to launch — use
|
|
109
|
-
`mm-harness verify` there). Wait for the runtime to be ready.
|
|
110
|
-
5. Discovery before anything else: run `mm-harness actions`. That list is the
|
|
111
|
-
ONLY set of capabilities you may use, now and in every future session.
|
|
112
|
-
Never invent an action or a flag. If you need something that is not listed,
|
|
113
|
-
stop and tell me.
|
|
114
|
-
6. Prove basic control with two direct calls. On Extension or Mobile, run
|
|
115
|
-
`mm-harness call read_state` and one listed visible UI action. On Core, run
|
|
116
|
-
`mm-harness call read_positions mode=all` and
|
|
117
|
-
`mm-harness call command cmd="echo core-ready"`. Show me both outputs.
|
|
118
|
-
7. Run one library recipe end-to-end. Pick a smoke recipe from
|
|
119
|
-
`mm-harness run --list`, then:
|
|
120
|
-
`mm-harness run <recipe> --artifacts-dir ./first-recipe-artifacts`
|
|
121
|
-
When it finishes, show me: the status from summary.json, the per-node
|
|
122
|
-
results from trace.json, and the artifact paths.
|
|
123
|
-
8. Close by telling me, in three sentences: what a recipe is, where the
|
|
124
|
-
evidence lives, and which command lists what I can do next.
|
|
125
|
-
|
|
126
|
-
Rules that are not optional: evidence comes only from executed actions — never
|
|
127
|
-
fabricate a result or edit state to manufacture one; if the harness says a
|
|
128
|
-
capability is unsupported, stop and report it rather than working around it;
|
|
129
|
-
if any step fails twice after following its error's instructions, stop and show
|
|
130
|
-
me the exact error.</code></pre></div>
|
|
131
|
-
</div>
|
|
132
|
-
</details>
|
|
133
|
-
</div>
|
|
134
|
-
</section>
|
|
135
|
-
|
|
136
|
-
<section class="wrap">
|
|
137
|
-
<h2 id="steps">The walkthrough</h2>
|
|
138
|
-
<p>Checkboxes persist in this browser, so you can close the tab and come back.</p>
|
|
170
|
+
<h2 id="steps">Prefer to go step by step?</h2>
|
|
171
|
+
<p>Here is each piece on its own. Checkboxes persist in this browser, so you can close the tab and come back.</p>
|
|
139
172
|
|
|
140
173
|
<ol class="steps">
|
|
141
174
|
|
|
@@ -172,7 +205,7 @@ me the exact error.</code></pre></div>
|
|
|
172
205
|
<span class="p">$ </span>mm-harness --version</code></pre></div>
|
|
173
206
|
|
|
174
207
|
<div class="out-label">Expected</div>
|
|
175
|
-
<div class="out">0.
|
|
208
|
+
<div class="out">0.33.x <span class="dim">— any 0.33 or newer</span></div>
|
|
176
209
|
|
|
177
210
|
<p class="step-why">Everything from here runs inside a product checkout:</p>
|
|
178
211
|
<div class="cmd"><pre><code><span class="p">$ </span>cd ~/dev/metamask/metamask-extension <span class="dim"># or metamask-mobile, or core</span></code></pre></div>
|
|
@@ -186,7 +219,7 @@ me the exact error.</code></pre></div>
|
|
|
186
219
|
directory to your shell profile.
|
|
187
220
|
</p>
|
|
188
221
|
<p>
|
|
189
|
-
<strong>Older than 0.
|
|
222
|
+
<strong>Older than 0.33</strong> — a stale global install is the most common source of
|
|
190
223
|
"the docs don't match my terminal". Run <code>mm-harness update</code>, or
|
|
191
224
|
<code>update --check</code> to look without installing.
|
|
192
225
|
</p>
|
|
@@ -208,7 +241,7 @@ me the exact error.</code></pre></div>
|
|
|
208
241
|
|
|
209
242
|
<div class="out-label">Expected — a checkout that needs one repair</div>
|
|
210
243
|
<div class="out"><span class="ok">pass</span> extension bridge present manifest=…/extension.action-manifest.json
|
|
211
|
-
harness: @deeeed/metamask-harness@0.
|
|
244
|
+
harness: @deeeed/metamask-harness@0.33.x
|
|
212
245
|
runtime: decision=install (deps-missing) deps=missing webpack=down
|
|
213
246
|
Dependencies are not installed (no yarn install-state markers).
|
|
214
247
|
runtime-context: temp/recipe/runtime/agentic-runtime.json (<span class="bad">absent</span> — run mm-harness doctor --fix)
|
|
@@ -264,13 +297,16 @@ capture: <span class="ok">pass</span> (screenshots: capture-helper → cdp; vide
|
|
|
264
297
|
</div>
|
|
265
298
|
<p class="step-why">
|
|
266
299
|
Starts the app and its dev server, installing the runtime overlay first if missing. Platform is
|
|
267
|
-
auto-detected
|
|
268
|
-
|
|
300
|
+
auto-detected. On iOS, pin one simulator UUID through provisioning and launch so duplicate device
|
|
301
|
+
names cannot select different simulators.
|
|
269
302
|
</p>
|
|
270
303
|
|
|
271
|
-
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness launch <span class="dim"># extension — fullscreen by default</span>
|
|
272
|
-
<span class="p">$ </span>
|
|
273
|
-
<span class="p">$ </span>mm-harness
|
|
304
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness launch --verify <span class="dim"># extension — fullscreen by default</span>
|
|
305
|
+
<span class="p">$ </span>xcrun simctl list devices available <span class="dim"># choose one iPhone UUID</span>
|
|
306
|
+
<span class="p">$ </span>mm-harness provision runway ios --device '<UUID>' --force
|
|
307
|
+
<span class="p">$ </span>xcrun simctl get_app_container '<UUID>' io.metamask.MetaMask app
|
|
308
|
+
<span class="p">$ </span>mm-harness launch ios --device '<UUID>' --verify
|
|
309
|
+
<span class="p">$ </span>mm-harness launch android --verify</code></pre></div>
|
|
274
310
|
|
|
275
311
|
<p class="step-why">
|
|
276
312
|
Quick relaunch is the default and reuses a healthy runtime. <code>--build</code> is the escape
|
|
@@ -290,7 +326,13 @@ capture: <span class="ok">pass</span> (screenshots: capture-helper → cdp; vide
|
|
|
290
326
|
<div class="fail-body">
|
|
291
327
|
<p>
|
|
292
328
|
<strong>Mobile: more than one device</strong> — the harness lists what it found rather than
|
|
293
|
-
guessing. Re-run with <code>--device <udid|serial
|
|
329
|
+
guessing. Re-run with <code>--device <udid|serial></code>. Prefer the iOS UUID over a name,
|
|
330
|
+
because Xcode can contain several simulators with the same display name.
|
|
331
|
+
</p>
|
|
332
|
+
<p>
|
|
333
|
+
<strong>iOS app missing after provisioning</strong> — repeat the provision command with
|
|
334
|
+
<code>--force</code> and the same UUID. Do not use <code>--preflight-mode</code>; it is an
|
|
335
|
+
internal adapter flag, not a public <code>mm-harness launch</code> option.
|
|
294
336
|
</p>
|
|
295
337
|
<p>
|
|
296
338
|
<strong>Stuck</strong> — <code>mm-harness logs</code> tails the dev server and app logs;
|
|
@@ -638,7 +680,7 @@ artifacts (6):
|
|
|
638
680
|
<footer class="footer">
|
|
639
681
|
<div class="wrap">
|
|
640
682
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
641
|
-
<p>Verified against mm-harness 0.
|
|
683
|
+
<p>Verified against mm-harness 0.33+. If a command here disagrees with your terminal, your terminal is right: run <code>mm-harness update</code>, then trust <code>--help</code>.</p>
|
|
642
684
|
</div>
|
|
643
685
|
</footer>
|
|
644
686
|
|
package/site/perps.html
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Perps recipes — MetaMask recipe workflow</title>
|
|
7
|
+
<meta name="description" content="Install the shared MetaMask Perps recipe library and run live, testnet-first proof across Extension, Mobile, and Core.">
|
|
8
|
+
<link rel="stylesheet" href="assets/style.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<a class="skip" href="#setup">Skip to setup</a>
|
|
12
|
+
|
|
13
|
+
<header class="topbar">
|
|
14
|
+
<div class="wrap topbar-inner">
|
|
15
|
+
<a class="brand" href="index.html">
|
|
16
|
+
<span class="brand-mark" aria-hidden="true"></span>
|
|
17
|
+
<span class="brand-name">mm-harness</span>
|
|
18
|
+
</a>
|
|
19
|
+
<nav class="nav" aria-label="Main">
|
|
20
|
+
<a href="index.html">Start Here</a>
|
|
21
|
+
<a href="recipes.html">Recipes</a>
|
|
22
|
+
<a href="perps.html" aria-current="page">Perps</a>
|
|
23
|
+
<a href="cheatsheet.html">Cheatsheet</a>
|
|
24
|
+
<a href="architecture.html">Architecture</a>
|
|
25
|
+
<a href="tutorials/index.html">Tutorials</a>
|
|
26
|
+
<a href="reviewers.html">For Reviewers</a>
|
|
27
|
+
</nav>
|
|
28
|
+
</div>
|
|
29
|
+
</header>
|
|
30
|
+
|
|
31
|
+
<main>
|
|
32
|
+
<section class="wrap hero" style="padding-bottom:1rem">
|
|
33
|
+
<span class="eyebrow">Shared MetaMask recipe library</span>
|
|
34
|
+
<h1>Prove Perps changes in the real product</h1>
|
|
35
|
+
<p class="lede">
|
|
36
|
+
The private Perps library gives Extension, Mobile, and Core one set of small, parameterized
|
|
37
|
+
recipes for live UI journeys, controller state, analytics, performance, and testnet mutations.
|
|
38
|
+
</p>
|
|
39
|
+
<div class="hero-meta">
|
|
40
|
+
<span>library name: perps</span>
|
|
41
|
+
<span>defaults to testnet</span>
|
|
42
|
+
<span>requires repository access</span>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
|
|
46
|
+
<section class="wrap">
|
|
47
|
+
<div class="doctrine">
|
|
48
|
+
<p>
|
|
49
|
+
<span class="k">The harness supplies the execution standard; the Perps library supplies the domain proof.</span>
|
|
50
|
+
Keep the shared library small: compose or repair the closest recipe before creating another one.
|
|
51
|
+
</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<h2>What lives where</h2>
|
|
55
|
+
<div class="table-scroll">
|
|
56
|
+
<table>
|
|
57
|
+
<thead><tr><th>Layer</th><th>Owns</th><th>Does not own</th></tr></thead>
|
|
58
|
+
<tbody>
|
|
59
|
+
<tr>
|
|
60
|
+
<td><code>mm-harness</code></td>
|
|
61
|
+
<td>Launch, typed actions, graph execution, screenshots, video, traces, and artifact contracts.</td>
|
|
62
|
+
<td>Ticket-specific Perps scenarios.</td>
|
|
63
|
+
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td><code>perps</code> library</td>
|
|
66
|
+
<td>Reusable Perps setup, journeys, assertions, cleanup, and platform variants.</td>
|
|
67
|
+
<td>Wallet credentials, generated evidence, or product source.</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td>Product checkout</td>
|
|
71
|
+
<td>The real Extension, Mobile, or Core code and runtime being proved.</td>
|
|
72
|
+
<td>A substitute test implementation.</td>
|
|
73
|
+
</tr>
|
|
74
|
+
</tbody>
|
|
75
|
+
</table>
|
|
76
|
+
</div>
|
|
77
|
+
</section>
|
|
78
|
+
|
|
79
|
+
<section class="wrap">
|
|
80
|
+
<h2 id="setup">Install and discover it</h2>
|
|
81
|
+
<p>
|
|
82
|
+
Run these commands from the MetaMask product checkout you want to exercise. The repository is
|
|
83
|
+
private; a clone failure means your GitHub account needs access.
|
|
84
|
+
</p>
|
|
85
|
+
|
|
86
|
+
<div class="cmd"><pre><code><span class="p">$ </span>npm i -g @deeeed/metamask-harness@latest
|
|
87
|
+
<span class="p">$ </span>git clone git@github.com:MetaMask/experimental-metamask-recipe-perps.git \
|
|
88
|
+
"$HOME/shared-library/metamask-recipe-perps"
|
|
89
|
+
<span class="p">$ </span>mm-harness run --list \
|
|
90
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"</code></pre></div>
|
|
91
|
+
|
|
92
|
+
<p>
|
|
93
|
+
If the checkout already exists and is clean, update it with <code>git pull --ff-only</code>.
|
|
94
|
+
Preserve and report a dirty checkout instead of overwriting it. Keep <code>--library</code> on each
|
|
95
|
+
command so separate tool shells do not lose an exported variable.
|
|
96
|
+
</p>
|
|
97
|
+
|
|
98
|
+
<div class="note blue">
|
|
99
|
+
<span class="note-title">Discovery is adapter-aware</span>
|
|
100
|
+
<p>
|
|
101
|
+
The list shows only recipes runnable in the current product checkout. A recipe marked
|
|
102
|
+
<code>[perps]</code> came from the shared library; <code>[metamask]</code> means it ships with the
|
|
103
|
+
harness. Read the selected platform variant with <code>--describe</code> before running it.
|
|
104
|
+
</p>
|
|
105
|
+
</div>
|
|
106
|
+
</section>
|
|
107
|
+
|
|
108
|
+
<section class="wrap">
|
|
109
|
+
<h2>Your first live proof</h2>
|
|
110
|
+
<p>
|
|
111
|
+
Complete <a href="index.html#steps">Start Here</a> first so the app, device, and wallet fixture are
|
|
112
|
+
ready. Then use a read-only recipe as the first proof.
|
|
113
|
+
</p>
|
|
114
|
+
|
|
115
|
+
<h3>Extension or Mobile</h3>
|
|
116
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness run perps.open-market --describe \
|
|
117
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"
|
|
118
|
+
<span class="p">$ </span>mm-harness run perps.open-market network=testnet market=BTC --plan \
|
|
119
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"
|
|
120
|
+
<span class="p">$ </span>mm-harness run perps.open-market network=testnet market=BTC \
|
|
121
|
+
--record-video=full-run --artifacts-dir ./perps-open-market-evidence \
|
|
122
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"</code></pre></div>
|
|
123
|
+
|
|
124
|
+
<h3>Core</h3>
|
|
125
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness run perps.snapshot-market --describe \
|
|
126
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"
|
|
127
|
+
<span class="p">$ </span>mm-harness run perps.snapshot-market network=testnet market=BTC \
|
|
128
|
+
--artifacts-dir ./perps-market-evidence \
|
|
129
|
+
--library "perps=$HOME/shared-library/metamask-recipe-perps"</code></pre></div>
|
|
130
|
+
|
|
131
|
+
<p>
|
|
132
|
+
A passing run writes <code>summary.json</code>, per-node results in <code>trace.json</code>, and an
|
|
133
|
+
artifact manifest beside screenshots or video. Visual review surfaces can render those same
|
|
134
|
+
recipe-derived artifacts without changing the proof graph.
|
|
135
|
+
</p>
|
|
136
|
+
</section>
|
|
137
|
+
|
|
138
|
+
<section class="wrap">
|
|
139
|
+
<h2>Choose the recipe that owns the claim</h2>
|
|
140
|
+
<div class="table-scroll">
|
|
141
|
+
<table>
|
|
142
|
+
<thead><tr><th>Claim</th><th>Recipe</th><th>Platforms</th></tr></thead>
|
|
143
|
+
<tbody>
|
|
144
|
+
<tr><td>Reach a live market detail screen</td><td><code>perps.open-market</code></td><td>Mobile, Extension</td></tr>
|
|
145
|
+
<tr><td>Read positions and orders</td><td><code>perps.snapshot-market</code></td><td>Mobile, Extension, Core</td></tr>
|
|
146
|
+
<tr><td>Place, assert, and clean up an order</td><td><code>perps.prove-order</code></td><td>Mobile, Extension, Core</td></tr>
|
|
147
|
+
<tr><td>Manage or close a position</td><td><code>perps.manage-position</code></td><td>Mobile, Extension, Core</td></tr>
|
|
148
|
+
<tr><td>Prove real MetaMetrics emissions</td><td><code>perps.analytics-lifecycle</code></td><td>Mobile, Extension</td></tr>
|
|
149
|
+
<tr><td>Measure the open-market journey</td><td><code>perps.performance-open-market</code></td><td>Mobile, Extension</td></tr>
|
|
150
|
+
<tr><td>Exercise edit-order contracts</td><td><code>perps.prove-edit-order</code></td><td>Core</td></tr>
|
|
151
|
+
</tbody>
|
|
152
|
+
</table>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div class="note">
|
|
156
|
+
<span class="note-title">Mutation boundary</span>
|
|
157
|
+
<p>
|
|
158
|
+
Always run <code>--describe</code> and <code>--plan</code> before a state-changing recipe. The
|
|
159
|
+
library defaults to testnet and cleans up testnet state. Never turn an onboarding proof into a
|
|
160
|
+
mainnet mutation; mainnet operations require the recipe's explicit real-funds confirmation.
|
|
161
|
+
</p>
|
|
162
|
+
</div>
|
|
163
|
+
</section>
|
|
164
|
+
|
|
165
|
+
<section class="wrap">
|
|
166
|
+
<h2>Maintain the proof, not a pile of scenarios</h2>
|
|
167
|
+
<ol>
|
|
168
|
+
<li>Parameterize stable choices such as market, side, order type, and network.</li>
|
|
169
|
+
<li>Compose existing setup, assertion, and cleanup recipes before adding a new top-level recipe.</li>
|
|
170
|
+
<li>Add a platform variant only when the products genuinely differ.</li>
|
|
171
|
+
<li>
|
|
172
|
+
If a locator or screen assertion fails, classify it first. Intentional product change may mean
|
|
173
|
+
small recipe drift; otherwise preserve the failure and fix the product, runtime, or harness layer
|
|
174
|
+
that owns it.
|
|
175
|
+
</li>
|
|
176
|
+
<li>Re-run every caller after a shared node changes and attach the fresh evidence.</li>
|
|
177
|
+
</ol>
|
|
178
|
+
|
|
179
|
+
<div class="btn-row">
|
|
180
|
+
<a class="btn btn-primary" href="tutorials/v3.html">Install skills and the library →</a>
|
|
181
|
+
<a class="btn btn-ghost" href="recipes.html">How recipes prove claims</a>
|
|
182
|
+
<a class="btn btn-ghost" href="reviewers.html">How to review evidence</a>
|
|
183
|
+
</div>
|
|
184
|
+
</section>
|
|
185
|
+
</main>
|
|
186
|
+
|
|
187
|
+
<footer class="footer">
|
|
188
|
+
<div class="wrap">
|
|
189
|
+
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
190
|
+
<p>Verified against mm-harness 0.33+ and the shared MetaMask Perps recipe library.</p>
|
|
191
|
+
</div>
|
|
192
|
+
</footer>
|
|
193
|
+
<script type="module" src="assets/progress.mjs"></script>
|
|
194
|
+
</body>
|
|
195
|
+
</html>
|
package/site/recipes.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="index.html">Start Here</a>
|
|
21
21
|
<a href="recipes.html" aria-current="page">Recipes</a>
|
|
22
|
+
<a href="perps.html">Perps</a>
|
|
22
23
|
<a href="cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="architecture.html">Architecture</a>
|
|
24
25
|
<a href="tutorials/index.html">Tutorials</a>
|
|
@@ -48,6 +49,27 @@
|
|
|
48
49
|
</div>
|
|
49
50
|
|
|
50
51
|
<p>Every clause there does a job against a specific failure mode. Here they are, one at a time.</p>
|
|
52
|
+
|
|
53
|
+
<h2 id="why">What it is for</h2>
|
|
54
|
+
<p>
|
|
55
|
+
<strong>Proof.</strong> Actions drive a real build and assertions check what should be true —
|
|
56
|
+
counted, where a count is what distinguishes working from nearly working. What lands is on-device
|
|
57
|
+
evidence, not a claim in a pull request description.
|
|
58
|
+
</p>
|
|
59
|
+
<p>
|
|
60
|
+
<strong>Self-checking, in the same context.</strong> The agent does not need a fresh session, a
|
|
61
|
+
reviewer, or a CI round-trip to know whether its change held. It replays the recipe mid-task, where
|
|
62
|
+
it is already working, and reads the verdict itself — the inner loop, closed before handoff.
|
|
63
|
+
</p>
|
|
64
|
+
<p>
|
|
65
|
+
<strong>Prevents regressions.</strong> The outer loop is the same recipe replayed against every
|
|
66
|
+
later change. Written once, it keeps refusing the bug it was written for, which is why a recipe is
|
|
67
|
+
worth authoring rather than checking by hand: the check survives the task.
|
|
68
|
+
</p>
|
|
69
|
+
<p>
|
|
70
|
+
<strong>Trust.</strong> Proven, self-checked, and still proving. Review reads evidence rather than
|
|
71
|
+
extending credit, and every gate stays yours to steer.
|
|
72
|
+
</p>
|
|
51
73
|
</section>
|
|
52
74
|
|
|
53
75
|
<section class="wrap">
|
|
@@ -387,7 +409,7 @@
|
|
|
387
409
|
<footer class="footer">
|
|
388
410
|
<div class="wrap">
|
|
389
411
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
390
|
-
<p>Verified against mm-harness 0.
|
|
412
|
+
<p>Verified against mm-harness 0.33+. The annotated recipe is a bundled library recipe, abridged.</p>
|
|
391
413
|
</div>
|
|
392
414
|
</footer>
|
|
393
415
|
|
package/site/reviewers.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="index.html">Start Here</a>
|
|
21
21
|
<a href="recipes.html">Recipes</a>
|
|
22
|
+
<a href="perps.html">Perps</a>
|
|
22
23
|
<a href="cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="architecture.html">Architecture</a>
|
|
24
25
|
<a href="tutorials/index.html">Tutorials</a>
|
|
@@ -365,7 +366,7 @@ Nodes: 6/6 passed
|
|
|
365
366
|
<footer class="footer">
|
|
366
367
|
<div class="wrap">
|
|
367
368
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
368
|
-
<p>Verified against mm-harness 0.
|
|
369
|
+
<p>Verified against mm-harness 0.33+. Example bundle is a real run with identifying values redacted.</p>
|
|
369
370
|
</div>
|
|
370
371
|
</footer>
|
|
371
372
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="../index.html">Start Here</a>
|
|
21
21
|
<a href="../recipes.html">Recipes</a>
|
|
22
|
+
<a href="../perps.html">Perps</a>
|
|
22
23
|
<a href="../cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="../architecture.html">Architecture</a>
|
|
24
25
|
<a href="index.html" aria-current="page">Tutorials</a>
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
<footer class="footer">
|
|
172
173
|
<div class="wrap-wide">
|
|
173
174
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
174
|
-
<p>Verified against mm-harness 0.
|
|
175
|
+
<p>Verified against mm-harness 0.33+.</p>
|
|
175
176
|
</div>
|
|
176
177
|
</footer>
|
|
177
178
|
|
package/site/tutorials/v1.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="../index.html">Start Here</a>
|
|
21
21
|
<a href="../recipes.html">Recipes</a>
|
|
22
|
+
<a href="../perps.html">Perps</a>
|
|
22
23
|
<a href="../cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="../architecture.html">Architecture</a>
|
|
24
25
|
<a href="index.html" aria-current="page">Tutorials</a>
|
|
@@ -103,7 +104,7 @@
|
|
|
103
104
|
<p class="step-why">Install globally, confirm it resolved, then work from inside a product checkout.</p>
|
|
104
105
|
<div class="cmd"><pre><code><span class="p">$ </span>npm i -g @deeeed/metamask-harness@latest
|
|
105
106
|
<span class="p">$ </span>mm-harness --version</code></pre></div>
|
|
106
|
-
<div class="out">0.
|
|
107
|
+
<div class="out">0.33.x <span class="dim">— any 0.33 or newer</span></div>
|
|
107
108
|
</li>
|
|
108
109
|
|
|
109
110
|
<li class="step" data-step="doctor">
|
|
@@ -202,7 +203,7 @@
|
|
|
202
203
|
<footer class="footer">
|
|
203
204
|
<div class="wrap">
|
|
204
205
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
205
|
-
<p>Verified against mm-harness 0.
|
|
206
|
+
<p>Verified against mm-harness 0.33+.</p>
|
|
206
207
|
</div>
|
|
207
208
|
</footer>
|
|
208
209
|
|
package/site/tutorials/v2.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<nav class="nav" aria-label="Main">
|
|
20
20
|
<a href="../index.html">Start Here</a>
|
|
21
21
|
<a href="../recipes.html">Recipes</a>
|
|
22
|
+
<a href="../perps.html">Perps</a>
|
|
22
23
|
<a href="../cheatsheet.html">Cheatsheet</a>
|
|
23
24
|
<a href="../architecture.html">Architecture</a>
|
|
24
25
|
<a href="index.html" aria-current="page">Tutorials</a>
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
<tr><td><code>0:40</code></td><td><code>recipe.json</code> — the graph that executed. Each node's <code>intent</code> is the argument being made.</td></tr>
|
|
78
79
|
<tr><td><code>1:40</code></td><td><code>trace.json</code> — per-node verdicts, timings, outputs. Counts come from here.</td></tr>
|
|
79
80
|
<tr><td><code>2:50</code></td><td><code>summary.json</code> — the verdict, the totals, which libraries were in scope.</td></tr>
|
|
80
|
-
<tr><td><code>3:30</code></td><td>Screenshots,
|
|
81
|
+
<tr><td><code>3:30</code></td><td>Screenshots, plus full-run video on Extension and iOS.</td></tr>
|
|
81
82
|
<tr><td><code>4:20</code></td><td><code>diagnostics.json</code> — application warnings, quarantined from the verdict.</td></tr>
|
|
82
83
|
<tr><td><code>5:10</code></td><td>The two rules that make the whole thing worth reading.</td></tr>
|
|
83
84
|
</tbody>
|
|
@@ -106,9 +107,9 @@
|
|
|
106
107
|
<div class="note blue">
|
|
107
108
|
<span class="note-title">Capture is not symmetric</span>
|
|
108
109
|
<p>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
Extension and iOS record full-run video through capture-helper; Android replay video is not
|
|
111
|
+
implemented yet. <code>mm-harness doctor</code> reports what the current checkout can capture on its
|
|
112
|
+
<code>capture:</code> line.
|
|
112
113
|
</p>
|
|
113
114
|
</div>
|
|
114
115
|
</section>
|
|
@@ -198,7 +199,7 @@
|
|
|
198
199
|
<footer class="footer">
|
|
199
200
|
<div class="wrap">
|
|
200
201
|
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
201
|
-
<p>Verified against mm-harness 0.
|
|
202
|
+
<p>Verified against mm-harness 0.33+.</p>
|
|
202
203
|
</div>
|
|
203
204
|
</footer>
|
|
204
205
|
|