claw-control-center 0.1.10 → 0.1.11

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.cjs CHANGED
@@ -3651,6 +3651,172 @@ var require_websocket_server = __commonJS({
3651
3651
  }
3652
3652
  });
3653
3653
 
3654
+ // ../node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js
3655
+ var require_cli_width = __commonJS({
3656
+ "../node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js"(exports2, module2) {
3657
+ "use strict";
3658
+ module2.exports = cliWidth2;
3659
+ function normalizeOpts(options) {
3660
+ const defaultOpts = {
3661
+ defaultWidth: 0,
3662
+ output: process.stdout,
3663
+ tty: require("tty")
3664
+ };
3665
+ if (!options) {
3666
+ return defaultOpts;
3667
+ }
3668
+ Object.keys(defaultOpts).forEach(function(key) {
3669
+ if (!options[key]) {
3670
+ options[key] = defaultOpts[key];
3671
+ }
3672
+ });
3673
+ return options;
3674
+ }
3675
+ function cliWidth2(options) {
3676
+ const opts = normalizeOpts(options);
3677
+ if (opts.output.getWindowSize) {
3678
+ return opts.output.getWindowSize()[0] || opts.defaultWidth;
3679
+ }
3680
+ if (opts.tty.getWindowSize) {
3681
+ return opts.tty.getWindowSize()[1] || opts.defaultWidth;
3682
+ }
3683
+ if (opts.output.columns) {
3684
+ return opts.output.columns;
3685
+ }
3686
+ if (process.env.CLI_WIDTH) {
3687
+ const width = parseInt(process.env.CLI_WIDTH, 10);
3688
+ if (!isNaN(width) && width !== 0) {
3689
+ return width;
3690
+ }
3691
+ }
3692
+ return opts.defaultWidth;
3693
+ }
3694
+ }
3695
+ });
3696
+
3697
+ // ../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
3698
+ var require_lib = __commonJS({
3699
+ "../node_modules/.pnpm/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js"(exports2, module2) {
3700
+ "use strict";
3701
+ var Stream = require("stream");
3702
+ var MuteStream2 = class extends Stream {
3703
+ #isTTY = null;
3704
+ constructor(opts = {}) {
3705
+ super(opts);
3706
+ this.writable = this.readable = true;
3707
+ this.muted = false;
3708
+ this.on("pipe", this._onpipe);
3709
+ this.replace = opts.replace;
3710
+ this._prompt = opts.prompt || null;
3711
+ this._hadControl = false;
3712
+ }
3713
+ #destSrc(key, def) {
3714
+ if (this._dest) {
3715
+ return this._dest[key];
3716
+ }
3717
+ if (this._src) {
3718
+ return this._src[key];
3719
+ }
3720
+ return def;
3721
+ }
3722
+ #proxy(method, ...args) {
3723
+ if (typeof this._dest?.[method] === "function") {
3724
+ this._dest[method](...args);
3725
+ }
3726
+ if (typeof this._src?.[method] === "function") {
3727
+ this._src[method](...args);
3728
+ }
3729
+ }
3730
+ get isTTY() {
3731
+ if (this.#isTTY !== null) {
3732
+ return this.#isTTY;
3733
+ }
3734
+ return this.#destSrc("isTTY", false);
3735
+ }
3736
+ // basically just get replace the getter/setter with a regular value
3737
+ set isTTY(val) {
3738
+ this.#isTTY = val;
3739
+ }
3740
+ get rows() {
3741
+ return this.#destSrc("rows");
3742
+ }
3743
+ get columns() {
3744
+ return this.#destSrc("columns");
3745
+ }
3746
+ mute() {
3747
+ this.muted = true;
3748
+ }
3749
+ unmute() {
3750
+ this.muted = false;
3751
+ }
3752
+ _onpipe(src) {
3753
+ this._src = src;
3754
+ }
3755
+ pipe(dest, options) {
3756
+ this._dest = dest;
3757
+ return super.pipe(dest, options);
3758
+ }
3759
+ pause() {
3760
+ if (this._src) {
3761
+ return this._src.pause();
3762
+ }
3763
+ }
3764
+ resume() {
3765
+ if (this._src) {
3766
+ return this._src.resume();
3767
+ }
3768
+ }
3769
+ write(c) {
3770
+ if (this.muted) {
3771
+ if (!this.replace) {
3772
+ return true;
3773
+ }
3774
+ if (c.match(/^\u001b/)) {
3775
+ if (c.indexOf(this._prompt) === 0) {
3776
+ c = c.slice(this._prompt.length);
3777
+ c = c.replace(/./g, this.replace);
3778
+ c = this._prompt + c;
3779
+ }
3780
+ this._hadControl = true;
3781
+ return this.emit("data", c);
3782
+ } else {
3783
+ if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
3784
+ this._hadControl = false;
3785
+ this.emit("data", this._prompt);
3786
+ c = c.slice(this._prompt.length);
3787
+ }
3788
+ c = c.toString().replace(/./g, this.replace);
3789
+ }
3790
+ }
3791
+ this.emit("data", c);
3792
+ }
3793
+ end(c) {
3794
+ if (this.muted) {
3795
+ if (c && this.replace) {
3796
+ c = c.toString().replace(/./g, this.replace);
3797
+ } else {
3798
+ c = null;
3799
+ }
3800
+ }
3801
+ if (c) {
3802
+ this.emit("data", c);
3803
+ }
3804
+ this.emit("end");
3805
+ }
3806
+ destroy(...args) {
3807
+ return this.#proxy("destroy", ...args);
3808
+ }
3809
+ destroySoon(...args) {
3810
+ return this.#proxy("destroySoon", ...args);
3811
+ }
3812
+ close(...args) {
3813
+ return this.#proxy("close", ...args);
3814
+ }
3815
+ };
3816
+ module2.exports = MuteStream2;
3817
+ }
3818
+ });
3819
+
3654
3820
  // ../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
