@deeeed/metamask-harness 0.19.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/adapters/extension/ensure-browser.sh +6 -4
  3. package/adapters/extension/launch-browser.cjs +6 -1
  4. package/adapters/extension/lib/chrome-args.cjs +11 -1
  5. package/adapters/extension/start-watch.sh +1 -1
  6. package/adapters/extension/verify.sh +17 -0
  7. package/adapters/mobile/open-device.sh +12 -1
  8. package/adapters/mobile/wait-for-bridge.sh +1 -1
  9. package/dist/adapters/extension/ensure-ready.js +7 -2
  10. package/dist/adapters/extension/runtime-decision.js +4 -6
  11. package/dist/adapters/extension/runtime.js +114 -17
  12. package/dist/adapters/mobile/prepare.js +40 -6
  13. package/dist/command-contract.js +58 -5
  14. package/dist/commands/call.js +6 -3
  15. package/dist/commands/check.js +9 -2
  16. package/dist/commands/checklist.js +117 -14
  17. package/dist/commands/launch/extension.js +8 -3
  18. package/dist/commands/launch/index.js +38 -25
  19. package/dist/commands/launch/mobile.js +2 -2
  20. package/dist/commands/manifest.js +72 -5
  21. package/dist/commands/run-engine.js +7 -2
  22. package/dist/heal-bounds.js +1 -1
  23. package/dist/metamask-action-validation.js +45 -0
  24. package/dist/mm-harness-cli.js +7 -4
  25. package/docs/CONTRIBUTING.md +8 -0
  26. package/library/actions/extension/platform/cdp.mjs +8 -3
  27. package/library/actions/extension/ui/navigate.mjs +239 -16
  28. package/library/actions/mobile/ui/navigate.mjs +1 -1
  29. package/library/manifests/core.action-manifest.json +60 -7
  30. package/library/manifests/extension.action-manifest.json +55 -13
  31. package/library/manifests/mobile.action-manifest.json +52 -12
  32. package/library/recipes/perps/lifecycle.recipe.json +3 -9
  33. package/library/recipes/runner/action-validation.extension.recipe.json +5 -4
  34. package/package.json +5 -4
  35. package/scripts/completions.sh +2 -2
@@ -221,7 +221,7 @@
221
221
  ]
222
222
  },
