@swmansion/argent 0.18.1-next.18 → 0.18.1-next.19

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 CHANGED
@@ -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: (a2, b) => (typeof require !== "undefined" ? require : a2)[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) {
@@ -33,6 +39,325 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
39
  mod
34
40
  ));
35
41
 
42
+ // ../../node_modules/dotenv/lib/main.js
43
+ var require_main = __commonJS({
44
+ "../../node_modules/dotenv/lib/main.js"(exports, module) {
45
+ var fs12 = __require("fs");
46
+ var path17 = __require("path");
47
+ var os3 = __require("os");
48
+ var crypto3 = __require("crypto");
49
+ var TIPS = [
50
+ "\u25C8 encrypted .env [www.dotenvx.com]",
51
+ "\u25C8 secrets for agents [www.dotenvx.com]",
52
+ "\u2301 auth for agents [www.vestauth.com]",
53
+ "\u2318 custom filepath { path: '/custom/path/.env' }",
54
+ "\u2318 enable debugging { debug: true }",
55
+ "\u2318 override existing { override: true }",
56
+ "\u2318 suppress logs { quiet: true }",
57
+ "\u2318 multiple files { path: ['.env.local', '.env'] }"
58
+ ];
59
+ function _getRandomTip() {
60
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
61
+ }
62
+ function parseBoolean(value) {
63
+ if (typeof value === "string") {
64
+ return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
65
+ }
66
+ return Boolean(value);
67
+ }
68
+ function supportsAnsi() {
69
+ return process.stdout.isTTY;
70
+ }
71
+ function dim(text2) {
72
+ return supportsAnsi() ? `\x1B[2m${text2}\x1B[0m` : text2;
73
+ }
74
+ var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
75
+ function parse(src) {
76
+ const obj = {};
77
+ let lines = src.toString();
78
+ lines = lines.replace(/\r\n?/mg, "\n");
79
+ let match;
80
+ while ((match = LINE.exec(lines)) != null) {
81
+ const key = match[1];
82
+ let value = match[2] || "";
83
+ value = value.trim();
84
+ const maybeQuote = value[0];
85
+ value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
86
+ if (maybeQuote === '"') {
87
+ value = value.replace(/\\n/g, "\n");
88
+ value = value.replace(/\\r/g, "\r");
89
+ }
90
+ obj[key] = value;
91
+ }
92
+ return obj;
93
+ }
94
+ function _parseVault(options) {
95
+ options = options || {};
96
+ const vaultPath = _vaultPath(options);
97
+ options.path = vaultPath;
98
+ const result = DotenvModule.configDotenv(options);
99
+ if (!result.parsed) {
100
+ const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
101
+ err.code = "MISSING_DATA";
102
+ throw err;
103
+ }
104
+ const keys = _dotenvKey(options).split(",");
105
+ const length = keys.length;
106
+ let decrypted;
107
+ for (let i2 = 0; i2 < length; i2++) {
108
+ try {
109
+ const key = keys[i2].trim();
110
+ const attrs = _instructions(result, key);
111
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
112
+ break;
113
+ } catch (error) {
114
+ if (i2 + 1 >= length) {
115
+ throw error;
116
+ }
117
+ }
118
+ }
119
+ return DotenvModule.parse(decrypted);
120
+ }
121
+ function _warn(message) {
122
+ console.error(`\u26A0 ${message}`);
123
+ }
124
+ function _debug(message) {
125
+ console.log(`\u2506 ${message}`);
126
+ }
127
+ function _log(message) {
128
+ console.log(`\u25C7 ${message}`);
129
+ }
130
+ function _dotenvKey(options) {
131
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
132
+ return options.DOTENV_KEY;
133
+ }
134
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
135
+ return process.env.DOTENV_KEY;
136
+ }
137
+ return "";
138
+ }
139
+ function _instructions(result, dotenvKey) {
140
+ let uri;
141
+ try {
142
+ uri = new URL(dotenvKey);
143
+ } catch (error) {
144
+ if (error.code === "ERR_INVALID_URL") {
145
+ 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");
146
+ err.code = "INVALID_DOTENV_KEY";
147
+ throw err;
148
+ }
149
+ throw error;
150
+ }
151
+ const key = uri.password;
152
+ if (!key) {
153
+ const err = new Error("INVALID_DOTENV_KEY: Missing key part");
154
+ err.code = "INVALID_DOTENV_KEY";
155
+ throw err;
156
+ }
157
+ const environment = uri.searchParams.get("environment");
158
+ if (!environment) {
159
+ const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
160
+ err.code = "INVALID_DOTENV_KEY";
161
+ throw err;
162
+ }
163
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
164
+ const ciphertext = result.parsed[environmentKey];
165
+ if (!ciphertext) {
166
+ const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
167
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
168
+ throw err;
169
+ }
170
+ return { ciphertext, key };
171
+ }
172
+ function _vaultPath(options) {
173
+ let possibleVaultPath = null;
174
+ if (options && options.path && options.path.length > 0) {
175
+ if (Array.isArray(options.path)) {
176
+ for (const filepath of options.path) {
177
+ if (fs12.existsSync(filepath)) {
178
+ possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
179
+ }
180
+ }
181
+ } else {
182
+ possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
183
+ }
184
+ } else {
185
+ possibleVaultPath = path17.resolve(process.cwd(), ".env.vault");
186
+ }
187
+ if (fs12.existsSync(possibleVaultPath)) {
188
+ return possibleVaultPath;
189
+ }
190
+ return null;
191
+ }
192
+ function _resolveHome(envPath) {
193
+ return envPath[0] === "~" ? path17.join(os3.homedir(), envPath.slice(1)) : envPath;
194
+ }
195
+ function _configVault(options) {
196
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
197
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
198
+ if (debug || !quiet) {
199
+ _log("loading env from encrypted .env.vault");
200
+ }
201
+ const parsed = DotenvModule._parseVault(options);
202
+ let processEnv = process.env;
203
+ if (options && options.processEnv != null) {
204
+ processEnv = options.processEnv;
205
+ }
206
+ DotenvModule.populate(processEnv, parsed, options);
207
+ return { parsed };
208
+ }
209
+ function configDotenv(options) {
210
+ const dotenvPath = path17.resolve(process.cwd(), ".env");
211
+ let encoding = "utf8";
212
+ let processEnv = process.env;
213
+ if (options && options.processEnv != null) {
214
+ processEnv = options.processEnv;
215
+ }
216
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
217
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
218
+ if (options && options.encoding) {
219
+ encoding = options.encoding;
220
+ } else {
221
+ if (debug) {
222
+ _debug("no encoding is specified (UTF-8 is used by default)");
223
+ }
224
+ }
225
+ let optionPaths = [dotenvPath];
226
+ if (options && options.path) {
227
+ if (!Array.isArray(options.path)) {
228
+ optionPaths = [_resolveHome(options.path)];
229
+ } else {
230
+ optionPaths = [];
231
+ for (const filepath of options.path) {
232
+ optionPaths.push(_resolveHome(filepath));
233
+ }
234
+ }
235
+ }
236
+ let lastError;
237
+ const parsedAll = {};
238
+ for (const path18 of optionPaths) {
239
+ try {
240
+ const parsed = DotenvModule.parse(fs12.readFileSync(path18, { encoding }));
241
+ DotenvModule.populate(parsedAll, parsed, options);
242
+ } catch (e) {
243
+ if (debug) {
244
+ _debug(`failed to load ${path18} ${e.message}`);
245
+ }
246
+ lastError = e;
247
+ }
248
+ }
249
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
250
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
251
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
252
+ if (debug || !quiet) {
253
+ const keysCount = Object.keys(populated).length;
254
+ const shortPaths = [];
255
+ for (const filePath of optionPaths) {
256
+ try {
257
+ const relative4 = path17.relative(process.cwd(), filePath);
258
+ shortPaths.push(relative4);
259
+ } catch (e) {
260
+ if (debug) {
261
+ _debug(`failed to load ${filePath} ${e.message}`);
262
+ }
263
+ lastError = e;
264
+ }
265
+ }
266
+ _log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
267
+ }
268
+ if (lastError) {
269
+ return { parsed: parsedAll, error: lastError };
270
+ } else {
271
+ return { parsed: parsedAll };
272
+ }
273
+ }
274
+ function config2(options) {
275
+ if (_dotenvKey(options).length === 0) {
276
+ return DotenvModule.configDotenv(options);
277
+ }
278
+ const vaultPath = _vaultPath(options);
279
+ if (!vaultPath) {
280
+ _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
281
+ return DotenvModule.configDotenv(options);
282
+ }
283
+ return DotenvModule._configVault(options);
284
+ }
285
+ function decrypt(encrypted, keyStr) {
286
+ const key = Buffer.from(keyStr.slice(-64), "hex");
287
+ let ciphertext = Buffer.from(encrypted, "base64");
288
+ const nonce = ciphertext.subarray(0, 12);
289
+ const authTag = ciphertext.subarray(-16);
290
+ ciphertext = ciphertext.subarray(12, -16);
291
+ try {
292
+ const aesgcm = crypto3.createDecipheriv("aes-256-gcm", key, nonce);
293
+ aesgcm.setAuthTag(authTag);
294
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
295
+ } catch (error) {
296
+ const isRange = error instanceof RangeError;
297
+ const invalidKeyLength = error.message === "Invalid key length";
298
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
299
+ if (isRange || invalidKeyLength) {
300
+ const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
301
+ err.code = "INVALID_DOTENV_KEY";
302
+ throw err;
303
+ } else if (decryptionFailed) {
304
+ const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
305
+ err.code = "DECRYPTION_FAILED";
306
+ throw err;
307
+ } else {
308
+ throw error;
309
+ }
310
+ }
311
+ }
312
+ function populate(processEnv, parsed, options = {}) {
313
+ const debug = Boolean(options && options.debug);
314
+ const override = Boolean(options && options.override);
315
+ const populated = {};
316
+ if (typeof parsed !== "object") {
317
+ const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
318
+ err.code = "OBJECT_REQUIRED";
319
+ throw err;
320
+ }
321
+ for (const key of Object.keys(parsed)) {
322
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
323
+ if (override === true) {
324
+ processEnv[key] = parsed[key];
325
+ populated[key] = parsed[key];
326
+ }
327
+ if (debug) {
328
+ if (override === true) {
329
+ _debug(`"${key}" is already defined and WAS overwritten`);
330
+ } else {
331
+ _debug(`"${key}" is already defined and was NOT overwritten`);
332
+ }
333
+ }
334
+ } else {
335
+ processEnv[key] = parsed[key];
336
+ populated[key] = parsed[key];
337
+ }
338
+ }
339
+ return populated;
340
+ }
341
+ var DotenvModule = {
342
+ configDotenv,
343
+ _configVault,
344
+ _parseVault,
345
+ config: config2,
346
+ decrypt,
347
+ parse,
348
+ populate
349
+ };
350
+ module.exports.configDotenv = DotenvModule.configDotenv;
351
+ module.exports._configVault = DotenvModule._configVault;
352
+ module.exports._parseVault = DotenvModule._parseVault;
353
+ module.exports.config = DotenvModule.config;
354
+ module.exports.decrypt = DotenvModule.decrypt;
355
+ module.exports.parse = DotenvModule.parse;
356
+ module.exports.populate = DotenvModule.populate;
357
+ module.exports = DotenvModule;
358
+ }
359
+ });
360
+
36
361
  // ../../node_modules/picocolors/picocolors.js
