@slayzone/cli 0.37.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/slay.js +266 -78
  2. package/package.json +1 -1
package/dist/slay.js CHANGED
@@ -216,7 +216,7 @@ var require_util = __commonJS({
216
216
  typeof arg === "undefined";
217
217
  }
218
218
  exports2.isPrimitive = isPrimitive;
219
- exports2.isBuffer = Buffer.isBuffer;
219
+ exports2.isBuffer = require("buffer").Buffer.isBuffer;
220
220
  function objectToString(o) {
221
221
  return Object.prototype.toString.call(o);
222
222
  }
@@ -5488,6 +5488,29 @@ var require_process = __commonJS({
5488
5488
  }
5489
5489
  });
5490
5490
 
5491
+ // ../../../node_modules/readable-stream/lib/internal/shims/process.js
5492
+ var require_process2 = __commonJS({
5493
+ "../../../node_modules/readable-stream/lib/internal/shims/process.js"(exports2, module2) {
5494
+ "use strict";
5495
+ var process3 = ((base, esmKey, keys, isValid) => {
5496
+ if (esmKey in base && base[esmKey] === true) {
5497
+ let candidate;
5498
+ for (const key of keys) {
5499
+ if (!(key in base)) {
5500
+ continue;
5501
+ }
5502
+ candidate = base[key];
5503
+ if (isValid(candidate)) {
5504
+ return candidate;
5505
+ }
5506
+ }
5507
+ }
5508
+ return base;
5509
+ })(require_process(), "__esModule", ["default", "process"], (candidate) => "nextTick" in candidate);
5510
+ module2.exports = process3;
5511
+ }
5512
+ });
5513
+
5491
5514
  // ../../../node_modules/readable-stream/lib/internal/streams/utils.js
