@swmansion/argent 0.34.1-next.35 → 0.34.1-next.37
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 +104 -49
- package/dist/tool-server.cjs +131 -12
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36256,7 +36256,7 @@ function isCi(env = process.env) {
|
|
|
36256
36256
|
var SESSION_ID2 = randomUUID5();
|
|
36257
36257
|
function readCliVersion() {
|
|
36258
36258
|
if (true) {
|
|
36259
|
-
return "0.34.1-next.
|
|
36259
|
+
return "0.34.1-next.37";
|
|
36260
36260
|
}
|
|
36261
36261
|
return "0.0.0";
|
|
36262
36262
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
|
|
|
10456
10456
|
case "scalar":
|
|
10457
10457
|
case "single-quoted-scalar":
|
|
10458
10458
|
case "double-quoted-scalar": {
|
|
10459
|
-
const
|
|
10459
|
+
const fs25 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs25, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs25);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs25, sep: [] });
|
|
10467
10467
|
this.onKeyLine = true;
|
|
10468
10468
|
}
|
|
10469
10469
|
return;
|
|
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
|
|
|
10591
10591
|
case "scalar":
|
|
10592
10592
|
case "single-quoted-scalar":
|
|
10593
10593
|
case "double-quoted-scalar": {
|
|
10594
|
-
const
|
|
10594
|
+
const fs25 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs25, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs25);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs25, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -16942,7 +16942,7 @@ function isCi(env = process.env) {
|
|
|
16942
16942
|
var SESSION_ID = randomUUID4();
|
|
16943
16943
|
function readCliVersion() {
|
|
16944
16944
|
if (true) {
|
|
16945
|
-
return "0.34.1-next.
|
|
16945
|
+
return "0.34.1-next.37";
|
|
16946
16946
|
}
|
|
16947
16947
|
return "0.0.0";
|
|
16948
16948
|
}
|
|
@@ -20015,6 +20015,13 @@ function getRemainingGlobalBinaryPath() {
|
|
|
20015
20015
|
function isGloballyInstalled() {
|
|
20016
20016
|
return getRemainingGlobalBinaryPath() !== null;
|
|
20017
20017
|
}
|
|
20018
|
+
function getUnshadowedGlobalBinaryPath() {
|
|
20019
|
+
const first = getPermanentBinaryPaths()[0];
|
|
20020
|
+
return first !== void 0 && !isProjectBinPath(first) ? getRemainingGlobalBinaryPath() : null;
|
|
20021
|
+
}
|
|
20022
|
+
function isGlobalInstallFirstOnPath() {
|
|
20023
|
+
return getUnshadowedGlobalBinaryPath() !== null;
|
|
20024
|
+
}
|
|
20018
20025
|
function getGloballyInstalledPackageRoot() {
|
|
20019
20026
|
const binaryPath = getRemainingGlobalBinaryPath();
|
|
20020
20027
|
return binaryPath ? globalPackageRootOf(binaryPath) : null;
|
|
@@ -20051,6 +20058,26 @@ function packageRootOf(binaryPath) {
|
|
|
20051
20058
|
return null;
|
|
20052
20059
|
}
|
|
20053
20060
|
}
|
|
20061
|
+
function cliPathOf(packageRoot) {
|
|
20062
|
+
const binSub = argentBinSubpath(packageRoot);
|
|
20063
|
+
if (!binSub) return null;
|
|
20064
|
+
const cli = path15.join(packageRoot, binSub);
|
|
20065
|
+
return fs14.existsSync(cli) ? cli : null;
|
|
20066
|
+
}
|
|
20067
|
+
function getGloballyInstalledLaunchPaths() {
|
|
20068
|
+
if (process.platform === "win32") return null;
|
|
20069
|
+
const binaryPath = getUnshadowedGlobalBinaryPath();
|
|
20070
|
+
if (!binaryPath) return null;
|
|
20071
|
+
const packageRoot = packageRootOf(binaryPath);
|
|
20072
|
+
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20073
|
+
if (!cli) return null;
|
|
20074
|
+
try {
|
|
20075
|
+
const node = path15.join(fs14.realpathSync(path15.dirname(binaryPath)), "node");
|
|
20076
|
+
return fs14.existsSync(node) ? { node, cli } : null;
|
|
20077
|
+
} catch {
|
|
20078
|
+
return null;
|
|
20079
|
+
}
|
|
20080
|
+
}
|
|
20054
20081
|
function getGloballyInstalledVersion() {
|
|
20055
20082
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20056
20083
|
if (!pkgRoot) return null;
|
|
@@ -20893,6 +20920,8 @@ function buildMcpEntry(mode = { kind: "global" }) {
|
|
|
20893
20920
|
return { command: "yarn", args: ["argent", "mcp"] };
|
|
20894
20921
|
case "local-npx":
|
|
20895
20922
|
return { command: "npx", args: ["--no-install", "argent", "mcp"] };
|
|
20923
|
+
case "global-pinned":
|
|
20924
|
+
return { command: mode.node, args: [mode.cli, "mcp"] };
|
|
20896
20925
|
default:
|
|
20897
20926
|
return { command: MCP_BINARY_NAME, args: ["mcp"] };
|
|
20898
20927
|
}
|
|
@@ -20906,8 +20935,15 @@ function resolveLocalCommandMode(root) {
|
|
|
20906
20935
|
if (binRelPath) return { kind: "local-node", binRelPath };
|
|
20907
20936
|
return { kind: "local-npx" };
|
|
20908
20937
|
}
|
|
20909
|
-
function
|
|
20910
|
-
|
|
20938
|
+
function resolveGlobalCommandMode() {
|
|
20939
|
+
const launch = getGloballyInstalledLaunchPaths();
|
|
20940
|
+
return launch ? { kind: "global-pinned", ...launch } : { kind: "global" };
|
|
20941
|
+
}
|
|
20942
|
+
function getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode) {
|
|
20943
|
+
if (installMode === "local" && configScope === "local" && localCmdMode) {
|
|
20944
|
+
return getMcpEntry(localCmdMode);
|
|
20945
|
+
}
|
|
20946
|
+
return getMcpEntry(configScope === "global" ? globalCmdMode : { kind: "global" });
|
|
20911
20947
|
}
|
|
20912
20948
|
function hasEnv(entry) {
|
|
20913
20949
|
return entry.env != null && Object.keys(entry.env).length > 0;
|
|
@@ -20952,6 +20988,7 @@ function normalizeServerEntry(raw) {
|
|
|
20952
20988
|
}
|
|
20953
20989
|
function isArgentManagedEntry(entry) {
|
|
20954
20990
|
if (entry === null || hasCustomizingEnv(entry)) return false;
|
|
20991
|
+
if (isPinnedGlobalEntry(entry)) return true;
|
|
20955
20992
|
const { command, args } = entry;
|
|
20956
20993
|
switch (command) {
|
|
20957
20994
|
case MCP_BINARY_NAME:
|
|
@@ -20970,6 +21007,10 @@ function isArgentManagedEntry(entry) {
|
|
|
20970
21007
|
return false;
|
|
20971
21008
|
}
|
|
20972
21009
|
}
|
|
21010
|
+
function isPinnedGlobalEntry(entry) {
|
|
21011
|
+
const [cli, subcommand] = entry.args;
|
|
21012
|
+
return path19.isAbsolute(entry.command) && path19.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path19.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
21013
|
+
}
|
|
20973
21014
|
function writeTomlOrRemove(filePath, data) {
|
|
20974
21015
|
if (Object.keys(data).length === 0) {
|
|
20975
21016
|
fs18.rmSync(filePath, { force: true });
|
|
@@ -22383,11 +22424,7 @@ function resolveCliEntry(mode, projectRoot) {
|
|
|
22383
22424
|
return relative5 ? path21.resolve(projectRoot, relative5) : null;
|
|
22384
22425
|
}
|
|
22385
22426
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22386
|
-
|
|
22387
|
-
const binSub = argentBinSubpath(packageRoot);
|
|
22388
|
-
if (!binSub) return null;
|
|
22389
|
-
const entry = path21.join(packageRoot, binSub);
|
|
22390
|
-
return fs19.existsSync(entry) ? entry : null;
|
|
22427
|
+
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
22391
22428
|
}
|
|
22392
22429
|
function writeCliRecord(input) {
|
|
22393
22430
|
const cli = resolveCliEntry(input.mode, input.projectRoot);
|
|
@@ -23308,7 +23345,8 @@ function writeMcpConfigs(args) {
|
|
|
23308
23345
|
);
|
|
23309
23346
|
}
|
|
23310
23347
|
}
|
|
23311
|
-
const
|
|
23348
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
23349
|
+
const entryFor = (configScope) => getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode);
|
|
23312
23350
|
const stillLocalMode = (root) => readInstallRecord(root)?.mode === "local" || isDeclaredLocally(root);
|
|
23313
23351
|
const keepsCommittedLocalEntry = (adapter, configPath, root) => {
|
|
23314
23352
|
if (installMode !== "global") return false;
|
|
@@ -23438,7 +23476,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23438
23476
|
} catch {
|
|
23439
23477
|
continue;
|
|
23440
23478
|
}
|
|
23441
|
-
if (entry === null) continue;
|
|
23479
|
+
if (entry === null || isPinnedGlobalEntry(entry)) continue;
|
|
23442
23480
|
if (isProvablyDead(entry)) {
|
|
23443
23481
|
pending.push({
|
|
23444
23482
|
adapterName: adapter.name,
|
|
@@ -23470,7 +23508,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23470
23508
|
} catch {
|
|
23471
23509
|
continue;
|
|
23472
23510
|
}
|
|
23473
|
-
if (entry !== null && entry.command !== MCP_BINARY_NAME) {
|
|
23511
|
+
if (entry !== null && entry.command !== MCP_BINARY_NAME && !isPinnedGlobalEntry(entry)) {
|
|
23474
23512
|
warned(
|
|
23475
23513
|
adapter.name,
|
|
23476
23514
|
projectPath,
|
|
@@ -24133,6 +24171,7 @@ function printBanner() {
|
|
|
24133
24171
|
// ../argent-installer/src/update.ts
|
|
24134
24172
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24135
24173
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24174
|
+
import * as fs23 from "node:fs";
|
|
24136
24175
|
import * as path30 from "node:path";
|
|
24137
24176
|
|
|
24138
24177
|
// ../argent-installer/src/install-targets.ts
|
|
@@ -24417,7 +24456,7 @@ import { spawn as spawn5 } from "node:child_process";
|
|
|
24417
24456
|
import { once } from "node:events";
|
|
24418
24457
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24419
24458
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24420
|
-
import { basename as
|
|
24459
|
+
import { basename as basename5, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
|
|
24421
24460
|
import { Writable } from "node:stream";
|
|
24422
24461
|
import { pipeline } from "node:stream/promises";
|
|
24423
24462
|
import zlib2 from "node:zlib";
|
|
@@ -24451,7 +24490,7 @@ import {
|
|
|
24451
24490
|
} from "node:fs/promises";
|
|
24452
24491
|
import { constants as fsConstants } from "node:fs";
|
|
24453
24492
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24454
|
-
import { basename as
|
|
24493
|
+
import { basename as basename8, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve19, sep as sep7 } from "node:path";
|
|
24455
24494
|
import { createHash as createHash5 } from "node:crypto";
|
|
24456
24495
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24457
24496
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24525,6 +24564,9 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24525
24564
|
if (trigger === "mcp_update") return "mcp_update";
|
|
24526
24565
|
return installed ? "standalone_update" : "standalone_install";
|
|
24527
24566
|
}
|
|
24567
|
+
function isLivePinnedEntry(entry) {
|
|
24568
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs23.existsSync(entry.command) && fs23.existsSync(entry.args[0]);
|
|
24569
|
+
}
|
|
24528
24570
|
async function update(args) {
|
|
24529
24571
|
const nonInteractive = args.includes("--yes") || args.includes("-y");
|
|
24530
24572
|
const noTelemetry = args.includes("--no-telemetry");
|
|
@@ -24880,8 +24922,10 @@ async function update(args) {
|
|
|
24880
24922
|
spinner2.start("Refreshing workspace configuration...");
|
|
24881
24923
|
const results = [];
|
|
24882
24924
|
const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
|
|
24925
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
24926
|
+
const globalInstallOnPath = isGlobalInstallFirstOnPath();
|
|
24883
24927
|
const skipEntryRewrite = localCmdMode?.kind === "local-npx";
|
|
24884
|
-
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode);
|
|
24928
|
+
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
|
|
24885
24929
|
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
24886
24930
|
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
24887
24931
|
["local", /* @__PURE__ */ new Set()],
|
|
@@ -24904,9 +24948,20 @@ async function update(args) {
|
|
|
24904
24948
|
);
|
|
24905
24949
|
continue;
|
|
24906
24950
|
}
|
|
24951
|
+
const entry = entryFor(normScope);
|
|
24952
|
+
const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
|
|
24953
|
+
if (replacesLivePin && normScope === "local") continue;
|
|
24954
|
+
if (replacesLivePin && !globalInstallOnPath) {
|
|
24955
|
+
results.push(
|
|
24956
|
+
`${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
|
|
24957
|
+
);
|
|
24958
|
+
continue;
|
|
24959
|
+
}
|
|
24907
24960
|
try {
|
|
24908
|
-
adapter.write(configPath,
|
|
24909
|
-
results.push(
|
|
24961
|
+
adapter.write(configPath, entry);
|
|
24962
|
+
results.push(
|
|
24963
|
+
replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
|
|
24964
|
+
);
|
|
24910
24965
|
} catch {
|
|
24911
24966
|
}
|
|
24912
24967
|
}
|
|
@@ -24999,7 +25054,7 @@ async function update(args) {
|
|
|
24999
25054
|
// ../argent-installer/src/uninstall.ts
|
|
25000
25055
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25001
25056
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25002
|
-
import * as
|
|
25057
|
+
import * as fs24 from "node:fs";
|
|
25003
25058
|
import * as path31 from "node:path";
|
|
25004
25059
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25005
25060
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
@@ -25021,10 +25076,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25021
25076
|
};
|
|
25022
25077
|
function removeDirIfEmpty2(dirPath) {
|
|
25023
25078
|
try {
|
|
25024
|
-
if (!
|
|
25025
|
-
if (!
|
|
25026
|
-
if (
|
|
25027
|
-
|
|
25079
|
+
if (!fs24.existsSync(dirPath)) return false;
|
|
25080
|
+
if (!fs24.statSync(dirPath).isDirectory()) return false;
|
|
25081
|
+
if (fs24.readdirSync(dirPath).length > 0) return false;
|
|
25082
|
+
fs24.rmdirSync(dirPath);
|
|
25028
25083
|
return true;
|
|
25029
25084
|
} catch {
|
|
25030
25085
|
return false;
|
|
@@ -25034,7 +25089,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25034
25089
|
const files = [];
|
|
25035
25090
|
const directories = [];
|
|
25036
25091
|
function walk(currentDir, relativeDir = "") {
|
|
25037
|
-
for (const entry of
|
|
25092
|
+
for (const entry of fs24.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25038
25093
|
const relativePath = relativeDir ? path31.join(relativeDir, entry.name) : entry.name;
|
|
25039
25094
|
const absolutePath = path31.join(currentDir, entry.name);
|
|
25040
25095
|
if (entry.isDirectory()) {
|
|
@@ -25049,7 +25104,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25049
25104
|
return { files, directories };
|
|
25050
25105
|
}
|
|
25051
25106
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25052
|
-
if (!
|
|
25107
|
+
if (!fs24.existsSync(sourceDir) || !fs24.existsSync(targetDir)) {
|
|
25053
25108
|
return { removedPaths: [], removedRoot: false };
|
|
25054
25109
|
}
|
|
25055
25110
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
@@ -25057,7 +25112,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25057
25112
|
for (const relativePath of files) {
|
|
25058
25113
|
const targetPath = path31.join(targetDir, relativePath);
|
|
25059
25114
|
try {
|
|
25060
|
-
const entry =
|
|
25115
|
+
const entry = fs24.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25061
25116
|
if (!entry || entry.isDirectory()) continue;
|
|
25062
25117
|
removePath(targetPath);
|
|
25063
25118
|
removedPaths.push(relativePath);
|
|
@@ -25070,18 +25125,18 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25070
25125
|
for (const relativePath of directories) {
|
|
25071
25126
|
const targetPath = path31.join(targetDir, relativePath);
|
|
25072
25127
|
try {
|
|
25073
|
-
if (!
|
|
25074
|
-
if (!
|
|
25075
|
-
if (
|
|
25076
|
-
|
|
25128
|
+
if (!fs24.existsSync(targetPath)) continue;
|
|
25129
|
+
if (!fs24.statSync(targetPath).isDirectory()) continue;
|
|
25130
|
+
if (fs24.readdirSync(targetPath).length > 0) continue;
|
|
25131
|
+
fs24.rmdirSync(targetPath);
|
|
25077
25132
|
} catch {
|
|
25078
25133
|
}
|
|
25079
25134
|
}
|
|
25080
25135
|
let removedRoot = false;
|
|
25081
25136
|
try {
|
|
25082
|
-
if (
|
|
25083
|
-
if (
|
|
25084
|
-
|
|
25137
|
+
if (fs24.existsSync(targetDir) && fs24.statSync(targetDir).isDirectory()) {
|
|
25138
|
+
if (fs24.readdirSync(targetDir).length === 0) {
|
|
25139
|
+
fs24.rmdirSync(targetDir);
|
|
25085
25140
|
removedRoot = true;
|
|
25086
25141
|
}
|
|
25087
25142
|
}
|
|
@@ -25094,7 +25149,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25094
25149
|
}
|
|
25095
25150
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25096
25151
|
try {
|
|
25097
|
-
const content =
|
|
25152
|
+
const content = fs24.readFileSync(skillFilePath, "utf8");
|
|
25098
25153
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25099
25154
|
if (!frontmatter) return fallbackName;
|
|
25100
25155
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25105,18 +25160,18 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25105
25160
|
}
|
|
25106
25161
|
}
|
|
25107
25162
|
function getBundledSkillNames(skillsDir) {
|
|
25108
|
-
if (!
|
|
25163
|
+
if (!fs24.existsSync(skillsDir)) return [];
|
|
25109
25164
|
const skillNames = [];
|
|
25110
|
-
for (const entry of
|
|
25165
|
+
for (const entry of fs24.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25111
25166
|
if (!entry.isDirectory()) continue;
|
|
25112
25167
|
const skillFilePath = path31.join(skillsDir, entry.name, "SKILL.md");
|
|
25113
|
-
if (!
|
|
25168
|
+
if (!fs24.existsSync(skillFilePath)) continue;
|
|
25114
25169
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25115
25170
|
}
|
|
25116
25171
|
return [...new Set(skillNames)].sort();
|
|
25117
25172
|
}
|
|
25118
25173
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25119
|
-
if (!
|
|
25174
|
+
if (!fs24.existsSync(targetDir)) {
|
|
25120
25175
|
return { removedPaths: [], removedRoot: false };
|
|
25121
25176
|
}
|
|
25122
25177
|
const removedPaths = [];
|
|
@@ -25134,12 +25189,12 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25134
25189
|
return { removedPaths, removedRoot };
|
|
25135
25190
|
}
|
|
25136
25191
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25137
|
-
if (!
|
|
25192
|
+
if (!fs24.existsSync(lockPath)) {
|
|
25138
25193
|
return { removedSkills: [], removedFile: false };
|
|
25139
25194
|
}
|
|
25140
25195
|
let parsed;
|
|
25141
25196
|
try {
|
|
25142
|
-
parsed = JSON.parse(
|
|
25197
|
+
parsed = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
25143
25198
|
} catch {
|
|
25144
25199
|
return { removedSkills: [], removedFile: false };
|
|
25145
25200
|
}
|
|
@@ -25166,10 +25221,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25166
25221
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25167
25222
|
);
|
|
25168
25223
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25169
|
-
|
|
25224
|
+
fs24.rmSync(lockPath, { force: true });
|
|
25170
25225
|
return { removedSkills, removedFile: true };
|
|
25171
25226
|
}
|
|
25172
|
-
|
|
25227
|
+
fs24.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25173
25228
|
return { removedSkills, removedFile: false };
|
|
25174
25229
|
}
|
|
25175
25230
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25491,7 +25546,7 @@ async function uninstall(args) {
|
|
|
25491
25546
|
try {
|
|
25492
25547
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25493
25548
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25494
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
25549
|
+
const removed = !leftover || removable.installDir !== null && !fs24.existsSync(removable.installDir);
|
|
25495
25550
|
if (removed) hasUninstalledPackage = true;
|
|
25496
25551
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25497
25552
|
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|
package/dist/tool-server.cjs
CHANGED
|
@@ -101440,7 +101440,7 @@ function isCi(env = process.env) {
|
|
|
101440
101440
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
101441
101441
|
function readCliVersion() {
|
|
101442
101442
|
if (true) {
|
|
101443
|
-
return "0.34.1-next.
|
|
101443
|
+
return "0.34.1-next.37";
|
|
101444
101444
|
}
|
|
101445
101445
|
return "0.0.0";
|
|
101446
101446
|
}
|
|
@@ -127849,6 +127849,59 @@ function bracketed(hostname4) {
|
|
|
127849
127849
|
return hostname4.includes(":") && !hostname4.startsWith("[") ? `[${hostname4}]` : hostname4;
|
|
127850
127850
|
}
|
|
127851
127851
|
|
|
127852
|
+
// ../tool-server/src/utils/debugger/scripts/await-promise.ts
|
|
127853
|
+
var WATCH_PROMISE_FUNCTION = `function (slot) {
|
|
127854
|
+
var self = this;
|
|
127855
|
+
var then = self.then;
|
|
127856
|
+
if (typeof then !== "function") return self;
|
|
127857
|
+
|
|
127858
|
+
var box = { settled: false, rejected: false, value: undefined };
|
|
127859
|
+
globalThis[slot] = box;
|
|
127860
|
+
|
|
127861
|
+
new Promise(function (resolve, reject) {
|
|
127862
|
+
then.call(self, resolve, reject);
|
|
127863
|
+
}).then(
|
|
127864
|
+
function (value) {
|
|
127865
|
+
box.settled = true;
|
|
127866
|
+
box.value = value;
|
|
127867
|
+
},
|
|
127868
|
+
function (reason) {
|
|
127869
|
+
box.settled = true;
|
|
127870
|
+
box.rejected = true;
|
|
127871
|
+
box.value = reason;
|
|
127872
|
+
}
|
|
127873
|
+
);
|
|
127874
|
+
|
|
127875
|
+
return slot;
|
|
127876
|
+
}`;
|
|
127877
|
+
function takeSettledScript(slot) {
|
|
127878
|
+
return `(function (slot) {
|
|
127879
|
+
var box = globalThis[slot];
|
|
127880
|
+
if (!box) throw ownError("The JS context reloaded while the Promise was pending.");
|
|
127881
|
+
if (!box.settled) return slot;
|
|
127882
|
+
|
|
127883
|
+
delete globalThis[slot];
|
|
127884
|
+
if (!box.rejected) return box.value;
|
|
127885
|
+
if (box.value instanceof Error) throw box.value;
|
|
127886
|
+
throw ownError("Promise rejected with: " + describe(box.value));
|
|
127887
|
+
|
|
127888
|
+
function ownError(message) {
|
|
127889
|
+
var error = new Error(message);
|
|
127890
|
+
error.stack = "";
|
|
127891
|
+
return error;
|
|
127892
|
+
}
|
|
127893
|
+
|
|
127894
|
+
function describe(reason) {
|
|
127895
|
+
try {
|
|
127896
|
+
var json = JSON.stringify(reason);
|
|
127897
|
+
return json === undefined ? String(reason) : json;
|
|
127898
|
+
} catch (e) {
|
|
127899
|
+
return Object.prototype.toString.call(reason);
|
|
127900
|
+
}
|
|
127901
|
+
}
|
|
127902
|
+
})(${JSON.stringify(slot)})`;
|
|
127903
|
+
}
|
|
127904
|
+
|
|
127852
127905
|
// ../tool-server/src/utils/debugger/cdp-client.ts
|
|
127853
127906
|
var BLOCKED_WHILE_PAUSED = /* @__PURE__ */ new Set(["Runtime.evaluate", "Runtime.callFunctionOn"]);
|
|
127854
127907
|
function trimBundleQuery(url2) {
|
|
@@ -127869,7 +127922,16 @@ function formatExceptionDetails(details) {
|
|
|
127869
127922
|
return `${description}
|
|
127870
127923
|
${frameLines}`;
|
|
127871
127924
|
}
|
|
127925
|
+
function runtimeException(details) {
|
|
127926
|
+
return new FailureError(formatExceptionDetails(details), {
|
|
127927
|
+
error_code: FAILURE_CODES.DEBUGGER_CDP_RUNTIME_EXCEPTION,
|
|
127928
|
+
failure_stage: "debugger_cdp_evaluate",
|
|
127929
|
+
failure_area: "tool_server",
|
|
127930
|
+
error_kind: "unknown"
|
|
127931
|
+
});
|
|
127932
|
+
}
|
|
127872
127933
|
var DEFAULT_TIMEOUT_MS2 = 1e4;
|
|
127934
|
+
var PROMISE_POLL_INTERVAL_MS = 100;
|
|
127873
127935
|
var ORIGIN_SETTLE_MS = 100;
|
|
127874
127936
|
var acceptedOrigins = /* @__PURE__ */ new Map();
|
|
127875
127937
|
var CDPClient = class {
|
|
@@ -127891,9 +127953,16 @@ var CDPClient = class {
|
|
|
127891
127953
|
paused;
|
|
127892
127954
|
wsUrl;
|
|
127893
127955
|
sendOrigin;
|
|
127956
|
+
/**
|
|
127957
|
+
* Hermes ignores `awaitPromise`, so {@linkcode evaluateAwaited} waits for a
|
|
127958
|
+
* returned Promise inside the app instead. Set only for Hermes behind the
|
|
127959
|
+
* modern inspector: it relies on `Runtime.callFunctionOn`.
|
|
127960
|
+
*/
|
|
127961
|
+
awaitPromisesInApp;
|
|
127894
127962
|
constructor(wsUrl, options) {
|
|
127895
127963
|
this.wsUrl = wsUrl;
|
|
127896
127964
|
this.sendOrigin = options?.sendOrigin !== false;
|
|
127965
|
+
this.awaitPromisesInApp = options?.awaitPromisesInApp === true;
|
|
127897
127966
|
}
|
|
127898
127967
|
async connect() {
|
|
127899
127968
|
if (!this.sendOrigin) {
|
|
@@ -128162,20 +128231,68 @@ var CDPClient = class {
|
|
|
128162
128231
|
async evaluate(expression, options) {
|
|
128163
128232
|
const returnByValue = options?.returnByValue ?? true;
|
|
128164
128233
|
const awaitPromise = options?.awaitPromise ?? true;
|
|
128165
|
-
const result = await this.
|
|
128234
|
+
const result = await this.runtimeCall(
|
|
128166
128235
|
"Runtime.evaluate",
|
|
128167
128236
|
{ expression, returnByValue, awaitPromise },
|
|
128168
128237
|
options?.timeout
|
|
128169
128238
|
);
|
|
128170
|
-
|
|
128171
|
-
|
|
128172
|
-
|
|
128173
|
-
|
|
128174
|
-
|
|
128175
|
-
|
|
128239
|
+
return result?.value;
|
|
128240
|
+
}
|
|
128241
|
+
/**
|
|
128242
|
+
* {@linkcode evaluate}, also on runtimes that ignore `awaitPromise`: a
|
|
128243
|
+
* returned Promise yields the value it resolves to, and a rejection throws
|
|
128244
|
+
* like an exception. A Promise still pending after {@linkcode DEFAULT_TIMEOUT_MS}
|
|
128245
|
+
* fails with DEBUGGER_CDP_REQUEST_TIMEOUT.
|
|
128246
|
+
*/
|
|
128247
|
+
async evaluateAwaited(expression) {
|
|
128248
|
+
if (!this.awaitPromisesInApp) return this.evaluate(expression);
|
|
128249
|
+
const result = await this.runtimeCall("Runtime.evaluate", { expression, returnByValue: false });
|
|
128250
|
+
const objectId = result?.objectId;
|
|
128251
|
+
if (!objectId || result?.type !== "object" && result?.type !== "function") {
|
|
128252
|
+
return result?.value;
|
|
128253
|
+
}
|
|
128254
|
+
const slot = `__argentPromise_${crypto3.randomUUID().replace(/-/g, "")}`;
|
|
128255
|
+
let watched2;
|
|
128256
|
+
try {
|
|
128257
|
+
const response = await this.runtimeCall("Runtime.callFunctionOn", {
|
|
128258
|
+
objectId,
|
|
128259
|
+
functionDeclaration: WATCH_PROMISE_FUNCTION,
|
|
128260
|
+
arguments: [{ value: slot }],
|
|
128261
|
+
returnByValue: true
|
|
128262
|
+
});
|
|
128263
|
+
watched2 = response?.value;
|
|
128264
|
+
} finally {
|
|
128265
|
+
this.send("Runtime.releaseObject", { objectId }).catch(() => {
|
|
128176
128266
|
});
|
|
128177
128267
|
}
|
|
128178
|
-
return
|
|
128268
|
+
if (watched2 !== slot) return watched2;
|
|
128269
|
+
return this.waitForSettled(slot);
|
|
128270
|
+
}
|
|
128271
|
+
async runtimeCall(method, params, timeout) {
|
|
128272
|
+
const response = await this.send(method, params, timeout);
|
|
128273
|
+
if (response.exceptionDetails) throw runtimeException(response.exceptionDetails);
|
|
128274
|
+
return response.result;
|
|
128275
|
+
}
|
|
128276
|
+
async waitForSettled(slot) {
|
|
128277
|
+
const take2 = takeSettledScript(slot);
|
|
128278
|
+
const deadline = Date.now() + DEFAULT_TIMEOUT_MS2;
|
|
128279
|
+
let taken = await this.evaluate(take2);
|
|
128280
|
+
while (taken === slot && Date.now() < deadline) {
|
|
128281
|
+
await sleep(PROMISE_POLL_INTERVAL_MS);
|
|
128282
|
+
taken = await this.evaluate(take2);
|
|
128283
|
+
}
|
|
128284
|
+
if (taken !== slot) return taken;
|
|
128285
|
+
this.evaluate(`delete globalThis[${JSON.stringify(slot)}]`).catch(() => {
|
|
128286
|
+
});
|
|
128287
|
+
throw new FailureError(
|
|
128288
|
+
`The expression returned a Promise that did not settle within ${DEFAULT_TIMEOUT_MS2}ms. The expression ran, and running it again repeats its side effects.`,
|
|
128289
|
+
{
|
|
128290
|
+
error_code: FAILURE_CODES.DEBUGGER_CDP_REQUEST_TIMEOUT,
|
|
128291
|
+
failure_stage: "debugger_cdp_await_promise",
|
|
128292
|
+
failure_area: "tool_server",
|
|
128293
|
+
error_kind: "timeout"
|
|
128294
|
+
}
|
|
128295
|
+
);
|
|
128179
128296
|
}
|
|
128180
128297
|
/**
|
|
128181
128298
|
* With `legacyInspector`, a protocol error leaves the binding unavailable
|
|
@@ -151780,7 +151897,9 @@ var jsRuntimeDebuggerBlueprint = {
|
|
|
151780
151897
|
});
|
|
151781
151898
|
const onPublishedBundler = publishedMetroPort(deviceId, port) === void 0;
|
|
151782
151899
|
const proxied = onPublishedBundler ? externalJsDebuggerUrl(deviceId) : void 0;
|
|
151783
|
-
const cdp = new CDPClient(proxied ?? selected.webSocketUrl
|
|
151900
|
+
const cdp = new CDPClient(proxied ?? selected.webSocketUrl, {
|
|
151901
|
+
awaitPromisesInApp: !selected.legacyInspector
|
|
151902
|
+
});
|
|
151784
151903
|
await cdp.connect();
|
|
151785
151904
|
const sourceMaps = new SourceMapsRegistry();
|
|
151786
151905
|
cdp.events.on("scriptParsed", (script) => {
|
|
@@ -162249,7 +162368,7 @@ var zodSchema33 = external_exports.object({
|
|
|
162249
162368
|
var debuggerEvaluateTool = {
|
|
162250
162369
|
id: "debugger-evaluate",
|
|
162251
162370
|
description: `Execute arbitrary JavaScript in the app's JS runtime via CDP: Hermes on iOS / Android / Vega, V8 on Chromium.
|
|
162252
|
-
Returns the result serialized by value as JSON, with deviceName, appName, and logicalDeviceId. Use when you need to read app state, including localStorage and sessionStorage on Chromium, call app functions, or test logic at runtime. Cyclic objects, which many RN runtime values are (fiber nodes, navigation refs, global), fail with a serialization error. Fails if the expression throws or the runtime is not connected. On React Native, a module that fails to load while the expression runs (e.g. a lazy react-native export whose native module the app lacks) fails the call with that module's error instead of opening the app's red box.`,
|
|
162371
|
+
Returns the result serialized by value as JSON, with deviceName, appName, and logicalDeviceId. A returned Promise is awaited and its resolved value returned. Use when you need to read app state, including localStorage and sessionStorage on Chromium, call app functions, or test logic at runtime. Cyclic objects, which many RN runtime values are (fiber nodes, navigation refs, global), fail with a serialization error. Fails if the expression throws or the runtime is not connected. On React Native, a module that fails to load while the expression runs (e.g. a lazy react-native export whose native module the app lacks) fails the call with that module's error instead of opening the app's red box.`,
|
|
162253
162372
|
zodSchema: zodSchema33,
|
|
162254
162373
|
searchHint: "javascript js eval expression runtime app state localstorage sessionstorage web storage",
|
|
162255
162374
|
interaction: {
|
|
@@ -162266,7 +162385,7 @@ Returns the result serialized by value as JSON, with deviceName, appName, and lo
|
|
|
162266
162385
|
let result;
|
|
162267
162386
|
try {
|
|
162268
162387
|
const expression = isChromiumDebuggerTarget(params.device_id) ? params.expression : guardModuleLoadErrors(params.expression);
|
|
162269
|
-
result = await api.cdp.
|
|
162388
|
+
result = await api.cdp.evaluateAwaited(expression);
|
|
162270
162389
|
} catch (err) {
|
|
162271
162390
|
if (err instanceof Error && getFailureSignal(err)?.error_code === FAILURE_CODES.DEBUGGER_CDP_RUNTIME_EXCEPTION) {
|
|
162272
162391
|
throw new FailureError(
|
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.37",
|
|
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",
|