@swmansion/argent 0.34.1-next.89 → 0.34.1-next.90
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/tool-server.cjs +78 -65
- package/package.json +2 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36298,7 +36298,7 @@ function isCi(env = process.env) {
|
|
|
36298
36298
|
var SESSION_ID2 = randomUUID5();
|
|
36299
36299
|
function readCliVersion() {
|
|
36300
36300
|
if (true) {
|
|
36301
|
-
return "0.34.1-next.
|
|
36301
|
+
return "0.34.1-next.90";
|
|
36302
36302
|
}
|
|
36303
36303
|
return "0.0.0";
|
|
36304
36304
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
|
|
|
16998
16998
|
var SESSION_ID = randomUUID4();
|
|
16999
16999
|
function readCliVersion() {
|
|
17000
17000
|
if (true) {
|
|
17001
|
-
return "0.34.1-next.
|
|
17001
|
+
return "0.34.1-next.90";
|
|
17002
17002
|
}
|
|
17003
17003
|
return "0.0.0";
|
|
17004
17004
|
}
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72950,7 +72950,7 @@ function isCi(env = process.env) {
|
|
|
72950
72950
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72951
72951
|
function readCliVersion() {
|
|
72952
72952
|
if (true) {
|
|
72953
|
-
return "0.34.1-next.
|
|
72953
|
+
return "0.34.1-next.90";
|
|
72954
72954
|
}
|
|
72955
72955
|
return "0.0.0";
|
|
72956
72956
|
}
|
|
@@ -120321,6 +120321,7 @@ var RECENT_MESSAGE_CHARS = 300;
|
|
|
120321
120321
|
var LINE_RE = /^\[L:(\d+)\] (\S+) (\S+)\s+(\S+) \| (.*)$/;
|
|
120322
120322
|
var CAMEL_LEVELS = ["startGroup", "startGroupCollapsed", "endGroup", "profileEnd", "timeEnd"];
|
|
120323
120323
|
var liveLogFiles = /* @__PURE__ */ new Set();
|
|
120324
|
+
var lastTimestamp = 0;
|
|
120324
120325
|
var LogFileWriter = class {
|
|
120325
120326
|
filePath;
|
|
120326
120327
|
fd = null;
|
|
@@ -120334,7 +120335,7 @@ var LogFileWriter = class {
|
|
|
120334
120335
|
ready = false;
|
|
120335
120336
|
closed = false;
|
|
120336
120337
|
constructor(port) {
|
|
120337
|
-
const timestamp = Date.now();
|
|
120338
|
+
const timestamp = lastTimestamp = Math.max(Date.now(), lastTimestamp + 1);
|
|
120338
120339
|
const dir = path35.join(os17.homedir(), ".argent", "tmp");
|
|
120339
120340
|
try {
|
|
120340
120341
|
fs40.mkdirSync(dir, { recursive: true });
|
|
@@ -120784,7 +120785,7 @@ var chromiumJsRuntimeDebuggerBlueprint = {
|
|
|
120784
120785
|
recordReapedSession(
|
|
120785
120786
|
"js-runtime-debugger",
|
|
120786
120787
|
device.id,
|
|
120787
|
-
keepFile ? `The log file with ${inFile < captured ? `${inFile} of its` : "its"} ${entries} is kept at ${logWriter.getFilePath()}.` : stored ? `The ${entries} went with it
|
|
120788
|
+
keepFile ? `The log file with ${inFile < captured ? `${inFile} of its` : "its"} ${entries} is kept at ${logWriter.getFilePath()}.` : stored ? `The ${entries} went with it: the log file is deleted on teardown. This registry holds only what the app has logged since.` : `The ${entries} went with it: no log file held them. This registry holds only what the app has logged since.`,
|
|
120788
120789
|
connectionLost
|
|
120789
120790
|
);
|
|
120790
120791
|
}
|
|
@@ -120813,6 +120814,9 @@ var RN_ONLY_TOOL_CAPABILITY = {
|
|
|
120813
120814
|
function isChromiumDebuggerTarget(deviceId) {
|
|
120814
120815
|
return !!canonicalDeviceId(deviceId)?.startsWith(CHROMIUM_ID_PREFIX);
|
|
120815
120816
|
}
|
|
120817
|
+
function reapedDebuggerKind(params) {
|
|
120818
|
+
return isChromiumDebuggerTarget(params.device_id) ? "js-runtime-debugger" : `js-runtime-debugger:${metroPort(params)}`;
|
|
120819
|
+
}
|
|
120816
120820
|
function debuggerServiceRef(params) {
|
|
120817
120821
|
const deviceId = canonicalDeviceId(params.device_id);
|
|
120818
120822
|
if (deviceId && isChromiumDebuggerTarget(deviceId)) {
|
|
@@ -126304,6 +126308,14 @@ function createConsoleLogServer2(consoleEvents, logWriter) {
|
|
|
126304
126308
|
server.on("error", reject);
|
|
126305
126309
|
});
|
|
126306
126310
|
}
|
|
126311
|
+
function cdpDisconnectedError() {
|
|
126312
|
+
return new FailureError("CDP disconnected", {
|
|
126313
|
+
error_code: FAILURE_CODES.JS_RUNTIME_CDP_DISCONNECTED,
|
|
126314
|
+
failure_stage: "js_runtime_debugger_cdp_lifecycle",
|
|
126315
|
+
failure_area: "tool_server",
|
|
126316
|
+
error_kind: "network"
|
|
126317
|
+
});
|
|
126318
|
+
}
|
|
126307
126319
|
var jsRuntimeDebuggerBlueprint = {
|
|
126308
126320
|
namespace: JS_RUNTIME_DEBUGGER_NAMESPACE,
|
|
126309
126321
|
getURN(payload) {
|
|
@@ -126385,6 +126397,7 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
126385
126397
|
const client2 = cdp;
|
|
126386
126398
|
const where = await client2.send("Runtime.enable").then(() => runtimeRunsOn(client2, deviceId)).catch(() => ({ verdict: "unknown" }));
|
|
126387
126399
|
if (where.verdict === "yes") {
|
|
126400
|
+
await client2.send("Runtime.disable").catch(() => void 0);
|
|
126388
126401
|
rememberNameMatch(deviceId, port, selectedId);
|
|
126389
126402
|
break;
|
|
126390
126403
|
}
|
|
@@ -126393,6 +126406,54 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
126393
126406
|
if (byPin && attempt === 0) continue;
|
|
126394
126407
|
throw unconfirmedMatchError(deviceId, port, selected.deviceName, where, metro.targets);
|
|
126395
126408
|
}
|
|
126409
|
+
const logWriter = new LogFileWriter(port);
|
|
126410
|
+
const consoleEvents = new TypedEventEmitter();
|
|
126411
|
+
let nextLogId = 0;
|
|
126412
|
+
cdp.events.on("consoleAPICalled", (params) => {
|
|
126413
|
+
const entry = {
|
|
126414
|
+
id: nextLogId++,
|
|
126415
|
+
level: params.type,
|
|
126416
|
+
args: params.args.map((a) => ({
|
|
126417
|
+
type: a.type,
|
|
126418
|
+
value: a.value,
|
|
126419
|
+
description: a.description
|
|
126420
|
+
})),
|
|
126421
|
+
message: formatConsoleArgs2(params),
|
|
126422
|
+
timestamp: params.timestamp,
|
|
126423
|
+
stackTrace: params.stackTrace
|
|
126424
|
+
};
|
|
126425
|
+
logWriter.write({
|
|
126426
|
+
id: entry.id,
|
|
126427
|
+
timestamp: consoleTimestampToIso(entry.timestamp),
|
|
126428
|
+
level: entry.level,
|
|
126429
|
+
message: entry.message,
|
|
126430
|
+
stackTrace: entry.stackTrace
|
|
126431
|
+
});
|
|
126432
|
+
consoleEvents.emit("log", entry);
|
|
126433
|
+
});
|
|
126434
|
+
const logicalDeviceId = selected.target.reactNative?.logicalDeviceId;
|
|
126435
|
+
const closeLog = ({ breadcrumb }) => {
|
|
126436
|
+
const captured = logWriter.getStats().totalEntries;
|
|
126437
|
+
const connectionLost = !cdp.isConnected();
|
|
126438
|
+
const inFile = logWriter.getFileEntryCount();
|
|
126439
|
+
const stored = logWriter.hasFile() && inFile > 0;
|
|
126440
|
+
const keepFile = captured > 0 && connectionLost && stored;
|
|
126441
|
+
if (breadcrumb && captured > 0) {
|
|
126442
|
+
const entries = `${captured} captured console ${captured === 1 ? "entry" : "entries"}`;
|
|
126443
|
+
const since = "This registry holds only what the runtime replayed or logged since, so earlier entries may be missing.";
|
|
126444
|
+
const salvage = keepFile ? `The log file with ${inFile < captured ? `${inFile} of its` : "its"} ${entries} is kept at ${logWriter.getFilePath()}. If the app kept running, the current registry may repeat these entries, replayed by the runtime.` : stored ? `The ${entries} went with it: the log file is deleted on teardown. ${since}` : `The ${entries} went with it: no log file held them. ${since}`;
|
|
126445
|
+
const kind = `js-runtime-debugger:${port}`;
|
|
126446
|
+
const ids = [deviceId, logicalDeviceId];
|
|
126447
|
+
const earlier = takeReapedSessionAnyId(kind, ids)?.salvage;
|
|
126448
|
+
recordReapedSession(
|
|
126449
|
+
kind,
|
|
126450
|
+
ids,
|
|
126451
|
+
earlier ? `${salvage} Before that: ${earlier}` : salvage,
|
|
126452
|
+
connectionLost
|
|
126453
|
+
);
|
|
126454
|
+
}
|
|
126455
|
+
logWriter.close({ keepFile });
|
|
126456
|
+
};
|
|
126396
126457
|
const sourceMaps = new SourceMapsRegistry();
|
|
126397
126458
|
cdp.events.on("scriptParsed", (script) => {
|
|
126398
126459
|
sourceMaps.registerFromScriptParsed(script.url, script.scriptId, script.sourceMapURL);
|
|
@@ -126430,39 +126491,15 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
126430
126491
|
await cdp.addBinding("__argent_callback", { legacyInspector: selected.legacyInspector });
|
|
126431
126492
|
await cdp.evaluate(DISABLE_LOGBOX_SCRIPT).catch(warnOnError("DISABLE_LOGBOX_SCRIPT"));
|
|
126432
126493
|
await sourceMaps.waitForPending();
|
|
126494
|
+
if (!cdp.isConnected()) throw cdpDisconnectedError();
|
|
126433
126495
|
const sourceResolver = createSourceResolver(port, metro.projectRoot);
|
|
126434
|
-
const logWriter = new LogFileWriter(port);
|
|
126435
|
-
const consoleEvents = new TypedEventEmitter();
|
|
126436
|
-
let nextLogId = 0;
|
|
126437
|
-
cdp.events.on("consoleAPICalled", (params) => {
|
|
126438
|
-
const entry = {
|
|
126439
|
-
id: nextLogId++,
|
|
126440
|
-
level: params.type,
|
|
126441
|
-
args: params.args.map((a) => ({
|
|
126442
|
-
type: a.type,
|
|
126443
|
-
value: a.value,
|
|
126444
|
-
description: a.description
|
|
126445
|
-
})),
|
|
126446
|
-
message: formatConsoleArgs2(params),
|
|
126447
|
-
timestamp: params.timestamp,
|
|
126448
|
-
stackTrace: params.stackTrace
|
|
126449
|
-
};
|
|
126450
|
-
logWriter.write({
|
|
126451
|
-
id: entry.id,
|
|
126452
|
-
timestamp: consoleTimestampToIso(entry.timestamp),
|
|
126453
|
-
level: entry.level,
|
|
126454
|
-
message: entry.message,
|
|
126455
|
-
stackTrace: entry.stackTrace
|
|
126456
|
-
});
|
|
126457
|
-
consoleEvents.emit("log", entry);
|
|
126458
|
-
});
|
|
126459
126496
|
const consoleServer = await createConsoleLogServer2(consoleEvents, logWriter);
|
|
126460
126497
|
const api = {
|
|
126461
126498
|
port,
|
|
126462
126499
|
projectRoot: metro.projectRoot,
|
|
126463
126500
|
deviceName: selected.deviceName,
|
|
126464
126501
|
appName: selected.target.title,
|
|
126465
|
-
logicalDeviceId
|
|
126502
|
+
logicalDeviceId,
|
|
126466
126503
|
runtimeApp,
|
|
126467
126504
|
isNewDebugger: selected.isNewDebugger,
|
|
126468
126505
|
cdp,
|
|
@@ -126476,43 +126513,21 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
126476
126513
|
rememberLogicalKeyedDevice(api.logicalDeviceId, deviceId);
|
|
126477
126514
|
const events = new TypedEventEmitter();
|
|
126478
126515
|
cdp.events.on("disconnected", (error63) => {
|
|
126479
|
-
events.emit(
|
|
126480
|
-
"terminated",
|
|
126481
|
-
error63 ?? new FailureError("CDP disconnected", {
|
|
126482
|
-
error_code: FAILURE_CODES.JS_RUNTIME_CDP_DISCONNECTED,
|
|
126483
|
-
failure_stage: "js_runtime_debugger_cdp_lifecycle",
|
|
126484
|
-
failure_area: "tool_server",
|
|
126485
|
-
error_kind: "network"
|
|
126486
|
-
})
|
|
126487
|
-
);
|
|
126516
|
+
events.emit("terminated", error63 ?? cdpDisconnectedError());
|
|
126488
126517
|
});
|
|
126489
126518
|
return {
|
|
126490
126519
|
api,
|
|
126491
126520
|
dispose: async () => {
|
|
126492
|
-
const captured = logWriter.getStats().totalEntries;
|
|
126493
|
-
const connectionLost = !cdp.isConnected();
|
|
126494
|
-
const inFile = logWriter.getFileEntryCount();
|
|
126495
|
-
const stored = logWriter.hasFile() && inFile > 0;
|
|
126496
|
-
const keepFile = captured > 0 && connectionLost && stored;
|
|
126497
|
-
if (captured > 0) {
|
|
126498
|
-
const entries = `${captured} captured console ${captured === 1 ? "entry" : "entries"}`;
|
|
126499
|
-
const salvage = keepFile ? `The log file with ${inFile < captured ? `${inFile} of its` : "its"} ${entries} is kept at ${logWriter.getFilePath()}.` : stored ? `The ${entries} went with it \u2014 the log file is deleted on teardown, so this registry starts empty rather than the app having logged nothing.` : `The ${entries} went with it \u2014 no log file held them, so this registry starts empty rather than the app having logged nothing.`;
|
|
126500
|
-
recordReapedSession(
|
|
126501
|
-
"js-runtime-debugger",
|
|
126502
|
-
[deviceId, api.logicalDeviceId],
|
|
126503
|
-
salvage,
|
|
126504
|
-
connectionLost
|
|
126505
|
-
);
|
|
126506
|
-
}
|
|
126507
126521
|
forgetDeviceAlias(api.logicalDeviceId);
|
|
126508
126522
|
forgetLogicalKeyedDevice(deviceId);
|
|
126509
126523
|
await consoleServer.close();
|
|
126510
|
-
|
|
126524
|
+
closeLog({ breadcrumb: true });
|
|
126511
126525
|
await cdp.disconnect();
|
|
126512
126526
|
},
|
|
126513
126527
|
events
|
|
126514
126528
|
};
|
|
126515
126529
|
} catch (error63) {
|
|
126530
|
+
closeLog({ breadcrumb: !cdp.isConnected() });
|
|
126516
126531
|
await cdp.disconnect();
|
|
126517
126532
|
throw error63;
|
|
126518
126533
|
}
|
|
@@ -138176,7 +138191,7 @@ Returns connection details and, after a crash, a note with the previous log path
|
|
|
138176
138191
|
}),
|
|
138177
138192
|
async execute(services, params) {
|
|
138178
138193
|
const api = services.debugger;
|
|
138179
|
-
const reaped2 = takeReapedSessionAnyId(
|
|
138194
|
+
const reaped2 = takeReapedSessionAnyId(reapedDebuggerKind(params), [
|
|
138180
138195
|
params.device_id,
|
|
138181
138196
|
api.logicalDeviceId
|
|
138182
138197
|
]);
|
|
@@ -139991,7 +140006,7 @@ function createDebuggerLogRegistryTool(registry2) {
|
|
|
139991
140006
|
id: "debugger-log-registry",
|
|
139992
140007
|
description: `Get a summary of all console logs captured from the app's JS runtime, with the newest entries inline in { entries } (oldest first, messages cut to 300 characters).
|
|
139993
140008
|
Returns the log file path, entry counts by level, and message clusters (grouped by similarity). Supports React Native<flag:macos-apps> (including Mac apps)</flag:macos-apps> and Chromium.
|
|
139994
|
-
Use when investigating warnings, errors, or unexpected output. Read { entries } first; Grep the returned file only for older lines or full messages, and never Read it whole: capture stops at 50,000 lines per session. Returns empty stats if no log data has been captured yet
|
|
140009
|
+
Use when investigating warnings, errors, or unexpected output. Read { entries } first; Grep the returned file only for older lines or full messages, and never Read it whole: capture stops at 50,000 lines per session. Returns empty stats if no log data has been captured yet. Check { note }, which is present when { file } does not exist or holds fewer entries than totalEntries counts (failed writes, e.g. a full disk), or when the previous debugger session ended: torn down (its log file deleted) or cut off by an app crash (the note names its kept log file, if it had one). With a note about the previous session, the stats and { entries } hold only what the runtime replayed or logged since. Without a note, empty means the app has logged nothing.
|
|
139995
140010
|
When the debugger cannot be reached, it returns { status: "not_connected", reason, detail, guidance } with NO log file. Follow the guidance (do not retry in a loop). Grep a log file in this state only when a { note } names one kept from before the app crashed. A "connected" result's stats may come from a session whose socket has since died. Use debugger-status, not this tool, to judge debugger health.`,
|
|
139996
140011
|
zodSchema: zodSchema37,
|
|
139997
140012
|
readOnly: true,
|
|
@@ -140020,14 +140035,12 @@ When the debugger cannot be reached, it returns { status: "not_connected", reaso
|
|
|
140020
140035
|
appName: api.appName,
|
|
140021
140036
|
logicalDeviceId: api.logicalDeviceId
|
|
140022
140037
|
};
|
|
140023
|
-
|
|
140024
|
-
|
|
140025
|
-
|
|
140026
|
-
|
|
140027
|
-
|
|
140028
|
-
|
|
140029
|
-
if (reaped2) response.note = describeReapedSession(reaped2, "JS-runtime debugger session");
|
|
140030
|
-
}
|
|
140038
|
+
const reaped2 = takeReapedSessionAnyId(reapedDebuggerKind(params), [
|
|
140039
|
+
canonicalDeviceId(params.device_id),
|
|
140040
|
+
params.device_id,
|
|
140041
|
+
api.logicalDeviceId
|
|
140042
|
+
]);
|
|
140043
|
+
if (reaped2) response.note = describeReapedSession(reaped2, "JS-runtime debugger session");
|
|
140031
140044
|
const inFile = api.logWriter.getFileEntryCount();
|
|
140032
140045
|
const fileNote = !api.logWriter.hasFile() ? `No log file exists at ${stats.file}, so there is nothing to grep: the counts, clusters and { entries } are all that was captured. Usually the disk was full or ~/.argent/tmp was not writable when this session started (if root owns ~/.argent: sudo chown -R "$USER" ~/.argent). Only a new debugger session gets a file: once that is fixed, call stop-all-simulator-servers with devices: ["${canonicalDeviceId(params.device_id)}"], then debugger-connect again.` : inFile === 0 && stats.totalEntries > 0 ? `The log file at ${stats.file} holds none of the ${stats.totalEntries} captured entries: every write to it failed (e.g. a full disk), so there is nothing to grep and the counts, clusters and { entries } are all that was captured. Entries logged once the disk has room are written to it.` : inFile < stats.totalEntries ? `The log file at ${stats.file} holds only ${inFile} of the ${stats.totalEntries} captured entries: the other writes to it failed (e.g. a full disk or a file-size limit), so byLevel and clusters count entries that grepping it will not find. Entries logged once the disk has room are written to it.` : void 0;
|
|
140033
140046
|
if (fileNote) response.note = response.note ? `${response.note} ${fileNote}` : fileNote;
|
|
@@ -140041,7 +140054,7 @@ When the debugger cannot be reached, it returns { status: "not_connected", reaso
|
|
|
140041
140054
|
err,
|
|
140042
140055
|
params
|
|
140043
140056
|
);
|
|
140044
|
-
const reaped2 = takeReapedSessionAnyId(
|
|
140057
|
+
const reaped2 = takeReapedSessionAnyId(reapedDebuggerKind(params), [
|
|
140045
140058
|
canonicalDeviceId(params.device_id),
|
|
140046
140059
|
params.device_id
|
|
140047
140060
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.90",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "a37acc2feb6a89f38ab1d0b979fb8f608bbc449b"
|
|
102
102
|
}
|