223
223
  "ui.navigate": {
224
- "description": "Navigate with either raw React Navigation route/screen params or a small stable page alias. Discover supported aliases here before hardcoding routes.",
224
+ "description": "Navigate by semantic page intent through the adapter-owned current route mapping, then verify the live destination. Route drift fails loudly; raw route/screen params must be verified against the current app first.",
225
225
  "schema": {
226
226
  "type": "object",
227
227
  "properties": {
@@ -265,7 +265,7 @@
265
265
  },
266
266
  "examples": [
267
267
  {
268
- "description": "Open Perps through the stable alias",
268
+ "description": "Ask the adapter to open the current Perps entry point",
269
269
  "node": {
270
270
  "action": "ui.navigate",
271
271
  "page": "perps",
@@ -273,7 +273,7 @@
273
273
  }
274
274
  },
275
275
  {
276
- "description": "Open a Perps market through the stable alias",
276
+ "description": "Open a Perps market through the current verified adapter path",
277
277
  "node": {
278
278
  "action": "ui.navigate",
279
279
  "page": "perps-market",
@@ -282,7 +282,7 @@
282
282
  }
283
283
  },
284
284
  {
285
- "description": "Fallback to a raw React Navigation route when no alias exists",
285
+ "description": "Use a raw React Navigation route only after verifying it in the current app",
286
286
  "node": {
287
287
  "action": "ui.navigate",
288
288
  "route": "PerpsMarketListView",
@@ -1743,17 +1743,23 @@
1743
1743
  "long",
1744
1744
  "short"
1745
1745
  ],
1746
- "description": "Optional position/order side filter."
1746
+ "description": "Required order direction."
1747
1747
  },
1748
1748
  "timeout_ms": {
1749
1749
  "type": "number"
1750
1750
  },
1751
1751
  "amount": {
1752
- "type": "string",
1752
+ "type": [
1753
+ "string",
1754
+ "number"
1755
+ ],
1753
1756
  "description": "USD amount/notional alias."
1754
1757
  },
1755
1758
  "notional": {
1756
- "type": "string",
1759
+ "type": [
1760
+ "string",
1761
+ "number"
1762
+ ],
1757
1763
  "description": "USD notional alias."
1758
1764
  },
1759
1765
  "size": {
@@ -2104,11 +2110,25 @@
2104
2110
  "long",
2105
2111
  "short"
2106
2112
  ],
2107
- "description": "Optional position/order side filter."
2113
+ "description": "Required when state=open/present; otherwise filters selected positions."
2108
2114
  },
2109
2115
  "timeout_ms": {
2110
2116
  "type": "number"
2111
2117
  },
2118
+ "amount": {
2119
+ "type": [
2120
+ "string",
2121
+ "number"
2122
+ ],
2123
+ "description": "Explicit USD notional used only when creating a missing open position. Alias: notional."
2124
+ },
2125
+ "notional": {
2126
+ "type": [
2127
+ "string",
2128
+ "number"
2129
+ ],
2130
+ "description": "Alias for amount."
2131
+ },
2112
2132
  "state": {
2113
2133
  "type": "string",
2114
2134
  "enum": [
@@ -2144,6 +2164,17 @@
2144
2164
  "mode": "all",
2145
2165
  "intent": "Converge Perps positions to the requested state"
2146
2166
  }
2167
+ },
2168
+ {
2169
+ "description": "Ensure one ETH long position exists",
2170
+ "node": {
2171
+ "action": "metamask.perps.ensure_positions",
2172
+ "market": "ETH",
2173
+ "side": "long",
2174
+ "state": "open",
2175
+ "notional": "10",
2176
+ "intent": "Converge ETH positions to one explicit testnet precondition"
2177
+ }
2147
2178
  }
2148
2179
  ],
2149
2180
  "proof_effect": "E2E validation must record this action in trace.json; live-proof actions include liveAdapter/proofPath or target runtime output.",
@@ -2234,15 +2265,24 @@
2234
2265
  "long",
2235
2266
  "short"
2236
2267
  ],
2237
- "description": "Optional position/order side filter."
2268
+ "description": "Required when state=open/present; otherwise filters selected orders."
2238
2269
  },
2239
2270
  "timeout_ms": {
2240
2271
  "type": "number"
2241
2272
  },
2273
+ "amount": {
2274
+ "type": [
2275
+ "string",
2276
+ "number"
2277
+ ],
2278
+ "description": "Explicit USD notional used only when creating a missing open order. Alias: notional."
2279
+ },
2242
2280
  "notional": {
2243
- "type": "number",
2244
- "default": 10,
2245
- "description": "Small testnet USD notional used only when creating a missing open order."
2281
+ "type": [
2282
+ "string",
2283
+ "number"
2284
+ ],
2285
+ "description": "Alias for amount."
2246
2286
  },
2247
2287
  "leverage": {
2248
2288
  "type": "number",
@@ -40,20 +40,14 @@
40
40
  "action": "ui.navigate",
41
41
  "intent": "Show the Perps home surface",
42
42
  "next": "navigate-market",
43
- "route": "PerpsMarketListView",
44
- "hash": "#/?tab=perps"
43
+ "page": "perps"
45
44
  },
46
45
  "navigate-market": {
47
46
  "action": "ui.navigate",
48
47
  "intent": "Show the ETH Perps market details",
49
48
  "next": "start-state",
50
- "route": "PerpsMarketDetails",
51
- "params": {
52
- "market": {
53
- "symbol": "ETH"
54
- }
55
- },
56
- "hash": "#/perps/market/ETH"
49
+ "page": "perps-market",
50
+ "market": "ETH"
57
51
  },
58
52
  "start-state": {
59
53
  "action": "metamask.perps.start_state",
@@ -116,7 +116,7 @@
116
116
  "action": "ui.navigate",
117
117
  "next": "ui-wait-perps",
118
118
  "intent": "Open the Perps tab",
119
- "hash": "#/?tab=perps"
119
+ "page": "perps"
120
120
  },
121
121
  "ui-wait-perps": {
122
122
  "action": "ui.wait_for",
@@ -148,19 +148,20 @@
148
148
  "action": "ui.navigate",
149
149
  "next": "perps-navigate-home",
150
150
  "intent": "Show the Perps home surface",
151
- "hash": "#/?tab=perps"
151
+ "page": "perps"
152
152
  },
153
153
  "perps-navigate-home": {
154
154
  "action": "ui.navigate",
155
155
  "next": "perps-navigate-market",
156
156
  "intent": "Show the Perps home surface",
157
- "hash": "#/?tab=perps"
157
+ "page": "perps"
158
158
  },
159
159
  "perps-navigate-market": {
160
160
  "action": "ui.navigate",
161
161
  "next": "start-state",
162
162
  "intent": "Show the ETH Perps market details",
163
- "hash": "#/perps/market/ETH"
163
+ "page": "perps-market",
164
+ "market": "ETH"
164
165
  },
165
166
  "ensure-clean": {
166
167
  "action": "metamask.perps.ensure_positions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeeed/metamask-harness",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mm-harness": "bin/mm-harness"
@@ -19,9 +19,10 @@
19
19
  "check:syntax": "find . -name '*.mjs' -print0 | xargs -0 -n1 node --check"
20
20
  },
21
21
  "dependencies": {
22
- "@farmslot/agent-runtime": "^0.2.0",
23
- "@farmslot/protocol": "^0.11.0",
24
- "@farmslot/recipe-harness": "^0.9.1",
22
+ "@farmslot/agent-runtime": "^0.3.0",
23
+ "@farmslot/handoff": "^0.3.1",
24
+ "@farmslot/protocol": "^0.11.1",
25
+ "@farmslot/recipe-harness": "^0.9.4",
25
26
  "commander": "^12.0.0",
26
27
  "es-module-lexer": "2.3.1",
27
28
  "esbuild": "0.28.1",
@@ -77,7 +77,7 @@ if [ -n "${BASH_VERSION:-}" ]; then
77
77
  case "$cmd" in
78
78
  launch) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "ios android" -- "$cur")) ;;
79
79
  fixtures) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "init sync set generate finalize" -- "$cur")) ;;
80
- checklist) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "mark" -- "$cur")) ;;
80
+ checklist) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "mark closeout" -- "$cur")) ;;
81
81
  completions) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "install bash zsh status" -- "$cur")) ;;
82
82
  call) [ "$cword" -eq 2 ] && COMPREPLY=($(compgen -W "$(_mmh_actions)" -- "$cur")) ;;
83
83
  run) COMPREPLY=($(compgen -f -- "$cur"; compgen -W "$(_mmh_recipes)" -- "$cur")) ;;
@@ -111,7 +111,7 @@ if [ -n "${ZSH_VERSION:-}" ]; then
111
111
  case "$cmd" in
112
112
  launch) (( CURRENT == 3 )) && { candidates=(ios android); compadd -a candidates; } ;;
113
113
  fixtures) (( CURRENT == 3 )) && { candidates=(init sync set generate finalize); compadd -a candidates; } ;;
114
- checklist) (( CURRENT == 3 )) && { candidates=(mark); compadd -a candidates; } ;;
114
+ checklist) (( CURRENT == 3 )) && { candidates=(mark closeout); compadd -a candidates; } ;;
115
115
  completions) (( CURRENT == 3 )) && { candidates=(install bash zsh status); compadd -a candidates; } ;;
116
116
  call) (( CURRENT == 3 )) && { candidates=("${(@f)$(_mmh_actions)}"); compadd -a candidates; } ;;
117
117
  run) candidates=("${(@f)$(_mmh_recipes)}"); compadd -a candidates; _files ;;