@swmansion/argent 0.18.1-next.2 → 0.18.1-next.21

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.
@@ -5,7 +5,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
9
15
  try {
10
16
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
17
  } catch (e) {
@@ -2984,7 +2990,7 @@ var require_compile = __commonJS({
2984
2990
  const schOrFunc = root.refs[ref];
2985
2991
  if (schOrFunc)
2986
2992
  return schOrFunc;
2987
- let _sch = resolve7.call(this, root, ref);
2993
+ let _sch = resolve8.call(this, root, ref);
2988
2994
  if (_sch === void 0) {
2989
2995
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
2990
2996
  const { schemaId } = this.opts;
@@ -3011,7 +3017,7 @@ var require_compile = __commonJS({
3011
3017
  function sameSchemaEnv(s1, s2) {
3012
3018
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3013
3019
  }
3014
- function resolve7(root, ref) {
3020
+ function resolve8(root, ref) {
3015
3021
  let sch;
3016
3022
  while (typeof (sch = this.refs[ref]) == "string")
3017
3023
  ref = sch;
@@ -3229,8 +3235,8 @@ var require_utils = __commonJS({
3229
3235
  }
3230
3236
  return ind;
3231
3237
  }
3232
- function removeDotSegments(path12) {
3233
- let input = path12;
3238
+ function removeDotSegments(path13) {
3239
+ let input = path13;
3234
3240
  const output = [];
3235
3241
  let nextSlash = -1;
3236
3242
  let len = 0;
@@ -3482,8 +3488,8 @@ var require_schemes = __commonJS({
3482
3488
  wsComponent.secure = void 0;
3483
3489
  }
3484
3490
  if (wsComponent.resourceName) {
3485
- const [path12, query] = wsComponent.resourceName.split("?");
3486
- wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
3491
+ const [path13, query] = wsComponent.resourceName.split("?");
3492
+ wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
3487
3493
  wsComponent.query = query;
3488
3494
  wsComponent.resourceName = void 0;
3489
3495
  }
@@ -3642,7 +3648,7 @@ var require_fast_uri = __commonJS({
3642
3648
  }
3643
3649
  return uri;
3644
3650
  }
3645
- function resolve7(baseURI, relativeURI, options) {
3651
+ function resolve8(baseURI, relativeURI, options) {
3646
3652
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3647
3653
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3648
3654
  schemelessOptions.skipEscape = true;
@@ -3900,7 +3906,7 @@ var require_fast_uri = __commonJS({
3900
3906
  var fastUri = {
3901
3907
  SCHEMES,
3902
3908
  normalize: normalize2,
3903
- resolve: resolve7,
3909
+ resolve: resolve8,
3904
3910
  resolveComponent,
3905
3911
  equal,
3906
3912
  serialize,
@@ -6876,12 +6882,12 @@ var require_dist = __commonJS({
6876
6882
  throw new Error(`Unknown format "${name}"`);
6877
6883
  return f;
6878
6884
  };
6879
- function addFormats(ajv, list, fs9, exportName) {
6885
+ function addFormats(ajv, list, fs10, exportName) {
6880
6886
  var _a3;
6881
6887
  var _b;
6882
6888
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
6883
6889
  for (const f of list)
6884
- ajv.addFormat(f, fs9[f]);
6890
+ ajv.addFormat(f, fs10[f]);
6885
6891
  }
6886
6892
  module.exports = exports = formatsPlugin;
6887
6893
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6889,6 +6895,325 @@ var require_dist = __commonJS({
6889
6895
  }
6890
6896
  });
6891
6897
 
6898
+ // ../../node_modules/dotenv/lib/main.js
6899
+ var require_main = __commonJS({
6900
+ "../../node_modules/dotenv/lib/main.js"(exports, module) {
6901
+ var fs10 = __require("fs");
6902
+ var path13 = __require("path");
6903
+ var os2 = __require("os");
6904
+ var crypto3 = __require("crypto");
6905
+ var TIPS = [
6906
+ "\u25C8 encrypted .env [www.dotenvx.com]",
6907
+ "\u25C8 secrets for agents [www.dotenvx.com]",
6908
+ "\u2301 auth for agents [www.vestauth.com]",
6909
+ "\u2318 custom filepath { path: '/custom/path/.env' }",
6910
+ "\u2318 enable debugging { debug: true }",
6911
+ "\u2318 override existing { override: true }",
6912
+ "\u2318 suppress logs { quiet: true }",
6913
+ "\u2318 multiple files { path: ['.env.local', '.env'] }"
6914
+ ];
6915
+ function _getRandomTip() {
6916
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
6917
+ }
6918
+ function parseBoolean(value) {
6919
+ if (typeof value === "string") {
6920
+ return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
6921
+ }
6922
+ return Boolean(value);
6923
+ }
6924
+ function supportsAnsi() {
6925
+ return process.stdout.isTTY;
6926
+ }
6927
+ function dim(text) {
6928
+ return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
6929
+ }
6930
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
6931
+ function parse3(src) {
6932
+ const obj = {};
6933
+ let lines = src.toString();
6934
+ lines = lines.replace(/\r\n?/mg, "\n");
6935
+ let match;
6936
+ while ((match = LINE.exec(lines)) != null) {
6937
+ const key = match[1];
6938
+ let value = match[2] || "";
6939
+ value = value.trim();
6940
+ const maybeQuote = value[0];
6941
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
6942
+ if (maybeQuote === '"') {
6943
+ value = value.replace(/\\n/g, "\n");
6944
+ value = value.replace(/\\r/g, "\r");
6945
+ }
6946
+ obj[key] = value;
6947
+ }
6948
+ return obj;
6949
+ }
6950
+ function _parseVault(options) {
6951
+ options = options || {};
6952
+ const vaultPath = _vaultPath(options);
6953
+ options.path = vaultPath;
6954
+ const result = DotenvModule.configDotenv(options);
6955
+ if (!result.parsed) {
6956
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
6957
+ err.code = "MISSING_DATA";
6958
+ throw err;
6959
+ }
6960
+ const keys = _dotenvKey(options).split(",");
6961
+ const length = keys.length;
6962
+ let decrypted;
6963
+ for (let i = 0; i < length; i++) {
6964
+ try {
6965
+ const key = keys[i].trim();
6966
+ const attrs = _instructions(result, key);
6967
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
6968
+ break;
6969
+ } catch (error2) {
6970
+ if (i + 1 >= length) {
6971
+ throw error2;
6972
+ }
6973
+ }
6974
+ }
6975
+ return DotenvModule.parse(decrypted);
6976
+ }
6977
+ function _warn(message) {
6978
+ console.error(`\u26A0 ${message}`);
6979
+ }
6980
+ function _debug(message) {
6981
+ console.log(`\u2506 ${message}`);
6982
+ }
6983
+ function _log(message) {
6984
+ console.log(`\u25C7 ${message}`);
6985
+ }
6986
+ function _dotenvKey(options) {
6987
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
6988
+ return options.DOTENV_KEY;
6989
+ }
6990
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
6991
+ return process.env.DOTENV_KEY;
6992
+ }
6993
+ return "";
6994
+ }
6995
+ function _instructions(result, dotenvKey) {
6996
+ let uri;
6997
+ try {
6998
+ uri = new URL(dotenvKey);
6999
+ } catch (error2) {
7000
+ if (error2.code === "ERR_INVALID_URL") {
7001
+ const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
7002
+ err.code = "INVALID_DOTENV_KEY";
7003
+ throw err;
7004
+ }
7005
+ throw error2;
7006
+ }
7007
+ const key = uri.password;
7008
+ if (!key) {
7009
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
7010
+ err.code = "INVALID_DOTENV_KEY";
7011
+ throw err;
7012
+ }
7013
+ const environment = uri.searchParams.get("environment");
7014
+ if (!environment) {
7015
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
7016
+ err.code = "INVALID_DOTENV_KEY";
7017
+ throw err;
7018
+ }
7019
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
7020
+ const ciphertext = result.parsed[environmentKey];
7021
+ if (!ciphertext) {
7022
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
7023
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
7024
+ throw err;
7025
+ }
7026
+ return { ciphertext, key };
7027
+ }
7028
+ function _vaultPath(options) {
7029
+ let possibleVaultPath = null;
7030
+ if (options && options.path && options.path.length > 0) {
7031
+ if (Array.isArray(options.path)) {
7032
+ for (const filepath of options.path) {
7033
+ if (fs10.existsSync(filepath)) {
7034
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
7035
+ }
7036
+ }
7037
+ } else {
7038
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
7039
+ }
7040
+ } else {
7041
+ possibleVaultPath = path13.resolve(process.cwd(), ".env.vault");
7042
+ }
7043
+ if (fs10.existsSync(possibleVaultPath)) {
7044
+ return possibleVaultPath;
7045
+ }
7046
+ return null;
7047
+ }
7048
+ function _resolveHome(envPath) {
7049
+ return envPath[0] === "~" ? path13.join(os2.homedir(), envPath.slice(1)) : envPath;
7050
+ }
7051
+ function _configVault(options) {
7052
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
7053
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
7054
+ if (debug || !quiet) {
7055
+ _log("loading env from encrypted .env.vault");
7056
+ }
7057
+ const parsed = DotenvModule._parseVault(options);
7058
+ let processEnv = process.env;
7059
+ if (options && options.processEnv != null) {
7060
+ processEnv = options.processEnv;
7061
+ }
7062
+ DotenvModule.populate(processEnv, parsed, options);
7063
+ return { parsed };
7064
+ }
7065
+ function configDotenv(options) {
7066
+ const dotenvPath = path13.resolve(process.cwd(), ".env");
7067
+ let encoding = "utf8";
7068
+ let processEnv = process.env;
7069
+ if (options && options.processEnv != null) {
7070
+ processEnv = options.processEnv;
7071
+ }
7072
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
7073
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
7074
+ if (options && options.encoding) {
7075
+ encoding = options.encoding;
7076
+ } else {
7077
+ if (debug) {
7078
+ _debug("no encoding is specified (UTF-8 is used by default)");
7079
+ }
7080
+ }
7081
+ let optionPaths = [dotenvPath];
7082
+ if (options && options.path) {
7083
+ if (!Array.isArray(options.path)) {
7084
+ optionPaths = [_resolveHome(options.path)];
7085
+ } else {
7086
+ optionPaths = [];
7087
+ for (const filepath of options.path) {
7088
+ optionPaths.push(_resolveHome(filepath));
7089
+ }
7090
+ }
7091
+ }
7092
+ let lastError;
7093
+ const parsedAll = {};
7094
+ for (const path14 of optionPaths) {
7095
+ try {
7096
+ const parsed = DotenvModule.parse(fs10.readFileSync(path14, { encoding }));
7097
+ DotenvModule.populate(parsedAll, parsed, options);
7098
+ } catch (e) {
7099
+ if (debug) {
7100
+ _debug(`failed to load ${path14} ${e.message}`);
7101
+ }
7102
+ lastError = e;
7103
+ }
7104
+ }
7105
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
7106
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
7107
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
7108
+ if (debug || !quiet) {
7109
+ const keysCount = Object.keys(populated).length;
7110
+ const shortPaths = [];
7111
+ for (const filePath of optionPaths) {
7112
+ try {
7113
+ const relative2 = path13.relative(process.cwd(), filePath);
7114
+ shortPaths.push(relative2);
7115
+ } catch (e) {
7116
+ if (debug) {
7117
+ _debug(`failed to load ${filePath} ${e.message}`);
7118
+ }
7119
+ lastError = e;
7120
+ }
7121
+ }
7122
+ _log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
7123
+ }
7124
+ if (lastError) {
7125
+ return { parsed: parsedAll, error: lastError };
7126
+ } else {
7127
+ return { parsed: parsedAll };
7128
+ }
7129
+ }
7130
+ function config2(options) {
7131
+ if (_dotenvKey(options).length === 0) {
7132
+ return DotenvModule.configDotenv(options);
7133
+ }
7134
+ const vaultPath = _vaultPath(options);
7135
+ if (!vaultPath) {
7136
+ _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
7137
+ return DotenvModule.configDotenv(options);
7138
+ }
7139
+ return DotenvModule._configVault(options);
7140
+ }
7141
+ function decrypt(encrypted, keyStr) {
7142
+ const key = Buffer.from(keyStr.slice(-64), "hex");
7143
+ let ciphertext = Buffer.from(encrypted, "base64");
7144
+ const nonce = ciphertext.subarray(0, 12);
7145
+ const authTag = ciphertext.subarray(-16);
7146
+ ciphertext = ciphertext.subarray(12, -16);
7147
+ try {
7148
+ const aesgcm = crypto3.createDecipheriv("aes-256-gcm", key, nonce);
7149
+ aesgcm.setAuthTag(authTag);
7150
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
7151
+ } catch (error2) {
7152
+ const isRange = error2 instanceof RangeError;
7153
+ const invalidKeyLength = error2.message === "Invalid key length";
7154
+ const decryptionFailed = error2.message === "Unsupported state or unable to authenticate data";
7155
+ if (isRange || invalidKeyLength) {
7156
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
7157
+ err.code = "INVALID_DOTENV_KEY";
7158
+ throw err;
7159
+ } else if (decryptionFailed) {
7160
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
7161
+ err.code = "DECRYPTION_FAILED";
7162
+ throw err;
7163
+ } else {
7164
+ throw error2;
7165
+ }
7166
+ }
7167
+ }
7168
+ function populate(processEnv, parsed, options = {}) {
7169
+ const debug = Boolean(options && options.debug);
7170
+ const override = Boolean(options && options.override);
7171
+ const populated = {};
7172
+ if (typeof parsed !== "object") {
7173
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
7174
+ err.code = "OBJECT_REQUIRED";
7175
+ throw err;
7176
+ }
7177
+ for (const key of Object.keys(parsed)) {
7178
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
7179
+ if (override === true) {
7180
+ processEnv[key] = parsed[key];
7181
+ populated[key] = parsed[key];
7182
+ }
7183
+ if (debug) {
7184
+ if (override === true) {
7185
+ _debug(`"${key}" is already defined and WAS overwritten`);
7186
+ } else {
7187
+ _debug(`"${key}" is already defined and was NOT overwritten`);
7188
+ }
7189
+ }
7190
+ } else {
7191
+ processEnv[key] = parsed[key];
7192
+ populated[key] = parsed[key];
7193
+ }
7194
+ }
7195
+ return populated;
7196
+ }
7197
+ var DotenvModule = {
7198
+ configDotenv,
7199
+ _configVault,
7200
+ _parseVault,
7201
+ config: config2,
7202
+ decrypt,
7203
+ parse: parse3,
7204
+ populate
7205
+ };
7206
+ module.exports.configDotenv = DotenvModule.configDotenv;
7207
+ module.exports._configVault = DotenvModule._configVault;
7208
+ module.exports._parseVault = DotenvModule._parseVault;
7209
+ module.exports.config = DotenvModule.config;
7210
+ module.exports.decrypt = DotenvModule.decrypt;
7211
+ module.exports.parse = DotenvModule.parse;
7212
+ module.exports.populate = DotenvModule.populate;
7213
+ module.exports = DotenvModule;
7214
+ }
7215
+ });
7216
+
6892
7217
  // ../argent-mcp/src/mcp-server.ts
6893
7218
  import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
6894
7219
  import { dirname as dirname6 } from "node:path";
@@ -7137,10 +7462,10 @@ function mergeDefs(...defs) {
7137
7462
  function cloneDef(schema) {
7138
7463
  return mergeDefs(schema._zod.def);
7139
7464
  }
7140
- function getElementAtPath(obj, path12) {
7141
- if (!path12)
7465
+ function getElementAtPath(obj, path13) {
7466
+ if (!path13)
7142
7467
  return obj;
7143
- return path12.reduce((acc, key) => acc?.[key], obj);
7468
+ return path13.reduce((acc, key) => acc?.[key], obj);
7144
7469
  }
7145
7470
  function promiseAllObject(promisesObj) {
7146
7471
  const keys = Object.keys(promisesObj);
@@ -7549,11 +7874,11 @@ function explicitlyAborted(x, startIndex = 0) {
7549
7874
  }
7550
7875
  return false;
7551
7876
  }
7552
- function prefixIssues(path12, issues) {
7877
+ function prefixIssues(path13, issues) {
7553
7878
  return issues.map((iss) => {
7554
7879
  var _a3;
7555
7880
  (_a3 = iss).path ?? (_a3.path = []);
7556
- iss.path.unshift(path12);
7881
+ iss.path.unshift(path13);
7557
7882
  return iss;
7558
7883
  });
7559
7884
  }
@@ -7700,16 +8025,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
7700
8025
  }
7701
8026
  function formatError(error2, mapper = (issue2) => issue2.message) {
7702
8027
  const fieldErrors = { _errors: [] };
7703
- const processError = (error3, path12 = []) => {
8028
+ const processError = (error3, path13 = []) => {
7704
8029
  for (const issue2 of error3.issues) {
7705
8030
  if (issue2.code === "invalid_union" && issue2.errors.length) {
7706
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
8031
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
7707
8032
  } else if (issue2.code === "invalid_key") {
7708
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
8033
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
7709
8034
  } else if (issue2.code === "invalid_element") {
7710
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
8035
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
7711
8036
  } else {
7712
- const fullpath = [...path12, ...issue2.path];
8037
+ const fullpath = [...path13, ...issue2.path];
7713
8038
  if (fullpath.length === 0) {
7714
8039
  fieldErrors._errors.push(mapper(issue2));
7715
8040
  } else {
@@ -13701,12 +14026,12 @@ var StdioServerTransport = class {
13701
14026
  this.onclose?.();
13702
14027
  }
13703
14028
  send(message) {
13704
- return new Promise((resolve7) => {
14029
+ return new Promise((resolve8) => {
13705
14030
  const json = serializeMessage(message);
13706
14031
  if (this._stdout.write(json)) {
13707
- resolve7();
14032
+ resolve8();
13708
14033
  } else {
13709
- this._stdout.once("drain", resolve7);
14034
+ this._stdout.once("drain", resolve8);
13710
14035
  }
13711
14036
  });
13712
14037
  }
@@ -14304,7 +14629,7 @@ var Protocol = class {
14304
14629
  return;
14305
14630
  }
14306
14631
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
14307
- await new Promise((resolve7) => setTimeout(resolve7, pollInterval));
14632
+ await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
14308
14633
  options?.signal?.throwIfAborted();
14309
14634
  }
14310
14635
  } catch (error2) {
@@ -14321,7 +14646,7 @@ var Protocol = class {
14321
14646
  */
14322
14647
  request(request, resultSchema, options) {
14323
14648
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
14324
- return new Promise((resolve7, reject) => {
14649
+ return new Promise((resolve8, reject) => {
14325
14650
  const earlyReject = (error2) => {
14326
14651
  reject(error2);
14327
14652
  };
@@ -14399,7 +14724,7 @@ var Protocol = class {
14399
14724
  if (!parseResult.success) {
14400
14725
  reject(parseResult.error);
14401
14726
  } else {
14402
- resolve7(parseResult.data);
14727
+ resolve8(parseResult.data);
14403
14728
  }
14404
14729
  } catch (error2) {
14405
14730
  reject(error2);
@@ -14660,12 +14985,12 @@ var Protocol = class {
14660
14985
  }
14661
14986
  } catch {
14662
14987
  }
14663
- return new Promise((resolve7, reject) => {
14988
+ return new Promise((resolve8, reject) => {
14664
14989
  if (signal.aborted) {
14665
14990
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
14666
14991
  return;
14667
14992
  }
14668
- const timeoutId = setTimeout(resolve7, interval);
14993
+ const timeoutId = setTimeout(resolve8, interval);
14669
14994
  signal.addEventListener("abort", () => {
14670
14995
  clearTimeout(timeoutId);
14671
14996
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -15490,7 +15815,7 @@ function generateToken() {
15490
15815
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
15491
15816
  }
15492
15817
  function findFreePort() {
15493
- return new Promise((resolve7, reject) => {
15818
+ return new Promise((resolve8, reject) => {
15494
15819
  const srv = net.createServer();
15495
15820
  srv.listen(0, "127.0.0.1", () => {
15496
15821
  const addr = srv.address();
@@ -15501,7 +15826,7 @@ function findFreePort() {
15501
15826
  const port = addr.port;
15502
15827
  srv.close((err) => {
15503
15828
  if (err) reject(err);
15504
- else resolve7(port);
15829
+ else resolve8(port);
15505
15830
  });
15506
15831
  });
15507
15832
  srv.on("error", reject);
@@ -15599,7 +15924,7 @@ function killSpawnedChild(child, pid) {
15599
15924
  }
15600
15925
  }
15601
15926
  function spawnToolsServer(paths, port, options = {}) {
15602
- return new Promise((resolve7, reject) => {
15927
+ return new Promise((resolve8, reject) => {
15603
15928
  let logFd;
15604
15929
  try {
15605
15930
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -15636,7 +15961,7 @@ function spawnToolsServer(paths, port, options = {}) {
15636
15961
  rl.close();
15637
15962
  child.stdout?.resume();
15638
15963
  child.stdout?.unref?.();
15639
- settle(() => resolve7({ port: actualPort, pid }));
15964
+ settle(() => resolve8({ port: actualPort, pid }));
15640
15965
  }
15641
15966
  });
15642
15967
  child.on("error", (err) => {
@@ -16085,9 +16410,9 @@ async function tarball(sourcePath) {
16085
16410
  return tarPath;
16086
16411
  }
16087
16412
  function sha256File(filePath) {
16088
- return new Promise((resolve7, reject) => {
16413
+ return new Promise((resolve8, reject) => {
16089
16414
  const hash = createHash2("sha256");
16090
- createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve7(hash.digest("hex"))).on("error", reject);
16415
+ createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve8(hash.digest("hex"))).on("error", reject);
16091
16416
  });
16092
16417
  }
16093
16418
  async function uploadTar(tarPath, endpoint) {
@@ -16206,7 +16531,7 @@ async function applyClientFileDirectives(result) {
16206
16531
  import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
16207
16532
  import { constants as fsConstants } from "node:fs";
16208
16533
  import { tmpdir as tmpdir2 } from "node:os";
16209
- import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, resolve as resolve5, sep as sep2 } from "node:path";
16534
+ import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join9, normalize, resolve as resolve6, sep as sep2 } from "node:path";
16210
16535
  import { createHash as createHash3 } from "node:crypto";
16211
16536
 
16212
16537
  // ../configuration-core/src/flags.ts
@@ -16407,6 +16732,11 @@ function updateConfig(mutate, scope = "global", options = {}) {
16407
16732
  }
16408
16733
  }
16409
16734
 
16735
+ // ../configuration-core/src/secrets.ts
16736
+ var import_dotenv = __toESM(require_main(), 1);
16737
+ import * as fs4 from "node:fs";
16738
+ import * as path7 from "node:path";
16739
+
16410
16740
  // ../configuration-core/src/merge.ts
16411
16741
  function mergeRestrictive(local, global2) {
16412
16742
  if (local === void 0) return global2;
@@ -16532,7 +16862,7 @@ function getConfigDefinition(key, registry2 = CONFIG_SCHEMA) {
16532
16862
  }
16533
16863
 
16534
16864
  // ../configuration-core/src/config-access.ts
16535
- import * as path7 from "node:path";
16865
+ import * as path8 from "node:path";
16536
16866
  function readScopeValue(def, scope, options) {
16537
16867
  if (!def.scopes.includes(scope)) return void 0;
16538
16868
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -16587,12 +16917,12 @@ function projectSlug() {
16587
16917
  return `${name}-${hash}`;
16588
16918
  }
16589
16919
  function artifactsRoot() {
16590
- return process.env.ARGENT_ARTIFACTS_DIR ?? join8(tmpdir2(), "argent-artifacts");
16920
+ return process.env.ARGENT_ARTIFACTS_DIR ?? join9(tmpdir2(), "argent-artifacts");
16591
16921
  }
16592
16922
  function artifactDir(deviceId) {
16593
16923
  const parts = [artifactsRoot(), projectSlug(), sessionId()];
16594
16924
  if (deviceId) parts.push(sanitizeSegment(deviceId));
16595
- return join8(...parts);
16925
+ return join9(...parts);
16596
16926
  }
16597
16927
  function durableBaseDir() {
16598
16928
  const projectRoot = findProjectRoot(process.cwd());
@@ -16611,8 +16941,8 @@ function configuredRecordingsDir() {
16611
16941
  const trimmed = value.trim();
16612
16942
  if (trimmed === "") return null;
16613
16943
  const home = dirname5(argentHomeDir());
16614
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep2}`) ? join8(home, trimmed.slice(2)) : trimmed;
16615
- return resolve5(durableBaseDir(), expanded);
16944
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep2}`) ? join9(home, trimmed.slice(2)) : trimmed;
16945
+ return resolve6(durableBaseDir(), expanded);
16616
16946
  }
16617
16947
  var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
16618
16948
  async function readCapped(res, cap) {
@@ -16645,10 +16975,10 @@ async function writeDurableUnique(dir, filename, write) {
16645
16975
  const stem = filename.slice(0, filename.length - ext.length);
16646
16976
  for (let i = 1; i <= 1e3; i++) {
16647
16977
  const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
16648
- const path12 = join8(dir, candidate);
16978
+ const path13 = join9(dir, candidate);
16649
16979
  try {
16650
- await write(path12);
16651
- return path12;
16980
+ await write(path13);
16981
+ return path13;
16652
16982
  } catch (err) {
16653
16983
  if (err?.code === "EEXIST") continue;
16654
16984
  throw err;
@@ -16668,21 +16998,21 @@ function durableSaveTarget(handle) {
16668
16998
  if (configured) {
16669
16999
  return {
16670
17000
  dir: configured,
16671
- path: join8(configured, sanitizeSegment(handle.filename)),
17001
+ path: join9(configured, sanitizeSegment(handle.filename)),
16672
17002
  base: configured,
16673
17003
  rel: ""
16674
17004
  };
16675
17005
  }
16676
17006
  }
16677
17007
  const base = durableBaseDir();
16678
- const dir = join8(base, rel);
16679
- return { dir, path: join8(dir, sanitizeSegment(handle.filename)), base, rel };
17008
+ const dir = join9(base, rel);
17009
+ return { dir, path: join9(dir, sanitizeSegment(handle.filename)), base, rel };
16680
17010
  }
16681
17011
  async function confineToRealBase(dir, base, rel) {
16682
17012
  try {
16683
17013
  const realDir = await realpath(dir);
16684
17014
  const realBase = await realpath(base);
16685
- return realDir === join8(realBase, rel);
17015
+ return realDir === join9(realBase, rel);
16686
17016
  } catch {
16687
17017
  return false;
16688
17018
  }
@@ -16705,7 +17035,7 @@ async function resolveLocalFile(handle) {
16705
17035
  }
16706
17036
  }
16707
17037
  async function downloadAndExtractArchive(handle, data, dir) {
16708
- const tarball2 = join8(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
17038
+ const tarball2 = join9(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
16709
17039
  try {
16710
17040
  await writeFile4(tarball2, data);
16711
17041
  return await safeExtractTarGz(tarball2, dir, handle.filename);
@@ -16795,7 +17125,7 @@ async function materializeArtifacts(result, ctx) {
16795
17125
  return await downloadAndExtractArchive(value, data, dir);
16796
17126
  }
16797
17127
  if (value.size > 0 && data.length !== value.size) return null;
16798
- const downloadedPath = join8(dir, sanitizeSegment(value.filename));
17128
+ const downloadedPath = join9(dir, sanitizeSegment(value.filename));
16799
17129
  await writeFile4(downloadedPath, data);
16800
17130
  if (value.mimeType.startsWith("image/")) {
16801
17131
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
@@ -18064,6 +18394,7 @@ var FAILURE_CODES = {
18064
18394
  CLI_RUN_FLAG_PARSE_FAILED: "CLI_RUN_FLAG_PARSE_FAILED",
18065
18395
  CLI_RUN_ARGS_NOT_OBJECT: "CLI_RUN_ARGS_NOT_OBJECT",
18066
18396
  CLI_RUN_ARGS_JSON_INVALID: "CLI_RUN_ARGS_JSON_INVALID",
18397
+ CLI_RUN_INPUT_VALIDATION_FAILED: "CLI_RUN_INPUT_VALIDATION_FAILED",
18067
18398
  CLI_RUN_TOOL_CALL_FAILED: "CLI_RUN_TOOL_CALL_FAILED",
18068
18399
  CLI_RUN_SAVE_IMAGE_FAILED: "CLI_RUN_SAVE_IMAGE_FAILED",
18069
18400
  TOOL_CAPABILITY_UNSUPPORTED_OPERATION: "TOOL_CAPABILITY_UNSUPPORTED_OPERATION",
@@ -18265,6 +18596,7 @@ var FAILURE_CODES = {
18265
18596
  CHROMIUM_DEVICE_ID_INVALID: "CHROMIUM_DEVICE_ID_INVALID",
18266
18597
  CHROMIUM_PARAM_INVALID: "CHROMIUM_PARAM_INVALID",
18267
18598
  CHROMIUM_INPUT_INVALID: "CHROMIUM_INPUT_INVALID",
18599
+ CHROMIUM_WINDOW_HIDDEN: "CHROMIUM_WINDOW_HIDDEN",
18268
18600
  CHROMIUM_VIEWPORT_READ_FAILED: "CHROMIUM_VIEWPORT_READ_FAILED",
18269
18601
  CHROMIUM_SCREENSHOT_FAILED: "CHROMIUM_SCREENSHOT_FAILED",
18270
18602
  CHROMIUM_STORAGE_EVAL_FAILED: "CHROMIUM_STORAGE_EVAL_FAILED",
@@ -19004,31 +19336,31 @@ var SESSION_ID2 = randomUUID5();
19004
19336
 
19005
19337
  // ../telemetry/src/identity.ts
19006
19338
  import * as crypto2 from "node:crypto";
19007
- import * as fs4 from "node:fs";
19008
- import * as path9 from "node:path";
19339
+ import * as fs5 from "node:fs";
19340
+ import * as path10 from "node:path";
19009
19341
 
19010
19342
  // ../telemetry/src/paths.ts
19011
- import * as path8 from "node:path";
19343
+ import * as path9 from "node:path";
19012
19344
 
19013
19345
  // ../telemetry/src/fingerprint.ts
19014
19346
  import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
19015
19347
 
19016
19348
  // ../native-devtools-ios/src/index.ts
19017
- import * as path10 from "node:path";
19018
- import * as fs5 from "node:fs";
19019
- var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path10.join(__dirname, "..", "dylibs");
19020
- var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path10.join(__dirname, "..", "bin");
19021
- var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path10.join(DYLIB_DIR, "tcp");
19022
- var DYLIB_TVOS_DIR = path10.join(DYLIB_DIR, "tvos");
19349
+ import * as path11 from "node:path";
19350
+ import * as fs6 from "node:fs";
19351
+ var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
19352
+ var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
19353
+ var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
19354
+ var DYLIB_TVOS_DIR = path11.join(DYLIB_DIR, "tvos");
19023
19355
 
19024
19356
  // ../telemetry/src/consent.ts
19025
- import * as fs6 from "node:fs";
19357
+ import * as fs7 from "node:fs";
19026
19358
  var cache = { current: null };
19027
19359
  var sessionOverride = null;
19028
19360
  function readConfigOverride() {
19029
19361
  let stats;
19030
19362
  try {
19031
- stats = fs6.lstatSync(configFilePath());
19363
+ stats = fs7.lstatSync(configFilePath());
19032
19364
  } catch (err) {
19033
19365
  if (err.code === "ENOENT") {
19034
19366
  cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
@@ -19048,7 +19380,7 @@ function readConfigOverride() {
19048
19380
  }
19049
19381
  let parsedEnabled = null;
19050
19382
  try {
19051
- const raw = fs6.readFileSync(configFilePath(), "utf8");
19383
+ const raw = fs7.readFileSync(configFilePath(), "utf8");
19052
19384
  const json = JSON.parse(raw);
19053
19385
  if (json && typeof json === "object") {
19054
19386
  const t = json.telemetry;
@@ -19102,7 +19434,7 @@ function isEnabled(env = process.env) {
19102
19434
  }
19103
19435
 
19104
19436
  // ../telemetry/src/debug.ts
19105
- import * as fs7 from "node:fs";
19437
+ import * as fs8 from "node:fs";
19106
19438
 
19107
19439
  // ../telemetry/src/notice.ts
19108
19440
  var TELEMETRY_OPT_OUT_COMMAND = "argent telemetry disable";
@@ -19291,9 +19623,11 @@ async function flowRunToMcpContent(result, ctx) {
19291
19623
  }
19292
19624
  }
19293
19625
  if (result.ok !== void 0) {
19626
+ const counted = (result.passed ?? 0) + (result.failed ?? 0) + (result.errored ?? 0) + (result.skipped ?? 0);
19627
+ const note = result.ok && counted === 0 ? " (no test steps)" : "";
19294
19628
  blocks.push({
19295
19629
  type: "text",
19296
- text: `${result.ok ? "PASS" : "FAIL"} \u2014 ${result.passed ?? 0} passed, ${result.failed ?? 0} failed, ${result.errored ?? 0} errored, ${result.skipped ?? 0} skipped`
19630
+ text: `${result.ok ? "PASS" : "FAIL"} \u2014 ${result.passed ?? 0} passed, ${result.failed ?? 0} failed, ${result.errored ?? 0} errored, ${result.skipped ?? 0} skipped${note}`
19297
19631
  });
19298
19632
  } else {
19299
19633
  blocks.push({ type: "text", text: `Flow "${result.flow}" complete.` });
@@ -19408,12 +19742,12 @@ function toMcpTool(t) {
19408
19742
  }
19409
19743
 
19410
19744
  // ../argent-mcp/src/installed-version.ts
19411
- import * as fs8 from "node:fs";
19412
- import * as path11 from "node:path";
19745
+ import * as fs9 from "node:fs";
19746
+ import * as path12 from "node:path";
19413
19747
  function getInstalledVersion() {
19414
19748
  try {
19415
- const pkgPath = path11.resolve(import.meta.dirname, "..", "package.json");
19416
- const pkg = JSON.parse(fs8.readFileSync(pkgPath, "utf8"));
19749
+ const pkgPath = path12.resolve(import.meta.dirname, "..", "package.json");
19750
+ const pkg = JSON.parse(fs9.readFileSync(pkgPath, "utf8"));
19417
19751
  return pkg.version ?? "unknown";
19418
19752
  } catch {
19419
19753
  return "unknown";