@deeeed/metamask-harness 0.28.0 → 0.29.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 +19 -0
- package/README.md +41 -0
- package/adapters/extension/build-lavamoat.sh +2 -1
- package/adapters/extension/ensure-browser.sh +82 -9
- package/adapters/extension/inject.mjs +1 -0
- package/adapters/extension/launch-browser.cjs +83 -1
- package/adapters/extension/lib/chrome-args.cjs +325 -1
- package/adapters/extension/lib/playwright-cdp.cjs +34 -0
- package/adapters/extension/lib/slot-title.cjs +2 -4
- package/adapters/extension/lib/validation-launch-supervisor.cjs +292 -0
- package/adapters/extension/lib/validation-process-ownership.cjs +69 -0
- package/adapters/extension/reattach.sh +2 -1
- package/adapters/extension/sidepanel-toggle.sh +14 -96
- package/adapters/extension/wallet-fixture-state.cjs +8 -31
- package/adapters/manifest.json +16 -0
- package/adapters/shared/private-atomic-write.cjs +47 -0
- package/adapters/shared/setup-base.sh +864 -0
- package/dist/adapters/extension/runtime.js +367 -24
- package/dist/adapters/extension/validation-process-ownership.js +10 -0
- package/dist/cli-commands.js +1 -0
- package/dist/command-contract.js +12 -0
- package/dist/commands/launch/extension.js +130 -19
- package/dist/commands/setup-base.js +24 -0
- package/dist/mm-harness-cli.js +28 -2
- package/library/actions/extension/analytics/consent.mjs +203 -0
- package/library/actions/extension/analytics/set_consent.mjs +19 -143
- package/library/actions/extension/perps/perps.mjs +2 -16
- package/library/actions/extension/perps/state.mjs +20 -0
- package/library/actions/extension/wallet/list_accounts.mjs +3 -25
- package/library/actions/extension/wallet/read_state.mjs +3 -23
- package/library/actions/extension/wallet/select_account.mjs +6 -33
- package/library/actions/extension/wallet/setup.mjs +2 -20
- package/library/actions/extension/wallet/state.mjs +111 -0
- package/library/recipes/runner/action-validation.extension.recipe.json +1 -1
- package/library/recipes/runner/action-validation.mobile.recipe.json +1 -1
- package/package.json +7 -4
- package/scripts/site-contrast.mjs +538 -0
- package/site/architecture.html +415 -0
- package/site/assets/progress.mjs +272 -0
- package/site/assets/style.css +808 -0
- package/site/cheatsheet.html +305 -0
- package/site/index.html +643 -0
- package/site/recipes.html +396 -0
- package/site/reviewers.html +374 -0
- package/site/tutorials/index.html +180 -0
- package/site/tutorials/v1.html +211 -0
- package/site/tutorials/v2.html +207 -0
- package/site/tutorials/v3.html +214 -0
- package/site/tutorials/v4.html +195 -0
- package/site/tutorials/v5.html +163 -0
- package/site/tutorials/v6.html +165 -0
- package/site/tutorials/v7.html +184 -0
package/site/index.html
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
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>Start Here — MetaMask agentic coding</title>
|
|
7
|
+
<meta name="description" content="Drive a real MetaMask build from one CLI and leave evidence a reviewer can trust. An interactive walkthrough: discover, drive, prove.">
|
|
8
|
+
<link rel="stylesheet" href="assets/style.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body data-progress-page="start">
|
|
11
|
+
<a class="skip" href="#steps">Skip to the walkthrough</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" aria-current="page">Start Here</a>
|
|
21
|
+
<a href="recipes.html">Recipes</a>
|
|
22
|
+
<a href="cheatsheet.html">Cheatsheet</a>
|
|
23
|
+
<a href="architecture.html">Architecture</a>
|
|
24
|
+
<a href="tutorials/index.html">Tutorials</a>
|
|
25
|
+
<a href="reviewers.html">For Reviewers</a>
|
|
26
|
+
</nav>
|
|
27
|
+
</div>
|
|
28
|
+
</header>
|
|
29
|
+
|
|
30
|
+
<div class="progress-rail">
|
|
31
|
+
<div class="wrap progress-inner">
|
|
32
|
+
<div class="progress-track" role="progressbar" aria-label="Walkthrough progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
|
|
33
|
+
<div class="progress-fill"></div>
|
|
34
|
+
</div>
|
|
35
|
+
<span class="progress-label">0/8 steps</span>
|
|
36
|
+
<button type="button" class="progress-reset">Reset</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<main>
|
|
41
|
+
<section class="wrap hero">
|
|
42
|
+
<span class="eyebrow">Agentic coding at MetaMask</span>
|
|
43
|
+
<h1>Drive the wallet. Prove what happened.</h1>
|
|
44
|
+
<p class="lede">
|
|
45
|
+
<code>mm-harness</code> launches a real MetaMask build — Extension, Mobile, or Core — drives it
|
|
46
|
+
through typed actions, and writes evidence a reviewer can check without taking your word for it.
|
|
47
|
+
Eight steps from an empty terminal to a green run you can open.
|
|
48
|
+
</p>
|
|
49
|
+
<div class="hero-meta">
|
|
50
|
+
<span>requires mm-harness 0.26+</span>
|
|
51
|
+
<span>~20 minutes</span>
|
|
52
|
+
<span>progress saves in this browser</span>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
|
|
56
|
+
<section class="wrap">
|
|
57
|
+
<h2 id="model">Two words</h2>
|
|
58
|
+
<p>
|
|
59
|
+
An <strong>action</strong> is one typed operation: unlock the wallet, press a button, read the
|
|
60
|
+
account state. A <strong>recipe</strong> is a JSON graph of actions that proves a task. Run one
|
|
61
|
+
against a real app and the harness records what happened — a per-step trace, a verdict,
|
|
62
|
+
screenshots. The steps below follow <strong>discover → drive → prove</strong>, which is also the
|
|
63
|
+
order you will work in from here on.
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
<div class="doctrine">
|
|
67
|
+
<p>
|
|
68
|
+
<span class="k">You never guess capabilities — you discover them.</span>
|
|
69
|
+
<code>mm-harness actions</code> prints what this checkout can do, and that list is law. The tool
|
|
70
|
+
refuses an invented action rather than improvising one, which is why its output is worth
|
|
71
|
+
trusting.
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
</section>
|
|
75
|
+
|
|
76
|
+
<section class="wrap">
|
|
77
|
+
<div class="agent-card">
|
|
78
|
+
<h2 style="margin-top:0">Or hand it to your agent</h2>
|
|
79
|
+
<p>
|
|
80
|
+
Start your agent in (or near) a MetaMask checkout and paste the prompt below. It walks the same
|
|
81
|
+
eight steps, following each error's own instructions rather than improvising.
|
|
82
|
+
</p>
|
|
83
|
+
<p>
|
|
84
|
+
Do them by hand once anyway — you will be reviewing this workflow's output later, and a bundle
|
|
85
|
+
you produced yourself is much easier to trust.
|
|
86
|
+
</p>
|
|
87
|
+
<details class="prompt">
|
|
88
|
+
<summary>Show the copyable prompt</summary>
|
|
89
|
+
<div class="prompt-body">
|
|
90
|
+
<div class="cmd"><pre><code>Task: set me up with the MetaMask recipe workflow and prove it works end-to-end.
|
|
91
|
+
Follow these steps exactly. Where a tool prints an error, its message contains the
|
|
92
|
+
exact next command — follow that instead of improvising.
|
|
93
|
+
|
|
94
|
+
1. Install or update the harness: `npm i -g @deeeed/metamask-harness@latest`,
|
|
95
|
+
then `mm-harness --version` to confirm it resolved.
|
|
96
|
+
2. Repo: use the product checkout I started you in (metamask-extension,
|
|
97
|
+
metamask-mobile, or core). If I started you outside one, ask me which ONE
|
|
98
|
+
product to clone and clone just that — do not clone multiples.
|
|
99
|
+
3. Run `mm-harness doctor` from the checkout and fix everything it reports by
|
|
100
|
+
following each finding's own instructions until doctor passes. `mm-harness
|
|
101
|
+
doctor --fix` repairs harness-owned runtime state; it will not invent
|
|
102
|
+
credentials or choose a wallet fixture for me.
|
|
103
|
+
4. Launch the app under harness control: `mm-harness launch` (add `ios` or
|
|
104
|
+
`android` for mobile; core is headless and has nothing to launch — use
|
|
105
|
+
`mm-harness verify` there). Wait for the runtime to be ready.
|
|
106
|
+
5. Discovery before anything else: run `mm-harness actions`. That list is the
|
|
107
|
+
ONLY set of capabilities you may use, now and in every future session.
|
|
108
|
+
Never invent an action or a flag. If you need something that is not listed,
|
|
109
|
+
stop and tell me.
|
|
110
|
+
6. Prove basic control with two direct calls. On Extension or Mobile, run
|
|
111
|
+
`mm-harness call read_state` and one listed visible UI action. On Core, run
|
|
112
|
+
`mm-harness call read_positions mode=all` and
|
|
113
|
+
`mm-harness call command cmd="echo core-ready"`. Show me both outputs.
|
|
114
|
+
7. Run one library recipe end-to-end. Pick a smoke recipe from
|
|
115
|
+
`mm-harness run --list`, then:
|
|
116
|
+
`mm-harness run <recipe> --artifacts-dir ./first-recipe-artifacts`
|
|
117
|
+
When it finishes, show me: the status from summary.json, the per-node
|
|
118
|
+
results from trace.json, and the artifact paths.
|
|
119
|
+
8. Close by telling me, in three sentences: what a recipe is, where the
|
|
120
|
+
evidence lives, and which command lists what I can do next.
|
|
121
|
+
|
|
122
|
+
Rules that are not optional: evidence comes only from executed actions — never
|
|
123
|
+
fabricate a result or edit state to manufacture one; if the harness says a
|
|
124
|
+
capability is unsupported, stop and report it rather than working around it;
|
|
125
|
+
if any step fails twice after following its error's instructions, stop and show
|
|
126
|
+
me the exact error.</code></pre></div>
|
|
127
|
+
</div>
|
|
128
|
+
</details>
|
|
129
|
+
</div>
|
|
130
|
+
</section>
|
|
131
|
+
|
|
132
|
+
<section class="wrap">
|
|
133
|
+
<h2 id="steps">The walkthrough</h2>
|
|
134
|
+
<p>Checkboxes persist in this browser, so you can close the tab and come back.</p>
|
|
135
|
+
|
|
136
|
+
<ol class="steps">
|
|
137
|
+
|
|
138
|
+
<li class="step" data-step="install">
|
|
139
|
+
<div class="step-head">
|
|
140
|
+
<input type="checkbox" class="step-check" id="c-install" aria-labelledby="t-install">
|
|
141
|
+
<h3 class="step-title" id="t-install">Get the CLI</h3>
|
|
142
|
+
</div>
|
|
143
|
+
<p class="step-why">Both paths end with <code>mm-harness</code> on your PATH.</p>
|
|
144
|
+
|
|
145
|
+
<div class="grid grid-2" style="margin:1.2rem 0">
|
|
146
|
+
<div class="path-card">
|
|
147
|
+
<div class="path-tag">Path A — from zero</div>
|
|
148
|
+
<h4 style="margin:0 0 .5rem">No checkout yet</h4>
|
|
149
|
+
<p style="font-size:.92rem;color:var(--text-dim)">
|
|
150
|
+
A one-shot bootstrap command is being prepared but is <strong>not published yet</strong> —
|
|
151
|
+
it is not on the npm package, so do not paste it from elsewhere expecting it to resolve.
|
|
152
|
+
Until it ships, use the install below and clone <em>one</em> product repo yourself.
|
|
153
|
+
</p>
|
|
154
|
+
<p style="margin-bottom:0"><span class="badge soon">bootstrap: shipping soon</span></p>
|
|
155
|
+
</div>
|
|
156
|
+
<div class="path-card">
|
|
157
|
+
<div class="path-tag">Path B — you already have a checkout</div>
|
|
158
|
+
<h4 style="margin:0 0 .5rem">Install and cd in</h4>
|
|
159
|
+
<p style="font-size:.92rem;color:var(--text-dim)">
|
|
160
|
+
Install globally, then work from inside the checkout. The product, ports, and runtime paths
|
|
161
|
+
are detected from where you are standing; there is no config file to write.
|
|
162
|
+
</p>
|
|
163
|
+
<p style="margin-bottom:0"><span class="badge live">available now</span></p>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="cmd"><pre><code><span class="p">$ </span>npm i -g @deeeed/metamask-harness@latest
|
|
168
|
+
<span class="p">$ </span>mm-harness --version</code></pre></div>
|
|
169
|
+
|
|
170
|
+
<div class="out-label">Expected</div>
|
|
171
|
+
<div class="out">0.26.x <span class="dim">— any 0.26 or newer</span></div>
|
|
172
|
+
|
|
173
|
+
<p class="step-why">Everything from here runs inside a product checkout:</p>
|
|
174
|
+
<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>
|
|
175
|
+
|
|
176
|
+
<details class="fail">
|
|
177
|
+
<summary>If it fails</summary>
|
|
178
|
+
<div class="fail-body">
|
|
179
|
+
<p>
|
|
180
|
+
<strong><code>mm-harness: command not found</code></strong> — your global npm bin is not on
|
|
181
|
+
PATH. <code>npm prefix -g</code> prints the global prefix; add its <code>bin</code>
|
|
182
|
+
directory to your shell profile.
|
|
183
|
+
</p>
|
|
184
|
+
<p>
|
|
185
|
+
<strong>Older than 0.26</strong> — a stale global install is the most common source of
|
|
186
|
+
"the docs don't match my terminal". Run <code>mm-harness update</code>, or
|
|
187
|
+
<code>update --check</code> to look without installing.
|
|
188
|
+
</p>
|
|
189
|
+
</div>
|
|
190
|
+
</details>
|
|
191
|
+
</li>
|
|
192
|
+
|
|
193
|
+
<li class="step" data-step="doctor">
|
|
194
|
+
<div class="step-head">
|
|
195
|
+
<input type="checkbox" class="step-check" id="c-doctor" aria-labelledby="t-doctor">
|
|
196
|
+
<h3 class="step-title" id="t-doctor">Run doctor — and learn to read the errors</h3>
|
|
197
|
+
</div>
|
|
198
|
+
<p class="step-why">
|
|
199
|
+
A read-only readiness check that launches nothing and names the exact command that fixes each
|
|
200
|
+
finding.
|
|
201
|
+
</p>
|
|
202
|
+
|
|
203
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness doctor</code></pre></div>
|
|
204
|
+
|
|
205
|
+
<div class="out-label">Expected — a checkout that needs one repair</div>
|
|
206
|
+
<div class="out"><span class="ok">pass</span> extension bridge present manifest=…/extension.action-manifest.json
|
|
207
|
+
harness: @deeeed/metamask-harness@0.26.x
|
|
208
|
+
runtime: decision=install (deps-missing) deps=missing webpack=down
|
|
209
|
+
Dependencies are not installed (no yarn install-state markers).
|
|
210
|
+
runtime-context: temp/recipe/runtime/agentic-runtime.json (<span class="bad">absent</span> — run mm-harness doctor --fix)
|
|
211
|
+
capture: <span class="ok">pass</span> (screenshots: capture-helper → cdp; video: capture-helper)
|
|
212
|
+
<span class="hint">Next: mm-harness launch --adapter extension --target '…'</span></div>
|
|
213
|
+
|
|
214
|
+
<div class="note">
|
|
215
|
+
<span class="note-title">The habit the toolchain is built around</span>
|
|
216
|
+
<p>
|
|
217
|
+
Every failure names one next action. Above, the finding tells you to run
|
|
218
|
+
<code>doctor --fix</code> and the <code>Next:</code> line says where to go once it passes.
|
|
219
|
+
Read the message and do what it says — that is also what lets an agent recover on its own
|
|
220
|
+
instead of guessing.
|
|
221
|
+
</p>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<p class="step-why">Do what it said:</p>
|
|
225
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness doctor --fix</code></pre></div>
|
|
226
|
+
|
|
227
|
+
<div class="out-label">Expected — the finding is gone</div>
|
|
228
|
+
<div class="out"><span class="ok">pass</span> extension bridge present ready=true <span class="ok">fixed=[runtime-context]</span> failed=[]</div>
|
|
229
|
+
|
|
230
|
+
<p class="step-why">
|
|
231
|
+
<code>--fix</code> repairs runtime state the harness owns. It will not launch the app, invent
|
|
232
|
+
credentials, or pick a wallet fixture; those are your decisions, so it stops and asks.
|
|
233
|
+
</p>
|
|
234
|
+
|
|
235
|
+
<details class="fail">
|
|
236
|
+
<summary>If it fails</summary>
|
|
237
|
+
<div class="fail-body">
|
|
238
|
+
<p>
|
|
239
|
+
<strong><code>deps=missing</code></strong> — run <code>yarn install</code> as usual for
|
|
240
|
+
that repo. The harness does not manage your product repo's dependencies.
|
|
241
|
+
</p>
|
|
242
|
+
<p>
|
|
243
|
+
<strong>A finding you do not understand</strong> — <code>mm-harness doctor --json</code>
|
|
244
|
+
carries the same findings with structured detail, and is the form to paste to an agent or a
|
|
245
|
+
bug report.
|
|
246
|
+
</p>
|
|
247
|
+
<p>
|
|
248
|
+
<strong>Still failing after <code>--fix</code></strong> — <code>fixed=[…] failed=[…]</code>
|
|
249
|
+
separates the two. Anything in <code>failed</code> needs a human decision; the finding says
|
|
250
|
+
which.
|
|
251
|
+
</p>
|
|
252
|
+
</div>
|
|
253
|
+
</details>
|
|
254
|
+
</li>
|
|
255
|
+
|
|
256
|
+
<li class="step" data-step="launch">
|
|
257
|
+
<div class="step-head">
|
|
258
|
+
<input type="checkbox" class="step-check" id="c-launch" aria-labelledby="t-launch">
|
|
259
|
+
<h3 class="step-title" id="t-launch">Launch the app under harness control</h3>
|
|
260
|
+
</div>
|
|
261
|
+
<p class="step-why">
|
|
262
|
+
Starts the app and its dev server, installing the runtime overlay first if missing. Platform is
|
|
263
|
+
auto-detected; mobile needs an explicit target because the harness will not pick a simulator for
|
|
264
|
+
you.
|
|
265
|
+
</p>
|
|
266
|
+
|
|
267
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness launch <span class="dim"># extension — fullscreen by default</span>
|
|
268
|
+
<span class="p">$ </span>mm-harness launch ios <span class="dim"># mobile — target is mandatory</span>
|
|
269
|
+
<span class="p">$ </span>mm-harness launch android</code></pre></div>
|
|
270
|
+
|
|
271
|
+
<p class="step-why">
|
|
272
|
+
Quick relaunch is the default and reuses a healthy runtime. <code>--build</code> is the escape
|
|
273
|
+
hatch that always clean-builds; reach for it only when native or bundler output changed.
|
|
274
|
+
</p>
|
|
275
|
+
|
|
276
|
+
<div class="out-label">Core is headless — and says so</div>
|
|
277
|
+
<div class="out"><span class="bad">✗</span> mm-harness launch: core is headless; there is nothing to launch.
|
|
278
|
+
<span class="hint">Next: mm-harness verify</span></div>
|
|
279
|
+
<p class="step-why">
|
|
280
|
+
In <code>core</code> there is no UI to launch, so you get the equivalent step instead of a
|
|
281
|
+
silent failure. Run <code>mm-harness verify</code> and continue.
|
|
282
|
+
</p>
|
|
283
|
+
|
|
284
|
+
<details class="fail">
|
|
285
|
+
<summary>If it fails</summary>
|
|
286
|
+
<div class="fail-body">
|
|
287
|
+
<p>
|
|
288
|
+
<strong>Mobile: more than one device</strong> — the harness lists what it found rather than
|
|
289
|
+
guessing. Re-run with <code>--device <udid|serial|name></code>.
|
|
290
|
+
</p>
|
|
291
|
+
<p>
|
|
292
|
+
<strong>Stuck</strong> — <code>mm-harness logs</code> tails the dev server and app logs;
|
|
293
|
+
<code>mm-harness status</code> shows the adapter, devices, and next command.
|
|
294
|
+
</p>
|
|
295
|
+
<p>
|
|
296
|
+
<strong>Clean slate</strong> — <code>mm-harness stop</code> stops only what this checkout
|
|
297
|
+
owns, so parallel checkouts are untouched. Stopping nothing is success.
|
|
298
|
+
</p>
|
|
299
|
+
</div>
|
|
300
|
+
</details>
|
|
301
|
+
</li>
|
|
302
|
+
|
|
303
|
+
<li class="step" data-step="actions">
|
|
304
|
+
<div class="step-head">
|
|
305
|
+
<input type="checkbox" class="step-check" id="c-actions" aria-labelledby="t-actions">
|
|
306
|
+
<h3 class="step-title" id="t-actions">Discover what this checkout can do</h3>
|
|
307
|
+
</div>
|
|
308
|
+
<p class="step-why">
|
|
309
|
+
Prints every typed operation available here, with its fields. The set differs per product:
|
|
310
|
+
Mobile has UI actions, Core is headless and has none.
|
|
311
|
+
</p>
|
|
312
|
+
|
|
313
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness actions --categories</code></pre></div>
|
|
314
|
+
|
|
315
|
+
<div class="out-label">Expected — a mobile checkout</div>
|
|
316
|
+
<div class="out">analytics (4)
|
|
317
|
+
assertion (4)
|
|
318
|
+
control (4)
|
|
319
|
+
evidence (2)
|
|
320
|
+
perps (11)
|
|
321
|
+
runtime (4)
|
|
322
|
+
ui (7)
|
|
323
|
+
utility (1)
|
|
324
|
+
wallet (6)</div>
|
|
325
|
+
|
|
326
|
+
<p class="step-why">Then look inside a category, search, or inspect one action's fields:</p>
|
|
327
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness actions --category ui
|
|
328
|
+
<span class="p">$ </span>mm-harness actions positions
|
|
329
|
+
<span class="p">$ </span>mm-harness actions --action read_state</code></pre></div>
|
|
330
|
+
|
|
331
|
+
<div class="doctrine">
|
|
332
|
+
<p>
|
|
333
|
+
<span class="k">The discovered list is law.</span> It is the capability boundary, not a
|
|
334
|
+
subset of some larger API. Call something not on it and the harness refuses, pointing you back
|
|
335
|
+
at discovery:
|
|
336
|
+
</p>
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<div class="out"><span class="bad">✗</span> call: unknown action "totally_made_up" for the extension adapter.
|
|
340
|
+
<span class="hint">Next: mm-harness actions --adapter extension --json</span></div>
|
|
341
|
+
|
|
342
|
+
<p class="step-why">
|
|
343
|
+
That refusal is why the evidence is worth reading: a tool that invents an action when asked for
|
|
344
|
+
something impossible would also produce a plausible-looking result, and you would have no way to
|
|
345
|
+
tell. Add <code>--json</code> when feeding this to an agent.
|
|
346
|
+
</p>
|
|
347
|
+
|
|
348
|
+
<details class="fail">
|
|
349
|
+
<summary>If it fails</summary>
|
|
350
|
+
<div class="fail-body">
|
|
351
|
+
<p>
|
|
352
|
+
<strong>Fewer actions than expected</strong> — you are seeing only the bundled set. Team
|
|
353
|
+
libraries add domain actions and must be declared: <a href="tutorials/v3.html">V3</a>.
|
|
354
|
+
</p>
|
|
355
|
+
<p>
|
|
356
|
+
<strong>Wrong product detected</strong> — pass <code>--adapter mobile|extension|core</code>
|
|
357
|
+
explicitly, and check you are inside the checkout you meant.
|
|
358
|
+
</p>
|
|
359
|
+
</div>
|
|
360
|
+
</details>
|
|
361
|
+
</li>
|
|
362
|
+
|
|
363
|
+
<li class="step" data-step="call-read">
|
|
364
|
+
<div class="step-head">
|
|
365
|
+
<input type="checkbox" class="step-check" id="c-call-read" aria-labelledby="t-call-read">
|
|
366
|
+
<h3 class="step-title" id="t-call-read">Drive it: read product state</h3>
|
|
367
|
+
</div>
|
|
368
|
+
<p class="step-why">
|
|
369
|
+
<code>call</code> runs one action as a one-node recipe through the real engine — same execution
|
|
370
|
+
path, trace, and evidence as a full run. Start with a read; reads cannot break anything.
|
|
371
|
+
</p>
|
|
372
|
+
|
|
373
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness call read_state</code></pre></div>
|
|
374
|
+
|
|
375
|
+
<div class="note blue">
|
|
376
|
+
<span class="note-title">Core branch</span>
|
|
377
|
+
<p>
|
|
378
|
+
Core has no wallet UI. Exercise its live controller boundary instead:
|
|
379
|
+
<code>mm-harness call read_positions mode=all</code>.
|
|
380
|
+
</p>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
<p class="step-why">
|
|
384
|
+
Short names resolve when unambiguous: <code>read_state</code> finds
|
|
385
|
+
<code>metamask.wallet.read_state</code>. An ambiguous one stops and lists the candidates.
|
|
386
|
+
</p>
|
|
387
|
+
|
|
388
|
+
<div class="out-label">Expected — shape of the result</div>
|
|
389
|
+
<div class="out">call read_state: <span class="ok">pass</span>
|
|
390
|
+
Result:
|
|
391
|
+
{
|
|
392
|
+
"action": "metamask.wallet.read_state",
|
|
393
|
+
"state": {
|
|
394
|
+
"selectedAccount": { "name": "Account 1", "address": "0x…" },
|
|
395
|
+
"completedOnboarding": true
|
|
396
|
+
},
|
|
397
|
+
"redacted": true
|
|
398
|
+
}</div>
|
|
399
|
+
|
|
400
|
+
<p class="step-why">
|
|
401
|
+
Note <code>"redacted": true</code> — wallet state passes through redaction before reaching an
|
|
402
|
+
artifact, because these bundles get attached to pull requests.
|
|
403
|
+
</p>
|
|
404
|
+
|
|
405
|
+
<details class="fail">
|
|
406
|
+
<summary>If it fails</summary>
|
|
407
|
+
<div class="fail-body">
|
|
408
|
+
<p>
|
|
409
|
+
<strong>Runtime health check failed / CDP not reachable</strong> — the app is not running.
|
|
410
|
+
Complete the launch step; <code>mm-harness status</code> confirms what is live.
|
|
411
|
+
</p>
|
|
412
|
+
<p>
|
|
413
|
+
<strong>Mobile: more than one device</strong> — <code>call</code> fails fast and lists
|
|
414
|
+
them. Re-run with <code>--device</code>.
|
|
415
|
+
</p>
|
|
416
|
+
<p>
|
|
417
|
+
<strong><code>unknown action</code></strong> — not in this adapter's set.
|
|
418
|
+
<code>mm-harness call --list</code> shows what <code>call</code> accepts here.
|
|
419
|
+
</p>
|
|
420
|
+
</div>
|
|
421
|
+
</details>
|
|
422
|
+
</li>
|
|
423
|
+
|
|
424
|
+
<li class="step" data-step="call-ui">
|
|
425
|
+
<div class="step-head">
|
|
426
|
+
<input type="checkbox" class="step-check" id="c-call-ui" aria-labelledby="t-call-ui">
|
|
427
|
+
<h3 class="step-title" id="t-call-ui">Drive it again: UI or headless Core</h3>
|
|
428
|
+
</div>
|
|
429
|
+
<p class="step-why">Keep the app visible for this one.</p>
|
|
430
|
+
|
|
431
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness call navigate page=perps</code></pre></div>
|
|
432
|
+
|
|
433
|
+
<div class="note blue">
|
|
434
|
+
<span class="note-title">Core branch</span>
|
|
435
|
+
<p>
|
|
436
|
+
Prove a second headless action instead:
|
|
437
|
+
<code>mm-harness call command cmd="echo core-ready"</code>.
|
|
438
|
+
</p>
|
|
439
|
+
</div>
|
|
440
|
+
|
|
441
|
+
<p class="step-why">
|
|
442
|
+
Fields are passed as <code>key=value</code>, or <code>--arg k=v</code> for the same effect.
|
|
443
|
+
</p>
|
|
444
|
+
|
|
445
|
+
<div class="note blue">
|
|
446
|
+
<span class="note-title">Semantic intent, not coordinates</span>
|
|
447
|
+
<p>
|
|
448
|
+
You asked for a <em>page</em>, not a pixel or a route. The adapter owns the mapping and
|
|
449
|
+
verifies where it landed, so a drifted route fails loudly instead of quietly doing nothing —
|
|
450
|
+
which is why these actions survive redesigns.
|
|
451
|
+
<code>mm-harness actions --action navigate</code> lists accepted values.
|
|
452
|
+
</p>
|
|
453
|
+
</div>
|
|
454
|
+
|
|
455
|
+
<p class="step-why">Others worth trying, if your adapter lists them:</p>
|
|
456
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness call press text="Account 1"
|
|
457
|
+
<span class="p">$ </span>mm-harness call screenshot path=proof.png</code></pre></div>
|
|
458
|
+
|
|
459
|
+
<details class="fail">
|
|
460
|
+
<summary>If it fails</summary>
|
|
461
|
+
<div class="fail-body">
|
|
462
|
+
<p>
|
|
463
|
+
<strong>Target not found</strong> — the element is not on screen. Actions do not hunt
|
|
464
|
+
blindly; use <code>wait_for</code> when something needs to mount first.
|
|
465
|
+
</p>
|
|
466
|
+
<p>
|
|
467
|
+
<strong>Core has no UI actions</strong> — correct, it is headless. Try
|
|
468
|
+
<code>mm-harness call command cmd="echo hello"</code> there instead.
|
|
469
|
+
</p>
|
|
470
|
+
</div>
|
|
471
|
+
</details>
|
|
472
|
+
</li>
|
|
473
|
+
|
|
474
|
+
<li class="step" data-step="run">
|
|
475
|
+
<div class="step-head">
|
|
476
|
+
<input type="checkbox" class="step-check" id="c-run" aria-labelledby="t-run">
|
|
477
|
+
<h3 class="step-title" id="t-run">Prove it: run your first recipe</h3>
|
|
478
|
+
</div>
|
|
479
|
+
<p class="step-why">
|
|
480
|
+
Everything so far was driving by hand. A recipe composes the same operations into a graph that
|
|
481
|
+
runs identically every time and records what happened. Start with what ships:
|
|
482
|
+
</p>
|
|
483
|
+
|
|
484
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness run --list</code></pre></div>
|
|
485
|
+
|
|
486
|
+
<div class="out-label">Expected — an extension checkout</div>
|
|
487
|
+
<div class="out">runnable recipes (extension)
|
|
488
|
+
Inspect: mm-harness run <recipe> --describe
|
|
489
|
+
perps.smoke [metamask] variant=extension — Non-mutating Perps domain smoke…
|
|
490
|
+
runner.smoke [metamask] variant=extension — Proves the runner executes manifest-declared actions…
|
|
491
|
+
wallet.smoke [metamask] variant=extension — Fixture-backed proof that the wallet is reachable, unlocked…</div>
|
|
492
|
+
|
|
493
|
+
<p class="step-why">
|
|
494
|
+
Read one first. <code>--describe</code> shows its parameters and every action it composes:
|
|
495
|
+
</p>
|
|
496
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness run wallet.smoke --describe
|
|
497
|
+
<span class="p">$ </span>mm-harness run wallet.smoke --plan</code></pre></div>
|
|
498
|
+
|
|
499
|
+
<p class="step-why">
|
|
500
|
+
<code>--plan</code> validates and prints the execution plan while touching nothing, exiting 5 if
|
|
501
|
+
the recipe is invalid. Cheap check before the expensive one.
|
|
502
|
+
</p>
|
|
503
|
+
|
|
504
|
+
<p class="step-why">Now for real, with the evidence somewhere you chose:</p>
|
|
505
|
+
<div class="cmd"><pre><code><span class="p">$ </span>mm-harness run wallet.smoke --artifacts-dir ./first-recipe-artifacts</code></pre></div>
|
|
506
|
+
|
|
507
|
+
<div class="out-label">Expected</div>
|
|
508
|
+
<div class="out"><span class="ok">PASS</span> recipe run [extension]
|
|
509
|
+
summary:
|
|
510
|
+
<span class="ok">PASS</span> status (app.status, 9ms): platform=extension
|
|
511
|
+
<span class="ok">PASS</span> fixture (metamask.wallet.fixture_status, 17ms): path=temp/recipe/runtime/wallet-fixture.json
|
|
512
|
+
<span class="ok">PASS</span> unlock (metamask.wallet.ensure_unlocked, 100ms): proof=extension-unlocked-state
|
|
513
|
+
<span class="ok">PASS</span> state (metamask.wallet.read_state, 94ms): proof=extension-wallet-state
|
|
514
|
+
<span class="ok">PASS</span> screenshot (ui.screenshot, 6.0s): path=screenshots/wallet-smoke.png
|
|
515
|
+
<span class="ok">PASS</span> done (end, 0ms)
|
|
516
|
+
artifacts (6):
|
|
517
|
+
Human run report: ./first-recipe-artifacts/report.md
|
|
518
|
+
Run summary: ./first-recipe-artifacts/summary.json
|
|
519
|
+
Execution trace: ./first-recipe-artifacts/trace.json
|
|
520
|
+
Executed recipe: ./first-recipe-artifacts/recipe.json
|
|
521
|
+
<span class="dim">…</span></div>
|
|
522
|
+
|
|
523
|
+
<div class="note">
|
|
524
|
+
<span class="note-title">Wallet fixtures</span>
|
|
525
|
+
<p>
|
|
526
|
+
Recipes needing a signed-in wallet read one canonical fixture per checkout; the password comes
|
|
527
|
+
<em>from</em> the fixture and is never typed. On a missing fixture,
|
|
528
|
+
<code>mm-harness fixtures</code> shows its status and the safe next command.
|
|
529
|
+
<code>fixtures init --dev</code> creates a disposable public test wallet that must never hold
|
|
530
|
+
real funds.
|
|
531
|
+
</p>
|
|
532
|
+
</div>
|
|
533
|
+
|
|
534
|
+
<details class="fail">
|
|
535
|
+
<summary>If it fails</summary>
|
|
536
|
+
<div class="fail-body">
|
|
537
|
+
<p>
|
|
538
|
+
<strong>Exit 5</strong> — validation or trust failure. The recipe is the problem, not your
|
|
539
|
+
environment; nothing executed. The message names the invalid part.
|
|
540
|
+
</p>
|
|
541
|
+
<p>
|
|
542
|
+
<strong>Exit 1</strong> — it ran and an action failed. A real result, not a tooling
|
|
543
|
+
problem: find the first node in <code>trace.json</code> with <code>"ok": false</code>.
|
|
544
|
+
</p>
|
|
545
|
+
<p>
|
|
546
|
+
<strong>Exit 3</strong> — infrastructure, not your recipe: the app or dev server fell over.
|
|
547
|
+
Try <code>mm-harness doctor</code> then <code>mm-harness logs</code>.
|
|
548
|
+
</p>
|
|
549
|
+
<p>
|
|
550
|
+
<strong>Lost track</strong> — <code>mm-harness last</code> prints the last significant
|
|
551
|
+
command with its verdict and evidence paths.
|
|
552
|
+
</p>
|
|
553
|
+
</div>
|
|
554
|
+
</details>
|
|
555
|
+
</li>
|
|
556
|
+
|
|
557
|
+
<li class="step" data-step="evidence">
|
|
558
|
+
<div class="step-head">
|
|
559
|
+
<input type="checkbox" class="step-check" id="c-evidence" aria-labelledby="t-evidence">
|
|
560
|
+
<h3 class="step-title" id="t-evidence">Open the evidence bundle</h3>
|
|
561
|
+
</div>
|
|
562
|
+
<p class="step-why">The run left a directory behind. This is the part that beats clicking through by hand.</p>
|
|
563
|
+
|
|
564
|
+
<div class="cmd"><pre><code><span class="p">$ </span>ls first-recipe-artifacts
|
|
565
|
+
<span class="p">$ </span>cat first-recipe-artifacts/summary.json
|
|
566
|
+
<span class="p">$ </span>open first-recipe-artifacts/screenshots</code></pre></div>
|
|
567
|
+
|
|
568
|
+
<div class="table-scroll">
|
|
569
|
+
<table>
|
|
570
|
+
<thead><tr><th>File</th><th>What it answers</th></tr></thead>
|
|
571
|
+
<tbody>
|
|
572
|
+
<tr><td><code>summary.json</code></td><td>Did it pass? How many nodes, how long, which libraries were in play. The verdict.</td></tr>
|
|
573
|
+
<tr><td><code>trace.json</code></td><td>What happened at every step: per-node verdict, timing, inputs, outputs. Counts come from here.</td></tr>
|
|
574
|
+
<tr><td><code>recipe.json</code></td><td>The graph that actually executed, including each node's stated intent.</td></tr>
|
|
575
|
+
<tr><td><code>report.md</code></td><td>The same story in one readable page — the thing to skim first.</td></tr>
|
|
576
|
+
<tr><td><code>screenshots/</code></td><td>Visual evidence captured during the run.</td></tr>
|
|
577
|
+
<tr><td><code>diagnostics.json</code></td><td>Warnings and errors the app emitted, kept deliberately separate from the verdict.</td></tr>
|
|
578
|
+
</tbody>
|
|
579
|
+
</table>
|
|
580
|
+
</div>
|
|
581
|
+
|
|
582
|
+
<p class="step-why">
|
|
583
|
+
Read them in that order: <code>report.md</code>, then <code>summary.json</code> for the verdict,
|
|
584
|
+
then <code>trace.json</code> when you want to know why. Cite numbers from
|
|
585
|
+
<code>trace.json</code>, never from prose written around it.
|
|
586
|
+
</p>
|
|
587
|
+
|
|
588
|
+
<div class="btn-row" style="margin-top:1.2rem">
|
|
589
|
+
<a class="btn btn-primary" href="reviewers.html">Read a bundle line by line →</a>
|
|
590
|
+
</div>
|
|
591
|
+
|
|
592
|
+
<details class="fail">
|
|
593
|
+
<summary>If it fails</summary>
|
|
594
|
+
<div class="fail-body">
|
|
595
|
+
<p>
|
|
596
|
+
<strong>Cannot find the directory</strong> — without <code>--artifacts-dir</code> it goes
|
|
597
|
+
to a checkout-local run directory. <code>mm-harness last</code> prints the path.
|
|
598
|
+
</p>
|
|
599
|
+
<p>
|
|
600
|
+
<strong>No screenshots</strong> — capture differs per platform;
|
|
601
|
+
<code>mm-harness doctor</code> reports it on a <code>capture:</code> line. A degraded
|
|
602
|
+
fallback still succeeds and records that it degraded in the artifact metadata.
|
|
603
|
+
</p>
|
|
604
|
+
</div>
|
|
605
|
+
</details>
|
|
606
|
+
</li>
|
|
607
|
+
|
|
608
|
+
</ol>
|
|
609
|
+
</section>
|
|
610
|
+
|
|
611
|
+
<section class="wrap">
|
|
612
|
+
<hr class="sep">
|
|
613
|
+
<h2>Next</h2>
|
|
614
|
+
<div class="grid grid-3">
|
|
615
|
+
<div class="card">
|
|
616
|
+
<h3>What a recipe is</h3>
|
|
617
|
+
<p>The graph, the intents, the assertions, and the test of whether yours is worth keeping.</p>
|
|
618
|
+
<p><a href="recipes.html">Recipes →</a></p>
|
|
619
|
+
</div>
|
|
620
|
+
<div class="card">
|
|
621
|
+
<h3>Your team's library</h3>
|
|
622
|
+
<p>Install the skills, declare your library, prove discovery sees it.</p>
|
|
623
|
+
<p><a href="tutorials/v3.html">Tutorial V3 →</a></p>
|
|
624
|
+
</div>
|
|
625
|
+
<div class="card">
|
|
626
|
+
<h3>Reviewing someone's proof</h3>
|
|
627
|
+
<p>A real bundle annotated, including a degraded capture that stayed honest about it.</p>
|
|
628
|
+
<p><a href="reviewers.html">For reviewers →</a></p>
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
</section>
|
|
632
|
+
</main>
|
|
633
|
+
|
|
634
|
+
<footer class="footer">
|
|
635
|
+
<div class="wrap">
|
|
636
|
+
<p>Internal getting-started guide for the MetaMask agentic coding workflow. Not official MetaMask product documentation.</p>
|
|
637
|
+
<p>Verified against mm-harness 0.26+. If a command here disagrees with your terminal, your terminal is right: run <code>mm-harness update</code>, then trust <code>--help</code>.</p>
|
|
638
|
+
</div>
|
|
639
|
+
</footer>
|
|
640
|
+
|
|
641
|
+
<script type="module" src="assets/progress.mjs"></script>
|
|
642
|
+
</body>
|
|
643
|
+
</html>
|