@swmansion/argent 0.35.1-next.64 → 0.35.1-next.66
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 +219 -101
- package/package.json +2 -2
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38736,7 +38736,7 @@ function isCi(env = process.env) {
|
|
|
38736
38736
|
var SESSION_ID2 = randomUUID5();
|
|
38737
38737
|
function readCliVersion() {
|
|
38738
38738
|
if (true) {
|
|
38739
|
-
return "0.35.1-next.
|
|
38739
|
+
return "0.35.1-next.65";
|
|
38740
38740
|
}
|
|
38741
38741
|
return "0.0.0";
|
|
38742
38742
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -17119,7 +17119,7 @@ function isCi(env = process.env) {
|
|
|
17119
17119
|
var SESSION_ID = randomUUID4();
|
|
17120
17120
|
function readCliVersion() {
|
|
17121
17121
|
if (true) {
|
|
17122
|
-
return "0.35.1-next.
|
|
17122
|
+
return "0.35.1-next.65";
|
|
17123
17123
|
}
|
|
17124
17124
|
return "0.0.0";
|
|
17125
17125
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38305,7 +38305,7 @@ async function startMcpServer(options) {
|
|
|
38305
38305
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38306
38306
|
const whatsNewOn = whatsNewEnabled();
|
|
38307
38307
|
const installedVersion = getInstalledVersion();
|
|
38308
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38308
|
+
const highlightsVersion = true ? "0.35.1-next.65" : installedVersion;
|
|
38309
38309
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38310
38310
|
const trees = createTreeMemory();
|
|
38311
38311
|
const screenshots = createScreenshotMemory();
|
package/dist/tool-server.cjs
CHANGED
|
@@ -73041,7 +73041,7 @@ function isCi(env = process.env) {
|
|
|
73041
73041
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
73042
73042
|
function readCliVersion() {
|
|
73043
73043
|
if (true) {
|
|
73044
|
-
return "0.35.1-next.
|
|
73044
|
+
return "0.35.1-next.65";
|
|
73045
73045
|
}
|
|
73046
73046
|
return "0.0.0";
|
|
73047
73047
|
}
|
|
@@ -104935,8 +104935,12 @@ var CDPClient = class {
|
|
|
104935
104935
|
if (dotIdx < 0) return;
|
|
104936
104936
|
const domain2 = method.slice(0, dotIdx);
|
|
104937
104937
|
const action = method.slice(dotIdx + 1);
|
|
104938
|
-
if (action === "enable")
|
|
104939
|
-
|
|
104938
|
+
if (action === "enable") {
|
|
104939
|
+
this.enabledDomains.add(domain2);
|
|
104940
|
+
this.events.emit("domainEnabled", domain2);
|
|
104941
|
+
} else if (action === "disable") {
|
|
104942
|
+
this.enabledDomains.delete(domain2);
|
|
104943
|
+
}
|
|
104940
104944
|
}
|
|
104941
104945
|
cleanup() {
|
|
104942
104946
|
this.paused = void 0;
|
|
@@ -104989,7 +104993,7 @@ async function discoverPrimaryPage(port, signal) {
|
|
|
104989
104993
|
);
|
|
104990
104994
|
}
|
|
104991
104995
|
throw new FailureError(
|
|
104992
|
-
`Chromium CDP on port ${port} answered but exposes no page target (the app is running with no window). Open an app window and retry.`,
|
|
104996
|
+
`Chromium CDP on port ${port} answered but exposes no page target (the app is running with no window). Open an app window and retry; in a browser, \`open-url\` opens a tab.`,
|
|
104993
104997
|
{
|
|
104994
104998
|
error_code: FAILURE_CODES.CHROMIUM_CDP_NO_PAGE_TARGET,
|
|
104995
104999
|
failure_stage: "chromium_cdp_discover_page_none",
|
|
@@ -105072,16 +105076,40 @@ async function fetchJson(url2, signal) {
|
|
|
105072
105076
|
);
|
|
105073
105077
|
}
|
|
105074
105078
|
}
|
|
105075
|
-
async function connectCdp(port) {
|
|
105079
|
+
async function connectCdp(port, opts = {}) {
|
|
105076
105080
|
await ensureCdpReachable(port);
|
|
105077
|
-
const target = await discoverPrimaryPage(port);
|
|
105081
|
+
const target = opts.openTabIfNone ? await discoverOrOpenPage(port) : await discoverPrimaryPage(port);
|
|
105078
105082
|
const wsUrl = target.webSocketDebuggerUrl;
|
|
105079
105083
|
const cdp = new CDPClient(wsUrl, { sendOrigin: false });
|
|
105080
105084
|
await cdp.connect();
|
|
105081
105085
|
return { cdp, wsUrl, target };
|
|
105082
105086
|
}
|
|
105087
|
+
async function discoverOrOpenPage(port) {
|
|
105088
|
+
try {
|
|
105089
|
+
return await discoverPrimaryPage(port);
|
|
105090
|
+
} catch (err) {
|
|
105091
|
+
if (getFailureSignal(err)?.failure_stage !== "chromium_cdp_discover_page_none") throw err;
|
|
105092
|
+
const targetId = await openBlankPage(port);
|
|
105093
|
+
const target = targetId && (await listPageTargets(port)).find((t) => t.id === targetId);
|
|
105094
|
+
if (!target) throw err;
|
|
105095
|
+
return target;
|
|
105096
|
+
}
|
|
105097
|
+
}
|
|
105098
|
+
async function openBlankPage(port) {
|
|
105099
|
+
const browser = new CDPClient(await browserWebSocketUrl(port), { sendOrigin: false });
|
|
105100
|
+
await browser.connect();
|
|
105101
|
+
try {
|
|
105102
|
+
const { targetId } = await browser.send("Target.createTarget", { url: "about:blank" });
|
|
105103
|
+
return targetId;
|
|
105104
|
+
} catch {
|
|
105105
|
+
return null;
|
|
105106
|
+
} finally {
|
|
105107
|
+
await browser.disconnect().catch(() => {
|
|
105108
|
+
});
|
|
105109
|
+
}
|
|
105110
|
+
}
|
|
105083
105111
|
async function primePageSession(cdp) {
|
|
105084
|
-
for (const domain2 of ["Page", "DOM", "Runtime", "Accessibility"]) {
|
|
105112
|
+
for (const domain2 of ["Page", "DOM", "Runtime", "Accessibility", "Log"]) {
|
|
105085
105113
|
try {
|
|
105086
105114
|
await cdp.send(`${domain2}.enable`);
|
|
105087
105115
|
} catch {
|
|
@@ -106098,7 +106126,9 @@ async function readViewport(cdp) {
|
|
|
106098
106126
|
|
|
106099
106127
|
// ../tool-server/src/chromium-server/index.ts
|
|
106100
106128
|
async function createChromiumServer(opts) {
|
|
106101
|
-
const { cdp, wsUrl, target } = await connectCdp(opts.port
|
|
106129
|
+
const { cdp, wsUrl, target } = await connectCdp(opts.port, {
|
|
106130
|
+
openTabIfNone: opts.openTabIfNone
|
|
106131
|
+
});
|
|
106102
106132
|
let viewport;
|
|
106103
106133
|
try {
|
|
106104
106134
|
if (opts.answerTimeoutMs !== void 0) {
|
|
@@ -106249,7 +106279,8 @@ var chromiumCdpBlueprint = {
|
|
|
106249
106279
|
const server = await createChromiumServer({
|
|
106250
106280
|
deviceId: device.id,
|
|
106251
106281
|
port,
|
|
106252
|
-
answerTimeoutMs: opts?.answerTimeoutMs
|
|
106282
|
+
answerTimeoutMs: opts?.answerTimeoutMs,
|
|
106283
|
+
openTabIfNone: opts?.openTabIfNone
|
|
106253
106284
|
});
|
|
106254
106285
|
const rootDomNodeId = await getDocumentNodeId(server.cdp);
|
|
106255
106286
|
const events = new TypedEventEmitter();
|
|
@@ -106371,18 +106402,26 @@ function getCandidateChromiumPorts() {
|
|
|
106371
106402
|
const fromEnv = parsePortList(process.env.ARGENT_CHROMIUM_PORTS);
|
|
106372
106403
|
return Array.from(/* @__PURE__ */ new Set([9222, ...fromEnv, ...TRACKED_PORTS, ...loadPersistedPorts()]));
|
|
106373
106404
|
}
|
|
106405
|
+
async function discoverPageOrNone(port, signal) {
|
|
106406
|
+
try {
|
|
106407
|
+
return await discoverPrimaryPage(port, signal);
|
|
106408
|
+
} catch (err) {
|
|
106409
|
+
if (getFailureSignal(err)?.failure_stage === "chromium_cdp_discover_page_none") return null;
|
|
106410
|
+
throw err;
|
|
106411
|
+
}
|
|
106412
|
+
}
|
|
106374
106413
|
async function probePort(port, timeoutMs) {
|
|
106375
106414
|
const ctrl = new AbortController();
|
|
106376
106415
|
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
106377
106416
|
try {
|
|
106378
106417
|
const version3 = await ensureCdpReachable(port, ctrl.signal);
|
|
106379
|
-
const target = await
|
|
106418
|
+
const target = await discoverPageOrNone(port, ctrl.signal);
|
|
106380
106419
|
return {
|
|
106381
106420
|
platform: "chromium",
|
|
106382
106421
|
id: chromiumIdFromPort(port),
|
|
106383
106422
|
port,
|
|
106384
|
-
title: target
|
|
106385
|
-
url: target
|
|
106423
|
+
title: target?.title ?? "",
|
|
106424
|
+
url: target?.url ?? "",
|
|
106386
106425
|
browser: version3.Browser ?? null,
|
|
106387
106426
|
state: "Running"
|
|
106388
106427
|
};
|
|
@@ -125293,6 +125332,66 @@ function describeReapedSession(entry, what) {
|
|
|
125293
125332
|
return `The ${what} for device ${entry.deviceId} was torn down ${secondsAgo}s ago \u2014 by a stop-all-simulator-servers, which reaps every service a device owns, or by another teardown that reaches the same services (a stop-simulator-server on Chromium or a Mac app, or a react-profiler-start reclaiming the session with force). One tool-server serves every agent using this Argent install and home, so this may have been another agent rather than your own call. It was not a session that never started.${salvage}`;
|
|
125294
125333
|
}
|
|
125295
125334
|
|
|
125335
|
+
// ../tool-server/src/tools/network/network-secrets.ts
|
|
125336
|
+
init_src();
|
|
125337
|
+
|
|
125338
|
+
// ../tool-server/src/utils/received-secrets.ts
|
|
125339
|
+
var MAX_VALUES2 = 256;
|
|
125340
|
+
var received = /* @__PURE__ */ new Map();
|
|
125341
|
+
function noteReceivedSecrets(secrets) {
|
|
125342
|
+
for (const [name, value] of secrets) {
|
|
125343
|
+
if (value.length === 0) continue;
|
|
125344
|
+
received.delete(value);
|
|
125345
|
+
received.set(value, name);
|
|
125346
|
+
if (received.size > MAX_VALUES2) received.delete(received.keys().next().value);
|
|
125347
|
+
}
|
|
125348
|
+
}
|
|
125349
|
+
function receivedSecrets() {
|
|
125350
|
+
return [...received].reverse().map(([value, name]) => ({ name, value }));
|
|
125351
|
+
}
|
|
125352
|
+
|
|
125353
|
+
// ../tool-server/src/tools/network/network-secrets.ts
|
|
125354
|
+
function networkSecrets(ctx) {
|
|
125355
|
+
const secrets = [];
|
|
125356
|
+
for (const [name, value] of ctx?.clientSecrets ?? []) secrets.push({ name, value });
|
|
125357
|
+
for (const source of secretSources()) {
|
|
125358
|
+
for (const [name, value] of source.values) secrets.push({ name, value });
|
|
125359
|
+
}
|
|
125360
|
+
return [...secrets, ...receivedSecrets(), ...typedSecrets()];
|
|
125361
|
+
}
|
|
125362
|
+
function networkRedactorOf(secrets) {
|
|
125363
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
125364
|
+
for (const { name, value } of secrets) {
|
|
125365
|
+
if (value.length > 0 && !byValue.has(value)) byValue.set(value, name);
|
|
125366
|
+
}
|
|
125367
|
+
return secretRedactor(
|
|
125368
|
+
[...byValue].map(([value, name]) => ({ name, value })),
|
|
125369
|
+
{ wholeValues: true }
|
|
125370
|
+
);
|
|
125371
|
+
}
|
|
125372
|
+
function networkSecretRedactor(ctx) {
|
|
125373
|
+
return networkRedactorOf(networkSecrets(ctx));
|
|
125374
|
+
}
|
|
125375
|
+
function redactNetworkResult(result, redact2, keep = []) {
|
|
125376
|
+
if (redact2.names.size === 0) return result;
|
|
125377
|
+
const kept = keep.map((path77) => path77.split("."));
|
|
125378
|
+
const walk = (node2, path77) => {
|
|
125379
|
+
if (typeof node2 === "string") {
|
|
125380
|
+
return kept.some(
|
|
125381
|
+
(k) => k.length === path77.length && k.every((p, i) => p === "*" ? /^\d+$/.test(path77[i]) : p === path77[i])
|
|
125382
|
+
) ? node2 : redact2(node2);
|
|
125383
|
+
}
|
|
125384
|
+
if (Array.isArray(node2)) return node2.map((item, i) => walk(item, [...path77, String(i)]));
|
|
125385
|
+
if (node2 === null || typeof node2 !== "object") return node2;
|
|
125386
|
+
const out = {};
|
|
125387
|
+
for (const [key2, value] of Object.entries(node2)) {
|
|
125388
|
+
out[redact2(key2)] = walk(value, [...path77, key2]);
|
|
125389
|
+
}
|
|
125390
|
+
return out;
|
|
125391
|
+
};
|
|
125392
|
+
return walk(result, []);
|
|
125393
|
+
}
|
|
125394
|
+
|
|
125296
125395
|
// ../tool-server/src/blueprints/chromium-js-runtime-debugger.ts
|
|
125297
125396
|
var CHROMIUM_JS_RUNTIME_DEBUGGER_NAMESPACE = "ChromiumJsRuntimeDebugger";
|
|
125298
125397
|
function chromiumJsRuntimeDebuggerRef(device) {
|
|
@@ -125318,6 +125417,66 @@ function formatConsoleArgs(params) {
|
|
|
125318
125417
|
return `[${arg.type}]`;
|
|
125319
125418
|
}).join(" ");
|
|
125320
125419
|
}
|
|
125420
|
+
var MAX_REPLAY_KEYS = 5e4;
|
|
125421
|
+
var REPLAY_KEY_PREFIX_CHARS = 64;
|
|
125422
|
+
function replayKey(targetId, { timestamp, level, message }) {
|
|
125423
|
+
const prefix = detachedCopy(message.slice(0, REPLAY_KEY_PREFIX_CHARS));
|
|
125424
|
+
return `${targetId}|${timestamp}|${level}|${message.length}|${prefix}`;
|
|
125425
|
+
}
|
|
125426
|
+
function createReplayFilter() {
|
|
125427
|
+
const recorded = /* @__PURE__ */ new Map();
|
|
125428
|
+
const seenSinceAttach = /* @__PURE__ */ new Map();
|
|
125429
|
+
const replaying = /* @__PURE__ */ new Set();
|
|
125430
|
+
return {
|
|
125431
|
+
attached: () => {
|
|
125432
|
+
seenSinceAttach.clear();
|
|
125433
|
+
replaying.add("Runtime").add("Log");
|
|
125434
|
+
},
|
|
125435
|
+
enabled: (domain2) => {
|
|
125436
|
+
replaying.delete(domain2);
|
|
125437
|
+
},
|
|
125438
|
+
isReplay(domain2, key2) {
|
|
125439
|
+
const seen = seenSinceAttach.get(key2) ?? 0;
|
|
125440
|
+
const count2 = recorded.get(key2) ?? 0;
|
|
125441
|
+
if (replaying.has(domain2) && seen < count2) {
|
|
125442
|
+
seenSinceAttach.set(key2, seen + 1);
|
|
125443
|
+
return true;
|
|
125444
|
+
}
|
|
125445
|
+
if (count2 > 0 || recorded.size < MAX_REPLAY_KEYS) {
|
|
125446
|
+
recorded.set(key2, count2 + 1);
|
|
125447
|
+
seenSinceAttach.set(key2, seen + 1);
|
|
125448
|
+
}
|
|
125449
|
+
return false;
|
|
125450
|
+
}
|
|
125451
|
+
};
|
|
125452
|
+
}
|
|
125453
|
+
function withEntryUrl(text, { source, url: url2 }) {
|
|
125454
|
+
if (!url2 || text.includes(url2)) return text;
|
|
125455
|
+
return source === "network" ? `${url2} ${text}` : `${text} ${url2}`;
|
|
125456
|
+
}
|
|
125457
|
+
function browserLogMessage(params) {
|
|
125458
|
+
const entry = params.entry ?? {};
|
|
125459
|
+
const text = entry.text ?? "";
|
|
125460
|
+
return {
|
|
125461
|
+
args: [],
|
|
125462
|
+
level: entry.level === "verbose" ? "debug" : entry.level ?? "info",
|
|
125463
|
+
message: withEntryUrl(text, entry),
|
|
125464
|
+
timestamp: entry.timestamp ?? NaN
|
|
125465
|
+
};
|
|
125466
|
+
}
|
|
125467
|
+
function uncaughtExceptionMessage(params) {
|
|
125468
|
+
const details = params.exceptionDetails ?? {};
|
|
125469
|
+
const exception = details.exception;
|
|
125470
|
+
const thrown = exception?.description?.split("\n")[0] ?? (exception && "value" in exception ? stringifyConsoleValue(exception.value) : void 0);
|
|
125471
|
+
const text = details.text ?? "Uncaught";
|
|
125472
|
+
return {
|
|
125473
|
+
args: [],
|
|
125474
|
+
level: "error",
|
|
125475
|
+
message: thrown ? `${text} ${thrown}` : text,
|
|
125476
|
+
timestamp: params.timestamp ?? NaN,
|
|
125477
|
+
stackTrace: details.stackTrace
|
|
125478
|
+
};
|
|
125479
|
+
}
|
|
125321
125480
|
function createConsoleLogServer(consoleEvents, logWriter) {
|
|
125322
125481
|
return new Promise((resolve24, reject) => {
|
|
125323
125482
|
const server = http3.createServer();
|
|
@@ -125402,10 +125561,26 @@ var chromiumJsRuntimeDebuggerBlueprint = {
|
|
|
125402
125561
|
const logWriter = new LogFileWriter(port);
|
|
125403
125562
|
const consoleEvents = new TypedEventEmitter();
|
|
125404
125563
|
let nextLogId = 0;
|
|
125564
|
+
const replays = createReplayFilter();
|
|
125565
|
+
cdp.events.on("connected", replays.attached);
|
|
125566
|
+
cdp.events.on("domainEnabled", replays.enabled);
|
|
125567
|
+
const isReplay = (domain2, fields) => Number.isFinite(fields.timestamp) && replays.isReplay(domain2, replayKey(chromium.server.tabs.activeTargetId(), fields));
|
|
125568
|
+
const record2 = (domain2, fields, { redactSecrets: redactSecrets2 = false } = {}) => {
|
|
125569
|
+
if (isReplay(domain2, fields)) return;
|
|
125570
|
+
const message = redactSecrets2 ? networkSecretRedactor()(fields.message) : fields.message;
|
|
125571
|
+
const ts = Number.isFinite(fields.timestamp) ? fields.timestamp : Date.now();
|
|
125572
|
+
const entry = { ...fields, id: nextLogId++, message, timestamp: ts };
|
|
125573
|
+
logWriter.write({
|
|
125574
|
+
id: entry.id,
|
|
125575
|
+
timestamp: consoleTimestampToIso(ts),
|
|
125576
|
+
level: entry.level,
|
|
125577
|
+
message: entry.message,
|
|
125578
|
+
stackTrace: entry.stackTrace
|
|
125579
|
+
});
|
|
125580
|
+
consoleEvents.emit("log", entry);
|
|
125581
|
+
};
|
|
125405
125582
|
const onConsoleAPI = (params) => {
|
|
125406
|
-
|
|
125407
|
-
const entry = {
|
|
125408
|
-
id: nextLogId++,
|
|
125583
|
+
record2("Runtime", {
|
|
125409
125584
|
level: params.type,
|
|
125410
125585
|
args: params.args.map((a) => ({
|
|
125411
125586
|
type: a.type,
|
|
@@ -125413,19 +125588,19 @@ var chromiumJsRuntimeDebuggerBlueprint = {
|
|
|
125413
125588
|
description: a.description
|
|
125414
125589
|
})),
|
|
125415
125590
|
message: formatConsoleArgs(params),
|
|
125416
|
-
timestamp:
|
|
125591
|
+
timestamp: params.timestamp,
|
|
125417
125592
|
stackTrace: params.stackTrace
|
|
125418
|
-
};
|
|
125419
|
-
logWriter.write({
|
|
125420
|
-
id: entry.id,
|
|
125421
|
-
timestamp: consoleTimestampToIso(ts),
|
|
125422
|
-
level: entry.level,
|
|
125423
|
-
message: entry.message,
|
|
125424
|
-
stackTrace: entry.stackTrace
|
|
125425
125593
|
});
|
|
125426
|
-
consoleEvents.emit("log", entry);
|
|
125427
125594
|
};
|
|
125428
125595
|
cdp.events.on("consoleAPICalled", onConsoleAPI);
|
|
125596
|
+
const onBrowserEvent = (method, params) => {
|
|
125597
|
+
if (method === "Log.entryAdded") {
|
|
125598
|
+
record2("Log", browserLogMessage(params), { redactSecrets: true });
|
|
125599
|
+
} else if (method === "Runtime.exceptionThrown") {
|
|
125600
|
+
record2("Runtime", uncaughtExceptionMessage(params));
|
|
125601
|
+
}
|
|
125602
|
+
};
|
|
125603
|
+
cdp.events.on("event", onBrowserEvent);
|
|
125429
125604
|
const consoleServer = await createConsoleLogServer(consoleEvents, logWriter);
|
|
125430
125605
|
await cdp.addBinding("__argent_callback").catch(() => {
|
|
125431
125606
|
});
|
|
@@ -125452,6 +125627,9 @@ var chromiumJsRuntimeDebuggerBlueprint = {
|
|
|
125452
125627
|
api,
|
|
125453
125628
|
dispose: async () => {
|
|
125454
125629
|
cdp.events.off("consoleAPICalled", onConsoleAPI);
|
|
125630
|
+
cdp.events.off("event", onBrowserEvent);
|
|
125631
|
+
cdp.events.off("connected", replays.attached);
|
|
125632
|
+
cdp.events.off("domainEnabled", replays.enabled);
|
|
125455
125633
|
cdp.events.off("disconnected", onDisconnected);
|
|
125456
125634
|
await consoleServer.close();
|
|
125457
125635
|
const captured = logWriter.getStats().totalEntries;
|
|
@@ -125757,21 +125935,6 @@ function isLocalConnection(socket) {
|
|
|
125757
125935
|
return LOOPBACK_ADDRESSES.has(remote) || remote === socket.localAddress || isOwnAddress(remote);
|
|
125758
125936
|
}
|
|
125759
125937
|
|
|
125760
|
-
// ../tool-server/src/utils/received-secrets.ts
|
|
125761
|
-
var MAX_VALUES2 = 256;
|
|
125762
|
-
var received = /* @__PURE__ */ new Map();
|
|
125763
|
-
function noteReceivedSecrets(secrets) {
|
|
125764
|
-
for (const [name, value] of secrets) {
|
|
125765
|
-
if (value.length === 0) continue;
|
|
125766
|
-
received.delete(value);
|
|
125767
|
-
received.set(value, name);
|
|
125768
|
-
if (received.size > MAX_VALUES2) received.delete(received.keys().next().value);
|
|
125769
|
-
}
|
|
125770
|
-
}
|
|
125771
|
-
function receivedSecrets() {
|
|
125772
|
-
return [...received].reverse().map(([value, name]) => ({ name, value }));
|
|
125773
|
-
}
|
|
125774
|
-
|
|
125775
125938
|
// ../tool-server/src/http.ts
|
|
125776
125939
|
var AUTO_SUPPRESS_MS = 30 * 60 * 1e3;
|
|
125777
125940
|
var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
|
|
@@ -129416,51 +129579,6 @@ Fails if the simulator server is not running for the given UDID.`,
|
|
|
129416
129579
|
|
|
129417
129580
|
// ../tool-server/src/tools/native-devtools/native-network-logs.ts
|
|
129418
129581
|
init_zod();
|
|
129419
|
-
|
|
129420
|
-
// ../tool-server/src/tools/network/network-secrets.ts
|
|
129421
|
-
init_src();
|
|
129422
|
-
function networkSecrets(ctx) {
|
|
129423
|
-
const secrets = [];
|
|
129424
|
-
for (const [name, value] of ctx?.clientSecrets ?? []) secrets.push({ name, value });
|
|
129425
|
-
for (const source of secretSources()) {
|
|
129426
|
-
for (const [name, value] of source.values) secrets.push({ name, value });
|
|
129427
|
-
}
|
|
129428
|
-
return [...secrets, ...receivedSecrets(), ...typedSecrets()];
|
|
129429
|
-
}
|
|
129430
|
-
function networkRedactorOf(secrets) {
|
|
129431
|
-
const byValue = /* @__PURE__ */ new Map();
|
|
129432
|
-
for (const { name, value } of secrets) {
|
|
129433
|
-
if (value.length > 0 && !byValue.has(value)) byValue.set(value, name);
|
|
129434
|
-
}
|
|
129435
|
-
return secretRedactor(
|
|
129436
|
-
[...byValue].map(([value, name]) => ({ name, value })),
|
|
129437
|
-
{ wholeValues: true }
|
|
129438
|
-
);
|
|
129439
|
-
}
|
|
129440
|
-
function networkSecretRedactor(ctx) {
|
|
129441
|
-
return networkRedactorOf(networkSecrets(ctx));
|
|
129442
|
-
}
|
|
129443
|
-
function redactNetworkResult(result, redact2, keep = []) {
|
|
129444
|
-
if (redact2.names.size === 0) return result;
|
|
129445
|
-
const kept = keep.map((path77) => path77.split("."));
|
|
129446
|
-
const walk = (node2, path77) => {
|
|
129447
|
-
if (typeof node2 === "string") {
|
|
129448
|
-
return kept.some(
|
|
129449
|
-
(k) => k.length === path77.length && k.every((p, i) => p === "*" ? /^\d+$/.test(path77[i]) : p === path77[i])
|
|
129450
|
-
) ? node2 : redact2(node2);
|
|
129451
|
-
}
|
|
129452
|
-
if (Array.isArray(node2)) return node2.map((item, i) => walk(item, [...path77, String(i)]));
|
|
129453
|
-
if (node2 === null || typeof node2 !== "object") return node2;
|
|
129454
|
-
const out = {};
|
|
129455
|
-
for (const [key2, value] of Object.entries(node2)) {
|
|
129456
|
-
out[redact2(key2)] = walk(value, [...path77, key2]);
|
|
129457
|
-
}
|
|
129458
|
-
return out;
|
|
129459
|
-
};
|
|
129460
|
-
return walk(result, []);
|
|
129461
|
-
}
|
|
129462
|
-
|
|
129463
|
-
// ../tool-server/src/tools/native-devtools/native-network-logs.ts
|
|
129464
129582
|
init_src2();
|
|
129465
129583
|
init_device_info();
|
|
129466
129584
|
|
|
@@ -138349,7 +138467,8 @@ Returns \`{ opened, url, note? }\`. Fails if no handler is registered<flag:harmo
|
|
|
138349
138467
|
services: (params) => {
|
|
138350
138468
|
const device = resolveDevice(params.udid);
|
|
138351
138469
|
if (device.platform === "chromium") {
|
|
138352
|
-
|
|
138470
|
+
const ref = chromiumCdpRef(device);
|
|
138471
|
+
return { chromium: { ...ref, options: { ...ref.options, openTabIfNone: true } } };
|
|
138353
138472
|
}
|
|
138354
138473
|
if (device.platform === "macos") return { macosApp: macosAppRef(device) };
|
|
138355
138474
|
return {};
|
|
@@ -141173,6 +141292,15 @@ function charToChromiumKey(char) {
|
|
|
141173
141292
|
|
|
141174
141293
|
// ../tool-server/src/tools/keyboard/platforms/chromium.ts
|
|
141175
141294
|
var sleep12 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
141295
|
+
var isOutsideAscii = (char) => char.codePointAt(0) >= 128;
|
|
141296
|
+
function assertTypeable(char) {
|
|
141297
|
+
if (charToChromiumKey(char) || isOutsideAscii(char)) return;
|
|
141298
|
+
throw new InvalidToolInputError(`No CDP key descriptor for character "${char}"`, {
|
|
141299
|
+
error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
|
|
141300
|
+
failure_stage: "keyboard_char_chromium",
|
|
141301
|
+
error_kind: "unsupported"
|
|
141302
|
+
});
|
|
141303
|
+
}
|
|
141176
141304
|
async function runChromium(api, params) {
|
|
141177
141305
|
const delay3 = params.delayMs ?? 50;
|
|
141178
141306
|
let keysPressed = 0;
|
|
@@ -141180,11 +141308,11 @@ async function runChromium(api, params) {
|
|
|
141180
141308
|
for (const char of params.text) {
|
|
141181
141309
|
const desc = charToChromiumKey(char);
|
|
141182
141310
|
if (!desc) {
|
|
141183
|
-
|
|
141184
|
-
|
|
141185
|
-
|
|
141186
|
-
|
|
141187
|
-
|
|
141311
|
+
assertTypeable(char);
|
|
141312
|
+
await api.cdp.send("Input.insertText", { text: char });
|
|
141313
|
+
keysPressed++;
|
|
141314
|
+
await sleep12(delay3);
|
|
141315
|
+
continue;
|
|
141188
141316
|
}
|
|
141189
141317
|
await api.dispatchKeyEvent({
|
|
141190
141318
|
type: "keyDown",
|
|
@@ -141243,17 +141371,7 @@ function makeChromiumImpl(registry2) {
|
|
|
141243
141371
|
return {
|
|
141244
141372
|
handler: async (_services, params, device) => {
|
|
141245
141373
|
if (params.clear) {
|
|
141246
|
-
|
|
141247
|
-
for (const char of params.text) {
|
|
141248
|
-
if (!charToChromiumKey(char)) {
|
|
141249
|
-
throw new InvalidToolInputError(`No CDP key descriptor for character "${char}"`, {
|
|
141250
|
-
error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
|
|
141251
|
-
failure_stage: "keyboard_char_chromium",
|
|
141252
|
-
error_kind: "unsupported"
|
|
141253
|
-
});
|
|
141254
|
-
}
|
|
141255
|
-
}
|
|
141256
|
-
}
|
|
141374
|
+
for (const char of params.text ?? "") assertTypeable(char);
|
|
141257
141375
|
await fillChromium(registry2, device, "");
|
|
141258
141376
|
if (!params.text && !params.key) {
|
|
141259
141377
|
return { typed: "", keys: 0, cleared: true };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.66",
|
|
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": "99f69a581658b01280e23a60c61c78988e4faf61"
|
|
102
102
|
}
|