minimal-forge-work-pack-sync 0.1.8 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.js +211 -163
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7415,6 +7415,7 @@ function resolveOpenCodeDir(home, platform, env, exists, pathApi) {
7415
7415
 
7416
7416
  // packages/cli/src/report.ts
7417
7417
  import os2 from "node:os";
7418
+ var AGENT_VERSION = "0.1.0";
7418
7419
  async function reportFailure(credentials, kind, error) {
7419
7420
  try {
7420
7421
  const message = error instanceof Error ? error.message : String(error);
@@ -7424,7 +7425,7 @@ async function reportFailure(credentials, kind, error) {
7424
7425
  authorization: `Bearer ${credentials.forgeApiKey}`,
7425
7426
  "content-type": "application/json",
7426
7427
  "x-forge-hostname": os2.hostname(),
7427
- "x-forge-agent-version": "0.1.0"
7428
+ "x-forge-agent-version": AGENT_VERSION
7428
7429
  },
7429
7430
  body: JSON.stringify({
7430
7431
  kind,
@@ -7437,6 +7438,23 @@ async function reportFailure(credentials, kind, error) {
7437
7438
  console.error("[Forge] Failed to report failure to Forge server:", error2 instanceof Error ? error2.message : String(error2));
7438
7439
  }
7439
7440
  }
7441
+ async function reportWorkPackObservations(credentials, kind, workPacks) {
7442
+ try {
7443
+ await fetch(`${credentials.forgeBaseUrl.replace(/\/$/, "")}/sync/report`, {
7444
+ method: "POST",
7445
+ headers: {
7446
+ authorization: `Bearer ${credentials.forgeApiKey}`,
7447
+ "content-type": "application/json",
7448
+ "x-forge-hostname": os2.hostname(),
7449
+ "x-forge-agent-version": AGENT_VERSION
7450
+ },
7451
+ body: JSON.stringify({ kind, ok: true, workPacks }),
7452
+ signal: AbortSignal.timeout(3e3)
7453
+ });
7454
+ } catch (error) {
7455
+ console.error("[Forge] Failed to report Work Pack state to Forge server:", error instanceof Error ? error.message : String(error));
7456
+ }
7457
+ }
7440
7458
 
7441
7459
  // packages/cli/src/sync.ts
7442
7460
  import { createHash } from "node:crypto";
@@ -7460,7 +7478,7 @@ import * as Ps from "zlib";
7460
7478
  import en from "zlib";
7461
7479
  import { posix as Zt } from "node:path";
7462
7480
  import { basename as _n } from "node:path";
7463
- import ui from "fs";
7481
+ import mi from "fs";
7464
7482
  import X from "fs";
7465
7483
  import js from "path";
7466
7484
  import { win32 as Pn } from "node:path";
@@ -7468,7 +7486,7 @@ import ar from "path";
7468
7486
  import Br from "node:fs";
7469
7487
  import co from "node:assert";
7470
7488
  import { randomBytes as Mr } from "node:crypto";
7471
- import m from "node:fs";
7489
+ import u from "node:fs";
7472
7490
  import R from "node:path";
7473
7491
  import pr from "fs";
7474
7492
  import wi from "node:fs";
@@ -7507,7 +7525,7 @@ var _ = /* @__PURE__ */ Symbol("bufferLength");
7507
7525
  var bi = /* @__PURE__ */ Symbol("bufferPush");
7508
7526
  var Ie = /* @__PURE__ */ Symbol("bufferShift");
7509
7527
  var L = /* @__PURE__ */ Symbol("objectMode");
7510
- var w = /* @__PURE__ */ Symbol("destroyed");
7528
+ var S = /* @__PURE__ */ Symbol("destroyed");
7511
7529
  var _i = /* @__PURE__ */ Symbol("error");
7512
7530
  var Oi = /* @__PURE__ */ Symbol("emitData");
7513
7531
  var Is = /* @__PURE__ */ Symbol("emitEnd");
@@ -7565,7 +7583,7 @@ var A = class extends Di {
7565
7583
  [Ne] = false;
7566
7584
  [qt] = null;
7567
7585
  [_] = 0;
7568
- [w] = false;
7586
+ [S] = false;
7569
7587
  [Jt];
7570
7588
  [Ce] = false;
7571
7589
  [Rt] = 0;
@@ -7614,7 +7632,7 @@ var A = class extends Di {
7614
7632
  write(t, e, i) {
7615
7633
  if (this[Ce]) return false;
7616
7634
  if (this[Q]) throw new Error("write after end");
7617
- if (this[w]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
7635
+ if (this[S]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
7618
7636
  typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
7619
7637
  let r = this[Z] ? jt : Yr;
7620
7638
  if (!this[L] && !Buffer.isBuffer(t)) {
@@ -7625,7 +7643,7 @@ var A = class extends Di {
7625
7643
  return this[L] ? (this[g] && this[_] !== 0 && this[Ae](true), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && !(e === this[z] && !this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[Ae](true), this[g] ? this.emit("data", t) : this[bi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
7626
7644
  }
7627
7645
  read(t) {
7628
- if (this[w]) return null;
7646
+ if (this[S]) return null;
7629
7647
  if (this[C] = false, this[_] === 0 || t === 0 || t && t > this[_]) return this[J](), null;
7630
7648
  this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
7631
7649
  let e = this[Ns](t || null, this[b][0]);
@@ -7643,7 +7661,7 @@ var A = class extends Di {
7643
7661
  return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = "utf8"), t !== void 0 && this.write(t, e), i && this.once("end", i), this[Q] = true, this.writable = false, (this[g] || !this[Qt]) && this[J](), this;
7644
7662
  }
7645
7663
  [Bt]() {
7646
- this[w] || (!this[Rt] && !this[N].length && (this[C] = true), this[Qt] = false, this[g] = true, this.emit("resume"), this[b].length ? this[Ae]() : this[Q] ? this[J]() : this.emit("drain"));
7664
+ this[S] || (!this[Rt] && !this[N].length && (this[C] = true), this[Qt] = false, this[g] = true, this.emit("resume"), this[b].length ? this[Ae]() : this[Q] ? this[J]() : this.emit("drain"));
7647
7665
  }
7648
7666
  resume() {
7649
7667
  return this[Bt]();
@@ -7652,7 +7670,7 @@ var A = class extends Di {
7652
7670
  this[g] = false, this[Qt] = true, this[C] = false;
7653
7671
  }
7654
7672
  get destroyed() {
7655
- return this[w];
7673
+ return this[S];
7656
7674
  }
7657
7675
  get flowing() {
7658
7676
  return this[g];
@@ -7676,7 +7694,7 @@ var A = class extends Di {
7676
7694
  return this.emit("data", t), this[g];
7677
7695
  }
7678
7696
  pipe(t, e) {
7679
- if (this[w]) return t;
7697
+ if (this[S]) return t;
7680
7698
  this[C] = false;
7681
7699
  let i = this[nt];
7682
7700
  return e = e || {}, t === Ds.stdout || t === Ds.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this[N].push(e.proxyErrors ? new Li(this, t, e) : new Fe(this, t, e)), this[Z] ? jt(() => this[Bt]()) : this[Bt]()), t;
@@ -7714,15 +7732,15 @@ var A = class extends Di {
7714
7732
  return this[nt];
7715
7733
  }
7716
7734
  [J]() {
7717
- !this[De] && !this[nt] && !this[w] && this[b].length === 0 && this[Q] && (this[De] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Ne] && this.emit("close"), this[De] = false);
7735
+ !this[De] && !this[nt] && !this[S] && this[b].length === 0 && this[Q] && (this[De] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Ne] && this.emit("close"), this[De] = false);
7718
7736
  }
7719
7737
  emit(t, ...e) {
7720
7738
  let i = e[0];
7721
- if (t !== "error" && t !== "close" && t !== w && this[w]) return false;
7739
+ if (t !== "error" && t !== "close" && t !== S && this[S]) return false;
7722
7740
  if (t === "data") return !this[L] && !i ? false : this[Z] ? (jt(() => this[Oi](i)), true) : this[Oi](i);
7723
7741
  if (t === "end") return this[Is]();
7724
7742
  if (t === "close") {
7725
- if (this[Ne] = true, !this[nt] && !this[w]) return false;
7743
+ if (this[Ne] = true, !this[nt] && !this[S]) return false;
7726
7744
  let n = super.emit("close");
7727
7745
  return this.removeAllListeners("close"), n;
7728
7746
  } else if (t === "error") {
@@ -7774,7 +7792,7 @@ var A = class extends Di {
7774
7792
  }
7775
7793
  async promise() {
7776
7794
  return new Promise((t, e) => {
7777
- this.on(w, () => e(new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
7795
+ this.on(S, () => e(new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
7778
7796
  });
7779
7797
  }
7780
7798
  [Symbol.asyncIterator]() {
@@ -7786,14 +7804,14 @@ var A = class extends Di {
7786
7804
  if (r !== null) return Promise.resolve({ done: false, value: r });
7787
7805
  if (this[Q]) return e();
7788
7806
  let n, o, h = (d) => {
7789
- this.off("data", a), this.off("end", l), this.off(w, c), e(), o(d);
7807
+ this.off("data", a), this.off("end", l), this.off(S, c), e(), o(d);
7790
7808
  }, a = (d) => {
7791
- this.off("error", h), this.off("end", l), this.off(w, c), this.pause(), n({ value: d, done: !!this[Q] });
7809
+ this.off("error", h), this.off("end", l), this.off(S, c), this.pause(), n({ value: d, done: !!this[Q] });
7792
7810
  }, l = () => {
7793
- this.off("error", h), this.off("data", a), this.off(w, c), e(), n({ done: true, value: void 0 });
7811
+ this.off("error", h), this.off("data", a), this.off(S, c), e(), n({ done: true, value: void 0 });
7794
7812
  }, c = () => h(new Error("stream destroyed"));
7795
- return new Promise((d, S) => {
7796
- o = S, n = d, this.once(w, c), this.once("error", h), this.once("end", l), this.once("data", a);
7813
+ return new Promise((d, y) => {
7814
+ o = y, n = d, this.once(S, c), this.once("error", h), this.once("end", l), this.once("data", a);
7797
7815
  });
7798
7816
  }, throw: e, return: e, [Symbol.asyncIterator]() {
7799
7817
  return this;
@@ -7802,21 +7820,21 @@ var A = class extends Di {
7802
7820
  }
7803
7821
  [Symbol.iterator]() {
7804
7822
  this[C] = false;
7805
- let t = false, e = () => (this.pause(), this.off(_i, e), this.off(w, e), this.off("end", e), t = true, { done: true, value: void 0 }), i = () => {
7823
+ let t = false, e = () => (this.pause(), this.off(_i, e), this.off(S, e), this.off("end", e), t = true, { done: true, value: void 0 }), i = () => {
7806
7824
  if (t) return e();
7807
7825
  let r = this.read();
7808
7826
  return r === null ? e() : { done: false, value: r };
7809
7827
  };
7810
- return this.once("end", e), this.once(_i, e), this.once(w, e), { next: i, throw: e, return: e, [Symbol.iterator]() {
7828
+ return this.once("end", e), this.once(_i, e), this.once(S, e), { next: i, throw: e, return: e, [Symbol.iterator]() {
7811
7829
  return this;
7812
7830
  }, [Symbol.dispose]: () => {
7813
7831
  } };
7814
7832
  }
7815
7833
  destroy(t) {
7816
- if (this[w]) return t ? this.emit("error", t) : this.emit(w), this;
7817
- this[w] = true, this[C] = true, this[b].length = 0, this[_] = 0;
7834
+ if (this[S]) return t ? this.emit("error", t) : this.emit(S), this;
7835
+ this[S] = true, this[C] = true, this[b].length = 0, this[_] = 0;
7818
7836
  let e = this;
7819
- return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(w), this;
7837
+ return typeof e.close == "function" && !this[Ne] && e.close(), t ? this.emit("error", t) : this.emit(S), this;
7820
7838
  }
7821
7839
  static get isStream() {
7822
7840
  return Wr;
@@ -7826,7 +7844,7 @@ var Jr = I.writev;
7826
7844
  var ht = /* @__PURE__ */ Symbol("_autoClose");
7827
7845
  var H = /* @__PURE__ */ Symbol("_close");
7828
7846
  var te = /* @__PURE__ */ Symbol("_ended");
7829
- var u = /* @__PURE__ */ Symbol("_fd");
7847
+ var m = /* @__PURE__ */ Symbol("_fd");
7830
7848
  var Ni = /* @__PURE__ */ Symbol("_finished");
7831
7849
  var tt = /* @__PURE__ */ Symbol("_flags");
7832
7850
  var Ai = /* @__PURE__ */ Symbol("_flush");
@@ -7853,7 +7871,7 @@ var Me = /* @__PURE__ */ Symbol("_defaultFlag");
7853
7871
  var bt = /* @__PURE__ */ Symbol("_errored");
7854
7872
  var _t = class extends A {
7855
7873
  [bt] = false;
7856
- [u];
7874
+ [m];
7857
7875
  [U];
7858
7876
  [Ci];
7859
7877
  [j] = false;
@@ -7862,10 +7880,10 @@ var _t = class extends A {
7862
7880
  [ht];
7863
7881
  constructor(t, e) {
7864
7882
  if (e = e || {}, super(e), this.readable = true, this.writable = false, typeof t != "string") throw new TypeError("path must be a string");
7865
- this[bt] = false, this[u] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ci] = e.readSize || 16 * 1024 * 1024, this[j] = false, this[Fi] = typeof e.size == "number" ? e.size : 1 / 0, this[ee] = this[Fi], this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : true, typeof this[u] == "number" ? this[zt]() : this[at]();
7883
+ this[bt] = false, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[U] = t, this[Ci] = e.readSize || 16 * 1024 * 1024, this[j] = false, this[Fi] = typeof e.size == "number" ? e.size : 1 / 0, this[ee] = this[Fi], this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : true, typeof this[m] == "number" ? this[zt]() : this[at]();
7866
7884
  }
7867
7885
  get fd() {
7868
- return this[u];
7886
+ return this[m];
7869
7887
  }
7870
7888
  get path() {
7871
7889
  return this[U];
@@ -7880,7 +7898,7 @@ var _t = class extends A {
7880
7898
  I.open(this[U], "r", (t, e) => this[Ht](t, e));
7881
7899
  }
7882
7900
  [Ht](t, e) {
7883
- t ? this[Ut](t) : (this[u] = e, this.emit("open", e), this[zt]());
7901
+ t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[zt]());
7884
7902
  }
7885
7903
  [vi]() {
7886
7904
  return Buffer.allocUnsafe(Math.min(this[Ci], this[ee]));
@@ -7890,16 +7908,16 @@ var _t = class extends A {
7890
7908
  this[j] = true;
7891
7909
  let t = this[vi]();
7892
7910
  if (t.length === 0) return process.nextTick(() => this[Ii](null, 0, t));
7893
- I.read(this[u], t, 0, t.length, null, (e, i, r) => this[Ii](e, i, r));
7911
+ I.read(this[m], t, 0, t.length, null, (e, i, r) => this[Ii](e, i, r));
7894
7912
  }
7895
7913
  }
7896
7914
  [Ii](t, e, i) {
7897
7915
  this[j] = false, t ? this[Ut](t) : this[ki](e, i) && this[zt]();
7898
7916
  }
7899
7917
  [H]() {
7900
- if (this[ht] && typeof this[u] == "number") {
7901
- let t = this[u];
7902
- this[u] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
7918
+ if (this[ht] && typeof this[m] == "number") {
7919
+ let t = this[m];
7920
+ this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
7903
7921
  }
7904
7922
  }
7905
7923
  [Ut](t) {
@@ -7915,7 +7933,7 @@ var _t = class extends A {
7915
7933
  case "finish":
7916
7934
  return false;
7917
7935
  case "drain":
7918
- return typeof this[u] == "number" && this[zt](), false;
7936
+ return typeof this[m] == "number" && this[zt](), false;
7919
7937
  case "error":
7920
7938
  return this[bt] ? false : (this[bt] = true, super.emit(t, ...e));
7921
7939
  default:
@@ -7938,7 +7956,7 @@ var Be = class extends _t {
7938
7956
  if (!this[j]) {
7939
7957
  this[j] = true;
7940
7958
  do {
7941
- let e = this[vi](), i = e.length === 0 ? 0 : I.readSync(this[u], e, 0, e.length, null);
7959
+ let e = this[vi](), i = e.length === 0 ? 0 : I.readSync(this[m], e, 0, e.length, null);
7942
7960
  if (!this[ki](i, e)) break;
7943
7961
  } while (true);
7944
7962
  this[j] = false;
@@ -7949,9 +7967,9 @@ var Be = class extends _t {
7949
7967
  }
7950
7968
  }
7951
7969
  [H]() {
7952
- if (this[ht] && typeof this[u] == "number") {
7953
- let t = this[u];
7954
- this[u] = void 0, I.closeSync(t), this.emit("close");
7970
+ if (this[ht] && typeof this[m] == "number") {
7971
+ let t = this[m];
7972
+ this[m] = void 0, I.closeSync(t), this.emit("close");
7955
7973
  }
7956
7974
  }
7957
7975
  };
@@ -7966,15 +7984,15 @@ var et = class extends Qr {
7966
7984
  [U];
7967
7985
  [ie];
7968
7986
  [ht];
7969
- [u];
7987
+ [m];
7970
7988
  [Me];
7971
7989
  [tt];
7972
7990
  [Ni] = false;
7973
7991
  [ot];
7974
7992
  constructor(t, e) {
7975
- e = e || {}, super(e), this[U] = t, this[u] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[ot] = typeof e.start == "number" ? e.start : void 0, this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : true;
7993
+ e = e || {}, super(e), this[U] = t, this[m] = typeof e.fd == "number" ? e.fd : void 0, this[ie] = e.mode === void 0 ? 438 : e.mode, this[ot] = typeof e.start == "number" ? e.start : void 0, this[ht] = typeof e.autoClose == "boolean" ? e.autoClose : true;
7976
7994
  let i = this[ot] !== void 0 ? "r+" : "w";
7977
- this[Me] = e.flags === void 0, this[tt] = e.flags === void 0 ? i : e.flags, this[u] === void 0 && this[at]();
7995
+ this[Me] = e.flags === void 0, this[tt] = e.flags === void 0 ? i : e.flags, this[m] === void 0 && this[at]();
7978
7996
  }
7979
7997
  emit(t, ...e) {
7980
7998
  if (t === "error") {
@@ -7984,7 +8002,7 @@ var et = class extends Qr {
7984
8002
  return super.emit(t, ...e);
7985
8003
  }
7986
8004
  get fd() {
7987
- return this[u];
8005
+ return this[m];
7988
8006
  }
7989
8007
  get path() {
7990
8008
  return this[U];
@@ -7996,16 +8014,16 @@ var et = class extends Qr {
7996
8014
  I.open(this[U], this[tt], this[ie], (t, e) => this[Ht](t, e));
7997
8015
  }
7998
8016
  [Ht](t, e) {
7999
- this[Me] && this[tt] === "r+" && t && t.code === "ENOENT" ? (this[tt] = "w", this[at]()) : t ? this[Ut](t) : (this[u] = e, this.emit("open", e), this[gt] || this[Ai]());
8017
+ this[Me] && this[tt] === "r+" && t && t.code === "ENOENT" ? (this[tt] = "w", this[at]()) : t ? this[Ut](t) : (this[m] = e, this.emit("open", e), this[gt] || this[Ai]());
8000
8018
  }
8001
8019
  end(t, e) {
8002
- return t && this.write(t, e), this[te] = true, !this[gt] && !this[Y].length && typeof this[u] == "number" && this[Pt](null, 0), this;
8020
+ return t && this.write(t, e), this[te] = true, !this[gt] && !this[Y].length && typeof this[m] == "number" && this[Pt](null, 0), this;
8003
8021
  }
8004
8022
  write(t, e) {
8005
- return typeof t == "string" && (t = Buffer.from(t, e)), this[te] ? (this.emit("error", new Error("write() after end()")), false) : this[u] === void 0 || this[gt] || this[Y].length ? (this[Y].push(t), this[ke] = true, false) : (this[gt] = true, this[ve](t), true);
8023
+ return typeof t == "string" && (t = Buffer.from(t, e)), this[te] ? (this.emit("error", new Error("write() after end()")), false) : this[m] === void 0 || this[gt] || this[Y].length ? (this[Y].push(t), this[ke] = true, false) : (this[gt] = true, this[ve](t), true);
8006
8024
  }
8007
8025
  [ve](t) {
8008
- I.write(this[u], t, 0, t.length, this[ot], (e, i) => this[Pt](e, i));
8026
+ I.write(this[m], t, 0, t.length, this[ot], (e, i) => this[Pt](e, i));
8009
8027
  }
8010
8028
  [Pt](t, e) {
8011
8029
  t ? this[Ut](t) : (this[ot] !== void 0 && typeof e == "number" && (this[ot] += e), this[Y].length ? this[Ai]() : (this[gt] = false, this[te] && !this[Ni] ? (this[Ni] = true, this[H](), this.emit("finish")) : this[ke] && (this[ke] = false, this.emit("drain"))));
@@ -8015,13 +8033,13 @@ var et = class extends Qr {
8015
8033
  else if (this[Y].length === 1) this[ve](this[Y].pop());
8016
8034
  else {
8017
8035
  let t = this[Y];
8018
- this[Y] = [], Jr(this[u], t, this[ot], (e, i) => this[Pt](e, i));
8036
+ this[Y] = [], Jr(this[m], t, this[ot], (e, i) => this[Pt](e, i));
8019
8037
  }
8020
8038
  }
8021
8039
  [H]() {
8022
- if (this[ht] && typeof this[u] == "number") {
8023
- let t = this[u];
8024
- this[u] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
8040
+ if (this[ht] && typeof this[m] == "number") {
8041
+ let t = this[m];
8042
+ this[m] = void 0, I.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
8025
8043
  }
8026
8044
  }
8027
8045
  };
@@ -8038,15 +8056,15 @@ var Wt = class extends et {
8038
8056
  this[Ht](null, t);
8039
8057
  }
8040
8058
  [H]() {
8041
- if (this[ht] && typeof this[u] == "number") {
8042
- let t = this[u];
8043
- this[u] = void 0, I.closeSync(t), this.emit("close");
8059
+ if (this[ht] && typeof this[m] == "number") {
8060
+ let t = this[m];
8061
+ this[m] = void 0, I.closeSync(t), this.emit("close");
8044
8062
  }
8045
8063
  }
8046
8064
  [ve](t) {
8047
8065
  let e = true;
8048
8066
  try {
8049
- this[Pt](null, I.writeSync(this[u], t, 0, t.length, this[ot])), e = false;
8067
+ this[Pt](null, I.writeSync(this[m], t, 0, t.length, this[ot])), e = false;
8050
8068
  } finally {
8051
8069
  if (e) try {
8052
8070
  this[H]();
@@ -8305,7 +8323,7 @@ var dn = (s3) => Ve.has(s3);
8305
8323
  var Ui = /* @__PURE__ */ new Set(["0", "", "1", "2", "3", "4", "5", "6", "7", "D"]);
8306
8324
  var oe = /* @__PURE__ */ new Map([["0", "File"], ["", "OldFile"], ["1", "Link"], ["2", "SymbolicLink"], ["3", "CharacterDevice"], ["4", "BlockDevice"], ["5", "Directory"], ["6", "FIFO"], ["7", "ContiguousFile"], ["g", "GlobalExtendedHeader"], ["x", "ExtendedHeader"], ["A", "SolarisACL"], ["D", "GNUDumpDir"], ["I", "Inode"], ["K", "NextFileHasLongLinkpath"], ["L", "NextFileHasLongPath"], ["M", "ContinuationFile"], ["N", "OldGnuLongPath"], ["S", "SparseFile"], ["V", "TapeVolumeHeader"], ["X", "OldExtendedHeader"]]);
8307
8325
  var Ve = new Map(Array.from(oe).map((s3) => [s3[1], s3[0]]));
8308
- var mn = (s3) => s3 === void 0 || s3 < 0 ? void 0 : s3;
8326
+ var un = (s3) => s3 === void 0 || s3 < 0 ? void 0 : s3;
8309
8327
  var F = class {
8310
8328
  cksumValid = false;
8311
8329
  needPax = false;
@@ -8334,7 +8352,7 @@ var F = class {
8334
8352
  decode(t, e, i, r) {
8335
8353
  if (e || (e = 0), !t || !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
8336
8354
  let n = xt(t, e + 156, 1), o = Ui.has(n), h = o ? i : void 0, a = o ? r : void 0;
8337
- if (this.path = h?.path ?? xt(t, e, 100), this.mode = h?.mode ?? a?.mode ?? lt(t, e + 100, 8), this.uid = h?.uid ?? a?.uid ?? lt(t, e + 108, 8), this.gid = h?.gid ?? a?.gid ?? lt(t, e + 116, 8), this.size = mn(h?.size ?? a?.size ?? lt(t, e + 124, 12)), this.mtime = h?.mtime ?? a?.mtime ?? Wi(t, e + 136, 12), this.cksum = lt(t, e + 148, 12), a && this.#i(a, true), h && this.#i(h), ne(n) && (this.#t = n || "0"), this.#t === "0" && this.path.slice(-1) === "/" && (this.#t = "5"), this.#t === "5" && (this.size = 0), this.linkpath = xt(t, e + 157, 100), t.subarray(e + 257, e + 265).toString() === "ustar\x0000") if (this.uname = h?.uname ?? a?.uname ?? xt(t, e + 265, 32), this.gname = h?.gname ?? a?.gname ?? xt(t, e + 297, 32), this.devmaj = h?.devmaj ?? a?.devmaj ?? lt(t, e + 329, 8) ?? 0, this.devmin = h?.devmin ?? a?.devmin ?? lt(t, e + 337, 8) ?? 0, t[e + 475] !== 0) {
8355
+ if (this.path = h?.path ?? xt(t, e, 100), this.mode = h?.mode ?? a?.mode ?? lt(t, e + 100, 8), this.uid = h?.uid ?? a?.uid ?? lt(t, e + 108, 8), this.gid = h?.gid ?? a?.gid ?? lt(t, e + 116, 8), this.size = un(h?.size ?? a?.size ?? lt(t, e + 124, 12)), this.mtime = h?.mtime ?? a?.mtime ?? Wi(t, e + 136, 12), this.cksum = lt(t, e + 148, 12), a && this.#i(a, true), h && this.#i(h), ne(n) && (this.#t = n || "0"), this.#t === "0" && this.path.slice(-1) === "/" && (this.#t = "5"), this.#t === "5" && (this.size = 0), this.linkpath = xt(t, e + 157, 100), t.subarray(e + 257, e + 265).toString() === "ustar\x0000") if (this.uname = h?.uname ?? a?.uname ?? xt(t, e + 265, 32), this.gname = h?.gname ?? a?.gname ?? xt(t, e + 297, 32), this.devmaj = h?.devmaj ?? a?.devmaj ?? lt(t, e + 329, 8) ?? 0, this.devmin = h?.devmin ?? a?.devmin ?? lt(t, e + 337, 8) ?? 0, t[e + 475] !== 0) {
8338
8356
  let c = xt(t, e + 345, 155);
8339
8357
  this.path = c + "/" + this.path;
8340
8358
  } else {
@@ -8351,7 +8369,7 @@ var F = class {
8351
8369
  }
8352
8370
  encode(t, e = 0) {
8353
8371
  if (t || (t = this.block = Buffer.alloc(512)), this.#t === "Unsupported" && (this.#t = "0"), !(t.length >= e + 512)) throw new Error("need 512 bytes for header");
8354
- let i = this.ctime || this.atime ? 130 : 155, r = un(this.path || "", i), n = r[0], o = r[1];
8372
+ let i = this.ctime || this.atime ? 130 : 155, r = mn(this.path || "", i), n = r[0], o = r[1];
8355
8373
  this.needPax = !!r[2], this.needPax = Lt(t, e, 100, n) || this.needPax, this.needPax = ct(t, e + 100, 8, this.mode) || this.needPax, this.needPax = ct(t, e + 108, 8, this.uid) || this.needPax, this.needPax = ct(t, e + 116, 8, this.gid) || this.needPax, this.needPax = ct(t, e + 124, 12, this.size) || this.needPax, this.needPax = Gi(t, e + 136, 12, this.mtime) || this.needPax, t[e + 156] = Number(this.#t.codePointAt(0)), this.needPax = Lt(t, e + 157, 100, this.linkpath) || this.needPax, t.write("ustar\x0000", e + 257, 8), this.needPax = Lt(t, e + 265, 32, this.uname) || this.needPax, this.needPax = Lt(t, e + 297, 32, this.gname) || this.needPax, this.needPax = ct(t, e + 329, 8, this.devmaj) || this.needPax, this.needPax = ct(t, e + 337, 8, this.devmin) || this.needPax, this.needPax = Lt(t, e + 345, i, o) || this.needPax, t[e + 475] !== 0 ? this.needPax = Lt(t, e + 345, 155, o) || this.needPax : (this.needPax = Lt(t, e + 345, 130, o) || this.needPax, this.needPax = Gi(t, e + 476, 12, this.atime) || this.needPax, this.needPax = Gi(t, e + 488, 12, this.ctime) || this.needPax);
8356
8374
  let h = 256;
8357
8375
  for (let a = e; a < e + 148; a++) h += t[a];
@@ -8371,7 +8389,7 @@ var F = class {
8371
8389
  else throw new TypeError("invalid entry type: " + t);
8372
8390
  }
8373
8391
  };
8374
- var un = (s3, t) => {
8392
+ var mn = (s3, t) => {
8375
8393
  let i = s3, r = "", n, o = Zt.parse(s3).root || ".";
8376
8394
  if (Buffer.byteLength(i) < 100) n = [i, r, false];
8377
8395
  else {
@@ -8564,10 +8582,10 @@ var dt = /* @__PURE__ */ Symbol("meta");
8564
8582
  var Ys = /* @__PURE__ */ Symbol("emitMeta");
8565
8583
  var p = /* @__PURE__ */ Symbol("buffer");
8566
8584
  var st = /* @__PURE__ */ Symbol("queue");
8567
- var mt = /* @__PURE__ */ Symbol("ended");
8585
+ var ut = /* @__PURE__ */ Symbol("ended");
8568
8586
  var Yi = /* @__PURE__ */ Symbol("emittedEnd");
8569
8587
  var At = /* @__PURE__ */ Symbol("emit");
8570
- var y = /* @__PURE__ */ Symbol("unzip");
8588
+ var w = /* @__PURE__ */ Symbol("unzip");
8571
8589
  var Xe = /* @__PURE__ */ Symbol("consumeChunk");
8572
8590
  var qe = /* @__PURE__ */ Symbol("consumeChunkSub");
8573
8591
  var Ki = /* @__PURE__ */ Symbol("consumeBody");
@@ -8606,8 +8624,8 @@ var rt = class extends Dn {
8606
8624
  [dt] = "";
8607
8625
  [V];
8608
8626
  [he];
8609
- [mt] = false;
8610
- [y];
8627
+ [ut] = false;
8628
+ [w];
8611
8629
  [$] = false;
8612
8630
  [It];
8613
8631
  [je] = false;
@@ -8717,7 +8735,13 @@ var rt = class extends Dn {
8717
8735
  }
8718
8736
  }
8719
8737
  abort(t) {
8720
- this[$] || (this[$] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false }));
8738
+ if (!this[$]) {
8739
+ if (this[w]) {
8740
+ let e = this[w];
8741
+ e.write = () => true, e.end = () => e, e.emit = () => false, e.destroy?.();
8742
+ }
8743
+ this[$] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false });
8744
+ }
8721
8745
  }
8722
8746
  [Xs](t) {
8723
8747
  this[$i] += t.length;
@@ -8726,11 +8750,11 @@ var rt = class extends Dn {
8726
8750
  }
8727
8751
  write(t, e, i) {
8728
8752
  if (typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, typeof e == "string" ? e : "utf8")), this[$]) return i?.(), false;
8729
- if ((this[y] === void 0 || this.brotli === void 0 && this[y] === false) && t) {
8753
+ if ((this[w] === void 0 || this.brotli === void 0 && this[w] === false) && t) {
8730
8754
  if (this[p] && (t = Buffer.concat([this[p], t]), this[p] = void 0), t.length < An) return this[p] = t, i?.(), true;
8731
- for (let a = 0; this[y] === void 0 && a < Xi.length; a++) t[a] !== Xi[a] && (this[y] = false);
8755
+ for (let a = 0; this[w] === void 0 && a < Xi.length; a++) t[a] !== Xi[a] && (this[w] = false);
8732
8756
  let o = false;
8733
- if (this[y] === false && this.zstd !== false) {
8757
+ if (this[w] === false && this.zstd !== false) {
8734
8758
  o = true;
8735
8759
  for (let a = 0; a < qi.length; a++) if (t[a] !== qi[a]) {
8736
8760
  o = false;
@@ -8738,27 +8762,27 @@ var rt = class extends Dn {
8738
8762
  }
8739
8763
  }
8740
8764
  let h = this.brotli === void 0 && !o;
8741
- if (this[y] === false && h) if (t.length < 512) if (this[mt]) this.brotli = true;
8765
+ if (this[w] === false && h) if (t.length < 512) if (this[ut]) this.brotli = true;
8742
8766
  else return this[p] = t, i?.(), true;
8743
8767
  else try {
8744
8768
  new F(t.subarray(0, 512)), this.brotli = false;
8745
8769
  } catch {
8746
8770
  this.brotli = true;
8747
8771
  }
8748
- if (this[y] === void 0 || this[y] === false && (this.brotli || o)) {
8749
- let a = this[mt];
8750
- this[mt] = false, this[y] = this[y] === void 0 ? new Ue({}) : o ? new Ke({}) : new Ge({}), this[y].on("data", (c) => {
8772
+ if (this[w] === void 0 || this[w] === false && (this.brotli || o)) {
8773
+ let a = this[ut];
8774
+ this[ut] = false, this[w] = this[w] === void 0 ? new Ue({}) : o ? new Ke({}) : new Ge({}), this[w].on("data", (c) => {
8751
8775
  this[Xs](c) && this[Xe](c);
8752
- }), this[y].on("error", (c) => {
8776
+ }), this[w].on("error", (c) => {
8753
8777
  this[$] || this.abort(c);
8754
- }), this[y].on("end", () => {
8755
- this[mt] = true, this[Xe]();
8778
+ }), this[w].on("end", () => {
8779
+ this[ut] = true, this[Xe]();
8756
8780
  }), this[Yt] = true, this[le] += t.length;
8757
- let l = !!this[y][a ? "end" : "write"](t);
8781
+ let l = !!this[w][a ? "end" : "write"](t);
8758
8782
  return this[Yt] = false, i?.(), l;
8759
8783
  }
8760
8784
  }
8761
- this[Yt] = true, this[y] ? (this[le] += t.length, this[y].write(t)) : this[Xe](t), this[Yt] = false;
8785
+ this[Yt] = true, this[w] ? (this[le] += t.length, this[w].write(t)) : this[Xe](t), this[Yt] = false;
8762
8786
  let n = this[st].length > 0 ? false : this[it] ? this[it].flowing : true;
8763
8787
  return !n && this[st].length === 0 && this[it]?.once("drain", () => this.emit("drain")), i?.(), n;
8764
8788
  }
@@ -8766,7 +8790,7 @@ var rt = class extends Dn {
8766
8790
  t && !this[$] && (this[p] = this[p] ? Buffer.concat([this[p], t]) : t);
8767
8791
  }
8768
8792
  [Qe]() {
8769
- if (this[mt] && !this[Yi] && !this[$] && !this[ae]) {
8793
+ if (this[ut] && !this[Yi] && !this[$] && !this[ae]) {
8770
8794
  this[Yi] = true;
8771
8795
  let t = this[Nt];
8772
8796
  if (t?.blockRemain) {
@@ -8791,7 +8815,7 @@ var rt = class extends Dn {
8791
8815
  }
8792
8816
  this[ae] = false;
8793
8817
  }
8794
- (!this[p] || this[mt]) && this[Qe]();
8818
+ (!this[p] || this[ut]) && this[Qe]();
8795
8819
  }
8796
8820
  [qe](t) {
8797
8821
  let e = 0, i = t.length;
@@ -8813,10 +8837,10 @@ var rt = class extends Dn {
8813
8837
  e < i && (this[p] = this[p] ? Buffer.concat([t.subarray(e), this[p]]) : t.subarray(e));
8814
8838
  }
8815
8839
  end(t, e, i) {
8816
- return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[y] ? (t && (this[le] += t.length, this[y].write(t)), this[y].end()) : (this[mt] = true, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[Qe]())), this;
8840
+ return typeof t == "function" && (i = t, e = void 0, t = void 0), typeof e == "function" && (i = e, e = void 0), typeof t == "string" && (t = Buffer.from(t, e)), i && this.once("finish", i), this[$] || (this[w] ? (t && (this[le] += t.length, this[w].write(t)), this[w].end()) : (this[ut] = true, (this.brotli === void 0 || this.zstd === void 0) && (t = t || Buffer.alloc(0)), t && this.write(t), this[Qe]())), this;
8817
8841
  }
8818
8842
  };
8819
- var ut = (s3) => {
8843
+ var mt = (s3) => {
8820
8844
  let t = s3.length - 1, e = -1;
8821
8845
  for (; t > -1 && s3.charAt(t) === "/"; ) e = t, t--;
8822
8846
  return e === -1 ? s3 : s3.slice(0, e);
@@ -8828,16 +8852,17 @@ var vn = (s3) => {
8828
8852
  } : (e) => e.resume();
8829
8853
  };
8830
8854
  var Qi = (s3, t) => {
8831
- let e = new Map(t.map((n) => [ut(n), true])), i = s3.filter, r = (n, o = "") => {
8832
- let h = o || kn(n).root || ".", a;
8833
- if (n === h) a = false;
8855
+ let e = new Map(t.map((o) => [mt(o), true])), i = s3.filter, r = 100, n = (o, h = "", a = 0) => {
8856
+ if (a >= r) return e.set(o, false), false;
8857
+ let l = h || kn(o).root || ".", c;
8858
+ if (o === l) c = false;
8834
8859
  else {
8835
- let l = e.get(n);
8836
- a = l !== void 0 ? l : r(Fn(n), h);
8860
+ let d = e.get(o);
8861
+ c = d !== void 0 ? d : n(Fn(o), l, a + 1);
8837
8862
  }
8838
- return e.set(n, a), a;
8863
+ return e.set(o, c), c;
8839
8864
  };
8840
- s3.filter = i ? (n, o) => i(n, o) && r(ut(n)) : (n) => r(ut(n));
8865
+ s3.filter = i ? (o, h) => i(o, h) && n(mt(o)) : (o) => n(mt(o));
8841
8866
  };
8842
8867
  var Mn = (s3) => {
8843
8868
  let t = new rt(s3), e = s3.file, i;
@@ -8894,7 +8919,7 @@ var Un = new Map(ei.map((s3, t) => [s3, ji[t]]));
8894
8919
  var Hn = new Map(ji.map((s3, t) => [s3, ei[t]]));
8895
8920
  var ts = (s3) => ei.reduce((t, e) => t.split(e).join(Un.get(e)), s3);
8896
8921
  var Qs = (s3) => ji.reduce((t, e) => t.split(e).join(Hn.get(e)), s3);
8897
- var rr = (s3, t) => t ? (s3 = f(s3).replace(/^\.(\/|$)/, ""), ut(t) + "/" + s3) : f(s3);
8922
+ var rr = (s3, t) => t ? (s3 = f(s3).replace(/^\.(\/|$)/, ""), mt(t) + "/" + s3) : f(s3);
8898
8923
  var Wn = 16 * 1024 * 1024;
8899
8924
  var tr = /* @__PURE__ */ Symbol("process");
8900
8925
  var er = /* @__PURE__ */ Symbol("file");
@@ -9321,16 +9346,16 @@ var hi = class s2 {
9321
9346
  }
9322
9347
  };
9323
9348
  function Zn(s3, t, e) {
9324
- let i = t, r = t ? t.next : s3.head, n = new me(e, i, r, s3);
9349
+ let i = t, r = t ? t.next : s3.head, n = new ue(e, i, r, s3);
9325
9350
  return n.next === void 0 && (s3.tail = n), n.prev === void 0 && (s3.head = n), s3.length++, n;
9326
9351
  }
9327
9352
  function Yn(s3, t) {
9328
- s3.tail = new me(t, s3.tail, void 0, s3), s3.head || (s3.head = s3.tail), s3.length++;
9353
+ s3.tail = new ue(t, s3.tail, void 0, s3), s3.head || (s3.head = s3.tail), s3.length++;
9329
9354
  }
9330
9355
  function Kn(s3, t) {
9331
- s3.head = new me(t, void 0, s3.head, s3), s3.tail || (s3.tail = s3.head), s3.length++;
9356
+ s3.head = new ue(t, void 0, s3.head, s3), s3.tail || (s3.tail = s3.head), s3.length++;
9332
9357
  }
9333
- var me = class {
9358
+ var ue = class {
9334
9359
  list;
9335
9360
  next;
9336
9361
  prev;
@@ -9355,7 +9380,7 @@ var pi = class {
9355
9380
  };
9356
9381
  var nr = Buffer.alloc(1024);
9357
9382
  var li = /* @__PURE__ */ Symbol("onStat");
9358
- var ue = /* @__PURE__ */ Symbol("ended");
9383
+ var me = /* @__PURE__ */ Symbol("ended");
9359
9384
  var W = /* @__PURE__ */ Symbol("queue");
9360
9385
  var pe = /* @__PURE__ */ Symbol("pendingLinks");
9361
9386
  var Et = /* @__PURE__ */ Symbol("current");
@@ -9367,12 +9392,12 @@ var ls = /* @__PURE__ */ Symbol("jobDone");
9367
9392
  var ci = /* @__PURE__ */ Symbol("addFSEntry");
9368
9393
  var or = /* @__PURE__ */ Symbol("addTarEntry");
9369
9394
  var ds = /* @__PURE__ */ Symbol("stat");
9370
- var ms = /* @__PURE__ */ Symbol("readdir");
9395
+ var us = /* @__PURE__ */ Symbol("readdir");
9371
9396
  var fi = /* @__PURE__ */ Symbol("onreaddir");
9372
9397
  var di = /* @__PURE__ */ Symbol("pipe");
9373
9398
  var hr = /* @__PURE__ */ Symbol("entry");
9374
9399
  var cs = /* @__PURE__ */ Symbol("entryOpt");
9375
- var mi = /* @__PURE__ */ Symbol("writeEntryClass");
9400
+ var ui = /* @__PURE__ */ Symbol("writeEntryClass");
9376
9401
  var lr = /* @__PURE__ */ Symbol("write");
9377
9402
  var fs = /* @__PURE__ */ Symbol("ondrain");
9378
9403
  var wt = class extends A {
@@ -9396,21 +9421,21 @@ var wt = class extends A {
9396
9421
  mtime;
9397
9422
  filter;
9398
9423
  jobs;
9399
- [mi];
9424
+ [ui];
9400
9425
  onWriteEntry;
9401
9426
  [W];
9402
9427
  [pe] = /* @__PURE__ */ new Map();
9403
9428
  [G] = 0;
9404
9429
  [Ee] = false;
9405
- [ue] = false;
9430
+ [me] = false;
9406
9431
  constructor(t = {}) {
9407
- if (super(), this.opt = t, this.file = t.file || "", this.cwd = t.cwd || process.cwd(), this.maxReadSize = t.maxReadSize, this.preservePaths = !!t.preservePaths, this.strict = !!t.strict, this.noPax = !!t.noPax, this.prefix = f(t.prefix || ""), this.linkCache = t.linkCache || /* @__PURE__ */ new Map(), this.statCache = t.statCache || /* @__PURE__ */ new Map(), this.readdirCache = t.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = t.onWriteEntry, this[mi] = de, typeof t.onwarn == "function" && this.on("warn", t.onwarn), this.portable = !!t.portable, t.gzip || t.brotli || t.zstd) {
9432
+ if (super(), this.opt = t, this.file = t.file || "", this.cwd = t.cwd || process.cwd(), this.maxReadSize = t.maxReadSize, this.preservePaths = !!t.preservePaths, this.strict = !!t.strict, this.noPax = !!t.noPax, this.prefix = f(t.prefix || ""), this.linkCache = t.linkCache || /* @__PURE__ */ new Map(), this.statCache = t.statCache || /* @__PURE__ */ new Map(), this.readdirCache = t.readdirCache || /* @__PURE__ */ new Map(), this.onWriteEntry = t.onWriteEntry, this[ui] = de, typeof t.onwarn == "function" && this.on("warn", t.onwarn), this.portable = !!t.portable, t.gzip || t.brotli || t.zstd) {
9408
9433
  if ((t.gzip ? 1 : 0) + (t.brotli ? 1 : 0) + (t.zstd ? 1 : 0) > 1) throw new TypeError("gzip, brotli, zstd are mutually exclusive");
9409
9434
  if (t.gzip && (typeof t.gzip != "object" && (t.gzip = {}), this.portable && (t.gzip.portable = true), this.zip = new ze(t.gzip)), t.brotli && (typeof t.brotli != "object" && (t.brotli = {}), this.zip = new We(t.brotli)), t.zstd && (typeof t.zstd != "object" && (t.zstd = {}), this.zip = new Ye(t.zstd)), !this.zip) throw new Error("impossible");
9410
9435
  let e = this.zip;
9411
9436
  e.on("data", (i) => super.write(i)), e.on("end", () => super.end()), e.on("drain", () => this[fs]()), this.on("resume", () => e.resume());
9412
9437
  } else this.on("drain", this[fs]);
9413
- this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => true, this[W] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee] = false, this[ue] = false;
9438
+ this.noDirRecurse = !!t.noDirRecurse, this.follow = !!t.follow, this.noMtime = !!t.noMtime, t.mtime && (this.mtime = t.mtime), this.filter = typeof t.filter == "function" ? t.filter : () => true, this[W] = new hi(), this[G] = 0, this.jobs = Number(t.jobs) || 4, this[Ee] = false, this[me] = false;
9414
9439
  }
9415
9440
  [lr](t) {
9416
9441
  return super.write(t);
@@ -9419,10 +9444,10 @@ var wt = class extends A {
9419
9444
  return this.write(t), this;
9420
9445
  }
9421
9446
  end(t, e, i) {
9422
- return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = void 0), t && this.add(t), this[ue] = true, this[Ft](), i && i(), this;
9447
+ return typeof t == "function" && (i = t, t = void 0), typeof e == "function" && (i = e, e = void 0), t && this.add(t), this[me] = true, this[Ft](), i && i(), this;
9423
9448
  }
9424
9449
  write(t) {
9425
- if (this[ue]) throw new Error("write after end");
9450
+ if (this[me]) throw new Error("write after end");
9426
9451
  return typeof t == "string" ? this[ci](t) : this[or](t), this.flowing;
9427
9452
  }
9428
9453
  [or](t) {
@@ -9441,7 +9466,7 @@ var wt = class extends A {
9441
9466
  [ds](t) {
9442
9467
  t.pending = true, this[G] += 1;
9443
9468
  let e = this.follow ? "stat" : "lstat";
9444
- ui[e](t.absolute, (i, r) => {
9469
+ mi[e](t.absolute, (i, r) => {
9445
9470
  t.pending = false, this[G] -= 1, i ? this.emit("error", i) : this[li](t, r);
9446
9471
  });
9447
9472
  }
@@ -9454,8 +9479,8 @@ var wt = class extends A {
9454
9479
  }
9455
9480
  this[Ft]();
9456
9481
  }
9457
- [ms](t) {
9458
- t.pending = true, this[G] += 1, ui.readdir(t.absolute, (e, i) => {
9482
+ [us](t) {
9483
+ t.pending = true, this[G] += 1, mi.readdir(t.absolute, (e, i) => {
9459
9484
  if (t.pending = false, this[G] -= 1, e) return this.emit("error", e);
9460
9485
  this[fi](t, i);
9461
9486
  });
@@ -9470,7 +9495,7 @@ var wt = class extends A {
9470
9495
  let e = t.next;
9471
9496
  this[W].removeNode(t), t.next = e;
9472
9497
  }
9473
- this[Ee] = false, this[ue] && this[W].length === 0 && this[G] === 0 && (this.zip ? this.zip.end(nr) : (super.write(nr), super.end()));
9498
+ this[Ee] = false, this[me] && this[W].length === 0 && this[G] === 0 && (this.zip ? this.zip.end(nr) : (super.write(nr), super.end()));
9474
9499
  }
9475
9500
  }
9476
9501
  get [Et]() {
@@ -9501,7 +9526,7 @@ var wt = class extends A {
9501
9526
  if (t.stat && !t.ignore) {
9502
9527
  if (!this.noDirRecurse && t.stat.isDirectory() && !t.readdir) {
9503
9528
  let e = this.readdirCache.get(t.absolute);
9504
- if (e ? this[fi](t, e) : this[ms](t), !t.readdir) return;
9529
+ if (e ? this[fi](t, e) : this[us](t), !t.readdir) return;
9505
9530
  }
9506
9531
  if (t.entry = this[hr](t), !t.entry) {
9507
9532
  t.ignore = true;
@@ -9517,7 +9542,7 @@ var wt = class extends A {
9517
9542
  [hr](t) {
9518
9543
  this[G] += 1;
9519
9544
  try {
9520
- return new this[mi](t.path, this[cs](t)).on("end", () => this[ls](t)).on("error", (i) => this.emit("error", i));
9545
+ return new this[ui](t.path, this[cs](t)).on("end", () => this[ls](t)).on("error", (i) => this.emit("error", i));
9521
9546
  } catch (e) {
9522
9547
  this.emit("error", e);
9523
9548
  }
@@ -9548,7 +9573,7 @@ var wt = class extends A {
9548
9573
  var kt = class extends wt {
9549
9574
  sync = true;
9550
9575
  constructor(t) {
9551
- super(t), this[mi] = ni;
9576
+ super(t), this[ui] = ni;
9552
9577
  }
9553
9578
  pause() {
9554
9579
  }
@@ -9556,10 +9581,10 @@ var kt = class extends wt {
9556
9581
  }
9557
9582
  [ds](t) {
9558
9583
  let e = this.follow ? "statSync" : "lstatSync";
9559
- this[li](t, ui[e](t.absolute));
9584
+ this[li](t, mi[e](t.absolute));
9560
9585
  }
9561
- [ms](t) {
9562
- this[fi](t, ui.readdirSync(t.absolute));
9586
+ [us](t) {
9587
+ this[fi](t, mi.readdirSync(t.absolute));
9563
9588
  }
9564
9589
  [di](t) {
9565
9590
  let e = t.entry, i = this.zip;
@@ -9610,13 +9635,13 @@ var Qn = K(Vn, $n, Xn, qn, (s3, t) => {
9610
9635
  });
9611
9636
  var Jn = process.env.__FAKE_PLATFORM__ || process.platform;
9612
9637
  var Er = Jn === "win32";
9613
- var { O_CREAT: wr, O_NOFOLLOW: mr, O_TRUNC: Sr, O_WRONLY: yr } = pr.constants;
9638
+ var { O_CREAT: wr, O_NOFOLLOW: ur, O_TRUNC: Sr, O_WRONLY: yr } = pr.constants;
9614
9639
  var Rr = Number(process.env.__FAKE_FS_O_FILENAME__) || pr.constants.UV_FS_O_FILEMAP || 0;
9615
9640
  var jn = Er && !!Rr;
9616
9641
  var to = 512 * 1024;
9617
9642
  var eo = Rr | Sr | wr | yr;
9618
- var ur = !Er && typeof mr == "number" ? mr | Sr | wr | yr : null;
9619
- var us = ur !== null ? () => ur : jn ? (s3) => s3 < to ? eo : "w" : () => "w";
9643
+ var mr = !Er && typeof ur == "number" ? ur | Sr | wr | yr : null;
9644
+ var ms = mr !== null ? () => mr : jn ? (s3) => s3 < to ? eo : "w" : () => "w";
9620
9645
  var ps = (s3, t, e) => {
9621
9646
  try {
9622
9647
  return wi.lchownSync(s3, t, e);
@@ -9702,13 +9727,13 @@ var no = (s3, t) => {
9702
9727
  };
9703
9728
  var gr = (s3, t, e) => {
9704
9729
  s3 = f(s3);
9705
- let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), S = (E, x) => {
9706
- E ? e(E) : x && a ? Es(x, o, h, (Le) => S(Le)) : n ? k.chmod(s3, r, e) : e();
9730
+ let i = t.umask ?? 18, r = t.mode | 448, n = (r & i) !== 0, o = t.uid, h = t.gid, a = typeof o == "number" && typeof h == "number" && (o !== t.processUid || h !== t.processGid), l = t.preserve, c = t.unlink, d = f(t.cwd), y = (E, x) => {
9731
+ E ? e(E) : x && a ? Es(x, o, h, (Le) => y(Le)) : n ? k.chmod(s3, r, e) : e();
9707
9732
  };
9708
- if (s3 === d) return no(s3, S);
9709
- if (l) return ro.mkdir(s3, { mode: r, recursive: true }).then((E) => S(null, E ?? void 0), S);
9733
+ if (s3 === d) return no(s3, y);
9734
+ if (l) return ro.mkdir(s3, { mode: r, recursive: true }).then((E) => y(null, E ?? void 0), y);
9710
9735
  let D = f(Si.relative(d, s3)).split("/");
9711
- Ss(d, D, r, c, d, void 0, S);
9736
+ Ss(d, D, r, c, d, void 0, y);
9712
9737
  };
9713
9738
  var Ss = (s3, t, e, i, r, n, o) => {
9714
9739
  if (t.length === 0) return o(null, n);
@@ -9784,7 +9809,7 @@ var yi = class {
9784
9809
  #i = /* @__PURE__ */ new Map();
9785
9810
  #s = /* @__PURE__ */ new Set();
9786
9811
  reserve(t, e) {
9787
- t = ao ? ["win32 parallelization disabled"] : t.map((r) => ut(xr(Tr(r))));
9812
+ t = ao ? ["win32 parallelization disabled"] : t.map((r) => mt(xr(Tr(r))));
9788
9813
  let i = new Set(t.map((r) => lo(r)).reduce((r, n) => r.concat(n)));
9789
9814
  this.#i.set(e, { dirs: i, paths: t });
9790
9815
  for (let r of t) {
@@ -9872,19 +9897,19 @@ var _e = /* @__PURE__ */ Symbol("gid");
9872
9897
  var Oe = /* @__PURE__ */ Symbol("checkedCwd");
9873
9898
  var fo = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform;
9874
9899
  var Te = fo === "win32";
9875
- var mo = 1024;
9876
- var uo = (s3, t) => {
9877
- if (!Te) return m.unlink(s3, t);
9900
+ var uo = 1024;
9901
+ var mo = (s3, t) => {
9902
+ if (!Te) return u.unlink(s3, t);
9878
9903
  let e = s3 + ".DELETE." + Mr(16).toString("hex");
9879
- m.rename(s3, e, (i) => {
9904
+ u.rename(s3, e, (i) => {
9880
9905
  if (i) return t(i);
9881
- m.unlink(e, t);
9906
+ u.unlink(e, t);
9882
9907
  });
9883
9908
  };
9884
9909
  var po = (s3) => {
9885
- if (!Te) return m.unlinkSync(s3);
9910
+ if (!Te) return u.unlinkSync(s3);
9886
9911
  let t = s3 + ".DELETE." + Mr(16).toString("hex");
9887
- m.renameSync(s3, t), m.unlinkSync(t);
9912
+ u.renameSync(s3, t), u.unlinkSync(t);
9888
9913
  };
9889
9914
  var vr = (s3, t, e) => s3 !== void 0 && s3 === s3 >>> 0 ? s3 : t !== void 0 && t === t >>> 0 ? t : e;
9890
9915
  var Xt = class extends rt {
@@ -9924,7 +9949,7 @@ var Xt = class extends rt {
9924
9949
  if (t.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
9925
9950
  this.uid = t.uid, this.gid = t.gid, this.setOwner = true;
9926
9951
  } else this.uid = void 0, this.gid = void 0, this.setOwner = false;
9927
- this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : mo, this.forceChown = t.forceChown === true, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(R.resolve(t.cwd || process.cwd())), this.strip = Number(t.strip) || 0, this.processUmask = this.chmod ? typeof t.processUmask == "number" ? t.processUmask : Lr() : 0, this.umask = typeof t.umask == "number" ? t.umask : this.processUmask, this.dmode = t.dmode || 511 & ~this.umask, this.fmode = t.fmode || 438 & ~this.umask, this.on("entry", (e) => this[Dr](e));
9952
+ this.preserveOwner = t.preserveOwner === void 0 && typeof t.uid != "number" ? process.getuid?.() === 0 : !!t.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : void 0, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : void 0, this.maxDepth = typeof t.maxDepth == "number" ? t.maxDepth : uo, this.forceChown = t.forceChown === true, this.win32 = !!t.win32 || Te, this.newer = !!t.newer, this.keep = !!t.keep, this.noMtime = !!t.noMtime, this.preservePaths = !!t.preservePaths, this.unlink = !!t.unlink, this.cwd = f(R.resolve(t.cwd || process.cwd())), this.strip = Number(t.strip) || 0, this.processUmask = this.chmod ? typeof t.processUmask == "number" ? t.processUmask : Lr() : 0, this.umask = typeof t.umask == "number" ? t.umask : this.processUmask, this.dmode = t.dmode || 511 & ~this.umask, this.fmode = t.fmode || 438 & ~this.umask, this.on("entry", (e) => this[Dr](e));
9928
9953
  }
9929
9954
  warn(t, e, i = {}) {
9930
9955
  return (t === "TAR_BAD_ARCHIVE" || t === "TAR_ABORT") && (i.recoverable = false), super.warn(t, e, i);
@@ -9998,18 +10023,18 @@ var Xt = class extends rt {
9998
10023
  return vr(this.gid, t.gid, this.processGid);
9999
10024
  }
10000
10025
  [Ts](t, e) {
10001
- let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = new et(String(t.absolute), { flags: us(t.size), mode: i, autoClose: false });
10026
+ let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = new et(String(t.absolute), { flags: ms(t.size), mode: i, autoClose: false });
10002
10027
  r.on("error", (a) => {
10003
- r.fd && m.close(r.fd, () => {
10028
+ r.fd && u.close(r.fd, () => {
10004
10029
  }), r.write = () => true, this[O](a, t), e();
10005
10030
  });
10006
10031
  let n = 1, o = (a) => {
10007
10032
  if (a) {
10008
- r.fd && m.close(r.fd, () => {
10033
+ r.fd && u.close(r.fd, () => {
10009
10034
  }), this[O](a, t), e();
10010
10035
  return;
10011
10036
  }
10012
- --n === 0 && r.fd !== void 0 && m.close(r.fd, (l) => {
10037
+ --n === 0 && r.fd !== void 0 && u.close(r.fd, (l) => {
10013
10038
  l ? this[O](l, t) : this[$t](), e();
10014
10039
  });
10015
10040
  };
@@ -10018,12 +10043,12 @@ var Xt = class extends rt {
10018
10043
  if (typeof l == "number" && t.mtime && !this.noMtime) {
10019
10044
  n++;
10020
10045
  let c = t.atime || /* @__PURE__ */ new Date(), d = t.mtime;
10021
- m.futimes(l, c, d, (S) => S ? m.utimes(a, c, d, (T) => o(T && S)) : o());
10046
+ u.futimes(l, c, d, (y) => y ? u.utimes(a, c, d, (T) => o(T && y)) : o());
10022
10047
  }
10023
10048
  if (typeof l == "number" && this[ge](t)) {
10024
10049
  n++;
10025
10050
  let c = this[be](t), d = this[_e](t);
10026
- typeof c == "number" && typeof d == "number" && m.fchown(l, c, d, (S) => S ? m.chown(a, c, d, (T) => o(T && S)) : o());
10051
+ typeof c == "number" && typeof d == "number" && u.fchown(l, c, d, (y) => y ? u.chown(a, c, d, (T) => o(T && y)) : o());
10027
10052
  }
10028
10053
  o();
10029
10054
  });
@@ -10042,7 +10067,7 @@ var Xt = class extends rt {
10042
10067
  let n = 1, o = () => {
10043
10068
  --n === 0 && (e(), this[$t](), t.resume());
10044
10069
  };
10045
- t.mtime && !this.noMtime && (n++, m.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[ge](t) && (n++, m.chown(String(t.absolute), Number(this[be](t)), Number(this[_e](t)), o)), o();
10070
+ t.mtime && !this.noMtime && (n++, u.utimes(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime, o)), this[ge](t) && (n++, u.chown(String(t.absolute), Number(this[be](t)), Number(this[_e](t)), o)), o();
10046
10071
  });
10047
10072
  }
10048
10073
  [Cr](t) {
@@ -10064,7 +10089,7 @@ var Xt = class extends rt {
10064
10089
  let o = i.shift();
10065
10090
  if (this.preservePaths || o === void 0) return r();
10066
10091
  let h = R.resolve(e, o);
10067
- m.lstat(h, (a, l) => {
10092
+ u.lstat(h, (a, l) => {
10068
10093
  if (a) return r();
10069
10094
  if (l?.isSymbolicLink()) return n(new St(h, R.resolve(h, i.join("/"))));
10070
10095
  this[Re](t, h, i, r, n);
@@ -10111,7 +10136,7 @@ var Xt = class extends rt {
10111
10136
  }
10112
10137
  o();
10113
10138
  }, o = () => {
10114
- m.lstat(String(t.absolute), (h, a) => {
10139
+ u.lstat(String(t.absolute), (h, a) => {
10115
10140
  if (a && (this.keep || this.newer && a.mtime > (t.mtime ?? a.mtime))) {
10116
10141
  this[Ls](t), i();
10117
10142
  return;
@@ -10120,12 +10145,12 @@ var Xt = class extends rt {
10120
10145
  if (a.isDirectory()) {
10121
10146
  if (t.type === "Directory") {
10122
10147
  let l = this.chmod && t.mode && (a.mode & 4095) !== t.mode, c = (d) => this[P](d ?? null, t, i);
10123
- return l ? m.chmod(String(t.absolute), Number(t.mode), c) : c();
10148
+ return l ? u.chmod(String(t.absolute), Number(t.mode), c) : c();
10124
10149
  }
10125
- if (t.absolute !== this.cwd) return m.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
10150
+ if (t.absolute !== this.cwd) return u.rmdir(String(t.absolute), (l) => this[P](l ?? null, t, i));
10126
10151
  }
10127
10152
  if (t.absolute === this.cwd) return this[P](null, t, i);
10128
- uo(String(t.absolute), (l) => this[P](l ?? null, t, i));
10153
+ mo(String(t.absolute), (l) => this[P](l ?? null, t, i));
10129
10154
  });
10130
10155
  };
10131
10156
  this[Oe] ? n() : r();
@@ -10150,7 +10175,7 @@ var Xt = class extends rt {
10150
10175
  }
10151
10176
  }
10152
10177
  [gi](t, e, i, r) {
10153
- m[i](e, String(t.absolute), (n) => {
10178
+ u[i](e, String(t.absolute), (n) => {
10154
10179
  n ? this[O](n, t) : (this[$t](), t.resume()), r();
10155
10180
  });
10156
10181
  }
@@ -10181,17 +10206,17 @@ var xe = class extends Xt {
10181
10206
  if (o) return this[O](o, t);
10182
10207
  }
10183
10208
  }
10184
- let [e, i] = ye(() => m.lstatSync(String(t.absolute)));
10209
+ let [e, i] = ye(() => u.lstatSync(String(t.absolute)));
10185
10210
  if (i && (this.keep || this.newer && i.mtime > (t.mtime ?? i.mtime))) return this[Ls](t);
10186
10211
  if (e || this[Os](t, i)) return this[P](null, t);
10187
10212
  if (i.isDirectory()) {
10188
10213
  if (t.type === "Directory") {
10189
10214
  let o = this.chmod && t.mode && (i.mode & 4095) !== t.mode, [h] = o ? ye(() => {
10190
- m.chmodSync(String(t.absolute), Number(t.mode));
10215
+ u.chmodSync(String(t.absolute), Number(t.mode));
10191
10216
  }) : [];
10192
10217
  return this[P](h, t);
10193
10218
  }
10194
- let [n] = ye(() => m.rmdirSync(String(t.absolute)));
10219
+ let [n] = ye(() => u.rmdirSync(String(t.absolute)));
10195
10220
  this[P](n, t);
10196
10221
  }
10197
10222
  let [r] = t.absolute === this.cwd ? [] : ye(() => po(String(t.absolute)));
@@ -10201,21 +10226,21 @@ var xe = class extends Xt {
10201
10226
  let i = typeof t.mode == "number" ? t.mode & 4095 : this.fmode, r = (h) => {
10202
10227
  let a;
10203
10228
  try {
10204
- m.closeSync(n);
10229
+ u.closeSync(n);
10205
10230
  } catch (l) {
10206
10231
  a = l;
10207
10232
  }
10208
10233
  (h || a) && this[O](h || a, t), e();
10209
10234
  }, n;
10210
10235
  try {
10211
- n = m.openSync(String(t.absolute), us(t.size), i);
10236
+ n = u.openSync(String(t.absolute), ms(t.size), i);
10212
10237
  } catch (h) {
10213
10238
  return r(h);
10214
10239
  }
10215
10240
  let o = this.transform && this.transform(t) || t;
10216
10241
  o !== t && (o.on("error", (h) => this[O](h, t)), t.pipe(o)), o.on("data", (h) => {
10217
10242
  try {
10218
- m.writeSync(n, h, 0, h.length);
10243
+ u.writeSync(n, h, 0, h.length);
10219
10244
  } catch (a) {
10220
10245
  r(a);
10221
10246
  }
@@ -10224,10 +10249,10 @@ var xe = class extends Xt {
10224
10249
  if (t.mtime && !this.noMtime) {
10225
10250
  let a = t.atime || /* @__PURE__ */ new Date(), l = t.mtime;
10226
10251
  try {
10227
- m.futimesSync(n, a, l);
10252
+ u.futimesSync(n, a, l);
10228
10253
  } catch (c) {
10229
10254
  try {
10230
- m.utimesSync(String(t.absolute), a, l);
10255
+ u.utimesSync(String(t.absolute), a, l);
10231
10256
  } catch {
10232
10257
  h = c;
10233
10258
  }
@@ -10236,10 +10261,10 @@ var xe = class extends Xt {
10236
10261
  if (this[ge](t)) {
10237
10262
  let a = this[be](t), l = this[_e](t);
10238
10263
  try {
10239
- m.fchownSync(n, Number(a), Number(l));
10264
+ u.fchownSync(n, Number(a), Number(l));
10240
10265
  } catch (c) {
10241
10266
  try {
10242
- m.chownSync(String(t.absolute), Number(a), Number(l));
10267
+ u.chownSync(String(t.absolute), Number(a), Number(l));
10243
10268
  } catch {
10244
10269
  h = h || c;
10245
10270
  }
@@ -10255,11 +10280,11 @@ var xe = class extends Xt {
10255
10280
  return;
10256
10281
  }
10257
10282
  if (t.mtime && !this.noMtime) try {
10258
- m.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
10283
+ u.utimesSync(String(t.absolute), t.atime || /* @__PURE__ */ new Date(), t.mtime);
10259
10284
  } catch {
10260
10285
  }
10261
10286
  if (this[ge](t)) try {
10262
- m.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e](t)));
10287
+ u.chownSync(String(t.absolute), Number(this[be](t)), Number(this[_e](t)));
10263
10288
  } catch {
10264
10289
  }
10265
10290
  e(), t.resume();
@@ -10276,7 +10301,7 @@ var xe = class extends Xt {
10276
10301
  let o = e;
10277
10302
  for (let h of i) {
10278
10303
  o = R.resolve(o, h);
10279
- let [a, l] = ye(() => m.lstatSync(o));
10304
+ let [a, l] = ye(() => u.lstatSync(o));
10280
10305
  if (a) return r();
10281
10306
  if (l.isSymbolicLink()) return n(new St(o, R.resolve(e, i.join("/"))));
10282
10307
  }
@@ -10285,7 +10310,7 @@ var xe = class extends Xt {
10285
10310
  [gi](t, e, i, r) {
10286
10311
  let n = `${i}Sync`;
10287
10312
  try {
10288
- m[n](e, String(t.absolute)), r(), t.resume();
10313
+ u[n](e, String(t.absolute)), r(), t.resume();
10289
10314
  } catch (o) {
10290
10315
  return this[O](o, t);
10291
10316
  }
@@ -10350,27 +10375,27 @@ var go = (s3, t) => {
10350
10375
  T ? v.close(n, (E) => h(T)) : h(null, D);
10351
10376
  }, l = 0;
10352
10377
  if (o === 0) return a(null, 0);
10353
- let c = 0, d = Buffer.alloc(512), S = (T, D) => {
10378
+ let c = 0, d = Buffer.alloc(512), y = (T, D) => {
10354
10379
  if (T || D === void 0) return a(T);
10355
- if (c += D, c < 512 && D) return v.read(n, d, c, d.length - c, l + c, S);
10380
+ if (c += D, c < 512 && D) return v.read(n, d, c, d.length - c, l + c, y);
10356
10381
  if (l === 0 && d[0] === 31 && d[1] === 139) return a(new Error("cannot append to compressed archives"));
10357
10382
  if (c < 512) return a(null, l);
10358
10383
  let E = new F(d);
10359
10384
  if (!E.cksumValid) return a(null, l);
10360
10385
  let x = 512 * Math.ceil((E.size ?? 0) / 512);
10361
10386
  if (l + x + 512 > o || (l += x + 512, l >= o)) return a(null, l);
10362
- s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0, v.read(n, d, 0, 512, l, S);
10387
+ s3.mtimeCache && E.mtime && s3.mtimeCache.set(String(E.path), E.mtime), c = 0, v.read(n, d, 0, 512, l, y);
10363
10388
  };
10364
- v.read(n, d, 0, 512, l, S);
10389
+ v.read(n, d, 0, 512, l, y);
10365
10390
  };
10366
10391
  return new Promise((n, o) => {
10367
10392
  e.on("error", o);
10368
10393
  let h = "r+", a = (l, c) => {
10369
10394
  if (l && l.code === "ENOENT" && h === "r+") return h = "w+", v.open(s3.file, h, a);
10370
10395
  if (l || !c) return o(l);
10371
- v.fstat(c, (d, S) => {
10396
+ v.fstat(c, (d, y) => {
10372
10397
  if (d) return v.close(c, () => o(d));
10373
- i(c, S.size, (T, D) => {
10398
+ i(c, y.size, (T, D) => {
10374
10399
  if (T) return o(T);
10375
10400
  let E = new et(s3.file, { fd: c, start: D });
10376
10401
  e.pipe(E), E.on("error", o), E.on("close", n), _o(e, t);
@@ -10582,7 +10607,7 @@ var DEFAULT_DEBUG_TRACE_LIMITS = {
10582
10607
  };
10583
10608
 
10584
10609
  // packages/shared/src/contracts/settings.ts
10585
- var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.8";
10610
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.10";
10586
10611
  var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
10587
10612
  var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
10588
10613
 
@@ -10827,7 +10852,29 @@ async function applyWorkPackManifest(paths, credentials, manifest, options) {
10827
10852
  const installed = workPacks.outcomes.filter((outcome) => outcome.status === "installed").map((outcome) => `${outcome.slug}@${outcome.version}`);
10828
10853
  const removed = workPacks.outcomes.filter((outcome) => outcome.status === "removed").map((outcome) => outcome.slug);
10829
10854
  const removedManagedPaths = [...new Set(workPacks.outcomes.flatMap((outcome) => outcome.removedManagedPaths ?? []))].sort();
10830
- return { installed, removed, removedManagedPaths, workPacks };
10855
+ const workPackObservations = await collectWorkPackObservations(paths, workPacks);
10856
+ return { installed, removed, removedManagedPaths, workPacks, workPackObservations };
10857
+ }
10858
+ async function collectWorkPackObservations(paths, reconciliation) {
10859
+ const installedVersions = /* @__PURE__ */ new Map();
10860
+ for (const slug of await managedWorkPackSlugs(paths.skillsDir)) {
10861
+ const version = (await readFile(path2.join(paths.skillsDir, slug, ".forge-version"), "utf8")).trim();
10862
+ if (version) installedVersions.set(slug, version);
10863
+ }
10864
+ const observations = new Map(
10865
+ [...installedVersions].map(([slug, version]) => [slug, { slug, state: "installed", version }])
10866
+ );
10867
+ for (const outcome of reconciliation.outcomes) {
10868
+ if (outcome.status !== "failed" && outcome.status !== "recovery-uncertain") continue;
10869
+ observations.set(outcome.slug, {
10870
+ slug: outcome.slug,
10871
+ state: "failed",
10872
+ ...outcome.version ? { version: outcome.version } : {},
10873
+ ...installedVersions.get(outcome.slug) ? { installedVersion: installedVersions.get(outcome.slug) } : {},
10874
+ errorCode: outcome.code ?? outcome.status
10875
+ });
10876
+ }
10877
+ return [...observations.values()].sort((a, b2) => a.slug.localeCompare(b2.slug));
10831
10878
  }
10832
10879
  async function operateWorkPack(paths, credentials, skillBySlug, approvedModelIds, cleanupPendingSlugs, operation, options) {
10833
10880
  const target = path2.join(paths.skillsDir, operation.pack.slug);
@@ -11490,7 +11537,7 @@ async function writeTextAtomic(filePath, content) {
11490
11537
  }
11491
11538
 
11492
11539
  // packages/cli/src/workPackSyncPlugin.ts
11493
- var PLUGIN_VERSION = "0.1.8";
11540
+ var PLUGIN_VERSION = "0.1.10";
11494
11541
  var STATUS_FILENAME = "work-pack-startup-status.json";
11495
11542
  var activeSync = /* @__PURE__ */ new Map();
11496
11543
  var ForgeWorkPackSyncServer = async (_input, options) => {
@@ -11515,6 +11562,7 @@ async function synchronizeAtStartup(forgeBaseUrl) {
11515
11562
  credentials = await readWellKnownForgeCredentials(paths.opencodeAuthPath, forgeBaseUrl);
11516
11563
  const manifest = await fetchManifest(credentials);
11517
11564
  const result = await applyWorkPackManifest(paths, credentials, manifest, {});
11565
+ await reportWorkPackObservations(credentials, "sync", result.workPackObservations);
11518
11566
  const failures = result.workPacks.outcomes.filter(
11519
11567
  (outcome) => outcome.status === "failed" || outcome.status === "recovery-uncertain"
11520
11568
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-forge-work-pack-sync",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Minimal Forge Work Pack startup synchronization for OpenCode and OpenWork.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {