@deeeed/metamask-harness 0.70.1 → 0.72.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 +25 -0
- package/adapters/extension/console-tail.mjs +38 -6
- package/adapters/manifest.json +128 -0
- package/adapters/terminal/cleanup.mjs +68 -0
- package/adapters/terminal/inject.mjs +74 -0
- package/adapters/terminal/launch.mjs +628 -0
- package/adapters/terminal/lib/cdp-client.mjs +84 -0
- package/adapters/terminal/lib/display.mjs +115 -0
- package/adapters/terminal/lib/hud.mjs +148 -0
- package/adapters/terminal/lib/mainnet-guard.mjs +177 -0
- package/adapters/terminal/lib/origin.mjs +30 -0
- package/adapters/terminal/lib/page-script.mjs +246 -0
- package/adapters/terminal/lib/processes.mjs +187 -0
- package/adapters/terminal/lib/readiness.mjs +274 -0
- package/adapters/terminal/lib/strict-wallet.mjs +138 -0
- package/adapters/terminal/stop.mjs +37 -0
- package/adapters/terminal/verify.mjs +48 -0
- package/adapters/terminal/wallet-host.mjs +703 -0
- package/dist/adapters/console-capture.js +122 -0
- package/dist/adapters/extension/console-capture.js +22 -85
- package/dist/adapters/mobile/verify.js +8 -3
- package/dist/adapters/surface.js +3 -1
- package/dist/adapters/terminal/console-capture.js +46 -0
- package/dist/adapters/terminal/stop.js +19 -0
- package/dist/adapters/terminal/surface.js +104 -0
- package/dist/adapters.js +27 -4
- package/dist/cli.js +2 -2
- package/dist/command-contract.js +12 -4
- package/dist/commands/check.js +1 -1
- package/dist/commands/config.js +1 -1
- package/dist/commands/doctor.js +24 -1
- package/dist/commands/domain.js +1 -1
- package/dist/commands/farmslot-ready.js +2 -0
- package/dist/commands/help.js +2 -2
- package/dist/commands/launch/index.js +97 -2
- package/dist/commands/manifest.js +3 -3
- package/dist/commands/recipe-advice.js +1 -1
- package/dist/commands/review.js +1 -1
- package/dist/commands/run-engine.js +1 -1
- package/dist/commands/shared.js +1 -1
- package/dist/doctor.js +3 -0
- package/dist/harness.js +17 -11
- package/dist/manifest.js +5 -0
- package/dist/mm-harness-cli.js +34 -20
- package/dist/paths.js +2 -2
- package/dist/recipe-security.js +12 -3
- package/dist/review/knowledge.js +1 -1
- package/dist/run-diagnostics.js +150 -33
- package/dist/runner.js +1 -1
- package/dist/runtime-context.js +3 -3
- package/docs/CONTRIBUTING.md +1 -1
- package/docs/cli-contract.md +163 -0
- package/library/actions/shared/console-allowlist-add.mjs +137 -0
- package/library/actions/shared/console-collector.mjs +230 -0
- package/library/actions/shared/console-findings.mjs +511 -0
- package/library/actions/terminal/app/assert_no_console_errors.mjs +119 -0
- package/library/actions/terminal/app/launch.mjs +45 -0
- package/library/actions/terminal/perps/_venue.mjs +242 -0
- package/library/actions/terminal/perps/assert_orders.mjs +54 -0
- package/library/actions/terminal/perps/assert_positions.mjs +40 -0
- package/library/actions/terminal/perps/read_orders.mjs +26 -0
- package/library/actions/terminal/perps/read_positions.mjs +25 -0
- package/library/actions/terminal/perps/read_snapshot.mjs +40 -0
- package/library/actions/terminal/perps/revoke_agent.mjs +58 -0
- package/library/actions/terminal/perps/teardown_state.mjs +104 -0
- package/library/actions/terminal/platform/hud.mjs +71 -0
- package/library/actions/terminal/platform/page.mjs +247 -0
- package/library/actions/terminal/platform/runtime.mjs +200 -0
- package/library/actions/terminal/ui/navigate.mjs +31 -0
- package/library/actions/terminal/wallet/_signature-log.mjs +177 -0
- package/library/actions/terminal/wallet/assert_signatures.mjs +43 -0
- package/library/actions/terminal/wallet/list_accounts.mjs +27 -0
- package/library/actions/terminal/wallet/read_signatures.mjs +37 -0
- package/library/manifests/terminal.action-manifest.json +1786 -0
- package/package.json +2 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Assert what the main wallet was asked to sign since the last reset: allowed
|
|
2
|
+
// EIP-712 primary types, exact signed counts, zero L1 (Agent / chainId 1337)
|
|
3
|
+
// payloads, active-chain matching and, in extension mode, confirmations shown.
|
|
4
|
+
// The full window is retained as evidence whether or not the assertion holds.
|
|
5
|
+
|
|
6
|
+
import { isDirectRun, runAdapter } from '../platform/runtime.mjs';
|
|
7
|
+
import { evaluateSignatureLog, windowSinceCursor, writeLogArtifact } from './_signature-log.mjs';
|
|
8
|
+
|
|
9
|
+
export async function assertSignatures(input) {
|
|
10
|
+
const node = input.node ?? {};
|
|
11
|
+
const projectRoot = input.context?.projectRoot;
|
|
12
|
+
const deadline = Date.now() + Math.max(0, Number(node.timeout_ms ?? 0));
|
|
13
|
+
let window = await windowSinceCursor(projectRoot);
|
|
14
|
+
let result = evaluateSignatureLog(window.entries, node);
|
|
15
|
+
// Entries arrive asynchronously from the wallet host; allow a short settle.
|
|
16
|
+
while (!result.ok && Date.now() < deadline) {
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
18
|
+
window = await windowSinceCursor(projectRoot);
|
|
19
|
+
result = evaluateSignatureLog(window.entries, node);
|
|
20
|
+
}
|
|
21
|
+
const artifacts = await writeLogArtifact(input, {
|
|
22
|
+
cursor: window.cursor,
|
|
23
|
+
total: window.total,
|
|
24
|
+
expectations: node,
|
|
25
|
+
...result,
|
|
26
|
+
entries: window.entries,
|
|
27
|
+
});
|
|
28
|
+
if (!result.ok) {
|
|
29
|
+
throw new Error(`signature log assertion failed: ${result.failures.join('; ')}`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
action: input.action,
|
|
33
|
+
source: 'terminal-wallet-request-log',
|
|
34
|
+
cursor: window.cursor,
|
|
35
|
+
count: window.entries.length,
|
|
36
|
+
summary: result.summary,
|
|
37
|
+
entries: window.entries,
|
|
38
|
+
artifacts,
|
|
39
|
+
proofPath: 'terminal-wallet-request-log',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isDirectRun(import.meta.url)) runAdapter((input) => assertSignatures(input));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// List the wallet-fixture account names and addresses available to the slot
|
|
2
|
+
// browser, marking the one the running browser uses. Addresses only.
|
|
3
|
+
|
|
4
|
+
import { isDirectRun, loadWalletFixture, readBrowserState, runAdapter, viemAccountFromEntry } from '../platform/runtime.mjs';
|
|
5
|
+
|
|
6
|
+
export async function listAccounts(input) {
|
|
7
|
+
const projectRoot = input.context?.projectRoot;
|
|
8
|
+
const { fixture } = await loadWalletFixture(projectRoot);
|
|
9
|
+
const state = await readBrowserState(projectRoot);
|
|
10
|
+
const accounts = fixture.accounts
|
|
11
|
+
.filter((entry) => entry?.type === 'mnemonic' || entry?.type === 'privateKey')
|
|
12
|
+
.map((entry) => {
|
|
13
|
+
const address = viemAccountFromEntry(entry).address;
|
|
14
|
+
return { name: entry.name, address, selected: state?.account?.address?.toLowerCase() === address.toLowerCase() };
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
action: input.action,
|
|
18
|
+
source: 'wallet-fixture',
|
|
19
|
+
signer: state?.signer ?? null,
|
|
20
|
+
accounts,
|
|
21
|
+
count: accounts.length,
|
|
22
|
+
redacted: true,
|
|
23
|
+
proofPath: 'terminal-wallet-accounts',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isDirectRun(import.meta.url)) runAdapter((input) => listAccounts(input));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Return the wallet request log since the last reset and retain it as run
|
|
2
|
+
// evidence. reset=true moves the window start to the end of the log so the next
|
|
3
|
+
// read covers only what follows (an explicit setup step, recorded in the trace).
|
|
4
|
+
|
|
5
|
+
import { isDirectRun, runAdapter } from '../platform/runtime.mjs';
|
|
6
|
+
import { readLog, summarize, windowSinceCursor, writeCursor, writeLogArtifact } from './_signature-log.mjs';
|
|
7
|
+
|
|
8
|
+
export async function readSignatures(input) {
|
|
9
|
+
const projectRoot = input.context?.projectRoot;
|
|
10
|
+
if (input.node?.reset === true) {
|
|
11
|
+
const entries = await readLog(projectRoot);
|
|
12
|
+
await writeCursor(projectRoot, entries.length);
|
|
13
|
+
return {
|
|
14
|
+
action: input.action,
|
|
15
|
+
source: 'terminal-wallet-request-log',
|
|
16
|
+
reset: true,
|
|
17
|
+
cursor: entries.length,
|
|
18
|
+
previousEntries: entries.length,
|
|
19
|
+
proofPath: 'terminal-wallet-request-log',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const { cursor, entries, total } = await windowSinceCursor(projectRoot);
|
|
23
|
+
const summary = summarize(entries);
|
|
24
|
+
const artifacts = await writeLogArtifact(input, { cursor, total, summary, entries });
|
|
25
|
+
return {
|
|
26
|
+
action: input.action,
|
|
27
|
+
source: 'terminal-wallet-request-log',
|
|
28
|
+
cursor,
|
|
29
|
+
count: entries.length,
|
|
30
|
+
summary,
|
|
31
|
+
entries,
|
|
32
|
+
artifacts,
|
|
33
|
+
proofPath: 'terminal-wallet-request-log',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isDirectRun(import.meta.url)) runAdapter((input) => readSignatures(input));
|