@slayzone/cli 0.37.2 → 0.38.1

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 +498 -247
  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
  }
@@ -315,7 +315,7 @@ var require_BufferList = __commonJS({
315
315
  this.head = this.tail = null;
316
316
  this.length = 0;
317
317
  };
318
- BufferList.prototype.join = function join10(s) {
318
+ BufferList.prototype.join = function join11(s) {
319
319
  if (this.length === 0) return "";
320
320
  var p = this.head;
321
321
  var ret = "" + p.data;
@@ -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;
@@ -12535,7 +12670,7 @@ var require_extract = __commonJS({
12535
12670
  // ../../../node_modules/tar-stream/constants.js
12536
12671
  var require_constants = __commonJS({
12537
12672
  "../../../node_modules/tar-stream/constants.js"(exports2, module2) {
12538
- var constants = {
12673
+ var constants2 = {
12539
12674
  // just for envs without fs
12540
12675
  S_IFMT: 61440,
12541
12676
  S_IFDIR: 16384,
@@ -12545,9 +12680,9 @@ var require_constants = __commonJS({
12545
12680
  S_IFLNK: 40960
12546
12681
  };
12547
12682
  try {
12548
- module2.exports = require("fs").constants || constants;
12683
+ module2.exports = require("fs").constants || constants2;
12549
12684
  } catch {
12550
- module2.exports = constants;
12685
+ module2.exports = constants2;
12551
12686
  }
12552
12687
  }
12553
12688
  });
@@ -12557,7 +12692,7 @@ var require_pack = __commonJS({
12557
12692
  "../../../node_modules/tar-stream/pack.js"(exports2, module2) {
12558
12693
  var { Readable: Readable3, Writable, getStreamError } = require_streamx();
12559
12694
  var b4a = require_b4a();
12560
- var constants = require_constants();
12695
+ var constants2 = require_constants();
12561
12696
  var headers = require_headers();
12562
12697
  var DMODE = 493;
12563
12698
  var FMODE = 420;
@@ -12760,16 +12895,16 @@ var require_pack = __commonJS({
12760
12895
  return new Pack(opts);
12761
12896
  };
12762
12897
  function modeToType(mode) {
12763
- switch (mode & constants.S_IFMT) {
12764
- case constants.S_IFBLK:
12898
+ switch (mode & constants2.S_IFMT) {
12899
+ case constants2.S_IFBLK:
12765
12900
  return "block-device";
12766
- case constants.S_IFCHR:
12901
+ case constants2.S_IFCHR:
12767
12902
  return "character-device";
12768
- case constants.S_IFDIR:
12903
+ case constants2.S_IFDIR:
12769
12904
  return "directory";
12770
- case constants.S_IFIFO:
12905
+ case constants2.S_IFIFO:
12771
12906
  return "fifo";
12772
- case constants.S_IFLNK:
12907
+ case constants2.S_IFLNK:
12773
12908
  return "symlink";
12774
12909
  }
12775
12910
  return "file";
@@ -16243,6 +16378,21 @@ var HUB_SSO_ENV = {
16243
16378
  /** `0|1`, default `1`: refuse a sign-in whose ID token's `amr` does not contain `mfa`. */
16244
16379
  requireMfa: "SLAYZONE_HUB_SSO_REQUIRE_MFA"
16245
16380
  };
16381
+ var HUB_OIDC_ENV = {
16382
+ /** The issuer, exactly as its tokens' `iss` (discovery: `<issuer>/.well-known/openid-configuration`). */
16383
+ issuer: "SLAYZONE_HUB_OIDC_ISSUER",
16384
+ clientId: "SLAYZONE_HUB_OIDC_CLIENT_ID",
16385
+ /** `client_secret_basic`. Env only, never in hub.config.json. */
16386
+ clientSecret: "SLAYZONE_HUB_OIDC_CLIENT_SECRET",
16387
+ /** Space-separated; default `openid profile email offline_access`. */
16388
+ scopes: "SLAYZONE_HUB_OIDC_SCOPES"
16389
+ };
16390
+ var IDP_ROLE_ENV = {
16391
+ enabled: "IDP_ROLES_ENABLED",
16392
+ claim: "IDP_ROLE_CLAIM",
16393
+ mapping: "IDP_ROLE_MAPPING",
16394
+ recheckIntervalSeconds: "IDP_RECHECK_INTERVAL_SECONDS"
16395
+ };
16246
16396
  var RETIRED_HUB_SSO_CLIENT_SECRET_ENV = "SLAYZONE_HUB_SSO_CLIENT_SECRET";
16247
16397
  var HUB_ADDRESS_ENV = {
16248
16398
  /** Where the hub LISTENS. Renamed from `SLAYZONE_HUB_ADDRESS`, which now only
@@ -16258,16 +16408,20 @@ var HUB_SESSION_RETENTION_DAYS_ENV = "SLAYZONE_HUB_SESSION_RETENTION_DAYS";
16258
16408
  var HUB_ALLOWED_WEB_ORIGINS_ENV = "SLAYZONE_HUB_ALLOWED_WEB_ORIGINS";
16259
16409
  var HUB_TRUSTED_PROXIES_ENV = "SLAYZONE_HUB_TRUSTED_PROXIES";
16260
16410
  var HUB_CONVEX_ADDRESS_ENV = "SLAYZONE_HUB_CONVEX_ADDRESS";
16411
+ var HUB_STUN_ADDRESSES_ENV = "SLAYZONE_HUB_STUN_ADDRESSES";
16261
16412
  var HUB_PROCESS_ENV = [
16262
16413
  ...Object.values(HUB_SWITCH_ENV),
16263
16414
  ...Object.values(HUB_SSO_ENV),
16415
+ ...Object.values(HUB_OIDC_ENV),
16416
+ ...Object.values(IDP_ROLE_ENV),
16264
16417
  RETIRED_HUB_SSO_CLIENT_SECRET_ENV,
16265
16418
  ...Object.values(HUB_ADDRESS_ENV),
16266
16419
  LEGACY_HUB_LISTEN_ENV,
16267
16420
  HUB_ALLOWED_WEB_ORIGINS_ENV,
16268
16421
  HUB_TRUSTED_PROXIES_ENV,
16269
16422
  HUB_SESSION_RETENTION_DAYS_ENV,
16270
- HUB_CONVEX_ADDRESS_ENV
16423
+ HUB_CONVEX_ADDRESS_ENV,
16424
+ HUB_STUN_ADDRESSES_ENV
16271
16425
  ];
16272
16426
 
16273
16427
  // ../../shared/platform/src/paths.ts
@@ -16543,6 +16697,53 @@ var VARIABLES = {
16543
16697
  // ../../shared/platform/src/cli-install.ts
16544
16698
  var import_child_process = require("child_process");
16545
16699
  var import_util = require("util");
16700
+
16701
+ // ../../shared/platform/src/resolve-command.ts
16702
+ var import_node_fs2 = require("node:fs");
16703
+ var import_node_path3 = require("node:path");
16704
+ function isExecutableFile(file2, platform) {
16705
+ try {
16706
+ if (!(0, import_node_fs2.statSync)(file2).isFile()) return false;
16707
+ if (platform !== "win32") (0, import_node_fs2.accessSync)(file2, import_node_fs2.constants.X_OK);
16708
+ return true;
16709
+ } catch {
16710
+ return false;
16711
+ }
16712
+ }
16713
+ function resolveCommand(command, env, cwd, platform = process.platform) {
16714
+ const win = platform === "win32";
16715
+ const suffixes = win ? [
16716
+ ...(env.PATHEXT ?? process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean),
16717
+ ""
16718
+ ] : [""];
16719
+ const hasDir = command.includes("/") || win && command.includes("\\");
16720
+ const found2 = (base) => suffixes.map((s) => base + s).find((p) => isExecutableFile(p, platform)) ?? null;
16721
+ if (hasDir) return found2((0, import_node_path3.isAbsolute)(command) ? command : (0, import_node_path3.join)(cwd ?? process.cwd(), command));
16722
+ for (const dir of (env.PATH ?? env.Path ?? "").split(win ? ";" : import_node_path3.delimiter)) {
16723
+ if (!dir) continue;
16724
+ const hit = found2((0, import_node_path3.join)(dir, command));
16725
+ if (hit) return hit;
16726
+ }
16727
+ return null;
16728
+ }
16729
+ var RESOLVER_CACHE_SIZE = 16;
16730
+ function createCommandResolver(command, platform = process.platform) {
16731
+ const cache = /* @__PURE__ */ new Map();
16732
+ return (env = process.env) => {
16733
+ const pathList = env.PATH ?? env.Path ?? "";
16734
+ const cached2 = cache.get(pathList);
16735
+ if (cached2 && isExecutableFile(cached2, platform)) return cached2;
16736
+ cache.delete(pathList);
16737
+ const found2 = resolveCommand(command, env, void 0, platform);
16738
+ if (!found2 || platform === "win32" && !/\.(exe|com)$/i.test(found2)) return command;
16739
+ if (cache.size >= RESOLVER_CACHE_SIZE) cache.delete(cache.keys().next().value);
16740
+ cache.set(pathList, found2);
16741
+ return found2;
16742
+ };
16743
+ }
16744
+ var gitCommand = createCommandResolver("git");
16745
+
16746
+ // ../../shared/platform/src/cli-install.ts
16546
16747
  var execFileAsync = (0, import_util.promisify)(import_child_process.execFile);
16547
16748
  var WINDOWS_SHIM = [
16548
16749
  "@echo off",
@@ -16757,7 +16958,7 @@ function unlinkIfPresent(file2) {
16757
16958
  }
16758
16959
 
16759
16960
  // src/local-hub.ts
16760
- var import_node_path3 = __toESM(require("node:path"), 1);
16961
+ var import_node_path4 = __toESM(require("node:path"), 1);
16761
16962
  function fixedPortForChannel(dev = isDevChannel()) {
16762
16963
  return dev ? SIDECAR_FIXED_PORT.dev : SIDECAR_FIXED_PORT.prod;
16763
16964
  }
@@ -16766,7 +16967,7 @@ function isDevChannel() {
16766
16967
  }
16767
16968
  function identityFor(dev) {
16768
16969
  const own2 = process.env.SLAYZONE_ROOT?.trim();
16769
- if (own2) return dev === isDevChannel() ? { kind: "root", root: import_node_path3.default.resolve(own2) } : null;
16970
+ if (own2) return dev === isDevChannel() ? { kind: "root", root: import_node_path4.default.resolve(own2) } : null;
16770
16971
  const user = currentOsUser();
16771
16972
  return user ? { kind: "user", user, dev } : null;
16772
16973
  }
@@ -16774,11 +16975,11 @@ function describeIdentity(id) {
16774
16975
  return id.kind === "root" ? id.root : `the SlayZone ${id.dev ? "dev " : ""}app of OS user "${id.user}"`;
16775
16976
  }
16776
16977
  function ownsFixedPort(hub, id) {
16777
- if (id.kind === "root") return import_node_path3.default.resolve(hub.root) === id.root;
16978
+ if (id.kind === "root") return import_node_path4.default.resolve(hub.root) === id.root;
16778
16979
  return hub.user === null || hub.user === id.user;
16779
16980
  }
16780
16981
  function isOursElsewhere(hub, id) {
16781
- if (id.kind === "root") return import_node_path3.default.resolve(hub.root) === id.root;
16982
+ if (id.kind === "root") return import_node_path4.default.resolve(hub.root) === id.root;
16782
16983
  return hub.supervised && hub.dev === id.dev && hub.user === id.user;
16783
16984
  }
16784
16985
  async function probeLocalHub(opts = {}) {
@@ -17366,7 +17567,7 @@ function canonical(p) {
17366
17567
  }
17367
17568
  }
17368
17569
  function git(args, cwd) {
17369
- const r = (0, import_child_process2.spawnSync)("git", args, { cwd, encoding: "utf8" });
17570
+ const r = (0, import_child_process2.spawnSync)(gitCommand(), args, { cwd, encoding: "utf8" });
17370
17571
  return { stdout: (r.stdout ?? "").trim(), status: r.status ?? 1 };
17371
17572
  }
17372
17573
  function isGitRepo(p) {
@@ -22954,8 +23155,8 @@ function tasksCommand() {
22954
23155
  }
22955
23156
 
22956
23157
  // src/commands/projects.ts
22957
- var import_node_fs2 = __toESM(require("node:fs"), 1);
22958
- var import_node_path4 = __toESM(require("node:path"), 1);
23158
+ var import_node_fs3 = __toESM(require("node:fs"), 1);
23159
+ var import_node_path5 = __toESM(require("node:path"), 1);
22959
23160
 
22960
23161
  // ../../shared/workflow/src/types.ts
22961
23162
  var WORKFLOW_CATEGORIES = [
@@ -23725,6 +23926,7 @@ __export(util_exports, {
23725
23926
  required: () => required,
23726
23927
  safeExtend: () => safeExtend,
23727
23928
  shallowClone: () => shallowClone,
23929
+ sizeCaps: () => sizeCaps,
23728
23930
  slugify: () => slugify,
23729
23931
  stringifyPrimitive: () => stringifyPrimitive,
23730
23932
  toZod: () => toZod,
@@ -24244,6 +24446,18 @@ function prefixIssues(path12, issues) {
24244
24446
  function unwrapMessage(message) {
24245
24447
  return typeof message === "string" ? message : message?.message;
24246
24448
  }
24449
+ function sizeCaps(defChecks) {
24450
+ const caps = [];
24451
+ for (const ch of defChecks ?? []) {
24452
+ const d = ch._zod.def;
24453
+ if (!/_(length|size)$|_equals$/.test(d.check))
24454
+ break;
24455
+ const max = d.maximum ?? d.length ?? d.size;
24456
+ if (max >= 0)
24457
+ caps.push([max, ch]);
24458
+ }
24459
+ return caps;
24460
+ }
24247
24461
  function attachSchema(issues, start, inst) {
24248
24462
  var _a4;
24249
24463
  for (let i = start; i < issues.length; i++) {
@@ -25071,8 +25285,8 @@ function emoji() {
25071
25285
  }
25072
25286
  var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
25073
25287
  var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
25074
- var mac = (delimiter) => {
25075
- const escapedDelim = escapeRegex(delimiter ?? ":");
25288
+ var mac = (delimiter2) => {
25289
+ const escapedDelim = escapeRegex(delimiter2 ?? ":");
25076
25290
  return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
25077
25291
  };
25078
25292
  var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
@@ -25664,7 +25878,7 @@ ${content.join("\n")}
25664
25878
  var version = {
25665
25879
  major: 4,
25666
25880
  minor: 6,
25667
- patch: 5
25881
+ patch: 7
25668
25882
  };
25669
25883
 
25670
25884
  // ../../../node_modules/zod/v4/core/schemas.js
@@ -26420,6 +26634,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
26420
26634
  return payload;
26421
26635
  };
26422
26636
  });
26637
+ function capSize(inst, size) {
26638
+ const caps = sizeCaps(inst._zod.def.checks);
26639
+ if (!caps.length)
26640
+ return;
26641
+ const cap = Math.min(...caps.map((c) => c[0]));
26642
+ const parse3 = inst._zod.parse;
26643
+ inst._zod.parse = (payload, ctx) => {
26644
+ const n = size(payload.value);
26645
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
26646
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
26647
+ if (n > max && ch._zod.def.when(payload)) {
26648
+ const start = payload.issues.length;
26649
+ ch._zod.check(payload);
26650
+ payload.issues[start].continue = false;
26651
+ attachSchema(payload.issues, start, inst);
26652
+ return payload;
26653
+ }
26654
+ }
26655
+ }
26656
+ return parse3(payload, ctx);
26657
+ };
26658
+ }
26659
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
26660
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
26661
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
26423
26662
  function handleArrayResult(result, final, index2) {
26424
26663
  if (result.issues.length) {
26425
26664
  final.issues.push(...prefixIssues(index2, result.issues));
@@ -26463,6 +26702,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
26463
26702
  }
26464
26703
  return payload;
26465
26704
  };
26705
+ capSize(inst, arraySize);
26466
26706
  });
26467
26707
  function handlePropertyResult(result, final, key, input2, optin, optout) {
26468
26708
  const isPresent = key in input2;
@@ -27419,6 +27659,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
27419
27659
  return Promise.all(proms).then(() => payload);
27420
27660
  return payload;
27421
27661
  };
27662
+ capSize(inst, mapSize);
27422
27663
  });
27423
27664
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
27424
27665
  if (keyResult.issues.length) {
@@ -27485,6 +27726,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
27485
27726
  return Promise.all(proms).then(() => payload);
27486
27727
  return payload;
27487
27728
  };
27729
+ capSize(inst, setSize);
27488
27730
  });
27489
27731
  function handleSetResult(result, final) {
27490
27732
  if (result.issues.length) {
@@ -37015,9 +37257,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
37015
37257
  doc.write(`}`);
37016
37258
  return outputVar;
37017
37259
  }
37260
+ function generateSizeGate(doc, schema, size) {
37261
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
37262
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
37263
+ }
37264
+ }
37018
37265
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
37019
37266
  const def = schema._zod.def;
37020
37267
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
37268
+ generateSizeGate(doc, schema, `${accessor}.length`);
37021
37269
  const outputVar = buildsValue ? newVar(ctx) : null;
37022
37270
  const iVar = newVar(ctx);
37023
37271
  const elemVar = newVar(ctx);
@@ -37417,6 +37665,7 @@ function literalPropertyKey(ctx, key) {
37417
37665
  function generateMapCheck(doc, ctx, schema, accessor) {
37418
37666
  const def = schema._zod.def;
37419
37667
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
37668
+ generateSizeGate(doc, schema, `${accessor}.size`);
37420
37669
  const outputVar = newVar(ctx);
37421
37670
  const kVar = newVar(ctx);
37422
37671
  const valVar = newVar(ctx);
@@ -37433,6 +37682,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
37433
37682
  function generateSetCheck(doc, ctx, schema, accessor) {
37434
37683
  const def = schema._zod.def;
37435
37684
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
37685
+ generateSizeGate(doc, schema, `${accessor}.size`);
37436
37686
  const outputVar = newVar(ctx);
37437
37687
  const valVar = newVar(ctx);
37438
37688
  doc.write(`const ${outputVar} = new Set();`);
@@ -42768,6 +43018,9 @@ var computerUpgradeStatusSchema = external_exports.object({
42768
43018
  updatedAt: external_exports.string().max(64)
42769
43019
  }).strict();
42770
43020
 
43021
+ // ../../domains/computers/src/shared/direct-link.ts
43022
+ var DIRECT_RTC_MAX_SDP = 64 * 1024;
43023
+
42771
43024
  // src/commands/projects.ts
42772
43025
  var DEFAULT_PROJECT_COLOR = "#3b82f6";
42773
43026
  function narrowProject(p) {
@@ -42785,20 +43038,20 @@ function normalizeProjectPath(input2) {
42785
43038
  if (!input2) return null;
42786
43039
  const trimmed = input2.trim();
42787
43040
  if (!trimmed) return null;
42788
- return import_node_path4.default.resolve(trimmed);
43041
+ return import_node_path5.default.resolve(trimmed);
42789
43042
  }
42790
43043
  function ensureProjectPath(projectPath) {
42791
43044
  if (!projectPath) return false;
42792
- const existedBefore = import_node_fs2.default.existsSync(projectPath);
43045
+ const existedBefore = import_node_fs3.default.existsSync(projectPath);
42793
43046
  try {
42794
- import_node_fs2.default.mkdirSync(projectPath, { recursive: true });
43047
+ import_node_fs3.default.mkdirSync(projectPath, { recursive: true });
42795
43048
  } catch (error62) {
42796
43049
  const message = error62 instanceof Error ? error62.message : String(error62);
42797
43050
  console.error(`Failed to create project path "${projectPath}": ${message}`);
42798
43051
  process.exit(1);
42799
43052
  }
42800
43053
  try {
42801
- const stat2 = import_node_fs2.default.statSync(projectPath);
43054
+ const stat2 = import_node_fs3.default.statSync(projectPath);
42802
43055
  if (!stat2.isDirectory()) {
42803
43056
  console.error(`Project path exists but is not a directory: ${projectPath}`);
42804
43057
  process.exit(1);
@@ -42825,7 +43078,7 @@ async function resolveHubComputer(ref) {
42825
43078
  process.exit(1);
42826
43079
  }
42827
43080
  function isAbsoluteAnywhere(p) {
42828
- return import_node_path4.default.posix.isAbsolute(p) || import_node_path4.default.win32.isAbsolute(p);
43081
+ return import_node_path5.default.posix.isAbsolute(p) || import_node_path5.default.win32.isAbsolute(p);
42829
43082
  }
42830
43083
  async function prepareFolder(input2, computer) {
42831
43084
  const local = computer === null && await isCoLocatedHub();
@@ -43263,8 +43516,8 @@ function completionsCommand(root) {
43263
43516
  }
43264
43517
 
43265
43518
  // src/commands/init.ts
43266
- var import_node_fs3 = __toESM(require("node:fs"), 1);
43267
- var import_node_path5 = __toESM(require("node:path"), 1);
43519
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
43520
+ var import_node_path6 = __toESM(require("node:path"), 1);
43268
43521
 
43269
43522
  // ../../domains/ai-config/src/shared/provider-registry.ts
43270
43523
  var PROVIDER_PATHS = {
@@ -44070,7 +44323,6 @@ var Schema = class Schema2 {
44070
44323
  case "mapping":
44071
44324
  if (tag.matchByTagPrefix) prefix.mapping.push(tag);
44072
44325
  else exact.mapping[tag.tagName] = tag;
44073
- break;
44074
44326
  }
44075
44327
  }
44076
44328
  const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
@@ -44324,6 +44576,8 @@ var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
44324
44576
  "!": "!",
44325
44577
  "!!": "tag:yaml.org,2002:"
44326
44578
  });
44579
+ var TAG_SUFFIX_CHARS = "-#;/?:@&=+$_.~*'()";
44580
+ var TAG_URI_CHARS = TAG_SUFFIX_CHARS + "!,[]";
44327
44581
  var DEFAULT_CONSTRUCTOR_OPTIONS = {
44328
44582
  filename: "",
44329
44583
  schema: CORE_SCHEMA,
@@ -45192,10 +45446,10 @@ function writeInstructionsToDisk(projectPath, providers) {
45192
45446
  }
45193
45447
  const written = [];
45194
45448
  for (const filename of filenames) {
45195
- const filePath = import_node_path5.default.join(projectPath, filename);
45196
- const existing = import_node_fs3.default.existsSync(filePath) ? import_node_fs3.default.readFileSync(filePath, "utf-8") : "";
45449
+ const filePath = import_node_path6.default.join(projectPath, filename);
45450
+ const existing = import_node_fs4.default.existsSync(filePath) ? import_node_fs4.default.readFileSync(filePath, "utf-8") : "";
45197
45451
  const prefix = existing && !existing.endsWith("\n") ? "\n" : "";
45198
- import_node_fs3.default.appendFileSync(filePath, prefix + INSTRUCTIONS, "utf-8");
45452
+ import_node_fs4.default.appendFileSync(filePath, prefix + INSTRUCTIONS, "utf-8");
45199
45453
  written.push(filename);
45200
45454
  }
45201
45455
  return written;
@@ -45205,9 +45459,9 @@ function writeSkillsToDisk(projectPath, providers, skills) {
45205
45459
  const mapping = PROVIDER_PATHS[provider];
45206
45460
  if (!mapping?.skillsDir) continue;
45207
45461
  for (const skill of skills) {
45208
- const filePath = import_node_path5.default.join(projectPath, mapping.skillsDir, skill.slug, "SKILL.md");
45209
- import_node_fs3.default.mkdirSync(import_node_path5.default.dirname(filePath), { recursive: true });
45210
- import_node_fs3.default.writeFileSync(filePath, skill.content, "utf-8");
45462
+ const filePath = import_node_path6.default.join(projectPath, mapping.skillsDir, skill.slug, "SKILL.md");
45463
+ import_node_fs4.default.mkdirSync(import_node_path6.default.dirname(filePath), { recursive: true });
45464
+ import_node_fs4.default.writeFileSync(filePath, skill.content, "utf-8");
45211
45465
  }
45212
45466
  }
45213
45467
  }
@@ -45231,8 +45485,8 @@ async function resolveTargetProject(explicit) {
45231
45485
  return { ref: data.id, localFolder: data.path };
45232
45486
  }
45233
45487
  async function runInstall(opts) {
45234
- const explicitPath = opts.path ? import_node_path5.default.resolve(opts.path) : null;
45235
- if (explicitPath && !import_node_fs3.default.statSync(explicitPath).isDirectory()) {
45488
+ const explicitPath = opts.path ? import_node_path6.default.resolve(opts.path) : null;
45489
+ if (explicitPath && !import_node_fs4.default.statSync(explicitPath).isDirectory()) {
45236
45490
  throw new Error(`Not a directory: ${explicitPath}`);
45237
45491
  }
45238
45492
  const { ref: projectRef, localFolder } = await resolveTargetProject(opts.project);
@@ -45242,7 +45496,7 @@ async function runInstall(opts) {
45242
45496
  );
45243
45497
  const { project, providers, stats, skills } = data;
45244
45498
  const candidate = explicitPath ?? localFolder ?? project.path;
45245
- const localPath = candidate && import_node_fs3.default.existsSync(candidate) ? candidate : null;
45499
+ const localPath = candidate && import_node_fs4.default.existsSync(candidate) ? candidate : null;
45246
45500
  if (opts.writeInstructions && localPath) {
45247
45501
  const written = writeInstructionsToDisk(localPath, providers);
45248
45502
  for (const f of written) console.log(` Appended instructions to ${f}`);
@@ -46217,7 +46471,7 @@ function templatesCommand() {
46217
46471
  }
46218
46472
 
46219
46473
  // src/commands/automations.ts
46220
- var import_node_fs4 = __toESM(require("node:fs"), 1);
46474
+ var import_node_fs5 = __toESM(require("node:fs"), 1);
46221
46475
 
46222
46476
  // ../../domains/automations/src/shared/templates.ts
46223
46477
  var TEMPLATE_VARIABLES = [
@@ -46325,7 +46579,7 @@ function automationsCommand() {
46325
46579
  let conditions = [];
46326
46580
  let actions;
46327
46581
  if (opts.config) {
46328
- const raw = import_node_fs4.default.readFileSync(opts.config, "utf-8");
46582
+ const raw = import_node_fs5.default.readFileSync(opts.config, "utf-8");
46329
46583
  const config2 = JSON.parse(raw);
46330
46584
  triggerConfig = config2.trigger_config;
46331
46585
  conditions = config2.conditions ?? [];
@@ -46552,12 +46806,12 @@ function panelsCommand() {
46552
46806
 
46553
46807
  // src/commands/hub.ts
46554
46808
  var import_node_child_process5 = require("node:child_process");
46555
- var import_node_fs10 = require("node:fs");
46556
- var import_node_path10 = require("node:path");
46809
+ var import_node_fs11 = require("node:fs");
46810
+ var import_node_path11 = require("node:path");
46557
46811
 
46558
46812
  // ../../shared/platform/src/slayzone-config.ts
46559
- var import_node_fs5 = require("node:fs");
46560
- var import_node_path6 = require("node:path");
46813
+ var import_node_fs6 = require("node:fs");
46814
+ var import_node_path7 = require("node:path");
46561
46815
  var HUB_CONFIG_SWITCH_KEYS = [
46562
46816
  "requireLogin",
46563
46817
  "enablePassword",
@@ -46567,13 +46821,13 @@ var HUB_CONFIG_SWITCH_KEYS = [
46567
46821
  "enableTelemetry"
46568
46822
  ];
46569
46823
  function getHubConfigFilePath() {
46570
- return (0, import_node_path6.join)(getSlayzoneHomeDir(), "hub.config.json");
46824
+ return (0, import_node_path7.join)(getSlayzoneHomeDir(), "hub.config.json");
46571
46825
  }
46572
46826
  function getComputerConfigFilePath() {
46573
- return (0, import_node_path6.join)(getSlayzoneHomeDir(), "computer.config.json");
46827
+ return (0, import_node_path7.join)(getSlayzoneHomeDir(), "computer.config.json");
46574
46828
  }
46575
46829
  function legacyConfigFilePathFor(newFilePath) {
46576
- return (0, import_node_path6.join)((0, import_node_path6.dirname)(newFilePath), "config.json");
46830
+ return (0, import_node_path7.join)((0, import_node_path7.dirname)(newFilePath), "config.json");
46577
46831
  }
46578
46832
  function coerceHubConfig(raw) {
46579
46833
  const cfg = {};
@@ -46590,6 +46844,8 @@ function coerceHubConfig(raw) {
46590
46844
  cfg.ssoTenantId = raw.ssoTenantId.trim();
46591
46845
  if (typeof raw.ssoClientId === "string" && raw.ssoClientId.trim().length > 0)
46592
46846
  cfg.ssoClientId = raw.ssoClientId.trim();
46847
+ if (Array.isArray(raw.stunAddresses) && raw.stunAddresses.every((a) => typeof a === "string"))
46848
+ cfg.stunAddresses = raw.stunAddresses;
46593
46849
  return cfg;
46594
46850
  }
46595
46851
  function coerceComputerConfig(raw) {
@@ -46608,12 +46864,14 @@ function coerceComputerConfig(raw) {
46608
46864
  const roots = raw.allowedRoots.filter((r) => typeof r === "string" && r.length > 0);
46609
46865
  if (roots.length > 0) cfg.allowedRoots = roots;
46610
46866
  }
46867
+ if (typeof raw.directListenAddress === "string") cfg.directListenAddress = raw.directListenAddress;
46868
+ if (typeof raw.directPublicAddress === "string") cfg.directPublicAddress = raw.directPublicAddress;
46611
46869
  return cfg;
46612
46870
  }
46613
46871
  function readJsonObject2(path12) {
46614
46872
  let raw;
46615
46873
  try {
46616
- raw = (0, import_node_fs5.readFileSync)(path12, "utf8");
46874
+ raw = (0, import_node_fs6.readFileSync)(path12, "utf8");
46617
46875
  } catch (err) {
46618
46876
  if (err.code === "ENOENT") return null;
46619
46877
  process.stderr.write(
@@ -46640,15 +46898,15 @@ function readJsonObject2(path12) {
46640
46898
  return parsed;
46641
46899
  }
46642
46900
  function writeJsonAtomic(path12, data) {
46643
- const dir = (0, import_node_path6.dirname)(path12);
46644
- (0, import_node_fs5.mkdirSync)(dir, { recursive: true, mode: 448 });
46901
+ const dir = (0, import_node_path7.dirname)(path12);
46902
+ (0, import_node_fs6.mkdirSync)(dir, { recursive: true, mode: 448 });
46645
46903
  const tmpPath = `${path12}.tmp-${process.pid}-${Date.now()}`;
46646
- (0, import_node_fs5.writeFileSync)(tmpPath, `${JSON.stringify(data, null, 2)}
46904
+ (0, import_node_fs6.writeFileSync)(tmpPath, `${JSON.stringify(data, null, 2)}
46647
46905
  `, { mode: 384 });
46648
46906
  try {
46649
- (0, import_node_fs5.renameSync)(tmpPath, path12);
46907
+ (0, import_node_fs6.renameSync)(tmpPath, path12);
46650
46908
  } catch (err) {
46651
- (0, import_node_fs5.rmSync)(tmpPath, { force: true });
46909
+ (0, import_node_fs6.rmSync)(tmpPath, { force: true });
46652
46910
  throw err;
46653
46911
  }
46654
46912
  }
@@ -46685,9 +46943,9 @@ function updateComputerConfigFile(patch, path12 = getComputerConfigFilePath()) {
46685
46943
 
46686
46944
  // ../../shared/platform/src/service-unit.ts
46687
46945
  var import_node_child_process2 = require("node:child_process");
46688
- var import_node_fs6 = require("node:fs");
46946
+ var import_node_fs7 = require("node:fs");
46689
46947
  var import_node_os2 = require("node:os");
46690
- var import_node_path7 = require("node:path");
46948
+ var import_node_path8 = require("node:path");
46691
46949
  var KINDS = {
46692
46950
  "computer-host": {
46693
46951
  labelPrefix: "com.slayzone.session-host.",
@@ -46732,8 +46990,8 @@ function assertValidServiceName(kind, name) {
46732
46990
  }
46733
46991
  function defaultUnitDir(backend) {
46734
46992
  const home = process.env.HOME ?? (0, import_node_os2.homedir)();
46735
- if (backend === "launchd") return (0, import_node_path7.join)(home, "Library", "LaunchAgents");
46736
- if (backend === "systemd") return (0, import_node_path7.join)(home, ".config", "systemd", "user");
46993
+ if (backend === "launchd") return (0, import_node_path8.join)(home, "Library", "LaunchAgents");
46994
+ if (backend === "systemd") return (0, import_node_path8.join)(home, ".config", "systemd", "user");
46737
46995
  throw new Error("[slayzone] no unit directory: this platform has no user service backend");
46738
46996
  }
46739
46997
  function derivedRuntimeDir() {
@@ -46741,7 +46999,7 @@ function derivedRuntimeDir() {
46741
46999
  const uid = process.getuid?.();
46742
47000
  if (uid === void 0) return null;
46743
47001
  const dir = `/run/user/${uid}`;
46744
- return (0, import_node_fs6.existsSync)(dir) ? dir : null;
47002
+ return (0, import_node_fs7.existsSync)(dir) ? dir : null;
46745
47003
  }
46746
47004
  function userServiceEnv() {
46747
47005
  const dir = derivedRuntimeDir();
@@ -46801,7 +47059,7 @@ then log out and back in.`;
46801
47059
  }
46802
47060
  function unitPath(kind, name, backend, unitDir = defaultUnitDir(backend)) {
46803
47061
  assertValidServiceName(kind, name);
46804
- return backend === "launchd" ? (0, import_node_path7.join)(unitDir, `${KINDS[kind].labelPrefix}${name}.plist`) : (0, import_node_path7.join)(unitDir, `${KINDS[kind].systemdPrefix}${name}.service`);
47062
+ return backend === "launchd" ? (0, import_node_path8.join)(unitDir, `${KINDS[kind].labelPrefix}${name}.plist`) : (0, import_node_path8.join)(unitDir, `${KINDS[kind].systemdPrefix}${name}.service`);
46805
47063
  }
46806
47064
  function nameFromUnitFile(kind, file2, backend) {
46807
47065
  if (backend === "launchd") {
@@ -46863,9 +47121,9 @@ ${envEntries}
46863
47121
  <false/>
46864
47122
  </dict>
46865
47123
  <key>StandardOutPath</key>
46866
- <string>${xmlEscape((0, import_node_path7.join)(spec.logDir, kind.outLog))}</string>
47124
+ <string>${xmlEscape((0, import_node_path8.join)(spec.logDir, kind.outLog))}</string>
46867
47125
  <key>StandardErrorPath</key>
46868
- <string>${xmlEscape((0, import_node_path7.join)(spec.logDir, kind.errLog))}</string>
47126
+ <string>${xmlEscape((0, import_node_path8.join)(spec.logDir, kind.errLog))}</string>
46869
47127
  <key>ProcessType</key>
46870
47128
  <string>Background</string>
46871
47129
  </dict>
@@ -46899,48 +47157,48 @@ WantedBy=default.target
46899
47157
  }
46900
47158
  function writeUnit(spec, backend, unitDir = defaultUnitDir(backend)) {
46901
47159
  const path12 = unitPath(spec.kind, spec.name, backend, unitDir);
46902
- (0, import_node_fs6.mkdirSync)(unitDir, { recursive: true });
47160
+ (0, import_node_fs7.mkdirSync)(unitDir, { recursive: true });
46903
47161
  const content = backend === "launchd" ? renderLaunchdPlist(spec) : renderSystemdUnit(spec);
46904
47162
  if (!unitHoldsSecret(spec)) {
46905
- (0, import_node_fs6.writeFileSync)(path12, content, { mode: 420 });
47163
+ (0, import_node_fs7.writeFileSync)(path12, content, { mode: 420 });
46906
47164
  return path12;
46907
47165
  }
46908
47166
  const tmp = `${path12}.${process.pid}.tmp`;
46909
- (0, import_node_fs6.rmSync)(tmp, { force: true });
47167
+ (0, import_node_fs7.rmSync)(tmp, { force: true });
46910
47168
  try {
46911
- (0, import_node_fs6.writeFileSync)(tmp, content, { mode: 384, flag: "wx" });
46912
- (0, import_node_fs6.chmodSync)(tmp, 384);
46913
- (0, import_node_fs6.renameSync)(tmp, path12);
47169
+ (0, import_node_fs7.writeFileSync)(tmp, content, { mode: 384, flag: "wx" });
47170
+ (0, import_node_fs7.chmodSync)(tmp, 384);
47171
+ (0, import_node_fs7.renameSync)(tmp, path12);
46914
47172
  } catch (err) {
46915
- (0, import_node_fs6.rmSync)(tmp, { force: true });
47173
+ (0, import_node_fs7.rmSync)(tmp, { force: true });
46916
47174
  throw err;
46917
47175
  }
46918
47176
  return path12;
46919
47177
  }
46920
47178
  function removeUnit(kind, name, backend, unitDir = defaultUnitDir(backend)) {
46921
47179
  const path12 = unitPath(kind, name, backend, unitDir);
46922
- if (!(0, import_node_fs6.existsSync)(path12)) return false;
46923
- (0, import_node_fs6.rmSync)(path12, { force: true });
47180
+ if (!(0, import_node_fs7.existsSync)(path12)) return false;
47181
+ (0, import_node_fs7.rmSync)(path12, { force: true });
46924
47182
  return true;
46925
47183
  }
46926
47184
  function listRegisteredUnits(kind, backend, unitDir = defaultUnitDir(backend)) {
46927
47185
  let files;
46928
47186
  try {
46929
- files = (0, import_node_fs6.readdirSync)(unitDir);
47187
+ files = (0, import_node_fs7.readdirSync)(unitDir);
46930
47188
  } catch {
46931
47189
  return [];
46932
47190
  }
46933
47191
  const out = [];
46934
47192
  for (const file2 of files) {
46935
47193
  const name = nameFromUnitFile(kind, file2, backend);
46936
- if (name) out.push({ name, unitPath: (0, import_node_path7.join)(unitDir, file2) });
47194
+ if (name) out.push({ name, unitPath: (0, import_node_path8.join)(unitDir, file2) });
46937
47195
  }
46938
47196
  return out.sort((a, b) => a.name.localeCompare(b.name));
46939
47197
  }
46940
47198
  function readUnitRoot(kind, name, backend, unitDir = defaultUnitDir(backend)) {
46941
47199
  let text;
46942
47200
  try {
46943
- text = (0, import_node_fs6.readFileSync)(unitPath(kind, name, backend, unitDir), "utf8");
47201
+ text = (0, import_node_fs7.readFileSync)(unitPath(kind, name, backend, unitDir), "utf8");
46944
47202
  } catch {
46945
47203
  return null;
46946
47204
  }
@@ -46963,7 +47221,7 @@ function launchdLabel(kind, name) {
46963
47221
  function readUnitEnv(kind, name, backend, unitDir = defaultUnitDir(backend)) {
46964
47222
  let text;
46965
47223
  try {
46966
- text = (0, import_node_fs6.readFileSync)(unitPath(kind, name, backend, unitDir), "utf8");
47224
+ text = (0, import_node_fs7.readFileSync)(unitPath(kind, name, backend, unitDir), "utf8");
46967
47225
  } catch {
46968
47226
  return {};
46969
47227
  }
@@ -46988,9 +47246,9 @@ function readUnitSecrets(kind, name, backend, unitDir = defaultUnitDir(backend))
46988
47246
  }
46989
47247
 
46990
47248
  // ../../shared/platform/src/computer-launcher.ts
46991
- var import_node_fs7 = require("node:fs");
46992
- var import_node_path8 = require("node:path");
46993
47249
  var import_node_fs8 = require("node:fs");
47250
+ var import_node_path9 = require("node:path");
47251
+ var import_node_fs9 = require("node:fs");
46994
47252
  var COMPUTER_LAUNCHER = String.raw`#!/usr/bin/env node
46995
47253
  const fs = require('node:fs'), path = require('node:path'), cp = require('node:child_process');
46996
47254
  const root = process.env.SLAYZONE_ROOT;
@@ -47031,48 +47289,48 @@ for (const signal of ['SIGINT','SIGTERM']) process.on(signal, () => {stopping =
47031
47289
  launch();
47032
47290
  `;
47033
47291
  function ensureComputerLauncher(root, release, forceUpgrade = false) {
47034
- const dir = (0, import_node_path8.join)(root, "computer-runtime");
47035
- (0, import_node_fs7.mkdirSync)(dir, { recursive: true, mode: 448 });
47036
- const launcher = (0, import_node_path8.join)(dir, "launch.cjs");
47037
- (0, import_node_fs7.writeFileSync)(launcher + ".tmp", COMPUTER_LAUNCHER, { mode: 448 });
47292
+ const dir = (0, import_node_path9.join)(root, "computer-runtime");
47293
+ (0, import_node_fs8.mkdirSync)(dir, { recursive: true, mode: 448 });
47294
+ const launcher = (0, import_node_path9.join)(dir, "launch.cjs");
47295
+ (0, import_node_fs8.writeFileSync)(launcher + ".tmp", COMPUTER_LAUNCHER, { mode: 448 });
47038
47296
  renameLauncher(launcher);
47039
47297
  if (forceUpgrade) {
47040
47298
  for (const name of ["supervisor.json", "host-release.json"]) {
47041
- const path12 = (0, import_node_path8.join)(dir, name);
47299
+ const path12 = (0, import_node_path9.join)(dir, name);
47042
47300
  let previous;
47043
47301
  try {
47044
47302
  previous = JSON.parse(readPointer(path12)).current;
47045
47303
  } catch {
47046
47304
  }
47047
- (0, import_node_fs7.writeFileSync)(
47305
+ (0, import_node_fs8.writeFileSync)(
47048
47306
  path12 + ".tmp",
47049
47307
  JSON.stringify({ current: release, ...previous ? { previous } : {} }),
47050
47308
  { mode: 384 }
47051
47309
  );
47052
- (0, import_node_fs8.renameSync)(path12 + ".tmp", path12);
47310
+ (0, import_node_fs9.renameSync)(path12 + ".tmp", path12);
47053
47311
  }
47054
47312
  }
47055
- const hostPointer = (0, import_node_path8.join)(dir, "host-release.json");
47056
- if (!(0, import_node_fs7.existsSync)(hostPointer))
47057
- (0, import_node_fs7.writeFileSync)(hostPointer, JSON.stringify({ current: release }), { mode: 384, flag: "wx" });
47058
- const pointer = (0, import_node_path8.join)(dir, "supervisor.json");
47059
- if (!(0, import_node_fs7.existsSync)(pointer))
47060
- (0, import_node_fs7.writeFileSync)(pointer, JSON.stringify({ current: release }), { mode: 384, flag: "wx" });
47313
+ const hostPointer = (0, import_node_path9.join)(dir, "host-release.json");
47314
+ if (!(0, import_node_fs8.existsSync)(hostPointer))
47315
+ (0, import_node_fs8.writeFileSync)(hostPointer, JSON.stringify({ current: release }), { mode: 384, flag: "wx" });
47316
+ const pointer = (0, import_node_path9.join)(dir, "supervisor.json");
47317
+ if (!(0, import_node_fs8.existsSync)(pointer))
47318
+ (0, import_node_fs8.writeFileSync)(pointer, JSON.stringify({ current: release }), { mode: 384, flag: "wx" });
47061
47319
  return launcher;
47062
47320
  }
47063
47321
  function readPointer(path12) {
47064
- return (0, import_node_fs8.readFileSync)(path12, "utf8");
47322
+ return (0, import_node_fs9.readFileSync)(path12, "utf8");
47065
47323
  }
47066
47324
  function renameLauncher(path12) {
47067
- (0, import_node_fs8.renameSync)(path12 + ".tmp", path12);
47325
+ (0, import_node_fs9.renameSync)(path12 + ".tmp", path12);
47068
47326
  }
47069
47327
 
47070
47328
  // src/service.ts
47071
47329
  var import_node_child_process3 = require("node:child_process");
47072
- var import_node_fs9 = require("node:fs");
47330
+ var import_node_fs10 = require("node:fs");
47073
47331
  var import_node_module = require("node:module");
47074
- var import_node_path9 = require("node:path");
47075
- var CLI_VERSION = true ? "0.37.2" : "";
47332
+ var import_node_path10 = require("node:path");
47333
+ var CLI_VERSION = true ? "0.38.1" : "";
47076
47334
  function fail(message) {
47077
47335
  console.error(message);
47078
47336
  process.exit(1);
@@ -47105,25 +47363,25 @@ function servicePackage(kind) {
47105
47363
  function readServicePkg(kind, pkgJsonPath) {
47106
47364
  let pkg;
47107
47365
  try {
47108
- pkg = JSON.parse((0, import_node_fs9.readFileSync)(pkgJsonPath, "utf8"));
47366
+ pkg = JSON.parse((0, import_node_fs10.readFileSync)(pkgJsonPath, "utf8"));
47109
47367
  } catch {
47110
47368
  return null;
47111
47369
  }
47112
47370
  const binRel = typeof pkg.bin === "string" ? pkg.bin : pkg.bin?.[PACKAGES[kind].bin];
47113
47371
  if (!binRel) return null;
47114
- const binPath = (0, import_node_path9.join)((0, import_node_path9.dirname)(pkgJsonPath), binRel);
47115
- if (!(0, import_node_fs9.existsSync)(binPath)) return null;
47372
+ const binPath = (0, import_node_path10.join)((0, import_node_path10.dirname)(pkgJsonPath), binRel);
47373
+ if (!(0, import_node_fs10.existsSync)(binPath)) return null;
47116
47374
  return { binPath, version: pkg.version ?? "unknown" };
47117
47375
  }
47118
47376
  function interpreterFor(binPath, version2) {
47119
- let dir = (0, import_node_path9.dirname)(binPath);
47377
+ let dir = (0, import_node_path10.dirname)(binPath);
47120
47378
  for (let i = 0; i < 6; i++) {
47121
- const pathTxt = (0, import_node_path9.join)(dir, "node_modules", "electron", "path.txt");
47122
- if ((0, import_node_fs9.existsSync)(pathTxt)) {
47379
+ const pathTxt = (0, import_node_path10.join)(dir, "node_modules", "electron", "path.txt");
47380
+ if ((0, import_node_fs10.existsSync)(pathTxt)) {
47123
47381
  try {
47124
- const rel = (0, import_node_fs9.readFileSync)(pathTxt, "utf8").trim();
47125
- const electron = (0, import_node_path9.join)(dir, "node_modules", "electron", "dist", rel);
47126
- if ((0, import_node_fs9.existsSync)(electron)) {
47382
+ const rel = (0, import_node_fs10.readFileSync)(pathTxt, "utf8").trim();
47383
+ const electron = (0, import_node_path10.join)(dir, "node_modules", "electron", "dist", rel);
47384
+ if ((0, import_node_fs10.existsSync)(electron)) {
47127
47385
  return {
47128
47386
  command: electron,
47129
47387
  args: [binPath],
@@ -47135,7 +47393,7 @@ function interpreterFor(binPath, version2) {
47135
47393
  } catch {
47136
47394
  }
47137
47395
  }
47138
- const parent = (0, import_node_path9.dirname)(dir);
47396
+ const parent = (0, import_node_path10.dirname)(dir);
47139
47397
  if (parent === dir) break;
47140
47398
  dir = parent;
47141
47399
  }
@@ -47163,7 +47421,7 @@ function resolveServiceBin(kind, computerRoot, forceUpgrade = false) {
47163
47421
  // this package's CJS bundle.
47164
47422
  () => {
47165
47423
  try {
47166
- return (0, import_node_module.createRequire)(process.argv[1] ?? (0, import_node_path9.join)(process.cwd(), "x")).resolve(
47424
+ return (0, import_node_module.createRequire)(process.argv[1] ?? (0, import_node_path10.join)(process.cwd(), "x")).resolve(
47167
47425
  `${pkg}/package.json`
47168
47426
  );
47169
47427
  } catch {
@@ -47174,8 +47432,8 @@ function resolveServiceBin(kind, computerRoot, forceUpgrade = false) {
47174
47432
  () => {
47175
47433
  const self2 = process.argv[1];
47176
47434
  if (!self2) return null;
47177
- const sibling = (0, import_node_path9.join)((0, import_node_path9.dirname)(self2), "..", "..", devDir, "package.json");
47178
- return (0, import_node_fs9.existsSync)(sibling) ? sibling : null;
47435
+ const sibling = (0, import_node_path10.join)((0, import_node_path10.dirname)(self2), "..", "..", devDir, "package.json");
47436
+ return (0, import_node_fs10.existsSync)(sibling) ? sibling : null;
47179
47437
  }
47180
47438
  ];
47181
47439
  for (const find of candidates) {
@@ -47185,11 +47443,11 @@ function resolveServiceBin(kind, computerRoot, forceUpgrade = false) {
47185
47443
  if (found3) return resolve2(interpreterFor(found3.binPath, found3.version));
47186
47444
  }
47187
47445
  const prefix = getServiceRuntimeDir(kind);
47188
- const installed = (0, import_node_path9.join)(prefix, "node_modules", pkg, "package.json");
47446
+ const installed = (0, import_node_path10.join)(prefix, "node_modules", pkg, "package.json");
47189
47447
  const wanted = CLI_VERSION ? `${pkg}@${CLI_VERSION}` : `${pkg}@beta`;
47190
- if (!(0, import_node_fs9.existsSync)(installed) || CLI_VERSION && readServicePkg(kind, installed)?.version !== CLI_VERSION) {
47448
+ if (!(0, import_node_fs10.existsSync)(installed) || CLI_VERSION && readServicePkg(kind, installed)?.version !== CLI_VERSION) {
47191
47449
  console.log(`Installing ${wanted}\u2026`);
47192
- (0, import_node_fs9.mkdirSync)(prefix, { recursive: true });
47450
+ (0, import_node_fs10.mkdirSync)(prefix, { recursive: true });
47193
47451
  try {
47194
47452
  (0, import_node_child_process3.execFileSync)(
47195
47453
  "npm",
@@ -47214,21 +47472,21 @@ function resolveServiceBin(kind, computerRoot, forceUpgrade = false) {
47214
47472
  }
47215
47473
  function ensureLogDir(kind, root) {
47216
47474
  const dir = logDirFor(kind, root);
47217
- (0, import_node_fs9.mkdirSync)(dir, { recursive: true });
47475
+ (0, import_node_fs10.mkdirSync)(dir, { recursive: true });
47218
47476
  return dir;
47219
47477
  }
47220
47478
  function logDirFor(_kind, root) {
47221
- return (0, import_node_path9.join)(root, "logs");
47479
+ return (0, import_node_path10.join)(root, "logs");
47222
47480
  }
47223
47481
  function serviceLogPaths(kind, root) {
47224
47482
  const dir = logDirFor(kind, root);
47225
47483
  const names = serviceLogNames(kind);
47226
- return { out: (0, import_node_path9.join)(dir, names.out), err: (0, import_node_path9.join)(dir, names.err) };
47484
+ return { out: (0, import_node_path10.join)(dir, names.out), err: (0, import_node_path10.join)(dir, names.err) };
47227
47485
  }
47228
47486
  function failWithLog(kind, name, logPath, what) {
47229
47487
  let detail = "";
47230
47488
  try {
47231
- detail = (0, import_node_fs9.readFileSync)(logPath, "utf8").trim().split("\n").slice(-12).join("\n");
47489
+ detail = (0, import_node_fs10.readFileSync)(logPath, "utf8").trim().split("\n").slice(-12).join("\n");
47232
47490
  } catch {
47233
47491
  }
47234
47492
  const label = kind === "hub" ? "Hub" : "Computer";
@@ -47257,14 +47515,14 @@ function readServiceLogTail(kind, root, lines, systemdUnit) {
47257
47515
  const dir = logDirFor(kind, root);
47258
47516
  let files;
47259
47517
  try {
47260
- files = (0, import_node_fs9.readdirSync)(dir).filter((f) => f.endsWith(".log"));
47518
+ files = (0, import_node_fs10.readdirSync)(dir).filter((f) => f.endsWith(".log"));
47261
47519
  } catch {
47262
47520
  return "";
47263
47521
  }
47264
47522
  const chunks = [];
47265
47523
  for (const f of files) {
47266
47524
  try {
47267
- chunks.push((0, import_node_fs9.readFileSync)((0, import_node_path9.join)(dir, f), "utf8"));
47525
+ chunks.push((0, import_node_fs10.readFileSync)((0, import_node_path10.join)(dir, f), "utf8"));
47268
47526
  } catch {
47269
47527
  }
47270
47528
  }
@@ -47280,8 +47538,8 @@ function followServiceLog(args) {
47280
47538
  return;
47281
47539
  }
47282
47540
  const dir = logDirFor(kind, root);
47283
- if (!(0, import_node_fs9.existsSync)(dir)) fail(`No log directory at ${shortenPath(dir)}.`);
47284
- const candidates = (0, import_node_fs9.readdirSync)(dir).filter((f) => f.endsWith(".log")).map((f) => ({ f, path: (0, import_node_path9.join)(dir, f), mtime: (0, import_node_fs9.statSync)((0, import_node_path9.join)(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
47541
+ if (!(0, import_node_fs10.existsSync)(dir)) fail(`No log directory at ${shortenPath(dir)}.`);
47542
+ const candidates = (0, import_node_fs10.readdirSync)(dir).filter((f) => f.endsWith(".log")).map((f) => ({ f, path: (0, import_node_path10.join)(dir, f), mtime: (0, import_node_fs10.statSync)((0, import_node_path10.join)(dir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
47285
47543
  if (candidates.length === 0) fail(`No log files in ${shortenPath(dir)}.`);
47286
47544
  const target = candidates[0].path;
47287
47545
  const targs = follow ? ["-f", "-n", String(lines), target] : ["-n", String(lines), target];
@@ -47529,25 +47787,13 @@ function postJson2(transport, url2, body, timeoutMs) {
47529
47787
  }
47530
47788
 
47531
47789
  // ../../domains/hub-auth/src/client/sign-in-error.ts
47532
- var ASK_ADMIN = "If it keeps failing, ask your administrator.";
47533
- var MESSAGES2 = {
47534
- // T-09 refuses every ID token that fails its checks with this generic code: another
47535
- // tenant, no MFA, no SlayZone app role, no email (the audit line names which).
47536
- unable_to_get_user_info: "Microsoft refused this account for this hub: it may belong to another organisation, have signed in without multi-factor authentication, or not be assigned to SlayZone. Ask your administrator.",
47537
- ACCOUNT_DISABLED: "This account is disabled on this hub. Ask your administrator.",
47538
- account_not_linked: "The email of this Microsoft account already belongs to another account on this hub, so it cannot sign in. Ask your administrator.",
47539
- unable_to_link_account: "This Microsoft account could not be connected to an account on this hub. Ask your administrator.",
47540
- access_denied: "Sign-in was cancelled at Microsoft. Try again.",
47541
- state_mismatch: "The sign-in took too long or was started in another tab. Try again.",
47542
- please_restart_the_process: "The sign-in took too long or was started in another tab. Try again.",
47543
- invalid_callback_request: "The sign-in took too long or was started in another tab. Try again.",
47544
- no_session: `Microsoft sign-in did not complete. Try again. ${ASK_ADMIN}`,
47545
- // App sign-in (`src/server/app-sign-in.ts`).
47546
- flow_expired: "The sign-in took too long or its browser window was closed. Try again.",
47547
- temporarily_unavailable: "Too many sign-ins are waiting on this hub. Try again in a few minutes."
47548
- };
47790
+ var DEFAULT_SSO_LABEL = "Microsoft";
47549
47791
 
47550
47792
  // ../../domains/hub-auth/src/client/health.ts
47793
+ function ssoLabelOf(health) {
47794
+ const label = health?.ssoLabel;
47795
+ return typeof label === "string" && /^[\p{L}\p{N} ._-]{1,32}$/u.test(label) ? label : DEFAULT_SSO_LABEL;
47796
+ }
47551
47797
  async function fetchHubHealth(transport, baseUrl, timeoutMs) {
47552
47798
  try {
47553
47799
  const res = await transport({
@@ -47571,7 +47817,11 @@ function signInMethodsOf(health) {
47571
47817
  const switches = health.switches;
47572
47818
  if (!switches) return void 0;
47573
47819
  const sw = switches;
47574
- return { sso: sw.enableSso === true, password: sw.enablePassword !== false };
47820
+ return {
47821
+ sso: sw.enableSso === true,
47822
+ password: sw.enablePassword !== false,
47823
+ ssoLabel: ssoLabelOf(health)
47824
+ };
47575
47825
  }
47576
47826
 
47577
47827
  // ../../domains/hub-auth/src/client/password.ts
@@ -48166,7 +48416,7 @@ async function launchHub(args) {
48166
48416
  const probePort = address !== void 0 ? parseHubAddress(address)?.port : port;
48167
48417
  const findIt = () => probePort === void 0 ? findAnyHub(name) : findHub(String(probePort));
48168
48418
  if (backend === "none") {
48169
- const out = (0, import_node_fs10.openSync)(logs.out, "a");
48419
+ const out = (0, import_node_fs11.openSync)(logs.out, "a");
48170
48420
  const child = (0, import_node_child_process5.spawn)(bin.command, bin.args, {
48171
48421
  cwd: root,
48172
48422
  detached: true,
@@ -48273,7 +48523,7 @@ then log out and back in, and retry. If this account is not meant to have one (a
48273
48523
  }
48274
48524
  }
48275
48525
  async function haltHub(hub, backend, opts) {
48276
- if (backend !== "none" && (0, import_node_fs10.existsSync)(unitPath("hub", hub.name, backend))) {
48526
+ if (backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("hub", hub.name, backend))) {
48277
48527
  supervisorStop("hub", backend, hub.name);
48278
48528
  if (opts.unregister) removeUnit("hub", hub.name, backend);
48279
48529
  } else {
@@ -48444,10 +48694,10 @@ function hubCommand() {
48444
48694
  console.log(
48445
48695
  `${"-".repeat(nameW)} ${"-".repeat(5)} ${"-".repeat(7)} ${"-".repeat(rootW)} ${"-".repeat(9)} ${"-".repeat(8)}`
48446
48696
  );
48447
- const ownRoot = process.env.SLAYZONE_ROOT?.trim() ? (0, import_node_path10.resolve)(process.env.SLAYZONE_ROOT.trim()) : null;
48697
+ const ownRoot = process.env.SLAYZONE_ROOT?.trim() ? (0, import_node_path11.resolve)(process.env.SLAYZONE_ROOT.trim()) : null;
48448
48698
  for (const h of hubs) {
48449
48699
  const root = h.supervised ? "(desktop app)" : shortenPath(h.root);
48450
- const mine = ownRoot && (0, import_node_path10.resolve)(h.root) === ownRoot ? " \u2190 this shell" : "";
48700
+ const mine = ownRoot && (0, import_node_path11.resolve)(h.root) === ownRoot ? " \u2190 this shell" : "";
48451
48701
  console.log(
48452
48702
  `${h.name.padEnd(nameW)} ${String(h.port).padEnd(5)} ${String(h.pid).padEnd(7)} ${root.padEnd(rootW)} ${String(h.computersConnected).padEnd(9)} ${formatUptime(h.uptimeMs)}${mine}`
48453
48703
  );
@@ -48464,7 +48714,7 @@ Task hub: ${taskHub.url} (${taskHub.connection}; connection not checked)`);
48464
48714
  "Address to listen on (default: loopback). Required with --public-address: the hub serves plain http, so say whether it listens on loopback behind a same-box TLS front end (127.0.0.1) or on an interface the front end reaches (e.g. 10.0.0.4)."
48465
48715
  ).action(
48466
48716
  async (name, opts) => {
48467
- const root = (0, import_node_path10.resolve)(opts.root ?? process.cwd());
48717
+ const root = (0, import_node_path11.resolve)(opts.root ?? process.cwd());
48468
48718
  const port = opts.port === void 0 ? void 0 : Number(opts.port);
48469
48719
  if (port !== void 0 && (!Number.isInteger(port) || port < 1 || port > 65535)) {
48470
48720
  fail(`Invalid --port ${opts.port} \u2014 expected an integer 1-65535.`);
@@ -48513,14 +48763,14 @@ Avoid 0.0.0.0 unless the machine's firewall only lets the front end in.`
48513
48763
  if (publicAddress !== void 0 && !authSecret) {
48514
48764
  fail(
48515
48765
  `A hub other machines can reach needs SLAYZONE_HUB_AUTH_SECRET in its environment \u2014 it never generates its signing key onto its own disk, and it would refuse to boot without one.
48516
- Existing hub root (it already has sessions and enrolled computers): reuse its computerTransportSecret from ${(0, import_node_path10.join)(root, "hub.state.json")} \u2014 a new value invalidates every session and computer credential.
48766
+ Existing hub root (it already has sessions and enrolled computers): reuse its computerTransportSecret from ${(0, import_node_path11.join)(root, "hub.state.json")} \u2014 a new value invalidates every session and computer credential.
48517
48767
  New hub: generate one for this command:
48518
48768
  SLAYZONE_HUB_AUTH_SECRET=$(openssl rand -hex 32) slay hub create ${name} --public-address ${publicAddress} --bind <host[:port]>
48519
48769
  It is written into the hub's service unit (owner-only, 0600) so the hub keeps it across restarts.`
48520
48770
  );
48521
48771
  }
48522
48772
  const backend = resolveBackend();
48523
- if (backend !== "none" && (0, import_node_fs10.existsSync)(unitPath("hub", name, backend))) {
48773
+ if (backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("hub", name, backend))) {
48524
48774
  const existingRoot = readUnitRoot("hub", name, backend);
48525
48775
  fail(
48526
48776
  `A hub named "${name}" already exists${existingRoot ? ` (root ${shortenPath(existingRoot)})` : ""}.
@@ -48548,7 +48798,7 @@ Start it with \`slay hub start ${name}\`, or remove it with \`slay hub rm ${name
48548
48798
  publicAddress,
48549
48799
  ...address !== void 0 ? { listenAddress: address } : {}
48550
48800
  },
48551
- (0, import_node_path10.join)(root, "hub.config.json")
48801
+ (0, import_node_path11.join)(root, "hub.config.json")
48552
48802
  );
48553
48803
  console.log("Reachable: login required (SLAYZONE_HUB_REQUIRE_LOGIN=1)");
48554
48804
  console.log(`Listen: ${address ?? "(hub block default)"}`);
@@ -48605,7 +48855,7 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
48605
48855
  `This platform has no user service manager, so hubs are not registered and \`start\` has nothing to act on. Use \`slay hub create ${name}\`.`
48606
48856
  );
48607
48857
  }
48608
- if (!(0, import_node_fs10.existsSync)(unitPath("hub", name, backend))) {
48858
+ if (!(0, import_node_fs11.existsSync)(unitPath("hub", name, backend))) {
48609
48859
  fail(
48610
48860
  `No hub named "${name}". Create it with \`slay hub create ${name}\`, or list what exists with \`slay hub registered\`.`
48611
48861
  );
@@ -48628,7 +48878,7 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
48628
48878
  const hub = await requireHub(nameOrPort);
48629
48879
  refuseSupervised(hub, "stop");
48630
48880
  const backend = resolveBackend();
48631
- const registered = backend !== "none" && (0, import_node_fs10.existsSync)(unitPath("hub", hub.name, backend));
48881
+ const registered = backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("hub", hub.name, backend));
48632
48882
  await haltHub(hub, backend, { unregister: false });
48633
48883
  console.log(
48634
48884
  registered ? `Stopped "${hub.name}". Start it again with \`slay hub start ${hub.name}\`.` : `Stopped "${hub.name}" (pid ${hub.pid}). It was not registered by slay.`
@@ -48638,7 +48888,7 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
48638
48888
  const backend = resolveBackend();
48639
48889
  const hub = await findAnyHub(nameOrPort);
48640
48890
  if (!hub) {
48641
- if (backend !== "none" && (0, import_node_fs10.existsSync)(unitPath("hub", nameOrPort, backend))) {
48891
+ if (backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("hub", nameOrPort, backend))) {
48642
48892
  const root = readUnitRoot("hub", nameOrPort, backend);
48643
48893
  supervisorStopQuiet("hub", backend, nameOrPort);
48644
48894
  removeUnit("hub", nameOrPort, backend);
@@ -48658,7 +48908,7 @@ machines dial, recreate it with \`--public-address <host:port>\`.`
48658
48908
  const hub = await requireHub(nameOrPort);
48659
48909
  refuseSupervised(hub, "restart");
48660
48910
  const backend = resolveBackend();
48661
- if (backend === "none" || !(0, import_node_fs10.existsSync)(unitPath("hub", hub.name, backend))) {
48911
+ if (backend === "none" || !(0, import_node_fs11.existsSync)(unitPath("hub", hub.name, backend))) {
48662
48912
  fail(
48663
48913
  `"${hub.name}" is not managed by slay, so it cannot be restarted from here. Stop it where it was started, then \`slay hub create ${hub.name}\`.`
48664
48914
  );
@@ -48710,7 +48960,7 @@ then \`slay hub start ${name}\`.`
48710
48960
  root: hub.root,
48711
48961
  lines,
48712
48962
  follow: opts.follow === true,
48713
- systemdUnit: backend === "systemd" && (0, import_node_fs10.existsSync)(unitPath("hub", hub.name, backend))
48963
+ systemdUnit: backend === "systemd" && (0, import_node_fs11.existsSync)(unitPath("hub", hub.name, backend))
48714
48964
  });
48715
48965
  });
48716
48966
  cmd.command("use <name|url>").description("Point this CLI at a hub \u2014 a name from `hub ls`, or a full URL").option("--token <token>", "Bearer token sent as Authorization header").action(async (target, opts) => {
@@ -48724,8 +48974,8 @@ then \`slay hub start ${name}\`.`
48724
48974
  });
48725
48975
  cmd.command("login <url>").description("Sign in to a hub and store its bearer token for this CLI").option(
48726
48976
  "--email <email>",
48727
- "Sign in with this account and a password (see `slay hub users ls`). Omit on a hub with Microsoft sign-in: you approve in a browser instead"
48728
- ).option("--password <password>", "Account password (omit to read from stdin)").option("--no-browser", "Microsoft sign-in: print the page, do not try to open a browser").action(
48977
+ "Sign in with this account and a password (see `slay hub users ls`). Omit on a hub with SSO sign-in (Microsoft or another provider): you approve in a browser instead"
48978
+ ).option("--password <password>", "Account password (omit to read from stdin)").option("--no-browser", "SSO sign-in: print the page, do not try to open a browser").action(
48729
48979
  async (rawUrl, opts) => {
48730
48980
  const url2 = normalizeHubUrl(rawUrl);
48731
48981
  if (!url2) fail(`Invalid hub URL (expected an http(s) URL): ${rawUrl}`);
@@ -48740,11 +48990,11 @@ then \`slay hub start ${name}\`.`
48740
48990
  );
48741
48991
  }
48742
48992
  token = await deviceSignIn(url2, { openBrowser: opts.browser });
48743
- who = await signedInEmail(url2, token) ?? "your Microsoft account";
48993
+ who = await signedInEmail(url2, token) ?? `your ${methods.ssoLabel ?? DEFAULT_SSO_LABEL} account`;
48744
48994
  } else {
48745
48995
  if (!methods.password) {
48746
48996
  fail(
48747
- `Password sign-in is off on ${url2}. Sign in through Microsoft instead:
48997
+ `Password sign-in is off on ${url2}. Sign in through ${methods.ssoLabel ?? DEFAULT_SSO_LABEL} instead:
48748
48998
  slay hub login ${rawUrl}`
48749
48999
  );
48750
49000
  }
@@ -48840,8 +49090,8 @@ ${target.token ?? ""}`;
48840
49090
 
48841
49091
  // src/commands/computer.ts
48842
49092
  var import_node_child_process6 = require("node:child_process");
48843
- var import_node_fs12 = require("node:fs");
48844
- var import_node_path12 = require("node:path");
49093
+ var import_node_fs13 = require("node:fs");
49094
+ var import_node_path13 = require("node:path");
48845
49095
 
48846
49096
  // ../../shared/platform/src/join-token.ts
48847
49097
  var JOIN_TOKEN_PREFIX = "szjt1";
@@ -48868,17 +49118,17 @@ function decodeJoinToken(token) {
48868
49118
  }
48869
49119
 
48870
49120
  // src/commands/computer-identity.ts
48871
- var import_node_fs11 = require("node:fs");
48872
- var import_node_path11 = require("node:path");
49121
+ var import_node_fs12 = require("node:fs");
49122
+ var import_node_path12 = require("node:path");
48873
49123
  function configPathFor(root) {
48874
- return (0, import_node_path11.join)(root, "computer.config.json");
49124
+ return (0, import_node_path12.join)(root, "computer.config.json");
48875
49125
  }
48876
49126
  function ambientRoot() {
48877
49127
  return process.env.SLAYZONE_ROOT ?? process.cwd();
48878
49128
  }
48879
49129
  function isEnrolled(root) {
48880
49130
  try {
48881
- const parsed = JSON.parse((0, import_node_fs11.readFileSync)((0, import_node_path11.join)(root, "computer.state.json"), "utf8"));
49131
+ const parsed = JSON.parse((0, import_node_fs12.readFileSync)((0, import_node_path12.join)(root, "computer.state.json"), "utf8"));
48882
49132
  return typeof parsed === "object" && parsed !== null && Object.keys(parsed).length > 0;
48883
49133
  } catch {
48884
49134
  return false;
@@ -48929,7 +49179,7 @@ function rootClaims(root, name) {
48929
49179
  }
48930
49180
  async function resolveComputer(name, backend, opts = {}) {
48931
49181
  const cwd = opts.cwd ?? ambientRoot();
48932
- const supervised = backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("computer", name, backend));
49182
+ const supervised = backend !== "none" && (0, import_node_fs12.existsSync)(unitPath("computer", name, backend));
48933
49183
  const root = supervised ? readUnitRoot("computer", name, backend) : rootClaims(cwd, name) ? cwd : null;
48934
49184
  const local = localFacts(name, root, backend, supervised);
48935
49185
  if (opts.hub === false) return { ...local, connected: null };
@@ -48956,7 +49206,7 @@ async function listComputers(backend, opts = {}) {
48956
49206
  for (const r of rows ?? []) names.add(r.name);
48957
49207
  const computers = [];
48958
49208
  for (const name of [...names].sort((a, b) => a.localeCompare(b))) {
48959
- const supervised = backend !== "none" && (0, import_node_fs11.existsSync)(unitPath("computer", name, backend));
49209
+ const supervised = backend !== "none" && (0, import_node_fs12.existsSync)(unitPath("computer", name, backend));
48960
49210
  const root = supervised ? readUnitRoot("computer", name, backend) : rootClaims(cwd, name) ? cwd : null;
48961
49211
  const local = localFacts(name, root, backend, supervised);
48962
49212
  const row = rows?.find((r) => r.name === name) ?? null;
@@ -49029,7 +49279,7 @@ function requireRegistered(name, backend) {
49029
49279
  npx ${COMPUTER_PACKAGE}`
49030
49280
  );
49031
49281
  }
49032
- if (!(0, import_node_fs12.existsSync)(unitPath("computer", name, backend))) {
49282
+ if (!(0, import_node_fs13.existsSync)(unitPath("computer", name, backend))) {
49033
49283
  const known = listRegisteredUnits("computer", backend).map((u) => u.name);
49034
49284
  fail(
49035
49285
  `No computer named "${name}" on this machine.
@@ -49059,7 +49309,7 @@ async function launchComputer(args) {
49059
49309
  const logDir = ensureLogDir("computer", root);
49060
49310
  const logs = serviceLogPaths("computer", root);
49061
49311
  if (backend === "none") {
49062
- const out = (0, import_node_fs12.openSync)(logs.out, "a");
49312
+ const out = (0, import_node_fs13.openSync)(logs.out, "a");
49063
49313
  const child = (0, import_node_child_process6.spawn)(bin.command, bin.args, {
49064
49314
  cwd: root,
49065
49315
  detached: true,
@@ -49109,8 +49359,8 @@ async function launchComputer(args) {
49109
49359
  },
49110
49360
  backend
49111
49361
  );
49112
- (0, import_node_fs12.writeFileSync)(
49113
- (0, import_node_path12.join)(root, "computer-runtime", "host-service.json"),
49362
+ (0, import_node_fs13.writeFileSync)(
49363
+ (0, import_node_path13.join)(root, "computer-runtime", "host-service.json"),
49114
49364
  JSON.stringify({ backend, name }),
49115
49365
  { mode: 384 }
49116
49366
  );
@@ -49195,7 +49445,7 @@ function computerCommand() {
49195
49445
  const cmd = new Command("computer").description("Run and manage SlayZone computers on this machine").showSuggestionAfterError(true).showHelpAfterError(true);
49196
49446
  cmd.command("mint [label]").description("Mint a computer enrollment token on a hub (see `slay hub current`)").option(
49197
49447
  "--for <user>",
49198
- "Who the computer is for: their email or account id. Required on a hub with login"
49448
+ "Who the computer is for: their email or account id. Defaults to you; naming someone else needs a hub admin"
49199
49449
  ).option("--ttl <minutes>", `Token lifetime in minutes (at most ${MAX_TTL_MINUTES})`, "15").option("--json", "Output as JSON").action(async (label, opts) => {
49200
49450
  const ttlMinutes = Number(opts.ttl);
49201
49451
  if (!Number.isFinite(ttlMinutes) || ttlMinutes <= 0) {
@@ -49219,17 +49469,18 @@ function computerCommand() {
49219
49469
  unwrap: "raw",
49220
49470
  hints: {
49221
49471
  // The hub's 400s here are all about who the token is for (the lifetime is
49222
- // checked above): unnamed on a hub with login, unknown or disabled, or named
49223
- // on a hub without login.
49224
- 400: forUser ? `\`slay hub users ls\` lists this hub's accounts.` : `Name the user the computer is for:
49225
- slay computer mint ${label ?? "<name>"} --for <email>
49226
- (\`slay hub users ls\` lists this hub's accounts.)`,
49472
+ // checked above): an unknown or disabled user, or one named on a hub without
49473
+ // login.
49474
+ ...forUser ? { 400: `\`slay hub users ls\` lists this hub's accounts.` } : {},
49227
49475
  // The hub cannot know which command the operator should run to get a
49228
49476
  // credential, so name it here rather than leaving a bare 401.
49229
49477
  401: `Sign in to this hub first:
49230
49478
  slay hub login ${target.baseUrl} --email <email>
49231
49479
  No account yet? Create one ON the hub machine: slay hub users add <email>`,
49232
- 403: `This hub only mints join tokens for callers on its own machine.
49480
+ // With `--for` a 403 is the hub refusing a non-admin's mint for someone else;
49481
+ // without it, a hub without login refusing an off-box caller.
49482
+ 403: forUser ? `Only a hub admin can enroll a computer for someone else.
49483
+ Enroll your own: slay computer mint ${label ?? "<name>"}` : `This hub only mints join tokens for callers on its own machine.
49233
49484
  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.`
49234
49485
  }
49235
49486
  });
@@ -49301,7 +49552,7 @@ ${unmanaged.map((r) => `"${r.name}"`).join(", ")} ${unmanaged.length === 1 ? "is
49301
49552
  "Filesystem root the computer may operate under (repeatable; default: the computer root)",
49302
49553
  (value, previous = []) => [...previous, value]
49303
49554
  ).action(async (name, opts) => {
49304
- const root = (0, import_node_path12.resolve)(opts.root ?? process.cwd());
49555
+ const root = (0, import_node_path13.resolve)(opts.root ?? process.cwd());
49305
49556
  const backend = resolveBackend();
49306
49557
  const decoded = decodeJoinToken(opts.token);
49307
49558
  if (!decoded) {
@@ -49317,7 +49568,7 @@ Mint one on the hub:
49317
49568
  `"${DEFAULT_LOCAL_COMPUTER_NAME}" is reserved for the computer inside the SlayZone desktop app \u2014 a second computer using it would collide with that one on the hub. Choose another name.`
49318
49569
  );
49319
49570
  }
49320
- if (backend !== "none" && (0, import_node_fs12.existsSync)(unitPath("computer", name, backend))) {
49571
+ if (backend !== "none" && (0, import_node_fs13.existsSync)(unitPath("computer", name, backend))) {
49321
49572
  const existingRoot = readUnitRoot("computer", name, backend);
49322
49573
  fail(
49323
49574
  `A computer named "${name}" already exists${existingRoot ? ` (root ${shortenPath(existingRoot)})` : ""}.
@@ -49346,7 +49597,7 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49346
49597
  ` If you started it in the foreground, stop that process first \u2014 otherwise two computers would share this root.`
49347
49598
  );
49348
49599
  }
49349
- const allowedRoots = opts.allow && opts.allow.length > 0 ? opts.allow.map((d) => (0, import_node_path12.resolve)(d)) : [root];
49600
+ const allowedRoots = opts.allow && opts.allow.length > 0 ? opts.allow.map((d) => (0, import_node_path13.resolve)(d)) : [root];
49350
49601
  updateComputerConfigFile(
49351
49602
  {
49352
49603
  joinToken: opts.token,
@@ -49358,7 +49609,7 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49358
49609
  );
49359
49610
  if (!adopting) {
49360
49611
  registerCreateRollback(() => {
49361
- (0, import_node_fs12.rmSync)(configPathFor(root), { force: true });
49612
+ (0, import_node_fs13.rmSync)(configPathFor(root), { force: true });
49362
49613
  });
49363
49614
  }
49364
49615
  console.log(`Hub: ${decoded.hubUrl}`);
@@ -49418,7 +49669,7 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49418
49669
  }
49419
49670
  if (facts.root && facts.installed) {
49420
49671
  if (opts.purge) {
49421
- (0, import_node_fs12.rmSync)(facts.root, { recursive: true, force: true });
49672
+ (0, import_node_fs13.rmSync)(facts.root, { recursive: true, force: true });
49422
49673
  console.log(`Deleted ${shortenPath(facts.root)}.`);
49423
49674
  } else {
49424
49675
  console.log(`Config and credentials remain in ${shortenPath(facts.root)}.`);
@@ -49457,7 +49708,7 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49457
49708
  supervisorStop("computer", backend, name);
49458
49709
  supervisorStopQuiet("computer-host", backend, name);
49459
49710
  await waitForStopped(name, backend, 15e3);
49460
- if ((0, import_node_fs12.existsSync)(unitPath("computer-host", name, backend)))
49711
+ if ((0, import_node_fs13.existsSync)(unitPath("computer-host", name, backend)))
49461
49712
  supervisorStart("computer-host", backend, name, unitPath("computer-host", name, backend));
49462
49713
  supervisorStart("computer", backend, name, unitPath("computer", name, backend));
49463
49714
  if (!await waitForConnected(root, ENROLL_TIMEOUT_MS, backend, name)) {
@@ -49489,9 +49740,9 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49489
49740
  return;
49490
49741
  }
49491
49742
  const edit = editAllowedRoots(current, {
49492
- add: (opts.add ?? []).map((d) => (0, import_node_path12.resolve)(d)),
49493
- remove: (opts.remove ?? []).map((d) => (0, import_node_path12.resolve)(d)),
49494
- exists: import_node_fs12.existsSync
49743
+ add: (opts.add ?? []).map((d) => (0, import_node_path13.resolve)(d)),
49744
+ remove: (opts.remove ?? []).map((d) => (0, import_node_path13.resolve)(d)),
49745
+ exists: import_node_fs13.existsSync
49495
49746
  });
49496
49747
  if (edit.missing.length > 0) {
49497
49748
  fail(
@@ -49519,7 +49770,7 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49519
49770
  root,
49520
49771
  lines,
49521
49772
  follow: opts.follow === true,
49522
- systemdUnit: backend === "systemd" && (0, import_node_fs12.existsSync)(unitPath("computer", name, backend))
49773
+ systemdUnit: backend === "systemd" && (0, import_node_fs13.existsSync)(unitPath("computer", name, backend))
49523
49774
  });
49524
49775
  });
49525
49776
  return cmd;
@@ -49527,9 +49778,9 @@ Start it with \`slay computer start ${name}\`, or remove it with \`slay computer
49527
49778
 
49528
49779
  // src/commands/update.ts
49529
49780
  var import_node_child_process7 = require("node:child_process");
49530
- var import_node_fs13 = require("node:fs");
49781
+ var import_node_fs14 = require("node:fs");
49531
49782
  var import_node_os3 = require("node:os");
49532
- var import_node_path13 = require("node:path");
49783
+ var import_node_path14 = require("node:path");
49533
49784
  var PACKAGE_NAMES = ["@slayzone/cli", "@slayzone/computer", "@slayzone/hub"];
49534
49785
  var KIND_FOR_PACKAGE = {
49535
49786
  "@slayzone/hub": "hub",
@@ -49543,9 +49794,9 @@ function runCapture(bin, args) {
49543
49794
  }
49544
49795
  }
49545
49796
  function bunGlobalRoot() {
49546
- const base = process.env.BUN_INSTALL || (0, import_node_path13.join)((0, import_node_os3.homedir)(), ".bun");
49547
- const dir = (0, import_node_path13.join)(base, "install", "global", "node_modules");
49548
- return (0, import_node_fs13.existsSync)(dir) ? dir : null;
49797
+ const base = process.env.BUN_INSTALL || (0, import_node_path14.join)((0, import_node_os3.homedir)(), ".bun");
49798
+ const dir = (0, import_node_path14.join)(base, "install", "global", "node_modules");
49799
+ return (0, import_node_fs14.existsSync)(dir) ? dir : null;
49549
49800
  }
49550
49801
  var MANAGERS = [
49551
49802
  {
@@ -49585,10 +49836,10 @@ var MANAGERS = [
49585
49836
  }
49586
49837
  ];
49587
49838
  function readInstalledVersion(globalRoot, pkg) {
49588
- const pkgJsonPath = (0, import_node_path13.join)(globalRoot, ...pkg.split("/"), "package.json");
49589
- if (!(0, import_node_fs13.existsSync)(pkgJsonPath)) return null;
49839
+ const pkgJsonPath = (0, import_node_path14.join)(globalRoot, ...pkg.split("/"), "package.json");
49840
+ if (!(0, import_node_fs14.existsSync)(pkgJsonPath)) return null;
49590
49841
  try {
49591
- const parsed = JSON.parse((0, import_node_fs13.readFileSync)(pkgJsonPath, "utf8"));
49842
+ const parsed = JSON.parse((0, import_node_fs14.readFileSync)(pkgJsonPath, "utf8"));
49592
49843
  return typeof parsed.version === "string" ? parsed.version : null;
49593
49844
  } catch {
49594
49845
  return null;
@@ -49704,7 +49955,7 @@ function updateCommand() {
49704
49955
  }
49705
49956
 
49706
49957
  // src/index.ts
49707
- var program2 = new Command().name("slay").description("SlayZone CLI").version("0.37.2").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) => {
49958
+ var program2 = new Command().name("slay").description("SlayZone CLI").version("0.38.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) => {
49708
49959
  const root = thisCommand.parent ?? thisCommand;
49709
49960
  const opts = root.opts();
49710
49961
  if (opts.dev) process.env.SLAYZONE_DEV = "1";
@@ -49799,7 +50050,7 @@ archiver/lib/plugins/json.js:
49799
50050
  *)
49800
50051
 
49801
50052
  js-yaml/dist/js-yaml.mjs:
49802
- (*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)
50053
+ (*! js-yaml 5.5.0 https://github.com/nodeca/js-yaml @license MIT *)
49803
50054
 
49804
50055
  @dagrejs/dagre/dist/dagre.esm.js:
49805
50056
  (*! For license information please see dagre.esm.js.LEGAL.txt *)