37
362
  var require_picocolors = __commonJS({
38
363
  "../../node_modules/picocolors/picocolors.js"(exports, module) {
@@ -162,8 +487,8 @@ var require_src = __commonJS({
162
487
  });
163
488
 
164
489
  // ../argent-cli/src/run.ts
165
- import * as fs8 from "node:fs";
166
- import * as path11 from "node:path";
490
+ import * as fs9 from "node:fs";
491
+ import * as path12 from "node:path";
167
492
 
168
493
  // ../argent-tools-client/src/launcher.ts
169
494
  import * as net from "node:net";
@@ -204,7 +529,7 @@ function generateAuthToken() {
204
529
  return generateToken();
205
530
  }
206
531
  function findFreePort() {
207
- return new Promise((resolve9, reject) => {
532
+ return new Promise((resolve10, reject) => {
208
533
  const srv = net.createServer();
209
534
  srv.listen(0, "127.0.0.1", () => {
210
535
  const addr = srv.address();
@@ -215,7 +540,7 @@ function findFreePort() {
215
540
  const port = addr.port;
216
541
  srv.close((err) => {
217
542
  if (err) reject(err);
218
- else resolve9(port);
543
+ else resolve10(port);
219
544
  });
220
545
  });
221
546
  srv.on("error", reject);
@@ -316,7 +641,7 @@ function killSpawnedChild(child, pid) {
316
641
  }
317
642
  }
318
643
  function spawnToolsServer(paths, port, options = {}) {
319
- return new Promise((resolve9, reject) => {
644
+ return new Promise((resolve10, reject) => {
320
645
  let logFd;
321
646
  try {
322
647
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -353,7 +678,7 @@ function spawnToolsServer(paths, port, options = {}) {
353
678
  rl.close();
354
679
  child.stdout?.resume();
355
680
  child.stdout?.unref?.();
356
- settle(() => resolve9({ port: actualPort, pid }));
681
+ settle(() => resolve10({ port: actualPort, pid }));
357
682
  }
358
683
  });
359
684
  child.on("error", (err) => {
@@ -742,8 +1067,8 @@ function parseLinkTarget(input) {
742
1067
  const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
743
1068
  if (!host) throw new Error(`URL "${input}" is missing a host.`);
744
1069
  const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
745
- const path16 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
746
- const url = `${u3.protocol}//${u3.host}${path16}`;
1070
+ const path17 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
1071
+ const url = `${u3.protocol}//${u3.host}${path17}`;
747
1072
  const token = u3.username ? decodeURIComponent(u3.username) : void 0;
748
1073
  return { url, host, port, ...token ? { token } : {} };
749
1074
  }
@@ -879,9 +1204,9 @@ async function tarball(sourcePath) {
879
1204
  return tarPath;
880
1205
  }
881
1206
  function sha256File(filePath) {
882
- return new Promise((resolve9, reject) => {
1207
+ return new Promise((resolve10, reject) => {
883
1208
  const hash = createHash2("sha256");
884
- createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
1209
+ createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
885
1210
  });
886
1211
  }
887
1212
  async function uploadTar(tarPath, endpoint) {
@@ -1103,7 +1428,7 @@ function createToolsClient(options = {}) {
1103
1428
  import { copyFile, mkdir as mkdir4, readFile as readFile4, realpath, rm as rm3, stat as stat2, writeFile as writeFile4 } from "node:fs/promises";
1104
1429
  import { constants as fsConstants } from "node:fs";
1105
1430
  import { tmpdir as tmpdir2 } from "node:os";
1106
- import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join8, normalize, resolve as resolve5, sep as sep2 } from "node:path";
1431
+ import { basename as basename3, dirname as dirname5, extname, isAbsolute as isAbsolute3, join as join9, normalize, resolve as resolve6, sep as sep2 } from "node:path";
1107
1432
  import { createHash as createHash3 } from "node:crypto";
1108
1433
 
1109
1434
  // ../configuration-core/src/flags.ts
@@ -1392,6 +1717,97 @@ function updateConfig(mutate, scope = "global", options = {}) {
1392
1717
  }
1393
1718
  }
1394
1719
 
1720
+ // ../configuration-core/src/secrets.ts
1721
+ var import_dotenv = __toESM(require_main(), 1);
1722
+ import * as fs4 from "node:fs";
1723
+ import * as path7 from "node:path";
1724
+ var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
1725
+ var SECRETS_FILE_NAME = "secrets.env";
1726
+ var SHARED_ENV_FILES = [".env.local", ".env"];
1727
+ var SECRET_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
1728
+ function envSource(env) {
1729
+ const values = /* @__PURE__ */ new Map();
1730
+ for (const [key, value] of Object.entries(env)) {
1731
+ if (value === void 0 || !key.startsWith(SECRET_ENV_PREFIX)) continue;
1732
+ const name = key.slice(SECRET_ENV_PREFIX.length);
1733
+ if (SECRET_NAME_RE.test(name)) values.set(name, value);
1734
+ }
1735
+ return {
1736
+ label: `environment (${SECRET_ENV_PREFIX}*)`,
1737
+ kind: "env",
1738
+ present: true,
1739
+ names: [...values.keys()].sort(),
1740
+ values
1741
+ };
1742
+ }
1743
+ function fileSource(filePath, exposure) {
1744
+ const label = filePath;
1745
+ const absent = {
1746
+ label,
1747
+ kind: "file",
1748
+ present: false,
1749
+ names: [],
1750
+ values: /* @__PURE__ */ new Map()
1751
+ };
1752
+ if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
1753
+ let content;
1754
+ try {
1755
+ content = fs4.readFileSync(filePath, "utf8");
1756
+ } catch {
1757
+ return absent;
1758
+ }
1759
+ const values = /* @__PURE__ */ new Map();
1760
+ let skippedUnprefixed = false;
1761
+ for (const [key, value] of Object.entries((0, import_dotenv.parse)(content))) {
1762
+ const prefixed = key.startsWith(SECRET_ENV_PREFIX);
1763
+ if (exposure === "shared" && !prefixed) {
1764
+ skippedUnprefixed = true;
1765
+ continue;
1766
+ }
1767
+ const name = prefixed ? key.slice(SECRET_ENV_PREFIX.length) : key;
1768
+ if (SECRET_NAME_RE.test(name)) values.set(name, value);
1769
+ }
1770
+ return {
1771
+ label,
1772
+ kind: "file",
1773
+ present: true,
1774
+ names: [...values.keys()].sort(),
1775
+ values,
1776
+ ...values.size === 0 && skippedUnprefixed ? { needsPrefix: true } : {}
1777
+ };
1778
+ }
1779
+ function secretSources(options = {}) {
1780
+ const sources = [envSource(options.env ?? process.env)];
1781
+ const projectRoot = findProjectRoot(options.cwd ?? process.cwd());
1782
+ const filePaths = [];
1783
+ if (projectRoot) {
1784
+ filePaths.push({
1785
+ path: path7.join(projectRoot, ".argent", SECRETS_FILE_NAME),
1786
+ exposure: "dedicated"
1787
+ });
1788
+ for (const name of SHARED_ENV_FILES) {
1789
+ filePaths.push({ path: path7.join(projectRoot, name), exposure: "shared" });
1790
+ }
1791
+ }
1792
+ filePaths.push({
1793
+ path: path7.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
1794
+ exposure: "dedicated"
1795
+ });
1796
+ const seen = /* @__PURE__ */ new Set();
1797
+ for (const entry of filePaths) {
1798
+ const resolved = path7.resolve(entry.path);
1799
+ if (seen.has(resolved)) continue;
1800
+ seen.add(resolved);
1801
+ sources.push(fileSource(resolved, entry.exposure));
1802
+ }
1803
+ return sources;
1804
+ }
1805
+ function secretNames(sources) {
1806
+ const names = /* @__PURE__ */ new Set();
1807
+ for (const source of sources) for (const name of source.names) names.add(name);
1808
+ return [...names].sort();
1809
+ }
1810
+
1395
1811
  // ../configuration-core/src/merge.ts
1396
1812
  function mergeRestrictive(local, global2) {
1397
1813
  if (local === void 0) return global2;
@@ -1529,7 +1945,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
1529
1945
  }
1530
1946
 
1531
1947
  // ../configuration-core/src/config-access.ts
1532
- import * as path7 from "node:path";
1948
+ import * as path8 from "node:path";
1533
1949
  function readScopeValue(def, scope, options) {
1534
1950
  if (!def.scopes.includes(scope)) return void 0;
1535
1951
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -1680,12 +2096,12 @@ function projectSlug() {
1680
2096
  return `${name}-${hash}`;
1681
2097
  }
1682
2098
  function artifactsRoot() {
1683
- return process.env.ARGENT_ARTIFACTS_DIR ?? join8(tmpdir2(), "argent-artifacts");
2099
+ return process.env.ARGENT_ARTIFACTS_DIR ?? join9(tmpdir2(), "argent-artifacts");
1684
2100
  }
1685
2101
  function artifactDir(deviceId) {
1686
2102
  const parts = [artifactsRoot(), projectSlug(), sessionId()];
1687
2103
  if (deviceId) parts.push(sanitizeSegment(deviceId));
1688
- return join8(...parts);
2104
+ return join9(...parts);
1689
2105
  }
1690
2106
  function durableBaseDir() {
1691
2107
  const projectRoot = findProjectRoot(process.cwd());
@@ -1704,8 +2120,8 @@ function configuredRecordingsDir() {
1704
2120
  const trimmed = value.trim();
1705
2121
  if (trimmed === "") return null;
1706
2122
  const home = dirname5(argentHomeDir());
1707
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep2}`) ? join8(home, trimmed.slice(2)) : trimmed;
1708
- return resolve5(durableBaseDir(), expanded);
2123
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep2}`) ? join9(home, trimmed.slice(2)) : trimmed;
2124
+ return resolve6(durableBaseDir(), expanded);
1709
2125
  }
1710
2126
  var MAX_DURABLE_BYTES = 2 * 1024 * 1024 * 1024;
1711
2127
  async function readCapped(res, cap) {
@@ -1738,10 +2154,10 @@ async function writeDurableUnique(dir, filename, write) {
1738
2154
  const stem = filename.slice(0, filename.length - ext.length);
1739
2155
  for (let i2 = 1; i2 <= 1e3; i2++) {
1740
2156
  const candidate = i2 === 1 ? filename : `${stem} (${i2})${ext}`;
1741
- const path16 = join8(dir, candidate);
2157
+ const path17 = join9(dir, candidate);
1742
2158
  try {
1743
- await write(path16);
1744
- return path16;
2159
+ await write(path17);
2160
+ return path17;
1745
2161
  } catch (err) {
1746
2162
  if (err?.code === "EEXIST") continue;
1747
2163
  throw err;
@@ -1761,21 +2177,21 @@ function durableSaveTarget(handle) {
1761
2177
  if (configured) {
1762
2178
  return {
1763
2179
  dir: configured,
1764
- path: join8(configured, sanitizeSegment(handle.filename)),
2180
+ path: join9(configured, sanitizeSegment(handle.filename)),
1765
2181
  base: configured,
1766
2182
  rel: ""
1767
2183
  };
1768
2184
  }
1769
2185
  }
1770
2186
  const base = durableBaseDir();
1771
- const dir = join8(base, rel);
1772
- return { dir, path: join8(dir, sanitizeSegment(handle.filename)), base, rel };
2187
+ const dir = join9(base, rel);
2188
+ return { dir, path: join9(dir, sanitizeSegment(handle.filename)), base, rel };
1773
2189
  }
1774
2190
  async function confineToRealBase(dir, base, rel) {
1775
2191
  try {
1776
2192
  const realDir = await realpath(dir);
1777
2193
  const realBase = await realpath(base);
1778
- return realDir === join8(realBase, rel);
2194
+ return realDir === join9(realBase, rel);
1779
2195
  } catch {
1780
2196
  return false;
1781
2197
  }
@@ -1798,7 +2214,7 @@ async function resolveLocalFile(handle) {
1798
2214
  }
1799
2215
  }
1800
2216
  async function downloadAndExtractArchive(handle, data, dir) {
1801
- const tarball2 = join8(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
2217
+ const tarball2 = join9(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
1802
2218
  try {
1803
2219
  await writeFile4(tarball2, data);
1804
2220
  return await safeExtractTarGz(tarball2, dir, handle.filename);
@@ -1888,7 +2304,7 @@ async function materializeArtifacts(result, ctx) {
1888
2304
  return await downloadAndExtractArchive(value, data, dir);
1889
2305
  }
1890
2306
  if (value.size > 0 && data.length !== value.size) return null;
1891
- const downloadedPath = join8(dir, sanitizeSegment(value.filename));
2307
+ const downloadedPath = join9(dir, sanitizeSegment(value.filename));
1892
2308
  await writeFile4(downloadedPath, data);
1893
2309
  if (value.mimeType.startsWith("image/")) {
1894
2310
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
@@ -1948,8 +2364,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname6(proce
1948
2364
  return decodedFile;
1949
2365
  };
1950
2366
  }
1951
- function normalizeWindowsPath(path16) {
1952
- return path16.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
2367
+ function normalizeWindowsPath(path17) {
2368
+ return path17.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
1953
2369
  }
1954
2370
 
1955
2371
  // ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
@@ -4501,15 +4917,15 @@ async function addSourceContext(frames) {
4501
4917
  LRU_FILE_CONTENTS_CACHE.reduce();
4502
4918
  return frames;
4503
4919
  }
4504
- function getContextLinesFromFile(path16, ranges, output) {
4505
- return new Promise((resolve9) => {
4506
- const stream = createReadStream2(path16);
4920
+ function getContextLinesFromFile(path17, ranges, output) {
4921
+ return new Promise((resolve10) => {
4922
+ const stream = createReadStream2(path17);
4507
4923
  const lineReaded = createInterface2({
4508
4924
  input: stream
4509
4925
  });
4510
4926
  function destroyStreamAndResolve() {
4511
4927
  stream.destroy();
4512
- resolve9();
4928
+ resolve10();
4513
4929
  }
4514
4930
  let lineNumber = 0;
4515
4931
  let currentRangeIndex = 0;
@@ -4518,7 +4934,7 @@ function getContextLinesFromFile(path16, ranges, output) {
4518
4934
  let rangeStart = range[0];
4519
4935
  let rangeEnd = range[1];
4520
4936
  function onStreamError() {
4521
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path16, 1);
4937
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(path17, 1);
4522
4938
  lineReaded.close();
4523
4939
  lineReaded.removeAllListeners();
4524
4940
  destroyStreamAndResolve();
@@ -4579,8 +4995,8 @@ function clearLineContext(frame) {
4579
4995
  delete frame.context_line;
4580
4996
  delete frame.post_context;
4581
4997
  }
4582
- function shouldSkipContextLinesForFile(path16) {
4583
- return path16.startsWith("node:") || path16.endsWith(".min.js") || path16.endsWith(".min.cjs") || path16.endsWith(".min.mjs") || path16.startsWith("data:");
4998
+ function shouldSkipContextLinesForFile(path17) {
4999
+ return path17.startsWith("node:") || path17.endsWith(".min.js") || path17.endsWith(".min.cjs") || path17.endsWith(".min.mjs") || path17.startsWith("data:");
4584
5000
  }
4585
5001
  function shouldSkipContextLinesForFrame(frame) {
4586
5002
  if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
@@ -5806,9 +6222,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5806
6222
  if (!waitUntil) return;
5807
6223
  if (this.disabled || this.optedOut) return;
5808
6224
  if (!this._waitUntilCycle) {
5809
- let resolve9;
6225
+ let resolve10;
5810
6226
  const promise = new Promise((r2) => {
5811
- resolve9 = r2;
6227
+ resolve10 = r2;
5812
6228
  });
5813
6229
  try {
5814
6230
  waitUntil(promise);
@@ -5816,7 +6232,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5816
6232
  return;
5817
6233
  }
5818
6234
  this._waitUntilCycle = {
5819
- resolve: resolve9,
6235
+ resolve: resolve10,
5820
6236
  startedAt: Date.now(),
5821
6237
  timer: void 0
5822
6238
  };
@@ -5840,12 +6256,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5840
6256
  return cycle?.resolve;
5841
6257
  }
5842
6258
  async resolveWaitUntilFlush() {
5843
- const resolve9 = this._consumeWaitUntilCycle();
6259
+ const resolve10 = this._consumeWaitUntilCycle();
5844
6260
  try {
5845
6261
  await super.flush();
5846
6262
  } catch {
5847
6263
  } finally {
5848
- resolve9?.();
6264
+ resolve10?.();
5849
6265
  }
5850
6266
  }
5851
6267
  getPersistedProperty(key) {
@@ -5966,15 +6382,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
5966
6382
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
5967
6383
  if (this.isLocalEvaluationReady()) return true;
5968
6384
  if (void 0 === this.featureFlagsPoller) return false;
5969
- return new Promise((resolve9) => {
6385
+ return new Promise((resolve10) => {
5970
6386
  const timeout = setTimeout(() => {
5971
6387
  cleanup();
5972
- resolve9(false);
6388
+ resolve10(false);
5973
6389
  }, timeoutMs);
5974
6390
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
5975
6391
  clearTimeout(timeout);
5976
6392
  cleanup();
5977
- resolve9(count > 0);
6393
+ resolve10(count > 0);
5978
6394
  });
5979
6395
  });
5980
6396
  }
@@ -6429,14 +6845,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
6429
6845
  this.context?.enter(data, options);
6430
6846
  }
6431
6847
  async _shutdown(shutdownTimeoutMs) {
6432
- const resolve9 = this._consumeWaitUntilCycle();
6848
+ const resolve10 = this._consumeWaitUntilCycle();
6433
6849
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
6434
6850
  this.errorTracking.shutdown();
6435
6851
  try {
6436
6852
  return await super._shutdown(shutdownTimeoutMs);
6437
6853
  } finally {
6438
6854
  this.distinctIdHasSentFlagCalls = {};
6439
- resolve9?.();
6855
+ resolve10?.();
6440
6856
  }
6441
6857
  }
6442
6858
  async _requestRemoteConfigPayload(flagKey) {
@@ -7423,9 +7839,9 @@ function isReplitAgent(env) {
7423
7839
  }
7424
7840
  var DEVIN_MARKER_PATH = "/opt/.devin";
7425
7841
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
7426
- function safeExists(fileExists, path16) {
7842
+ function safeExists(fileExists, path17) {
7427
7843
  try {
7428
- return fileExists(path16);
7844
+ return fileExists(path17);
7429
7845
  } catch {
7430
7846
  return false;
7431
7847
  }
@@ -7880,16 +8296,16 @@ function getBaseProps(runtime) {
7880
8296
 
7881
8297
  // ../telemetry/src/identity.ts
7882
8298
  import * as crypto2 from "node:crypto";
7883
- import * as fs4 from "node:fs";
7884
- import * as path9 from "node:path";
8299
+ import * as fs5 from "node:fs";
8300
+ import * as path10 from "node:path";
7885
8301
 
7886
8302
  // ../telemetry/src/paths.ts
7887
- import * as path8 from "node:path";
8303
+ import * as path9 from "node:path";
7888
8304
  function identityFilePath() {
7889
- return path8.join(argentHomeDir(), "telemetry-id");
8305
+ return path9.join(argentHomeDir(), "telemetry-id");
7890
8306
  }
7891
8307
  function debugLogPath() {
7892
- return path8.join(argentHomeDir(), "telemetry-debug.log");
8308
+ return path9.join(argentHomeDir(), "telemetry-debug.log");
7893
8309
  }
7894
8310
 
7895
8311
  // ../telemetry/src/identity.ts
@@ -7988,66 +8404,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
7988
8404
  function isCorruptIdFile(filePath) {
7989
8405
  let isRegularFile;
7990
8406
  try {
7991
- isRegularFile = fs4.lstatSync(filePath).isFile();
8407
+ isRegularFile = fs5.lstatSync(filePath).isFile();
7992
8408
  } catch {
7993
8409
  return false;
7994
8410
  }
7995
8411
  return isRegularFile && tryReadId(filePath) === null;
7996
8412
  }
7997
8413
  function writeIdFileAtomic(finalPath, id) {
7998
- fs4.mkdirSync(argentHomeDir(), { recursive: true });
8414
+ fs5.mkdirSync(argentHomeDir(), { recursive: true });
7999
8415
  let occupant;
8000
8416
  try {
8001
- occupant = fs4.lstatSync(finalPath);
8417
+ occupant = fs5.lstatSync(finalPath);
8002
8418
  } catch (err) {
8003
8419
  if (err.code !== "ENOENT") throw err;
8004
8420
  }
8005
8421
  if (occupant && !occupant.isFile()) {
8006
8422
  throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
8007
8423
  }
8008
- const tmpPath = path9.join(
8424
+ const tmpPath = path10.join(
8009
8425
  argentHomeDir(),
8010
8426
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
8011
8427
  );
8012
- const fd = fs4.openSync(tmpPath, "wx", 384);
8428
+ const fd = fs5.openSync(tmpPath, "wx", 384);
8013
8429
  try {
8014
8430
  try {
8015
- fs4.writeSync(fd, id);
8016
- fs4.fsyncSync(fd);
8431
+ fs5.writeSync(fd, id);
8432
+ fs5.fsyncSync(fd);
8017
8433
  } finally {
8018
- fs4.closeSync(fd);
8434
+ fs5.closeSync(fd);
8019
8435
  }
8020
- fs4.renameSync(tmpPath, finalPath);
8436
+ fs5.renameSync(tmpPath, finalPath);
8021
8437
  } finally {
8022
8438
  try {
8023
- fs4.unlinkSync(tmpPath);
8439
+ fs5.unlinkSync(tmpPath);
8024
8440
  } catch {
8025
8441
  }
8026
8442
  }
8027
8443
  }
8028
8444
  function mintRandomId(finalPath) {
8029
- fs4.mkdirSync(argentHomeDir(), { recursive: true });
8445
+ fs5.mkdirSync(argentHomeDir(), { recursive: true });
8030
8446
  let value = crypto2.randomUUID();
8031
8447
  for (let attempt = 0; attempt < 3; attempt++) {
8032
- const tmpPath = path9.join(
8448
+ const tmpPath = path10.join(
8033
8449
  argentHomeDir(),
8034
8450
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
8035
8451
  );
8036
8452
  let fd;
8037
8453
  try {
8038
- fd = fs4.openSync(tmpPath, "wx", 384);
8454
+ fd = fs5.openSync(tmpPath, "wx", 384);
8039
8455
  } catch (err) {
8040
8456
  if (err.code === "EEXIST") continue;
8041
8457
  throw err;
8042
8458
  }
8043
8459
  try {
8044
8460
  try {
8045
- fs4.writeSync(fd, value);
8046
- fs4.fsyncSync(fd);
8461
+ fs5.writeSync(fd, value);
8462
+ fs5.fsyncSync(fd);
8047
8463
  } finally {
8048
- fs4.closeSync(fd);
8464
+ fs5.closeSync(fd);
8049
8465
  }
8050
- fs4.linkSync(tmpPath, finalPath);
8466
+ fs5.linkSync(tmpPath, finalPath);
8051
8467
  cached = { path: finalPath, id: value };
8052
8468
  return value;
8053
8469
  } catch (err) {
@@ -8066,7 +8482,7 @@ function mintRandomId(finalPath) {
8066
8482
  throw err;
8067
8483
  } finally {
8068
8484
  try {
8069
- fs4.unlinkSync(tmpPath);
8485
+ fs5.unlinkSync(tmpPath);
8070
8486
  } catch {
8071
8487
  }
8072
8488
  }
@@ -8074,12 +8490,12 @@ function mintRandomId(finalPath) {
8074
8490
  throw new Error("telemetry: failed to create identity after retries");
8075
8491
  }
8076
8492
  function claimCorruptOccupant(finalPath) {
8077
- const claimed = path9.join(
8493
+ const claimed = path10.join(
8078
8494
  argentHomeDir(),
8079
8495
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
8080
8496
  );
8081
8497
  try {
8082
- fs4.renameSync(finalPath, claimed);
8498
+ fs5.renameSync(finalPath, claimed);
8083
8499
  } catch {
8084
8500
  return null;
8085
8501
  }
@@ -8088,7 +8504,7 @@ function claimCorruptOccupant(finalPath) {
8088
8504
  grabbed = tryReadId(claimed);
8089
8505
  } finally {
8090
8506
  try {
8091
- fs4.unlinkSync(claimed);
8507
+ fs5.unlinkSync(claimed);
8092
8508
  } catch {
8093
8509
  }
8094
8510
  }
@@ -8100,9 +8516,9 @@ function peekAnonId() {
8100
8516
  function tryReadId(filePath) {
8101
8517
  let raw;
8102
8518
  try {
8103
- const stats = fs4.lstatSync(filePath);
8519
+ const stats = fs5.lstatSync(filePath);
8104
8520
  if (!stats.isFile()) return null;
8105
- raw = fs4.readFileSync(filePath, "utf8");
8521
+ raw = fs5.readFileSync(filePath, "utf8");
8106
8522
  } catch (err) {
8107
8523
  if (err.code === "ENOENT") return null;
8108
8524
  return null;
@@ -8116,12 +8532,12 @@ function tryReadId(filePath) {
8116
8532
  import { execFileSync as execFileSync2, spawn as spawn2 } from "node:child_process";
8117
8533
 
8118
8534
  // ../native-devtools-ios/src/index.ts
8119
- import * as path10 from "node:path";
8120
- import * as fs5 from "node:fs";
8121
- var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path10.join(__dirname, "..", "dylibs");
8122
- var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path10.join(__dirname, "..", "bin");
8123
- var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path10.join(DYLIB_DIR, "tcp");
8124
- var DYLIB_TVOS_DIR = path10.join(DYLIB_DIR, "tvos");
8535
+ import * as path11 from "node:path";
8536
+ import * as fs6 from "node:fs";
8537
+ var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
8538
+ var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
8539
+ var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
8540
+ var DYLIB_TVOS_DIR = path11.join(DYLIB_DIR, "tvos");
8125
8541
  function hostPlatformKey() {
8126
8542
  if (process.platform === "linux" && process.arch === "arm64") {
8127
8543
  return "linux-arm64";
@@ -8132,14 +8548,14 @@ function simulatorServerBinaryName() {
8132
8548
  return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
8133
8549
  }
8134
8550
  function platformBinDir() {
8135
- return path10.join(BIN_DIR, hostPlatformKey());
8551
+ return path11.join(BIN_DIR, hostPlatformKey());
8136
8552
  }
8137
8553
  function simulatorServerBinaryPath() {
8138
8554
  const binaryName = simulatorServerBinaryName();
8139
- const p = path10.join(platformBinDir(), binaryName);
8140
- if (!fs5.existsSync(p)) {
8141
- const flat = path10.join(BIN_DIR, binaryName);
8142
- const migrationHint = fs5.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
8555
+ const p = path11.join(platformBinDir(), binaryName);
8556
+ if (!fs6.existsSync(p)) {
8557
+ const flat = path11.join(BIN_DIR, binaryName);
8558
+ const migrationHint = fs6.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
8143
8559
  throw new Error(
8144
8560
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
8145
8561
  );
@@ -8172,12 +8588,12 @@ function resolveHostFingerprint() {
8172
8588
  }
8173
8589
  }
8174
8590
  function resolveHostFingerprintAsync() {
8175
- return new Promise((resolve9) => {
8591
+ return new Promise((resolve10) => {
8176
8592
  let binary;
8177
8593
  try {
8178
8594
  binary = simulatorServerBinaryPath();
8179
8595
  } catch {
8180
- resolve9(null);
8596
+ resolve10(null);
8181
8597
  return;
8182
8598
  }
8183
8599
  let settled = false;
@@ -8190,7 +8606,7 @@ function resolveHostFingerprintAsync() {
8190
8606
  child?.kill("SIGKILL");
8191
8607
  } catch {
8192
8608
  }
8193
- resolve9(value);
8609
+ resolve10(value);
8194
8610
  };
8195
8611
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
8196
8612
  watchdog.unref?.();
@@ -8223,13 +8639,13 @@ function resolveHostFingerprintAsync() {
8223
8639
  }
8224
8640
 
8225
8641
  // ../telemetry/src/consent.ts
8226
- import * as fs6 from "node:fs";
8642
+ import * as fs7 from "node:fs";
8227
8643
  var cache = { current: null };
8228
8644
  var sessionOverride = null;
8229
8645
  function readConfigOverride() {
8230
8646
  let stats;
8231
8647
  try {
8232
- stats = fs6.lstatSync(configFilePath());
8648
+ stats = fs7.lstatSync(configFilePath());
8233
8649
  } catch (err) {
8234
8650
  if (err.code === "ENOENT") {
8235
8651
  cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
@@ -8249,7 +8665,7 @@ function readConfigOverride() {
8249
8665
  }
8250
8666
  let parsedEnabled = null;
8251
8667
  try {
8252
- const raw = fs6.readFileSync(configFilePath(), "utf8");
8668
+ const raw = fs7.readFileSync(configFilePath(), "utf8");
8253
8669
  const json = JSON.parse(raw);
8254
8670
  if (json && typeof json === "object") {
8255
8671
  const t2 = json.telemetry;
@@ -8310,7 +8726,7 @@ function writeConsentFlag(enabled) {
8310
8726
  }
8311
8727
 
8312
8728
  // ../telemetry/src/debug.ts
8313
- import * as fs7 from "node:fs";
8729
+ import * as fs8 from "node:fs";
8314
8730
  function isDebugEnabled(env = process.env) {
8315
8731
  const v = env.ARGENT_TELEMETRY_DEBUG;
8316
8732
  if (!v) return false;
@@ -8337,8 +8753,8 @@ function emitDebugPayload(payload) {
8337
8753
  } catch {
8338
8754
  }
8339
8755
  try {
8340
- fs7.mkdirSync(argentHomeDir(), { recursive: true });
8341
- fs7.appendFileSync(debugLogPath(), line + "\n");
8756
+ fs8.mkdirSync(argentHomeDir(), { recursive: true });
8757
+ fs8.appendFileSync(debugLogPath(), line + "\n");
8342
8758
  } catch {
8343
8759
  }
8344
8760
  }
@@ -8432,7 +8848,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
8432
8848
  try {
8433
8849
  await Promise.race([
8434
8850
  client2.shutdown(timeoutMs),
8435
- new Promise((resolve9) => setTimeout(resolve9, timeoutMs + 250).unref())
8851
+ new Promise((resolve10) => setTimeout(resolve10, timeoutMs + 250).unref())
8436
8852
  ]);
8437
8853
  } catch (err) {
8438
8854
  emitDebugError("shutdown failed", err);
@@ -8452,7 +8868,7 @@ async function markDisabled() {
8452
8868
  try {
8453
8869
  await Promise.race([
8454
8870
  client2.shutdown(SHORT_FLUSH_TIMEOUT_MS),
8455
- new Promise((resolve9) => setTimeout(resolve9, SHORT_FLUSH_TIMEOUT_MS).unref())
8871
+ new Promise((resolve10) => setTimeout(resolve10, SHORT_FLUSH_TIMEOUT_MS).unref())
8456
8872
  ]);
8457
8873
  } catch {
8458
8874
  }
@@ -8810,13 +9226,13 @@ function splitOptions(argv) {
8810
9226
  return { json, outPath, argvForFlags: rest };
8811
9227
  }
8812
9228
  async function readStdin() {
8813
- return new Promise((resolve9, reject) => {
9229
+ return new Promise((resolve10, reject) => {
8814
9230
  let data = "";
8815
9231
  process.stdin.setEncoding("utf8");
8816
9232
  process.stdin.on("data", (chunk) => {
8817
9233
  data += chunk;
8818
9234
  });
8819
- process.stdin.on("end", () => resolve9(data));
9235
+ process.stdin.on("end", () => resolve10(data));
8820
9236
  process.stdin.on("error", reject);
8821
9237
  });
8822
9238
  }
@@ -8848,8 +9264,8 @@ async function fetchImageToFile(result, outPath) {
8848
9264
  const res = await fetch(url);
8849
9265
  if (!res.ok) throw new Error(`Failed to download image: ${res.status} ${res.statusText}`);
8850
9266
  const buf = Buffer.from(await res.arrayBuffer());
8851
- fs8.mkdirSync(path11.dirname(path11.resolve(outPath)), { recursive: true });
8852
- fs8.writeFileSync(outPath, buf);
9267
+ fs9.mkdirSync(path12.dirname(path12.resolve(outPath)), { recursive: true });
9268
+ fs9.writeFileSync(outPath, buf);
8853
9269
  }
8854
9270
  function renderResult(result, outputHint, images, json) {
8855
9271
  if (json) return JSON.stringify(result, null, 2);
@@ -9047,8 +9463,8 @@ Examples:
9047
9463
  if (outPath && meta.outputHint === "image") {
9048
9464
  try {
9049
9465
  if (images.length > 0) {
9050
- fs8.mkdirSync(path11.dirname(path11.resolve(outPath)), { recursive: true });
9051
- fs8.writeFileSync(outPath, images[0].data);
9466
+ fs9.mkdirSync(path12.dirname(path12.resolve(outPath)), { recursive: true });
9467
+ fs9.writeFileSync(outPath, images[0].data);
9052
9468
  } else if (result && typeof result === "object") {
9053
9469
  await fetchImageToFile(result, outPath);
9054
9470
  }
@@ -9072,7 +9488,7 @@ Examples:
9072
9488
 
9073
9489
  // ../argent-cli/src/flow.ts
9074
9490
  import * as fsp from "node:fs/promises";
9075
- import * as path12 from "node:path";
9491
+ import * as path13 from "node:path";
9076
9492
  var STATUS_GLYPH = {
9077
9493
  pass: "\u2713",
9078
9494
  fail: "\u2717",
@@ -9212,12 +9628,12 @@ async function exportFailureArtifacts(report, outputDir, ctx) {
9212
9628
  if (!key || !SAFE_ARTIFACT_NAME.test(key)) continue;
9213
9629
  const { result } = await materializeArtifacts(s.artifacts, ctx);
9214
9630
  s.artifacts = result;
9215
- const dir = path12.join(outputDir, report.flow);
9631
+ const dir = path13.join(outputDir, report.flow);
9216
9632
  for (const [role, value] of Object.entries(s.artifacts)) {
9217
9633
  if (typeof value !== "string") continue;
9218
- const dest = path12.join(dir, `${key}-${role}.png`);
9219
- const rel = path12.relative(outputDir, dest);
9220
- if (rel.startsWith("..") || path12.isAbsolute(rel)) continue;
9634
+ const dest = path13.join(dir, `${key}-${role}.png`);
9635
+ const rel = path13.relative(outputDir, dest);
9636
+ if (rel.startsWith("..") || path13.isAbsolute(rel)) continue;
9221
9637
  try {
9222
9638
  await fsp.mkdir(dir, { recursive: true });
9223
9639
  await fsp.copyFile(value, dest);
@@ -9233,7 +9649,7 @@ async function exportFailureArtifacts(report, outputDir, ctx) {
9233
9649
  function keyFromBaselinePath(artifacts) {
9234
9650
  const baseline = artifacts.baseline;
9235
9651
  if (typeof baseline !== "string") return null;
9236
- return path12.basename(baseline).replace(/\.png$/, "");
9652
+ return path13.basename(baseline).replace(/\.png$/, "");
9237
9653
  }
9238
9654
  function resolveArtifactDisplayPaths(report) {
9239
9655
  for (const s of report.steps) {
@@ -9245,7 +9661,7 @@ function resolveArtifactDisplayPaths(report) {
9245
9661
  }
9246
9662
  function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
9247
9663
  return Promise.all(
9248
- streams.map((s) => new Promise((resolve9) => s.write("", () => resolve9())))
9664
+ streams.map((s) => new Promise((resolve10) => s.write("", () => resolve10())))
9249
9665
  ).then(() => process.exit(code));
9250
9666
  }
9251
9667
  function renderReport(report) {
@@ -9282,7 +9698,7 @@ async function flow(argv, options) {
9282
9698
  }
9283
9699
  const { callTool, baseUrl } = createToolsClient({ paths: options.paths });
9284
9700
  if (sub === "list") {
9285
- const dir = path12.join(process.cwd(), ".argent", "flows");
9701
+ const dir = path13.join(process.cwd(), ".argent", "flows");
9286
9702
  try {
9287
9703
  const entries = await fsp.readdir(dir);
9288
9704
  const names = entries.filter((f) => f.endsWith(".yaml")).map((f) => f.replace(/\.yaml$/, ""));
@@ -9361,7 +9777,7 @@ async function flow(argv, options) {
9361
9777
  }
9362
9778
  if (args.output) {
9363
9779
  const { url, token } = await baseUrl();
9364
- await exportFailureArtifacts(report, path12.resolve(args.output), {
9780
+ await exportFailureArtifacts(report, path13.resolve(args.output), {
9365
9781
  toolsUrl: url,
9366
9782
  authToken: token
9367
9783
  });
@@ -9427,7 +9843,7 @@ ${sorted.length} tools. Run \`argent tools describe <name>\` for details.`);
9427
9843
  if (meta.outputHint) console.log(`
9428
9844
  Output hint: ${meta.outputHint}`);
9429
9845
  }
9430
- function printUsage3() {
9846
+ function printUsage4() {
9431
9847
  console.log(`Usage:
9432
9848
  argent tools List available tools
9433
9849
  argent tools describe <name> Show one tool's flags and description
@@ -9444,7 +9860,7 @@ Listing tools contacts the argent tool-server, starting one if none is running.
9444
9860
  const positional = argv.filter((a2) => !a2.startsWith("--") || isHelpFlag(a2));
9445
9861
  const sub = positional[0];
9446
9862
  if (sub !== void 0 && isHelpFlag(sub)) {
9447
- printUsage3();
9863
+ printUsage4();
9448
9864
  return;
9449
9865
  }
9450
9866
  if (!sub) {
@@ -9465,12 +9881,12 @@ Listing tools contacts the argent tool-server, starting one if none is running.
9465
9881
  }
9466
9882
 
9467
9883
  // ../argent-cli/src/server.ts
9468
- import * as fs9 from "node:fs";
9469
- import * as path13 from "node:path";
9884
+ import * as fs10 from "node:fs";
9885
+ import * as path14 from "node:path";
9470
9886
  import { homedir as homedir5, networkInterfaces } from "node:os";
9471
9887
  import { spawn as spawn3 } from "node:child_process";
9472
- var STATE_DIR2 = path13.join(homedir5(), ".argent");
9473
- var LOG_FILE2 = path13.join(STATE_DIR2, "tool-server.log");
9888
+ var STATE_DIR2 = path14.join(homedir5(), ".argent");
9889
+ var LOG_FILE2 = path14.join(STATE_DIR2, "tool-server.log");
9474
9890
  async function describeForeignServers(ownBundlePath) {
9475
9891
  const others = (await readAllToolsServerStates()).filter(
9476
9892
  ({ state: state2 }) => state2.bundlePath !== ownBundlePath && isToolsServerProcessAlive(state2.pid)
@@ -9529,12 +9945,12 @@ Stop one with: kill <pid>`);
9529
9945
  console.log(`tool-server stopped (pid ${state2.pid}).`);
9530
9946
  }
9531
9947
  function logsCmd(follow) {
9532
- if (!fs9.existsSync(LOG_FILE2)) {
9948
+ if (!fs10.existsSync(LOG_FILE2)) {
9533
9949
  console.log(`No log file at ${LOG_FILE2}`);
9534
9950
  return;
9535
9951
  }
9536
9952
  if (!follow) {
9537
- process.stdout.write(fs9.readFileSync(LOG_FILE2, "utf8"));
9953
+ process.stdout.write(fs10.readFileSync(LOG_FILE2, "utf8"));
9538
9954
  return;
9539
9955
  }
9540
9956
  const child = spawn3("tail", ["-f", LOG_FILE2], { stdio: "inherit" });
@@ -9877,9 +10293,9 @@ async function server(argv, options) {
9877
10293
  }
9878
10294
 
9879
10295
  // ../argent-cli/src/lens.ts
9880
- import * as fs10 from "node:fs";
10296
+ import * as fs11 from "node:fs";
9881
10297
  import * as os2 from "node:os";
9882
- import * as path14 from "node:path";
10298
+ import * as path15 from "node:path";
9883
10299
 
9884
10300
  // ../argent-cli/src/lens-terminal.ts
9885
10301
  import { execFileSync as execFileSync3 } from "node:child_process";
@@ -10097,15 +10513,15 @@ function isSessionAlive(session) {
10097
10513
  // ../argent-cli/src/lens-pty.ts
10098
10514
  import { chmodSync as chmodSync2, readdirSync as readdirSync2 } from "node:fs";
10099
10515
  import { createRequire } from "node:module";
10100
- import { dirname as dirname8, join as join14 } from "node:path";
10516
+ import { dirname as dirname8, join as join15 } from "node:path";
10101
10517
  var nodeRequire = createRequire(import.meta.url);
10102
10518
  function ensureSpawnHelperExecutable(req = nodeRequire) {
10103
10519
  if (process.platform !== "darwin") return;
10104
10520
  try {
10105
- const prebuilds = join14(dirname8(req.resolve("node-pty/package.json")), "prebuilds");
10521
+ const prebuilds = join15(dirname8(req.resolve("node-pty/package.json")), "prebuilds");
10106
10522
  for (const entry of readdirSync2(prebuilds)) {
10107
10523
  try {
10108
- chmodSync2(join14(prebuilds, entry, "spawn-helper"), 493);
10524
+ chmodSync2(join15(prebuilds, entry, "spawn-helper"), 493);
10109
10525
  } catch {
10110
10526
  }
10111
10527
  }
@@ -10137,7 +10553,7 @@ function ptyInjectBeats(text2) {
10137
10553
  ];
10138
10554
  }
10139
10555
  function sleep(ms) {
10140
- return new Promise((resolve9) => setTimeout(resolve9, ms));
10556
+ return new Promise((resolve10) => setTimeout(resolve10, ms));
10141
10557
  }
10142
10558
  var DEFAULT_COLS = 80;
10143
10559
  var DEFAULT_ROWS = 24;
@@ -10358,7 +10774,7 @@ var SPAWN_GRACE_MS = 8e3;
10358
10774
  var DEATH_CONFIRMATIONS = 3;
10359
10775
  var SSE_RECONNECT_MS = 1e3;
10360
10776
  function sleep2(ms) {
10361
- return new Promise((resolve9) => setTimeout(resolve9, ms));
10777
+ return new Promise((resolve10) => setTimeout(resolve10, ms));
10362
10778
  }
10363
10779
  var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
10364
10780
  async function dismissTrustPrompt(session) {
@@ -10638,12 +11054,12 @@ async function lens(argv, options) {
10638
11054
  await endSession(baseUrl);
10639
11055
  process.exit(1);
10640
11056
  }
10641
- const seedFile = path14.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
10642
- fs10.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
11057
+ const seedFile = path15.join(os2.tmpdir(), `argent-lens-seed-${process.pid}-${Date.now()}.txt`);
11058
+ fs11.writeFileSync(seedFile, buildSeedPrompt(), "utf8");
10643
11059
  const launchCmd = agent.launch(shellQuote(process.cwd()), shellQuote(seedFile));
10644
11060
  const removeSeedFile = () => {
10645
11061
  try {
10646
- fs10.rmSync(seedFile, { force: true });
11062
+ fs11.rmSync(seedFile, { force: true });
10647
11063
  } catch {
10648
11064
  }
10649
11065
  };
@@ -11033,7 +11449,7 @@ Options:
11033
11449
 
11034
11450
  // ../argent-cli/src/config.ts
11035
11451
  var import_picocolors2 = __toESM(require_picocolors(), 1);
11036
- import * as path15 from "node:path";
11452
+ import * as path16 from "node:path";
11037
11453
  function config(argv) {
11038
11454
  if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
11039
11455
  printUsage();
@@ -11217,16 +11633,16 @@ function wantsHelp(argv) {
11217
11633
  }
11218
11634
  function scopeLabel(scope) {
11219
11635
  if (scope === "global") return "global";
11220
- return `project: ${path15.dirname(configDir("project"))}`;
11636
+ return `project: ${path16.dirname(configDir("project"))}`;
11221
11637
  }
11222
11638
  function degenerateProjectScopeWarning(scope) {
11223
11639
  if (scope !== "project") return null;
11224
11640
  const projDir = configDir("project");
11225
- if (path15.resolve(projDir) === path15.resolve(configDir("global"))) {
11226
- return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path15.join(projDir, "config.json")}).`;
11641
+ if (path16.resolve(projDir) === path16.resolve(configDir("global"))) {
11642
+ return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path16.join(projDir, "config.json")}).`;
11227
11643
  }
11228
11644
  if (findProjectRoot(process.cwd()) === null) {
11229
- return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path15.join(projDir, "config.json")}.`;
11645
+ return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path16.join(projDir, "config.json")}.`;
11230
11646
  }
11231
11647
  return null;
11232
11648
  }
@@ -11302,6 +11718,99 @@ ${keyLines.join("\n")}
11302
11718
  Run \`argent config <command> --help\` for command-specific help.`);
11303
11719
  }
11304
11720
 
11721
+ // ../argent-cli/src/secrets.ts
11722
+ var import_picocolors3 = __toESM(require_picocolors(), 1);
11723
+ async function secrets(argv) {
11724
+ const [sub, ...rest] = argv;
11725
+ if (sub === void 0 || sub === "list") return cmdList2(rest);
11726
+ if (sub === "--help" || sub === "-h") return printUsage2();
11727
+ if (sub === "--json") return cmdList2([sub, ...rest]);
11728
+ console.error(`Error: unknown subcommand "secrets ${sub}". Try \`argent secrets --help\`.`);
11729
+ process.exit(2);
11730
+ }
11731
+ function printUsage2() {
11732
+ console.log(`Usage: argent secrets [list] [--json]
11733
+
11734
+ List the secrets a \`{{secret:<NAME>}}\` placeholder can resolve, and the sources
11735
+ they come from. Names only \u2014 a value is never printed.
11736
+
11737
+ A name is resolved by the machine running the tool-server, taking the first
11738
+ source that defines it:
11739
+
11740
+ 1. ${SECRET_ENV_PREFIX}<NAME> in the environment prefixed variables only
11741
+ 2. <project>/.argent/secrets.env every key (gitignore this file)
11742
+ 3. <project>/.env.local, then <project>/.env only ${SECRET_ENV_PREFIX}-prefixed keys
11743
+ 4. ~/.argent/secrets.env every key, any project
11744
+
11745
+ A secrets file applies to the next tool call \u2014 no restart. An environment
11746
+ variable only reaches a tool-server started after it was exported.
11747
+
11748
+ Examples:
11749
+ echo 'APP_PASSWORD=\u2026' >> ~/.argent/secrets.env # available in every project
11750
+ argent secrets # check it is picked up`);
11751
+ }
11752
+ async function cmdList2(argv) {
11753
+ if (argv.includes("--help") || argv.includes("-h")) return printUsage2();
11754
+ const json = argv.includes("--json");
11755
+ const sources = secretSources();
11756
+ const all = secretNames(sources);
11757
+ if (json) {
11758
+ console.log(
11759
+ JSON.stringify(
11760
+ {
11761
+ secrets: all,
11762
+ sources: sources.map((s) => ({
11763
+ source: s.label,
11764
+ present: s.present,
11765
+ names: s.names,
11766
+ ...s.needsPrefix ? { needsPrefix: true } : {}
11767
+ }))
11768
+ },
11769
+ null,
11770
+ 2
11771
+ )
11772
+ );
11773
+ return;
11774
+ }
11775
+ console.log(`Secrets available to \`{{secret:<NAME>}}\` on this machine:
11776
+ `);
11777
+ const claimed = /* @__PURE__ */ new Set();
11778
+ for (const source of sources) {
11779
+ console.log(` ${source.label}`);
11780
+ if (!source.present) {
11781
+ console.log(` ${import_picocolors3.default.dim("not found")}`);
11782
+ } else if (source.needsPrefix) {
11783
+ console.log(
11784
+ ` ${import_picocolors3.default.dim(`no ${SECRET_ENV_PREFIX}* keys \u2014 only prefixed keys are exposed from a file the app shares`)}`
11785
+ );
11786
+ } else if (source.names.length === 0) {
11787
+ console.log(` ${import_picocolors3.default.dim("no secrets")}`);
11788
+ } else {
11789
+ const rendered = source.names.map(
11790
+ (name) => claimed.has(name) ? import_picocolors3.default.dim(`${name} (shadowed above)`) : name
11791
+ );
11792
+ for (const name of source.names) claimed.add(name);
11793
+ console.log(` ${rendered.join(", ")}`);
11794
+ }
11795
+ }
11796
+ console.log(
11797
+ `
11798
+ ${all.length === 0 ? "No secrets are defined." : `${all.length} name${all.length === 1 ? "" : "s"} in effect: ${all.join(", ")}`}`
11799
+ );
11800
+ console.log(
11801
+ import_picocolors3.default.dim("Values are never printed. Run `argent secrets --help` to see where to add one.")
11802
+ );
11803
+ const routed = await getResolvedToolsUrl().catch(() => ({ url: null }));
11804
+ if (routed.url) {
11805
+ console.log(
11806
+ import_picocolors3.default.yellow(
11807
+ `
11808
+ Note: a remote tool-server is linked (${routed.url}). Placeholders resolve there, against that machine's environment and secrets files \u2014 not the ones listed above.`
11809
+ )
11810
+ );
11811
+ }
11812
+ }
11813
+
11305
11814
  // ../../node_modules/@clack/core/dist/index.mjs
11306
11815
  import { styleText } from "node:util";
11307
11816
  import { stdout, stdin } from "node:process";
@@ -12022,7 +12531,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
12022
12531
  import process$1 from "node:process";
12023
12532
  var import_sisteransi2 = __toESM(require_src(), 1);
12024
12533
  import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
12025
- import { dirname as dirname10, join as join17 } from "node:path";
12534
+ import { dirname as dirname10, join as join18 } from "node:path";
12026
12535
  function isUnicodeSupported() {
12027
12536
  if (process$1.platform !== "win32") {
12028
12537
  return process$1.env.TERM !== "linux";
@@ -12459,7 +12968,7 @@ ${r2}
12459
12968
  }).prompt();
12460
12969
 
12461
12970
  // ../argent-cli/src/link.ts
12462
- var import_picocolors3 = __toESM(require_picocolors(), 1);
12971
+ var import_picocolors4 = __toESM(require_picocolors(), 1);
12463
12972
  var WILDCARD_HOSTS = /* @__PURE__ */ new Set(["0.0.0.0", "::", "::0", ""]);
12464
12973
  function isLoopback2(host) {
12465
12974
  return host === "127.0.0.1" || host === "localhost" || host === "::1";
@@ -12717,7 +13226,7 @@ async function preflightHealth(url, token) {
12717
13226
  }
12718
13227
  function printRestartHint() {
12719
13228
  console.log(
12720
- import_picocolors3.default.dim("Restart your editor to apply the change to any running `argent mcp` session.")
13229
+ import_picocolors4.default.dim("Restart your editor to apply the change to any running `argent mcp` session.")
12721
13230
  );
12722
13231
  }
12723
13232
  function printSecurityCaveat(host, token, url) {
@@ -12726,7 +13235,7 @@ function printSecurityCaveat(host, token, url) {
12726
13235
  if (tls) {
12727
13236
  if (!token) {
12728
13237
  process.stderr.write(
12729
- import_picocolors3.default.yellow(
13238
+ import_picocolors4.default.yellow(
12730
13239
  `WARNING: ${host} is reached over HTTPS but with NO token \u2014 anyone who can reach the URL can drive the server. Pair with a token.
12731
13240
  `
12732
13241
  )
@@ -12736,7 +13245,7 @@ function printSecurityCaveat(host, token, url) {
12736
13245
  }
12737
13246
  if (token) {
12738
13247
  process.stderr.write(
12739
- import_picocolors3.default.dim(
13248
+ import_picocolors4.default.dim(
12740
13249
  `Note: ${host} is reached over plain HTTP (bearer-token auth, no TLS). Keep this link to a trusted network or VPN, or front it with an https:// tunnel.
12741
13250
  `
12742
13251
  )
@@ -12744,7 +13253,7 @@ function printSecurityCaveat(host, token, url) {
12744
13253
  return;
12745
13254
  }
12746
13255
  process.stderr.write(
12747
- import_picocolors3.default.yellow(
13256
+ import_picocolors4.default.yellow(
12748
13257
  `WARNING: linked target ${host} is non-loopback and has NO token \u2014 tool calls travel over plain HTTP with no auth. Treat this link as trusted-network-only, or pair with a token (start the server without --no-auth).
12749
13258
  `
12750
13259
  )
@@ -12777,9 +13286,9 @@ async function link(argv) {
12777
13286
  if (flags2.host !== null) {
12778
13287
  host = flags2.host;
12779
13288
  } else {
12780
- intro(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" argent link ")));
13289
+ intro(import_picocolors4.default.bgCyan(import_picocolors4.default.black(" argent link ")));
12781
13290
  if (existing) {
12782
- log.info(`Current link: ${import_picocolors3.default.cyan(existing.url)} (${existing.createdAt})`);
13291
+ log.info(`Current link: ${import_picocolors4.default.cyan(existing.url)} (${existing.createdAt})`);
12783
13292
  }
12784
13293
  host = await promptHost(existing);
12785
13294
  }
@@ -12795,12 +13304,12 @@ async function link(argv) {
12795
13304
  let url = flags2.url ?? formatUrl(host, port);
12796
13305
  if (!flags2.yes && existing) {
12797
13306
  if (existing.url === url) {
12798
- log.info(`Already linked to ${import_picocolors3.default.cyan(url)}.`);
13307
+ log.info(`Already linked to ${import_picocolors4.default.cyan(url)}.`);
12799
13308
  outro("No changes.");
12800
13309
  return;
12801
13310
  }
12802
13311
  const overwrite = await confirm({
12803
- message: `Replace existing link ${import_picocolors3.default.dim(existing.url)} with ${import_picocolors3.default.cyan(url)}?`,
13312
+ message: `Replace existing link ${import_picocolors4.default.dim(existing.url)} with ${import_picocolors4.default.cyan(url)}?`,
12804
13313
  initialValue: true
12805
13314
  });
12806
13315
  if (isCancel(overwrite) || !overwrite) {
@@ -12818,10 +13327,10 @@ async function link(argv) {
12818
13327
  }
12819
13328
  const result = await preflightHealth(url, token);
12820
13329
  if (result.ok) {
12821
- if (spinner2) spinner2.stop(import_picocolors3.default.green("Tool-server reachable."));
13330
+ if (spinner2) spinner2.stop(import_picocolors4.default.green("Tool-server reachable."));
12822
13331
  break;
12823
13332
  }
12824
- if (spinner2) spinner2.stop(import_picocolors3.default.red("Verification failed."));
13333
+ if (spinner2) spinner2.stop(import_picocolors4.default.red("Verification failed."));
12825
13334
  const detail = result.error ? ` (${result.error})` : "";
12826
13335
  if (flags2.yes) {
12827
13336
  console.error(
@@ -12861,15 +13370,15 @@ async function link(argv) {
12861
13370
  };
12862
13371
  await writeLinkConfig(cfg);
12863
13372
  if (existing && existing.url !== url) {
12864
- console.log(`${import_picocolors3.default.green("\u2713")} Link updated: ${import_picocolors3.default.dim(existing.url)} \u2192 ${import_picocolors3.default.cyan(url)}`);
13373
+ console.log(`${import_picocolors4.default.green("\u2713")} Link updated: ${import_picocolors4.default.dim(existing.url)} \u2192 ${import_picocolors4.default.cyan(url)}`);
12865
13374
  } else {
12866
- console.log(`${import_picocolors3.default.green("\u2713")} Linked: ${import_picocolors3.default.cyan(url)}`);
13375
+ console.log(`${import_picocolors4.default.green("\u2713")} Linked: ${import_picocolors4.default.cyan(url)}`);
12867
13376
  }
12868
- if (token) console.log(import_picocolors3.default.dim(" auth: token stored in ~/.argent/link.json (0600)"));
13377
+ if (token) console.log(import_picocolors4.default.dim(" auth: token stored in ~/.argent/link.json (0600)"));
12869
13378
  printSecurityCaveat(host, token, url);
12870
13379
  if (process.env.ARGENT_TOOLS_URL) {
12871
13380
  console.log(
12872
- import_picocolors3.default.yellow(
13381
+ import_picocolors4.default.yellow(
12873
13382
  `Note: ARGENT_TOOLS_URL=${process.env.ARGENT_TOOLS_URL} is set in your environment and takes precedence over the link.`
12874
13383
  )
12875
13384
  );
@@ -12900,7 +13409,7 @@ async function unlink3(argv) {
12900
13409
  }
12901
13410
  if (!flags2.yes) {
12902
13411
  const confirmed = await confirm({
12903
- message: `Remove link to ${import_picocolors3.default.cyan(existing.url)}?`,
13412
+ message: `Remove link to ${import_picocolors4.default.cyan(existing.url)}?`,
12904
13413
  initialValue: true
12905
13414
  });
12906
13415
  if (isCancel(confirmed) || !confirmed) {
@@ -12909,10 +13418,10 @@ async function unlink3(argv) {
12909
13418
  }
12910
13419
  }
12911
13420
  await clearLinkConfig();
12912
- console.log(`${import_picocolors3.default.green("\u2713")} Unlinked from ${import_picocolors3.default.dim(existing.url)}.`);
13421
+ console.log(`${import_picocolors4.default.green("\u2713")} Unlinked from ${import_picocolors4.default.dim(existing.url)}.`);
12913
13422
  if (process.env.ARGENT_TOOLS_URL) {
12914
13423
  console.log(
12915
- import_picocolors3.default.yellow(
13424
+ import_picocolors4.default.yellow(
12916
13425
  `The env var ARGENT_TOOLS_URL is also set in your shell (=${process.env.ARGENT_TOOLS_URL}) and takes precedence \u2014 unset it manually if you want fully local behaviour.`
12917
13426
  )
12918
13427
  );
@@ -12921,13 +13430,13 @@ async function unlink3(argv) {
12921
13430
  }
12922
13431
 
12923
13432
  // ../argent-cli/src/telemetry.ts
12924
- var import_picocolors4 = __toESM(require_picocolors(), 1);
13433
+ var import_picocolors5 = __toESM(require_picocolors(), 1);
12925
13434
  async function telemetry(args) {
12926
13435
  const sub = args[0];
12927
13436
  init("cli");
12928
13437
  switch (sub) {
12929
13438
  case void 0:
12930
- printUsage2();
13439
+ printUsage3();
12931
13440
  await shutdown();
12932
13441
  return;
12933
13442
  case "status":
@@ -12942,7 +13451,7 @@ async function telemetry(args) {
12942
13451
  return;
12943
13452
  case "--help":
12944
13453
  case "-h":
12945
- printUsage2();
13454
+ printUsage3();
12946
13455
  await shutdown();
12947
13456
  return;
12948
13457
  default:
@@ -12951,7 +13460,7 @@ async function telemetry(args) {
12951
13460
  process.exit(1);
12952
13461
  }
12953
13462
  }
12954
- function printUsage2() {
13463
+ function printUsage3() {
12955
13464
  console.log(`Usage:
12956
13465
  argent telemetry status Show telemetry state and device id
12957
13466
  argent telemetry enable Enable telemetry
@@ -12969,21 +13478,21 @@ async function cmdEnable() {
12969
13478
  const wasEnabled = isEnabled();
12970
13479
  markEnabled();
12971
13480
  if (wasEnabled) {
12972
- console.log(import_picocolors4.default.dim("Telemetry was already enabled."));
13481
+ console.log(import_picocolors5.default.dim("Telemetry was already enabled."));
12973
13482
  } else {
12974
- console.log(import_picocolors4.default.green("Telemetry enabled."));
13483
+ console.log(import_picocolors5.default.green("Telemetry enabled."));
12975
13484
  }
12976
13485
  await shutdown();
12977
13486
  }
12978
13487
  async function cmdDisable() {
12979
13488
  const wasEnabled = isEnabled();
12980
13489
  if (!wasEnabled) {
12981
- console.log(import_picocolors4.default.dim("Telemetry was already disabled."));
13490
+ console.log(import_picocolors5.default.dim("Telemetry was already disabled."));
12982
13491
  await shutdown();
12983
13492
  return;
12984
13493
  }
12985
13494
  await markDisabled();
12986
- console.log(import_picocolors4.default.red("Telemetry disabled."));
13495
+ console.log(import_picocolors5.default.red("Telemetry disabled."));
12987
13496
  await shutdown();
12988
13497
  }
12989
13498
  export {
@@ -12998,6 +13507,7 @@ export {
12998
13507
  lens,
12999
13508
  link,
13000
13509
  run,
13510
+ secrets,
13001
13511
  server,
13002
13512
  telemetry,
13003
13513
  tools,