@swmansion/argent 0.15.1-next.7 → 0.15.1-next.8
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/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-server.cjs +73 -31
- package/package.json +1 -1
- package/rules/argent.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +8 -6
- package/skills/argent-metro-debugger/references/failure-scenarios.md +6 -6
- package/skills/argent-tv-interact/SKILL.md +11 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -6234,10 +6234,10 @@ var FAILURE_CODES = {
|
|
|
6234
6234
|
ANDROID_UIAUTOMATOR_PARSE_FAILED: "ANDROID_UIAUTOMATOR_PARSE_FAILED",
|
|
6235
6235
|
ANDROID_UIAUTOMATOR_CAPTURE_FAILED: "ANDROID_UIAUTOMATOR_CAPTURE_FAILED",
|
|
6236
6236
|
DEBUGGER_METRO_NOT_RUNNING: "DEBUGGER_METRO_NOT_RUNNING",
|
|
6237
|
-
DEBUGGER_METRO_PROJECT_ROOT_MISSING: "DEBUGGER_METRO_PROJECT_ROOT_MISSING",
|
|
6238
6237
|
DEBUGGER_METRO_NO_TARGETS: "DEBUGGER_METRO_NO_TARGETS",
|
|
6239
6238
|
DEBUGGER_CDP_RUNTIME_EXCEPTION: "DEBUGGER_CDP_RUNTIME_EXCEPTION",
|
|
6240
6239
|
DEBUGGER_CDP_BINDING_TIMEOUT: "DEBUGGER_CDP_BINDING_TIMEOUT",
|
|
6240
|
+
DEBUGGER_CDP_BINDING_UNAVAILABLE: "DEBUGGER_CDP_BINDING_UNAVAILABLE",
|
|
6241
6241
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
6242
6242
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
6243
6243
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
package/dist/installer.mjs
CHANGED
|
@@ -16141,10 +16141,10 @@ var FAILURE_CODES = {
|
|
|
16141
16141
|
ANDROID_UIAUTOMATOR_PARSE_FAILED: "ANDROID_UIAUTOMATOR_PARSE_FAILED",
|
|
16142
16142
|
ANDROID_UIAUTOMATOR_CAPTURE_FAILED: "ANDROID_UIAUTOMATOR_CAPTURE_FAILED",
|
|
16143
16143
|
DEBUGGER_METRO_NOT_RUNNING: "DEBUGGER_METRO_NOT_RUNNING",
|
|
16144
|
-
DEBUGGER_METRO_PROJECT_ROOT_MISSING: "DEBUGGER_METRO_PROJECT_ROOT_MISSING",
|
|
16145
16144
|
DEBUGGER_METRO_NO_TARGETS: "DEBUGGER_METRO_NO_TARGETS",
|
|
16146
16145
|
DEBUGGER_CDP_RUNTIME_EXCEPTION: "DEBUGGER_CDP_RUNTIME_EXCEPTION",
|
|
16147
16146
|
DEBUGGER_CDP_BINDING_TIMEOUT: "DEBUGGER_CDP_BINDING_TIMEOUT",
|
|
16147
|
+
DEBUGGER_CDP_BINDING_UNAVAILABLE: "DEBUGGER_CDP_BINDING_UNAVAILABLE",
|
|
16148
16148
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
16149
16149
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
16150
16150
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -17660,10 +17660,10 @@ var FAILURE_CODES = {
|
|
|
17660
17660
|
ANDROID_UIAUTOMATOR_PARSE_FAILED: "ANDROID_UIAUTOMATOR_PARSE_FAILED",
|
|
17661
17661
|
ANDROID_UIAUTOMATOR_CAPTURE_FAILED: "ANDROID_UIAUTOMATOR_CAPTURE_FAILED",
|
|
17662
17662
|
DEBUGGER_METRO_NOT_RUNNING: "DEBUGGER_METRO_NOT_RUNNING",
|
|
17663
|
-
DEBUGGER_METRO_PROJECT_ROOT_MISSING: "DEBUGGER_METRO_PROJECT_ROOT_MISSING",
|
|
17664
17663
|
DEBUGGER_METRO_NO_TARGETS: "DEBUGGER_METRO_NO_TARGETS",
|
|
17665
17664
|
DEBUGGER_CDP_RUNTIME_EXCEPTION: "DEBUGGER_CDP_RUNTIME_EXCEPTION",
|
|
17666
17665
|
DEBUGGER_CDP_BINDING_TIMEOUT: "DEBUGGER_CDP_BINDING_TIMEOUT",
|
|
17666
|
+
DEBUGGER_CDP_BINDING_UNAVAILABLE: "DEBUGGER_CDP_BINDING_UNAVAILABLE",
|
|
17667
17667
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
17668
17668
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
17669
17669
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
package/dist/tool-server.cjs
CHANGED
|
@@ -314,10 +314,10 @@ var init_failure_codes = __esm({
|
|
|
314
314
|
ANDROID_UIAUTOMATOR_PARSE_FAILED: "ANDROID_UIAUTOMATOR_PARSE_FAILED",
|
|
315
315
|
ANDROID_UIAUTOMATOR_CAPTURE_FAILED: "ANDROID_UIAUTOMATOR_CAPTURE_FAILED",
|
|
316
316
|
DEBUGGER_METRO_NOT_RUNNING: "DEBUGGER_METRO_NOT_RUNNING",
|
|
317
|
-
DEBUGGER_METRO_PROJECT_ROOT_MISSING: "DEBUGGER_METRO_PROJECT_ROOT_MISSING",
|
|
318
317
|
DEBUGGER_METRO_NO_TARGETS: "DEBUGGER_METRO_NO_TARGETS",
|
|
319
318
|
DEBUGGER_CDP_RUNTIME_EXCEPTION: "DEBUGGER_CDP_RUNTIME_EXCEPTION",
|
|
320
319
|
DEBUGGER_CDP_BINDING_TIMEOUT: "DEBUGGER_CDP_BINDING_TIMEOUT",
|
|
320
|
+
DEBUGGER_CDP_BINDING_UNAVAILABLE: "DEBUGGER_CDP_BINDING_UNAVAILABLE",
|
|
321
321
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
322
322
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
323
323
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
@@ -114407,6 +114407,8 @@ var CDPClient = class {
|
|
|
114407
114407
|
nextId = 1;
|
|
114408
114408
|
pending = /* @__PURE__ */ new Map();
|
|
114409
114409
|
pendingBindings = /* @__PURE__ */ new Map();
|
|
114410
|
+
/** Set by addBinding when the runtime ACKs the command but installs nothing. */
|
|
114411
|
+
bindingUnavailable = false;
|
|
114410
114412
|
scripts = /* @__PURE__ */ new Map();
|
|
114411
114413
|
enabledDomains = /* @__PURE__ */ new Set();
|
|
114412
114414
|
wsUrl;
|
|
@@ -114539,6 +114541,8 @@ var CDPClient = class {
|
|
|
114539
114541
|
}
|
|
114540
114542
|
async addBinding(name) {
|
|
114541
114543
|
await this.send("Runtime.addBinding", { name });
|
|
114544
|
+
const probe3 = await this.evaluate(`typeof ${name}`).catch(() => void 0);
|
|
114545
|
+
this.bindingUnavailable = probe3 === "undefined";
|
|
114542
114546
|
}
|
|
114543
114547
|
/**
|
|
114544
114548
|
* Inject a script that will push a result via the binding using a unique requestId.
|
|
@@ -114547,6 +114551,19 @@ var CDPClient = class {
|
|
|
114547
114551
|
evaluateWithBinding(expression, requestId, options) {
|
|
114548
114552
|
const id = requestId ?? crypto3.randomUUID();
|
|
114549
114553
|
const timeout = options?.timeout ?? DEFAULT_TIMEOUT_MS2;
|
|
114554
|
+
if (this.bindingUnavailable) {
|
|
114555
|
+
return Promise.reject(
|
|
114556
|
+
new FailureError(
|
|
114557
|
+
"This JS runtime acknowledges Runtime.addBinding but never installs the binding (legacy Hermes, React Native <= 0.72), so it cannot deliver a result over the binding channel. Tools that read the React tree this way are unavailable here; use `describe` to read on-screen structure.",
|
|
114558
|
+
{
|
|
114559
|
+
error_code: FAILURE_CODES.DEBUGGER_CDP_BINDING_UNAVAILABLE,
|
|
114560
|
+
failure_stage: "debugger_cdp_binding",
|
|
114561
|
+
failure_area: "tool_server",
|
|
114562
|
+
error_kind: "unsupported"
|
|
114563
|
+
}
|
|
114564
|
+
)
|
|
114565
|
+
);
|
|
114566
|
+
}
|
|
114550
114567
|
return new Promise((resolve7, reject) => {
|
|
114551
114568
|
const timer = setTimeout(() => {
|
|
114552
114569
|
this.pendingBindings.delete(id);
|
|
@@ -121983,12 +122000,14 @@ init_src();
|
|
|
121983
122000
|
|
|
121984
122001
|
// ../tool-server/src/utils/debugger/discovery.ts
|
|
121985
122002
|
init_src();
|
|
122003
|
+
var DECOY_VM = "don't use";
|
|
121986
122004
|
async function discoverMetro(port) {
|
|
121987
|
-
|
|
121988
|
-
|
|
121989
|
-
|
|
122005
|
+
let statusRes;
|
|
122006
|
+
try {
|
|
122007
|
+
statusRes = await fetch(`http://localhost:${port}/status`);
|
|
122008
|
+
} catch (err) {
|
|
121990
122009
|
throw new FailureError(
|
|
121991
|
-
`Metro at port ${port} is not running (got: ${
|
|
122010
|
+
`Metro at port ${port} is not running (got: ${err instanceof Error ? err.message : String(err)})`,
|
|
121992
122011
|
{
|
|
121993
122012
|
error_code: FAILURE_CODES.DEBUGGER_METRO_NOT_RUNNING,
|
|
121994
122013
|
failure_stage: "debugger_discover_metro_status",
|
|
@@ -121997,21 +122016,25 @@ async function discoverMetro(port) {
|
|
|
121997
122016
|
}
|
|
121998
122017
|
);
|
|
121999
122018
|
}
|
|
122000
|
-
const
|
|
122001
|
-
if (!
|
|
122019
|
+
const statusText = await statusRes.text();
|
|
122020
|
+
if (!statusText.includes("packager-status:running")) {
|
|
122002
122021
|
throw new FailureError(
|
|
122003
|
-
`Metro at port ${port}
|
|
122022
|
+
`Metro at port ${port} is not running (got: ${statusText.slice(0, 100)})`,
|
|
122004
122023
|
{
|
|
122005
|
-
error_code: FAILURE_CODES.
|
|
122006
|
-
failure_stage: "
|
|
122024
|
+
error_code: FAILURE_CODES.DEBUGGER_METRO_NOT_RUNNING,
|
|
122025
|
+
failure_stage: "debugger_discover_metro_status",
|
|
122007
122026
|
failure_area: "tool_server",
|
|
122008
122027
|
error_kind: "network"
|
|
122009
122028
|
}
|
|
122010
122029
|
);
|
|
122011
122030
|
}
|
|
122031
|
+
const projectRoot = statusRes.headers.get("X-React-Native-Project-Root") ?? "";
|
|
122012
122032
|
const listRes = await fetch(`http://localhost:${port}/json/list`);
|
|
122013
|
-
const
|
|
122014
|
-
|
|
122033
|
+
const parsed = await listRes.json().catch(() => null);
|
|
122034
|
+
const targets = (Array.isArray(parsed) ? parsed : []).filter(
|
|
122035
|
+
(t) => t?.vm !== DECOY_VM
|
|
122036
|
+
);
|
|
122037
|
+
if (!targets.length) {
|
|
122015
122038
|
throw new FailureError(
|
|
122016
122039
|
`Metro at port ${port} has no CDP targets \u2014 is a React Native app connected?`,
|
|
122017
122040
|
{
|
|
@@ -122026,8 +122049,19 @@ async function discoverMetro(port) {
|
|
|
122026
122049
|
}
|
|
122027
122050
|
|
|
122028
122051
|
// ../tool-server/src/utils/debugger/target-selection.ts
|
|
122052
|
+
function deviceKey(target) {
|
|
122053
|
+
const logicalId = target.reactNative?.logicalDeviceId;
|
|
122054
|
+
if (logicalId) return logicalId;
|
|
122055
|
+
try {
|
|
122056
|
+
const device = new URL(target.webSocketDebuggerUrl).searchParams.get("device");
|
|
122057
|
+
if (device) return `device=${device}`;
|
|
122058
|
+
} catch {
|
|
122059
|
+
}
|
|
122060
|
+
return target.deviceName;
|
|
122061
|
+
}
|
|
122029
122062
|
function selectTarget(targets, port, options) {
|
|
122030
|
-
|
|
122063
|
+
const pool = targets;
|
|
122064
|
+
let candidates = pool;
|
|
122031
122065
|
if (typeof options?.deviceId === "string" && options.deviceId) {
|
|
122032
122066
|
const deviceId = options.deviceId;
|
|
122033
122067
|
const filtered = candidates.filter((t) => t.reactNative?.logicalDeviceId === deviceId);
|
|
@@ -122035,16 +122069,21 @@ function selectTarget(targets, port, options) {
|
|
|
122035
122069
|
candidates = filtered;
|
|
122036
122070
|
} else {
|
|
122037
122071
|
const distinctDevices = /* @__PURE__ */ new Map();
|
|
122038
|
-
for (const t of
|
|
122039
|
-
const
|
|
122040
|
-
if (
|
|
122041
|
-
distinctDevices.set(
|
|
122072
|
+
for (const t of pool) {
|
|
122073
|
+
const key = deviceKey(t);
|
|
122074
|
+
if (key && !distinctDevices.has(key)) {
|
|
122075
|
+
distinctDevices.set(key, {
|
|
122076
|
+
name: t.deviceName,
|
|
122077
|
+
logicalId: t.reactNative?.logicalDeviceId
|
|
122078
|
+
});
|
|
122042
122079
|
}
|
|
122043
122080
|
}
|
|
122044
122081
|
if (distinctDevices.size > 1) {
|
|
122045
|
-
const listed = [...distinctDevices.
|
|
122082
|
+
const listed = [...distinctDevices.values()].map(
|
|
122083
|
+
(d) => d.logicalId ? `${d.name ?? "unknown"} (${d.logicalId})` : `${d.name ?? "unknown"} (legacy inspector \u2014 no logicalDeviceId)`
|
|
122084
|
+
).join(", ");
|
|
122046
122085
|
throw new Error(
|
|
122047
|
-
`No debugger target matches device_id "${deviceId}". ${distinctDevices.size} devices are connected to Metro on port ${port}: ${listed}.
|
|
122086
|
+
`No debugger target matches device_id "${deviceId}". ${distinctDevices.size} devices are connected to Metro on port ${port}: ${listed}. Re-target with the logicalDeviceId in parentheses \u2014 that is what debugger-connect returns and what subsequent debugger-* calls must pass. A legacy-inspector device (RN 0.72 / Vega) reports none and cannot be singled out of a shared Metro: give it its own Metro port.`
|
|
122048
122087
|
);
|
|
122049
122088
|
}
|
|
122050
122089
|
}
|
|
@@ -122185,6 +122224,7 @@ function parseNode(line) {
|
|
|
122185
122224
|
// ../tool-server/src/utils/debugger/source-resolver.ts
|
|
122186
122225
|
var ALLOWED_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]);
|
|
122187
122226
|
function isInsideProject(absFile, projectRoot) {
|
|
122227
|
+
if (!projectRoot) return false;
|
|
122188
122228
|
const resolvedRoot = path17.resolve(projectRoot);
|
|
122189
122229
|
const resolvedFile = path17.resolve(absFile);
|
|
122190
122230
|
const rel = path17.relative(resolvedRoot, resolvedFile);
|
|
@@ -122227,7 +122267,7 @@ function createSourceResolver(port, projectRoot) {
|
|
|
122227
122267
|
const frame = data.stack?.[0];
|
|
122228
122268
|
if (!frame?.file) return null;
|
|
122229
122269
|
if (/^https?:\/\//.test(frame.file)) return null;
|
|
122230
|
-
const relFile = frame.file.replace(projectRoot + "/", "").replace(/^\/+/, "");
|
|
122270
|
+
const relFile = projectRoot ? frame.file.replace(projectRoot + "/", "").replace(/^\/+/, "") : frame.file;
|
|
122231
122271
|
return {
|
|
122232
122272
|
file: relFile,
|
|
122233
122273
|
line: frame.lineNumber ?? 0,
|
|
@@ -122246,6 +122286,7 @@ function createSourceResolver(port, projectRoot) {
|
|
|
122246
122286
|
},
|
|
122247
122287
|
symbolicate: symbolicateFrame,
|
|
122248
122288
|
async readSourceFragment(location, contextLines = 3) {
|
|
122289
|
+
if (!projectRoot) return null;
|
|
122249
122290
|
try {
|
|
122250
122291
|
const absPath = path17.isAbsolute(location.file) ? path17.resolve(location.file) : path17.resolve(projectRoot, location.file);
|
|
122251
122292
|
const realRoot = await fs18.realpath(projectRoot);
|
|
@@ -133797,7 +133838,8 @@ var DEBUGGER_TOOL_CAPABILITY = {
|
|
|
133797
133838
|
apple: { simulator: true, device: true },
|
|
133798
133839
|
appleRemote: { simulator: true },
|
|
133799
133840
|
android: { emulator: true, device: true, unknown: true },
|
|
133800
|
-
chromium: { app: true }
|
|
133841
|
+
chromium: { app: true },
|
|
133842
|
+
vega: { vvd: true }
|
|
133801
133843
|
};
|
|
133802
133844
|
var RN_ONLY_TOOL_CAPABILITY = {
|
|
133803
133845
|
apple: { simulator: true, device: true },
|
|
@@ -133816,14 +133858,14 @@ function debuggerServiceRef(params) {
|
|
|
133816
133858
|
var zodSchema29 = external_exports.object({
|
|
133817
133859
|
port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium \u2014 its CDP port is encoded in device_id)"),
|
|
133818
133860
|
device_id: external_exports.string().describe(
|
|
133819
|
-
"Device id: iOS simulator UDID, Android logicalDeviceId returned by Metro, or Chromium device id (chromium-cdp-<port>) from list-devices.
|
|
133861
|
+
"Device id: iOS simulator UDID, Android logicalDeviceId returned by Metro, Vega serial (amazon-...), or Chromium device id (chromium-cdp-<port>) from list-devices. When a logicalDeviceId is returned, forward it as device_id to all subsequent debugger-* calls to pin them to this device; when none is returned (Vega), keep passing the id you connected with."
|
|
133820
133862
|
)
|
|
133821
133863
|
});
|
|
133822
133864
|
var debuggerConnectTool = {
|
|
133823
133865
|
id: "debugger-connect",
|
|
133824
133866
|
description: `Connect to a JS runtime CDP debugger.
|
|
133825
|
-
iOS / Android: connects to Metro's CDP endpoint on the given port. Chromium: re-uses the page CDP session opened by boot-device \u2014 port is ignored.
|
|
133826
|
-
Returns connection info including port, projectRoot (empty on Chromium), deviceName, appName, logicalDeviceId, and isNewDebugger. If already connected, returns the existing connection.
|
|
133867
|
+
iOS / Android / Vega: connects to Metro's CDP endpoint on the given port. Chromium: re-uses the page CDP session opened by boot-device \u2014 port is ignored.
|
|
133868
|
+
Returns connection info including port, projectRoot (empty on Chromium and on legacy Metro, e.g. Vega), deviceName, appName, logicalDeviceId (absent on Vega), and isNewDebugger. If already connected, returns the existing connection.
|
|
133827
133869
|
Use when starting a debug session or before calling other debugger-* tools. Fails if the runtime is unreachable (Metro down, or Chromium CDP terminated).`,
|
|
133828
133870
|
zodSchema: zodSchema29,
|
|
133829
133871
|
capability: DEBUGGER_TOOL_CAPABILITY,
|
|
@@ -133849,13 +133891,13 @@ init_zod();
|
|
|
133849
133891
|
var zodSchema30 = external_exports.object({
|
|
133850
133892
|
port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
|
|
133851
133893
|
device_id: external_exports.string().describe(
|
|
133852
|
-
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, or Chromium device id)."
|
|
133894
|
+
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
|
|
133853
133895
|
)
|
|
133854
133896
|
});
|
|
133855
133897
|
var debuggerStatusTool = {
|
|
133856
133898
|
id: "debugger-status",
|
|
133857
133899
|
description: `Get JS runtime debugger connection status and diagnostic info.
|
|
133858
|
-
Use when you need to verify connectivity before using other debugger tools. Returns port, projectRoot (empty on Chromium), deviceName, appName, logicalDeviceId, connected flag, loadedScripts count, and sourceMapReady (always true \u2014 waits for pending source maps before returning; no-op on Chromium). Fails if the runtime is unreachable.`,
|
|
133900
|
+
Use when you need to verify connectivity before using other debugger tools. Returns port, projectRoot (empty on Chromium and on legacy Metro, e.g. Vega), deviceName, appName, logicalDeviceId (absent on Vega), isNewDebugger (false on the legacy inspector), connected flag, loadedScripts count, and sourceMapReady (always true \u2014 waits for pending source maps before returning; no-op on Chromium). Fails if the runtime is unreachable.`,
|
|
133859
133901
|
zodSchema: zodSchema30,
|
|
133860
133902
|
capability: DEBUGGER_TOOL_CAPABILITY,
|
|
133861
133903
|
services: (params) => ({
|
|
@@ -133884,13 +133926,13 @@ init_zod();
|
|
|
133884
133926
|
var zodSchema31 = external_exports.object({
|
|
133885
133927
|
port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
|
|
133886
133928
|
device_id: external_exports.string().describe(
|
|
133887
|
-
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, or Chromium device id)."
|
|
133929
|
+
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
|
|
133888
133930
|
),
|
|
133889
133931
|
expression: external_exports.string().describe("JavaScript expression to evaluate in the app runtime")
|
|
133890
133932
|
});
|
|
133891
133933
|
var debuggerEvaluateTool = {
|
|
133892
133934
|
id: "debugger-evaluate",
|
|
133893
|
-
description: `Execute arbitrary JavaScript in the app's JS runtime via CDP \u2014 Hermes on iOS / Android, V8 on Chromium.
|
|
133935
|
+
description: `Execute arbitrary JavaScript in the app's JS runtime via CDP \u2014 Hermes on iOS / Android / Vega, V8 on Chromium.
|
|
133894
133936
|
Returns the evaluation result as a JSON-serializable value, along with deviceName, appName, and logicalDeviceId for context. Use when you need to read app state, call app functions, or test logic at runtime. The result is serialized by value, so cyclic objects (many RN runtime values \u2014 fiber nodes, navigation refs, global \u2014 are cyclic) fail with a serialization error rather than returning silently. Fails if the expression throws or the runtime is not connected.`,
|
|
133895
133937
|
zodSchema: zodSchema31,
|
|
133896
133938
|
capability: DEBUGGER_TOOL_CAPABILITY,
|
|
@@ -135374,13 +135416,13 @@ init_zod();
|
|
|
135374
135416
|
var zodSchema35 = external_exports.object({
|
|
135375
135417
|
port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
|
|
135376
135418
|
device_id: external_exports.string().describe(
|
|
135377
|
-
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, or Chromium device id)."
|
|
135419
|
+
"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
|
|
135378
135420
|
)
|
|
135379
135421
|
});
|
|
135380
135422
|
var debuggerLogRegistryTool = {
|
|
135381
135423
|
id: "debugger-log-registry",
|
|
135382
135424
|
description: `Get a summary of all console logs captured from the app's JS runtime.
|
|
135383
|
-
Returns the log file path, entry counts by level, and message clusters (grouped by similarity). Works against Hermes (iOS / Android) and V8 (Chromium).
|
|
135425
|
+
Returns the log file path, entry counts by level, and message clusters (grouped by similarity). Works against Hermes (iOS / Android / Vega) and V8 (Chromium).
|
|
135384
135426
|
Use when investigating warnings, errors, or unexpected output \u2014 call this first for an overview, then read the returned file for details. Returns empty stats if no log data has been captured yet.`,
|
|
135385
135427
|
zodSchema: zodSchema35,
|
|
135386
135428
|
capability: DEBUGGER_TOOL_CAPABILITY,
|
|
@@ -135472,7 +135514,7 @@ var networkLogsTool = {
|
|
|
135472
135514
|
description: `Retrieve captured network (HTTP) requests from the running app.
|
|
135473
135515
|
Returns a paginated list of requests with method, URL, status, resource type, size, and duration.
|
|
135474
135516
|
Each entry includes a requestId that can be passed to view-network-request-details for full details.
|
|
135475
|
-
On React Native (iOS/Android) interception is injected into the JS runtime \u2014 it captures fetch() calls. On Chromium it reads the browser's native CDP Network domain (the active tab; all request types).
|
|
135517
|
+
On React Native (iOS / Android / Vega) interception is injected into the JS runtime \u2014 it captures fetch() calls. On Chromium it reads the browser's native CDP Network domain (the active tab; all request types).
|
|
135476
135518
|
Use when inspecting outbound HTTP traffic or debugging API calls in the running app.
|
|
135477
135519
|
Fails if the app is not connected (RN) or the device is not reachable (Chromium).`,
|
|
135478
135520
|
zodSchema: zodSchema36,
|
package/package.json
CHANGED
package/rules/argent.md
CHANGED
|
@@ -119,7 +119,7 @@ Prompt keywords: permission, grant, deny, revoke, reset permission, privacy, cam
|
|
|
119
119
|
|
|
120
120
|
TV INTERACTION (APPLE TV / ANDROID TV / FIRE TV)
|
|
121
121
|
Skill: `argent-tv-interact`
|
|
122
|
-
When: Any TV target — a `list-devices` entry with `runtimeKind: "tv"` (Apple TV simulator or Android TV emulator) or `platform:"vega"` / `kind:"vvd"` (Amazon Fire TV / VVD), or the user mentions Apple TV / tvOS / Android TV / leanback / Vega / Fire TV. A TV UI is focus-driven, not touch-driven: drive it with `describe` (read focus) + `tv-remote` (D-pad presses) + `keyboard` (type); `gesture-*` tools do NOT apply. Covers booting the target, app lifecycle, focus navigation, typing, screenshots, and (Vega) VVD lifecycle + Fast Refresh.
|
|
122
|
+
When: Any TV target — a `list-devices` entry with `runtimeKind: "tv"` (Apple TV simulator or Android TV emulator) or `platform:"vega"` / `kind:"vvd"` (Amazon Fire TV / VVD), or the user mentions Apple TV / tvOS / Android TV / leanback / Vega / Fire TV. A TV UI is focus-driven, not touch-driven: drive it with `describe` (read focus) + `tv-remote` (D-pad presses) + `keyboard` (type); `gesture-*` tools do NOT apply. Covers booting the target, app lifecycle, focus navigation, typing, screenshots, and (Vega) VVD lifecycle + Fast Refresh + JS-runtime debugging (evaluate, console logs, network inspector).
|
|
123
123
|
Prompt keywords: apple tv, tvos, android tv, leanback, vega, fire tv, vvd, d-pad
|
|
124
124
|
|
|
125
125
|
SCREENSHOT DIFF & VISUAL REGRESSION
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: argent-metro-debugger
|
|
3
|
-
description: Debug a JS runtime via CDP using argent debugger tools. Primary path is React Native via Metro (iOS / Android); a subset of the tools (debugger-connect, debugger-status, debugger-evaluate, debugger-log-registry) also drive a Chromium (CDP) app's renderer (an Electron app, or any Chromium browser exposing CDP) through the same surface. Use when connecting to the runtime, inspecting React components, reading console logs, or evaluating JavaScript.
|
|
3
|
+
description: Debug a JS runtime via CDP using argent debugger tools. Primary path is React Native via Metro (iOS / Android / Vega); a subset of the tools (debugger-connect, debugger-status, debugger-evaluate, debugger-log-registry) also drive a Chromium (CDP) app's renderer (an Electron app, or any Chromium browser exposing CDP) through the same surface. Use when connecting to the runtime, inspecting React components, reading console logs, or evaluating JavaScript.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## 1. Prerequisites
|
|
7
7
|
|
|
8
8
|
For **React Native (iOS / Android)**: requires **Metro dev server running** (default `localhost:8081`) and **a React Native app connected to Metro** (at least one CDP target). Verify via `debugger-status`.
|
|
9
9
|
|
|
10
|
+
For **Vega (Fire TV)**: requires a **Debug `.vpkg`** (a Release build never attaches) and **Metro reachable from the device** (`vega device start-port-forwarding --port 8081 --forward false`). Verify via `debugger-status`. `debugger-component-tree`, `debugger-inspect-element`, `debugger-reload-metro` and the `react-profiler-*` / `profiler-*` tools are unavailable there — see the `argent-tv-interact` skill.
|
|
11
|
+
|
|
10
12
|
For **Chromium (CDP)**: requires a Chromium/CDP app already available — an Electron app booted via `boot-device` with `electronAppPath`, or any Chromium browser exposing a CDP port (auto-discovered by `list-devices` on `9222` / `ARGENT_CHROMIUM_PORTS`). The debugger re-uses the page CDP session — `port` is ignored, `device_id` is the `chromium-cdp-<port>` value from `list-devices` / `boot-device`. Only `debugger-connect`, `debugger-status`, `debugger-evaluate`, `debugger-log-registry`, `view-network-logs`, and `view-network-request-details` work on Chromium (the latter two read the browser's native CDP Network recording for the active tab instead of the Metro-injected `fetch` interceptor); `debugger-component-tree`, `debugger-reload-metro`, `debugger-inspect-element`, and the `react-profiler-*` / `profiler-*` tools are RN-only and reject Chromium at the capability gate with `Tool 'X' is not supported on chromium app`.
|
|
11
13
|
|
|
12
14
|
### Android: reverse port for Metro
|
|
@@ -21,16 +23,16 @@ adb -s <serial> reverse tcp:8081 tcp:8081
|
|
|
21
23
|
|
|
22
24
|
## 2. Tool Overview
|
|
23
25
|
|
|
24
|
-
All tools accept `port` (default 8081) AND `device_id` (the iOS Simulator UDID
|
|
26
|
+
All tools accept `port` (default 8081) AND `device_id` (the iOS Simulator UDID, Android serial, or Vega serial — a.k.a. `logicalDeviceId`, the CDP-reported id that matches the device). Vega's legacy inspector reports no `logicalDeviceId`, so there keep passing the serial. Always make sure you target the correct app on the correct device.
|
|
25
27
|
|
|
26
28
|
One Metro port can serve multiple connected devices (e.g. two simulators on `localhost:8081`, or an iOS simulator alongside an Android emulator with `adb reverse` set up). `device_id` pins every debugger/network/profiler call to a specific device so sessions do not collide.
|
|
27
29
|
|
|
28
30
|
### Connect & diagnostics
|
|
29
31
|
|
|
30
|
-
| Tool | Purpose
|
|
31
|
-
| ------------------ |
|
|
32
|
-
| `debugger-connect` | Connect to the JS runtime's CDP (Metro on iOS / Android; the page CDP session on Chromium). Returns port, projectRoot (empty on Chromium), deviceName, appName, `logicalDeviceId
|
|
33
|
-
| `debugger-status` | Like connect + loadedScripts, enabledDomains, sourceMapReady (no-op on Chromium). **Use to diagnose.**
|
|
32
|
+
| Tool | Purpose |
|
|
33
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `debugger-connect` | Connect to the JS runtime's CDP (Metro on iOS / Android / Vega; the page CDP session on Chromium). Returns port, projectRoot (empty on Chromium and on legacy Metro, e.g. Vega), deviceName, appName, `logicalDeviceId` (absent on Vega), isNewDebugger, connected. When a `logicalDeviceId` comes back, use it as the `device_id` for every subsequent debugger call. |
|
|
35
|
+
| `debugger-status` | Like connect + loadedScripts, enabledDomains, sourceMapReady (no-op on Chromium). **Use to diagnose.** |
|
|
34
36
|
|
|
35
37
|
### Reload & recovery
|
|
36
38
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
When a debugger tool fails, use **`debugger-status`** first to diagnose. Then match the error or situation below and act as specified. Do not retry the same failing tool repeatedly without following the recovery steps.
|
|
4
4
|
|
|
5
|
-
| Scenario | Error or situation | What to do
|
|
6
|
-
| ---------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
7
|
-
| **Metro not running** | Error contains: `Metro at port 8081 is not running (got: ...)` | **Start Metro yourself** unless the user asked you not to: scan the workspace configuration and run the appropriate command to start Metro in the background (by default `npx react-native start` or `npx expo start`). Wait for Metro to be ready, then retry `debugger-connect` or `debugger-status`. If you cannot determine the project root, ask the user. |
|
|
8
|
-
| **
|
|
9
|
-
| **App not connected** | Error contains: `Metro at port 8081 has no CDP targets — is a React Native app connected?` | 1) Confirm the app is running on the device. 2) Use `restart-app` with the app's device id and bundleId to relaunch so it connects to Metro. 3) Wait a few seconds for the bundle to load. 4) Retry `debugger-status`. Do **not** use `debugger-reload-metro` to fix this — it also requires at least one target.
|
|
10
|
-
| **Was connected, then tool fails** | Any debugger tool fails with a connection or disconnect error after it was working | The app may have crashed or been closed. Use `restart-app` to relaunch the app, then call `debugger-connect` again to pick up the fresh `logicalDeviceId` (may change for booted-fresh simulators), and use that new `device_id` on all subsequent calls.
|
|
5
|
+
| Scenario | Error or situation | What to do |
|
|
6
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| **Metro not running** | Error contains: `Metro at port 8081 is not running (got: ...)` | **Start Metro yourself** unless the user asked you not to: scan the workspace configuration and run the appropriate command to start Metro in the background (by default `npx react-native start` or `npx expo start`). Wait for Metro to be ready, then retry `debugger-connect` or `debugger-status`. If you cannot determine the project root, ask the user. A non-Metro server occupying the port lands here too — the `got:` text shows what answered. |
|
|
8
|
+
| **No source locations** | `projectRoot` is `""` and source lookups report no file:line | Not a failure. Legacy Metro (RN 0.72 and older, e.g. Vega) sends no `X-React-Native-Project-Root` header, so paths cannot be resolved against a project root. `debugger-evaluate`, console logs and the network inspector work regardless — do not restart Metro to "fix" it. |
|
|
9
|
+
| **App not connected** | Error contains: `Metro at port 8081 has no CDP targets — is a React Native app connected?` | 1) Confirm the app is running on the device. 2) Use `restart-app` with the app's device id and bundleId to relaunch so it connects to Metro. 3) Wait a few seconds for the bundle to load. 4) Retry `debugger-status`. Do **not** use `debugger-reload-metro` to fix this — it also requires at least one target. |
|
|
10
|
+
| **Was connected, then tool fails** | Any debugger tool fails with a connection or disconnect error after it was working | The app may have crashed or been closed. Use `restart-app` to relaunch the app, then call `debugger-connect` again to pick up the fresh `logicalDeviceId` (may change for booted-fresh simulators), and use that new `device_id` on all subsequent calls. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: argent-tv-interact
|
|
3
|
-
description: Control and inspect TV apps via argent — Apple TV (tvOS), Android TV (leanback), and Amazon Fire TV (Vega). Boot the target, read focus, navigate with the D-pad remote, type, and
|
|
3
|
+
description: Control and inspect TV apps via argent — Apple TV (tvOS), Android TV (leanback), and Amazon Fire TV (Vega). Boot the target, read focus, navigate with the D-pad remote, type, screenshot, and on Vega debug the JS runtime (evaluate, console logs, network inspector). Use when a task targets a TV (runtimeKind "tv", or platform "vega"), or mentions Apple TV / tvOS / Android TV / leanback / Vega / Fire TV / VVD.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Argent TV (Apple TV + Android TV + Fire TV)
|
|
@@ -58,3 +58,13 @@ Needs a Debug build + Metro running. argent only _connects_ to Metro — start M
|
|
|
58
58
|
|
|
59
59
|
- **Apple TV / Android TV:** use the dev-build deep-links above; `npm start` for Metro.
|
|
60
60
|
- **Vega:** build/install a Debug `.vpkg` (`vega device install-app -p <path>`), `npm start`, `vega device start-port-forwarding --port 8081 --forward false`, then `vega device launch-app -a <appId>`. Confirm `http://localhost:8081/json/list` shows a `Hermes React Native` target; `.tsx` edits then hot-reload.
|
|
61
|
+
|
|
62
|
+
## Debugging the JS runtime (Vega)
|
|
63
|
+
|
|
64
|
+
Once that same Debug build + Metro setup is in place, the JS-runtime tools work on a Vega VVD: `debugger-connect`, `debugger-status`, `debugger-evaluate`, `debugger-log-registry` (console logs), `view-network-logs`, and `view-network-request-details`. See the `argent-metro-debugger` skill.
|
|
65
|
+
|
|
66
|
+
Vega's React Native forks RN 0.72 and serves the legacy Hermes inspector, so three things differ from iOS / Android:
|
|
67
|
+
|
|
68
|
+
- `debugger-component-tree`, `debugger-inspect-element`, `debugger-reload-metro` and the `react-profiler-*` / `profiler-*` tools are **not supported**. Component-tree and inspect-element are hard-blocked: they need `Runtime.addBinding`, which this Hermes acknowledges but never installs. The rest are simply unverified on the legacy inspector. Use `describe` for on-screen structure; with both component tools gated off, component `file:line` tracing has no path on Vega.
|
|
69
|
+
- `debugger-status` reports `isNewDebugger: false`.
|
|
70
|
+
- `projectRoot` is empty (RN 0.72's Metro sends no project-root header), so lookups that resolve paths against the project root return no location.
|