@swmansion/argent 0.35.1-next.91 → 0.35.1-next.93
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/tool-server.cjs +59 -18
- package/package.json +2 -2
package/dist/tool-server.cjs
CHANGED
|
@@ -99565,25 +99565,39 @@ function decodeHexFingerprint(fingerprint) {
|
|
|
99565
99565
|
}
|
|
99566
99566
|
return out;
|
|
99567
99567
|
}
|
|
99568
|
+
var CONNECT_TIMEOUT_MS = 2e4;
|
|
99568
99569
|
async function connectMoq(info, options = {}) {
|
|
99569
|
-
const url2 =
|
|
99570
|
-
if (info.token) url2.searchParams.set("token", info.token);
|
|
99570
|
+
const url2 = withToken(info.url, info.token);
|
|
99571
99571
|
const fingerprint = decodeHexFingerprint(info.fingerprint);
|
|
99572
|
+
const overdue = new AbortController();
|
|
99573
|
+
const timer = setTimeout(
|
|
99574
|
+
() => overdue.abort(new Error(`no connection after ${CONNECT_TIMEOUT_MS} ms`)),
|
|
99575
|
+
CONNECT_TIMEOUT_MS
|
|
99576
|
+
);
|
|
99572
99577
|
try {
|
|
99573
99578
|
return await connection_exports.connect(url2, {
|
|
99574
99579
|
webtransport: {
|
|
99575
99580
|
...options.webtransport,
|
|
99576
99581
|
serverCertificateHashes: [{ algorithm: "sha-256", value: fingerprint }]
|
|
99577
99582
|
},
|
|
99578
|
-
|
|
99579
|
-
|
|
99580
|
-
// reconnect.
|
|
99581
|
-
websocket: { enabled: false }
|
|
99583
|
+
websocket: websocketFallback(info),
|
|
99584
|
+
signal: options.signal ? AbortSignal.any([overdue.signal, options.signal]) : overdue.signal
|
|
99582
99585
|
});
|
|
99583
99586
|
} catch (err) {
|
|
99584
99587
|
throw unwrapMoqConnectError(err, info.url);
|
|
99588
|
+
} finally {
|
|
99589
|
+
clearTimeout(timer);
|
|
99585
99590
|
}
|
|
99586
99591
|
}
|
|
99592
|
+
function withToken(endpoint, token) {
|
|
99593
|
+
const url2 = new URL(endpoint);
|
|
99594
|
+
if (token) url2.searchParams.set("token", token);
|
|
99595
|
+
return url2;
|
|
99596
|
+
}
|
|
99597
|
+
function websocketFallback(info) {
|
|
99598
|
+
if (!info.websocket_url) return { enabled: false };
|
|
99599
|
+
return { enabled: true, url: withToken(info.websocket_url, info.token) };
|
|
99600
|
+
}
|
|
99587
99601
|
function unwrapMoqConnectError(err, url2) {
|
|
99588
99602
|
if (err instanceof AggregateError) {
|
|
99589
99603
|
const parts2 = err.errors.map((e) => e instanceof Error ? `${e.name}: ${e.message}` : String(e));
|
|
@@ -108942,7 +108956,7 @@ function outdatedCloudCliNote(version3) {
|
|
|
108942
108956
|
return `iOS: ${argentCloudCommand()} ${version3} is older than ${MIN_ARGENT_CLOUD_VERSION}, the version Argent expects. Argent Cloud simulators still work. The user can update it with \`argent cloud install\`.`;
|
|
108943
108957
|
}
|
|
108944
108958
|
var ANDROID_SDK_MISSING_NOTE = "Android: no SDK found (adb, emulator). Installing the platform tools and creating an AVD adds Android targets.";
|
|
108945
|
-
var EXTERNAL_DEVICES_HINT = `Some entries are tagged 'external: true': another application is already driving that device, and its 'provider' field names it ('provider.workspace' names the project it opened, when it published one). Drive them with the usual tools, by the 'ext:'-prefixed id. Two rules differ: prefer the external device whose 'provider.workspace.path' matches the project you are working in, and do NOT call boot-device on them, since the provider owns their lifecycle. stop-simulator-server IS safe on them and never stops the provider's server \u2014 it drops argent's cached handles, which is the recovery when calls keep failing against an endpoint the provider has since moved. Each entry's 'capabilities' lists the mechanisms that provider granted; a tool relying on one it withheld fails with a clear message naming the provider.`;
|
|
108959
|
+
var EXTERNAL_DEVICES_HINT = `Some entries are tagged 'external: true': another application is already driving that device, and its 'provider' field names it ('provider.workspace' names the project it opened, when it published one). Drive them with the usual tools, by the 'ext:'-prefixed id. Two rules differ: prefer the external device whose 'provider.workspace.path' matches the project you are working in, and do NOT call boot-device on them, since the provider owns their lifecycle. stop-simulator-server IS safe on them and never stops the provider's server \u2014 it drops argent's cached handles, which is the recovery when calls keep failing against an endpoint the provider has since moved. stop-all-simulator-servers does the same for that server, also under the device's plain UDID / serial, and leaves it out of 'stopped', so an empty 'stopped' does not mean the provider's server is gone. Each entry's 'capabilities' lists the mechanisms that provider granted; a tool relying on one it withheld fails with a clear message naming the provider.`;
|
|
108946
108960
|
function foldableCheckTimedOutHint(names) {
|
|
108947
108961
|
return `The foldable check did not finish in time for ${names.join(", ")}, so 'foldable: true' may be missing there. Call list-devices again to retry the check.`;
|
|
108948
108962
|
}
|
|
@@ -162818,7 +162832,7 @@ init_device_info();
|
|
|
162818
162832
|
init_capability();
|
|
162819
162833
|
var AUDIO_DIR_ENV2 = "ARGENT_AUDIO_DIR";
|
|
162820
162834
|
var AUDIO_DYLIB = "libArgentAudio.dylib";
|
|
162821
|
-
var
|
|
162835
|
+
var CONNECT_TIMEOUT_MS2 = 3e4;
|
|
162822
162836
|
var REPLY_TIMEOUT_MS = 6e4;
|
|
162823
162837
|
var MAX_FILE_BYTES = 256 * 1024 * 1024;
|
|
162824
162838
|
function createRemoteAudioSession(udid) {
|
|
@@ -162996,7 +163010,7 @@ async function startFeeder(session) {
|
|
|
162996
163010
|
const connected = new Promise((resolve24, reject) => {
|
|
162997
163011
|
timer = setTimeout(
|
|
162998
163012
|
() => reject(failure2("The remote audio feeder did not connect.", "audio_remote_link")),
|
|
162999
|
-
|
|
163013
|
+
CONNECT_TIMEOUT_MS2
|
|
163000
163014
|
);
|
|
163001
163015
|
server.on("connection", (socket) => {
|
|
163002
163016
|
let hello = "";
|
|
@@ -167484,9 +167498,9 @@ Returns a session list or loaded summary. Fails if \`session_id\` or its files a
|
|
|
167484
167498
|
init_zod();
|
|
167485
167499
|
init_src2();
|
|
167486
167500
|
init_device_info();
|
|
167487
|
-
init_external_devices();
|
|
167488
167501
|
|
|
167489
167502
|
// ../tool-server/src/tools/simulator/device-services.ts
|
|
167503
|
+
init_src2();
|
|
167490
167504
|
init_external_devices();
|
|
167491
167505
|
var URN_SUFFIXES = ["", ":tcp"];
|
|
167492
167506
|
var PORT_KEYED_NAMESPACES = [
|
|
@@ -167565,16 +167579,42 @@ function deviceIdOfUrn(urn, namespaces) {
|
|
|
167565
167579
|
}
|
|
167566
167580
|
return void 0;
|
|
167567
167581
|
}
|
|
167568
|
-
function
|
|
167569
|
-
if (isExternalDeviceUrn(urn)) return true;
|
|
167582
|
+
async function isLentNativeDevtools(registry2, urn) {
|
|
167570
167583
|
const portion = deviceIdOfUrn(urn, [NATIVE_DEVTOOLS_NAMESPACE]);
|
|
167571
167584
|
if (portion === void 0) return false;
|
|
167572
167585
|
const suffix = URN_SUFFIXES.find((s) => s !== "" && portion.endsWith(s)) ?? "";
|
|
167573
|
-
|
|
167586
|
+
if (isExternalId(portion.slice(0, portion.length - suffix.length))) return true;
|
|
167587
|
+
try {
|
|
167588
|
+
if (registry2.getServiceState(urn) !== "RUNNING" /* RUNNING */) return false;
|
|
167589
|
+
const api = await registry2.resolveService(urn);
|
|
167590
|
+
return api.armsEnv === false;
|
|
167591
|
+
} catch {
|
|
167592
|
+
return false;
|
|
167593
|
+
}
|
|
167574
167594
|
}
|
|
167575
167595
|
function unnameableSessionUrns(urns) {
|
|
167576
167596
|
return urns.filter((urn) => isLogicalKeyedDevice(deviceIdOfUrn(urn, PORT_KEYED_NAMESPACES)));
|
|
167577
167597
|
}
|
|
167598
|
+
async function isBorrowedSimulatorServer(registry2, urn) {
|
|
167599
|
+
if (!urn.startsWith(`${SIMULATOR_SERVER_NAMESPACE}:`)) return false;
|
|
167600
|
+
if (isExternalDeviceUrn(urn)) return true;
|
|
167601
|
+
try {
|
|
167602
|
+
if (registry2.getServiceState(urn) !== "RUNNING" /* RUNNING */) return false;
|
|
167603
|
+
const api = await registry2.resolveService(urn);
|
|
167604
|
+
return api.external === true;
|
|
167605
|
+
} catch {
|
|
167606
|
+
return false;
|
|
167607
|
+
}
|
|
167608
|
+
}
|
|
167609
|
+
async function providerOwnedUrns(registry2, urns) {
|
|
167610
|
+
const owned = /* @__PURE__ */ new Set();
|
|
167611
|
+
for (const urn of urns) {
|
|
167612
|
+
if (await isLentNativeDevtools(registry2, urn) || await isBorrowedSimulatorServer(registry2, urn)) {
|
|
167613
|
+
owned.add(urn);
|
|
167614
|
+
}
|
|
167615
|
+
}
|
|
167616
|
+
return owned;
|
|
167617
|
+
}
|
|
167578
167618
|
|
|
167579
167619
|
// ../tool-server/src/tools/simulator/stop-simulator-server.ts
|
|
167580
167620
|
var zodSchema69 = external_exports.object({
|
|
@@ -167587,7 +167627,7 @@ function createStopSimulatorServerTool(registry2) {
|
|
|
167587
167627
|
id: "stop-simulator-server",
|
|
167588
167628
|
description: `Stop the transport session for one device (simulator-server, physical iOS runner, Chromium CDP, or TV daemons).
|
|
167589
167629
|
Use when restarting a wedged transport or freeing one device without affecting others (not routinely after every task; use \`stop-all-simulator-servers\` with \`devices\` to also stop devtools/profilers/debuggers). On Chromium, also ends the JS debugger session.<flag:macos-apps> On Mac apps, also stops native capture (discarding records) and screen recording.</flag:macos-apps>
|
|
167590
|
-
Returns \`{ stopped, udid }\` (\`stopped: false\` if none was running
|
|
167630
|
+
Returns \`{ stopped, udid }\` (\`stopped: true\` if any of these services was running, \`false\` if none was). A simulator-server that Argent did not start keeps running and does not count, so on a TV target \`stopped\` can be true from the TV daemons alone. Fails only on invalid input.`,
|
|
167591
167631
|
zodSchema: zodSchema69,
|
|
167592
167632
|
interaction: {
|
|
167593
167633
|
startedMsg: ({ params }) => `Stopping simulator server for ${params.udid}`,
|
|
@@ -167599,16 +167639,16 @@ Returns \`{ stopped, udid }\` (\`stopped: false\` if none was running). Fails on
|
|
|
167599
167639
|
const udid = params.udid;
|
|
167600
167640
|
const platform = resolveDevice(udid).platform;
|
|
167601
167641
|
const namespaces = transportNamespacesForPlatform(platform);
|
|
167602
|
-
const external = isExternalId(udid);
|
|
167603
167642
|
const snapshot = registry2.getSnapshot();
|
|
167604
167643
|
let stopped = false;
|
|
167605
167644
|
const urns = [...snapshot.services.keys()].filter(
|
|
167606
167645
|
(urn) => deviceIdOwningUrn(urn, namespaces, [udid]) !== void 0
|
|
167607
167646
|
);
|
|
167647
|
+
const providerUrns = await providerOwnedUrns(registry2, urns);
|
|
167608
167648
|
for (const urn of urns) {
|
|
167609
167649
|
const entry = snapshot.services.get(urn);
|
|
167610
167650
|
if (!entry || entry.state === "IDLE" /* IDLE */) continue;
|
|
167611
|
-
if (
|
|
167651
|
+
if (providerUrns.has(urn)) {
|
|
167612
167652
|
await registry2.disposeService(urn);
|
|
167613
167653
|
continue;
|
|
167614
167654
|
}
|
|
@@ -167634,7 +167674,7 @@ function createStopAllSimulatorServersTool(registry2) {
|
|
|
167634
167674
|
description: `Stop device-owned background services (simulator-server, devtools, accessibility, TV daemons, Chromium CDP, screen recordings, profilers, network capture/throttle, and JS debugger sessions), freeing their processes and ports.
|
|
167635
167675
|
Use when cleaning up or ending a session, or when a skill asks to recycle services \u2014 not routinely after every task (services are reused). Use \`network-capture-stop\` to stop network capture while keeping recorded requests.
|
|
167636
167676
|
Always pass \`devices\` with this session's device IDs (plus any \`logicalDeviceId\` used with \`debugger-connect\` on shared Metro) so other agents' devices aren't torn down; omit \`devices\` only for a machine-wide sweep. \`[]\` stops nothing.
|
|
167637
|
-
Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`left_running\` names unscoped debugger URNs; re-call with the id after \`<ns>:<port>:\` to reap them). Fails if unknown keys (e.g. \`udids\`) are passed.`,
|
|
167677
|
+
Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`stopped\` leaves out a simulator-server or native devtools agent that Argent did not start, which keeps running; \`left_running\` names unscoped debugger URNs; re-call with the id after \`<ns>:<port>:\` to reap them). Fails if unknown keys (e.g. \`udids\`) are passed.`,
|
|
167638
167678
|
zodSchema: zodSchema70,
|
|
167639
167679
|
interaction: {
|
|
167640
167680
|
// "all" only holds for the unscoped sweep; a scoped call touches just the
|
|
@@ -167675,6 +167715,7 @@ Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`left_running\` n
|
|
|
167675
167715
|
let aborted2 = false;
|
|
167676
167716
|
const paused = await pauseJsCapturesOf(registry2, scoped ? devices2 : void 0);
|
|
167677
167717
|
const snapshot = registry2.getSnapshot();
|
|
167718
|
+
const providerUrns = await providerOwnedUrns(registry2, snapshot.services.keys());
|
|
167678
167719
|
for (const [urn, entry] of snapshot.services) {
|
|
167679
167720
|
if (ctx?.signal?.aborted) {
|
|
167680
167721
|
aborted2 = true;
|
|
@@ -167687,7 +167728,7 @@ Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`left_running\` n
|
|
|
167687
167728
|
if (matches2 && entry.state !== "IDLE" /* IDLE */) {
|
|
167688
167729
|
const wasLive = isLiveServiceState(entry.state);
|
|
167689
167730
|
await registry2.disposeService(urn);
|
|
167690
|
-
if (wasLive && !
|
|
167731
|
+
if (wasLive && !providerUrns.has(urn)) stopped.push(urn);
|
|
167691
167732
|
} else if (scoped && isLiveServiceState(entry.state) && isDeviceServiceUrn(urn, PORT_KEYED_NAMESPACES)) {
|
|
167692
167733
|
survivors.push(urn);
|
|
167693
167734
|
}
|
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.93",
|
|
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": "7b99b3dcad9de16cefd21590123231633a103381"
|
|
102
102
|
}
|