5492
5515
  var require_utils = __commonJS({
5493
5516
  "../../../node_modules/readable-stream/lib/internal/streams/utils.js"(exports2, module2) {
@@ -5701,7 +5724,7 @@ var require_utils = __commonJS({
5701
5724
  var require_end_of_stream = __commonJS({
5702
5725
  "../../../node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports2, module2) {
5703
5726
  "use strict";
5704
- var process3 = require_process();
5727
+ var process3 = require_process2();
5705
5728
  var { AbortError, codes } = require_errors();
5706
5729
  var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
5707
5730
  var { kEmptyObject, once } = require_util2();
@@ -5953,7 +5976,7 @@ var require_end_of_stream = __commonJS({
5953
5976
  var require_destroy2 = __commonJS({
5954
5977
  "../../../node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
5955
5978
  "use strict";
5956
- var process3 = require_process();
5979
+ var process3 = require_process2();
5957
5980
  var {
5958
5981
  aggregateTwoErrors,
5959
5982
  codes: { ERR_MULTIPLE_CALLBACK },
@@ -6255,8 +6278,9 @@ var require_legacy = __commonJS({
6255
6278
  if (typeof dest.destroy === "function") dest.destroy();
6256
6279
  }
6257
6280
  function onerror(er) {
6281
+ var _this$listenerCount;
6258
6282
  cleanup();
6259
- if (EE.listenerCount(this, "error") === 0) {
6283
+ if (((_this$listenerCount = this.listenerCount) === null || _this$listenerCount === void 0 ? void 0 : _this$listenerCount.call(this, "error")) === 0) {
6260
6284
  this.emit("error", er);
6261
6285
  }
6262
6286
  }
@@ -6840,7 +6864,7 @@ var require_string_decoder2 = __commonJS({
6840
6864
  var require_from = __commonJS({
6841
6865
  "../../../node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
6842
6866
  "use strict";
6843
- var process3 = require_process();
6867
+ var process3 = require_process2();
6844
6868
  var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
6845
6869
  var { Buffer: Buffer2 } = require("buffer");
6846
6870
  var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors().codes;
@@ -6935,7 +6959,7 @@ var require_from = __commonJS({
6935
6959
  var require_readable2 = __commonJS({
6936
6960
  "../../../node_modules/readable-stream/lib/internal/streams/readable.js"(exports2, module2) {
6937
6961
  "use strict";
6938
- var process3 = require_process();
6962
+ var process3 = require_process2();
6939
6963
  var {
6940
6964
  ArrayPrototypeIndexOf,
6941
6965
  NumberIsInteger,
@@ -7901,7 +7925,7 @@ var require_readable2 = __commonJS({
7901
7925
  var require_writable = __commonJS({
7902
7926
  "../../../node_modules/readable-stream/lib/internal/streams/writable.js"(exports2, module2) {
7903
7927
  "use strict";
7904
- var process3 = require_process();
7928
+ var process3 = require_process2();
7905
7929
  var {
7906
7930
  ArrayPrototypeSlice,
7907
7931
  Error: Error2,
@@ -8521,7 +8545,7 @@ var require_writable = __commonJS({
8521
8545
  // ../../../node_modules/readable-stream/lib/internal/streams/duplexify.js
8522
8546
  var require_duplexify = __commonJS({
8523
8547
  "../../../node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports2, module2) {
8524
- var process3 = require_process();
8548
+ var process3 = require_process2();
8525
8549
  var bufferModule = require("buffer");
8526
8550
  var {
8527
8551
  isReadable,
@@ -9106,7 +9130,7 @@ var require_passthrough2 = __commonJS({
9106
9130
  // ../../../node_modules/readable-stream/lib/internal/streams/pipeline.js
9107
9131
  var require_pipeline = __commonJS({
9108
9132
  "../../../node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports2, module2) {
9109
- var process3 = require_process();
9133
+ var process3 = require_process2();
9110
9134
  var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
9111
9135
  var eos = require_end_of_stream();
9112
9136
  var { once } = require_util2();
@@ -10637,6 +10661,9 @@ var require_b4a = __commonJS({
10637
10661
  function toString(buffer, encoding, start, end) {
10638
10662
  return toBuffer(buffer).toString(encoding, start, end);
10639
10663
  }
10664
+ function toHex(buffer, start, end) {
10665
+ return toBuffer(buffer).toString("hex", start, end);
10666
+ }
10640
10667
  function write(buffer, string4, offset, length, encoding) {
10641
10668
  return toBuffer(buffer).write(string4, offset, length, encoding);
10642
10669
  }
@@ -10709,6 +10736,7 @@ var require_b4a = __commonJS({
10709
10736
  swap64,
10710
10737
  toBuffer,
10711
10738
  toString,
10739
+ toHex,
10712
10740
  write,
10713
10741
  readDoubleBE,
10714
10742
  readDoubleLE,
@@ -10960,14 +10988,55 @@ var require_text_decoder = __commonJS({
10960
10988
  }
10961
10989
  });
10962
10990
 
10991
+ // ../../../node_modules/streamx/lib/errors.js
10992
+ var require_errors2 = __commonJS({
10993
+ "../../../node_modules/streamx/lib/errors.js"(exports2, module2) {
10994
+ module2.exports = class StreamError extends Error {
10995
+ constructor(msg, code, fn = StreamError) {
10996
+ super(msg);
10997
+ this.code = code;
10998
+ if (Error.captureStackTrace) {
10999
+ Error.captureStackTrace(this, fn);
11000
+ }
11001
+ }
11002
+ static isStreamDestroyed(err) {
11003
+ return err && err.code === "STREAM_DESTROYED";
11004
+ }
11005
+ static isPrematureClose(err) {
11006
+ return err && err.code === "PREMATURE_CLOSE";
11007
+ }
11008
+ static isAborted(err) {
11009
+ return err && err.code === "ABORTED";
11010
+ }
11011
+ static isBadArgument(err) {
11012
+ return err && err.code === "BAD_ARGUMENT";
11013
+ }
11014
+ get name() {
11015
+ return "StreamError";
11016
+ }
11017
+ static STREAM_DESTROYED() {
11018
+ return new StreamError("Stream was destroyed", "STREAM_DESTROYED", StreamError.STREAM_DESTROYED);
11019
+ }
11020
+ static PREMATURE_CLOSE(msg = "Premature close") {
11021
+ return new StreamError(msg, "PREMATURE_CLOSE", StreamError.PREMATURE_CLOSE);
11022
+ }
11023
+ static ABORTED() {
11024
+ return new StreamError("Stream aborted", "ABORTED", StreamError.ABORTED);
11025
+ }
11026
+ static BAD_ARGUMENT(msg = "Bad argument") {
11027
+ return new StreamError(msg, "BAD_ARGUMENT", StreamError.BAD_ARGUMENT);
11028
+ }
11029
+ };
11030
+ }
11031
+ });
11032
+
10963
11033
  // ../../../node_modules/streamx/index.js
10964
11034
  var require_streamx = __commonJS({
10965
11035
  "../../../node_modules/streamx/index.js"(exports2, module2) {
10966
11036
  var { EventEmitter: EventEmitter3 } = require_default();
10967
- var STREAM_DESTROYED = new Error("Stream was destroyed");
10968
- var PREMATURE_CLOSE = new Error("Premature close");
10969
11037
  var FIFO = require_fast_fifo();
10970
11038
  var TextDecoder2 = require_text_decoder();
11039
+ var StreamError = require_errors2();
10971
11040
  var qmt = typeof queueMicrotask === "undefined" ? (fn) => global.process.nextTick(fn) : queueMicrotask;
10972
11041
  var MAX = (1 << 29) - 1;
10973
11042
  var OPENING = 1;
@@ -11095,8 +11164,11 @@ var require_streamx = __commonJS({
11095
11164
  return data;
11096
11165
  }
11097
11166
  end(data) {
11098
- if (typeof data === "function") this.stream.once("finish", data);
11099
- else if (data !== void 0 && data !== null) this.push(data);
11167
+ if (typeof data === "function") {
11168
+ this.stream.once("finish", data);
11169
+ } else if (data !== void 0 && data !== null) {
11170
+ this.push(data);
11171
+ }
11100
11172
  this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
11101
11173
  }
11102
11174
  autoBatch(data, cb) {
@@ -11147,8 +11219,11 @@ var require_streamx = __commonJS({
11147
11219
  return true;
11148
11220
  }
11149
11221
  updateCallback() {
11150
- if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update();
11151
- else this.updateNextTick();
11222
+ if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) {
11223
+ this.update();
11224
+ } else {
11225
+ this.updateNextTick();
11226
+ }
11152
11227
  }
11153
11228
  updateNextTick() {
11154
11229
  if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
@@ -11178,7 +11253,7 @@ var require_streamx = __commonJS({
11178
11253
  return (this.stream._duplexState & READ_DONE) !== 0;
11179
11254
  }
11180
11255
  pipe(pipeTo, cb) {
11181
- if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
11256
+ if (this.pipeTo !== null) throw StreamError.BAD_ARGUMENT("Can only pipe to one destination");
11182
11257
  if (typeof cb !== "function") cb = null;
11183
11258
  this.stream._duplexState |= READ_PIPE_DRAINED;
11184
11259
  this.pipeTo = pipeTo;
@@ -11221,7 +11296,9 @@ var require_streamx = __commonJS({
11221
11296
  shift() {
11222
11297
  const data = this.queue.shift();
11223
11298
  this.buffered -= this.byteLength(data);
11224
- if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED;
11299
+ if (this.buffered === 0) {
11300
+ this.stream._duplexState &= READ_NOT_QUEUED;
11301
+ }
11225
11302
  return data;
11226
11303
  }
11227
11304
  unshift(data) {
@@ -11238,9 +11315,12 @@ var require_streamx = __commonJS({
11238
11315
  const stream = this.stream;
11239
11316
  if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
11240
11317
  const data = this.shift();
11241
- if (this.pipeTo !== null && this.pipeTo.write(data) === false)
11318
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
11242
11319
  stream._duplexState &= READ_PIPE_NOT_DRAINED;
11243
- if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
11320
+ }
11321
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
11322
+ stream.emit("data", data);
11323
+ }
11244
11324
  return data;
11245
11325
  }
11246
11326
  if (this.readAhead === false) {
@@ -11253,9 +11333,12 @@ var require_streamx = __commonJS({
11253
11333
  const stream = this.stream;
11254
11334
  while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
11255
11335
  const data = this.shift();
11256
- if (this.pipeTo !== null && this.pipeTo.write(data) === false)
11336
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
11257
11337
  stream._duplexState &= READ_PIPE_NOT_DRAINED;
11258
- if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
11338
+ }
11339
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
11340
+ stream.emit("data", data);
11341
+ }
11259
11342
  }
11260
11343
  }
11261
11344
  update() {
@@ -11272,7 +11355,9 @@ var require_streamx = __commonJS({
11272
11355
  stream._duplexState |= READ_EMITTED_READABLE;
11273
11356
  stream.emit("readable");
11274
11357
  }
11275
- if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
11358
+ if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) {
11359
+ this.updateNonPrimary();
11360
+ }
11276
11361
  } while (this.continueUpdate() === true);
11277
11362
  stream._duplexState &= READ_NOT_UPDATING;
11278
11363
  }
@@ -11281,8 +11366,12 @@ var require_streamx = __commonJS({
11281
11366
  if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
11282
11367
  stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
11283
11368
  stream.emit("end");
11284
- if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING;
11285
- if (this.pipeTo !== null) this.pipeTo.end();
11369
+ if ((stream._duplexState & AUTO_DESTROY) === DONE) {
11370
+ stream._duplexState |= DESTROYING;
11371
+ }
11372
+ if (this.pipeTo !== null) {
11373
+ this.pipeTo.end();
11374
+ }
11286
11375
  }
11287
11376
  if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
11288
11377
  if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
@@ -11302,8 +11391,11 @@ var require_streamx = __commonJS({
11302
11391
  return true;
11303
11392
  }
11304
11393
  updateCallback() {
11305
- if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update();
11306
- else this.updateNextTick();
11394
+ if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) {
11395
+ this.update();
11396
+ } else {
11397
+ this.updateNextTick();
11398
+ }
11307
11399
  }
11308
11400
  updateNextTickIfOpen() {
11309
11401
  if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return;
@@ -11340,7 +11432,7 @@ var require_streamx = __commonJS({
11340
11432
  this.to = null;
11341
11433
  if (this.from !== null) {
11342
11434
  if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
11343
- this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
11435
+ this.from.destroy(this.error || StreamError.PREMATURE_CLOSE("Writable stream closed"));
11344
11436
  }
11345
11437
  return;
11346
11438
  }
@@ -11349,7 +11441,7 @@ var require_streamx = __commonJS({
11349
11441
  this.from = null;
11350
11442
  if (this.to !== null) {
11351
11443
  if ((stream._duplexState & READ_DONE) === 0) {
11352
- this.to.destroy(this.error || new Error("Readable stream closed before ending"));
11444
+ this.to.destroy(this.error || StreamError.PREMATURE_CLOSE("Readable stream closed"));
11353
11445
  }
11354
11446
  return;
11355
11447
  }
@@ -11373,21 +11465,30 @@ var require_streamx = __commonJS({
11373
11465
  stream._duplexState |= DESTROYING;
11374
11466
  }
11375
11467
  stream._duplexState &= WRITE_NOT_FINISHING;
11376
- if ((stream._duplexState & WRITE_UPDATING) === 0) this.update();
11377
- else this.updateNextTick();
11468
+ if ((stream._duplexState & WRITE_UPDATING) === 0) {
11469
+ this.update();
11470
+ } else {
11471
+ this.updateNextTick();
11472
+ }
11378
11473
  }
11379
11474
  function afterDestroy(err) {
11380
11475
  const stream = this.stream;
11381
- if (!err && this.error !== STREAM_DESTROYED) err = this.error;
11476
+ if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error;
11382
11477
  if (err) stream.emit("error", err);
11383
11478
  stream._duplexState |= DESTROYED;
11384
11479
  stream.emit("close");
11385
11480
  const rs = stream._readableState;
11386
11481
  const ws = stream._writableState;
11387
- if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err);
11482
+ if (rs !== null && rs.pipeline !== null) {
11483
+ rs.pipeline.done(stream, err);
11484
+ }
11388
11485
  if (ws !== null) {
11389
- while (ws.drains !== null && ws.drains.length > 0) ws.drains.shift().resolve(false);
11390
- if (ws.pipeline !== null) ws.pipeline.done(stream, err);
11486
+ while (ws.drains !== null && ws.drains.length > 0) {
11487
+ ws.drains.shift().resolve(false);
11488
+ }
11489
+ if (ws.pipeline !== null) {
11490
+ ws.pipeline.done(stream, err);
11491
+ }
11391
11492
  }
11392
11493
  }
11393
11494
  function afterWrite(err) {
@@ -11406,8 +11507,9 @@ var require_streamx = __commonJS({
11406
11507
  function afterRead(err) {
11407
11508
  if (err) this.stream.destroy(err);
11408
11509
  this.stream._duplexState &= READ_NOT_ACTIVE;
11409
- if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0)
11510
+ if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) {
11410
11511
  this.stream._duplexState &= READ_NO_READ_AHEAD;
11512
+ }
11411
11513
  this.updateCallback();
11412
11514
  }
11413
11515
  function updateReadNT() {
@@ -11434,8 +11536,12 @@ var require_streamx = __commonJS({
11434
11536
  const stream = this.stream;
11435
11537
  if (err) stream.destroy(err);
11436
11538
  if ((stream._duplexState & DESTROYING) === 0) {
11437
- if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY;
11438
- if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY;
11539
+ if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) {
11540
+ stream._duplexState |= READ_PRIMARY;
11541
+ }
11542
+ if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) {
11543
+ stream._duplexState |= WRITE_PRIMARY;
11544
+ }
11439
11545
  stream.emit("open");
11440
11546
  }
11441
11547
  stream._duplexState &= NOT_ACTIVE;
@@ -11478,9 +11584,7 @@ var require_streamx = __commonJS({
11478
11584
  if (opts.open) this._open = opts.open;
11479
11585
  if (opts.destroy) this._destroy = opts.destroy;
11480
11586
  if (opts.predestroy) this._predestroy = opts.predestroy;
11481
- if (opts.signal) {
11482
- opts.signal.addEventListener("abort", abort.bind(this));
11483
- }
11587
+ if (opts.signal) opts.signal.addEventListener("abort", abort.bind(this));
11484
11588
  }
11485
11589
  this.on("newListener", newListener);
11486
11590
  }
@@ -11506,7 +11610,7 @@ var require_streamx = __commonJS({
11506
11610
  }
11507
11611
  destroy(err) {
11508
11612
  if ((this._duplexState & DESTROY_STATUS) === 0) {
11509
- if (!err) err = STREAM_DESTROYED;
11613
+ if (!err) err = StreamError.STREAM_DESTROYED();
11510
11614
  this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
11511
11615
  if (this._readableState !== null) {
11512
11616
  this._readableState.highWaterMark = 0;
@@ -11519,8 +11623,12 @@ var require_streamx = __commonJS({
11519
11623
  this._duplexState |= PREDESTROYING;
11520
11624
  this._predestroy();
11521
11625
  this._duplexState &= NOT_PREDESTROYING;
11522
- if (this._readableState !== null) this._readableState.updateNextTick();
11523
- if (this._writableState !== null) this._writableState.updateNextTick();
11626
+ if (this._readableState !== null) {
11627
+ this._readableState.updateNextTick();
11628
+ }
11629
+ if (this._writableState !== null) {
11630
+ this._writableState.updateNextTick();
11631
+ }
11524
11632
  }
11525
11633
  }
11526
11634
  };
@@ -11536,6 +11644,15 @@ var require_streamx = __commonJS({
11536
11644
  if (opts.encoding) this.setEncoding(opts.encoding);
11537
11645
  }
11538
11646
  }
11647
+ static deferred(fn, opts) {
11648
+ const out = new PassThrough3(opts);
11649
+ fn().then((src) => {
11650
+ if (src === null) return out.end();
11651
+ if (out.destroying) return;
11652
+ pipeline2(src, out, noop);
11653
+ }).catch((err) => out.destroy(err));
11654
+ return out;
11655
+ }
11539
11656
  setEncoding(encoding) {
11540
11657
  const dec = new TextDecoder2(encoding);
11541
11658
  const map2 = this._readableState.map || echo;
@@ -11653,10 +11770,13 @@ var require_streamx = __commonJS({
11653
11770
  }
11654
11771
  function ondata(data) {
11655
11772
  if (promiseReject === null) return;
11656
- if (error62) promiseReject(error62);
11657
- else if (data === null && (stream._duplexState & READ_DONE) === 0)
11658
- promiseReject(STREAM_DESTROYED);
11659
- else promiseResolve({ value: data, done: data === null });
11773
+ if (error62) {
11774
+ promiseReject(error62);
11775
+ } else if (data === null && (stream._duplexState & READ_DONE) === 0) {
11776
+ promiseReject(StreamError.STREAM_DESTROYED());
11777
+ } else {
11778
+ promiseResolve({ value: data, done: data === null });
11779
+ }
11660
11780
  promiseReject = promiseResolve = null;
11661
11781
  }
11662
11782
  function destroy(err) {
@@ -11825,7 +11945,7 @@ var require_streamx = __commonJS({
11825
11945
  function pipeline2(stream, ...streams) {
11826
11946
  const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
11827
11947
  const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
11828
- if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
11948
+ if (all.length < 2) throw StreamError.BAD_ARGUMENT("Pipeline requires at least 2 streams");
11829
11949
  let src = all[0];
11830
11950
  let dest = null;
11831
11951
  let error62 = null;
@@ -11850,7 +11970,7 @@ var require_streamx = __commonJS({
11850
11970
  if (!autoDestroy) done(error62);
11851
11971
  });
11852
11972
  if (autoDestroy) {
11853
- dest.on("close", () => done(error62 || (fin ? null : PREMATURE_CLOSE)));
11973
+ dest.on("close", () => done(error62 || (fin ? null : StreamError.PREMATURE_CLOSE())));
11854
11974
  }
11855
11975
  }
11856
11976
  return dest;
@@ -11858,8 +11978,12 @@ var require_streamx = __commonJS({
11858
11978
  s.on("error", onerror2);
11859
11979
  s.on("close", onclose);
11860
11980
  function onclose() {
11861
- if (rd && s._readableState && !s._readableState.ended) return onerror2(PREMATURE_CLOSE);
11862
- if (wr && s._writableState && !s._writableState.ended) return onerror2(PREMATURE_CLOSE);
11981
+ if (rd && s._readableState && !s._readableState.ended) {
11982
+ return onerror2(StreamError.PREMATURE_CLOSE());
11983
+ }
11984
+ if (wr && s._writableState && !s._writableState.ended) {
11985
+ return onerror2(StreamError.PREMATURE_CLOSE());
11986
+ }
11863
11987
  }
11864
11988
  }
11865
11989
  function onerror(err) {
@@ -11893,7 +12017,7 @@ var require_streamx = __commonJS({
11893
12017
  }
11894
12018
  function getStreamError(stream, opts = {}) {
11895
12019
  const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
11896
- return !opts.all && err === STREAM_DESTROYED ? null : err;
12020
+ return !opts.all && StreamError.isStreamDestroyed(err) ? null : err;
11897
12021
  }
11898
12022
  function isReadStreamx(stream) {
11899
12023
  return isStreamx(stream) && stream.readable;
@@ -11910,7 +12034,7 @@ var require_streamx = __commonJS({
11910
12034
  function noop() {
11911
12035
  }
11912
12036
  function abort() {
11913
- this.destroy(new Error("Stream aborted."));
12037
+ this.destroy(StreamError.ABORTED());
11914
12038
  }
11915
12039
  function isWritev(s) {
11916
12040
  return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
@@ -12045,6 +12169,7 @@ var require_headers = __commonJS({
12045
12169
  uid,
12046
12170
  gid,
12047
12171
  size,
12172
+ byteOffset: 0,
12048
12173
  mtime: new Date(1e3 * mtime),
12049
12174
  type,
12050
12175
  linkname,
@@ -12206,6 +12331,7 @@ var require_extract = __commonJS({
12206
12331
  var b4a = require_b4a();
12207
12332
  var headers = require_headers();
12208
12333
  var EMPTY2 = b4a.alloc(0);
12334
+ var MAX_HEADER_SIZE = 4 * 1024 * 1024;
12209
12335
  var BufferList = class {
12210
12336
  constructor() {
12211
12337
  this.buffered = 0;
@@ -12218,7 +12344,7 @@ var require_extract = __commonJS({
12218
12344
  this.queue.push(buffer);
12219
12345
  }
12220
12346
  shiftFirst(size) {
12221
- return this._buffered === 0 ? null : this._next(size);
12347
+ return this.buffered === 0 ? null : this._next(size);
12222
12348
  }
12223
12349
  shift(size) {
12224
12350
  if (size > this.buffered) return null;
@@ -12319,6 +12445,7 @@ var require_extract = __commonJS({
12319
12445
  return false;
12320
12446
  }
12321
12447
  if (!this._header) return true;
12448
+ this._header.byteOffset = this._buffer.shifted;
12322
12449
  switch (this._header.type) {
12323
12450
  case "gnu-long-path":
12324
12451
  case "gnu-long-link-path":
@@ -12326,10 +12453,18 @@ var require_extract = __commonJS({
12326
12453
  case "pax-header":
12327
12454
  this._longHeader = true;
12328
12455
  this._missing = this._header.size;
12456
+ if (this._missing > MAX_HEADER_SIZE) {
12457
+ this._continueWrite(new Error("Header exceeds max size"));
12458
+ return false;
12459
+ }
12329
12460
  return true;
12330
12461
  }
12331
12462
  this._locked = true;
12332
12463
  this._applyLongHeaders();
12464
+ if (!(this._header.size >= 0)) {
12465
+ this._continueWrite(new Error("Invalid header"));
12466
+ return false;
12467
+ }
12333
12468
  if (this._header.size === 0 || this._header.type === "directory") {
12334
12469
  this.emit("entry", this._header, this._createStream(), this._unlockBound);
12335
12470
  return true;
@@ -16682,7 +16817,6 @@ function flagTarget() {
16682
16817
  return hubOverride ? { ...hubOverride, source: "flag" } : null;
16683
16818
  }
16684
16819
  function relayTarget() {
16685
- if (!isTaskTerminal()) return null;
16686
16820
  const address = process.env.SLAYZONE_CLI_RELAY_ADDRESS;
16687
16821
  const token = process.env.SLAYZONE_CLI_RELAY_TOKEN;
16688
16822
  if (!address && !token) return null;
@@ -23726,6 +23860,7 @@ __export(util_exports, {
23726
23860
  required: () => required,
23727
23861
  safeExtend: () => safeExtend,
23728
23862
  shallowClone: () => shallowClone,
23863
+ sizeCaps: () => sizeCaps,
23729
23864
  slugify: () => slugify,
23730
23865
  stringifyPrimitive: () => stringifyPrimitive,
23731
23866
  toZod: () => toZod,
@@ -24245,6 +24380,18 @@ function prefixIssues(path12, issues) {
24245
24380
  function unwrapMessage(message) {
24246
24381
  return typeof message === "string" ? message : message?.message;
24247
24382
  }
24383
+ function sizeCaps(defChecks) {
24384
+ const caps = [];
24385
+ for (const ch of defChecks ?? []) {
24386
+ const d = ch._zod.def;
24387
+ if (!/_(length|size)$|_equals$/.test(d.check))
24388
+ break;
24389
+ const max = d.maximum ?? d.length ?? d.size;
24390
+ if (max >= 0)
24391
+ caps.push([max, ch]);
24392
+ }
24393
+ return caps;
24394
+ }
24248
24395
  function attachSchema(issues, start, inst) {
24249
24396
  var _a4;
24250
24397
  for (let i = start; i < issues.length; i++) {
@@ -25665,7 +25812,7 @@ ${content.join("\n")}
25665
25812
  var version = {
25666
25813
  major: 4,
25667
25814
  minor: 6,
25668
- patch: 5
25815
+ patch: 7
25669
25816
  };
25670
25817
 
25671
25818
  // ../../../node_modules/zod/v4/core/schemas.js
@@ -26421,6 +26568,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
26421
26568
  return payload;
26422
26569
  };
26423
26570
  });
26571
+ function capSize(inst, size) {
26572
+ const caps = sizeCaps(inst._zod.def.checks);
26573
+ if (!caps.length)
26574
+ return;
26575
+ const cap = Math.min(...caps.map((c) => c[0]));
26576
+ const parse3 = inst._zod.parse;
26577
+ inst._zod.parse = (payload, ctx) => {
26578
+ const n = size(payload.value);
26579
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
26580
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
26581
+ if (n > max && ch._zod.def.when(payload)) {
26582
+ const start = payload.issues.length;
26583
+ ch._zod.check(payload);
26584
+ payload.issues[start].continue = false;
26585
+ attachSchema(payload.issues, start, inst);
26586
+ return payload;
26587
+ }
26588
+ }
26589
+ }
26590
+ return parse3(payload, ctx);
26591
+ };
26592
+ }
26593
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
26594
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
26595
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
26424
26596
  function handleArrayResult(result, final, index2) {
26425
26597
  if (result.issues.length) {
26426
26598
  final.issues.push(...prefixIssues(index2, result.issues));
@@ -26464,6 +26636,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
26464
26636
  }
26465
26637
  return payload;
26466
26638
  };
26639
+ capSize(inst, arraySize);
26467
26640
  });
26468
26641
  function handlePropertyResult(result, final, key, input2, optin, optout) {
26469
26642
  const isPresent = key in input2;
@@ -27420,6 +27593,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
27420
27593
  return Promise.all(proms).then(() => payload);
27421
27594
  return payload;
27422
27595
  };
27596
+ capSize(inst, mapSize);
27423
27597
  });
27424
27598
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
27425
27599
  if (keyResult.issues.length) {
@@ -27486,6 +27660,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
27486
27660
  return Promise.all(proms).then(() => payload);
27487
27661
  return payload;
27488
27662
  };
27663
+ capSize(inst, setSize);
27489
27664
  });
27490
27665
  function handleSetResult(result, final) {
27491
27666
  if (result.issues.length) {
@@ -37016,9 +37191,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
37016
37191
  doc.write(`}`);
37017
37192
  return outputVar;
37018
37193
  }
37194
+ function generateSizeGate(doc, schema, size) {
37195
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
37196
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
37197
+ }
37198
+ }
37019
37199
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
37020
37200
  const def = schema._zod.def;
37021
37201
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
37202
+ generateSizeGate(doc, schema, `${accessor}.length`);
37022
37203
  const outputVar = buildsValue ? newVar(ctx) : null;
37023
37204
  const iVar = newVar(ctx);
37024
37205
  const elemVar = newVar(ctx);
@@ -37418,6 +37599,7 @@ function literalPropertyKey(ctx, key) {
37418
37599
  function generateMapCheck(doc, ctx, schema, accessor) {
37419
37600
  const def = schema._zod.def;
37420
37601
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
37602
+ generateSizeGate(doc, schema, `${accessor}.size`);
37421
37603
  const outputVar = newVar(ctx);
37422
37604
  const kVar = newVar(ctx);
37423
37605
  const valVar = newVar(ctx);
@@ -37434,6 +37616,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
37434
37616
  function generateSetCheck(doc, ctx, schema, accessor) {
37435
37617
  const def = schema._zod.def;
37436
37618
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
37619
+ generateSizeGate(doc, schema, `${accessor}.size`);
37437
37620
  const outputVar = newVar(ctx);
37438
37621
  const valVar = newVar(ctx);
37439
37622
  doc.write(`const ${outputVar} = new Set();`);
@@ -42743,19 +42926,22 @@ function date4(params) {
42743
42926
  return _coercedDate(ZodDate, params);
42744
42927
  }
42745
42928
 
42929
+ // ../../domains/computers/src/shared/computer-labels.ts
42930
+ var COMPUTER_UPGRADE_PHASES = [
42931
+ "checking",
42932
+ "installing",
42933
+ "waiting-for-idle",
42934
+ "restarting",
42935
+ "probation",
42936
+ "connected",
42937
+ "rollback",
42938
+ "failed",
42939
+ "maintenance-required"
42940
+ ];
42941
+
42746
42942
  // ../../domains/computers/src/shared/upgrade-status.ts
42747
42943
  var computerUpgradeStatusSchema = external_exports.object({
42748
- phase: external_exports.enum([
42749
- "checking",
42750
- "installing",
42751
- "waiting-for-idle",
42752
- "restarting",
42753
- "probation",
42754
- "connected",
42755
- "rollback",
42756
- "failed",
42757
- "maintenance-required"
42758
- ]),
42944
+ phase: external_exports.enum(COMPUTER_UPGRADE_PHASES),
42759
42945
  currentVersion: external_exports.string().max(100),
42760
42946
  hostVersion: external_exports.string().max(100),
42761
42947
  version: external_exports.string().max(100).optional(),
@@ -44068,7 +44254,6 @@ var Schema = class Schema2 {
44068
44254
  case "mapping":
44069
44255
  if (tag.matchByTagPrefix) prefix.mapping.push(tag);
44070
44256
  else exact.mapping[tag.tagName] = tag;
44071
- break;
44072
44257
  }
44073
44258
  }
44074
44259
  const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
@@ -44322,6 +44507,8 @@ var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
44322
44507
  "!": "!",
44323
44508
  "!!": "tag:yaml.org,2002:"
44324
44509
  });
44510
+ var TAG_SUFFIX_CHARS = "-#;/?:@&=+$_.~*'()";
44511
+ var TAG_URI_CHARS = TAG_SUFFIX_CHARS + "!,[]";
44325
44512
  var DEFAULT_CONSTRUCTOR_OPTIONS = {
44326
44513
  filename: "",
44327
44514
  schema: CORE_SCHEMA,
@@ -47070,7 +47257,7 @@ var import_node_child_process3 = require("node:child_process");
47070
47257
  var import_node_fs9 = require("node:fs");
47071
47258
  var import_node_module = require("node:module");
47072
47259
  var import_node_path9 = require("node:path");
47073
- var CLI_VERSION = true ? "0.37.1" : "";
47260
+ var CLI_VERSION = true ? "0.38.0" : "";
47074
47261
  function fail(message) {
47075
47262
  console.error(message);
47076
47263
  process.exit(1);
@@ -49193,7 +49380,7 @@ function computerCommand() {
49193
49380
  const cmd = new Command("computer").description("Run and manage SlayZone computers on this machine").showSuggestionAfterError(true).showHelpAfterError(true);
49194
49381
  cmd.command("mint [label]").description("Mint a computer enrollment token on a hub (see `slay hub current`)").option(
49195
49382
  "--for <user>",
49196
- "Who the computer is for: their email or account id. Required on a hub with login"
49383
+ "Who the computer is for: their email or account id. Defaults to you; naming someone else needs a hub admin"
49197
49384
  ).option("--ttl <minutes>", `Token lifetime in minutes (at most ${MAX_TTL_MINUTES})`, "15").option("--json", "Output as JSON").action(async (label, opts) => {
49198
49385
  const ttlMinutes = Number(opts.ttl);
49199
49386
  if (!Number.isFinite(ttlMinutes) || ttlMinutes <= 0) {
@@ -49217,17 +49404,18 @@ function computerCommand() {
49217
49404
  unwrap: "raw",
49218
49405
  hints: {
49219
49406
  // The hub's 400s here are all about who the token is for (the lifetime is
49220
- // checked above): unnamed on a hub with login, unknown or disabled, or named
49221
- // on a hub without login.
49222
- 400: forUser ? `\`slay hub users ls\` lists this hub's accounts.` : `Name the user the computer is for:
49223
- slay computer mint ${label ?? "<name>"} --for <email>
49224
- (\`slay hub users ls\` lists this hub's accounts.)`,
49407
+ // checked above): an unknown or disabled user, or one named on a hub without
49408
+ // login.
49409
+ ...forUser ? { 400: `\`slay hub users ls\` lists this hub's accounts.` } : {},
49225
49410
  // The hub cannot know which command the operator should run to get a
49226
49411
  // credential, so name it here rather than leaving a bare 401.
49227
49412
  401: `Sign in to this hub first:
49228
49413
  slay hub login ${target.baseUrl} --email <email>
49229
49414
  No account yet? Create one ON the hub machine: slay hub users add <email>`,
49230
- 403: `This hub only mints join tokens for callers on its own machine.
49415
+ // With `--for` a 403 is the hub refusing a non-admin's mint for someone else;
49416
+ // without it, a hub without login refusing an off-box caller.
49417
+ 403: forUser ? `Only a hub admin can enroll a computer for someone else.
49418
+ Enroll your own: slay computer mint ${label ?? "<name>"}` : `This hub only mints join tokens for callers on its own machine.
49231
49419
  Run \`slay computer mint\` there, or turn login on for the hub (\`slay hub create --public-address <host:port> --bind <host[:port]>\`) so it can authenticate you.`
49232
49420
  }
49233
49421
  });
@@ -49702,7 +49890,7 @@ function updateCommand() {
49702
49890
  }
49703
49891
 
49704
49892
  // src/index.ts
49705
- var program2 = new Command().name("slay").description("SlayZone CLI").version("0.37.1").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
49893
+ var program2 = new Command().name("slay").description("SlayZone CLI").version("0.38.0").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
49706
49894
  const root = thisCommand.parent ?? thisCommand;
49707
49895
  const opts = root.opts();
49708
49896
  if (opts.dev) process.env.SLAYZONE_DEV = "1";
@@ -49797,7 +49985,7 @@ archiver/lib/plugins/json.js:
49797
49985
  *)
49798
49986
 
49799
49987
  js-yaml/dist/js-yaml.mjs:
49800
- (*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)
49988
+ (*! js-yaml 5.5.0 https://github.com/nodeca/js-yaml @license MIT *)
49801
49989
 
49802
49990
  @dagrejs/dagre/dist/dagre.esm.js:
49803
49991
  (*! For license information please see dagre.esm.js.LEGAL.txt *)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slayzone/cli",
3
- "version": "0.37.1",
3
+ "version": "0.38.0",
4
4
  "description": "SlayZone CLI — run, list and target SlayZone hubs; drive tasks, ptys and projects",
5
5
  "license": "GPL-3.0-only",
6
6
  "private": false,