@deeeed/metamask-harness 0.17.0 → 0.17.2
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 +34 -0
- package/README.md +90 -140
- package/adapters/core/cleanup.sh +0 -0
- package/adapters/core/inject.sh +0 -0
- package/adapters/extension/cleanup.mjs +0 -0
- package/adapters/extension/console-tail.mjs +51 -24
- package/adapters/extension/ensure-browser.sh +0 -0
- package/adapters/extension/inject.mjs +5 -9
- package/adapters/extension/launch-browser.cjs +0 -0
- package/adapters/extension/launch-webpack.cjs +83 -0
- package/adapters/extension/launch.sh +8 -11
- package/adapters/extension/live.sh +2 -0
- package/adapters/extension/readiness.mjs +0 -0
- package/adapters/extension/reattach.sh +1 -0
- package/adapters/extension/refresh-build.sh +0 -0
- package/adapters/extension/seed-fixture.sh +4 -12
- package/adapters/extension/sidepanel-toggle.sh +4 -1
- package/adapters/extension/snapshot-dist.sh +0 -0
- package/adapters/extension/stamp-runtime-title.cjs +49 -0
- package/adapters/extension/start-watch.sh +16 -4
- package/adapters/extension/stop-viewers.sh +1 -1
- package/adapters/extension/sync-webpack-dist.cjs +105 -0
- package/adapters/extension/verify.sh +1 -1
- package/adapters/extension/wallet-fixture-state.cjs +0 -0
- package/adapters/manifest.json +46 -38
- package/adapters/mobile/bridge-runtime/cdp-bridge.cjs +0 -0
- package/adapters/mobile/bridge-runtime/console-forwarder.cjs +1 -1
- package/adapters/mobile/bridge-runtime/lib/target-discovery.cjs +2 -3
- package/adapters/mobile/bridge-runtime/setup-wallet.sh +0 -0
- package/adapters/mobile/cleanup.sh +16 -176
- package/adapters/mobile/inject.sh +88 -671
- package/adapters/mobile/launch-console-forwarder.cjs +39 -0
- package/adapters/mobile/lib/metro-listener.sh +0 -0
- package/adapters/mobile/lib/tmux-viewer.sh +0 -0
- package/adapters/mobile/open-device.sh +0 -0
- package/adapters/mobile/prewarm-bundle.sh +0 -0
- package/adapters/mobile/start-console-forwarder.sh +70 -0
- package/adapters/mobile/start-metro.sh +0 -41
- package/adapters/mobile/stop-metro.sh +0 -0
- package/adapters/mobile/verify.sh +4 -61
- package/adapters/mobile/wait-for-bridge.sh +0 -0
- package/adapters/mobile/yarn-setup.sh +0 -0
- package/adapters/shared/activate-repo-node.sh +0 -0
- package/adapters/shared/activate-repo-ruby.sh +0 -0
- package/adapters/shared/cli-ux.sh +0 -0
- package/adapters/shared/ensure-runner-deps.sh +0 -0
- package/adapters/shared/harness-path.sh +0 -0
- package/adapters/shared/hash-helpers.sh +0 -0
- package/adapters/shared/install-repo-deps.sh +0 -0
- package/adapters/shared/json-field.sh +0 -0
- package/adapters/shared/open-debug.mjs +90 -36
- package/adapters/shared/open-log-window.sh +0 -0
- package/adapters/shared/reap-checkout-metros.sh +0 -0
- package/adapters/shared/resolve-slot-ports-core.mjs +0 -6
- package/adapters/shared/resolve-slot-ports.mjs +0 -0
- package/adapters/shared/resolve-slot-ports.sh +0 -5
- package/adapters/shared/sync-wallet-fixture.sh +0 -0
- package/adapters/shared/tmux-session.sh +0 -0
- package/adapters/shared/tmux-viewer.sh +0 -0
- package/adapters/shared/update-check-worker.mjs +37 -0
- package/dist/adapters/extension/console-capture.js +84 -0
- package/dist/adapters/extension/runtime-decision.js +14 -2
- package/dist/adapters/extension/surface.js +3 -2
- package/dist/adapters/mobile/prepare.js +22 -7
- package/dist/adapters/mobile/surface.js +1 -1
- package/dist/adapters/resolve-slot-ports.js +0 -2
- package/dist/adapters/slot-ports.js +8 -0
- package/dist/cli.js +3 -11
- package/dist/commands/call.js +9 -4
- package/dist/commands/debug.js +38 -31
- package/dist/commands/fixtures.js +18 -10
- package/dist/commands/launch/index.js +10 -0
- package/dist/commands/logs.js +8 -6
- package/dist/commands/manifest.js +5 -17
- package/dist/commands/run-engine.js +1 -32
- package/dist/commands/run-report.js +1 -1
- package/dist/commands/run.js +50 -3
- package/dist/commands/status-probe.js +1 -1
- package/dist/commands/update.js +15 -28
- package/dist/doctor.js +1 -4
- package/dist/harness.js +5 -123
- package/dist/live-adapter-contract.js +6 -20
- package/dist/mm-harness-cli.js +6 -43
- package/dist/paths.js +2 -5
- package/dist/run-diagnostics.js +35 -40
- package/dist/runtime-context.js +26 -8
- package/docs/CHEATSHEET.md +39 -52
- package/docs/CLI-ERGONOMICS-HUMAN-QA.md +48 -104
- package/docs/CODE-MAP.md +1 -1
- package/docs/VIDEO-DEMO-VALIDATION.md +62 -0
- package/docs/architecture.md +65 -375
- package/docs/live-adapter-contract.md +3 -1
- package/library/actions/core/perps/_controller.mjs +10 -55
- package/library/manifests/mobile.action-manifest.json +1 -1
- package/package.json +2 -2
- package/scripts/completions.sh +0 -0
- package/scripts/install-completions.sh +0 -0
- package/adapters/mobile/overlay/app/dev-tools/AgenticService/AgentStepHud.tsx.patch +0 -185
- package/adapters/mobile/overlay/app/dev-tools/AgenticService/AgenticService.ts.patch +0 -1662
- package/adapters/mobile/overlay/compat/README.md +0 -28
- package/adapters/mobile/overlay/compat/rn81-message-event-source.patch +0 -42
- package/adapters/shared/resolve-farmslot-ports-core.mjs +0 -3
- package/adapters/shared/resolve-farmslot-ports.mjs +0 -5
- package/adapters/shared/resolve-farmslot-ports.sh +0 -7
- package/docs/CLI-SPEC.md +0 -1142
- package/docs/MENTAL-MODEL.md +0 -295
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
-
import { FullWindowOverlay } from 'react-native-screens';
|
|
5
|
-
|
|
6
|
-
interface Step {
|
|
7
|
-
id: string;
|
|
8
|
-
intent: string;
|
|
9
|
-
status?: string;
|
|
10
|
-
progress?: { current?: number; total?: number };
|
|
11
|
-
detail?: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
nodeId?: string;
|
|
14
|
-
debug?: { nodeId?: string; proofTarget?: unknown };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Step bus. The HUD owns the registry so nothing outside this leaf module needs
|
|
18
|
-
// to import AgenticService — keeping the bridge off the static import graph, so
|
|
19
|
-
// it is dead-code-eliminated from release builds. AgenticService emits through
|
|
20
|
-
// `emitStepHud`; the mounted HUD registers its setState as the sink.
|
|
21
|
-
let stepSink: ((step: Step | null) => void) | null = null;
|
|
22
|
-
|
|
23
|
-
export function emitStepHud(step: Step | null) {
|
|
24
|
-
stepSink?.(step);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function registerStepHudCallback(sink: ((step: Step | null) => void) | null) {
|
|
28
|
-
stepSink = sink;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function statusForStep(step: Step) {
|
|
32
|
-
const id = typeof step.id === 'string' ? step.id : '';
|
|
33
|
-
return String(step.status ?? id.split(/\s+/)[0] ?? '').toLowerCase();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function progressForStep(step: Step) {
|
|
37
|
-
if (
|
|
38
|
-
typeof step.progress?.current === 'number' &&
|
|
39
|
-
typeof step.progress?.total === 'number'
|
|
40
|
-
) {
|
|
41
|
-
return `${step.progress.current}/${step.progress.total}`;
|
|
42
|
-
}
|
|
43
|
-
const progressPattern = /\b\d+\s*\/\s*\d+\b/;
|
|
44
|
-
const id = typeof step.id === 'string' ? step.id : '';
|
|
45
|
-
const match = progressPattern.exec(id);
|
|
46
|
-
return match ? match[0].replace(/\s+/g, '') : null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function badgeTextForStep(step: Step) {
|
|
50
|
-
const rawStatus = statusForStep(step);
|
|
51
|
-
const status = rawStatus === 'running' ? 'run' : rawStatus;
|
|
52
|
-
const progress = progressForStep(step);
|
|
53
|
-
return [status || 'run', progress].filter(Boolean).join(' ').toUpperCase();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function statusToneForStep(step: Step) {
|
|
57
|
-
const status = statusForStep(step);
|
|
58
|
-
if (status === 'fail' || status === 'failed' || status === 'error') {
|
|
59
|
-
return 'fail';
|
|
60
|
-
}
|
|
61
|
-
if (status === 'pass' || status === 'passed' || status === 'success') {
|
|
62
|
-
return 'pass';
|
|
63
|
-
}
|
|
64
|
-
return 'running';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function displayStateForStep(step: Step) {
|
|
68
|
-
const intent = step.intent.trim();
|
|
69
|
-
const secondary = [
|
|
70
|
-
step.error ? `error: ${step.error}` : null,
|
|
71
|
-
step.detail && step.detail !== intent ? step.detail : null,
|
|
72
|
-
].filter((part): part is string => Boolean(part));
|
|
73
|
-
return {
|
|
74
|
-
intent,
|
|
75
|
-
secondary: secondary.filter(
|
|
76
|
-
(part, index) => secondary.indexOf(part) === index,
|
|
77
|
-
),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Debug-only overlay — intentionally uses hardcoded colors for guaranteed
|
|
82
|
-
// contrast on both light and dark themes. Design tokens would defeat the purpose.
|
|
83
|
-
/* eslint-disable react-native/no-color-literals, @metamask/design-tokens/color-no-hex */
|
|
84
|
-
const styles = StyleSheet.create({
|
|
85
|
-
container: {
|
|
86
|
-
position: 'absolute',
|
|
87
|
-
left: 0,
|
|
88
|
-
right: 0,
|
|
89
|
-
zIndex: 9999,
|
|
90
|
-
backgroundColor: 'rgba(0, 0, 0, 0.58)',
|
|
91
|
-
paddingVertical: 3,
|
|
92
|
-
},
|
|
93
|
-
line: {
|
|
94
|
-
color: '#FFFFFF',
|
|
95
|
-
fontSize: 11,
|
|
96
|
-
fontWeight: '700',
|
|
97
|
-
lineHeight: 14,
|
|
98
|
-
},
|
|
99
|
-
badgeText: {
|
|
100
|
-
fontFamily: 'Courier',
|
|
101
|
-
fontSize: 9,
|
|
102
|
-
fontWeight: '800',
|
|
103
|
-
},
|
|
104
|
-
badgeTextRunning: {
|
|
105
|
-
color: '#00FF88',
|
|
106
|
-
},
|
|
107
|
-
badgeTextPass: {
|
|
108
|
-
color: '#00FF88',
|
|
109
|
-
},
|
|
110
|
-
badgeTextFail: {
|
|
111
|
-
color: '#FF4D4F',
|
|
112
|
-
},
|
|
113
|
-
secondary: {
|
|
114
|
-
color: '#E6E6E6',
|
|
115
|
-
fontSize: 10,
|
|
116
|
-
fontWeight: '400',
|
|
117
|
-
lineHeight: 12,
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
/* eslint-enable react-native/no-color-literals, @metamask/design-tokens/color-no-hex */
|
|
121
|
-
|
|
122
|
-
// Inner component — hooks always called unconditionally, per rules of React.
|
|
123
|
-
const AgentStepHudInner = () => {
|
|
124
|
-
const [step, setStep] = useState<Step | null>(null);
|
|
125
|
-
const insets = useSafeAreaInsets();
|
|
126
|
-
|
|
127
|
-
const containerStyle = useMemo(
|
|
128
|
-
() => [
|
|
129
|
-
styles.container,
|
|
130
|
-
{
|
|
131
|
-
bottom: Math.max(insets.bottom, 0),
|
|
132
|
-
paddingLeft: Math.max(insets.left, 10),
|
|
133
|
-
paddingRight: Math.max(insets.right, 10),
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
[insets.left, insets.right, insets.bottom],
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
registerStepHudCallback(setStep);
|
|
141
|
-
return () => {
|
|
142
|
-
registerStepHudCallback(null);
|
|
143
|
-
};
|
|
144
|
-
}, []);
|
|
145
|
-
|
|
146
|
-
if (!step) return null;
|
|
147
|
-
|
|
148
|
-
const { intent, secondary } = displayStateForStep(step);
|
|
149
|
-
const badge = badgeTextForStep(step);
|
|
150
|
-
const tone = statusToneForStep(step);
|
|
151
|
-
const badgeTextStyle =
|
|
152
|
-
tone === 'fail'
|
|
153
|
-
? styles.badgeTextFail
|
|
154
|
-
: tone === 'pass'
|
|
155
|
-
? styles.badgeTextPass
|
|
156
|
-
: styles.badgeTextRunning;
|
|
157
|
-
|
|
158
|
-
// FullWindowOverlay (iOS) renders the HUD in a UIWindow above every native
|
|
159
|
-
// layer — including native-stack modal screens (perps close-position/TPSL,
|
|
160
|
-
// etc.), which a plain absolute/zIndex View in the JS root cannot reach. On
|
|
161
|
-
// Android it is a passthrough, so root-level rendering is preserved.
|
|
162
|
-
return (
|
|
163
|
-
<FullWindowOverlay>
|
|
164
|
-
<View style={containerStyle} pointerEvents="none">
|
|
165
|
-
<Text style={styles.line}>
|
|
166
|
-
<Text style={[styles.badgeText, badgeTextStyle]}>{badge}</Text>
|
|
167
|
-
{intent ? ` ${intent}` : ''}
|
|
168
|
-
</Text>
|
|
169
|
-
{secondary.map((detail) => (
|
|
170
|
-
<Text key={detail} style={styles.secondary}>
|
|
171
|
-
{detail}
|
|
172
|
-
</Text>
|
|
173
|
-
))}
|
|
174
|
-
</View>
|
|
175
|
-
</FullWindowOverlay>
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// Outer guard — never calls hooks, so the __DEV__ early return is fine.
|
|
180
|
-
const AgentStepHud = () => {
|
|
181
|
-
if (!__DEV__) return null;
|
|
182
|
-
return <AgentStepHudInner />;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export default AgentStepHud;
|