@swmansion/argent 0.35.1-next.63 → 0.35.1-next.65

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.
@@ -416,11 +416,11 @@ var require_codegen = __commonJS({
416
416
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
417
417
  return `${varKind} ${this.name}${rhs};` + _n;
418
418
  }
419
- optimizeNames(names, constants2) {
419
+ optimizeNames(names, constants3) {
420
420
  if (!names[this.name.str])
421
421
  return;
422
422
  if (this.rhs)
423
- this.rhs = optimizeExpr(this.rhs, names, constants2);
423
+ this.rhs = optimizeExpr(this.rhs, names, constants3);
424
424
  return this;
425
425
  }
426
426
  get names() {
@@ -437,10 +437,10 @@ var require_codegen = __commonJS({
437
437
  render({ _n }) {
438
438
  return `${this.lhs} = ${this.rhs};` + _n;
439
439
  }
440
- optimizeNames(names, constants2) {
440
+ optimizeNames(names, constants3) {
441
441
  if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
442
442
  return;
443
- this.rhs = optimizeExpr(this.rhs, names, constants2);
443
+ this.rhs = optimizeExpr(this.rhs, names, constants3);
444
444
  return this;
445
445
  }
446
446
  get names() {
@@ -501,8 +501,8 @@ var require_codegen = __commonJS({
501
501
  optimizeNodes() {
502
502
  return `${this.code}` ? this : void 0;
503
503
  }
504
- optimizeNames(names, constants2) {
505
- this.code = optimizeExpr(this.code, names, constants2);
504
+ optimizeNames(names, constants3) {
505
+ this.code = optimizeExpr(this.code, names, constants3);
506
506
  return this;
507
507
  }
508
508
  get names() {
@@ -531,12 +531,12 @@ var require_codegen = __commonJS({
531
531
  }
532
532
  return nodes.length > 0 ? this : void 0;
533
533
  }
534
- optimizeNames(names, constants2) {
534
+ optimizeNames(names, constants3) {
535
535
  const { nodes } = this;
536
536
  let i = nodes.length;
537
537
  while (i--) {
538
538
  const n = nodes[i];
539
- if (n.optimizeNames(names, constants2))
539
+ if (n.optimizeNames(names, constants3))
540
540
  continue;
541
541
  subtractNames(names, n.names);
542
542
  nodes.splice(i, 1);
@@ -589,12 +589,12 @@ var require_codegen = __commonJS({
589
589
  return void 0;
590
590
  return this;
591
591
  }
592
- optimizeNames(names, constants2) {
592
+ optimizeNames(names, constants3) {
593
593
  var _a3;
594
- this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
595
- if (!(super.optimizeNames(names, constants2) || this.else))
594
+ this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
595
+ if (!(super.optimizeNames(names, constants3) || this.else))
596
596
  return;
597
- this.condition = optimizeExpr(this.condition, names, constants2);
597
+ this.condition = optimizeExpr(this.condition, names, constants3);
598
598
  return this;
599
599
  }
600
600
  get names() {
@@ -617,10 +617,10 @@ var require_codegen = __commonJS({
617
617
  render(opts) {
618
618
  return `for(${this.iteration})` + super.render(opts);
619
619
  }
620
- optimizeNames(names, constants2) {
621
- if (!super.optimizeNames(names, constants2))
620
+ optimizeNames(names, constants3) {
621
+ if (!super.optimizeNames(names, constants3))
622
622
  return;
623
- this.iteration = optimizeExpr(this.iteration, names, constants2);
623
+ this.iteration = optimizeExpr(this.iteration, names, constants3);
624
624
  return this;
625
625
  }
626
626
  get names() {
@@ -656,10 +656,10 @@ var require_codegen = __commonJS({
656
656
  render(opts) {
657
657
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
658
658
  }
659
- optimizeNames(names, constants2) {
660
- if (!super.optimizeNames(names, constants2))
659
+ optimizeNames(names, constants3) {
660
+ if (!super.optimizeNames(names, constants3))
661
661
  return;
662
- this.iterable = optimizeExpr(this.iterable, names, constants2);
662
+ this.iterable = optimizeExpr(this.iterable, names, constants3);
663
663
  return this;
664
664
  }
665
665
  get names() {
@@ -701,11 +701,11 @@ var require_codegen = __commonJS({
701
701
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
702
702
  return this;
703
703
  }
704
- optimizeNames(names, constants2) {
704
+ optimizeNames(names, constants3) {
705
705
  var _a3, _b;
706
- super.optimizeNames(names, constants2);
707
- (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
708
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
706
+ super.optimizeNames(names, constants3);
707
+ (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
708
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants3);
709
709
  return this;
710
710
  }
711
711
  get names() {
@@ -1006,7 +1006,7 @@ var require_codegen = __commonJS({
1006
1006
  function addExprNames(names, from) {
1007
1007
  return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
1008
1008
  }
1009
- function optimizeExpr(expr, names, constants2) {
1009
+ function optimizeExpr(expr, names, constants3) {
1010
1010
  if (expr instanceof code_1.Name)
1011
1011
  return replaceName(expr);
1012
1012
  if (!canOptimize(expr))
@@ -1021,14 +1021,14 @@ var require_codegen = __commonJS({
1021
1021
  return items;
1022
1022
  }, []));
1023
1023
  function replaceName(n) {
1024
- const c = constants2[n.str];
1024
+ const c = constants3[n.str];
1025
1025
  if (c === void 0 || names[n.str] !== 1)
1026
1026
  return n;
1027
1027
  delete names[n.str];
1028
1028
  return c;
1029
1029
  }
1030
1030
  function canOptimize(e) {
1031
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
1031
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants3[c.str] !== void 0);
1032
1032
  }
1033
1033
  }
1034
1034
  function subtractNames(names, from) {
@@ -7158,11 +7158,11 @@ var require_codegen2 = __commonJS({
7158
7158
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
7159
7159
  return `${varKind} ${this.name}${rhs};` + _n;
7160
7160
  }
7161
- optimizeNames(names, constants2) {
7161
+ optimizeNames(names, constants3) {
7162
7162
  if (!names[this.name.str])
7163
7163
  return;
7164
7164
  if (this.rhs)
7165
- this.rhs = optimizeExpr(this.rhs, names, constants2);
7165
+ this.rhs = optimizeExpr(this.rhs, names, constants3);
7166
7166
  return this;
7167
7167
  }
7168
7168
  get names() {
@@ -7179,10 +7179,10 @@ var require_codegen2 = __commonJS({
7179
7179
  render({ _n }) {
7180
7180
  return `${this.lhs} = ${this.rhs};` + _n;
7181
7181
  }
7182
- optimizeNames(names, constants2) {
7182
+ optimizeNames(names, constants3) {
7183
7183
  if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
7184
7184
  return;
7185
- this.rhs = optimizeExpr(this.rhs, names, constants2);
7185
+ this.rhs = optimizeExpr(this.rhs, names, constants3);
7186
7186
  return this;
7187
7187
  }
7188
7188
  get names() {
@@ -7243,8 +7243,8 @@ var require_codegen2 = __commonJS({
7243
7243
  optimizeNodes() {
7244
7244
  return `${this.code}` ? this : void 0;
7245
7245
  }
7246
- optimizeNames(names, constants2) {
7247
- this.code = optimizeExpr(this.code, names, constants2);
7246
+ optimizeNames(names, constants3) {
7247
+ this.code = optimizeExpr(this.code, names, constants3);
7248
7248
  return this;
7249
7249
  }
7250
7250
  get names() {
@@ -7273,12 +7273,12 @@ var require_codegen2 = __commonJS({
7273
7273
  }
7274
7274
  return nodes.length > 0 ? this : void 0;
7275
7275
  }
7276
- optimizeNames(names, constants2) {
7276
+ optimizeNames(names, constants3) {
7277
7277
  const { nodes } = this;
7278
7278
  let i = nodes.length;
7279
7279
  while (i--) {
7280
7280
  const n = nodes[i];
7281
- if (n.optimizeNames(names, constants2))
7281
+ if (n.optimizeNames(names, constants3))
7282
7282
  continue;
7283
7283
  subtractNames(names, n.names);
7284
7284
  nodes.splice(i, 1);
@@ -7331,12 +7331,12 @@ var require_codegen2 = __commonJS({
7331
7331
  return void 0;
7332
7332
  return this;
7333
7333
  }
7334
- optimizeNames(names, constants2) {
7334
+ optimizeNames(names, constants3) {
7335
7335
  var _a3;
7336
- this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
7337
- if (!(super.optimizeNames(names, constants2) || this.else))
7336
+ this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
7337
+ if (!(super.optimizeNames(names, constants3) || this.else))
7338
7338
  return;
7339
- this.condition = optimizeExpr(this.condition, names, constants2);
7339
+ this.condition = optimizeExpr(this.condition, names, constants3);
7340
7340
  return this;
7341
7341
  }
7342
7342
  get names() {
@@ -7359,10 +7359,10 @@ var require_codegen2 = __commonJS({
7359
7359
  render(opts) {
7360
7360
  return `for(${this.iteration})` + super.render(opts);
7361
7361
  }
7362
- optimizeNames(names, constants2) {
7363
- if (!super.optimizeNames(names, constants2))
7362
+ optimizeNames(names, constants3) {
7363
+ if (!super.optimizeNames(names, constants3))
7364
7364
  return;
7365
- this.iteration = optimizeExpr(this.iteration, names, constants2);
7365
+ this.iteration = optimizeExpr(this.iteration, names, constants3);
7366
7366
  return this;
7367
7367
  }
7368
7368
  get names() {
@@ -7398,10 +7398,10 @@ var require_codegen2 = __commonJS({
7398
7398
  render(opts) {
7399
7399
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
7400
7400
  }
7401
- optimizeNames(names, constants2) {
7402
- if (!super.optimizeNames(names, constants2))
7401
+ optimizeNames(names, constants3) {
7402
+ if (!super.optimizeNames(names, constants3))
7403
7403
  return;
7404
- this.iterable = optimizeExpr(this.iterable, names, constants2);
7404
+ this.iterable = optimizeExpr(this.iterable, names, constants3);
7405
7405
  return this;
7406
7406
  }
7407
7407
  get names() {
@@ -7443,11 +7443,11 @@ var require_codegen2 = __commonJS({
7443
7443
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
7444
7444
  return this;
7445
7445
  }
7446
- optimizeNames(names, constants2) {
7446
+ optimizeNames(names, constants3) {
7447
7447
  var _a3, _b;
7448
- super.optimizeNames(names, constants2);
7449
- (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants2);
7450
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
7448
+ super.optimizeNames(names, constants3);
7449
+ (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants3);
7450
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants3);
7451
7451
  return this;
7452
7452
  }
7453
7453
  get names() {
@@ -7748,7 +7748,7 @@ var require_codegen2 = __commonJS({
7748
7748
  function addExprNames(names, from) {
7749
7749
  return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
7750
7750
  }
7751
- function optimizeExpr(expr, names, constants2) {
7751
+ function optimizeExpr(expr, names, constants3) {
7752
7752
  if (expr instanceof code_1.Name)
7753
7753
  return replaceName(expr);
7754
7754
  if (!canOptimize(expr))
@@ -7763,14 +7763,14 @@ var require_codegen2 = __commonJS({
7763
7763
  return items;
7764
7764
  }, []));
7765
7765
  function replaceName(n) {
7766
- const c = constants2[n.str];
7766
+ const c = constants3[n.str];
7767
7767
  if (c === void 0 || names[n.str] !== 1)
7768
7768
  return n;
7769
7769
  delete names[n.str];
7770
7770
  return c;
7771
7771
  }
7772
7772
  function canOptimize(e) {
7773
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
7773
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants3[c.str] !== void 0);
7774
7774
  }
7775
7775
  }
7776
7776
  function subtractNames(names, from) {
@@ -21162,10 +21162,10 @@ var require_truncate = __commonJS({
21162
21162
  "../../node_modules/semver/functions/truncate.js"(exports, module) {
21163
21163
  "use strict";
21164
21164
  var parse5 = require_parse();
21165
- var constants2 = require_constants();
21165
+ var constants3 = require_constants();
21166
21166
  var SemVer = require_semver();
21167
21167
  var truncate = (version2, truncation, options) => {
21168
- if (!constants2.RELEASE_TYPES.includes(truncation)) {
21168
+ if (!constants3.RELEASE_TYPES.includes(truncation)) {
21169
21169
  return null;
21170
21170
  }
21171
21171
  const clonedVersion = cloneInputVersion(version2, options);
@@ -22214,7 +22214,7 @@ var require_semver2 = __commonJS({
22214
22214
  "../../node_modules/semver/index.js"(exports, module) {
22215
22215
  "use strict";
22216
22216
  var internalRe = require_re();
22217
- var constants2 = require_constants();
22217
+ var constants3 = require_constants();
22218
22218
  var SemVer = require_semver();
22219
22219
  var identifiers = require_identifiers();
22220
22220
  var parse5 = require_parse();
@@ -22298,8 +22298,8 @@ var require_semver2 = __commonJS({
22298
22298
  re: internalRe.re,
22299
22299
  src: internalRe.src,
22300
22300
  tokens: internalRe.t,
22301
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
22302
- RELEASE_TYPES: constants2.RELEASE_TYPES,
22301
+ SEMVER_SPEC_VERSION: constants3.SEMVER_SPEC_VERSION,
22302
+ RELEASE_TYPES: constants3.RELEASE_TYPES,
22303
22303
  compareIdentifiers: identifiers.compareIdentifiers,
22304
22304
  rcompareIdentifiers: identifiers.rcompareIdentifiers
22305
22305
  };
@@ -32096,12 +32096,13 @@ var Server = class extends Protocol {
32096
32096
 
32097
32097
  // ../argent-tools-client/src/launcher.ts
32098
32098
  import * as net from "node:net";
32099
+ import * as os2 from "node:os";
32099
32100
  import * as fs6 from "node:fs";
32100
32101
  import * as path7 from "node:path";
32101
32102
  import * as readline from "node:readline";
32102
32103
  import { spawn, execFileSync } from "node:child_process";
32103
32104
  import { createHash, randomBytes } from "node:crypto";
32104
- import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
32105
+ import { readFile, readdir, unlink } from "node:fs/promises";
32105
32106
 
32106
32107
  // ../configuration-core/src/flags.ts
32107
32108
  import * as fs from "node:fs";
@@ -33009,20 +33010,66 @@ async function readToolsServerState(bundlePath) {
33009
33010
  const legacy = await readStateFile(STATE_FILE);
33010
33011
  return legacy && legacy.bundlePath === bundlePath ? legacy : null;
33011
33012
  }
33013
+ function primaryGid() {
33014
+ try {
33015
+ return os2.userInfo().gid;
33016
+ } catch {
33017
+ return process.getgid?.();
33018
+ }
33019
+ }
33020
+ var UnsafeArgentHomeError = class extends Error {
33021
+ name = "UnsafeArgentHomeError";
33022
+ };
33023
+ function statHome() {
33024
+ try {
33025
+ fs6.mkdirSync(path7.dirname(STATE_DIR), { recursive: true });
33026
+ fs6.mkdirSync(STATE_DIR, { mode: 448 });
33027
+ } catch {
33028
+ }
33029
+ try {
33030
+ return fs6.statSync(STATE_DIR);
33031
+ } catch {
33032
+ return null;
33033
+ }
33034
+ }
33035
+ function isWritable(dir) {
33036
+ try {
33037
+ fs6.accessSync(dir, fs6.constants.W_OK);
33038
+ return true;
33039
+ } catch {
33040
+ return false;
33041
+ }
33042
+ }
33043
+ function assertPrivateArgentHome() {
33044
+ const uid = process.getuid?.();
33045
+ if (uid === void 0) return;
33046
+ const stat6 = statHome();
33047
+ if (!stat6) return;
33048
+ if (stat6.uid !== uid && !(stat6.uid === 0 && isWritable(STATE_DIR))) {
33049
+ throw new UnsafeArgentHomeError(
33050
+ `The Argent home ${STATE_DIR} belongs to another user. Change its owner or set ARGENT_HOME_DIR to a directory you own.`
33051
+ );
33052
+ }
33053
+ const ownPrivateGroup = process.platform === "linux" && stat6.gid === primaryGid();
33054
+ const groupCanWrite = (stat6.mode & 16) !== 0 && !ownPrivateGroup;
33055
+ if ((stat6.mode & 2) !== 0 || groupCanWrite) {
33056
+ throw new UnsafeArgentHomeError(
33057
+ `The Argent home ${STATE_DIR} is writable by other users. If only you have used it, run \`chmod go-w '${STATE_DIR}'\`. Otherwise set ARGENT_HOME_DIR to a new private directory.`
33058
+ );
33059
+ }
33060
+ }
33012
33061
  async function writeToolsServerState(state) {
33062
+ writeToolsServerStateSync(state);
33063
+ }
33064
+ function writeToolsServerStateSync(state) {
33013
33065
  const target = stateFileForBundle(state.bundlePath);
33014
- await mkdir(STATE_DIR, { recursive: true });
33015
- const tmp = `${target}.${process.pid}.tmp`;
33066
+ fs6.mkdirSync(STATE_DIR, { recursive: true });
33067
+ const tmp = `${target}.${randomBytes(8).toString("hex")}.tmp`;
33016
33068
  try {
33017
- await writeFile(tmp, JSON.stringify(state, null, 2) + "\n", {
33018
- encoding: "utf8",
33019
- mode: 384
33020
- });
33021
- await chmod(tmp, 384);
33022
- await rename(tmp, target);
33069
+ fs6.writeFileSync(tmp, JSON.stringify(state, null, 2) + "\n", { flag: "wx", mode: 384 });
33070
+ fs6.renameSync(tmp, target);
33023
33071
  } catch (err) {
33024
- await unlink(tmp).catch(() => {
33025
- });
33072
+ fs6.rmSync(tmp, { force: true });
33026
33073
  throw err;
33027
33074
  }
33028
33075
  }
@@ -33222,6 +33269,7 @@ async function reusableHandle(state, wantBundlePath, wantVersion) {
33222
33269
  return { url: formatUrl(healthCheckHost(host), state.port), token: state.token ?? "" };
33223
33270
  }
33224
33271
  async function ensureToolsServer(paths) {
33272
+ assertPrivateArgentHome();
33225
33273
  const fast = await reusableHandle(
33226
33274
  await readState(paths.bundlePath),
33227
33275
  paths.bundlePath,
@@ -34120,7 +34168,7 @@ function describeParamIssues(error2, params) {
34120
34168
 
34121
34169
  // ../argent-tools-client/src/link-config.ts
34122
34170
  import * as path10 from "node:path";
34123
- import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
34171
+ import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
34124
34172
  var LINK_DIR = argentHomeDir();
34125
34173
  var LINK_FILE = path10.join(LINK_DIR, "link.json");
34126
34174
  async function readLinkConfig() {
@@ -34162,19 +34210,19 @@ async function getResolvedToolsUrl() {
34162
34210
 
34163
34211
  // ../argent-tools-client/src/file-inputs.ts
34164
34212
  import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
34165
- import { createReadStream as createReadStream2, rmSync as rmSync2 } from "node:fs";
34213
+ import { createReadStream as createReadStream2, rmSync as rmSync3 } from "node:fs";
34166
34214
  import {
34167
- chmod as chmod3,
34215
+ chmod as chmod2,
34168
34216
  lstat,
34169
- mkdir as mkdir3,
34217
+ mkdir as mkdir2,
34170
34218
  readFile as readFile3,
34171
34219
  realpath as realpath2,
34172
- rename as rename2,
34220
+ rename,
34173
34221
  rm as rm2,
34174
34222
  stat as stat3,
34175
- writeFile as writeFile3
34223
+ writeFile as writeFile2
34176
34224
  } from "node:fs/promises";
34177
- import { constants, tmpdir } from "node:os";
34225
+ import { constants as constants2, tmpdir } from "node:os";
34178
34226
  import * as path11 from "node:path";
34179
34227
 
34180
34228
  // ../archive/src/index.ts
@@ -34538,7 +34586,7 @@ var ARCHIVE_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
34538
34586
  function removePendingArchives() {
34539
34587
  for (const archive of pendingArchives) {
34540
34588
  try {
34541
- rmSync2(archive, { force: true });
34589
+ rmSync3(archive, { force: true });
34542
34590
  } catch {
34543
34591
  }
34544
34592
  }
@@ -34552,7 +34600,7 @@ function removeArchivesOnSignal(signal) {
34552
34600
  try {
34553
34601
  process.kill(process.pid, signal);
34554
34602
  } catch {
34555
- process.exit(128 + constants.signals[signal]);
34603
+ process.exit(128 + constants2.signals[signal]);
34556
34604
  }
34557
34605
  }
34558
34606
  function trackArchive(archive) {
@@ -34727,9 +34775,9 @@ function isClientFileDirective2(value) {
34727
34775
  async function replaceFile(target, bytes, mode) {
34728
34776
  const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
34729
34777
  try {
34730
- await writeFile3(temp, bytes, { flag: "wx" });
34731
- if (mode !== void 0) await chmod3(temp, mode & 511);
34732
- await rename2(temp, target);
34778
+ await writeFile2(temp, bytes, { flag: "wx" });
34779
+ if (mode !== void 0) await chmod2(temp, mode & 511);
34780
+ await rename(temp, target);
34733
34781
  } catch (err) {
34734
34782
  await rm2(temp, { force: true });
34735
34783
  throw err;
@@ -34743,7 +34791,7 @@ async function writeBaselineFile(file, bytes, allowedDirs) {
34743
34791
  return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
34744
34792
  }
34745
34793
  const dir = path11.dirname(file);
34746
- await mkdir3(dir, { recursive: true });
34794
+ await mkdir2(dir, { recursive: true });
34747
34795
  const link = await lstat(file).catch(() => null);
34748
34796
  const real = link === null ? null : await realpath2(file).catch(() => null);
34749
34797
  if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
@@ -34782,8 +34830,8 @@ async function applyClientFileDirectives(result, opts = {}) {
34782
34830
  if (isClientFileDirective2(value)) {
34783
34831
  if (!isAllowedClientFilePath(value.path)) return null;
34784
34832
  try {
34785
- await mkdir3(path11.dirname(value.path), { recursive: true });
34786
- await writeFile3(value.path, value.content, "utf8");
34833
+ await mkdir2(path11.dirname(value.path), { recursive: true });
34834
+ await writeFile2(value.path, value.content, "utf8");
34787
34835
  written.push(value.path);
34788
34836
  return value.path;
34789
34837
  } catch {
@@ -35581,6 +35629,7 @@ function createToolsClient(options = {}) {
35581
35629
  `));
35582
35630
  async function route() {
35583
35631
  if (options.baseUrl) return options.baseUrl();
35632
+ assertPrivateArgentHome();
35584
35633
  const resolved = await getResolvedToolsUrl();
35585
35634
  if (resolved.url) {
35586
35635
  return { url: resolved.url, token: resolved.token ?? "", remote: true };
@@ -35809,13 +35858,13 @@ function createToolsClient(options = {}) {
35809
35858
  // ../argent-tools-client/src/artifacts.ts
35810
35859
  import {
35811
35860
  copyFile,
35812
- mkdir as mkdir4,
35861
+ mkdir as mkdir3,
35813
35862
  mkdtemp,
35814
35863
  readFile as readFile6,
35815
35864
  realpath as realpath4,
35816
35865
  rm as rm3,
35817
35866
  stat as stat5,
35818
- writeFile as writeFile4
35867
+ writeFile as writeFile3
35819
35868
  } from "node:fs/promises";
35820
35869
  import { constants as fsConstants } from "node:fs";
35821
35870
  import { tmpdir as tmpdir2 } from "node:os";
@@ -35966,8 +36015,8 @@ async function downloadAndExtractArchive(handle, data, dir, signal) {
35966
36015
  const tarball = join14(attemptDir, "download.tar");
35967
36016
  const extractDir = join14(attemptDir, "files");
35968
36017
  try {
35969
- await writeFile4(tarball, data, { signal });
35970
- await mkdir4(extractDir);
36018
+ await writeFile3(tarball, data, { signal });
36019
+ await mkdir3(extractDir);
35971
36020
  const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
35972
36021
  await rm3(tarball);
35973
36022
  signal?.throwIfAborted();
@@ -35986,7 +36035,7 @@ async function materializeArtifacts(result, ctx) {
35986
36035
  let dirReady = false;
35987
36036
  async function ensureDir() {
35988
36037
  if (!dirReady) {
35989
- await mkdir4(dir, { recursive: true });
36038
+ await mkdir3(dir, { recursive: true });
35990
36039
  dirReady = true;
35991
36040
  }
35992
36041
  }
@@ -35997,7 +36046,7 @@ async function materializeArtifacts(result, ctx) {
35997
36046
  if (saveTarget) {
35998
36047
  const filename = basename7(saveTarget.path);
35999
36048
  try {
36000
- await mkdir4(saveTarget.dir, { recursive: true });
36049
+ await mkdir3(saveTarget.dir, { recursive: true });
36001
36050
  if (!await confineToRealBase(saveTarget.dir, saveTarget.base, saveTarget.rel)) {
36002
36051
  return null;
36003
36052
  }
@@ -36030,7 +36079,7 @@ async function materializeArtifacts(result, ctx) {
36030
36079
  const finalPath = await writeDurableUnique(
36031
36080
  saveTarget.dir,
36032
36081
  filename,
36033
- (p) => writeFile4(p, data, { flag: "wx" })
36082
+ (p) => writeFile3(p, data, { flag: "wx" })
36034
36083
  );
36035
36084
  if (!finalPath) return null;
36036
36085
  if (value.mimeType.startsWith("image/")) {
@@ -36065,7 +36114,7 @@ async function materializeArtifacts(result, ctx) {
36065
36114
  }
36066
36115
  if (value.size > 0 && data.length !== value.size) return null;
36067
36116
  const downloadedPath = join14(dir, sanitizeSegment(value.filename));
36068
- await writeFile4(downloadedPath, data);
36117
+ await writeFile3(downloadedPath, data);
36069
36118
  if (value.mimeType.startsWith("image/")) {
36070
36119
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
36071
36120
  }
@@ -38091,12 +38140,12 @@ function createToolCaller(deps) {
38091
38140
  // ../argent-mcp/src/call-log.ts
38092
38141
  import {
38093
38142
  appendFileSync as appendFileSync2,
38094
- chmodSync as chmodSync2,
38143
+ chmodSync,
38095
38144
  linkSync as linkSync2,
38096
38145
  mkdirSync as mkdirSync6,
38097
38146
  readFileSync as readFileSync8,
38098
- renameSync as renameSync4,
38099
- rmSync as rmSync3,
38147
+ renameSync as renameSync5,
38148
+ rmSync as rmSync4,
38100
38149
  statSync as statSync4
38101
38150
  } from "node:fs";
38102
38151
  import { appendFile } from "node:fs/promises";
@@ -38115,7 +38164,7 @@ function createCallLog(file, maxBytes = CALL_LOG_MAX_BYTES) {
38115
38164
  if (!st) return;
38116
38165
  if (st.mode & 63) {
38117
38166
  try {
38118
- chmodSync2(file, st.mode & 448);
38167
+ chmodSync(file, st.mode & 448);
38119
38168
  } catch {
38120
38169
  }
38121
38170
  }
@@ -38147,7 +38196,7 @@ function createCallLog(file, maxBytes = CALL_LOG_MAX_BYTES) {
38147
38196
  function rotate(file, measured) {
38148
38197
  const aside = `${file}.${process.pid}.rotating`;
38149
38198
  try {
38150
- renameSync4(file, aside);
38199
+ renameSync5(file, aside);
38151
38200
  } catch {
38152
38201
  return;
38153
38202
  }
@@ -38159,7 +38208,7 @@ function rotate(file, measured) {
38159
38208
  }
38160
38209
  if (moved.ino === measured.ino && moved.dev === measured.dev) {
38161
38210
  try {
38162
- renameSync4(aside, `${file}.1`);
38211
+ renameSync5(aside, `${file}.1`);
38163
38212
  } catch {
38164
38213
  }
38165
38214
  return;
@@ -38173,7 +38222,7 @@ function rotate(file, measured) {
38173
38222
  return;
38174
38223
  }
38175
38224
  }
38176
- rmSync3(aside, { force: true });
38225
+ rmSync4(aside, { force: true });
38177
38226
  }
38178
38227
 
38179
38228
  // ../argent-mcp/src/whats-new.ts
@@ -38246,6 +38295,7 @@ async function withDeadline(signal, ms, work) {
38246
38295
  }
38247
38296
  }
38248
38297
  async function startMcpServer(options) {
38298
+ assertPrivateArgentHome();
38249
38299
  if (shouldShowFirstRunNotice()) {
38250
38300
  process.stderr.write(`[argent] ${FIRST_RUN_NOTICE}
38251
38301
  `);
@@ -38255,7 +38305,7 @@ async function startMcpServer(options) {
38255
38305
  const autoDescribeOn = autoDescribeEnabled();
38256
38306
  const whatsNewOn = whatsNewEnabled();
38257
38307
  const installedVersion = getInstalledVersion();
38258
- const highlightsVersion = true ? "0.35.1-next.63" : installedVersion;
38308
+ const highlightsVersion = true ? "0.35.1-next.65" : installedVersion;
38259
38309
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38260
38310
  const trees = createTreeMemory();
38261
38311
  const screenshots = createScreenshotMemory();