@swmansion/argent 0.15.1-next.10 → 0.15.1-next.12
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/bin/darwin/simulator-server +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/dist/bundled-paths.js +3 -2
- package/dist/bundled-paths.js.map +1 -1
- package/dist/cli-cmds.mjs +34 -4
- package/dist/installer.mjs +3 -0
- package/dist/mcp-server.mjs +14 -1
- package/dist/tool-server.cjs +9 -4
- package/package.json +3 -5
- package/scripts/postinstall.cjs +0 -105
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/bundled-paths.js
CHANGED
|
@@ -3,8 +3,9 @@ import * as path from "node:path";
|
|
|
3
3
|
// Installed package version, read from the shipped package.json. Lets the
|
|
4
4
|
// launcher detect a stale tool-server after an in-place version bump (a local
|
|
5
5
|
// devDependency update rewrites tool-server.cjs at the same path) and respawn
|
|
6
|
-
// it —
|
|
7
|
-
// (--ignore-scripts, pnpm
|
|
6
|
+
// it — with no install-time hook: install scripts are frequently disabled
|
|
7
|
+
// (--ignore-scripts, pnpm's build gate, Yarn PnP, locked-down CI), which is
|
|
8
|
+
// why argent ships no postinstall script at all.
|
|
8
9
|
function readPackageVersion() {
|
|
9
10
|
try {
|
|
10
11
|
const pkg = JSON.parse(fs.readFileSync(path.join(import.meta.dirname, "..", "package.json"), "utf8"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundled-paths.js","sourceRoot":"","sources":["../src/bundled-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E
|
|
1
|
+
{"version":3,"file":"bundled-paths.js","sourceRoot":"","sources":["../src/bundled-paths.ts"],"names":[],"mappings":"AAAA,OAAO,K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,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,iBAAiB,GAAG,eAAe,EAAE,CAAC;AAE5C,2EAA2E;AAC3E,4EAA4E;AAC5E,sDAAsD;AACtD,MAAM,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC;IAC5D,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;IAChD,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IAClD,OAAO,EAAE,kBAAkB,EAAE;IAC7B,WAAW,EAAE,iBAAiB,CAAC,IAAI;IACnC,kBAAkB,EAAE,iBAAiB,CAAC,WAAW;CAClD,CAAC"}
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -451,8 +451,21 @@ async function sweepDeadStateFiles() {
|
|
|
451
451
|
for (const { file } of await readAllToolsServerStates()) {
|
|
452
452
|
if (file === STATE_FILE) continue;
|
|
453
453
|
const fresh = await readStateFile(file);
|
|
454
|
-
if (
|
|
454
|
+
if (!fresh) continue;
|
|
455
|
+
if (!isProcessAlive(fresh.pid)) {
|
|
456
|
+
await unlink(file).catch(() => {
|
|
457
|
+
});
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
if (fs.existsSync(fresh.bundlePath)) continue;
|
|
461
|
+
const guarded = process.platform !== "win32";
|
|
462
|
+
if (guarded && !processCommandMatches(fresh.pid, fresh.bundlePath)) continue;
|
|
463
|
+
await unlink(file).catch(() => {
|
|
455
464
|
});
|
|
465
|
+
void terminatePid(
|
|
466
|
+
fresh.pid,
|
|
467
|
+
guarded ? () => processCommandMatches(fresh.pid, fresh.bundlePath) : void 0
|
|
468
|
+
);
|
|
456
469
|
}
|
|
457
470
|
}
|
|
458
471
|
var readState = readToolsServerState;
|
|
@@ -9392,12 +9405,29 @@ function isSessionAlive(session) {
|
|
|
9392
9405
|
}
|
|
9393
9406
|
|
|
9394
9407
|
// ../argent-cli/src/lens-pty.ts
|
|
9408
|
+
import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
9395
9409
|
import { createRequire } from "node:module";
|
|
9410
|
+
import { dirname as dirname7, join as join14 } from "node:path";
|
|
9396
9411
|
var nodeRequire = createRequire(import.meta.url);
|
|
9412
|
+
function ensureSpawnHelperExecutable(req = nodeRequire) {
|
|
9413
|
+
if (process.platform !== "darwin") return;
|
|
9414
|
+
try {
|
|
9415
|
+
const prebuilds = join14(dirname7(req.resolve("node-pty/package.json")), "prebuilds");
|
|
9416
|
+
for (const entry of readdirSync2(prebuilds)) {
|
|
9417
|
+
try {
|
|
9418
|
+
chmodSync2(join14(prebuilds, entry, "spawn-helper"), 493);
|
|
9419
|
+
} catch {
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
} catch {
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9397
9425
|
function loadNodePty(req = nodeRequire) {
|
|
9398
9426
|
try {
|
|
9399
9427
|
const mod = req("node-pty");
|
|
9400
|
-
|
|
9428
|
+
if (!mod || typeof mod.spawn !== "function") return null;
|
|
9429
|
+
ensureSpawnHelperExecutable(req);
|
|
9430
|
+
return mod;
|
|
9401
9431
|
} catch {
|
|
9402
9432
|
return null;
|
|
9403
9433
|
}
|
|
@@ -11020,8 +11050,8 @@ var n = class extends V {
|
|
|
11020
11050
|
import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
11021
11051
|
import process$1 from "node:process";
|
|
11022
11052
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
11023
|
-
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as
|
|
11024
|
-
import { dirname as
|
|
11053
|
+
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
11054
|
+
import { dirname as dirname8, join as join16 } from "node:path";
|
|
11025
11055
|
function isUnicodeSupported() {
|
|
11026
11056
|
if (process$1.platform !== "win32") {
|
|
11027
11057
|
return process$1.env.TERM !== "linux";
|
package/dist/installer.mjs
CHANGED
|
@@ -23903,6 +23903,9 @@ async function update(args) {
|
|
|
23903
23903
|
const { landed: reachedTarget, exitError: installError } = await runTrustingDisk(
|
|
23904
23904
|
() => {
|
|
23905
23905
|
execShellCommandSync(cmd, {
|
|
23906
|
+
// Older versions still ship a postinstall script that honors this
|
|
23907
|
+
// (current ones have none); keep it so downgrades and pinned
|
|
23908
|
+
// installs of those versions stay quiet and don't double-kill.
|
|
23906
23909
|
env: { ...process.env, ARGENT_SKIP_POSTINSTALL: "1" },
|
|
23907
23910
|
// Local installs must rewrite the project's manifest/lockfile.
|
|
23908
23911
|
...mode === "local" ? { cwd: projectRoot } : {}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -15725,8 +15725,21 @@ async function sweepDeadStateFiles() {
|
|
|
15725
15725
|
for (const { file } of await readAllToolsServerStates()) {
|
|
15726
15726
|
if (file === STATE_FILE) continue;
|
|
15727
15727
|
const fresh = await readStateFile(file);
|
|
15728
|
-
if (
|
|
15728
|
+
if (!fresh) continue;
|
|
15729
|
+
if (!isProcessAlive(fresh.pid)) {
|
|
15730
|
+
await unlink(file).catch(() => {
|
|
15731
|
+
});
|
|
15732
|
+
continue;
|
|
15733
|
+
}
|
|
15734
|
+
if (fs.existsSync(fresh.bundlePath)) continue;
|
|
15735
|
+
const guarded = process.platform !== "win32";
|
|
15736
|
+
if (guarded && !processCommandMatches(fresh.pid, fresh.bundlePath)) continue;
|
|
15737
|
+
await unlink(file).catch(() => {
|
|
15729
15738
|
});
|
|
15739
|
+
void terminatePid(
|
|
15740
|
+
fresh.pid,
|
|
15741
|
+
guarded ? () => processCommandMatches(fresh.pid, fresh.bundlePath) : void 0
|
|
15742
|
+
);
|
|
15730
15743
|
}
|
|
15731
15744
|
}
|
|
15732
15745
|
var readState = readToolsServerState;
|
package/dist/tool-server.cjs
CHANGED
|
@@ -133273,8 +133273,13 @@ async function describeVega(_serial) {
|
|
|
133273
133273
|
|
|
133274
133274
|
// ../tool-server/src/utils/ui-tree-match.ts
|
|
133275
133275
|
init_zod();
|
|
133276
|
+
function hasVisibleText(text) {
|
|
133277
|
+
return text.replace(/[\p{Cf}\p{Co}\p{Cc}]/gu, "").trim().length > 0;
|
|
133278
|
+
}
|
|
133276
133279
|
var selectorFieldsSchema = external_exports.object({
|
|
133277
|
-
text: external_exports.string().min(1).
|
|
133280
|
+
text: external_exports.string().min(1).refine(hasVisibleText, {
|
|
133281
|
+
message: "text must contain at least one visible character (icon-font/private-use and zero-width characters render as nothing) \u2014 select by identifier or role instead"
|
|
133282
|
+
}).optional().describe("Case-insensitive substring of the element's visible label or value."),
|
|
133278
133283
|
identifier: external_exports.string().min(1).optional().describe(
|
|
133279
133284
|
"The element's identifier (accessibilityIdentifier / resource-id / testid), matched case-insensitively as the exact identifier or the unqualified resource-id name ('submit' matches 'com.example.app:id/submit')."
|
|
133280
133285
|
),
|
|
@@ -133462,7 +133467,7 @@ var GENERIC_ROLES = /* @__PURE__ */ new Set([
|
|
|
133462
133467
|
]);
|
|
133463
133468
|
function deriveSelector(node) {
|
|
133464
133469
|
if (node.identifier && node.identifier.trim()) return { identifier: node.identifier };
|
|
133465
|
-
const text = [node.label, node.value].map((t) => t?.trim()).find(
|
|
133470
|
+
const text = [node.label, node.value].map((t) => t?.trim()).find((t) => t && hasVisibleText(t));
|
|
133466
133471
|
if (text) return { text };
|
|
133467
133472
|
if (node.role && !GENERIC_ROLES.has(node.role.toLowerCase())) return { role: node.role };
|
|
133468
133473
|
return null;
|
|
@@ -144664,9 +144669,9 @@ function selectorToYaml(sel) {
|
|
|
144664
144669
|
'Cannot serialize flow selector without losing constraints: both `text` and `textMatches` are set, but flow YAML can represent only one `text` constraint (a literal string or `{ matches: "<regex>" }`). Use either literal or regex text matching.'
|
|
144665
144670
|
);
|
|
144666
144671
|
}
|
|
144667
|
-
if (sel.
|
|
144672
|
+
if (sel.text !== void 0 && (typeof sel.text !== "string" || !hasVisibleText(sel.text))) {
|
|
144668
144673
|
throw new Error(
|
|
144669
|
-
"Cannot serialize
|
|
144674
|
+
"Cannot serialize flow selector: `text` must contain at least one visible character (icon-font/private-use and zero-width characters render as nothing). Select by identifier or role, or use a coordinate tap."
|
|
144670
144675
|
);
|
|
144671
144676
|
}
|
|
144672
144677
|
if (sel.loose && (sel.text === void 0 || sel.textMatches !== void 0 || sel.identifier !== void 0 || sel.role !== void 0)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.15.1-next.
|
|
3
|
+
"version": "0.15.1-next.12",
|
|
4
4
|
"description": "MCP server for iOS Simulator and Android Emulator control",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest",
|
|
23
23
|
"typecheck:tests": "tsc --noEmit -p tsconfig.test.json",
|
|
24
24
|
"observe": "node scripts/observe.cjs",
|
|
25
|
-
"benchmark": "node scripts/benchmark.cjs"
|
|
26
|
-
"postinstall": "node scripts/postinstall.cjs"
|
|
25
|
+
"benchmark": "node scripts/benchmark.cjs"
|
|
27
26
|
},
|
|
28
27
|
"private": false,
|
|
29
28
|
"publishConfig": {
|
|
@@ -37,8 +36,7 @@
|
|
|
37
36
|
"skills/",
|
|
38
37
|
"agents/",
|
|
39
38
|
"rules/",
|
|
40
|
-
"assets/"
|
|
41
|
-
"scripts/postinstall.cjs"
|
|
39
|
+
"assets/"
|
|
42
40
|
],
|
|
43
41
|
"dependencies": {
|
|
44
42
|
"@fails-components/webtransport": "^1.6.3",
|
package/scripts/postinstall.cjs
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
// Runs automatically after `npm install @swmansion/argent`.
|
|
5
|
-
// Set ARGENT_SKIP_POSTINSTALL=1 to suppress the init message (used by `argent update`).
|
|
6
|
-
|
|
7
|
-
const os = require("os");
|
|
8
|
-
const fs = require("fs");
|
|
9
|
-
const path = require("path");
|
|
10
|
-
|
|
11
|
-
// Kill the running tool-server so the freshly-installed binary takes effect on
|
|
12
|
-
// next use — but ONLY when the tracked server belongs to THIS package's bundle.
|
|
13
|
-
// A repo-local devDependency install of argent must not tear down a tool-server
|
|
14
|
-
// spawned by a *different* install (another project's local copy, or the global
|
|
15
|
-
// binary) that an unrelated editor session is actively using.
|
|
16
|
-
//
|
|
17
|
-
// State records are per-install files (tool-server-<hash>.json) plus the legacy
|
|
18
|
-
// single-slot tool-server.json written by older versions — scan them all rather
|
|
19
|
-
// than reproducing the launcher's hash.
|
|
20
|
-
const stateDir = path.join(os.homedir(), ".argent");
|
|
21
|
-
const ownBundlePath = path.resolve(__dirname, "..", "dist", "tool-server.cjs");
|
|
22
|
-
|
|
23
|
-
function sameBundle(recorded) {
|
|
24
|
-
if (!recorded) return false;
|
|
25
|
-
if (path.resolve(recorded) === ownBundlePath) return true;
|
|
26
|
-
// Tolerate symlinked install layouts (npm global prefix, pnpm store) where the
|
|
27
|
-
// recorded path and our __dirname resolve to the same real file.
|
|
28
|
-
try {
|
|
29
|
-
return fs.realpathSync(recorded) === fs.realpathSync(ownBundlePath);
|
|
30
|
-
} catch {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function shouldKill(recorded) {
|
|
36
|
-
if (!recorded) return false;
|
|
37
|
-
if (sameBundle(recorded)) return true;
|
|
38
|
-
// A recorded bundle whose file is GONE can never serve again: pnpm/yarn
|
|
39
|
-
// global layouts keep the package in a version-pinned dir, so an upgrade
|
|
40
|
-
// replaces the dir instead of rewriting it in place and sameBundle never
|
|
41
|
-
// matches. No live install's server can be running from a nonexistent
|
|
42
|
-
// path, so retiring it is safe for every other session.
|
|
43
|
-
try {
|
|
44
|
-
fs.accessSync(recorded);
|
|
45
|
-
return false;
|
|
46
|
-
} catch {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
for (const name of fs.readdirSync(stateDir)) {
|
|
53
|
-
if (!/^tool-server(-[0-9a-f]{12})?\.json$/.test(name)) continue;
|
|
54
|
-
const stateFile = path.join(stateDir, name);
|
|
55
|
-
try {
|
|
56
|
-
const state = JSON.parse(fs.readFileSync(stateFile, "utf8"));
|
|
57
|
-
if (state && state.pid && shouldKill(state.bundlePath)) {
|
|
58
|
-
try {
|
|
59
|
-
process.kill(state.pid, "SIGTERM");
|
|
60
|
-
} catch {
|
|
61
|
-
/* process already gone — nothing to kill */
|
|
62
|
-
}
|
|
63
|
-
fs.unlinkSync(stateFile);
|
|
64
|
-
}
|
|
65
|
-
} catch {
|
|
66
|
-
/* unreadable record — leave it alone */
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} catch {
|
|
70
|
-
/* no state dir — nothing to clean up */
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// node-pty (optional dep, used by `argent lens`'s agent PTY proxy) ships its
|
|
74
|
-
// macOS prebuilt `spawn-helper` WITHOUT the executable bit, so the very first
|
|
75
|
-
// pty.spawn() fails with "posix_spawnp failed". Restore +x on every prebuild's
|
|
76
|
-
// helper. Best-effort and macOS-only: skip silently when node-pty isn't
|
|
77
|
-
// installed (the lens command then falls back to a new terminal window).
|
|
78
|
-
if (process.platform === "darwin") {
|
|
79
|
-
try {
|
|
80
|
-
const ptyDir = path.dirname(require.resolve("node-pty/package.json"));
|
|
81
|
-
const prebuilds = path.join(ptyDir, "prebuilds");
|
|
82
|
-
for (const entry of fs.readdirSync(prebuilds)) {
|
|
83
|
-
const helper = path.join(prebuilds, entry, "spawn-helper");
|
|
84
|
-
try {
|
|
85
|
-
fs.chmodSync(helper, 0o755);
|
|
86
|
-
} catch {
|
|
87
|
-
/* no helper for this arch — ignore */
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
} catch {
|
|
91
|
-
/* node-pty not installed or layout changed — lens falls back gracefully */
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (process.env.ARGENT_SKIP_POSTINSTALL === "1") {
|
|
96
|
-
process.exit(0);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
console.log(`
|
|
100
|
-
@swmansion/argent installed.
|
|
101
|
-
|
|
102
|
-
To set up your workspace (MCP server, skills, rules), run:
|
|
103
|
-
|
|
104
|
-
argent init
|
|
105
|
-
`);
|