@swmansion/argent 0.14.1-next.14 → 0.14.1-next.16
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 +13 -8
- package/dist/tool-server.cjs +24 -2
- package/package.json +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -7365,6 +7365,7 @@ function parseJsonOrThrow(raw, label) {
|
|
|
7365
7365
|
}
|
|
7366
7366
|
function parseFlags(argv, schema) {
|
|
7367
7367
|
const properties = schema?.properties ?? {};
|
|
7368
|
+
const argsHatchHint = properties.args === void 0 ? " or --args '<json>'" : "";
|
|
7368
7369
|
const args = {};
|
|
7369
7370
|
const positional = [];
|
|
7370
7371
|
let helpRequested = false;
|
|
@@ -7400,7 +7401,7 @@ function parseFlags(argv, schema) {
|
|
|
7400
7401
|
} else {
|
|
7401
7402
|
flag = tok.slice(2);
|
|
7402
7403
|
}
|
|
7403
|
-
if (flag === "args") {
|
|
7404
|
+
if (flag === "args" && properties.args === void 0) {
|
|
7404
7405
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, "args");
|
|
7405
7406
|
rawArgs = value2;
|
|
7406
7407
|
i2 = nextIndex2;
|
|
@@ -7411,7 +7412,7 @@ function parseFlags(argv, schema) {
|
|
|
7411
7412
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
7412
7413
|
if (seenArrayFields.has(fieldName)) {
|
|
7413
7414
|
throw new FlagParseException(
|
|
7414
|
-
`--${fieldName} and --${flag} cannot be mixed for the same field; pass it entirely as --${flag} '<json>'
|
|
7415
|
+
`--${fieldName} and --${flag} cannot be mixed for the same field; pass it entirely as --${flag} '<json>'${argsHatchHint}`
|
|
7415
7416
|
);
|
|
7416
7417
|
}
|
|
7417
7418
|
args[fieldName] = parseJsonOrThrow(value2, `--${flag}`);
|
|
@@ -7443,13 +7444,13 @@ function parseFlags(argv, schema) {
|
|
|
7443
7444
|
const itemType = propSchema.items?.type;
|
|
7444
7445
|
if (!isScalarType(itemType)) {
|
|
7445
7446
|
throw new FlagParseException(
|
|
7446
|
-
`--${flag} is an array of objects; pass it as --${flag}-json '<json>'
|
|
7447
|
+
`--${flag} is an array of objects; pass it as --${flag}-json '<json>'${argsHatchHint}`
|
|
7447
7448
|
);
|
|
7448
7449
|
}
|
|
7449
7450
|
const { value: value2, nextIndex: nextIndex2 } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
7450
7451
|
if (jsonFields.has(flag)) {
|
|
7451
7452
|
throw new FlagParseException(
|
|
7452
|
-
`--${flag} and --${flag}-json cannot be mixed for the same field; pass it entirely as --${flag}-json '<json>'
|
|
7453
|
+
`--${flag} and --${flag}-json cannot be mixed for the same field; pass it entirely as --${flag}-json '<json>'${argsHatchHint}`
|
|
7453
7454
|
);
|
|
7454
7455
|
}
|
|
7455
7456
|
const coerced = coerceScalar(value2, itemType, flag);
|
|
@@ -7464,7 +7465,7 @@ function parseFlags(argv, schema) {
|
|
|
7464
7465
|
}
|
|
7465
7466
|
if (propSchema?.type === "object") {
|
|
7466
7467
|
throw new FlagParseException(
|
|
7467
|
-
`--${flag} is an object; pass it as --${flag}-json '<json>'
|
|
7468
|
+
`--${flag} is an object; pass it as --${flag}-json '<json>'${argsHatchHint}`
|
|
7468
7469
|
);
|
|
7469
7470
|
}
|
|
7470
7471
|
const { value, nextIndex } = inlineValue !== void 0 ? { value: inlineValue, nextIndex: i2 } : takeNext(i2, flag);
|
|
@@ -7551,15 +7552,19 @@ async function readStdin() {
|
|
|
7551
7552
|
}
|
|
7552
7553
|
function printToolHelp(meta) {
|
|
7553
7554
|
const description = meta.description?.trim() ?? "";
|
|
7555
|
+
const schema = meta.inputSchema;
|
|
7556
|
+
const hasOwnArgsField = schema?.properties?.args !== void 0;
|
|
7554
7557
|
console.log(`argent run ${meta.name} [flags]`);
|
|
7555
7558
|
if (description) console.log(`
|
|
7556
7559
|
${description}
|
|
7557
7560
|
`);
|
|
7558
7561
|
console.log("Flags:");
|
|
7559
|
-
console.log(formatSchemaUsage(
|
|
7562
|
+
console.log(formatSchemaUsage(schema));
|
|
7560
7563
|
console.log("\nGlobal flags:");
|
|
7561
|
-
|
|
7562
|
-
|
|
7564
|
+
if (!hasOwnArgsField) {
|
|
7565
|
+
console.log(" --args <json> Pass the entire payload as JSON (overrides flags)");
|
|
7566
|
+
console.log(" --args - Read the entire payload as JSON from stdin");
|
|
7567
|
+
}
|
|
7563
7568
|
console.log(" --<field>-json <json> Pass a single field as JSON (objects/nested arrays)");
|
|
7564
7569
|
console.log(" --json Print the raw JSON result");
|
|
7565
7570
|
console.log(" --out <path> For image results, save to <path> instead of fetching URL");
|
package/dist/tool-server.cjs
CHANGED
|
@@ -118565,6 +118565,19 @@ var fs20 = __toESM(require("node:fs"));
|
|
|
118565
118565
|
var net5 = __toESM(require("node:net"));
|
|
118566
118566
|
var path18 = __toESM(require("node:path"));
|
|
118567
118567
|
init_src();
|
|
118568
|
+
|
|
118569
|
+
// ../tool-server/src/utils/electron-env.ts
|
|
118570
|
+
function electronGuiChildEnv(overrides = {}) {
|
|
118571
|
+
const env = { ...process.env, ...overrides };
|
|
118572
|
+
for (const key of Object.keys(env)) {
|
|
118573
|
+
if (key.toLowerCase() === "electron_run_as_node") {
|
|
118574
|
+
delete env[key];
|
|
118575
|
+
}
|
|
118576
|
+
}
|
|
118577
|
+
return env;
|
|
118578
|
+
}
|
|
118579
|
+
|
|
118580
|
+
// ../tool-server/src/tools/devices/boot-electron.ts
|
|
118568
118581
|
var DEFAULT_READY_TIMEOUT_MS = 3e4;
|
|
118569
118582
|
async function pickFreePort() {
|
|
118570
118583
|
return new Promise((resolve5, reject) => {
|
|
@@ -118688,7 +118701,12 @@ async function bootElectronApp(options) {
|
|
|
118688
118701
|
child = (0, import_node_child_process15.spawn)(launcher.command, args, {
|
|
118689
118702
|
detached: true,
|
|
118690
118703
|
stdio: ["ignore", "pipe", "pipe"],
|
|
118691
|
-
|
|
118704
|
+
// Strip ELECTRON_RUN_AS_NODE (see electronGuiChildEnv): if the tool-server
|
|
118705
|
+
// inherited it from an Electron-based MCP host, the Electron binary would
|
|
118706
|
+
// run in Node mode with no CDP endpoint — so boot-device fails below (the
|
|
118707
|
+
// child exits early, or the readiness probe times out) instead of the app
|
|
118708
|
+
// coming up.
|
|
118709
|
+
env: electronGuiChildEnv({ ELECTRON_ENABLE_LOGGING: "1" })
|
|
118692
118710
|
});
|
|
118693
118711
|
} catch (err) {
|
|
118694
118712
|
throw new FailureError(
|
|
@@ -142252,7 +142270,11 @@ function createPreviewWindowManager(opts = {}) {
|
|
|
142252
142270
|
const launchBin = wrapperBin ?? electronBin;
|
|
142253
142271
|
const launchArgs = wrapperBin ? ["--no-sandbox", mainScript] : [mainScript];
|
|
142254
142272
|
const next = (0, import_node_child_process27.spawn)(launchBin, launchArgs, {
|
|
142255
|
-
|
|
142273
|
+
// Strip ELECTRON_RUN_AS_NODE so the child boots as a GUI Electron app, not
|
|
142274
|
+
// a bare Node runtime (see electronGuiChildEnv). An Electron-based MCP
|
|
142275
|
+
// host puts it in our env, and inheriting it makes main.cjs crash at
|
|
142276
|
+
// app.setName() with `app` undefined — the window never opens.
|
|
142277
|
+
env: electronGuiChildEnv({ ARGENT_PREVIEW_URL: url2 }),
|
|
142256
142278
|
stdio: ["pipe", "ignore", "pipe"]
|
|
142257
142279
|
});
|
|
142258
142280
|
next.on("error", (err) => {
|