3655
3821
  var require_identity = __commonJS({
3656
3822
  "../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js"(exports2) {
@@ -3728,17 +3894,17 @@ var require_visit = __commonJS({
3728
3894
  visit.BREAK = BREAK;
3729
3895
  visit.SKIP = SKIP;
3730
3896
  visit.REMOVE = REMOVE;
3731
- function visit_(key, node, visitor, path) {
3732
- const ctrl = callVisitor(key, node, visitor, path);
3897
+ function visit_(key, node, visitor, path2) {
3898
+ const ctrl = callVisitor(key, node, visitor, path2);
3733
3899
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3734
- replaceNode(key, path, ctrl);
3735
- return visit_(key, ctrl, visitor, path);
3900
+ replaceNode(key, path2, ctrl);
3901
+ return visit_(key, ctrl, visitor, path2);
3736
3902
  }
3737
3903
  if (typeof ctrl !== "symbol") {
3738
3904
  if (identity.isCollection(node)) {
3739
- path = Object.freeze(path.concat(node));
3905
+ path2 = Object.freeze(path2.concat(node));
3740
3906
  for (let i = 0; i < node.items.length; ++i) {
3741
- const ci = visit_(i, node.items[i], visitor, path);
3907
+ const ci = visit_(i, node.items[i], visitor, path2);
3742
3908
  if (typeof ci === "number")
3743
3909
  i = ci - 1;
3744
3910
  else if (ci === BREAK)
@@ -3749,13 +3915,13 @@ var require_visit = __commonJS({
3749
3915
  }
3750
3916
  }
3751
3917
  } else if (identity.isPair(node)) {
3752
- path = Object.freeze(path.concat(node));
3753
- const ck = visit_("key", node.key, visitor, path);
3918
+ path2 = Object.freeze(path2.concat(node));
3919
+ const ck = visit_("key", node.key, visitor, path2);
3754
3920
  if (ck === BREAK)
3755
3921
  return BREAK;
3756
3922
  else if (ck === REMOVE)
3757
3923
  node.key = null;
3758
- const cv = visit_("value", node.value, visitor, path);
3924
+ const cv = visit_("value", node.value, visitor, path2);
3759
3925
  if (cv === BREAK)
3760
3926
  return BREAK;
3761
3927
  else if (cv === REMOVE)
@@ -3776,17 +3942,17 @@ var require_visit = __commonJS({
3776
3942
  visitAsync.BREAK = BREAK;
3777
3943
  visitAsync.SKIP = SKIP;
3778
3944
  visitAsync.REMOVE = REMOVE;
3779
- async function visitAsync_(key, node, visitor, path) {
3780
- const ctrl = await callVisitor(key, node, visitor, path);
3945
+ async function visitAsync_(key, node, visitor, path2) {
3946
+ const ctrl = await callVisitor(key, node, visitor, path2);
3781
3947
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3782
- replaceNode(key, path, ctrl);
3783
- return visitAsync_(key, ctrl, visitor, path);
3948
+ replaceNode(key, path2, ctrl);
3949
+ return visitAsync_(key, ctrl, visitor, path2);
3784
3950
  }
3785
3951
  if (typeof ctrl !== "symbol") {
3786
3952
  if (identity.isCollection(node)) {
3787
- path = Object.freeze(path.concat(node));
3953
+ path2 = Object.freeze(path2.concat(node));
3788
3954
  for (let i = 0; i < node.items.length; ++i) {
3789
- const ci = await visitAsync_(i, node.items[i], visitor, path);
3955
+ const ci = await visitAsync_(i, node.items[i], visitor, path2);
3790
3956
  if (typeof ci === "number")
3791
3957
  i = ci - 1;
3792
3958
  else if (ci === BREAK)
@@ -3797,13 +3963,13 @@ var require_visit = __commonJS({
3797
3963
  }
3798
3964
  }
3799
3965
  } else if (identity.isPair(node)) {
3800
- path = Object.freeze(path.concat(node));
3801
- const ck = await visitAsync_("key", node.key, visitor, path);
3966
+ path2 = Object.freeze(path2.concat(node));
3967
+ const ck = await visitAsync_("key", node.key, visitor, path2);
3802
3968
  if (ck === BREAK)
3803
3969
  return BREAK;
3804
3970
  else if (ck === REMOVE)
3805
3971
  node.key = null;
3806
- const cv = await visitAsync_("value", node.value, visitor, path);
3972
+ const cv = await visitAsync_("value", node.value, visitor, path2);
3807
3973
  if (cv === BREAK)
3808
3974
  return BREAK;
3809
3975
  else if (cv === REMOVE)
@@ -3830,23 +3996,23 @@ var require_visit = __commonJS({
3830
3996
  }
3831
3997
  return visitor;
3832
3998
  }
3833
- function callVisitor(key, node, visitor, path) {
3999
+ function callVisitor(key, node, visitor, path2) {
3834
4000
  if (typeof visitor === "function")
3835
- return visitor(key, node, path);
4001
+ return visitor(key, node, path2);
3836
4002
  if (identity.isMap(node))
3837
- return visitor.Map?.(key, node, path);
4003
+ return visitor.Map?.(key, node, path2);
3838
4004
  if (identity.isSeq(node))
3839
- return visitor.Seq?.(key, node, path);
4005
+ return visitor.Seq?.(key, node, path2);
3840
4006
  if (identity.isPair(node))
3841
- return visitor.Pair?.(key, node, path);
4007
+ return visitor.Pair?.(key, node, path2);
3842
4008
  if (identity.isScalar(node))
3843
- return visitor.Scalar?.(key, node, path);
4009
+ return visitor.Scalar?.(key, node, path2);
3844
4010
  if (identity.isAlias(node))
3845
- return visitor.Alias?.(key, node, path);
4011
+ return visitor.Alias?.(key, node, path2);
3846
4012
  return void 0;
3847
4013
  }
3848
- function replaceNode(key, path, node) {
3849
- const parent = path[path.length - 1];
4014
+ function replaceNode(key, path2, node) {
4015
+ const parent = path2[path2.length - 1];
3850
4016
  if (identity.isCollection(parent)) {
3851
4017
  parent.items[key] = node;
3852
4018
  } else if (identity.isPair(parent)) {
@@ -4456,10 +4622,10 @@ var require_Collection = __commonJS({
4456
4622
  var createNode = require_createNode();
4457
4623
  var identity = require_identity();
4458
4624
  var Node = require_Node();
4459
- function collectionFromPath(schema, path, value) {
4625
+ function collectionFromPath(schema, path2, value) {
4460
4626
  let v = value;
4461
- for (let i = path.length - 1; i >= 0; --i) {
4462
- const k = path[i];
4627
+ for (let i = path2.length - 1; i >= 0; --i) {
4628
+ const k = path2[i];
4463
4629
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
4464
4630
  const a = [];
4465
4631
  a[k] = v;
@@ -4478,7 +4644,7 @@ var require_Collection = __commonJS({
4478
4644
  sourceObjects: /* @__PURE__ */ new Map()
4479
4645
  });
4480
4646
  }
4481
- var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
4647
+ var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
4482
4648
  var Collection = class extends Node.NodeBase {
4483
4649
  constructor(type, schema) {
4484
4650
  super(type);
@@ -4508,11 +4674,11 @@ var require_Collection = __commonJS({
4508
4674
  * be a Pair instance or a `{ key, value }` object, which may not have a key
4509
4675
  * that already exists in the map.
4510
4676
  */
4511
- addIn(path, value) {
4512
- if (isEmptyPath(path))
4677
+ addIn(path2, value) {
4678
+ if (isEmptyPath(path2))
4513
4679
  this.add(value);
4514
4680
  else {
4515
- const [key, ...rest] = path;
4681
+ const [key, ...rest] = path2;
4516
4682
  const node = this.get(key, true);
4517
4683
  if (identity.isCollection(node))
4518
4684
  node.addIn(rest, value);
@@ -4526,8 +4692,8 @@ var require_Collection = __commonJS({
4526
4692
  * Removes a value from the collection.
4527
4693
  * @returns `true` if the item was found and removed.
4528
4694
  */
4529
- deleteIn(path) {
4530
- const [key, ...rest] = path;
4695
+ deleteIn(path2) {
4696
+ const [key, ...rest] = path2;
4531
4697
  if (rest.length === 0)
4532
4698
  return this.delete(key);
4533
4699
  const node = this.get(key, true);
@@ -4541,8 +4707,8 @@ var require_Collection = __commonJS({
4541
4707
  * scalar values from their surrounding node; to disable set `keepScalar` to
4542
4708
  * `true` (collections are always returned intact).
4543
4709
  */
4544
- getIn(path, keepScalar) {
4545
- const [key, ...rest] = path;
4710
+ getIn(path2, keepScalar) {
4711
+ const [key, ...rest] = path2;
4546
4712
  const node = this.get(key, true);
4547
4713
  if (rest.length === 0)
4548
4714
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -4560,8 +4726,8 @@ var require_Collection = __commonJS({
4560
4726
  /**
4561
4727
  * Checks if the collection includes a value with the key `key`.
4562
4728
  */
4563
- hasIn(path) {
4564
- const [key, ...rest] = path;
4729
+ hasIn(path2) {
4730
+ const [key, ...rest] = path2;
4565
4731
  if (rest.length === 0)
4566
4732
  return this.has(key);
4567
4733
  const node = this.get(key, true);
@@ -4571,8 +4737,8 @@ var require_Collection = __commonJS({
4571
4737
  * Sets a value in this collection. For `!!set`, `value` needs to be a
4572
4738
  * boolean to add/remove the item from the set.
4573
4739
  */
4574
- setIn(path, value) {
4575
- const [key, ...rest] = path;
4740
+ setIn(path2, value) {
4741
+ const [key, ...rest] = path2;
4576
4742
  if (rest.length === 0) {
4577
4743
  this.set(key, value);
4578
4744
  } else {
@@ -7087,9 +7253,9 @@ var require_Document = __commonJS({
7087
7253
  this.contents.add(value);
7088
7254
  }
7089
7255
  /** Adds a value to the document. */
7090
- addIn(path, value) {
7256
+ addIn(path2, value) {
7091
7257
  if (assertCollection(this.contents))
7092
- this.contents.addIn(path, value);
7258
+ this.contents.addIn(path2, value);
7093
7259
  }
7094
7260
  /**
7095
7261
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -7164,14 +7330,14 @@ var require_Document = __commonJS({
7164
7330
  * Removes a value from the document.
7165
7331
  * @returns `true` if the item was found and removed.
7166
7332
  */
7167
- deleteIn(path) {
7168
- if (Collection.isEmptyPath(path)) {
7333
+ deleteIn(path2) {
7334
+ if (Collection.isEmptyPath(path2)) {
7169
7335
  if (this.contents == null)
7170
7336
  return false;
7171
7337
  this.contents = null;
7172
7338
  return true;
7173
7339
  }
7174
- return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
7340
+ return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
7175
7341
  }
7176
7342
  /**
7177
7343
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -7186,10 +7352,10 @@ var require_Document = __commonJS({
7186
7352
  * scalar values from their surrounding node; to disable set `keepScalar` to
7187
7353
  * `true` (collections are always returned intact).
7188
7354
  */
7189
- getIn(path, keepScalar) {
7190
- if (Collection.isEmptyPath(path))
7355
+ getIn(path2, keepScalar) {
7356
+ if (Collection.isEmptyPath(path2))
7191
7357
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
7192
- return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
7358
+ return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : void 0;
7193
7359
  }
7194
7360
  /**
7195
7361
  * Checks if the document includes a value with the key `key`.
@@ -7200,10 +7366,10 @@ var require_Document = __commonJS({
7200
7366
  /**
7201
7367
  * Checks if the document includes a value at `path`.
7202
7368
  */
7203
- hasIn(path) {
7204
- if (Collection.isEmptyPath(path))
7369
+ hasIn(path2) {
7370
+ if (Collection.isEmptyPath(path2))
7205
7371
  return this.contents !== void 0;
7206
- return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
7372
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
7207
7373
  }
7208
7374
  /**
7209
7375
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -7220,13 +7386,13 @@ var require_Document = __commonJS({
7220
7386
  * Sets a value in this document. For `!!set`, `value` needs to be a
7221
7387
  * boolean to add/remove the item from the set.
7222
7388
  */
7223
- setIn(path, value) {
7224
- if (Collection.isEmptyPath(path)) {
7389
+ setIn(path2, value) {
7390
+ if (Collection.isEmptyPath(path2)) {
7225
7391
  this.contents = value;
7226
7392
  } else if (this.contents == null) {
7227
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
7393
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
7228
7394
  } else if (assertCollection(this.contents)) {
7229
- this.contents.setIn(path, value);
7395
+ this.contents.setIn(path2, value);
7230
7396
  }
7231
7397
  }
7232
7398
  /**
@@ -9186,9 +9352,9 @@ var require_cst_visit = __commonJS({
9186
9352
  visit.BREAK = BREAK;
9187
9353
  visit.SKIP = SKIP;
9188
9354
  visit.REMOVE = REMOVE;
9189
- visit.itemAtPath = (cst, path) => {
9355
+ visit.itemAtPath = (cst, path2) => {
9190
9356
  let item = cst;
9191
- for (const [field, index] of path) {
9357
+ for (const [field, index] of path2) {
9192
9358
  const tok = item?.[field];
9193
9359
  if (tok && "items" in tok) {
9194
9360
  item = tok.items[index];
@@ -9197,23 +9363,23 @@ var require_cst_visit = __commonJS({
9197
9363
  }
9198
9364
  return item;
9199
9365
  };
9200
- visit.parentCollection = (cst, path) => {
9201
- const parent = visit.itemAtPath(cst, path.slice(0, -1));
9202
- const field = path[path.length - 1][0];
9366
+ visit.parentCollection = (cst, path2) => {
9367
+ const parent = visit.itemAtPath(cst, path2.slice(0, -1));
9368
+ const field = path2[path2.length - 1][0];
9203
9369
  const coll = parent?.[field];
9204
9370
  if (coll && "items" in coll)
9205
9371
  return coll;
9206
9372
  throw new Error("Parent collection not found");
9207
9373
  };
9208
- function _visit(path, item, visitor) {
9209
- let ctrl = visitor(item, path);
9374
+ function _visit(path2, item, visitor) {
9375
+ let ctrl = visitor(item, path2);
9210
9376
  if (typeof ctrl === "symbol")
9211
9377
  return ctrl;
9212
9378
  for (const field of ["key", "value"]) {
9213
9379
  const token = item[field];
9214
9380
  if (token && "items" in token) {
9215
9381
  for (let i = 0; i < token.items.length; ++i) {
9216
- const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
9382
+ const ci = _visit(Object.freeze(path2.concat([[field, i]])), token.items[i], visitor);
9217
9383
  if (typeof ci === "number")
9218
9384
  i = ci - 1;
9219
9385
  else if (ci === BREAK)
@@ -9224,10 +9390,10 @@ var require_cst_visit = __commonJS({
9224
9390
  }
9225
9391
  }
9226
9392
  if (typeof ctrl === "function" && field === "key")
9227
- ctrl = ctrl(item, path);
9393
+ ctrl = ctrl(item, path2);
9228
9394
  }
9229
9395
  }
9230
- return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
9396
+ return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
9231
9397
  }
9232
9398
  exports2.visit = visit;
9233
9399
  }
@@ -10992,7 +11158,7 @@ __export(index_exports, {
10992
11158
  });
10993
11159
  module.exports = __toCommonJS(index_exports);
10994
11160
  var import_node_fs5 = require("fs");
10995
- var import_node_path7 = require("path");
11161
+ var import_node_path8 = require("path");
10996
11162
  var import_node_crypto5 = require("crypto");
10997
11163
 
10998
11164
  // src/agent-event-probe.ts
@@ -12945,9 +13111,9 @@ function readString(record, keys) {
12945
13111
  }
12946
13112
  return void 0;
12947
13113
  }
12948
- function readNestedString(record, path) {
13114
+ function readNestedString(record, path2) {
12949
13115
  let current = record;
12950
- for (const segment of path) {
13116
+ for (const segment of path2) {
12951
13117
  if (!current || typeof current !== "object" || !(segment in current)) {
12952
13118
  return void 0;
12953
13119
  }
@@ -14568,16 +14734,16 @@ function mapResponsesToolEvent(sessionId, seq, eventType, data) {
14568
14734
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
14569
14735
  };
14570
14736
  }
14571
- function readStringFromUnknown(value, path) {
14572
- const current = readUnknownPath(value, path);
14737
+ function readStringFromUnknown(value, path2) {
14738
+ const current = readUnknownPath(value, path2);
14573
14739
  return typeof current === "string" && current.trim() ? current : void 0;
14574
14740
  }
14575
14741
  function isGatewayRequestTimeoutFor(error, method) {
14576
14742
  return error instanceof Error && error.message === `gateway request timeout for ${method}`;
14577
14743
  }
14578
- function readUnknownPath(value, path) {
14744
+ function readUnknownPath(value, path2) {
14579
14745
  let current = value;
14580
- for (const segment of path) {
14746
+ for (const segment of path2) {
14581
14747
  if (!current || typeof current !== "object" || !(segment in current)) {
14582
14748
  return void 0;
14583
14749
  }
@@ -16208,11 +16374,1729 @@ function toRecord3(value) {
16208
16374
 
16209
16375
  // src/install-qclaw.ts
16210
16376
  var import_node_crypto4 = require("crypto");
16211
- var import_promises4 = require("readline/promises");
16212
- var import_promises5 = require("fs/promises");
16377
+ var import_promises4 = require("fs/promises");
16213
16378
  var import_node_fs4 = require("fs");
16214
16379
  var import_node_os2 = require("os");
16215
- var import_node_path6 = require("path");
16380
+ var import_node_path7 = require("path");
16381
+
16382
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/key.js
16383
+ var keybindings = ["emacs", "vim"];
16384
+ var keybindingLookup = new Set(keybindings);
16385
+ function isKeybinding(value) {
16386
+ return keybindingLookup.has(value);
16387
+ }
16388
+ function getDefaultKeybindings() {
16389
+ const env = process.env["INQUIRER_KEYBINDINGS"];
16390
+ if (!env)
16391
+ return [];
16392
+ return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
16393
+ }
16394
+ var isUpKey = (key, keybindings2 = []) => (
16395
+ // The up key
16396
+ key.name === "up" || // Vim keybinding: hjkl keys map to left/down/up/right
16397
+ keybindings2.includes("vim") && key.name === "k" || // Emacs keybinding: Ctrl+P means "previous" in Emacs navigation conventions
16398
+ keybindings2.includes("emacs") && key.ctrl && key.name === "p"
16399
+ );
16400
+ var isDownKey = (key, keybindings2 = []) => (
16401
+ // The down key
16402
+ key.name === "down" || // Vim keybinding: hjkl keys map to left/down/up/right
16403
+ keybindings2.includes("vim") && key.name === "j" || // Emacs keybinding: Ctrl+N means "next" in Emacs navigation conventions
16404
+ keybindings2.includes("emacs") && key.ctrl && key.name === "n"
16405
+ );
16406
+ var isSpaceKey = (key) => key.name === "space";
16407
+ var isNumberKey = (key) => "1234567890".includes(key.name);
16408
+ var isEnterKey = (key) => key.name === "enter" || key.name === "return";
16409
+
16410
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/errors.js
16411
+ var AbortPromptError = class extends Error {
16412
+ name = "AbortPromptError";
16413
+ message = "Prompt was aborted";
16414
+ constructor(options) {
16415
+ super();
16416
+ this.cause = options?.cause;
16417
+ }
16418
+ };
16419
+ var CancelPromptError = class extends Error {
16420
+ name = "CancelPromptError";
16421
+ message = "Prompt was canceled";
16422
+ };
16423
+ var ExitPromptError = class extends Error {
16424
+ name = "ExitPromptError";
16425
+ };
16426
+ var HookError = class extends Error {
16427
+ name = "HookError";
16428
+ };
16429
+ var ValidationError = class extends Error {
16430
+ name = "ValidationError";
16431
+ };
16432
+
16433
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-state.js
16434
+ var import_node_async_hooks2 = require("async_hooks");
16435
+
16436
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/hook-engine.js
16437
+ var import_node_async_hooks = require("async_hooks");
16438
+ var hookStorage = new import_node_async_hooks.AsyncLocalStorage();
16439
+ function createStore(rl) {
16440
+ const store = {
16441
+ rl,
16442
+ hooks: [],
16443
+ hooksCleanup: [],
16444
+ hooksEffect: [],
16445
+ index: 0,
16446
+ handleChange() {
16447
+ }
16448
+ };
16449
+ return store;
16450
+ }
16451
+ function withHooks(rl, cb) {
16452
+ const store = createStore(rl);
16453
+ return hookStorage.run(store, () => {
16454
+ function cycle(render) {
16455
+ store.handleChange = () => {
16456
+ store.index = 0;
16457
+ render();
16458
+ };
16459
+ store.handleChange();
16460
+ }
16461
+ return cb(cycle);
16462
+ });
16463
+ }
16464
+ function getStore() {
16465
+ const store = hookStorage.getStore();
16466
+ if (!store) {
16467
+ throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
16468
+ }
16469
+ return store;
16470
+ }
16471
+ function readline() {
16472
+ return getStore().rl;
16473
+ }
16474
+ function withUpdates(fn) {
16475
+ const wrapped = (...args) => {
16476
+ const store = getStore();
16477
+ let shouldUpdate = false;
16478
+ const oldHandleChange = store.handleChange;
16479
+ store.handleChange = () => {
16480
+ shouldUpdate = true;
16481
+ };
16482
+ const returnValue = fn(...args);
16483
+ if (shouldUpdate) {
16484
+ oldHandleChange();
16485
+ }
16486
+ store.handleChange = oldHandleChange;
16487
+ return returnValue;
16488
+ };
16489
+ return import_node_async_hooks.AsyncResource.bind(wrapped);
16490
+ }
16491
+ function withPointer(cb) {
16492
+ const store = getStore();
16493
+ const { index } = store;
16494
+ const pointer = {
16495
+ get() {
16496
+ return store.hooks[index];
16497
+ },
16498
+ set(value) {
16499
+ store.hooks[index] = value;
16500
+ },
16501
+ initialized: index in store.hooks
16502
+ };
16503
+ const returnValue = cb(pointer);
16504
+ store.index++;
16505
+ return returnValue;
16506
+ }
16507
+ function handleChange() {
16508
+ getStore().handleChange();
16509
+ }
16510
+ var effectScheduler = {
16511
+ queue(cb) {
16512
+ const store = getStore();
16513
+ const { index } = store;
16514
+ store.hooksEffect.push(() => {
16515
+ store.hooksCleanup[index]?.();
16516
+ const cleanFn = cb(readline());
16517
+ if (cleanFn != null && typeof cleanFn !== "function") {
16518
+ throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
16519
+ }
16520
+ store.hooksCleanup[index] = cleanFn;
16521
+ });
16522
+ },
16523
+ run() {
16524
+ const store = getStore();
16525
+ withUpdates(() => {
16526
+ store.hooksEffect.forEach((effect) => {
16527
+ effect();
16528
+ });
16529
+ store.hooksEffect.length = 0;
16530
+ })();
16531
+ },
16532
+ clearAll() {
16533
+ const store = getStore();
16534
+ store.hooksCleanup.forEach((cleanFn) => {
16535
+ cleanFn?.();
16536
+ });
16537
+ store.hooksEffect.length = 0;
16538
+ store.hooksCleanup.length = 0;
16539
+ }
16540
+ };
16541
+
16542
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-state.js
16543
+ function isFactory(value) {
16544
+ return typeof value === "function";
16545
+ }
16546
+ function useState(defaultValue) {
16547
+ return withPointer((pointer) => {
16548
+ const setState = import_node_async_hooks2.AsyncResource.bind(function setState2(newValue) {
16549
+ if (pointer.get() !== newValue) {
16550
+ pointer.set(newValue);
16551
+ handleChange();
16552
+ }
16553
+ });
16554
+ if (pointer.initialized) {
16555
+ return [pointer.get(), setState];
16556
+ }
16557
+ const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
16558
+ pointer.set(value);
16559
+ return [value, setState];
16560
+ });
16561
+ }
16562
+
16563
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-effect.js
16564
+ function useEffect(cb, depArray) {
16565
+ withPointer((pointer) => {
16566
+ const oldDeps = pointer.get();
16567
+ const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
16568
+ if (hasChanged) {
16569
+ effectScheduler.queue(cb);
16570
+ }
16571
+ pointer.set(depArray);
16572
+ });
16573
+ }
16574
+
16575
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/theme.js
16576
+ var import_node_util = require("util");
16577
+
16578
+ // ../node_modules/.pnpm/@inquirer+figures@2.0.7/node_modules/@inquirer/figures/dist/index.js
16579
+ var import_node_process = __toESM(require("process"), 1);
16580
+ function isUnicodeSupported() {
16581
+ if (!import_node_process.default.platform.startsWith("win")) {
16582
+ return import_node_process.default.env["TERM"] !== "linux";
16583
+ }
16584
+ return Boolean(import_node_process.default.env["CI"]) || // CI environments generally support unicode
16585
+ Boolean(import_node_process.default.env["WT_SESSION"]) || // Windows Terminal
16586
+ Boolean(import_node_process.default.env["TERMINUS_SUBLIME"]) || // Terminus (<0.2.27)
16587
+ import_node_process.default.env["ConEmuTask"] === "{cmd::Cmder}" || // ConEmu and cmder
16588
+ import_node_process.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process.default.env["TERM_PROGRAM"] === "vscode" || import_node_process.default.env["TERM"] === "xterm-256color" || import_node_process.default.env["TERM"] === "alacritty" || import_node_process.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
16589
+ }
16590
+ var common = {
16591
+ circleQuestionMark: "(?)",
16592
+ questionMarkPrefix: "(?)",
16593
+ square: "\u2588",
16594
+ squareDarkShade: "\u2593",
16595
+ squareMediumShade: "\u2592",
16596
+ squareLightShade: "\u2591",
16597
+ squareTop: "\u2580",
16598
+ squareBottom: "\u2584",
16599
+ squareLeft: "\u258C",
16600
+ squareRight: "\u2590",
16601
+ squareCenter: "\u25A0",
16602
+ bullet: "\u25CF",
16603
+ dot: "\u2024",
16604
+ ellipsis: "\u2026",
16605
+ pointerSmall: "\u203A",
16606
+ triangleUp: "\u25B2",
16607
+ triangleUpSmall: "\u25B4",
16608
+ triangleDown: "\u25BC",
16609
+ triangleDownSmall: "\u25BE",
16610
+ triangleLeftSmall: "\u25C2",
16611
+ triangleRightSmall: "\u25B8",
16612
+ home: "\u2302",
16613
+ heart: "\u2665",
16614
+ musicNote: "\u266A",
16615
+ musicNoteBeamed: "\u266B",
16616
+ arrowUp: "\u2191",
16617
+ arrowDown: "\u2193",
16618
+ arrowLeft: "\u2190",
16619
+ arrowRight: "\u2192",
16620
+ arrowLeftRight: "\u2194",
16621
+ arrowUpDown: "\u2195",
16622
+ almostEqual: "\u2248",
16623
+ notEqual: "\u2260",
16624
+ lessOrEqual: "\u2264",
16625
+ greaterOrEqual: "\u2265",
16626
+ identical: "\u2261",
16627
+ infinity: "\u221E",
16628
+ subscriptZero: "\u2080",
16629
+ subscriptOne: "\u2081",
16630
+ subscriptTwo: "\u2082",
16631
+ subscriptThree: "\u2083",
16632
+ subscriptFour: "\u2084",
16633
+ subscriptFive: "\u2085",
16634
+ subscriptSix: "\u2086",
16635
+ subscriptSeven: "\u2087",
16636
+ subscriptEight: "\u2088",
16637
+ subscriptNine: "\u2089",
16638
+ oneHalf: "\xBD",
16639
+ oneThird: "\u2153",
16640
+ oneQuarter: "\xBC",
16641
+ oneFifth: "\u2155",
16642
+ oneSixth: "\u2159",
16643
+ oneEighth: "\u215B",
16644
+ twoThirds: "\u2154",
16645
+ twoFifths: "\u2156",
16646
+ threeQuarters: "\xBE",
16647
+ threeFifths: "\u2157",
16648
+ threeEighths: "\u215C",
16649
+ fourFifths: "\u2158",
16650
+ fiveSixths: "\u215A",
16651
+ fiveEighths: "\u215D",
16652
+ sevenEighths: "\u215E",
16653
+ line: "\u2500",
16654
+ lineBold: "\u2501",
16655
+ lineDouble: "\u2550",
16656
+ lineDashed0: "\u2504",
16657
+ lineDashed1: "\u2505",
16658
+ lineDashed2: "\u2508",
16659
+ lineDashed3: "\u2509",
16660
+ lineDashed4: "\u254C",
16661
+ lineDashed5: "\u254D",
16662
+ lineDashed6: "\u2574",
16663
+ lineDashed7: "\u2576",
16664
+ lineDashed8: "\u2578",
16665
+ lineDashed9: "\u257A",
16666
+ lineDashed10: "\u257C",
16667
+ lineDashed11: "\u257E",
16668
+ lineDashed12: "\u2212",
16669
+ lineDashed13: "\u2013",
16670
+ lineDashed14: "\u2010",
16671
+ lineDashed15: "\u2043",
16672
+ lineVertical: "\u2502",
16673
+ lineVerticalBold: "\u2503",
16674
+ lineVerticalDouble: "\u2551",
16675
+ lineVerticalDashed0: "\u2506",
16676
+ lineVerticalDashed1: "\u2507",
16677
+ lineVerticalDashed2: "\u250A",
16678
+ lineVerticalDashed3: "\u250B",
16679
+ lineVerticalDashed4: "\u254E",
16680
+ lineVerticalDashed5: "\u254F",
16681
+ lineVerticalDashed6: "\u2575",
16682
+ lineVerticalDashed7: "\u2577",
16683
+ lineVerticalDashed8: "\u2579",
16684
+ lineVerticalDashed9: "\u257B",
16685
+ lineVerticalDashed10: "\u257D",
16686
+ lineVerticalDashed11: "\u257F",
16687
+ lineDownLeft: "\u2510",
16688
+ lineDownLeftArc: "\u256E",
16689
+ lineDownBoldLeftBold: "\u2513",
16690
+ lineDownBoldLeft: "\u2512",
16691
+ lineDownLeftBold: "\u2511",
16692
+ lineDownDoubleLeftDouble: "\u2557",
16693
+ lineDownDoubleLeft: "\u2556",
16694
+ lineDownLeftDouble: "\u2555",
16695
+ lineDownRight: "\u250C",
16696
+ lineDownRightArc: "\u256D",
16697
+ lineDownBoldRightBold: "\u250F",
16698
+ lineDownBoldRight: "\u250E",
16699
+ lineDownRightBold: "\u250D",
16700
+ lineDownDoubleRightDouble: "\u2554",
16701
+ lineDownDoubleRight: "\u2553",
16702
+ lineDownRightDouble: "\u2552",
16703
+ lineUpLeft: "\u2518",
16704
+ lineUpLeftArc: "\u256F",
16705
+ lineUpBoldLeftBold: "\u251B",
16706
+ lineUpBoldLeft: "\u251A",
16707
+ lineUpLeftBold: "\u2519",
16708
+ lineUpDoubleLeftDouble: "\u255D",
16709
+ lineUpDoubleLeft: "\u255C",
16710
+ lineUpLeftDouble: "\u255B",
16711
+ lineUpRight: "\u2514",
16712
+ lineUpRightArc: "\u2570",
16713
+ lineUpBoldRightBold: "\u2517",
16714
+ lineUpBoldRight: "\u2516",
16715
+ lineUpRightBold: "\u2515",
16716
+ lineUpDoubleRightDouble: "\u255A",
16717
+ lineUpDoubleRight: "\u2559",
16718
+ lineUpRightDouble: "\u2558",
16719
+ lineUpDownLeft: "\u2524",
16720
+ lineUpBoldDownBoldLeftBold: "\u252B",
16721
+ lineUpBoldDownBoldLeft: "\u2528",
16722
+ lineUpDownLeftBold: "\u2525",
16723
+ lineUpBoldDownLeftBold: "\u2529",
16724
+ lineUpDownBoldLeftBold: "\u252A",
16725
+ lineUpDownBoldLeft: "\u2527",
16726
+ lineUpBoldDownLeft: "\u2526",
16727
+ lineUpDoubleDownDoubleLeftDouble: "\u2563",
16728
+ lineUpDoubleDownDoubleLeft: "\u2562",
16729
+ lineUpDownLeftDouble: "\u2561",
16730
+ lineUpDownRight: "\u251C",
16731
+ lineUpBoldDownBoldRightBold: "\u2523",
16732
+ lineUpBoldDownBoldRight: "\u2520",
16733
+ lineUpDownRightBold: "\u251D",
16734
+ lineUpBoldDownRightBold: "\u2521",
16735
+ lineUpDownBoldRightBold: "\u2522",
16736
+ lineUpDownBoldRight: "\u251F",
16737
+ lineUpBoldDownRight: "\u251E",
16738
+ lineUpDoubleDownDoubleRightDouble: "\u2560",
16739
+ lineUpDoubleDownDoubleRight: "\u255F",
16740
+ lineUpDownRightDouble: "\u255E",
16741
+ lineDownLeftRight: "\u252C",
16742
+ lineDownBoldLeftBoldRightBold: "\u2533",
16743
+ lineDownLeftBoldRightBold: "\u252F",
16744
+ lineDownBoldLeftRight: "\u2530",
16745
+ lineDownBoldLeftBoldRight: "\u2531",
16746
+ lineDownBoldLeftRightBold: "\u2532",
16747
+ lineDownLeftRightBold: "\u252E",
16748
+ lineDownLeftBoldRight: "\u252D",
16749
+ lineDownDoubleLeftDoubleRightDouble: "\u2566",
16750
+ lineDownDoubleLeftRight: "\u2565",
16751
+ lineDownLeftDoubleRightDouble: "\u2564",
16752
+ lineUpLeftRight: "\u2534",
16753
+ lineUpBoldLeftBoldRightBold: "\u253B",
16754
+ lineUpLeftBoldRightBold: "\u2537",
16755
+ lineUpBoldLeftRight: "\u2538",
16756
+ lineUpBoldLeftBoldRight: "\u2539",
16757
+ lineUpBoldLeftRightBold: "\u253A",
16758
+ lineUpLeftRightBold: "\u2536",
16759
+ lineUpLeftBoldRight: "\u2535",
16760
+ lineUpDoubleLeftDoubleRightDouble: "\u2569",
16761
+ lineUpDoubleLeftRight: "\u2568",
16762
+ lineUpLeftDoubleRightDouble: "\u2567",
16763
+ lineUpDownLeftRight: "\u253C",
16764
+ lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
16765
+ lineUpDownBoldLeftBoldRightBold: "\u2548",
16766
+ lineUpBoldDownLeftBoldRightBold: "\u2547",
16767
+ lineUpBoldDownBoldLeftRightBold: "\u254A",
16768
+ lineUpBoldDownBoldLeftBoldRight: "\u2549",
16769
+ lineUpBoldDownLeftRight: "\u2540",
16770
+ lineUpDownBoldLeftRight: "\u2541",
16771
+ lineUpDownLeftBoldRight: "\u253D",
16772
+ lineUpDownLeftRightBold: "\u253E",
16773
+ lineUpBoldDownBoldLeftRight: "\u2542",
16774
+ lineUpDownLeftBoldRightBold: "\u253F",
16775
+ lineUpBoldDownLeftBoldRight: "\u2543",
16776
+ lineUpBoldDownLeftRightBold: "\u2544",
16777
+ lineUpDownBoldLeftBoldRight: "\u2545",
16778
+ lineUpDownBoldLeftRightBold: "\u2546",
16779
+ lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
16780
+ lineUpDoubleDownDoubleLeftRight: "\u256B",
16781
+ lineUpDownLeftDoubleRightDouble: "\u256A",
16782
+ lineCross: "\u2573",
16783
+ lineBackslash: "\u2572",
16784
+ lineSlash: "\u2571"
16785
+ };
16786
+ var specialMainSymbols = {
16787
+ tick: "\u2714",
16788
+ info: "\u2139",
16789
+ warning: "\u26A0",
16790
+ cross: "\u2718",
16791
+ squareSmall: "\u25FB",
16792
+ squareSmallFilled: "\u25FC",
16793
+ circle: "\u25EF",
16794
+ circleFilled: "\u25C9",
16795
+ circleDotted: "\u25CC",
16796
+ circleDouble: "\u25CE",
16797
+ circleCircle: "\u24DE",
16798
+ circleCross: "\u24E7",
16799
+ circlePipe: "\u24BE",
16800
+ radioOn: "\u25C9",
16801
+ radioOff: "\u25EF",
16802
+ checkboxOn: "\u2612",
16803
+ checkboxOff: "\u2610",
16804
+ checkboxCircleOn: "\u24E7",
16805
+ checkboxCircleOff: "\u24BE",
16806
+ pointer: "\u276F",
16807
+ triangleUpOutline: "\u25B3",
16808
+ triangleLeft: "\u25C0",
16809
+ triangleRight: "\u25B6",
16810
+ lozenge: "\u25C6",
16811
+ lozengeOutline: "\u25C7",
16812
+ hamburger: "\u2630",
16813
+ smiley: "\u32E1",
16814
+ mustache: "\u0DF4",
16815
+ star: "\u2605",
16816
+ play: "\u25B6",
16817
+ nodejs: "\u2B22",
16818
+ oneSeventh: "\u2150",
16819
+ oneNinth: "\u2151",
16820
+ oneTenth: "\u2152"
16821
+ };
16822
+ var specialFallbackSymbols = {
16823
+ tick: "\u221A",
16824
+ info: "i",
16825
+ warning: "\u203C",
16826
+ cross: "\xD7",
16827
+ squareSmall: "\u25A1",
16828
+ squareSmallFilled: "\u25A0",
16829
+ circle: "( )",
16830
+ circleFilled: "(*)",
16831
+ circleDotted: "( )",
16832
+ circleDouble: "( )",
16833
+ circleCircle: "(\u25CB)",
16834
+ circleCross: "(\xD7)",
16835
+ circlePipe: "(\u2502)",
16836
+ radioOn: "(*)",
16837
+ radioOff: "( )",
16838
+ checkboxOn: "[\xD7]",
16839
+ checkboxOff: "[ ]",
16840
+ checkboxCircleOn: "(\xD7)",
16841
+ checkboxCircleOff: "( )",
16842
+ pointer: ">",
16843
+ triangleUpOutline: "\u2206",
16844
+ triangleLeft: "\u25C4",
16845
+ triangleRight: "\u25BA",
16846
+ lozenge: "\u2666",
16847
+ lozengeOutline: "\u25CA",
16848
+ hamburger: "\u2261",
16849
+ smiley: "\u263A",
16850
+ mustache: "\u250C\u2500\u2510",
16851
+ star: "\u2736",
16852
+ play: "\u25BA",
16853
+ nodejs: "\u2666",
16854
+ oneSeventh: "1/7",
16855
+ oneNinth: "1/9",
16856
+ oneTenth: "1/10"
16857
+ };
16858
+ var mainSymbols = {
16859
+ ...common,
16860
+ ...specialMainSymbols
16861
+ };
16862
+ var fallbackSymbols = {
16863
+ ...common,
16864
+ ...specialFallbackSymbols
16865
+ };
16866
+ var shouldUseMain = isUnicodeSupported();
16867
+ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
16868
+ var dist_default = figures;
16869
+ var replacements = Object.entries(specialMainSymbols);
16870
+
16871
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/theme.js
16872
+ var defaultTheme = {
16873
+ prefix: {
16874
+ idle: (0, import_node_util.styleText)("blue", "?"),
16875
+ done: (0, import_node_util.styleText)("green", dist_default.tick)
16876
+ },
16877
+ spinner: {
16878
+ interval: 80,
16879
+ frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"].map((frame) => (0, import_node_util.styleText)("yellow", frame))
16880
+ },
16881
+ keybindings: [],
16882
+ style: {
16883
+ answer: (text) => (0, import_node_util.styleText)("cyan", text),
16884
+ message: (text) => (0, import_node_util.styleText)("bold", text),
16885
+ error: (text) => (0, import_node_util.styleText)("red", `> ${text}`),
16886
+ defaultAnswer: (text) => (0, import_node_util.styleText)("dim", `(${text})`),
16887
+ help: (text) => (0, import_node_util.styleText)("dim", text),
16888
+ highlight: (text) => (0, import_node_util.styleText)("cyan", text),
16889
+ key: (text) => (0, import_node_util.styleText)("cyan", (0, import_node_util.styleText)("bold", `<${text}>`))
16890
+ }
16891
+ };
16892
+ function getDefaultTheme() {
16893
+ return {
16894
+ ...defaultTheme,
16895
+ keybindings: getDefaultKeybindings()
16896
+ };
16897
+ }
16898
+
16899
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/make-theme.js
16900
+ function isPlainObject(value) {
16901
+ if (typeof value !== "object" || value === null)
16902
+ return false;
16903
+ let proto = value;
16904
+ while (Object.getPrototypeOf(proto) !== null) {
16905
+ proto = Object.getPrototypeOf(proto);
16906
+ }
16907
+ return Object.getPrototypeOf(value) === proto;
16908
+ }
16909
+ function deepMerge(...objects) {
16910
+ const output = {};
16911
+ for (const obj of objects) {
16912
+ for (const [key, value] of Object.entries(obj)) {
16913
+ const prevValue = output[key];
16914
+ output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
16915
+ }
16916
+ }
16917
+ return output;
16918
+ }
16919
+ function makeTheme(...themes) {
16920
+ const themesToMerge = [
16921
+ getDefaultTheme(),
16922
+ ...themes.filter((theme) => theme != null)
16923
+ ];
16924
+ return deepMerge(...themesToMerge);
16925
+ }
16926
+
16927
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-prefix.js
16928
+ function usePrefix({ status = "idle", theme }) {
16929
+ const [showLoader, setShowLoader] = useState(false);
16930
+ const [tick, setTick] = useState(0);
16931
+ const { prefix, spinner } = makeTheme(theme);
16932
+ useEffect(() => {
16933
+ if (status === "loading") {
16934
+ let tickInterval;
16935
+ let inc = -1;
16936
+ const delayTimeout = setTimeout(() => {
16937
+ setShowLoader(true);
16938
+ tickInterval = setInterval(() => {
16939
+ inc = inc + 1;
16940
+ setTick(inc % spinner.frames.length);
16941
+ }, spinner.interval);
16942
+ }, 300);
16943
+ return () => {
16944
+ clearTimeout(delayTimeout);
16945
+ clearInterval(tickInterval);
16946
+ };
16947
+ } else {
16948
+ setShowLoader(false);
16949
+ }
16950
+ }, [status]);
16951
+ if (showLoader) {
16952
+ return spinner.frames[tick];
16953
+ }
16954
+ const iconName = status === "loading" ? "idle" : status;
16955
+ return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
16956
+ }
16957
+
16958
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-memo.js
16959
+ function useMemo(fn, dependencies) {
16960
+ return withPointer((pointer) => {
16961
+ const prev = pointer.get();
16962
+ if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
16963
+ const value = fn();
16964
+ pointer.set({ value, dependencies });
16965
+ return value;
16966
+ }
16967
+ return prev.value;
16968
+ });
16969
+ }
16970
+
16971
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-ref.js
16972
+ function useRef(val) {
16973
+ return useState({ current: val })[0];
16974
+ }
16975
+
16976
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/use-keypress.js
16977
+ function useKeypress(userHandler) {
16978
+ const signal = useRef(userHandler);
16979
+ signal.current = userHandler;
16980
+ useEffect((rl) => {
16981
+ let ignore = false;
16982
+ const handler = withUpdates((_input, event) => {
16983
+ if (ignore)
16984
+ return;
16985
+ void signal.current(event, rl);
16986
+ });
16987
+ rl.input.on("keypress", handler);
16988
+ return () => {
16989
+ ignore = true;
16990
+ rl.input.removeListener("keypress", handler);
16991
+ };
16992
+ }, []);
16993
+ }
16994
+
16995
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/utils.js
16996
+ var import_cli_width = __toESM(require_cli_width(), 1);
16997
+
16998
+ // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
16999
+ var getCodePointsLength = /* @__PURE__ */ (() => {
17000
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
17001
+ return (input) => {
17002
+ let surrogatePairsNr = 0;
17003
+ SURROGATE_PAIR_RE.lastIndex = 0;
17004
+ while (SURROGATE_PAIR_RE.test(input)) {
17005
+ surrogatePairsNr += 1;
17006
+ }
17007
+ return input.length - surrogatePairsNr;
17008
+ };
17009
+ })();
17010
+ var isFullWidth = (x) => {
17011
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
17012
+ };
17013
+ var isWideNotCJKTNotEmoji = (x) => {
17014
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
17015
+ };
17016
+
17017
+ // ../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
17018
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
17019
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
17020
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
17021
+ var TAB_RE = /\t{1,1000}/y;
17022
+ var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
17023
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
17024
+ var MODIFIER_RE = /\p{M}+/gu;
17025
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
17026
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
17027
+ const LIMIT = truncationOptions.limit ?? Infinity;
17028
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
17029
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
17030
+ const ANSI_WIDTH = 0;
17031
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
17032
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
17033
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
17034
+ const FULL_WIDTH_WIDTH = 2;
17035
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
17036
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
17037
+ const PARSE_BLOCKS = [
17038
+ [LATIN_RE, REGULAR_WIDTH],
17039
+ [ANSI_RE, ANSI_WIDTH],
17040
+ [CONTROL_RE, CONTROL_WIDTH],
17041
+ [TAB_RE, TAB_WIDTH],
17042
+ [EMOJI_RE, EMOJI_WIDTH],
17043
+ [CJKT_WIDE_RE, WIDE_WIDTH]
17044
+ ];
17045
+ let indexPrev = 0;
17046
+ let index = 0;
17047
+ let length = input.length;
17048
+ let lengthExtra = 0;
17049
+ let truncationEnabled = false;
17050
+ let truncationIndex = length;
17051
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
17052
+ let unmatchedStart = 0;
17053
+ let unmatchedEnd = 0;
17054
+ let width = 0;
17055
+ let widthExtra = 0;
17056
+ outer: while (true) {
17057
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
17058
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
17059
+ lengthExtra = 0;
17060
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
17061
+ const codePoint = char.codePointAt(0) || 0;
17062
+ if (isFullWidth(codePoint)) {
17063
+ widthExtra = FULL_WIDTH_WIDTH;
17064
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
17065
+ widthExtra = WIDE_WIDTH;
17066
+ } else {
17067
+ widthExtra = REGULAR_WIDTH;
17068
+ }
17069
+ if (width + widthExtra > truncationLimit) {
17070
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
17071
+ }
17072
+ if (width + widthExtra > LIMIT) {
17073
+ truncationEnabled = true;
17074
+ break outer;
17075
+ }
17076
+ lengthExtra += char.length;
17077
+ width += widthExtra;
17078
+ }
17079
+ unmatchedStart = unmatchedEnd = 0;
17080
+ }
17081
+ if (index >= length) {
17082
+ break outer;
17083
+ }
17084
+ for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
17085
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
17086
+ BLOCK_RE.lastIndex = index;
17087
+ if (BLOCK_RE.test(input)) {
17088
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
17089
+ widthExtra = lengthExtra * BLOCK_WIDTH;
17090
+ if (width + widthExtra > truncationLimit) {
17091
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
17092
+ }
17093
+ if (width + widthExtra > LIMIT) {
17094
+ truncationEnabled = true;
17095
+ break outer;
17096
+ }
17097
+ width += widthExtra;
17098
+ unmatchedStart = indexPrev;
17099
+ unmatchedEnd = index;
17100
+ index = indexPrev = BLOCK_RE.lastIndex;
17101
+ continue outer;
17102
+ }
17103
+ }
17104
+ index += 1;
17105
+ }
17106
+ return {
17107
+ width: truncationEnabled ? truncationLimit : width,
17108
+ index: truncationEnabled ? truncationIndex : length,
17109
+ truncated: truncationEnabled,
17110
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
17111
+ };
17112
+ };
17113
+ var dist_default2 = getStringTruncatedWidth;
17114
+
17115
+ // ../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
17116
+ var NO_TRUNCATION2 = {
17117
+ limit: Infinity,
17118
+ ellipsis: "",
17119
+ ellipsisWidth: 0
17120
+ };
17121
+ var fastStringWidth = (input, options = {}) => {
17122
+ return dist_default2(input, NO_TRUNCATION2, options).width;
17123
+ };
17124
+ var dist_default3 = fastStringWidth;
17125
+
17126
+ // ../node_modules/.pnpm/fast-wrap-ansi@0.2.0/node_modules/fast-wrap-ansi/lib/main.js
17127
+ var ESC = "\x1B";
17128
+ var CSI = "\x9B";
17129
+ var END_CODE = 39;
17130
+ var ANSI_ESCAPE_BELL = "\x07";
17131
+ var ANSI_CSI = "[";
17132
+ var ANSI_OSC = "]";
17133
+ var ANSI_SGR_TERMINATOR = "m";
17134
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
17135
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
17136
+ var getClosingCode = (openingCode) => {
17137
+ if (openingCode >= 30 && openingCode <= 37)
17138
+ return 39;
17139
+ if (openingCode >= 90 && openingCode <= 97)
17140
+ return 39;
17141
+ if (openingCode >= 40 && openingCode <= 47)
17142
+ return 49;
17143
+ if (openingCode >= 100 && openingCode <= 107)
17144
+ return 49;
17145
+ if (openingCode === 1 || openingCode === 2)
17146
+ return 22;
17147
+ if (openingCode === 3)
17148
+ return 23;
17149
+ if (openingCode === 4)
17150
+ return 24;
17151
+ if (openingCode === 7)
17152
+ return 27;
17153
+ if (openingCode === 8)
17154
+ return 28;
17155
+ if (openingCode === 9)
17156
+ return 29;
17157
+ if (openingCode === 0)
17158
+ return 0;
17159
+ return void 0;
17160
+ };
17161
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
17162
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
17163
+ var wrapWord = (rows, word, columns) => {
17164
+ const characters = word[Symbol.iterator]();
17165
+ let isInsideEscape = false;
17166
+ let isInsideLinkEscape = false;
17167
+ let lastRow = rows.at(-1);
17168
+ let visible = lastRow === void 0 ? 0 : dist_default3(lastRow);
17169
+ let currentCharacter = characters.next();
17170
+ let nextCharacter = characters.next();
17171
+ let rawCharacterIndex = 0;
17172
+ while (!currentCharacter.done) {
17173
+ const character = currentCharacter.value;
17174
+ const characterLength = dist_default3(character);
17175
+ if (visible + characterLength <= columns) {
17176
+ rows[rows.length - 1] += character;
17177
+ } else {
17178
+ rows.push(character);
17179
+ visible = 0;
17180
+ }
17181
+ if (character === ESC || character === CSI) {
17182
+ isInsideEscape = true;
17183
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
17184
+ }
17185
+ if (isInsideEscape) {
17186
+ if (isInsideLinkEscape) {
17187
+ if (character === ANSI_ESCAPE_BELL) {
17188
+ isInsideEscape = false;
17189
+ isInsideLinkEscape = false;
17190
+ }
17191
+ } else if (character === ANSI_SGR_TERMINATOR) {
17192
+ isInsideEscape = false;
17193
+ }
17194
+ } else {
17195
+ visible += characterLength;
17196
+ if (visible === columns && !nextCharacter.done) {
17197
+ rows.push("");
17198
+ visible = 0;
17199
+ }
17200
+ }
17201
+ currentCharacter = nextCharacter;
17202
+ nextCharacter = characters.next();
17203
+ rawCharacterIndex += character.length;
17204
+ }
17205
+ lastRow = rows.at(-1);
17206
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
17207
+ rows[rows.length - 2] += rows.pop();
17208
+ }
17209
+ };
17210
+ var stringVisibleTrimSpacesRight = (string) => {
17211
+ const words = string.split(" ");
17212
+ let last = words.length;
17213
+ while (last) {
17214
+ if (dist_default3(words[last - 1])) {
17215
+ break;
17216
+ }
17217
+ last--;
17218
+ }
17219
+ if (last === words.length) {
17220
+ return string;
17221
+ }
17222
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
17223
+ };
17224
+ var exec = (string, columns, options = {}) => {
17225
+ if (options.trim !== false && string.trim() === "") {
17226
+ return "";
17227
+ }
17228
+ let returnValue = "";
17229
+ let escapeCode;
17230
+ let escapeUrl;
17231
+ const words = string.split(" ");
17232
+ let rows = [""];
17233
+ let rowLength = 0;
17234
+ for (let index = 0; index < words.length; index++) {
17235
+ const word = words[index];
17236
+ if (options.trim !== false) {
17237
+ const row = rows.at(-1) ?? "";
17238
+ const trimmed = row.trimStart();
17239
+ if (row.length !== trimmed.length) {
17240
+ rows[rows.length - 1] = trimmed;
17241
+ rowLength = dist_default3(trimmed);
17242
+ }
17243
+ }
17244
+ if (index !== 0) {
17245
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
17246
+ rows.push("");
17247
+ rowLength = 0;
17248
+ }
17249
+ if (rowLength || options.trim === false) {
17250
+ rows[rows.length - 1] += " ";
17251
+ rowLength++;
17252
+ }
17253
+ }
17254
+ const wordLength = dist_default3(word);
17255
+ if (options.hard && wordLength > columns) {
17256
+ const remainingColumns = columns - rowLength;
17257
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
17258
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
17259
+ if (breaksStartingNextLine < breaksStartingThisLine) {
17260
+ rows.push("");
17261
+ }
17262
+ wrapWord(rows, word, columns);
17263
+ rowLength = dist_default3(rows.at(-1) ?? "");
17264
+ continue;
17265
+ }
17266
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
17267
+ if (options.wordWrap === false && rowLength < columns) {
17268
+ wrapWord(rows, word, columns);
17269
+ rowLength = dist_default3(rows.at(-1) ?? "");
17270
+ continue;
17271
+ }
17272
+ rows.push("");
17273
+ rowLength = 0;
17274
+ }
17275
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
17276
+ wrapWord(rows, word, columns);
17277
+ rowLength = dist_default3(rows.at(-1) ?? "");
17278
+ continue;
17279
+ }
17280
+ rows[rows.length - 1] += word;
17281
+ rowLength += wordLength;
17282
+ }
17283
+ if (options.trim !== false) {
17284
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
17285
+ }
17286
+ const preString = rows.join("\n");
17287
+ let inSurrogate = false;
17288
+ for (let i = 0; i < preString.length; i++) {
17289
+ const character = preString[i];
17290
+ returnValue += character;
17291
+ if (!inSurrogate) {
17292
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
17293
+ if (inSurrogate) {
17294
+ continue;
17295
+ }
17296
+ } else {
17297
+ inSurrogate = false;
17298
+ }
17299
+ if (character === ESC || character === CSI) {
17300
+ GROUP_REGEX.lastIndex = i + 1;
17301
+ const groupsResult = GROUP_REGEX.exec(preString);
17302
+ const groups = groupsResult?.groups;
17303
+ if (groups?.code !== void 0) {
17304
+ const code = Number.parseFloat(groups.code);
17305
+ escapeCode = code === END_CODE ? void 0 : code;
17306
+ } else if (groups?.uri !== void 0) {
17307
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
17308
+ }
17309
+ }
17310
+ if (preString[i + 1] === "\n") {
17311
+ if (escapeUrl) {
17312
+ returnValue += wrapAnsiHyperlink("");
17313
+ }
17314
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
17315
+ if (escapeCode && closingCode) {
17316
+ returnValue += wrapAnsiCode(closingCode);
17317
+ }
17318
+ } else if (character === "\n") {
17319
+ if (escapeCode && getClosingCode(escapeCode)) {
17320
+ returnValue += wrapAnsiCode(escapeCode);
17321
+ }
17322
+ if (escapeUrl) {
17323
+ returnValue += wrapAnsiHyperlink(escapeUrl);
17324
+ }
17325
+ }
17326
+ }
17327
+ return returnValue;
17328
+ };
17329
+ var CRLF_OR_LF = /\r?\n/;
17330
+ function wrapAnsi(string, columns, options) {
17331
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
17332
+ }
17333
+
17334
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/utils.js
17335
+ function breakLines(content, width) {
17336
+ return content.split("\n").flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split("\n").map((str) => str.trimEnd())).join("\n");
17337
+ }
17338
+ function readlineWidth() {
17339
+ return (0, import_cli_width.default)({ defaultWidth: 80, output: readline().output });
17340
+ }
17341
+
17342
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
17343
+ function usePointerPosition({ active, renderedItems, pageSize, loop }) {
17344
+ const state = useRef({
17345
+ lastPointer: active,
17346
+ lastActive: void 0
17347
+ });
17348
+ const { lastPointer, lastActive } = state.current;
17349
+ const middle = Math.floor(pageSize / 2);
17350
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
17351
+ const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
17352
+ let pointer = defaultPointerPosition;
17353
+ if (renderedLength > pageSize) {
17354
+ if (loop) {
17355
+ pointer = lastPointer;
17356
+ if (
17357
+ // First render, skip this logic.
17358
+ lastActive != null && // Only move the pointer down when the user moves down.
17359
+ lastActive < active && // Check user didn't move up across page boundary.
17360
+ active - lastActive < pageSize
17361
+ ) {
17362
+ pointer = Math.min(
17363
+ // Furthest allowed position for the pointer is the middle of the list
17364
+ middle,
17365
+ Math.abs(active - lastActive) === 1 ? Math.min(
17366
+ // Move the pointer at most the height of the last active item.
17367
+ lastPointer + (renderedItems[lastActive]?.length ?? 0),
17368
+ // If the user moved by one item, move the pointer to the natural position of the active item as
17369
+ // long as it doesn't move the cursor up.
17370
+ Math.max(defaultPointerPosition, lastPointer)
17371
+ ) : (
17372
+ // Otherwise, move the pointer down by the difference between the active and last active item.
17373
+ lastPointer + active - lastActive
17374
+ )
17375
+ );
17376
+ }
17377
+ } else {
17378
+ const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
17379
+ pointer = spaceUnderActive < pageSize - middle ? (
17380
+ // If the active item is near the end of the list, progressively move the cursor towards the end.
17381
+ pageSize - spaceUnderActive
17382
+ ) : (
17383
+ // Otherwise, progressively move the pointer to the middle of the list.
17384
+ Math.min(defaultPointerPosition, middle)
17385
+ );
17386
+ }
17387
+ }
17388
+ state.current.lastPointer = pointer;
17389
+ state.current.lastActive = active;
17390
+ return pointer;
17391
+ }
17392
+ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
17393
+ const width = readlineWidth();
17394
+ const bound = (num) => (num % items.length + items.length) % items.length;
17395
+ const renderedItems = items.map((item, index) => {
17396
+ if (item == null)
17397
+ return [];
17398
+ return breakLines(renderItem({ item, index, isActive: index === active }), width).split("\n");
17399
+ });
17400
+ const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
17401
+ const renderItemAtIndex = (index) => renderedItems[index] ?? [];
17402
+ const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
17403
+ const activeItem = renderItemAtIndex(active).slice(0, pageSize);
17404
+ const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
17405
+ const pageBuffer = Array.from({ length: pageSize });
17406
+ pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
17407
+ const itemVisited = /* @__PURE__ */ new Set([active]);
17408
+ let bufferPointer = activeItemPosition + activeItem.length;
17409
+ let itemPointer = bound(active + 1);
17410
+ while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
17411
+ const lines = renderItemAtIndex(itemPointer);
17412
+ const linesToAdd = lines.slice(0, pageSize - bufferPointer);
17413
+ pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
17414
+ itemVisited.add(itemPointer);
17415
+ bufferPointer += linesToAdd.length;
17416
+ itemPointer = bound(itemPointer + 1);
17417
+ }
17418
+ bufferPointer = activeItemPosition - 1;
17419
+ itemPointer = bound(active - 1);
17420
+ while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
17421
+ const lines = renderItemAtIndex(itemPointer);
17422
+ const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
17423
+ pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
17424
+ itemVisited.add(itemPointer);
17425
+ bufferPointer -= linesToAdd.length;
17426
+ itemPointer = bound(itemPointer - 1);
17427
+ }
17428
+ return pageBuffer.filter((line) => typeof line === "string").join("\n");
17429
+ }
17430
+
17431
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/create-prompt.js
17432
+ var readline2 = __toESM(require("readline"), 1);
17433
+ var import_node_async_hooks3 = require("async_hooks");
17434
+ var import_mute_stream = __toESM(require_lib(), 1);
17435
+
17436
+ // ../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
17437
+ var signals = [];
17438
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
17439
+ if (process.platform !== "win32") {
17440
+ signals.push(
17441
+ "SIGALRM",
17442
+ "SIGABRT",
17443
+ "SIGVTALRM",
17444
+ "SIGXCPU",
17445
+ "SIGXFSZ",
17446
+ "SIGUSR2",
17447
+ "SIGTRAP",
17448
+ "SIGSYS",
17449
+ "SIGQUIT",
17450
+ "SIGIOT"
17451
+ // should detect profiler and enable/disable accordingly.
17452
+ // see #21
17453
+ // 'SIGPROF'
17454
+ );
17455
+ }
17456
+ if (process.platform === "linux") {
17457
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
17458
+ }
17459
+
17460
+ // ../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
17461
+ var processOk = (process4) => !!process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
17462
+ var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
17463
+ var global = globalThis;
17464
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
17465
+ var Emitter = class {
17466
+ emitted = {
17467
+ afterExit: false,
17468
+ exit: false
17469
+ };
17470
+ listeners = {
17471
+ afterExit: [],
17472
+ exit: []
17473
+ };
17474
+ count = 0;
17475
+ id = Math.random();
17476
+ constructor() {
17477
+ if (global[kExitEmitter]) {
17478
+ return global[kExitEmitter];
17479
+ }
17480
+ ObjectDefineProperty(global, kExitEmitter, {
17481
+ value: this,
17482
+ writable: false,
17483
+ enumerable: false,
17484
+ configurable: false
17485
+ });
17486
+ }
17487
+ on(ev, fn) {
17488
+ this.listeners[ev].push(fn);
17489
+ }
17490
+ removeListener(ev, fn) {
17491
+ const list = this.listeners[ev];
17492
+ const i = list.indexOf(fn);
17493
+ if (i === -1) {
17494
+ return;
17495
+ }
17496
+ if (i === 0 && list.length === 1) {
17497
+ list.length = 0;
17498
+ } else {
17499
+ list.splice(i, 1);
17500
+ }
17501
+ }
17502
+ emit(ev, code, signal) {
17503
+ if (this.emitted[ev]) {
17504
+ return false;
17505
+ }
17506
+ this.emitted[ev] = true;
17507
+ let ret = false;
17508
+ for (const fn of this.listeners[ev]) {
17509
+ ret = fn(code, signal) === true || ret;
17510
+ }
17511
+ if (ev === "exit") {
17512
+ ret = this.emit("afterExit", code, signal) || ret;
17513
+ }
17514
+ return ret;
17515
+ }
17516
+ };
17517
+ var SignalExitBase = class {
17518
+ };
17519
+ var signalExitWrap = (handler) => {
17520
+ return {
17521
+ onExit(cb, opts) {
17522
+ return handler.onExit(cb, opts);
17523
+ },
17524
+ load() {
17525
+ return handler.load();
17526
+ },
17527
+ unload() {
17528
+ return handler.unload();
17529
+ }
17530
+ };
17531
+ };
17532
+ var SignalExitFallback = class extends SignalExitBase {
17533
+ onExit() {
17534
+ return () => {
17535
+ };
17536
+ }
17537
+ load() {
17538
+ }
17539
+ unload() {
17540
+ }
17541
+ };
17542
+ var SignalExit = class extends SignalExitBase {
17543
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
17544
+ // so use a supported signal instead
17545
+ /* c8 ignore start */
17546
+ #hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
17547
+ /* c8 ignore stop */
17548
+ #emitter = new Emitter();
17549
+ #process;
17550
+ #originalProcessEmit;
17551
+ #originalProcessReallyExit;
17552
+ #sigListeners = {};
17553
+ #loaded = false;
17554
+ constructor(process4) {
17555
+ super();
17556
+ this.#process = process4;
17557
+ this.#sigListeners = {};
17558
+ for (const sig of signals) {
17559
+ this.#sigListeners[sig] = () => {
17560
+ const listeners = this.#process.listeners(sig);
17561
+ let { count } = this.#emitter;
17562
+ const p = process4;
17563
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
17564
+ count += p.__signal_exit_emitter__.count;
17565
+ }
17566
+ if (listeners.length === count) {
17567
+ this.unload();
17568
+ const ret = this.#emitter.emit("exit", null, sig);
17569
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
17570
+ if (!ret)
17571
+ process4.kill(process4.pid, s);
17572
+ }
17573
+ };
17574
+ }
17575
+ this.#originalProcessReallyExit = process4.reallyExit;
17576
+ this.#originalProcessEmit = process4.emit;
17577
+ }
17578
+ onExit(cb, opts) {
17579
+ if (!processOk(this.#process)) {
17580
+ return () => {
17581
+ };
17582
+ }
17583
+ if (this.#loaded === false) {
17584
+ this.load();
17585
+ }
17586
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
17587
+ this.#emitter.on(ev, cb);
17588
+ return () => {
17589
+ this.#emitter.removeListener(ev, cb);
17590
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
17591
+ this.unload();
17592
+ }
17593
+ };
17594
+ }
17595
+ load() {
17596
+ if (this.#loaded) {
17597
+ return;
17598
+ }
17599
+ this.#loaded = true;
17600
+ this.#emitter.count += 1;
17601
+ for (const sig of signals) {
17602
+ try {
17603
+ const fn = this.#sigListeners[sig];
17604
+ if (fn)
17605
+ this.#process.on(sig, fn);
17606
+ } catch (_) {
17607
+ }
17608
+ }
17609
+ this.#process.emit = (ev, ...a) => {
17610
+ return this.#processEmit(ev, ...a);
17611
+ };
17612
+ this.#process.reallyExit = (code) => {
17613
+ return this.#processReallyExit(code);
17614
+ };
17615
+ }
17616
+ unload() {
17617
+ if (!this.#loaded) {
17618
+ return;
17619
+ }
17620
+ this.#loaded = false;
17621
+ signals.forEach((sig) => {
17622
+ const listener = this.#sigListeners[sig];
17623
+ if (!listener) {
17624
+ throw new Error("Listener not defined for signal: " + sig);
17625
+ }
17626
+ try {
17627
+ this.#process.removeListener(sig, listener);
17628
+ } catch (_) {
17629
+ }
17630
+ });
17631
+ this.#process.emit = this.#originalProcessEmit;
17632
+ this.#process.reallyExit = this.#originalProcessReallyExit;
17633
+ this.#emitter.count -= 1;
17634
+ }
17635
+ #processReallyExit(code) {
17636
+ if (!processOk(this.#process)) {
17637
+ return 0;
17638
+ }
17639
+ this.#process.exitCode = code || 0;
17640
+ this.#emitter.emit("exit", this.#process.exitCode, null);
17641
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
17642
+ }
17643
+ #processEmit(ev, ...args) {
17644
+ const og = this.#originalProcessEmit;
17645
+ if (ev === "exit" && processOk(this.#process)) {
17646
+ if (typeof args[0] === "number") {
17647
+ this.#process.exitCode = args[0];
17648
+ }
17649
+ const ret = og.call(this.#process, ev, ...args);
17650
+ this.#emitter.emit("exit", this.#process.exitCode, null);
17651
+ return ret;
17652
+ } else {
17653
+ return og.call(this.#process, ev, ...args);
17654
+ }
17655
+ }
17656
+ };
17657
+ var process3 = globalThis.process;
17658
+ var {
17659
+ /**
17660
+ * Called when the process is exiting, whether via signal, explicit
17661
+ * exit, or running out of stuff to do.
17662
+ *
17663
+ * If the global process object is not suitable for instrumentation,
17664
+ * then this will be a no-op.
17665
+ *
17666
+ * Returns a function that may be used to unload signal-exit.
17667
+ */
17668
+ onExit,
17669
+ /**
17670
+ * Load the listeners. Likely you never need to call this, unless
17671
+ * doing a rather deep integration with signal-exit functionality.
17672
+ * Mostly exposed for the benefit of testing.
17673
+ *
17674
+ * @internal
17675
+ */
17676
+ load,
17677
+ /**
17678
+ * Unload the listeners. Likely you never need to call this, unless
17679
+ * doing a rather deep integration with signal-exit functionality.
17680
+ * Mostly exposed for the benefit of testing.
17681
+ *
17682
+ * @internal
17683
+ */
17684
+ unload
17685
+ } = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback());
17686
+
17687
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/screen-manager.js
17688
+ var import_node_util2 = require("util");
17689
+
17690
+ // ../node_modules/.pnpm/@inquirer+ansi@2.0.7/node_modules/@inquirer/ansi/dist/index.js
17691
+ var ESC2 = "\x1B[";
17692
+ var cursorLeft = ESC2 + "G";
17693
+ var cursorHide = ESC2 + "?25l";
17694
+ var cursorShow = ESC2 + "?25h";
17695
+ var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
17696
+ var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
17697
+ var cursorTo = (x, y) => {
17698
+ if (typeof y === "number" && !Number.isNaN(y)) {
17699
+ return `${ESC2}${y + 1};${x + 1}H`;
17700
+ }
17701
+ return `${ESC2}${x + 1}G`;
17702
+ };
17703
+ var eraseLine = ESC2 + "2K";
17704
+ var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
17705
+
17706
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/screen-manager.js
17707
+ var height = (content) => content.split("\n").length;
17708
+ var lastLine = (content) => content.split("\n").pop() ?? "";
17709
+ var ScreenManager = class {
17710
+ // These variables are keeping information to allow correct prompt re-rendering
17711
+ height = 0;
17712
+ extraLinesUnderPrompt = 0;
17713
+ cursorPos;
17714
+ rl;
17715
+ constructor(rl) {
17716
+ this.rl = rl;
17717
+ this.cursorPos = rl.getCursorPos();
17718
+ }
17719
+ write(content) {
17720
+ this.rl.output.unmute();
17721
+ this.rl.output.write(content);
17722
+ this.rl.output.mute();
17723
+ }
17724
+ render(content, bottomContent = "") {
17725
+ const promptLine = lastLine(content);
17726
+ const rawPromptLine = (0, import_node_util2.stripVTControlCharacters)(promptLine);
17727
+ let prompt = rawPromptLine;
17728
+ if (this.rl.line.length > 0) {
17729
+ prompt = prompt.slice(0, -this.rl.line.length);
17730
+ }
17731
+ this.rl.setPrompt(prompt);
17732
+ this.cursorPos = this.rl.getCursorPos();
17733
+ const width = readlineWidth();
17734
+ content = breakLines(content, width);
17735
+ bottomContent = breakLines(bottomContent, width);
17736
+ if (rawPromptLine.length % width === 0) {
17737
+ content += "\n";
17738
+ }
17739
+ let output = content + (bottomContent ? "\n" + bottomContent : "");
17740
+ const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
17741
+ const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
17742
+ if (bottomContentHeight > 0)
17743
+ output += cursorUp(bottomContentHeight);
17744
+ output += cursorTo(this.cursorPos.cols);
17745
+ this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
17746
+ this.extraLinesUnderPrompt = bottomContentHeight;
17747
+ this.height = height(output);
17748
+ }
17749
+ checkCursorPos() {
17750
+ const cursorPos = this.rl.getCursorPos();
17751
+ if (cursorPos.cols !== this.cursorPos.cols) {
17752
+ this.write(cursorTo(cursorPos.cols));
17753
+ this.cursorPos = cursorPos;
17754
+ }
17755
+ }
17756
+ done({ clearContent }) {
17757
+ this.rl.setPrompt("");
17758
+ let output = cursorDown(this.extraLinesUnderPrompt);
17759
+ output += clearContent ? eraseLines(this.height) : "\n";
17760
+ output += cursorLeft;
17761
+ output += cursorShow;
17762
+ this.write(output);
17763
+ this.rl.close();
17764
+ }
17765
+ };
17766
+
17767
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
17768
+ var PromisePolyfill = class extends Promise {
17769
+ // Available starting from Node 22
17770
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
17771
+ static withResolver() {
17772
+ let resolve4;
17773
+ let reject;
17774
+ const promise = new Promise((res, rej) => {
17775
+ resolve4 = res;
17776
+ reject = rej;
17777
+ });
17778
+ return { promise, resolve: resolve4, reject };
17779
+ }
17780
+ };
17781
+
17782
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/create-prompt.js
17783
+ var import_node_path6 = __toESM(require("path"), 1);
17784
+ var nativeSetImmediate = globalThis.setImmediate;
17785
+ function getCallSites() {
17786
+ const savedPrepareStackTrace = Error.prepareStackTrace;
17787
+ let result = [];
17788
+ try {
17789
+ Error.prepareStackTrace = (_, callSites) => {
17790
+ const callSitesWithoutCurrent = callSites.slice(1);
17791
+ result = callSitesWithoutCurrent;
17792
+ return callSitesWithoutCurrent;
17793
+ };
17794
+ new Error().stack;
17795
+ } catch {
17796
+ return result;
17797
+ }
17798
+ Error.prepareStackTrace = savedPrepareStackTrace;
17799
+ return result;
17800
+ }
17801
+ function createPrompt(view) {
17802
+ const callSites = getCallSites();
17803
+ const prompt = (config, context = {}) => {
17804
+ const { input = process.stdin, signal } = context;
17805
+ const cleanups = /* @__PURE__ */ new Set();
17806
+ const output = new import_mute_stream.default();
17807
+ output.pipe(context.output ?? process.stdout);
17808
+ const rl = readline2.createInterface({
17809
+ terminal: true,
17810
+ input,
17811
+ output
17812
+ });
17813
+ output.mute();
17814
+ const screen = new ScreenManager(rl);
17815
+ const { promise, resolve: resolve4, reject } = PromisePolyfill.withResolver();
17816
+ const cancel = () => reject(new CancelPromptError());
17817
+ if (signal) {
17818
+ const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
17819
+ if (signal.aborted) {
17820
+ abort();
17821
+ return Object.assign(promise, { cancel });
17822
+ }
17823
+ signal.addEventListener("abort", abort);
17824
+ cleanups.add(() => signal.removeEventListener("abort", abort));
17825
+ }
17826
+ cleanups.add(onExit((code, signal2) => {
17827
+ reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
17828
+ }));
17829
+ const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
17830
+ rl.on("SIGINT", sigint);
17831
+ cleanups.add(() => rl.removeListener("SIGINT", sigint));
17832
+ return withHooks(rl, (cycle) => {
17833
+ const hooksCleanup = import_node_async_hooks3.AsyncResource.bind(() => effectScheduler.clearAll());
17834
+ rl.on("close", hooksCleanup);
17835
+ cleanups.add(() => rl.removeListener("close", hooksCleanup));
17836
+ const startCycle = () => {
17837
+ const checkCursorPos = () => screen.checkCursorPos();
17838
+ rl.input.on("keypress", checkCursorPos);
17839
+ cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
17840
+ let pendingDone = null;
17841
+ cycle(() => {
17842
+ let effectsSettled = false;
17843
+ try {
17844
+ const nextView = view(config, (value) => {
17845
+ if (effectsSettled) {
17846
+ resolve4(value);
17847
+ } else {
17848
+ pendingDone = { value };
17849
+ }
17850
+ });
17851
+ if (nextView === void 0) {
17852
+ let callerFilename = callSites[1]?.getFileName();
17853
+ if (callerFilename && !callerFilename.startsWith("file://")) {
17854
+ callerFilename = import_node_path6.default.resolve(callerFilename);
17855
+ }
17856
+ throw new Error(`Prompt functions must return a string.
17857
+ at ${callerFilename}`);
17858
+ }
17859
+ const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
17860
+ screen.render(content, bottomContent);
17861
+ effectScheduler.run();
17862
+ } catch (error) {
17863
+ reject(error);
17864
+ }
17865
+ effectsSettled = true;
17866
+ if (pendingDone !== null) {
17867
+ const { value } = pendingDone;
17868
+ pendingDone = null;
17869
+ resolve4(value);
17870
+ }
17871
+ });
17872
+ };
17873
+ if ("readableFlowing" in input) {
17874
+ nativeSetImmediate(startCycle);
17875
+ } else {
17876
+ startCycle();
17877
+ }
17878
+ return Object.assign(promise.then((answer) => {
17879
+ effectScheduler.clearAll();
17880
+ return answer;
17881
+ }, (error) => {
17882
+ effectScheduler.clearAll();
17883
+ throw error;
17884
+ }).finally(() => {
17885
+ cleanups.forEach((cleanup) => cleanup());
17886
+ screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
17887
+ output.end();
17888
+ }).then(() => promise), { cancel });
17889
+ });
17890
+ };
17891
+ return prompt;
17892
+ }
17893
+
17894
+ // ../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@24.12.4/node_modules/@inquirer/core/dist/lib/Separator.js
17895
+ var import_node_util3 = require("util");
17896
+ var Separator = class {
17897
+ separator = (0, import_node_util3.styleText)("dim", Array.from({ length: 15 }).join(dist_default.line));
17898
+ type = "separator";
17899
+ constructor(separator) {
17900
+ if (separator) {
17901
+ this.separator = separator;
17902
+ }
17903
+ }
17904
+ static isSeparator(choice) {
17905
+ return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
17906
+ }
17907
+ };
17908
+
17909
+ // ../node_modules/.pnpm/@inquirer+checkbox@5.2.1_@types+node@24.12.4/node_modules/@inquirer/checkbox/dist/index.js
17910
+ var import_node_util4 = require("util");
17911
+ var checkboxTheme = {
17912
+ icon: {
17913
+ checked: (0, import_node_util4.styleText)("green", dist_default.circleFilled),
17914
+ unchecked: dist_default.circle,
17915
+ cursor: dist_default.pointer,
17916
+ disabledChecked: (0, import_node_util4.styleText)("green", dist_default.circleDouble),
17917
+ disabledUnchecked: "-"
17918
+ },
17919
+ style: {
17920
+ disabled: (text) => (0, import_node_util4.styleText)("dim", text),
17921
+ renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
17922
+ description: (text) => (0, import_node_util4.styleText)("cyan", text),
17923
+ keysHelpTip: (keys) => keys.map(([key, action]) => `${(0, import_node_util4.styleText)("bold", key)} ${(0, import_node_util4.styleText)("dim", action)}`).join((0, import_node_util4.styleText)("dim", " \u2022 "))
17924
+ },
17925
+ i18n: { disabledError: "This option is disabled and cannot be toggled." }
17926
+ };
17927
+ function isSelectable(item) {
17928
+ return !Separator.isSeparator(item) && !item.disabled;
17929
+ }
17930
+ function isNavigable(item) {
17931
+ return !Separator.isSeparator(item);
17932
+ }
17933
+ function isChecked(item) {
17934
+ return !Separator.isSeparator(item) && item.checked;
17935
+ }
17936
+ function toggle(item) {
17937
+ return isSelectable(item) ? { ...item, checked: !item.checked } : item;
17938
+ }
17939
+ function check(checked) {
17940
+ return function(item) {
17941
+ return isSelectable(item) ? { ...item, checked } : item;
17942
+ };
17943
+ }
17944
+ function normalizeChoices(choices) {
17945
+ return choices.map((choice) => {
17946
+ if (Separator.isSeparator(choice))
17947
+ return choice;
17948
+ if (typeof choice !== "object" || choice === null || !("value" in choice)) {
17949
+ const name2 = String(choice);
17950
+ return {
17951
+ value: choice,
17952
+ name: name2,
17953
+ short: name2,
17954
+ checkedName: name2,
17955
+ disabled: false,
17956
+ checked: false
17957
+ };
17958
+ }
17959
+ const name = choice.name ?? String(choice.value);
17960
+ const normalizedChoice = {
17961
+ value: choice.value,
17962
+ name,
17963
+ short: choice.short ?? name,
17964
+ checkedName: choice.checkedName ?? name,
17965
+ disabled: choice.disabled ?? false,
17966
+ checked: choice.checked ?? false
17967
+ };
17968
+ if (choice.description) {
17969
+ normalizedChoice.description = choice.description;
17970
+ }
17971
+ return normalizedChoice;
17972
+ });
17973
+ }
17974
+ var dist_default4 = createPrompt((config, done) => {
17975
+ const { pageSize = 7, loop = true, required, validate = () => true } = config;
17976
+ const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
17977
+ const theme = makeTheme(checkboxTheme, config.theme);
17978
+ const { keybindings: keybindings2 } = theme;
17979
+ const [status, setStatus] = useState("idle");
17980
+ const prefix = usePrefix({ status, theme });
17981
+ const [items, setItems] = useState(normalizeChoices(config.choices));
17982
+ const bounds = useMemo(() => {
17983
+ const first = items.findIndex(isNavigable);
17984
+ const last = items.findLastIndex(isNavigable);
17985
+ if (first === -1) {
17986
+ throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
17987
+ }
17988
+ return { first, last };
17989
+ }, [items]);
17990
+ const [active, setActive] = useState(bounds.first);
17991
+ const [errorMsg, setError] = useState();
17992
+ useKeypress(async (key) => {
17993
+ if (isEnterKey(key)) {
17994
+ const selection = items.filter(isChecked);
17995
+ const isValid = await validate([...selection]);
17996
+ if (required && !selection.length) {
17997
+ setError("At least one choice must be selected");
17998
+ } else if (isValid === true) {
17999
+ setStatus("done");
18000
+ done(selection.map((choice) => choice.value));
18001
+ } else {
18002
+ setError(isValid || "You must select a valid value");
18003
+ }
18004
+ } else if (isUpKey(key, keybindings2) || isDownKey(key, keybindings2)) {
18005
+ if (errorMsg) {
18006
+ setError(void 0);
18007
+ }
18008
+ if (loop || isUpKey(key, keybindings2) && active !== bounds.first || isDownKey(key, keybindings2) && active !== bounds.last) {
18009
+ const offset = isUpKey(key, keybindings2) ? -1 : 1;
18010
+ let next = active;
18011
+ do {
18012
+ next = (next + offset + items.length) % items.length;
18013
+ } while (!isNavigable(items[next]));
18014
+ setActive(next);
18015
+ }
18016
+ } else if (isSpaceKey(key)) {
18017
+ const activeItem = items[active];
18018
+ if (activeItem && !Separator.isSeparator(activeItem)) {
18019
+ if (activeItem.disabled) {
18020
+ setError(theme.i18n.disabledError);
18021
+ } else {
18022
+ setError(void 0);
18023
+ setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
18024
+ }
18025
+ }
18026
+ } else if (key.name === shortcuts.all) {
18027
+ const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
18028
+ setItems(items.map(check(selectAll)));
18029
+ } else if (key.name === shortcuts.invert) {
18030
+ setItems(items.map(toggle));
18031
+ } else if (isNumberKey(key)) {
18032
+ const selectedIndex = Number(key.name) - 1;
18033
+ let selectableIndex = -1;
18034
+ const position = items.findIndex((item) => {
18035
+ if (Separator.isSeparator(item))
18036
+ return false;
18037
+ selectableIndex++;
18038
+ return selectableIndex === selectedIndex;
18039
+ });
18040
+ const selectedItem = items[position];
18041
+ if (selectedItem && isSelectable(selectedItem)) {
18042
+ setActive(position);
18043
+ setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
18044
+ }
18045
+ }
18046
+ });
18047
+ const message = theme.style.message(config.message, status);
18048
+ let description;
18049
+ const page = usePagination({
18050
+ items,
18051
+ active,
18052
+ renderItem({ item, isActive }) {
18053
+ if (Separator.isSeparator(item)) {
18054
+ return ` ${item.separator}`;
18055
+ }
18056
+ const cursor = isActive ? theme.icon.cursor : " ";
18057
+ if (item.disabled) {
18058
+ const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
18059
+ const checkbox2 = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
18060
+ return theme.style.disabled(`${cursor}${checkbox2} ${item.name} ${disabledLabel}`);
18061
+ }
18062
+ if (isActive) {
18063
+ description = item.description;
18064
+ }
18065
+ const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
18066
+ const name = item.checked ? item.checkedName : item.name;
18067
+ const color = isActive ? theme.style.highlight : (x) => x;
18068
+ return color(`${cursor}${checkbox} ${name}`);
18069
+ },
18070
+ pageSize,
18071
+ loop
18072
+ });
18073
+ if (status === "done") {
18074
+ const selection = items.filter(isChecked);
18075
+ const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
18076
+ return [prefix, message, answer].filter(Boolean).join(" ");
18077
+ }
18078
+ const keys = [
18079
+ ["\u2191\u2193", "navigate"],
18080
+ ["space", "select"]
18081
+ ];
18082
+ if (shortcuts.all)
18083
+ keys.push([shortcuts.all, "all"]);
18084
+ if (shortcuts.invert)
18085
+ keys.push([shortcuts.invert, "invert"]);
18086
+ keys.push(["\u23CE", "submit"]);
18087
+ const helpLine = theme.style.keysHelpTip(keys);
18088
+ const lines = [
18089
+ [prefix, message].filter(Boolean).join(" "),
18090
+ page,
18091
+ " ",
18092
+ description ? theme.style.description(description) : "",
18093
+ errorMsg ? theme.style.error(errorMsg) : "",
18094
+ helpLine
18095
+ ].filter(Boolean).join("\n").trimEnd();
18096
+ return `${lines}${cursorHide}`;
18097
+ });
18098
+
18099
+ // src/install-qclaw.ts
16216
18100
  var import_yaml = __toESM(require_dist(), 1);
16217
18101
  var PLUGIN_ID = "claw-control-center";
16218
18102
  var LEGACY_PLUGIN_ID = "53ai-openclaw";
@@ -16253,8 +18137,8 @@ async function installIntoHermes(input) {
16253
18137
  throw new Error("Hermes install requires --hub-ws-url, --hub-bot-id, and --hub-secret");
16254
18138
  }
16255
18139
  const platformsDir = normalizeHermesPlatformsDir(input.extensionsDir);
16256
- const destination = (0, import_node_path6.join)(platformsDir, HERMES_PLATFORM_ID);
16257
- await (0, import_promises5.mkdir)(destination, { recursive: true });
18140
+ const destination = (0, import_node_path7.join)(platformsDir, HERMES_PLATFORM_ID);
18141
+ await (0, import_promises4.mkdir)(destination, { recursive: true });
16258
18142
  await copyHermesPlatformPackage(input.packageRoot, destination);
16259
18143
  await updateHermesConfig(input.configPath);
16260
18144
  await updateHermesEnv(input.configPath, {
@@ -16271,11 +18155,11 @@ async function installIntoHermes(input) {
16271
18155
  };
16272
18156
  }
16273
18157
  async function installIntoHost(input, hostLabel) {
16274
- await (0, import_promises5.mkdir)(input.extensionsDir, { recursive: true });
16275
- const destination = (0, import_node_path6.join)(input.extensionsDir, PLUGIN_ID);
16276
- await (0, import_promises5.mkdir)(destination, { recursive: true });
18158
+ await (0, import_promises4.mkdir)(input.extensionsDir, { recursive: true });
18159
+ const destination = (0, import_node_path7.join)(input.extensionsDir, PLUGIN_ID);
18160
+ await (0, import_promises4.mkdir)(destination, { recursive: true });
16277
18161
  await copyPublishablePackage(input.packageRoot, destination);
16278
- await (0, import_promises5.mkdir)((0, import_node_path6.dirname)(input.configPath), { recursive: true });
18162
+ await (0, import_promises4.mkdir)((0, import_node_path7.dirname)(input.configPath), { recursive: true });
16279
18163
  const config = await readOpenClawConfig(input.configPath);
16280
18164
  const inferredGateway = inferGatewaySettings(config);
16281
18165
  const inferredHub53AI = inferHub53AISettings(config);
@@ -16309,8 +18193,8 @@ async function installIntoHost(input, hostLabel) {
16309
18193
  ...Array.isArray(plugins.allow) ? plugins.allow.filter((entry) => entry !== LEGACY_PLUGIN_ID) : [],
16310
18194
  PLUGIN_ID
16311
18195
  ]);
16312
- const load = ensureObject(plugins, "load");
16313
- load.paths = dedupeStrings([...Array.isArray(load.paths) ? load.paths : [], input.extensionsDir]);
18196
+ const load2 = ensureObject(plugins, "load");
18197
+ load2.paths = dedupeStrings([...Array.isArray(load2.paths) ? load2.paths : [], input.extensionsDir]);
16314
18198
  const entries = ensureObject(plugins, "entries");
16315
18199
  const legacyEntry = entries[LEGACY_PLUGIN_ID] && typeof entries[LEGACY_PLUGIN_ID] === "object" && !Array.isArray(entries[LEGACY_PLUGIN_ID]) ? entries[LEGACY_PLUGIN_ID] : void 0;
16316
18200
  if (legacyEntry) {
@@ -16370,7 +18254,7 @@ async function installIntoHost(input, hostLabel) {
16370
18254
  }
16371
18255
  }
16372
18256
  previousEntry.enabled = true;
16373
- await (0, import_promises5.writeFile)(input.configPath, `${JSON.stringify(config, null, 2)}
18257
+ await (0, import_promises4.writeFile)(input.configPath, `${JSON.stringify(config, null, 2)}
16374
18258
  `);
16375
18259
  return {
16376
18260
  configPath: input.configPath,
@@ -16391,6 +18275,7 @@ async function runInstallCommand(input) {
16391
18275
  hostDefinitions: input.hostDefinitions,
16392
18276
  selectHosts: input.selectHosts,
16393
18277
  selectHost: input.selectHost,
18278
+ promptSelectHosts: input.promptSelectHosts,
16394
18279
  ttyPath: input.ttyPath
16395
18280
  });
16396
18281
  for (const destination of destinations) {
@@ -16425,8 +18310,8 @@ async function runInstallCommand(input) {
16425
18310
  }
16426
18311
  }
16427
18312
  async function resolveInstallDestinations(args, options = {}) {
16428
- const explicitConfigPath = args["config-path"] ? (0, import_node_path6.resolve)(args["config-path"]) : void 0;
16429
- const explicitExtensionsDir = args["extensions-dir"] ? (0, import_node_path6.resolve)(args["extensions-dir"]) : void 0;
18313
+ const explicitConfigPath = args["config-path"] ? (0, import_node_path7.resolve)(args["config-path"]) : void 0;
18314
+ const explicitExtensionsDir = args["extensions-dir"] ? (0, import_node_path7.resolve)(args["extensions-dir"]) : void 0;
16430
18315
  if (explicitConfigPath && explicitExtensionsDir) {
16431
18316
  const hermes = isHermesDestination(explicitConfigPath, explicitExtensionsDir);
16432
18317
  return [{
@@ -16446,7 +18331,7 @@ async function resolveInstallDestinations(args, options = {}) {
16446
18331
  return [toInstallDestination(compatible[0])];
16447
18332
  }
16448
18333
  if (compatible.length > 1) {
16449
- const selected = options.selectHosts ? await options.selectHosts(compatible, incompatible) : options.selectHost ? [await options.selectHost(compatible)] : await promptForInstallHosts(compatible, incompatible, options.ttyPath ?? "/dev/tty");
18334
+ const selected = options.selectHosts ? await options.selectHosts(compatible, incompatible) : options.selectHost ? [await options.selectHost(compatible)] : await (options.promptSelectHosts ?? promptForInstallHosts)(compatible, incompatible);
16450
18335
  return validateSelectedHosts(selected, compatible).map(toInstallDestination);
16451
18336
  }
16452
18337
  throw new Error(
@@ -16461,27 +18346,27 @@ async function resolveInstallDestinations(args, options = {}) {
16461
18346
  }
16462
18347
  function getDefaultHostDefinitions() {
16463
18348
  const home = (0, import_node_os2.homedir)();
16464
- const qclawHome = (0, import_node_path6.resolve)(home, ".qclaw");
16465
- const openClawHome = (0, import_node_path6.resolve)(home, ".openclaw");
16466
- const hermesHome = (0, import_node_path6.resolve)(home, ".hermes");
18349
+ const qclawHome = (0, import_node_path7.resolve)(home, ".qclaw");
18350
+ const openClawHome = (0, import_node_path7.resolve)(home, ".openclaw");
18351
+ const hermesHome = (0, import_node_path7.resolve)(home, ".hermes");
16467
18352
  return [
16468
18353
  {
16469
18354
  id: "qclaw",
16470
18355
  label: "QClaw",
16471
- configPath: (0, import_node_path6.join)(qclawHome, "openclaw.json"),
16472
- extensionsDir: (0, import_node_path6.resolve)(home, "Library/Application Support/QClaw/openclaw/config/extensions")
18356
+ configPath: (0, import_node_path7.join)(qclawHome, "openclaw.json"),
18357
+ extensionsDir: (0, import_node_path7.resolve)(home, "Library/Application Support/QClaw/openclaw/config/extensions")
16473
18358
  },
16474
18359
  {
16475
18360
  id: "openclaw",
16476
18361
  label: "OpenClaw",
16477
- configPath: (0, import_node_path6.join)(openClawHome, "openclaw.json"),
16478
- extensionsDir: (0, import_node_path6.resolve)(openClawHome, "extensions")
18362
+ configPath: (0, import_node_path7.join)(openClawHome, "openclaw.json"),
18363
+ extensionsDir: (0, import_node_path7.resolve)(openClawHome, "extensions")
16479
18364
  },
16480
18365
  {
16481
18366
  id: "hermes",
16482
18367
  label: "Hermes",
16483
- configPath: (0, import_node_path6.join)(hermesHome, "config.yaml"),
16484
- extensionsDir: (0, import_node_path6.resolve)(hermesHome, "plugins", "platforms"),
18368
+ configPath: (0, import_node_path7.join)(hermesHome, "config.yaml"),
18369
+ extensionsDir: (0, import_node_path7.resolve)(hermesHome, "plugins", "platforms"),
16485
18370
  installKind: "hermes"
16486
18371
  }
16487
18372
  ];
@@ -16489,7 +18374,7 @@ function getDefaultHostDefinitions() {
16489
18374
  function detectInstallHosts(hosts) {
16490
18375
  const seen = /* @__PURE__ */ new Set();
16491
18376
  return hosts.filter((host) => {
16492
- const key = `${(0, import_node_path6.resolve)(host.configPath)}\0${(0, import_node_path6.resolve)(host.extensionsDir)}`;
18377
+ const key = `${(0, import_node_path7.resolve)(host.configPath)}\0${(0, import_node_path7.resolve)(host.extensionsDir)}`;
16493
18378
  if (seen.has(key) || !(0, import_node_fs4.existsSync)(host.configPath)) {
16494
18379
  return false;
16495
18380
  }
@@ -16497,63 +18382,55 @@ function detectInstallHosts(hosts) {
16497
18382
  return true;
16498
18383
  });
16499
18384
  }
16500
- async function promptForInstallHosts(hosts, incompatibleHosts, ttyPath) {
16501
- let handle;
18385
+ async function promptForInstallHosts(hosts, incompatibleHosts) {
16502
18386
  try {
16503
- handle = await (0, import_promises5.open)(ttyPath, "r+");
16504
- const input = handle.createReadStream();
16505
- const output = handle.createWriteStream();
16506
- const readline = (0, import_promises4.createInterface)({ input, output });
16507
- try {
16508
- output.write("Multiple Claw installations were detected.\n");
16509
- output.write("Choose one or more locations to install claw-control-center:\n");
16510
- hosts.forEach((host, index) => {
16511
- output.write(`${index + 1}. ${host.label}
16512
- `);
16513
- output.write(` Config: ${host.configPath}
16514
- `);
16515
- output.write(` Extensions: ${host.extensionsDir}
16516
- `);
16517
- });
16518
- if (incompatibleHosts.length > 0) {
16519
- output.write("\nDetected but not installable by this OpenClaw plugin installer:\n");
16520
- for (const host of incompatibleHosts) {
16521
- output.write(`- ${host.label}: ${host.incompatibilityReason ?? "incompatible plugin format"}
16522
- `);
16523
- }
16524
- }
16525
- const answer = await readline.question(`Install location(s) [1-${hosts.length}, comma-separated, or all]: `);
16526
- const selectedIndexes = parseInstallSelection(answer, hosts.length);
16527
- if (selectedIndexes.length === 0) {
16528
- throw new Error(`invalid install location: ${answer}`);
18387
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
18388
+ throw new Error("interactive terminal is required");
18389
+ }
18390
+ const choices = [
18391
+ ...hosts.map((host) => ({
18392
+ name: host.label,
18393
+ value: host,
18394
+ short: host.label,
18395
+ description: `Config: ${host.configPath}
18396
+ Extensions: ${host.extensionsDir}`
18397
+ })),
18398
+ ...incompatibleHosts.map((host) => ({
18399
+ name: host.label,
18400
+ value: host,
18401
+ short: host.label,
18402
+ disabled: host.incompatibilityReason ?? "incompatible plugin format",
18403
+ description: `Config: ${host.configPath}
18404
+ Extensions: ${host.extensionsDir}`
18405
+ }))
18406
+ ];
18407
+ return await dist_default4({
18408
+ message: "Choose one or more Claw installations to install claw-control-center:",
18409
+ choices,
18410
+ pageSize: Math.min(Math.max(choices.length, 5), 12),
18411
+ required: true,
18412
+ shortcuts: {
18413
+ all: "a",
18414
+ invert: "i"
16529
18415
  }
16530
- return selectedIndexes.map((index) => hosts[index - 1]);
16531
- } finally {
16532
- readline.close();
16533
- input.destroy();
16534
- output.end();
16535
- }
18416
+ });
16536
18417
  } catch (error) {
16537
- if (error instanceof Error && error.message.startsWith("invalid install location:")) {
16538
- throw error;
16539
- }
16540
18418
  throw new Error(
16541
18419
  [
16542
18420
  "multiple Claw installations were detected, but no interactive terminal was available.",
16543
- "Run the installer again with --config-path and --extensions-dir.",
18421
+ "Run the installer again in an interactive terminal, or pass --config-path and --extensions-dir.",
16544
18422
  "",
16545
18423
  "Detected locations:",
16546
- ...formatHostList(hosts)
18424
+ ...formatHostList(hosts),
18425
+ ...error instanceof Error && error.message ? ["", `Prompt error: ${error.message}`] : []
16547
18426
  ].join("\n")
16548
18427
  );
16549
- } finally {
16550
- await handle?.close().catch(() => void 0);
16551
18428
  }
16552
18429
  }
16553
18430
  function toInstallDestination(host) {
16554
18431
  return {
16555
- configPath: (0, import_node_path6.resolve)(host.configPath),
16556
- extensionsDir: (0, import_node_path6.resolve)(host.extensionsDir),
18432
+ configPath: (0, import_node_path7.resolve)(host.configPath),
18433
+ extensionsDir: (0, import_node_path7.resolve)(host.extensionsDir),
16557
18434
  label: host.label,
16558
18435
  installKind: host.installKind ?? "openclaw"
16559
18436
  };
@@ -16573,14 +18450,6 @@ function validateSelectedHosts(selected, compatible) {
16573
18450
  return true;
16574
18451
  });
16575
18452
  }
16576
- function parseInstallSelection(answer, hostCount) {
16577
- const trimmed = answer.trim().toLowerCase();
16578
- if (trimmed === "all" || trimmed === "*") {
16579
- return Array.from({ length: hostCount }, (_, index) => index + 1);
16580
- }
16581
- const indexes = trimmed.split(",").map((part) => Number(part.trim())).filter((index) => Number.isInteger(index) && index >= 1 && index <= hostCount);
16582
- return Array.from(new Set(indexes));
16583
- }
16584
18453
  function formatHostList(hosts) {
16585
18454
  return hosts.flatMap((host) => [
16586
18455
  `- ${host.label}`,
@@ -16618,42 +18487,42 @@ async function copyPublishablePackage(packageRoot, destination) {
16618
18487
  throw new Error(`package root does not exist: ${packageRoot}`);
16619
18488
  }
16620
18489
  for (const relativePath of COPY_ITEMS) {
16621
- const source = (0, import_node_path6.join)(packageRoot, relativePath);
18490
+ const source = (0, import_node_path7.join)(packageRoot, relativePath);
16622
18491
  if (!(0, import_node_fs4.existsSync)(source)) {
16623
18492
  continue;
16624
18493
  }
16625
- const target = (0, import_node_path6.join)(destination, relativePath);
16626
- await (0, import_promises5.rm)(target, { recursive: true, force: true });
16627
- await (0, import_promises5.cp)(source, target, { recursive: true, force: true });
18494
+ const target = (0, import_node_path7.join)(destination, relativePath);
18495
+ await (0, import_promises4.rm)(target, { recursive: true, force: true });
18496
+ await (0, import_promises4.cp)(source, target, { recursive: true, force: true });
16628
18497
  }
16629
18498
  await sanitizeExtensionPackageJson(destination);
16630
18499
  }
16631
18500
  async function sanitizeExtensionPackageJson(destination) {
16632
- const packageJsonPath = (0, import_node_path6.join)(destination, "package.json");
18501
+ const packageJsonPath = (0, import_node_path7.join)(destination, "package.json");
16633
18502
  if (!(0, import_node_fs4.existsSync)(packageJsonPath)) {
16634
18503
  return;
16635
18504
  }
16636
- const packageJson = JSON.parse(await (0, import_promises5.readFile)(packageJsonPath, "utf8"));
18505
+ const packageJson = JSON.parse(await (0, import_promises4.readFile)(packageJsonPath, "utf8"));
16637
18506
  delete packageJson.dependencies;
16638
18507
  delete packageJson.optionalDependencies;
16639
- await (0, import_promises5.writeFile)(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
18508
+ await (0, import_promises4.writeFile)(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
16640
18509
  `);
16641
18510
  }
16642
18511
  async function copyHermesPlatformPackage(packageRoot, destination) {
16643
- const source = (0, import_node_path6.join)(packageRoot, "hermes", "platforms", HERMES_PLATFORM_ID);
18512
+ const source = (0, import_node_path7.join)(packageRoot, "hermes", "platforms", HERMES_PLATFORM_ID);
16644
18513
  if (!(0, import_node_fs4.existsSync)(source)) {
16645
18514
  throw new Error(`Hermes platform package does not exist: ${source}`);
16646
18515
  }
16647
- await (0, import_promises5.rm)(destination, { recursive: true, force: true });
16648
- await (0, import_promises5.mkdir)((0, import_node_path6.dirname)(destination), { recursive: true });
16649
- await (0, import_promises5.cp)(source, destination, { recursive: true, force: true });
18516
+ await (0, import_promises4.rm)(destination, { recursive: true, force: true });
18517
+ await (0, import_promises4.mkdir)((0, import_node_path7.dirname)(destination), { recursive: true });
18518
+ await (0, import_promises4.cp)(source, destination, { recursive: true, force: true });
16650
18519
  }
16651
18520
  async function readPluginBuildInfo(destination) {
16652
- const packagePath = (0, import_node_path6.join)(destination, "package.json");
16653
- const entryPath = (0, import_node_path6.join)(destination, "dist", "index.cjs");
18521
+ const packagePath = (0, import_node_path7.join)(destination, "package.json");
18522
+ const entryPath = (0, import_node_path7.join)(destination, "dist", "index.cjs");
16654
18523
  let version = "unknown";
16655
18524
  try {
16656
- const packageJson = JSON.parse(await (0, import_promises5.readFile)(packagePath, "utf8"));
18525
+ const packageJson = JSON.parse(await (0, import_promises4.readFile)(packagePath, "utf8"));
16657
18526
  if (typeof packageJson.version === "string" && packageJson.version.trim()) {
16658
18527
  version = packageJson.version.trim();
16659
18528
  }
@@ -16661,7 +18530,7 @@ async function readPluginBuildInfo(destination) {
16661
18530
  version = "unknown";
16662
18531
  }
16663
18532
  try {
16664
- const entry = await (0, import_promises5.readFile)(entryPath);
18533
+ const entry = await (0, import_promises4.readFile)(entryPath);
16665
18534
  const digest = (0, import_node_crypto4.createHash)("sha256").update(entry).digest("hex").slice(0, 12);
16666
18535
  return `${PLUGIN_ID}@${version} sha256:${digest}`;
16667
18536
  } catch {
@@ -16669,11 +18538,11 @@ async function readPluginBuildInfo(destination) {
16669
18538
  }
16670
18539
  }
16671
18540
  async function readHermesPluginBuildInfo(destination) {
16672
- const manifestPath = (0, import_node_path6.join)(destination, "plugin.yaml");
18541
+ const manifestPath = (0, import_node_path7.join)(destination, "plugin.yaml");
16673
18542
  try {
16674
- const manifest = (0, import_yaml.parse)(await (0, import_promises5.readFile)(manifestPath, "utf8"));
18543
+ const manifest = (0, import_yaml.parse)(await (0, import_promises4.readFile)(manifestPath, "utf8"));
16675
18544
  const version = typeof manifest?.version === "string" || typeof manifest?.version === "number" ? String(manifest.version) : "unknown";
16676
- const adapter = await (0, import_promises5.readFile)((0, import_node_path6.join)(destination, "adapter.py"));
18545
+ const adapter = await (0, import_promises4.readFile)((0, import_node_path7.join)(destination, "adapter.py"));
16677
18546
  const digest = (0, import_node_crypto4.createHash)("sha256").update(adapter).digest("hex").slice(0, 12);
16678
18547
  return `${PLUGIN_ID}/hermes@${version} sha256:${digest}`;
16679
18548
  } catch {
@@ -16684,10 +18553,10 @@ async function readOpenClawConfig(configPath) {
16684
18553
  if (!(0, import_node_fs4.existsSync)(configPath)) {
16685
18554
  return {};
16686
18555
  }
16687
- return JSON.parse(await (0, import_promises5.readFile)(configPath, "utf8"));
18556
+ return JSON.parse(await (0, import_promises4.readFile)(configPath, "utf8"));
16688
18557
  }
16689
18558
  async function updateHermesConfig(configPath) {
16690
- await (0, import_promises5.mkdir)((0, import_node_path6.dirname)(configPath), { recursive: true });
18559
+ await (0, import_promises4.mkdir)((0, import_node_path7.dirname)(configPath), { recursive: true });
16691
18560
  const config = await readHermesConfig(configPath);
16692
18561
  const plugins = ensureObject(config, "plugins");
16693
18562
  plugins.enabled = dedupeStrings([...Array.isArray(plugins.enabled) ? plugins.enabled : [], HERMES_PLUGIN_KEY, HERMES_PLATFORM_ID]);
@@ -16699,19 +18568,19 @@ async function updateHermesConfig(configPath) {
16699
18568
  const displayPlatforms = ensureObject(display, "platforms");
16700
18569
  const displayPlatform = ensureObject(displayPlatforms, HERMES_PLATFORM_ID);
16701
18570
  displayPlatform.show_reasoning = true;
16702
- await (0, import_promises5.writeFile)(configPath, (0, import_yaml.stringify)(config));
18571
+ await (0, import_promises4.writeFile)(configPath, (0, import_yaml.stringify)(config));
16703
18572
  }
16704
18573
  async function readHermesConfig(configPath) {
16705
18574
  if (!(0, import_node_fs4.existsSync)(configPath)) {
16706
18575
  return {};
16707
18576
  }
16708
- const parsed = (0, import_yaml.parse)(await (0, import_promises5.readFile)(configPath, "utf8"));
18577
+ const parsed = (0, import_yaml.parse)(await (0, import_promises4.readFile)(configPath, "utf8"));
16709
18578
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
16710
18579
  }
16711
18580
  async function updateHermesEnv(configPath, values) {
16712
- const envPath = (0, import_node_path6.join)((0, import_node_path6.dirname)(configPath), ".env");
16713
- await (0, import_promises5.mkdir)((0, import_node_path6.dirname)(envPath), { recursive: true });
16714
- const existing = (0, import_node_fs4.existsSync)(envPath) ? await (0, import_promises5.readFile)(envPath, "utf8") : "";
18581
+ const envPath = (0, import_node_path7.join)((0, import_node_path7.dirname)(configPath), ".env");
18582
+ await (0, import_promises4.mkdir)((0, import_node_path7.dirname)(envPath), { recursive: true });
18583
+ const existing = (0, import_node_fs4.existsSync)(envPath) ? await (0, import_promises4.readFile)(envPath, "utf8") : "";
16715
18584
  const updates = /* @__PURE__ */ new Map([
16716
18585
  [HERMES_ENV_KEYS.botId, values.botId],
16717
18586
  [HERMES_ENV_KEYS.secret, values.secret],
@@ -16732,7 +18601,7 @@ async function updateHermesEnv(configPath, values) {
16732
18601
  lines.push(`${key}=${quoteEnvValue(value)}`);
16733
18602
  }
16734
18603
  }
16735
- await (0, import_promises5.writeFile)(envPath, `${lines.filter((line, index, all) => line || index < all.length - 1).join("\n")}
18604
+ await (0, import_promises4.writeFile)(envPath, `${lines.filter((line, index, all) => line || index < all.length - 1).join("\n")}
16736
18605
  `);
16737
18606
  }
16738
18607
  function quoteEnvValue(value) {
@@ -16748,7 +18617,7 @@ function normalizeHermesPlatformsDir(extensionsDir) {
16748
18617
  return extensionsDir;
16749
18618
  }
16750
18619
  if (parts.at(-1) === "plugins") {
16751
- return (0, import_node_path6.join)(extensionsDir, "platforms");
18620
+ return (0, import_node_path7.join)(extensionsDir, "platforms");
16752
18621
  }
16753
18622
  return extensionsDir;
16754
18623
  }
@@ -16855,17 +18724,17 @@ var plugin = {
16855
18724
  var index_default = plugin;
16856
18725
  function resolveConfigPath(ctx) {
16857
18726
  const candidates = [
16858
- ctx.stateDir ? (0, import_node_path7.join)(ctx.stateDir, "openclaw.json") : void 0,
16859
- process.env.HOME ? (0, import_node_path7.join)(process.env.HOME, ".qclaw", "openclaw.json") : void 0,
16860
- process.env.HOME ? (0, import_node_path7.join)(process.env.HOME, ".openclaw", "openclaw.json") : void 0
18727
+ ctx.stateDir ? (0, import_node_path8.join)(ctx.stateDir, "openclaw.json") : void 0,
18728
+ process.env.HOME ? (0, import_node_path8.join)(process.env.HOME, ".qclaw", "openclaw.json") : void 0,
18729
+ process.env.HOME ? (0, import_node_path8.join)(process.env.HOME, ".openclaw", "openclaw.json") : void 0
16861
18730
  ].filter((candidate) => Boolean(candidate));
16862
18731
  return candidates.find((candidate) => (0, import_node_fs5.existsSync)(candidate)) ?? candidates[0] ?? "openclaw.json";
16863
18732
  }
16864
18733
  function resolveWebDir(rootDir) {
16865
18734
  const candidates = [
16866
- (0, import_node_path7.join)(rootDir, "web-dist"),
16867
- (0, import_node_path7.join)(rootDir, "..", "web", "dist"),
16868
- (0, import_node_path7.join)(rootDir, "web", "dist")
18735
+ (0, import_node_path8.join)(rootDir, "web-dist"),
18736
+ (0, import_node_path8.join)(rootDir, "..", "web", "dist"),
18737
+ (0, import_node_path8.join)(rootDir, "web", "dist")
16869
18738
  ];
16870
18739
  return candidates.find((candidate) => (0, import_node_fs5.existsSync)(candidate));
16871
18740
  }