@open-artifacts/bus 0.218.0 → 0.219.0

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/index.js CHANGED
@@ -23853,11 +23853,11 @@ var require_codegen = __commonJS({
23853
23853
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
23854
23854
  return `${varKind} ${this.name}${rhs};` + _n;
23855
23855
  }
23856
- optimizeNames(names2, constants8) {
23856
+ optimizeNames(names2, constants9) {
23857
23857
  if (!names2[this.name.str])
23858
23858
  return;
23859
23859
  if (this.rhs)
23860
- this.rhs = optimizeExpr(this.rhs, names2, constants8);
23860
+ this.rhs = optimizeExpr(this.rhs, names2, constants9);
23861
23861
  return this;
23862
23862
  }
23863
23863
  get names() {
@@ -23874,10 +23874,10 @@ var require_codegen = __commonJS({
23874
23874
  render({ _n }) {
23875
23875
  return `${this.lhs} = ${this.rhs};` + _n;
23876
23876
  }
23877
- optimizeNames(names2, constants8) {
23877
+ optimizeNames(names2, constants9) {
23878
23878
  if (this.lhs instanceof code_1.Name && !names2[this.lhs.str] && !this.sideEffects)
23879
23879
  return;
23880
- this.rhs = optimizeExpr(this.rhs, names2, constants8);
23880
+ this.rhs = optimizeExpr(this.rhs, names2, constants9);
23881
23881
  return this;
23882
23882
  }
23883
23883
  get names() {
@@ -23938,8 +23938,8 @@ var require_codegen = __commonJS({
23938
23938
  optimizeNodes() {
23939
23939
  return `${this.code}` ? this : void 0;
23940
23940
  }
23941
- optimizeNames(names2, constants8) {
23942
- this.code = optimizeExpr(this.code, names2, constants8);
23941
+ optimizeNames(names2, constants9) {
23942
+ this.code = optimizeExpr(this.code, names2, constants9);
23943
23943
  return this;
23944
23944
  }
23945
23945
  get names() {
@@ -23968,12 +23968,12 @@ var require_codegen = __commonJS({
23968
23968
  }
23969
23969
  return nodes.length > 0 ? this : void 0;
23970
23970
  }
23971
- optimizeNames(names2, constants8) {
23971
+ optimizeNames(names2, constants9) {
23972
23972
  const { nodes } = this;
23973
23973
  let i = nodes.length;
23974
23974
  while (i--) {
23975
23975
  const n = nodes[i];
23976
- if (n.optimizeNames(names2, constants8))
23976
+ if (n.optimizeNames(names2, constants9))
23977
23977
  continue;
23978
23978
  subtractNames(names2, n.names);
23979
23979
  nodes.splice(i, 1);
@@ -24026,12 +24026,12 @@ var require_codegen = __commonJS({
24026
24026
  return void 0;
24027
24027
  return this;
24028
24028
  }
24029
- optimizeNames(names2, constants8) {
24029
+ optimizeNames(names2, constants9) {
24030
24030
  var _a3;
24031
- this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants8);
24032
- if (!(super.optimizeNames(names2, constants8) || this.else))
24031
+ this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants9);
24032
+ if (!(super.optimizeNames(names2, constants9) || this.else))
24033
24033
  return;
24034
- this.condition = optimizeExpr(this.condition, names2, constants8);
24034
+ this.condition = optimizeExpr(this.condition, names2, constants9);
24035
24035
  return this;
24036
24036
  }
24037
24037
  get names() {
@@ -24054,10 +24054,10 @@ var require_codegen = __commonJS({
24054
24054
  render(opts) {
24055
24055
  return `for(${this.iteration})` + super.render(opts);
24056
24056
  }
24057
- optimizeNames(names2, constants8) {
24058
- if (!super.optimizeNames(names2, constants8))
24057
+ optimizeNames(names2, constants9) {
24058
+ if (!super.optimizeNames(names2, constants9))
24059
24059
  return;
24060
- this.iteration = optimizeExpr(this.iteration, names2, constants8);
24060
+ this.iteration = optimizeExpr(this.iteration, names2, constants9);
24061
24061
  return this;
24062
24062
  }
24063
24063
  get names() {
@@ -24093,10 +24093,10 @@ var require_codegen = __commonJS({
24093
24093
  render(opts) {
24094
24094
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
24095
24095
  }
24096
- optimizeNames(names2, constants8) {
24097
- if (!super.optimizeNames(names2, constants8))
24096
+ optimizeNames(names2, constants9) {
24097
+ if (!super.optimizeNames(names2, constants9))
24098
24098
  return;
24099
- this.iterable = optimizeExpr(this.iterable, names2, constants8);
24099
+ this.iterable = optimizeExpr(this.iterable, names2, constants9);
24100
24100
  return this;
24101
24101
  }
24102
24102
  get names() {
@@ -24138,11 +24138,11 @@ var require_codegen = __commonJS({
24138
24138
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
24139
24139
  return this;
24140
24140
  }
24141
- optimizeNames(names2, constants8) {
24141
+ optimizeNames(names2, constants9) {
24142
24142
  var _a3, _b;
24143
- super.optimizeNames(names2, constants8);
24144
- (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants8);
24145
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2, constants8);
24143
+ super.optimizeNames(names2, constants9);
24144
+ (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names2, constants9);
24145
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names2, constants9);
24146
24146
  return this;
24147
24147
  }
24148
24148
  get names() {
@@ -24443,7 +24443,7 @@ var require_codegen = __commonJS({
24443
24443
  function addExprNames(names2, from) {
24444
24444
  return from instanceof code_1._CodeOrName ? addNames(names2, from.names) : names2;
24445
24445
  }
24446
- function optimizeExpr(expr, names2, constants8) {
24446
+ function optimizeExpr(expr, names2, constants9) {
24447
24447
  if (expr instanceof code_1.Name)
24448
24448
  return replaceName(expr);
24449
24449
  if (!canOptimize(expr))
@@ -24458,14 +24458,14 @@ var require_codegen = __commonJS({
24458
24458
  return items;
24459
24459
  }, []));
24460
24460
  function replaceName(n) {
24461
- const c = constants8[n.str];
24461
+ const c = constants9[n.str];
24462
24462
  if (c === void 0 || names2[n.str] !== 1)
24463
24463
  return n;
24464
24464
  delete names2[n.str];
24465
24465
  return c;
24466
24466
  }
24467
24467
  function canOptimize(e) {
24468
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 && constants8[c.str] !== void 0);
24468
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names2[c.str] === 1 && constants9[c.str] !== void 0);
24469
24469
  }
24470
24470
  }
24471
24471
  function subtractNames(names2, from) {
@@ -32866,7 +32866,7 @@ var init_frames = __esm({
32866
32866
  late = { late: external_exports.array(external_exports.string().min(1)).optional() };
32867
32867
  isWellFormed2 = (s) => s.isWellFormed();
32868
32868
  WELL_FORMED = { message: "text is not well-formed unicode" };
32869
- CLIENT_VERSION = true ? "0.218.0" : "0.0.0";
32869
+ CLIENT_VERSION = true ? "0.219.0" : "0.0.0";
32870
32870
  clientVersion = {
32871
32871
  client_version: external_exports.string().min(1).max(64).optional()
32872
32872
  };
@@ -44621,7 +44621,7 @@ import { fileURLToPath as fileURLToPath7 } from "node:url";
44621
44621
  // ../bus-daemon/src/index.ts
44622
44622
  init_src3();
44623
44623
  import { randomBytes as randomBytes4 } from "node:crypto";
44624
- import { existsSync as existsSync7, lstatSync as lstatSync9, realpathSync as realpathSync10, writeFileSync as writeFileSync12 } from "node:fs";
44624
+ import { existsSync as existsSync7, lstatSync as lstatSync10, realpathSync as realpathSync10, writeFileSync as writeFileSync12 } from "node:fs";
44625
44625
  import { basename as basename7, isAbsolute as isAbsolute8, join as join25 } from "node:path";
44626
44626
 
44627
44627
  // ../bus-adapter-opencode/src/version.ts
@@ -46905,7 +46905,7 @@ var TakenWatch = class {
46905
46905
  // ../bus-daemon/src/config-issues.ts
46906
46906
  init_src();
46907
46907
  import { realpathSync as realpathSync5 } from "node:fs";
46908
- import { dirname as dirname6, join as join13 } from "node:path";
46908
+ import { dirname as dirname7, join as join13 } from "node:path";
46909
46909
 
46910
46910
  // ../bus-daemon/src/global.ts
46911
46911
  import { randomBytes } from "node:crypto";
@@ -47016,7 +47016,7 @@ import { execFileSync as execFileSync5 } from "node:child_process";
47016
47016
  import { existsSync as existsSync4, realpathSync as realpathSync4 } from "node:fs";
47017
47017
  import {
47018
47018
  basename as basename5,
47019
- dirname as dirname5,
47019
+ dirname as dirname6,
47020
47020
  isAbsolute as isAbsolute5,
47021
47021
  join as join12,
47022
47022
  relative,
@@ -47038,22 +47038,84 @@ import {
47038
47038
  import { basename as basename4, isAbsolute as isAbsolute4, join as join11 } from "node:path";
47039
47039
 
47040
47040
  // ../bus-daemon/src/instances.ts
47041
+ init_src();
47041
47042
  import { randomBytes as randomBytes2 } from "node:crypto";
47042
47043
  import {
47043
47044
  chmodSync as chmodSync7,
47044
47045
  closeSync as closeSync6,
47046
+ constants as constants3,
47045
47047
  existsSync as existsSync3,
47048
+ fstatSync as fstatSync5,
47046
47049
  linkSync as linkSync2,
47050
+ lstatSync as lstatSync5,
47047
47051
  mkdirSync as mkdirSync5,
47048
47052
  openSync as openSync6,
47049
47053
  readdirSync as readdirSync5,
47050
47054
  readFileSync as readFileSync9,
47051
- statSync as statSync6,
47052
47055
  unlinkSync as unlinkSync2,
47053
47056
  writeSync as writeSync2
47054
47057
  } from "node:fs";
47055
- import { join as join10 } from "node:path";
47058
+ import { dirname as dirname5, join as join10 } from "node:path";
47056
47059
  var MAIN_INSTANCE = "main";
47060
+ var instanceChecks = {
47061
+ lstat: lstatSync5,
47062
+ uid: () => process.getuid?.()
47063
+ };
47064
+ var posix = () => process.platform !== "win32";
47065
+ function checkDir(dir, fixMode = false) {
47066
+ if (!posix()) return;
47067
+ const st = instanceChecks.lstat(dir);
47068
+ if (st.isSymbolicLink() || !st.isDirectory())
47069
+ throw new StartError(
47070
+ "CREDENTIALS_UNREADABLE",
47071
+ `${dir} must be a real folder, not a link: remove it and run \`${BUS_CMD} add\` again`
47072
+ );
47073
+ const uid = instanceChecks.uid();
47074
+ if (uid !== void 0 && st.uid !== uid)
47075
+ throw new StartError("CREDENTIALS_UNREADABLE", `${dir} must belong to you`);
47076
+ if (!fixMode && st.mode & 63)
47077
+ throw new StartError(
47078
+ "CREDENTIALS_OPEN",
47079
+ `${dir} is open to other users: run \`chmod 700 ${dir}\``
47080
+ );
47081
+ }
47082
+ function readInstanceFile(file2) {
47083
+ if (!posix()) return readFileSync9(file2, "utf8");
47084
+ checkDir(dirname5(file2));
47085
+ const st = instanceChecks.lstat(file2);
47086
+ if (st.isSymbolicLink() || !st.isFile())
47087
+ throw new StartError(
47088
+ "CREDENTIALS_UNREADABLE",
47089
+ `${file2} must be a regular file, not a link`
47090
+ );
47091
+ const uid = instanceChecks.uid();
47092
+ if (uid !== void 0 && st.uid !== uid)
47093
+ throw new StartError(
47094
+ "CREDENTIALS_UNREADABLE",
47095
+ `cannot read ${file2}: it must belong to you`
47096
+ );
47097
+ if (st.mode & 63)
47098
+ throw new StartError(
47099
+ "CREDENTIALS_OPEN",
47100
+ `${file2} is readable by other users: run \`chmod 600 ${file2}\``
47101
+ );
47102
+ const fd = openSync6(
47103
+ file2,
47104
+ constants3.O_RDONLY | (constants3.O_NOFOLLOW ?? 0) | (constants3.O_NONBLOCK ?? 0)
47105
+ );
47106
+ try {
47107
+ const fs = fstatSync5(fd);
47108
+ const owner = instanceChecks.uid();
47109
+ if (!fs.isFile() || owner !== void 0 && fs.uid !== owner || fs.mode & 63)
47110
+ throw new StartError(
47111
+ "CREDENTIALS_UNREADABLE",
47112
+ `${file2} changed while it was being read: run \`${BUS_CMD} add\` again`
47113
+ );
47114
+ return readFileSync9(fd, "utf8");
47115
+ } finally {
47116
+ closeSync6(fd);
47117
+ }
47118
+ }
47057
47119
  var NAME_RE2 = /^[a-z0-9-]{1,32}$/;
47058
47120
  function nameProblem(name) {
47059
47121
  if (name === MAIN_INSTANCE) return `"${MAIN_INSTANCE}" is reserved`;
@@ -47082,6 +47144,11 @@ function mainAddress(h) {
47082
47144
  function addedNames(h) {
47083
47145
  let files2;
47084
47146
  try {
47147
+ try {
47148
+ checkDir(instancesDir(h));
47149
+ } catch (e) {
47150
+ if (!(e instanceof StartError)) throw e;
47151
+ }
47085
47152
  files2 = readdirSync5(instancesDir(h));
47086
47153
  } catch {
47087
47154
  return [];
@@ -47097,7 +47164,7 @@ function listInstances(h = home()) {
47097
47164
  for (const name of added) {
47098
47165
  let hub = "";
47099
47166
  try {
47100
- const r = JSON.parse(readFileSync9(instanceFile(name, h), "utf8"));
47167
+ const r = JSON.parse(readInstanceFile(instanceFile(name, h)));
47101
47168
  if (typeof r.hub === "string") hub = r.hub;
47102
47169
  } catch {
47103
47170
  }
@@ -47105,6 +47172,57 @@ function listInstances(h = home()) {
47105
47172
  }
47106
47173
  return list;
47107
47174
  }
47175
+ function credentialsFor(name, h = home()) {
47176
+ if (name === MAIN_INSTANCE) return readConfig(h);
47177
+ if (nameProblem(name))
47178
+ throw new StartError("NOT_LOGGED_IN", `no instance named ${name}`);
47179
+ const file2 = instanceFile(name, h);
47180
+ const notThere = () => new StartError(
47181
+ "NOT_LOGGED_IN",
47182
+ `no instance named ${name}: run \`${BUS_CMD} add <address>\``
47183
+ );
47184
+ let text3;
47185
+ try {
47186
+ text3 = readInstanceFile(file2);
47187
+ } catch (e) {
47188
+ if (e instanceof StartError) throw e;
47189
+ const code2 = e.code;
47190
+ if (code2 === "ENOENT") throw notThere();
47191
+ if (code2 === "ELOOP")
47192
+ throw new StartError(
47193
+ "CREDENTIALS_UNREADABLE",
47194
+ `${file2} must be a regular file, not a link`
47195
+ );
47196
+ if (code2 === "EACCES" || code2 === "EPERM")
47197
+ throw new StartError(
47198
+ "CREDENTIALS_UNREADABLE",
47199
+ `cannot read ${file2} (${code2}): it must belong to you`
47200
+ );
47201
+ throw e;
47202
+ }
47203
+ let raw;
47204
+ try {
47205
+ raw = JSON.parse(text3);
47206
+ } catch {
47207
+ throw notThere();
47208
+ }
47209
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
47210
+ throw notThere();
47211
+ const r = raw;
47212
+ if (typeof r.hub !== "string" || !r.hub || r.name !== name) throw notThere();
47213
+ if (!isMachineToken(r.machine_token))
47214
+ throw new StartError(
47215
+ "NOT_LOGGED_IN",
47216
+ `instance ${name} has a malformed machine token: run \`${BUS_CMD} add\` again`
47217
+ );
47218
+ checkHub(r.hub);
47219
+ return {
47220
+ hub: r.hub,
47221
+ machine_id: typeof r.machine_id === "string" ? r.machine_id : "",
47222
+ label: cleanLabel(r.label),
47223
+ machine_token: r.machine_token
47224
+ };
47225
+ }
47108
47226
  function addProblem(name, address, h = home()) {
47109
47227
  const bad2 = nameProblem(name);
47110
47228
  if (bad2) return bad2;
@@ -47114,9 +47232,18 @@ function addProblem(name, address, h = home()) {
47114
47232
  const main2 = mainAddress(h);
47115
47233
  if (want !== void 0 && main2 !== void 0 && canonicalAddress(main2) === want)
47116
47234
  return `that address is already this machine's main instance`;
47117
- for (const i of listInstances(h))
47235
+ for (const i of listInstances(h)) {
47236
+ if (!i.main && !i.hub) {
47237
+ try {
47238
+ credentialsFor(i.name, h);
47239
+ } catch (e) {
47240
+ if (e instanceof StartError) return e.message;
47241
+ }
47242
+ return `instance ${i.name} cannot be read, so the address cannot be checked: fix or remove ${instanceFile(i.name, h)} first`;
47243
+ }
47118
47244
  if (!i.main && want !== void 0 && canonicalAddress(i.hub) === want)
47119
47245
  return `that address is already the instance ${i.name}`;
47246
+ }
47120
47247
  return void 0;
47121
47248
  }
47122
47249
  function suggestName(address, h = home()) {
@@ -47138,6 +47265,7 @@ function saveInstance(c, h = home()) {
47138
47265
  const dir = instancesDir(h);
47139
47266
  mkdirSync5(h, { recursive: true, mode: 448 });
47140
47267
  mkdirSync5(dir, { recursive: true, mode: 448 });
47268
+ checkDir(dir, true);
47141
47269
  chmodSync7(dir, 448);
47142
47270
  const tmp = join10(dir, `.${c.name}.${randomBytes2(8).toString("hex")}.tmp`);
47143
47271
  const fd = openSync6(tmp, "wx", 384);
@@ -47310,7 +47438,7 @@ function resolveNamespace(start, deps2 = {}) {
47310
47438
  }
47311
47439
  if (approved(nsFile, cfg.namespace, deps2))
47312
47440
  return { namespace: cfg.namespace, global: global2, source: "config" };
47313
- const dir = dirname5(nsFile);
47441
+ const dir = dirname6(nsFile);
47314
47442
  deps2.issues?.setPending(nsFile, deps2.uid ?? process.getuid?.(), {
47315
47443
  file: nsFile,
47316
47444
  dir,
@@ -47356,7 +47484,7 @@ function pinRemote(rootPath, cwd, derived2, deps2, quiet) {
47356
47484
  try {
47357
47485
  writeRemotes(
47358
47486
  entries.filter((e) => priors.includes(e) || existsSync4(e.dir)),
47359
- dirname5(recordFile)
47487
+ dirname6(recordFile)
47360
47488
  );
47361
47489
  } catch (e) {
47362
47490
  once(
@@ -47417,7 +47545,7 @@ function recordRoots(root, cwd, deps2) {
47417
47545
  if (!common) return [real3];
47418
47546
  try {
47419
47547
  const c = realpathSync4(resolve2(cwd, common));
47420
- const key2 = basename5(c) === ".git" ? dirname5(c) : c;
47548
+ const key2 = basename5(c) === ".git" ? dirname6(c) : c;
47421
47549
  return key2 === real3 ? [real3] : [key2, real3];
47422
47550
  } catch {
47423
47551
  return [real3];
@@ -47476,7 +47604,7 @@ function approved(file2, namespace2, deps2) {
47476
47604
  `approvals:${path}:${list.error}`,
47477
47605
  `${path} ${list.error}: no namespace is approved`
47478
47606
  );
47479
- return isApproved(dirname5(file2), namespace2, list.entries);
47607
+ return isApproved(dirname6(file2), namespace2, list.entries);
47480
47608
  }
47481
47609
  function allowlisted(cwd, deps2) {
47482
47610
  const file2 = deps2.globalFile ?? globalFile();
@@ -47735,9 +47863,9 @@ function scanConfigFiles(cwd, opts = {}) {
47735
47863
  }
47736
47864
  function configPaths(cwd) {
47737
47865
  const out = [];
47738
- for (let dir = cwd; ; dir = dirname6(dir)) {
47866
+ for (let dir = cwd; ; dir = dirname7(dir)) {
47739
47867
  out.push(join13(dir, CONFIG_FILE));
47740
- if (dirname6(dir) === dir) return out;
47868
+ if (dirname7(dir) === dir) return out;
47741
47869
  }
47742
47870
  }
47743
47871
 
@@ -49578,7 +49706,7 @@ init_src();
49578
49706
  import { createHash as createHash5, randomUUID } from "node:crypto";
49579
49707
  import {
49580
49708
  chmodSync as chmodSync11,
49581
- lstatSync as lstatSync5,
49709
+ lstatSync as lstatSync6,
49582
49710
  mkdirSync as mkdirSync7,
49583
49711
  readFileSync as readFileSync12,
49584
49712
  renameSync as renameSync10,
@@ -49586,7 +49714,7 @@ import {
49586
49714
  writeFileSync as writeFileSync7
49587
49715
  } from "node:fs";
49588
49716
  import { createServer as createServer2 } from "node:net";
49589
- import { dirname as dirname7, join as join14 } from "node:path";
49717
+ import { dirname as dirname8, join as join14 } from "node:path";
49590
49718
  import { createInterface } from "node:readline";
49591
49719
 
49592
49720
  // ../bus-daemon/src/transports/held.ts
@@ -49652,7 +49780,7 @@ function unsafeClaudeSocket(path) {
49652
49780
  const uid = process.getuid?.();
49653
49781
  let sock;
49654
49782
  try {
49655
- sock = lstatSync5(path);
49783
+ sock = lstatSync6(path);
49656
49784
  } catch (e) {
49657
49785
  if (e.code === "ENOENT") return null;
49658
49786
  return `${path} cannot be checked (${e.code ?? String(e)})`;
@@ -49660,8 +49788,8 @@ function unsafeClaudeSocket(path) {
49660
49788
  try {
49661
49789
  if (!sock.isSocket()) return `${path} is not a socket`;
49662
49790
  if (sock.uid !== uid) return `${path} belongs to another user`;
49663
- const dir = dirname7(path);
49664
- const st = lstatSync5(dir);
49791
+ const dir = dirname8(path);
49792
+ const st = lstatSync6(dir);
49665
49793
  if (!st.isDirectory()) return `${dir} is not a folder`;
49666
49794
  if (st.uid !== uid) return `${dir} belongs to another user`;
49667
49795
  if (st.mode & 18)
@@ -50140,7 +50268,7 @@ async function shut(sink) {
50140
50268
  init_src2();
50141
50269
  init_src();
50142
50270
  import { execFile } from "node:child_process";
50143
- import { accessSync, constants as constants3, readFileSync as readFileSync13, statSync as statSync7 } from "node:fs";
50271
+ import { accessSync, constants as constants4, readFileSync as readFileSync13, statSync as statSync6 } from "node:fs";
50144
50272
  import { readFile } from "node:fs/promises";
50145
50273
  import { delimiter, isAbsolute as isAbsolute6, join as join16 } from "node:path";
50146
50274
 
@@ -50195,8 +50323,8 @@ var CODEX_APP = "/Applications/ChatGPT.app";
50195
50323
  var CODEX_APP_ID = "com.openai.codex";
50196
50324
  var executable = (p) => {
50197
50325
  try {
50198
- if (!statSync7(p).isFile()) return false;
50199
- accessSync(p, constants3.X_OK);
50326
+ if (!statSync6(p).isFile()) return false;
50327
+ accessSync(p, constants4.X_OK);
50200
50328
  return true;
50201
50329
  } catch {
50202
50330
  return false;
@@ -50273,7 +50401,7 @@ function splitArgv0(args) {
50273
50401
  const real3 = ends.find((e) => {
50274
50402
  const p = args.slice(0, e);
50275
50403
  try {
50276
- return isAbsolute6(p) && statSync7(p).isFile();
50404
+ return isAbsolute6(p) && statSync6(p).isFile();
50277
50405
  } catch {
50278
50406
  return false;
50279
50407
  }
@@ -50733,7 +50861,7 @@ var PiTransport = class {
50733
50861
  import { createHash as createHash6 } from "node:crypto";
50734
50862
  import {
50735
50863
  chmodSync as chmodSync12,
50736
- lstatSync as lstatSync6,
50864
+ lstatSync as lstatSync7,
50737
50865
  mkdirSync as mkdirSync8,
50738
50866
  readdirSync as readdirSync6,
50739
50867
  readFileSync as readFileSync14,
@@ -50753,7 +50881,7 @@ var binPath = (home2) => join17(home2, "bin");
50753
50881
  var stateFile = (home2) => join17(home2, "update.json");
50754
50882
  var lstat = (path) => {
50755
50883
  try {
50756
- return lstatSync6(path);
50884
+ return lstatSync7(path);
50757
50885
  } catch {
50758
50886
  return void 0;
50759
50887
  }
@@ -50993,7 +51121,7 @@ function hashTree(dir) {
50993
51121
  if (rel === "" && name === ".live") continue;
50994
51122
  const p = join17(abs, name);
50995
51123
  const r = rel === "" ? name : `${rel}/${name}`;
50996
- const st = lstatSync6(p);
51124
+ const st = lstatSync7(p);
50997
51125
  if (st.isDirectory()) walk(p, r);
50998
51126
  else if (st.isFile()) {
50999
51127
  if (Object.keys(out).length >= MAX_TREE_FILES)
@@ -51249,7 +51377,7 @@ import { existsSync as existsSync5 } from "node:fs";
51249
51377
  // ../bus-daemon/src/update/state.ts
51250
51378
  import {
51251
51379
  chmodSync as chmodSync14,
51252
- lstatSync as lstatSync7,
51380
+ lstatSync as lstatSync8,
51253
51381
  readFileSync as readFileSync17,
51254
51382
  renameSync as renameSync13,
51255
51383
  rmSync as rmSync8,
@@ -51484,7 +51612,7 @@ function parseRequest(text3) {
51484
51612
  }
51485
51613
  function requestOk(path) {
51486
51614
  try {
51487
- const st = lstatSync7(path);
51615
+ const st = lstatSync8(path);
51488
51616
  if (!st.isFile()) return false;
51489
51617
  const uid = process.getuid?.();
51490
51618
  if (uid !== void 0 && st.uid !== uid) return false;
@@ -51861,13 +51989,13 @@ async function fetchRelease(version2, doFetch = globalThis.fetch) {
51861
51989
  // ../bus-daemon/src/update/tar.ts
51862
51990
  import {
51863
51991
  closeSync as closeSync8,
51864
- constants as constants4,
51992
+ constants as constants5,
51865
51993
  mkdirSync as mkdirSync9,
51866
51994
  openSync as openSync8,
51867
51995
  realpathSync as realpathSync7,
51868
51996
  writeSync as writeSync4
51869
51997
  } from "node:fs";
51870
- import { basename as basename6, dirname as dirname8, join as join21, relative as relative3, resolve as resolve3, sep as sep3 } from "node:path";
51998
+ import { basename as basename6, dirname as dirname9, join as join21, relative as relative3, resolve as resolve3, sep as sep3 } from "node:path";
51871
51999
  import { gunzipSync } from "node:zlib";
51872
52000
  var BLOCK = 512;
51873
52001
  var FILE_RE = /^package\/(package\.json|LICENSE|dist\/.+|assets\/.+)$/;
@@ -51992,13 +52120,13 @@ function unpackTo(entries, dest) {
51992
52120
  mkdirSync9(target2, { recursive: true, mode: 448 });
51993
52121
  continue;
51994
52122
  }
51995
- mkdirSync9(dirname8(target2), { recursive: true, mode: 448 });
51996
- const parent = realpathSync7(dirname8(target2));
52123
+ mkdirSync9(dirname9(target2), { recursive: true, mode: 448 });
52124
+ const parent = realpathSync7(dirname9(target2));
51997
52125
  if (parent !== root && !parent.startsWith(root + sep3))
51998
52126
  bad("parent escapes the destination");
51999
52127
  const fd = openSync8(
52000
52128
  join21(parent, basename6(target2)),
52001
- constants4.O_WRONLY | constants4.O_CREAT | constants4.O_EXCL | constants4.O_NOFOLLOW,
52129
+ constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | constants5.O_NOFOLLOW,
52002
52130
  384
52003
52131
  );
52004
52132
  try {
@@ -52841,9 +52969,9 @@ var Updater = class {
52841
52969
 
52842
52970
  // ../bus-daemon/src/event-log.ts
52843
52971
  init_src2();
52844
- import { constants as constants5 } from "node:fs";
52972
+ import { constants as constants6 } from "node:fs";
52845
52973
  import { lstat as lstat2, mkdir, open as open2, rename } from "node:fs/promises";
52846
- import { dirname as dirname9 } from "node:path";
52974
+ import { dirname as dirname10 } from "node:path";
52847
52975
  var EVENT_LOG_MAX_BYTES = 1e6;
52848
52976
  var FIELDS = /* @__PURE__ */ new Set([
52849
52977
  "name",
@@ -52876,14 +53004,14 @@ function createEventLog(file2, opts = {}) {
52876
53004
  const now = opts.now ?? (() => /* @__PURE__ */ new Date());
52877
53005
  let chain = Promise.resolve();
52878
53006
  let size;
52879
- const checkDir2 = async (dir) => {
53007
+ const checkDir3 = async (dir) => {
52880
53008
  const ls = await lstat2(dir).catch(() => void 0);
52881
53009
  if (ls && ls.isSymbolicLink()) throw new Error("folder is a symlink");
52882
53010
  if (ls && !ls.isDirectory()) throw new Error("not a folder");
52883
53011
  if (!ls) await mkdir(dir, { recursive: true, mode: 448 });
52884
53012
  const dh = await open2(
52885
53013
  dir,
52886
- constants5.O_RDONLY | constants5.O_DIRECTORY | constants5.O_NOFOLLOW
53014
+ constants6.O_RDONLY | constants6.O_DIRECTORY | constants6.O_NOFOLLOW
52887
53015
  );
52888
53016
  try {
52889
53017
  const st = await dh.stat();
@@ -52906,7 +53034,7 @@ function createEventLog(file2, opts = {}) {
52906
53034
  const openChecked = async (f, flags) => {
52907
53035
  const fh = await open2(
52908
53036
  f,
52909
- flags | constants5.O_NOFOLLOW | constants5.O_NONBLOCK,
53037
+ flags | constants6.O_NOFOLLOW | constants6.O_NONBLOCK,
52910
53038
  384
52911
53039
  );
52912
53040
  try {
@@ -52920,14 +53048,14 @@ function createEventLog(file2, opts = {}) {
52920
53048
  };
52921
53049
  const write = async (line) => {
52922
53050
  try {
52923
- const dir = dirname9(file2);
52924
- const id = await checkDir2(dir);
53051
+ const dir = dirname10(file2);
53052
+ const id = await checkDir3(dir);
52925
53053
  if (size === void 0) {
52926
53054
  size = 0;
52927
53055
  for (const f of [file2, `${file2}.1`]) {
52928
53056
  const st = await lstat2(f).catch(() => void 0);
52929
53057
  if (!st) continue;
52930
- const fh2 = await openChecked(f, constants5.O_RDONLY);
53058
+ const fh2 = await openChecked(f, constants6.O_RDONLY);
52931
53059
  try {
52932
53060
  if (f === file2) size = (await fh2.stat()).size;
52933
53061
  } finally {
@@ -52942,7 +53070,7 @@ function createEventLog(file2, opts = {}) {
52942
53070
  }
52943
53071
  const fh = await openChecked(
52944
53072
  file2,
52945
- constants5.O_WRONLY | constants5.O_APPEND | constants5.O_CREAT
53073
+ constants6.O_WRONLY | constants6.O_APPEND | constants6.O_CREAT
52946
53074
  );
52947
53075
  try {
52948
53076
  await sameDir2(dir, id);
@@ -52993,7 +53121,7 @@ function createEventLog(file2, opts = {}) {
52993
53121
  init_src();
52994
53122
  import { execFileSync as execFileSync6 } from "node:child_process";
52995
53123
  import { realpathSync as realpathSync8 } from "node:fs";
52996
- import { dirname as dirname10, isAbsolute as isAbsolute7, join as join23, relative as relative4, resolve as resolve4, sep as sep4 } from "node:path";
53124
+ import { dirname as dirname11, isAbsolute as isAbsolute7, join as join23, relative as relative4, resolve as resolve4, sep as sep4 } from "node:path";
52997
53125
  var foldersFile = (h = home()) => join23(h, "folders.json");
52998
53126
  var strMap = (v) => {
52999
53127
  if (v === void 0) return {};
@@ -53088,7 +53216,7 @@ function readSuggestion(cwd, opts = {}) {
53088
53216
  return void 0;
53089
53217
  }
53090
53218
  const uid = opts.uid ?? process.getuid?.();
53091
- for (let d = dir; ; d = dirname10(d)) {
53219
+ for (let d = dir; ; d = dirname11(d)) {
53092
53220
  const deeper = opts.below !== void 0 && !inside(d, opts.below);
53093
53221
  if (!deeper) {
53094
53222
  const own2 = readOwnFile(join23(d, CONFIG_FILE), uid, {
@@ -53103,7 +53231,7 @@ function readSuggestion(cwd, opts = {}) {
53103
53231
  }
53104
53232
  }
53105
53233
  }
53106
- if (dirname10(d) === d) return void 0;
53234
+ if (dirname11(d) === d) return void 0;
53107
53235
  }
53108
53236
  }
53109
53237
  function instanceAt(address, list) {
@@ -53112,7 +53240,7 @@ function instanceAt(address, list) {
53112
53240
 
53113
53241
  // ../bus-daemon/src/leads/templates.ts
53114
53242
  init_src();
53115
- import { lstatSync as lstatSync8, readdirSync as readdirSync7, realpathSync as realpathSync9, statSync as statSync8 } from "node:fs";
53243
+ import { lstatSync as lstatSync9, readdirSync as readdirSync7, realpathSync as realpathSync9, statSync as statSync7 } from "node:fs";
53116
53244
  import { join as join24 } from "node:path";
53117
53245
  var leadsDir = (h = home()) => join24(h, "leads");
53118
53246
  var leadTemplateFile = (name, h = home()) => join24(leadsDir(h), `${name}.json`);
@@ -53129,7 +53257,7 @@ var refused2 = (name, why2) => ({
53129
53257
  function checkLeadsDir(dir, uid) {
53130
53258
  let st;
53131
53259
  try {
53132
- st = lstatSync8(dir);
53260
+ st = lstatSync9(dir);
53133
53261
  } catch (e) {
53134
53262
  const code2 = e.code;
53135
53263
  if (code2 === "ENOENT" || code2 === "ENOTDIR") return "none";
@@ -53154,7 +53282,7 @@ function checkRealDir(path, label2, uid, group) {
53154
53282
  if (real3 !== path)
53155
53283
  return `${label2} is not its own real path (a symlink or alias)`;
53156
53284
  try {
53157
- const st = statSync8(real3);
53285
+ const st = statSync7(real3);
53158
53286
  if (!st.isDirectory()) return `${label2} is not a folder`;
53159
53287
  if (uid !== void 0 && st.uid !== uid)
53160
53288
  return `${label2} belongs to another user`;
@@ -53169,7 +53297,7 @@ function checkRealDir(path, label2, uid, group) {
53169
53297
  }
53170
53298
  function checkBinary(path, uid) {
53171
53299
  try {
53172
- const st = statSync8(path);
53300
+ const st = statSync7(path);
53173
53301
  if (!st.isFile()) return "binary is not a regular file";
53174
53302
  if (uid !== void 0 && st.uid !== uid && st.uid !== 0)
53175
53303
  return "binary belongs to another user";
@@ -54723,11 +54851,11 @@ async function runDaemon(deps2 = {}) {
54723
54851
  announceSessions();
54724
54852
  }
54725
54853
  }).catch(socketInUse);
54726
- const bound = lstatSync9(listenPath);
54854
+ const bound = lstatSync10(listenPath);
54727
54855
  const socketWatch = setInterval(() => {
54728
54856
  let now;
54729
54857
  try {
54730
- now = lstatSync9(listenPath);
54858
+ now = lstatSync10(listenPath);
54731
54859
  } catch {
54732
54860
  }
54733
54861
  if (now?.ino === bound.ino && now.dev === bound.dev) return;
@@ -56446,7 +56574,7 @@ import {
56446
56574
  chmodSync as chmodSync18,
56447
56575
  cpSync,
56448
56576
  existsSync as existsSync8,
56449
- lstatSync as lstatSync11,
56577
+ lstatSync as lstatSync12,
56450
56578
  mkdirSync as mkdirSync12,
56451
56579
  readdirSync as readdirSync8,
56452
56580
  readFileSync as readFileSync21,
@@ -56459,7 +56587,7 @@ import { tmpdir } from "node:os";
56459
56587
  import {
56460
56588
  basename as basename8,
56461
56589
  delimiter as delimiter2,
56462
- dirname as dirname12,
56590
+ dirname as dirname13,
56463
56591
  isAbsolute as isAbsolute9,
56464
56592
  join as join28,
56465
56593
  relative as relative5,
@@ -56469,7 +56597,7 @@ import { fileURLToPath } from "node:url";
56469
56597
  init_src();
56470
56598
 
56471
56599
  // src/steps/codex.ts
56472
- import { lstatSync as lstatSync10, readFileSync as readFileSync19 } from "node:fs";
56600
+ import { lstatSync as lstatSync11, readFileSync as readFileSync19 } from "node:fs";
56473
56601
  import { join as join26, resolve as resolve5 } from "node:path";
56474
56602
 
56475
56603
  // ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
@@ -57241,7 +57369,7 @@ var codexConfig = (home2, env2) => join26(codexHome2(home2, env2), "config.toml"
57241
57369
  function hasCodex(o) {
57242
57370
  if (o.which("codex")) return true;
57243
57371
  try {
57244
- lstatSync10(codexHome2(o.home, o.env));
57372
+ lstatSync11(codexHome2(o.home, o.env));
57245
57373
  return true;
57246
57374
  } catch {
57247
57375
  }
@@ -57654,7 +57782,7 @@ import {
57654
57782
  renameSync as renameSync15,
57655
57783
  writeFileSync as writeFileSync14
57656
57784
  } from "node:fs";
57657
- import { dirname as dirname11 } from "node:path";
57785
+ import { dirname as dirname12 } from "node:path";
57658
57786
  function readInstallFile(path) {
57659
57787
  try {
57660
57788
  const v = JSON.parse(readFileSync20(path, "utf8"));
@@ -57666,7 +57794,7 @@ function readInstallFile(path) {
57666
57794
  }
57667
57795
  function updateInstallFile(path, patch) {
57668
57796
  const next = { ...readInstallFile(path), ...patch };
57669
- mkdirSync11(dirname11(path), { recursive: true, mode: 448 });
57797
+ mkdirSync11(dirname12(path), { recursive: true, mode: 448 });
57670
57798
  const tmp = `${path}.${process.pid}.tmp`;
57671
57799
  writeFileSync14(tmp, `${JSON.stringify(next, null, 2)}
57672
57800
  `, { mode: 384 });
@@ -57717,7 +57845,7 @@ function servicePath(env2, execPath, platform) {
57717
57845
  "/bin"
57718
57846
  ];
57719
57847
  const mine = (env2.PATH ?? "").split(delimiter2).filter((d) => isAbsolute9(d) && !transient(d));
57720
- const node2 = dirname12(execPath);
57848
+ const node2 = dirname13(execPath);
57721
57849
  if (!mine.includes(node2) && isAbsolute9(node2) && !transient(node2))
57722
57850
  mine.unshift(node2);
57723
57851
  return [.../* @__PURE__ */ new Set([...mine, ...system])].join(delimiter2);
@@ -57784,7 +57912,7 @@ function cliSource() {
57784
57912
  jiti: import.meta.resolve("jiti")
57785
57913
  } : { kind: "bundle", file: here };
57786
57914
  }
57787
- var entryName = (src) => src.kind === "bundle" ? join28(basename8(dirname12(src.file)), basename8(src.file)) : "oa-bus.js";
57915
+ var entryName = (src) => src.kind === "bundle" ? join28(basename8(dirname13(src.file)), basename8(src.file)) : "oa-bus.js";
57788
57916
  var shim = (src) => `// Written by oa-bus install: runs the sources it was installed from.
57789
57917
  import { createJiti } from ${JSON.stringify(src.jiti)};
57790
57918
 
@@ -57844,7 +57972,7 @@ function versionOf(src) {
57844
57972
  if (src.kind === "dev") return "dev";
57845
57973
  try {
57846
57974
  const j = JSON.parse(
57847
- readFileSync21(join28(dirname12(dirname12(src.file)), "package.json"), "utf8")
57975
+ readFileSync21(join28(dirname13(dirname13(src.file)), "package.json"), "utf8")
57848
57976
  );
57849
57977
  if (isSafeVersion(j?.version)) return j.version;
57850
57978
  } catch {
@@ -57859,7 +57987,7 @@ function installCli(home2, src, node2) {
57859
57987
  versionOf(src),
57860
57988
  (tmp) => {
57861
57989
  if (src.kind === "bundle") {
57862
- const pkg = dirname12(dirname12(src.file));
57990
+ const pkg = dirname13(dirname13(src.file));
57863
57991
  for (const name of ["dist", "assets", "package.json"])
57864
57992
  if (existsSync8(join28(pkg, name)))
57865
57993
  cpSync(join28(pkg, name), join28(tmp, name), { recursive: true });
@@ -57881,14 +58009,14 @@ function installCli(home2, src, node2) {
57881
58009
  }
57882
58010
  var present = (path) => {
57883
58011
  try {
57884
- lstatSync11(path);
58012
+ lstatSync12(path);
57885
58013
  return true;
57886
58014
  } catch {
57887
58015
  return false;
57888
58016
  }
57889
58017
  };
57890
58018
  function writeReplacing(path, text3) {
57891
- mkdirSync12(dirname12(path), { recursive: true });
58019
+ mkdirSync12(dirname13(path), { recursive: true });
57892
58020
  const tmp = `${path}.${process.pid}.tmp`;
57893
58021
  try {
57894
58022
  writeFileSync15(tmp, text3, { mode: 420 });
@@ -57903,7 +58031,7 @@ var real = (path, native = false) => {
57903
58031
  try {
57904
58032
  return (native ? realpathSync11.native : realpathSync11)(abs);
57905
58033
  } catch {
57906
- const parent = dirname12(abs);
58034
+ const parent = dirname13(abs);
57907
58035
  return parent === abs ? abs : join28(real(parent, native), basename8(abs));
57908
58036
  }
57909
58037
  };
@@ -58189,7 +58317,7 @@ function systemService(d) {
58189
58317
  },
58190
58318
  others() {
58191
58319
  if (manager === void 0) return [];
58192
- const dir = dirname12(fresh());
58320
+ const dir = dirname13(fresh());
58193
58321
  const own2 = fileName();
58194
58322
  const re = manager === "launchd" ? /^com\.open-artifacts\.bus\.[0-9a-f]{8}\.plist$/ : /^oa-bus-[0-9a-f]{8}\.service$/;
58195
58323
  try {
@@ -58211,7 +58339,7 @@ function systemService(d) {
58211
58339
  const me = (d.ownerUid ?? (() => process.getuid?.()))();
58212
58340
  const st = (() => {
58213
58341
  try {
58214
- return lstatSync11(r);
58342
+ return lstatSync12(r);
58215
58343
  } catch {
58216
58344
  return void 0;
58217
58345
  }
@@ -58231,7 +58359,7 @@ var noService = {
58231
58359
  remove: async () => ({}),
58232
58360
  cli: () => ["oa-bus"]
58233
58361
  };
58234
- var VERSION = true ? "0.218.0" : JSON.parse(
58362
+ var VERSION = true ? "0.219.0" : JSON.parse(
58235
58363
  readFileSync22(new URL("../package.json", import.meta.url), "utf8")
58236
58364
  ).version;
58237
58365
  var which = (cmd) => {
@@ -58413,16 +58541,16 @@ import { randomBytes as randomBytes7 } from "node:crypto";
58413
58541
  import {
58414
58542
  chmodSync as chmodSync20,
58415
58543
  existsSync as existsSync15,
58416
- lstatSync as lstatSync17,
58544
+ lstatSync as lstatSync18,
58417
58545
  mkdirSync as mkdirSync15,
58418
58546
  readFileSync as readFileSync31,
58419
58547
  readlinkSync as readlinkSync5,
58420
58548
  renameSync as renameSync19,
58421
58549
  rmSync as rmSync19,
58422
- statSync as statSync10,
58550
+ statSync as statSync9,
58423
58551
  writeFileSync as writeFileSync18
58424
58552
  } from "node:fs";
58425
- import { dirname as dirname16, isAbsolute as isAbsolute14, join as join35, relative as relative7, resolve as resolve13 } from "node:path";
58553
+ import { dirname as dirname17, isAbsolute as isAbsolute14, join as join35, relative as relative7, resolve as resolve13 } from "node:path";
58426
58554
  import { isDeepStrictEqual } from "node:util";
58427
58555
 
58428
58556
  // ../bus-adapter-hermes/src/index.ts
@@ -59665,7 +59793,7 @@ var PI_EXTENSION = fileURLToPath4(
59665
59793
  );
59666
59794
 
59667
59795
  // src/steps/claude-proof.ts
59668
- import { lstatSync as lstatSync12, readFileSync as readFileSync23 } from "node:fs";
59796
+ import { lstatSync as lstatSync13, readFileSync as readFileSync23 } from "node:fs";
59669
59797
  import { join as join29, resolve as resolve7 } from "node:path";
59670
59798
  var claudeConfigFile = (home2, env2) => join29(env2.CLAUDE_CONFIG_DIR ?? home2, ".claude.json");
59671
59799
  var PROOF_COMMAND = "mcp-proof";
@@ -59842,7 +59970,7 @@ function installProof(io, origin, busBin, busHome2, opts = {}) {
59842
59970
  if (opts.guard) {
59843
59971
  let link2 = false;
59844
59972
  try {
59845
- link2 = lstatSync12(io.file).isSymbolicLink();
59973
+ link2 = lstatSync13(io.file).isSymbolicLink();
59846
59974
  } catch {
59847
59975
  }
59848
59976
  if (link2 || read2(io.file) !== text3)
@@ -59907,7 +60035,7 @@ function proofReport(file2, origin, opts = {}) {
59907
60035
  };
59908
60036
  const doc = read2(file2);
59909
60037
  try {
59910
- report.symlink = lstatSync12(file2).isSymbolicLink();
60038
+ report.symlink = lstatSync13(file2).isSymbolicLink();
59911
60039
  } catch {
59912
60040
  }
59913
60041
  const localNames = /* @__PURE__ */ new Set();
@@ -60270,7 +60398,7 @@ function proxyProgramMissing(doc, which2) {
60270
60398
  init_src();
60271
60399
  import {
60272
60400
  existsSync as existsSync12,
60273
- lstatSync as lstatSync16,
60401
+ lstatSync as lstatSync17,
60274
60402
  readFileSync as readFileSync28,
60275
60403
  realpathSync as realpathSync15,
60276
60404
  rmSync as rmSync16
@@ -60281,7 +60409,7 @@ import { join as join33, resolve as resolve11, sep as sep5 } from "node:path";
60281
60409
  import { createHash as createHash11, randomBytes as randomBytes6 } from "node:crypto";
60282
60410
  import {
60283
60411
  cpSync as cpSync2,
60284
- lstatSync as lstatSync13,
60412
+ lstatSync as lstatSync14,
60285
60413
  mkdirSync as mkdirSync13,
60286
60414
  readdirSync as readdirSync9,
60287
60415
  readFileSync as readFileSync25,
@@ -60294,7 +60422,7 @@ import {
60294
60422
  } from "node:fs";
60295
60423
  import {
60296
60424
  basename as basename9,
60297
- dirname as dirname13,
60425
+ dirname as dirname14,
60298
60426
  isAbsolute as isAbsolute12,
60299
60427
  join as join30,
60300
60428
  relative as relative6,
@@ -60314,7 +60442,7 @@ var real2 = (p) => {
60314
60442
  try {
60315
60443
  return join30(realpathSync12(cur), ...rest.reverse());
60316
60444
  } catch {
60317
- const up = dirname13(cur);
60445
+ const up = dirname14(cur);
60318
60446
  if (up === cur) return p;
60319
60447
  rest.push(basename9(cur));
60320
60448
  cur = up;
@@ -60345,7 +60473,7 @@ function sweepStaging(staging, own2, o = {}) {
60345
60473
  const path = join30(staging, name);
60346
60474
  let old;
60347
60475
  try {
60348
- old = now - lstatSync13(path).mtimeMs > STAGING_STALE_MS;
60476
+ old = now - lstatSync14(path).mtimeMs > STAGING_STALE_MS;
60349
60477
  } catch {
60350
60478
  continue;
60351
60479
  }
@@ -60368,7 +60496,7 @@ function hermesHome(home2, env2, platform = process.platform) {
60368
60496
  const native = nativeHome(home2, env2, platform);
60369
60497
  const v = env2.HERMES_HOME?.trim();
60370
60498
  const given = v ? tilded(home2, v) : void 0;
60371
- if (given !== void 0 && basename9(dirname13(given)) === "profiles")
60499
+ if (given !== void 0 && basename9(dirname14(given)) === "profiles")
60372
60500
  return given;
60373
60501
  const base3 = given ?? native;
60374
60502
  const root = hermesRoot(home2, env2, platform);
@@ -60377,7 +60505,7 @@ function hermesHome(home2, env2, platform = process.platform) {
60377
60505
  const name = readFileSync25(join30(root, "active_profile"), "utf8").trim().toLowerCase();
60378
60506
  if (name && name !== "default" && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(name)) {
60379
60507
  const dir = join30(root, "profiles", name);
60380
- if (lstatSync13(dir).isDirectory()) return dir;
60508
+ if (lstatSync14(dir).isDirectory()) return dir;
60381
60509
  }
60382
60510
  } catch {
60383
60511
  }
@@ -60388,7 +60516,7 @@ function hermesRoot(home2, env2, platform = process.platform) {
60388
60516
  const v = env2.HERMES_HOME?.trim();
60389
60517
  const given = v ? tilded(home2, v) : void 0;
60390
60518
  if (given === void 0) return native;
60391
- if (basename9(dirname13(given)) === "profiles") return dirname13(dirname13(given));
60519
+ if (basename9(dirname14(given)) === "profiles") return dirname14(dirname14(given));
60392
60520
  const rel = relative6(real2(native), real2(given));
60393
60521
  if (rel === "" || !rel.startsWith("..") && !isAbsolute12(rel)) return native;
60394
60522
  return given;
@@ -60397,7 +60525,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
60397
60525
  const path = join30(hermesRoot(home2, env2, platform), "profiles");
60398
60526
  let isLink3 = false;
60399
60527
  try {
60400
- isLink3 = lstatSync13(path).isSymbolicLink();
60528
+ isLink3 = lstatSync14(path).isSymbolicLink();
60401
60529
  } catch {
60402
60530
  }
60403
60531
  const target2 = () => {
@@ -60405,7 +60533,7 @@ function hermesProfilesScan(home2, env2, platform = process.platform) {
60405
60533
  return realpathSync12(path);
60406
60534
  } catch {
60407
60535
  try {
60408
- return resolve8(dirname13(path), readlinkSync3(path));
60536
+ return resolve8(dirname14(path), readlinkSync3(path));
60409
60537
  } catch {
60410
60538
  return "somewhere else";
60411
60539
  }
@@ -60454,7 +60582,7 @@ var hermesEnv = (home2, env2, platform = process.platform) => ({
60454
60582
  var hermesPluginDir = (home2, env2, platform = process.platform) => join30(hermesHome(home2, env2, platform), "plugins", HERMES_PLUGIN_NAME);
60455
60583
  var kind = (path) => {
60456
60584
  try {
60457
- const st = lstatSync13(path);
60585
+ const st = lstatSync14(path);
60458
60586
  return st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file";
60459
60587
  } catch {
60460
60588
  return void 0;
@@ -60531,7 +60659,7 @@ async function installHermes(deps2) {
60531
60659
  mkdirSync13(plugins2, { recursive: true });
60532
60660
  const staging = join30(plugins2, "..", HERMES_STAGING);
60533
60661
  const own2 = `${process.pid}-${randomBytes6(4).toString("hex")}`;
60534
- const st = lstatSync13(staging, { throwIfNoEntry: false });
60662
+ const st = lstatSync14(staging, { throwIfNoEntry: false });
60535
60663
  if (st !== void 0 && !st.isDirectory())
60536
60664
  throw new Error(
60537
60665
  `${staging} is not a plain folder; remove it and run the install again`
@@ -60611,7 +60739,7 @@ async function hermesEnabled(deps2) {
60611
60739
  // src/steps/openclaw.ts
60612
60740
  import {
60613
60741
  existsSync as existsSync11,
60614
- lstatSync as lstatSync15,
60742
+ lstatSync as lstatSync16,
60615
60743
  readdirSync as readdirSync11,
60616
60744
  readFileSync as readFileSync27,
60617
60745
  realpathSync as realpathSync14,
@@ -60624,7 +60752,7 @@ import { fileURLToPath as fileURLToPath5 } from "node:url";
60624
60752
  import {
60625
60753
  chmodSync as chmodSync19,
60626
60754
  existsSync as existsSync10,
60627
- lstatSync as lstatSync14,
60755
+ lstatSync as lstatSync15,
60628
60756
  mkdirSync as mkdirSync14,
60629
60757
  readdirSync as readdirSync10,
60630
60758
  readFileSync as readFileSync26,
@@ -60633,10 +60761,10 @@ import {
60633
60761
  renameSync as renameSync18,
60634
60762
  rmdirSync as rmdirSync2,
60635
60763
  rmSync as rmSync14,
60636
- statSync as statSync9,
60764
+ statSync as statSync8,
60637
60765
  writeFileSync as writeFileSync17
60638
60766
  } from "node:fs";
60639
- import { dirname as dirname14, join as join31, resolve as resolve9 } from "node:path";
60767
+ import { dirname as dirname15, join as join31, resolve as resolve9 } from "node:path";
60640
60768
  var SKILL_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
60641
60769
  var CODEX_BEGIN = "<!-- BEGIN Open Artifacts skill (managed): edits inside are replaced on reinstall. -->";
60642
60770
  var CODEX_END = "<!-- END Open Artifacts skill -->";
@@ -60728,7 +60856,7 @@ var quotesMarker = (text3) => {
60728
60856
  };
60729
60857
  var lstatOk = (path) => {
60730
60858
  try {
60731
- lstatSync14(path);
60859
+ lstatSync15(path);
60732
60860
  return true;
60733
60861
  } catch {
60734
60862
  return false;
@@ -60736,7 +60864,7 @@ var lstatOk = (path) => {
60736
60864
  };
60737
60865
  var brokenLink = (path) => {
60738
60866
  try {
60739
- return lstatSync14(path).isSymbolicLink() && !existsSync10(path);
60867
+ return lstatSync15(path).isSymbolicLink() && !existsSync10(path);
60740
60868
  } catch {
60741
60869
  return false;
60742
60870
  }
@@ -60779,19 +60907,19 @@ async function fetchSkillText(doFetch, url2) {
60779
60907
  }
60780
60908
  var targetOf = (path) => {
60781
60909
  try {
60782
- return lstatSync14(path).isSymbolicLink() ? realpathSync13(path) : path;
60910
+ return lstatSync15(path).isSymbolicLink() ? realpathSync13(path) : path;
60783
60911
  } catch {
60784
60912
  return path;
60785
60913
  }
60786
60914
  };
60787
60915
  var seq = 0;
60788
60916
  var writeAtomic = (path, text3) => {
60789
- mkdirSync14(dirname14(path), { recursive: true });
60917
+ mkdirSync14(dirname15(path), { recursive: true });
60790
60918
  const tmp = `${path}.oa-${process.pid}-${seq++}.tmp`;
60791
60919
  try {
60792
60920
  let mode;
60793
60921
  try {
60794
- mode = statSync9(path).mode & 4095;
60922
+ mode = statSync8(path).mode & 4095;
60795
60923
  } catch {
60796
60924
  }
60797
60925
  writeFileSync17(tmp, text3);
@@ -60846,14 +60974,14 @@ var realOrResolved = (p) => {
60846
60974
  var placesOf = (p) => {
60847
60975
  const out = [realOrResolved(p)];
60848
60976
  try {
60849
- if (lstatSync14(p).isSymbolicLink())
60850
- out.push(realOrResolved(resolve9(dirname14(p), readlinkSync4(p))));
60977
+ if (lstatSync15(p).isSymbolicLink())
60978
+ out.push(realOrResolved(resolve9(dirname15(p), readlinkSync4(p))));
60851
60979
  } catch {
60852
60980
  }
60853
60981
  return out;
60854
60982
  };
60855
60983
  var codexSkillsShared = (deps2) => {
60856
- const mine = placesOf(dirname14(dirname14(codexSkillFile(deps2, "x"))));
60984
+ const mine = placesOf(dirname15(dirname15(codexSkillFile(deps2, "x"))));
60857
60985
  const theirs = placesOf(skillDir(deps2, "pi"));
60858
60986
  return mine.some((m) => theirs.includes(m));
60859
60987
  };
@@ -60939,7 +61067,7 @@ var installCodex = (deps2, folder, text3, written, notes) => {
60939
61067
  try {
60940
61068
  rmSync14(targetOf(filePath), { force: true });
60941
61069
  try {
60942
- rmdirSync2(dirname14(filePath));
61070
+ rmdirSync2(dirname15(filePath));
60943
61071
  } catch {
60944
61072
  }
60945
61073
  } catch (e) {
@@ -61030,7 +61158,7 @@ var uninstallSkill = (deps2, harnesses = [
61030
61158
  const dir = join31(base3, entry);
61031
61159
  const file2 = join31(dir, "SKILL.md");
61032
61160
  try {
61033
- const st = lstatSync14(dir);
61161
+ const st = lstatSync15(dir);
61034
61162
  if (st.isSymbolicLink()) {
61035
61163
  if (existsSync10(file2))
61036
61164
  notes.push(`Left ${dir} alone: it is a symlinked folder.`);
@@ -61064,7 +61192,7 @@ var uninstallSkill = (deps2, harnesses = [
61064
61192
  } catch (e) {
61065
61193
  fail3(base3, e);
61066
61194
  }
61067
- scan2(join31(dirname14(base3), "skills"));
61195
+ scan2(join31(dirname15(base3), "skills"));
61068
61196
  continue;
61069
61197
  }
61070
61198
  scan2(base3);
@@ -61076,7 +61204,7 @@ var codexSkillState = (deps2) => {
61076
61204
  shared: codexSkillsShared(deps2)
61077
61205
  };
61078
61206
  try {
61079
- const dir = join31(dirname14(skillDir(deps2, "codex")), "skills");
61207
+ const dir = join31(dirname15(skillDir(deps2, "codex")), "skills");
61080
61208
  for (const entry of readdirSync10(dir)) {
61081
61209
  const file2 = join31(dir, entry, "SKILL.md");
61082
61210
  if (ourSkillFile(file2, entry)) {
@@ -61163,7 +61291,7 @@ var openclawEnv = (home2, env2) => ({
61163
61291
  var openclawNix = (env2) => env2?.OPENCLAW_NIX_MODE === "1";
61164
61292
  var kind2 = (path) => {
61165
61293
  try {
61166
- const st = lstatSync15(path);
61294
+ const st = lstatSync16(path);
61167
61295
  return st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file";
61168
61296
  } catch {
61169
61297
  return void 0;
@@ -61507,7 +61635,7 @@ function withHabits(existing, block, added) {
61507
61635
  var reason = (e) => e instanceof Error ? e.message : String(e);
61508
61636
  var isLink = (path) => {
61509
61637
  try {
61510
- return lstatSync16(path).isSymbolicLink();
61638
+ return lstatSync17(path).isSymbolicLink();
61511
61639
  } catch {
61512
61640
  return false;
61513
61641
  }
@@ -61686,7 +61814,7 @@ var pluginPaths = (deps2, p) => {
61686
61814
  };
61687
61815
  var pluginOurs = (dir, p) => {
61688
61816
  try {
61689
- return lstatSync16(dir).isDirectory() && p.ours(dir);
61817
+ return lstatSync17(dir).isDirectory() && p.ours(dir);
61690
61818
  } catch {
61691
61819
  return false;
61692
61820
  }
@@ -61695,7 +61823,7 @@ function pluginHabitsState(deps2, p) {
61695
61823
  const { dir, marker } = pluginPaths(deps2, p);
61696
61824
  if (!pluginOurs(dir, p)) return "not installed";
61697
61825
  try {
61698
- return lstatSync16(marker).isFile() ? "on" : "off";
61826
+ return lstatSync17(marker).isFile() ? "on" : "off";
61699
61827
  } catch {
61700
61828
  return "off";
61701
61829
  }
@@ -61831,7 +61959,7 @@ function setPluginHabits(deps2, plugins2, on) {
61831
61959
  }
61832
61960
  var probe = (path) => {
61833
61961
  try {
61834
- const st = lstatSync16(path);
61962
+ const st = lstatSync17(path);
61835
61963
  return {
61836
61964
  k: st.isSymbolicLink() ? "link" : st.isDirectory() ? "dir" : "file"
61837
61965
  };
@@ -61862,7 +61990,7 @@ var habitsQuestionLines = (q) => [
61862
61990
 
61863
61991
  // src/steps/opencode-proof.ts
61864
61992
  import { existsSync as existsSync13, readFileSync as readFileSync29, rmSync as rmSync17 } from "node:fs";
61865
- import { dirname as dirname15, isAbsolute as isAbsolute13, join as join34, resolve as resolve12 } from "node:path";
61993
+ import { dirname as dirname16, isAbsolute as isAbsolute13, join as join34, resolve as resolve12 } from "node:path";
61866
61994
  init_src();
61867
61995
  var OPENCODE_ENTRY_FILE = "opencode-mcp-entry.json";
61868
61996
  var isRecord5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
@@ -61905,7 +62033,7 @@ var REMOTE_ONLY = /* @__PURE__ */ new Set(["type", "url", "headers", "oauth"]);
61905
62033
  function resolveTokenFile(x, configFile, home2) {
61906
62034
  if (x === "~") return home2;
61907
62035
  if (x.startsWith("~/")) return join34(home2, x.slice(2));
61908
- return isAbsolute13(x) ? x : resolve12(dirname15(configFile), x);
62036
+ return isAbsolute13(x) ? x : resolve12(dirname16(configFile), x);
61909
62037
  }
61910
62038
  var proxyEntry = (io, origin, tokenFile, entry) => {
61911
62039
  const kept = Object.fromEntries(
@@ -62280,7 +62408,7 @@ function readDoc(path) {
62280
62408
  }
62281
62409
  function present2(path) {
62282
62410
  try {
62283
- lstatSync17(path);
62411
+ lstatSync18(path);
62284
62412
  return true;
62285
62413
  } catch {
62286
62414
  return false;
@@ -62289,24 +62417,24 @@ function present2(path) {
62289
62417
  function target(path) {
62290
62418
  let p = path;
62291
62419
  for (let hops = 0; hops < 40; hops++) {
62292
- if (!present2(p) || !lstatSync17(p).isSymbolicLink()) {
62293
- if (p !== path && !existsSync15(dirname16(p)))
62420
+ if (!present2(p) || !lstatSync18(p).isSymbolicLink()) {
62421
+ if (p !== path && !existsSync15(dirname17(p)))
62294
62422
  throw new Error(
62295
62423
  `${path} is a dangling symlink to ${p}; left it untouched`
62296
62424
  );
62297
62425
  return p;
62298
62426
  }
62299
- p = resolve13(dirname16(p), readlinkSync5(p));
62427
+ p = resolve13(dirname17(p), readlinkSync5(p));
62300
62428
  }
62301
62429
  throw new Error(`${path}: too many symlinks; left it untouched`);
62302
62430
  }
62303
62431
  function writeAtomic2(path, data, mode) {
62304
62432
  const dest = target(path);
62305
- mkdirSync15(dirname16(dest), { recursive: true });
62433
+ mkdirSync15(dirname17(dest), { recursive: true });
62306
62434
  let m = mode ?? 420;
62307
62435
  if (mode === void 0)
62308
62436
  try {
62309
- m = statSync10(dest).mode & 511;
62437
+ m = statSync9(dest).mode & 511;
62310
62438
  } catch {
62311
62439
  }
62312
62440
  const tmp = `${dest}.${process.pid}.${randomBytes7(4).toString("hex")}.tmp`;
@@ -62680,7 +62808,7 @@ var install = {
62680
62808
  if (next !== text3) {
62681
62809
  const bak = `${p.codex}.oa-bus.bak`;
62682
62810
  if (text3 !== "" && !present2(bak))
62683
- writeAtomic2(bak, text3, statSync10(dest).mode & 511);
62811
+ writeAtomic2(bak, text3, statSync9(dest).mode & 511);
62684
62812
  writeAtomic2(p.codex, next);
62685
62813
  }
62686
62814
  const bin = findCodexBin({ path: deps2.env?.PATH, app: deps2.codexApp });
@@ -63032,8 +63160,8 @@ function recordClaudeProof(deps2) {
63032
63160
  import {
63033
63161
  accessSync as accessSync2,
63034
63162
  chmodSync as chmodSync21,
63035
- constants as constants6,
63036
- lstatSync as lstatSync18,
63163
+ constants as constants7,
63164
+ lstatSync as lstatSync19,
63037
63165
  mkdirSync as mkdirSync16,
63038
63166
  readFileSync as readFileSync32,
63039
63167
  readlinkSync as readlinkSync6,
@@ -63041,7 +63169,7 @@ import {
63041
63169
  rmSync as rmSync20,
63042
63170
  writeFileSync as writeFileSync19
63043
63171
  } from "node:fs";
63044
- import { delimiter as delimiter3, dirname as dirname17, join as join36, resolve as resolve14, sep as sep6 } from "node:path";
63172
+ import { delimiter as delimiter3, dirname as dirname18, join as join36, resolve as resolve14, sep as sep6 } from "node:path";
63045
63173
  var SHIM_MARKER = "# oa-bus shim: written by oa-bus install";
63046
63174
  var HOME_PREFIX = "# oa-bus home: ";
63047
63175
  var NAME2 = "oa-bus";
@@ -63064,13 +63192,13 @@ function shimText(o) {
63064
63192
  function ownerOf(file2, busHome2) {
63065
63193
  let st;
63066
63194
  try {
63067
- st = lstatSync18(file2);
63195
+ st = lstatSync19(file2);
63068
63196
  } catch {
63069
63197
  return void 0;
63070
63198
  }
63071
63199
  if (st.isSymbolicLink()) {
63072
63200
  try {
63073
- const to = resolve14(dirname17(file2), readlinkSync6(file2));
63201
+ const to = resolve14(dirname18(file2), readlinkSync6(file2));
63074
63202
  const home2 = resolve14(busHome2);
63075
63203
  return to === home2 || to.startsWith(`${home2}/`) ? { ours: true, home: home2 } : { ours: false };
63076
63204
  } catch {
@@ -63141,8 +63269,8 @@ function removeShim(o) {
63141
63269
  }
63142
63270
  var executable2 = (f) => {
63143
63271
  try {
63144
- accessSync2(f, constants6.X_OK);
63145
- return lstatSync18(f).isFile() || lstatSync18(f).isSymbolicLink();
63272
+ accessSync2(f, constants7.X_OK);
63273
+ return lstatSync19(f).isFile() || lstatSync19(f).isSymbolicLink();
63146
63274
  } catch {
63147
63275
  return false;
63148
63276
  }
@@ -63581,7 +63709,7 @@ import { join as join40 } from "node:path";
63581
63709
  import { fileURLToPath as fileURLToPath6 } from "node:url";
63582
63710
 
63583
63711
  // src/machine.ts
63584
- import { readFileSync as readFileSync33, statSync as statSync11 } from "node:fs";
63712
+ import { readFileSync as readFileSync33, statSync as statSync10 } from "node:fs";
63585
63713
  import { join as join38 } from "node:path";
63586
63714
  init_src();
63587
63715
  function readMachine(home2) {
@@ -63589,7 +63717,7 @@ function readMachine(home2) {
63589
63717
  let text3;
63590
63718
  let mode;
63591
63719
  try {
63592
- mode = statSync11(file2).mode;
63720
+ mode = statSync10(file2).mode;
63593
63721
  text3 = readFileSync33(file2, "utf8");
63594
63722
  } catch (e) {
63595
63723
  return e.code === "ENOENT" ? { state: "missing" } : { state: "bad" };
@@ -63845,13 +63973,13 @@ import { join as join42 } from "node:path";
63845
63973
 
63846
63974
  // src/steps/output-style.ts
63847
63975
  import {
63848
- lstatSync as lstatSync19,
63976
+ lstatSync as lstatSync20,
63849
63977
  readdirSync as readdirSync12,
63850
63978
  readFileSync as readFileSync35,
63851
63979
  rmdirSync as rmdirSync3,
63852
63980
  rmSync as rmSync22
63853
63981
  } from "node:fs";
63854
- import { dirname as dirname18, join as join41 } from "node:path";
63982
+ import { dirname as dirname19, join as join41 } from "node:path";
63855
63983
  var OUTPUT_STYLE_FILE = "artifacts-teammate.md";
63856
63984
  var OUTPUT_STYLE_MARKER = "<!-- managed by the Open Artifacts bus installer: edits are replaced on reinstall. -->";
63857
63985
  var OUTPUT_STYLE_NAME = "Artifacts Teammate";
@@ -63872,14 +64000,14 @@ var isOurs2 = (text3) => {
63872
64000
  };
63873
64001
  var isLink2 = (path) => {
63874
64002
  try {
63875
- return lstatSync19(path).isSymbolicLink();
64003
+ return lstatSync20(path).isSymbolicLink();
63876
64004
  } catch {
63877
64005
  return false;
63878
64006
  }
63879
64007
  };
63880
64008
  var exists = (path) => {
63881
64009
  try {
63882
- lstatSync19(path);
64010
+ lstatSync20(path);
63883
64011
  return true;
63884
64012
  } catch {
63885
64013
  return false;
@@ -64062,7 +64190,7 @@ var outputStyleOn = (deps2) => {
64062
64190
  var outputStyleState = (deps2) => {
64063
64191
  const path = outputStyleFile(deps2);
64064
64192
  try {
64065
- if (isLink2(dirname18(path)) || isLink2(path)) return void 0;
64193
+ if (isLink2(dirname19(path)) || isLink2(path)) return void 0;
64066
64194
  if (!isOurs2(readFileSync35(path, "utf8"))) return void 0;
64067
64195
  const s = readSettings(claudeSettingsFile(deps2));
64068
64196
  return { path, on: s.ok && s.style === OUTPUT_STYLE_NAME };
@@ -64933,7 +65061,7 @@ function habitsLine(ctx) {
64933
65061
  }
64934
65062
 
64935
65063
  // src/commands/namespace.ts
64936
- import { realpathSync as realpathSync16, statSync as statSync12 } from "node:fs";
65064
+ import { realpathSync as realpathSync16, statSync as statSync11 } from "node:fs";
64937
65065
  import { join as join45, resolve as resolve15 } from "node:path";
64938
65066
  init_src();
64939
65067
  function shown3(ctx, path) {
@@ -65001,7 +65129,7 @@ async function namespace(opts, ctx) {
65001
65129
  say(ctx, c.nsRevoked(shown3(ctx, real3 ?? given) + at));
65002
65130
  return 0;
65003
65131
  }
65004
- if (!real3 || !statSync12(real3).isDirectory()) {
65132
+ if (!real3 || !statSync11(real3).isDirectory()) {
65005
65133
  sayErr(ctx, c.nsNotDir(shown3(ctx, real3 ?? given)));
65006
65134
  return 1;
65007
65135
  }
@@ -65084,7 +65212,7 @@ init_src();
65084
65212
 
65085
65213
  // src/commands/install.ts
65086
65214
  init_src3();
65087
- import { dirname as dirname19, join as join47 } from "node:path";
65215
+ import { dirname as dirname20, join as join47 } from "node:path";
65088
65216
  init_src2();
65089
65217
 
65090
65218
  // src/live.ts
@@ -65135,7 +65263,7 @@ function spinner(ctx) {
65135
65263
 
65136
65264
  // src/steps/leftovers.ts
65137
65265
  import {
65138
- lstatSync as lstatSync20,
65266
+ lstatSync as lstatSync21,
65139
65267
  readdirSync as readdirSync13,
65140
65268
  readFileSync as readFileSync38,
65141
65269
  rmdirSync as rmdirSync4,
@@ -65169,7 +65297,7 @@ function leftoverTargets(deps2) {
65169
65297
  }
65170
65298
  var exists2 = (path) => {
65171
65299
  try {
65172
- lstatSync20(path);
65300
+ lstatSync21(path);
65173
65301
  return true;
65174
65302
  } catch {
65175
65303
  return false;
@@ -65202,7 +65330,7 @@ function pruneMade(deps2) {
65202
65330
  }
65203
65331
  function emptyFile(path) {
65204
65332
  try {
65205
- const st = lstatSync20(path);
65333
+ const st = lstatSync21(path);
65206
65334
  if (!st.isFile()) return false;
65207
65335
  if (st.size === 0) return true;
65208
65336
  const doc = JSON.parse(readFileSync38(path, "utf8"));
@@ -65221,7 +65349,7 @@ function removeMade(made) {
65221
65349
  }
65222
65350
  for (const path of made.filter((x) => !gone.includes(x)).sort((a, b) => b.length - a.length)) {
65223
65351
  try {
65224
- if (!lstatSync20(path).isDirectory()) continue;
65352
+ if (!lstatSync21(path).isDirectory()) continue;
65225
65353
  if (readdirSync13(path).length > 0) continue;
65226
65354
  rmdirSync4(path);
65227
65355
  gone.push(path);
@@ -65621,7 +65749,7 @@ function reportShim(ctx) {
65621
65749
  if (r.kind === "installed") {
65622
65750
  say(ctx, ctx.copy.shimInstalled(tilde(ctx, r.path)));
65623
65751
  if (!r.onPath && r.hint)
65624
- say(ctx, ctx.copy.shimNotOnPath(tilde(ctx, dirname19(r.path)), r.hint));
65752
+ say(ctx, ctx.copy.shimNotOnPath(tilde(ctx, dirname20(r.path)), r.hint));
65625
65753
  } else if (r.kind === "other-home")
65626
65754
  say(ctx, ctx.copy.shimOtherHome(tilde(ctx, r.path), tilde(ctx, r.home)));
65627
65755
  else if (r.kind === "foreign")
@@ -66175,7 +66303,7 @@ async function doctor(ctx) {
66175
66303
  }
66176
66304
 
66177
66305
  // src/commands/global.ts
66178
- import { realpathSync as realpathSync17, statSync as statSync13 } from "node:fs";
66306
+ import { realpathSync as realpathSync17, statSync as statSync12 } from "node:fs";
66179
66307
  import { resolve as resolve16 } from "node:path";
66180
66308
  function shown4(ctx, path) {
66181
66309
  const t = tilde(ctx, path);
@@ -66209,7 +66337,7 @@ async function global(opts, ctx) {
66209
66337
  } catch {
66210
66338
  }
66211
66339
  if (opts.sub === "add") {
66212
- if (!real3 || !statSync13(real3).isDirectory()) {
66340
+ if (!real3 || !statSync12(real3).isDirectory()) {
66213
66341
  sayErr(ctx, c.globalNotDir(shown4(ctx, real3 ?? given)));
66214
66342
  return 1;
66215
66343
  }
@@ -66297,14 +66425,14 @@ async function leads(opts, ctx) {
66297
66425
  }
66298
66426
 
66299
66427
  // src/commands/link.ts
66300
- import { statSync as statSync14 } from "node:fs";
66428
+ import { statSync as statSync13 } from "node:fs";
66301
66429
  import { resolve as resolve17 } from "node:path";
66302
66430
  init_src();
66303
66431
  function side(ctx, dir) {
66304
66432
  const given = resolve17(ctx.cwd, dir);
66305
66433
  try {
66306
66434
  const real3 = canonicalPath(given);
66307
- if (!statSync14(real3).isDirectory()) return void 0;
66435
+ if (!statSync13(real3).isDirectory()) return void 0;
66308
66436
  const ns = resolveNamespace(real3, {
66309
66437
  globalFile: globalFile(ctx.home),
66310
66438
  namespacesFile: approvalsFileFor(ctx, real3),
@@ -66394,18 +66522,18 @@ async function link(opts, ctx) {
66394
66522
  // src/commands/logs.ts
66395
66523
  import {
66396
66524
  closeSync as closeSync11,
66397
- constants as constants7,
66398
- fstatSync as fstatSync5,
66399
- lstatSync as lstatSync21,
66525
+ constants as constants8,
66526
+ fstatSync as fstatSync6,
66527
+ lstatSync as lstatSync22,
66400
66528
  openSync as openSync11,
66401
66529
  readFileSync as readFileSync41
66402
66530
  } from "node:fs";
66403
- import { dirname as dirname20, join as join50 } from "node:path";
66531
+ import { dirname as dirname21, join as join50 } from "node:path";
66404
66532
  var TAIL = 50;
66405
- var checkDir = (dir) => {
66533
+ var checkDir2 = (dir) => {
66406
66534
  let fd;
66407
66535
  try {
66408
- const ls = lstatSync21(dir);
66536
+ const ls = lstatSync22(dir);
66409
66537
  if (ls.isSymbolicLink()) return { ok: false, why: "it is a symlink" };
66410
66538
  if (!ls.isDirectory()) return { ok: false, why: "it is not a folder" };
66411
66539
  if (typeof process.getuid === "function" && ls.uid !== process.getuid())
@@ -66414,9 +66542,9 @@ var checkDir = (dir) => {
66414
66542
  return { ok: false, why: "it is open to other users (want mode 0700)" };
66415
66543
  fd = openSync11(
66416
66544
  dir,
66417
- constants7.O_RDONLY | constants7.O_DIRECTORY | constants7.O_NOFOLLOW
66545
+ constants8.O_RDONLY | constants8.O_DIRECTORY | constants8.O_NOFOLLOW
66418
66546
  );
66419
- const fs = fstatSync5(fd);
66547
+ const fs = fstatSync6(fd);
66420
66548
  if (fs.dev !== ls.dev || fs.ino !== ls.ino)
66421
66549
  return { ok: false, why: "it changed while it was checked" };
66422
66550
  return { ok: true, dev: fs.dev, ino: fs.ino };
@@ -66431,10 +66559,10 @@ var tail = (path, dir) => {
66431
66559
  try {
66432
66560
  fd = openSync11(
66433
66561
  path,
66434
- constants7.O_RDONLY | constants7.O_NOFOLLOW | constants7.O_NONBLOCK
66562
+ constants8.O_RDONLY | constants8.O_NOFOLLOW | constants8.O_NONBLOCK
66435
66563
  );
66436
- if (!fstatSync5(fd).isFile()) return "skipped";
66437
- const after = lstatSync21(dirname20(path));
66564
+ if (!fstatSync6(fd).isFile()) return "skipped";
66565
+ const after = lstatSync22(dirname21(path));
66438
66566
  if (after.isSymbolicLink() || after.dev !== dir.dev || after.ino !== dir.ino)
66439
66567
  return "skipped";
66440
66568
  return readFileSync41(fd, "utf8").replace(/\n$/, "").split("\n").slice(-TAIL);
@@ -66448,7 +66576,7 @@ async function logs(ctx) {
66448
66576
  const logDir = join50(ctx.home, "logs");
66449
66577
  const path = join50(logDir, "daemon.log");
66450
66578
  const eventsPath = join50(logDir, "events.log");
66451
- const dir = checkDir(logDir);
66579
+ const dir = checkDir2(logDir);
66452
66580
  if (!dir.ok && dir.why !== "missing") {
66453
66581
  say(ctx, `Not reading ${tilde(ctx, logDir)}: ${dir.why}.`);
66454
66582
  return 1;
@@ -66670,7 +66798,7 @@ import { join as join53 } from "node:path";
66670
66798
 
66671
66799
  // src/steps/purge.ts
66672
66800
  init_src3();
66673
- import { lstatSync as lstatSync22, readdirSync as readdirSync14, rmdirSync as rmdirSync5, rmSync as rmSync24 } from "node:fs";
66801
+ import { lstatSync as lstatSync23, readdirSync as readdirSync14, rmdirSync as rmdirSync5, rmSync as rmSync24 } from "node:fs";
66674
66802
  import { join as join52 } from "node:path";
66675
66803
  var FILES = [
66676
66804
  "machine.json",
@@ -66724,7 +66852,7 @@ var FOLDERS = [
66724
66852
  ];
66725
66853
  function kind3(path) {
66726
66854
  try {
66727
- const st = lstatSync22(path);
66855
+ const st = lstatSync23(path);
66728
66856
  return st.isDirectory() ? "dir" : st.isSocket() ? "socket" : "other";
66729
66857
  } catch {
66730
66858
  return void 0;