@slayzone/hub 0.36.0-beta.12 → 0.36.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.cjs CHANGED
@@ -56,6 +56,10 @@ function getSlayzoneReleaseChannel() {
56
56
  const raw = process.env.SLAYZONE_RELEASE_CHANNEL?.trim();
57
57
  return raw ? raw : "unknown";
58
58
  }
59
+ function getSupervisedRoot(role2, channel = getSlayzoneReleaseChannel()) {
60
+ const bucket = channel === "dev" ? "dev" : "stable";
61
+ return import_path.default.join(getSlayzoneHomeDir(), bucket, role2);
62
+ }
59
63
  function getClaudeSettingsPath() {
60
64
  if (process.env.SLAYZONE_CLAUDE_SETTINGS_PATH) return process.env.SLAYZONE_CLAUDE_SETTINGS_PATH;
61
65
  const home = process.env.HOME ?? process.env.USERPROFILE ?? import_os.default.homedir();
@@ -18308,7 +18312,7 @@ var init_hub_addr = __esm({
18308
18312
 
18309
18313
  // ../../shared/platform/src/paths.ts
18310
18314
  function getStorageDir() {
18311
- return (0, import_node_path2.join)(getSlayzoneHomeDir(), "storage");
18315
+ return getSlayzoneHomeDir();
18312
18316
  }
18313
18317
  function ensureDataRoot() {
18314
18318
  const dir = getStorageDir();
@@ -18348,12 +18352,11 @@ function getServerHost() {
18348
18352
  }
18349
18353
  return host;
18350
18354
  }
18351
- var import_node_fs2, import_node_path2, warnedHost, SIDECAR_FIXED_PORT, HUB_PORT_BLOCK, HUB_DYNAMIC_PORT_RANGE;
18355
+ var import_node_fs2, warnedHost, SIDECAR_FIXED_PORT, HUB_PORT_BLOCK, HUB_DYNAMIC_PORT_RANGE;
18352
18356
  var init_paths = __esm({
18353
18357
  "../../shared/platform/src/paths.ts"() {
18354
18358
  "use strict";
18355
18359
  import_node_fs2 = require("node:fs");
18356
- import_node_path2 = require("node:path");
18357
18360
  init_dirs();
18358
18361
  init_hub_addr();
18359
18362
  warnedHost = null;
@@ -18647,6 +18650,82 @@ async function writeFileIfChanged(filePath, content, mode) {
18647
18650
  await import_promises2.default.rename(tmp, target);
18648
18651
  return true;
18649
18652
  }
18653
+ async function updateFileAtomically(filePath, merge3, opts = {}) {
18654
+ const { mode, retries = 5 } = opts;
18655
+ const target = await resolveTarget(filePath);
18656
+ await import_promises2.default.mkdir(import_path2.default.dirname(target), { recursive: true });
18657
+ const release = await acquireLock(`${target}.lock`);
18658
+ try {
18659
+ for (let attempt = 0; ; attempt++) {
18660
+ const baseline = await safeReadFile(target);
18661
+ const merged = await merge3(baseline);
18662
+ if (merged == null) return false;
18663
+ const buf = Buffer.isBuffer(merged) ? merged : Buffer.from(merged, "utf8");
18664
+ if (baseline && baseline.equals(buf)) return false;
18665
+ const tmp = `${target}.tmp.${import_crypto.default.randomBytes(6).toString("hex")}`;
18666
+ await import_promises2.default.writeFile(tmp, buf);
18667
+ if (mode != null && process.platform !== "win32") {
18668
+ await import_promises2.default.chmod(tmp, mode);
18669
+ }
18670
+ if (sameBytes(baseline, await safeReadFile(target))) {
18671
+ await import_promises2.default.rename(tmp, target);
18672
+ return true;
18673
+ }
18674
+ await import_promises2.default.rm(tmp, { force: true });
18675
+ if (attempt >= retries) {
18676
+ throw new Error(
18677
+ `[fs-utils] updateFileAtomically: ${target} kept changing underneath ${retries + 1} merge attempts \u2014 giving up rather than writing a stale merge`
18678
+ );
18679
+ }
18680
+ await sleep2(2 ** attempt + Math.floor(Math.random() * 5));
18681
+ }
18682
+ } finally {
18683
+ await release();
18684
+ }
18685
+ }
18686
+ async function acquireLock(lockPath) {
18687
+ const deadline = Date.now() + LOCK_TIMEOUT_MS;
18688
+ for (; ; ) {
18689
+ try {
18690
+ const handle = await import_promises2.default.open(lockPath, "wx");
18691
+ await handle.writeFile(`${process.pid} ${(/* @__PURE__ */ new Date()).toISOString()}
18692
+ `);
18693
+ await handle.close();
18694
+ return async () => {
18695
+ await import_promises2.default.rm(lockPath, { force: true });
18696
+ };
18697
+ } catch (err) {
18698
+ if (!isCode(err, "EEXIST")) throw err;
18699
+ const age = await lockAgeMs(lockPath);
18700
+ if (age === null) continue;
18701
+ if (age > LOCK_STALE_MS) {
18702
+ await import_promises2.default.rm(lockPath, { force: true });
18703
+ continue;
18704
+ }
18705
+ if (Date.now() > deadline) {
18706
+ throw new Error(
18707
+ `[fs-utils] timed out after ${LOCK_TIMEOUT_MS}ms waiting for ${lockPath}`
18708
+ );
18709
+ }
18710
+ await sleep2(5 + Math.floor(Math.random() * 10));
18711
+ }
18712
+ }
18713
+ }
18714
+ async function lockAgeMs(lockPath) {
18715
+ try {
18716
+ return Date.now() - (await import_promises2.default.stat(lockPath)).mtimeMs;
18717
+ } catch (err) {
18718
+ if (isCode(err, "ENOENT")) return null;
18719
+ throw err;
18720
+ }
18721
+ }
18722
+ function sameBytes(a, b) {
18723
+ if (a === null || b === null) return a === b;
18724
+ return a.equals(b);
18725
+ }
18726
+ function sleep2(ms) {
18727
+ return new Promise((resolve5) => setTimeout(resolve5, ms));
18728
+ }
18650
18729
  async function safeReadFile(p2) {
18651
18730
  try {
18652
18731
  return await import_promises2.default.readFile(p2);
@@ -18665,15 +18744,20 @@ async function resolveTarget(p2) {
18665
18744
  return p2;
18666
18745
  }
18667
18746
  function isENOENT(err) {
18668
- return typeof err === "object" && err != null && err.code === "ENOENT";
18747
+ return isCode(err, "ENOENT");
18669
18748
  }
18670
- var import_promises2, import_path2, import_crypto;
18749
+ function isCode(err, code) {
18750
+ return typeof err === "object" && err != null && err.code === code;
18751
+ }
18752
+ var import_promises2, import_path2, import_crypto, LOCK_STALE_MS, LOCK_TIMEOUT_MS;
18671
18753
  var init_fs_utils = __esm({
18672
18754
  "../../shared/platform/src/fs-utils.ts"() {
18673
18755
  "use strict";
18674
18756
  import_promises2 = __toESM(require("fs/promises"), 1);
18675
18757
  import_path2 = __toESM(require("path"), 1);
18676
18758
  import_crypto = __toESM(require("crypto"), 1);
18759
+ LOCK_STALE_MS = 1e4;
18760
+ LOCK_TIMEOUT_MS = 5e3;
18677
18761
  }
18678
18762
  });
18679
18763
 
@@ -19154,6 +19238,7 @@ __export(src_exports, {
19154
19238
  getSlayzoneReleaseChannel: () => getSlayzoneReleaseChannel,
19155
19239
  getStateDir: () => getStateDir,
19156
19240
  getStorageDir: () => getStorageDir,
19241
+ getSupervisedRoot: () => getSupervisedRoot,
19157
19242
  getTrpcPort: () => getTrpcPort,
19158
19243
  hubUrlFromAddr: () => hubUrlFromAddr,
19159
19244
  installCli: () => installCli,
@@ -19174,6 +19259,7 @@ __export(src_exports, {
19174
19259
  stripDeviceStatusQueries: () => stripDeviceStatusQueries,
19175
19260
  stripDeviceStatusResponses: () => stripDeviceStatusResponses,
19176
19261
  toSlzFileUrl: () => toSlzFileUrl,
19262
+ updateFileAtomically: () => updateFileAtomically,
19177
19263
  withResultDedup: () => withResultDedup,
19178
19264
  writeFileIfChanged: () => writeFileIfChanged
19179
19265
  });
@@ -23122,7 +23208,7 @@ var require_BufferList = __commonJS({
23122
23208
  this.head = this.tail = null;
23123
23209
  this.length = 0;
23124
23210
  };
23125
- BufferList.prototype.join = function join30(s2) {
23211
+ BufferList.prototype.join = function join29(s2) {
23126
23212
  if (this.length === 0) return "";
23127
23213
  var p2 = this.head;
23128
23214
  var ret = "" + p2.data;
@@ -53088,7 +53174,7 @@ var require_common = __commonJS({
53088
53174
  function setup(env2) {
53089
53175
  createDebug.debug = createDebug;
53090
53176
  createDebug.default = createDebug;
53091
- createDebug.coerce = coerce2;
53177
+ createDebug.coerce = coerce;
53092
53178
  createDebug.disable = disable;
53093
53179
  createDebug.enable = enable;
53094
53180
  createDebug.enabled = enabled;
@@ -53243,7 +53329,7 @@ var require_common = __commonJS({
53243
53329
  }
53244
53330
  return false;
53245
53331
  }
53246
- function coerce2(val) {
53332
+ function coerce(val) {
53247
53333
  if (val instanceof Error) {
53248
53334
  return val.stack || val.message;
53249
53335
  }
@@ -71669,7 +71755,7 @@ var require_view = __commonJS({
71669
71755
  var dirname11 = path27.dirname;
71670
71756
  var basename6 = path27.basename;
71671
71757
  var extname2 = path27.extname;
71672
- var join30 = path27.join;
71758
+ var join29 = path27.join;
71673
71759
  var resolve5 = path27.resolve;
71674
71760
  module2.exports = View;
71675
71761
  function View(name, options) {
@@ -71731,12 +71817,12 @@ var require_view = __commonJS({
71731
71817
  };
71732
71818
  View.prototype.resolve = function resolve6(dir, file2) {
71733
71819
  var ext = this.ext;
71734
- var path28 = join30(dir, file2);
71820
+ var path28 = join29(dir, file2);
71735
71821
  var stat7 = tryStat(path28);
71736
71822
  if (stat7 && stat7.isFile()) {
71737
71823
  return path28;
71738
71824
  }
71739
- path28 = join30(dir, basename6(file2, ext), "index" + ext);
71825
+ path28 = join29(dir, basename6(file2, ext), "index" + ext);
71740
71826
  stat7 = tryStat(path28);
71741
71827
  if (stat7 && stat7.isFile()) {
71742
71828
  return path28;
@@ -75381,7 +75467,7 @@ var require_send = __commonJS({
75381
75467
  var Stream = require("stream");
75382
75468
  var util2 = require("util");
75383
75469
  var extname2 = path27.extname;
75384
- var join30 = path27.join;
75470
+ var join29 = path27.join;
75385
75471
  var normalize = path27.normalize;
75386
75472
  var resolve5 = path27.resolve;
75387
75473
  var sep3 = path27.sep;
@@ -75553,7 +75639,7 @@ var require_send = __commonJS({
75553
75639
  return res;
75554
75640
  }
75555
75641
  parts = path28.split(sep3);
75556
- path28 = normalize(join30(root, path28));
75642
+ path28 = normalize(join29(root, path28));
75557
75643
  } else {
75558
75644
  if (UP_PATH_REGEXP.test(path28)) {
75559
75645
  debug('malicious path "%s"', path28);
@@ -75686,7 +75772,7 @@ var require_send = __commonJS({
75686
75772
  if (err) return self2.onStatError(err);
75687
75773
  return self2.error(404);
75688
75774
  }
75689
- var p2 = join30(path28, self2._index[i]);
75775
+ var p2 = join29(path28, self2._index[i]);
75690
75776
  debug('stat "%s"', p2);
75691
75777
  fs17.stat(p2, function(err2, stat7) {
75692
75778
  if (err2) return next(err2);
@@ -97938,7 +98024,7 @@ var init_factory = __esm({
97938
98024
  }
97939
98025
  return transformedData;
97940
98026
  };
97941
- const transformOutput = async (data, unsafe_model, select = [], join30) => {
98027
+ const transformOutput = async (data, unsafe_model, select = [], join29) => {
97942
98028
  const transformSingleOutput = async (data2, unsafe_model2, select2 = []) => {
97943
98029
  if (!data2) return null;
97944
98030
  const newMappedKeys = config3.mapKeysTransformOutput ?? {};
@@ -97974,10 +98060,10 @@ var init_factory = __esm({
97974
98060
  }
97975
98061
  return transformedData2;
97976
98062
  };
97977
- if (!join30 || Object.keys(join30).length === 0) return await transformSingleOutput(data, unsafe_model, select);
98063
+ if (!join29 || Object.keys(join29).length === 0) return await transformSingleOutput(data, unsafe_model, select);
97978
98064
  unsafe_model = getDefaultModelName(unsafe_model);
97979
98065
  const transformedData = await transformSingleOutput(data, unsafe_model, select);
97980
- const requiredModels = Object.entries(join30).map(([model, joinConfig]) => ({
98066
+ const requiredModels = Object.entries(join29).map(([model, joinConfig]) => ({
97981
98067
  modelName: getModelName(model),
97982
98068
  defaultModelName: getDefaultModelName(model),
97983
98069
  joinConfig
@@ -98074,8 +98160,8 @@ var init_factory = __esm({
98074
98160
  if (!unsanitizedJoin) return void 0;
98075
98161
  if (Object.keys(unsanitizedJoin).length === 0) return void 0;
98076
98162
  const transformedJoin = {};
98077
- for (const [model, join30] of Object.entries(unsanitizedJoin)) {
98078
- if (!join30) continue;
98163
+ for (const [model, join29] of Object.entries(unsanitizedJoin)) {
98164
+ if (!join29) continue;
98079
98165
  const defaultModelName = getDefaultModelName(model);
98080
98166
  const defaultBaseModelName = getDefaultModelName(baseModel);
98081
98167
  let foreignKeys = Object.entries(schema4[defaultModelName].fields).filter(([field, fieldAttributes]) => fieldAttributes.references && getDefaultModelName(fieldAttributes.references.model) === defaultBaseModelName);
@@ -98116,7 +98202,7 @@ var init_factory = __esm({
98116
98202
  const isUnique = to === "id" ? true : foreignKeyAttributes.unique ?? false;
98117
98203
  let limit = options.advanced?.database?.defaultFindManyLimit ?? 100;
98118
98204
  if (isUnique) limit = 1;
98119
- else if (typeof join30 === "object" && typeof join30.limit === "number") limit = join30.limit;
98205
+ else if (typeof join29 === "object" && typeof join29.limit === "number") limit = join29.limit;
98120
98206
  transformedJoin[getModelName(model)] = {
98121
98207
  on: {
98122
98208
  from,
@@ -98332,21 +98418,21 @@ var init_factory = __esm({
98332
98418
  action: "findOne"
98333
98419
  });
98334
98420
  unsafeModel = getDefaultModelName(unsafeModel);
98335
- let join30;
98421
+ let join29;
98336
98422
  let passJoinToAdapter = true;
98337
98423
  if (!config3.disableTransformJoin) {
98338
98424
  const result = transformJoinClause(unsafeModel, unsafeJoin, select);
98339
98425
  if (result) {
98340
- join30 = result.join;
98426
+ join29 = result.join;
98341
98427
  select = result.select;
98342
98428
  }
98343
- if (!options.experimental?.joins && join30 && Object.keys(join30).length > 0) passJoinToAdapter = false;
98344
- } else join30 = unsafeJoin;
98429
+ if (!options.experimental?.joins && join29 && Object.keys(join29).length > 0) passJoinToAdapter = false;
98430
+ } else join29 = unsafeJoin;
98345
98431
  debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 3)}`, `${formatMethod("findOne")}:`, {
98346
98432
  model,
98347
98433
  where,
98348
98434
  select,
98349
- join: join30
98435
+ join: join29
98350
98436
  });
98351
98437
  const res = await withSpan(`db findOne ${model}`, {
98352
98438
  [ATTR_DB_OPERATION_NAME]: "findOne",
@@ -98355,14 +98441,14 @@ var init_factory = __esm({
98355
98441
  model,
98356
98442
  where,
98357
98443
  select,
98358
- join: passJoinToAdapter ? join30 : void 0
98444
+ join: passJoinToAdapter ? join29 : void 0
98359
98445
  }));
98360
98446
  debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 3)}`, `${formatMethod("findOne")} ${formatAction("DB Result")}:`, {
98361
98447
  model,
98362
98448
  data: res
98363
98449
  });
98364
98450
  let transformed = res;
98365
- if (!config3.disableTransformOutput) transformed = await transformOutput(res, unsafeModel, select, join30);
98451
+ if (!config3.disableTransformOutput) transformed = await transformOutput(res, unsafeModel, select, join29);
98366
98452
  debugLog({ method: "findOne" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 3)}`, `${formatMethod("findOne")} ${formatAction("Parsed Result")}:`, {
98367
98453
  model,
98368
98454
  data: transformed
@@ -98380,23 +98466,23 @@ var init_factory = __esm({
98380
98466
  action: "findMany"
98381
98467
  });
98382
98468
  unsafeModel = getDefaultModelName(unsafeModel);
98383
- let join30;
98469
+ let join29;
98384
98470
  let passJoinToAdapter = true;
98385
98471
  if (!config3.disableTransformJoin) {
98386
98472
  const result = transformJoinClause(unsafeModel, unsafeJoin, select);
98387
98473
  if (result) {
98388
- join30 = result.join;
98474
+ join29 = result.join;
98389
98475
  select = result.select;
98390
98476
  }
98391
- if (!options.experimental?.joins && join30 && Object.keys(join30).length > 0) passJoinToAdapter = false;
98392
- } else join30 = unsafeJoin;
98477
+ if (!options.experimental?.joins && join29 && Object.keys(join29).length > 0) passJoinToAdapter = false;
98478
+ } else join29 = unsafeJoin;
98393
98479
  debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(1, 3)}`, `${formatMethod("findMany")}:`, {
98394
98480
  model,
98395
98481
  where,
98396
98482
  limit,
98397
98483
  sortBy,
98398
98484
  offset,
98399
- join: join30
98485
+ join: join29
98400
98486
  });
98401
98487
  const res = await withSpan(`db findMany ${model}`, {
98402
98488
  [ATTR_DB_OPERATION_NAME]: "findMany",
@@ -98408,7 +98494,7 @@ var init_factory = __esm({
98408
98494
  select,
98409
98495
  sortBy,
98410
98496
  offset,
98411
- join: passJoinToAdapter ? join30 : void 0
98497
+ join: passJoinToAdapter ? join29 : void 0
98412
98498
  }));
98413
98499
  debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(2, 3)}`, `${formatMethod("findMany")} ${formatAction("DB Result")}:`, {
98414
98500
  model,
@@ -98416,7 +98502,7 @@ var init_factory = __esm({
98416
98502
  });
98417
98503
  let transformed = res;
98418
98504
  if (!config3.disableTransformOutput) transformed = await Promise.all(res.map(async (r) => {
98419
- return await transformOutput(r, unsafeModel, void 0, join30);
98505
+ return await transformOutput(r, unsafeModel, void 0, join29);
98420
98506
  }));
98421
98507
  debugLog({ method: "findMany" }, `${formatTransactionId(thisTransactionId)} ${formatStep(3, 3)}`, `${formatMethod("findMany")} ${formatAction("Parsed Result")}:`, {
98422
98508
  model,
@@ -98821,7 +98907,7 @@ var init_dist5 = __esm({
98821
98907
  return sortBy.direction === "asc" ? comparison : -comparison;
98822
98908
  });
98823
98909
  };
98824
- function convertWhereClause(where, model, join30, select) {
98910
+ function convertWhereClause(where, model, join29, select) {
98825
98911
  const baseRecords = (() => {
98826
98912
  const table = activeDb[model];
98827
98913
  if (!table) {
@@ -98881,14 +98967,14 @@ var init_dist5 = __esm({
98881
98967
  })))));
98882
98968
  return records;
98883
98969
  })();
98884
- if (!join30) return baseRecords;
98970
+ if (!join29) return baseRecords;
98885
98971
  const grouped = /* @__PURE__ */ new Map();
98886
98972
  const seenIds = /* @__PURE__ */ new Map();
98887
98973
  for (const baseRecord of baseRecords) {
98888
98974
  const baseId = String(baseRecord.id);
98889
98975
  if (!grouped.has(baseId)) {
98890
98976
  const nested = { ...baseRecord };
98891
- for (const [joinModel, joinAttr] of Object.entries(join30)) {
98977
+ for (const [joinModel, joinAttr] of Object.entries(join29)) {
98892
98978
  const joinModelName = getModelName(joinModel);
98893
98979
  if (joinAttr.relation === "one-to-one") nested[joinModelName] = null;
98894
98980
  else {
@@ -98899,7 +98985,7 @@ var init_dist5 = __esm({
98899
98985
  grouped.set(baseId, nested);
98900
98986
  }
98901
98987
  const nestedEntry = grouped.get(baseId);
98902
- for (const [joinModel, joinAttr] of Object.entries(join30)) {
98988
+ for (const [joinModel, joinAttr] of Object.entries(join29)) {
98903
98989
  const joinModelName = getModelName(joinModel);
98904
98990
  const joinTable = activeDb[joinModelName];
98905
98991
  if (!joinTable) {
@@ -98932,18 +99018,18 @@ var init_dist5 = __esm({
98932
99018
  activeDb[model].push(data);
98933
99019
  return data;
98934
99020
  },
98935
- findOne: async ({ model, where, select, join: join30 }) => {
98936
- const res = convertWhereClause(where, model, join30, select);
98937
- if (join30) {
99021
+ findOne: async ({ model, where, select, join: join29 }) => {
99022
+ const res = convertWhereClause(where, model, join29, select);
99023
+ if (join29) {
98938
99024
  const resArray = res;
98939
99025
  if (!resArray.length) return null;
98940
99026
  return resArray[0];
98941
99027
  }
98942
99028
  return res[0] || null;
98943
99029
  },
98944
- findMany: async ({ model, where, sortBy, limit, select, offset, join: join30 }) => {
98945
- const res = convertWhereClause(where || [], model, join30, select);
98946
- if (join30) {
99030
+ findMany: async ({ model, where, sortBy, limit, select, offset, join: join29 }) => {
99031
+ const res = convertWhereClause(where || [], model, join29, select);
99032
+ if (join29) {
98947
99033
  const resArray = res;
98948
99034
  if (!resArray.length) return [];
98949
99035
  applySortToRecords(resArray, sortBy, model);
@@ -100913,10 +100999,10 @@ var init_query_node = __esm({
100913
100999
  where: node.where ? WhereNode.cloneWithOperation(node.where, "And", operation) : WhereNode.create(operation)
100914
101000
  });
100915
101001
  },
100916
- cloneWithJoin(node, join30) {
101002
+ cloneWithJoin(node, join29) {
100917
101003
  return freeze({
100918
101004
  ...node,
100919
- joins: node.joins ? freeze([...node.joins, join30]) : freeze([join30])
101005
+ joins: node.joins ? freeze([...node.joins, join29]) : freeze([join29])
100920
101006
  });
100921
101007
  },
100922
101008
  cloneWithReturning(node, selections) {
@@ -105427,8 +105513,8 @@ var init_with_schema_transformer = __esm({
105427
105513
  this.#collectSchemableIdsFromTableExpr(node.table, schemableIds);
105428
105514
  }
105429
105515
  if ("joins" in node && node.joins) {
105430
- for (const join30 of node.joins) {
105431
- this.#collectSchemableIdsFromTableExpr(join30.table, schemableIds);
105516
+ for (const join29 of node.joins) {
105517
+ this.#collectSchemableIdsFromTableExpr(join29.table, schemableIds);
105432
105518
  }
105433
105519
  }
105434
105520
  if ("using" in node && node.using) {
@@ -117609,7 +117695,7 @@ var init_mssql_introspector = __esm({
117609
117695
  return await this.#db.selectFrom("sys.schemas").select("name").execute();
117610
117696
  }
117611
117697
  async getTables(options = { withInternalKyselyTables: false }) {
117612
- const rawColumns = await this.#db.selectFrom("sys.tables as tables").leftJoin("sys.schemas as table_schemas", "table_schemas.schema_id", "tables.schema_id").innerJoin("sys.columns as columns", "columns.object_id", "tables.object_id").innerJoin("sys.types as types", "types.user_type_id", "columns.user_type_id").leftJoin("sys.schemas as type_schemas", "type_schemas.schema_id", "types.schema_id").leftJoin("sys.extended_properties as comments", (join30) => join30.onRef("comments.major_id", "=", "tables.object_id").onRef("comments.minor_id", "=", "columns.column_id").on("comments.name", "=", "MS_Description")).$if(!options.withInternalKyselyTables, (qb) => qb.where("tables.name", "!=", DEFAULT_MIGRATION_TABLE).where("tables.name", "!=", DEFAULT_MIGRATION_LOCK_TABLE)).select([
117698
+ const rawColumns = await this.#db.selectFrom("sys.tables as tables").leftJoin("sys.schemas as table_schemas", "table_schemas.schema_id", "tables.schema_id").innerJoin("sys.columns as columns", "columns.object_id", "tables.object_id").innerJoin("sys.types as types", "types.user_type_id", "columns.user_type_id").leftJoin("sys.schemas as type_schemas", "type_schemas.schema_id", "types.schema_id").leftJoin("sys.extended_properties as comments", (join29) => join29.onRef("comments.major_id", "=", "tables.object_id").onRef("comments.minor_id", "=", "columns.column_id").on("comments.name", "=", "MS_Description")).$if(!options.withInternalKyselyTables, (qb) => qb.where("tables.name", "!=", DEFAULT_MIGRATION_TABLE).where("tables.name", "!=", DEFAULT_MIGRATION_LOCK_TABLE)).select([
117613
117699
  "tables.name as table_name",
117614
117700
  (eb) => eb.ref("tables.type").$castTo().as("table_type"),
117615
117701
  "table_schemas.name as table_schema_name",
@@ -117624,7 +117710,7 @@ var init_mssql_introspector = __esm({
117624
117710
  "types.name as type_name",
117625
117711
  "type_schemas.name as type_schema_name",
117626
117712
  "comments.value as column_comment"
117627
- ]).unionAll(this.#db.selectFrom("sys.views as views").leftJoin("sys.schemas as view_schemas", "view_schemas.schema_id", "views.schema_id").innerJoin("sys.columns as columns", "columns.object_id", "views.object_id").innerJoin("sys.types as types", "types.user_type_id", "columns.user_type_id").leftJoin("sys.schemas as type_schemas", "type_schemas.schema_id", "types.schema_id").leftJoin("sys.extended_properties as comments", (join30) => join30.onRef("comments.major_id", "=", "views.object_id").onRef("comments.minor_id", "=", "columns.column_id").on("comments.name", "=", "MS_Description")).select([
117713
+ ]).unionAll(this.#db.selectFrom("sys.views as views").leftJoin("sys.schemas as view_schemas", "view_schemas.schema_id", "views.schema_id").innerJoin("sys.columns as columns", "columns.object_id", "views.object_id").innerJoin("sys.types as types", "types.user_type_id", "columns.user_type_id").leftJoin("sys.schemas as type_schemas", "type_schemas.schema_id", "types.schema_id").leftJoin("sys.extended_properties as comments", (join29) => join29.onRef("comments.major_id", "=", "views.object_id").onRef("comments.minor_id", "=", "columns.column_id").on("comments.name", "=", "MS_Description")).select([
117628
117714
  "views.name as table_name",
117629
117715
  "views.type as table_type",
117630
117716
  "view_schemas.name as table_schema_name",
@@ -118714,10 +118800,10 @@ var init_dist7 = __esm({
118714
118800
  mysqlNoIdWarned = true;
118715
118801
  logger.warn(`[Kysely Adapter] MySQL does not support INSERT...RETURNING. With generateId set to false, the adapter uses best-effort fallback strategies (unique columns, full-field match) to retrieve inserted rows. For reliable behavior, use Better Auth's default ID generation, a custom generateId function, or generateId: "serial" for auto-increment.`);
118716
118802
  }
118717
- const selectAllJoins = (join30) => {
118803
+ const selectAllJoins = (join29) => {
118718
118804
  const allSelects = [];
118719
118805
  const allSelectsStr = [];
118720
- if (join30) for (const [joinModel, _2] of Object.entries(join30)) {
118806
+ if (join29) for (const [joinModel, _2] of Object.entries(join29)) {
118721
118807
  const fields = schema4[getDefaultModelName(joinModel)]?.fields;
118722
118808
  const [_joinModelSchema, joinModelName] = joinModel.includes(".") ? joinModel.split(".") : [void 0, joinModel];
118723
118809
  if (!fields) continue;
@@ -118942,7 +119028,7 @@ var init_dist7 = __esm({
118942
119028
  async create({ data, model }) {
118943
119029
  return await withReturning(data, db2.insertInto(model).values(data), model, []);
118944
119030
  },
118945
- async findOne({ model, where, select, join: join30 }) {
119031
+ async findOne({ model, where, select, join: join29 }) {
118946
119032
  const { and, or } = convertWhereClause(model, where);
118947
119033
  let query = db2.selectFrom((eb) => {
118948
119034
  let b = eb.selectFrom(model);
@@ -118955,19 +119041,19 @@ var init_dist7 = __esm({
118955
119041
  else b = b.selectAll();
118956
119042
  return b.as("primary");
118957
119043
  }).selectAll("primary");
118958
- if (join30) for (const [joinModel, joinAttr] of Object.entries(join30)) {
119044
+ if (join29) for (const [joinModel, joinAttr] of Object.entries(join29)) {
118959
119045
  const [_joinModelSchema, joinModelName] = joinModel.includes(".") ? joinModel.split(".") : [void 0, joinModel];
118960
- query = query.leftJoin(`${joinModel} as join_${joinModelName}`, (join31) => join31.onRef(`join_${joinModelName}.${joinAttr.on.to}`, "=", `primary.${joinAttr.on.from}`));
119046
+ query = query.leftJoin(`${joinModel} as join_${joinModelName}`, (join30) => join30.onRef(`join_${joinModelName}.${joinAttr.on.to}`, "=", `primary.${joinAttr.on.from}`));
118961
119047
  }
118962
- const { allSelectsStr, allSelects } = selectAllJoins(join30);
119048
+ const { allSelectsStr, allSelects } = selectAllJoins(join29);
118963
119049
  query = query.select(allSelects);
118964
119050
  const res = await query.execute();
118965
119051
  if (!res || !Array.isArray(res) || res.length === 0) return null;
118966
119052
  const row = res[0];
118967
- if (join30) return processJoinedResults(res, join30, allSelectsStr)[0];
119053
+ if (join29) return processJoinedResults(res, join29, allSelectsStr)[0];
118968
119054
  return row;
118969
119055
  },
118970
- async findMany({ model, where, limit, select, offset, sortBy, join: join30 }) {
119056
+ async findMany({ model, where, limit, select, offset, sortBy, join: join29 }) {
118971
119057
  const { and, or } = convertWhereClause(model, where);
118972
119058
  let query = db2.selectFrom((eb) => {
118973
119059
  let b = eb.selectFrom(model);
@@ -118996,11 +119082,11 @@ var init_dist7 = __esm({
118996
119082
  else b = b.selectAll();
118997
119083
  return b.as("primary");
118998
119084
  }).selectAll("primary");
118999
- if (join30) for (const [joinModel, joinAttr] of Object.entries(join30)) {
119085
+ if (join29) for (const [joinModel, joinAttr] of Object.entries(join29)) {
119000
119086
  const [_joinModelSchema, joinModelName] = joinModel.includes(".") ? joinModel.split(".") : [void 0, joinModel];
119001
- query = query.leftJoin(`${joinModel} as join_${joinModelName}`, (join31) => join31.onRef(`join_${joinModelName}.${joinAttr.on.to}`, "=", `primary.${joinAttr.on.from}`));
119087
+ query = query.leftJoin(`${joinModel} as join_${joinModelName}`, (join30) => join30.onRef(`join_${joinModelName}.${joinAttr.on.to}`, "=", `primary.${joinAttr.on.from}`));
119002
119088
  }
119003
- const { allSelectsStr, allSelects } = selectAllJoins(join30);
119089
+ const { allSelectsStr, allSelects } = selectAllJoins(join29);
119004
119090
  query = query.select(allSelects);
119005
119091
  if (sortBy?.field) query = query.orderBy(`${getFieldName({
119006
119092
  model,
@@ -119008,7 +119094,7 @@ var init_dist7 = __esm({
119008
119094
  })}`, sortBy.direction);
119009
119095
  const res = await query.execute();
119010
119096
  if (!res) return [];
119011
- if (join30) return processJoinedResults(res, join30, allSelectsStr);
119097
+ if (join29) return processJoinedResults(res, join29, allSelectsStr);
119012
119098
  return res;
119013
119099
  },
119014
119100
  async update({ model, where, update: values }) {
@@ -141900,107 +141986,128 @@ function resolveHubName() {
141900
141986
  const fromEnv = process.env.SLAYZONE_HUB_NAME?.trim();
141901
141987
  if (fromEnv) return fromEnv;
141902
141988
  if (process.env.SLAYZONE_SUPERVISED === "1") return SUPERVISED_HUB_NAME;
141903
- const fromFile = loadSlayzoneConfig().hubName?.trim();
141989
+ const fromFile = loadHubConfigFile().hubName?.trim();
141904
141990
  if (fromFile) return fromFile;
141905
141991
  return (0, import_node_path.basename)(getSlayzoneHomeDir()) || "hub";
141906
141992
  }
141907
- function getSlayzoneConfigPath() {
141908
- return (0, import_node_path.join)(getSlayzoneHomeDir(), "config.json");
141993
+ function getHubConfigFilePath() {
141994
+ return (0, import_node_path.join)(getSlayzoneHomeDir(), "hub.config.json");
141995
+ }
141996
+ function getHubStateFilePath() {
141997
+ return (0, import_node_path.join)(getSlayzoneHomeDir(), "hub.state.json");
141909
141998
  }
141910
- function coerce(raw) {
141999
+ function legacyConfigFilePathFor(newFilePath) {
142000
+ return (0, import_node_path.join)((0, import_node_path.dirname)(newFilePath), "config.json");
142001
+ }
142002
+ function coerceHubConfig(raw) {
141911
142003
  const cfg = {};
141912
- if (typeof raw.runnerTransportSecret === "string" && raw.runnerTransportSecret.length > 0)
141913
- cfg.runnerTransportSecret = raw.runnerTransportSecret;
141914
142004
  if (typeof raw.address === "string" && raw.address.length > 0) cfg.address = raw.address;
141915
142005
  if (typeof raw.publicAddress === "string" && raw.publicAddress.length > 0)
141916
142006
  cfg.publicAddress = raw.publicAddress;
141917
- if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0)
141918
- cfg.hubName = raw.hubName.trim();
141919
142007
  if (raw.mode === "local" || raw.mode === "remote") cfg.mode = raw.mode;
142008
+ if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0) cfg.hubName = raw.hubName.trim();
141920
142009
  if (typeof raw.port === "number" && Number.isInteger(raw.port)) cfg.port = raw.port;
141921
142010
  if (typeof raw.publicUrl === "string" && raw.publicUrl.length > 0) cfg.publicUrl = raw.publicUrl;
141922
- if (typeof raw.joinToken === "string" && raw.joinToken.length > 0) cfg.joinToken = raw.joinToken;
141923
- if (typeof raw.runnerName === "string" && raw.runnerName.length > 0)
141924
- cfg.runnerName = raw.runnerName;
141925
- if (typeof raw.hubUrl === "string" && raw.hubUrl.length > 0) cfg.hubUrl = raw.hubUrl;
141926
- if (Array.isArray(raw.allowedRoots)) {
141927
- const roots = raw.allowedRoots.filter(
141928
- (r) => typeof r === "string" && r.length > 0
141929
- );
141930
- if (roots.length > 0) cfg.allowedRoots = roots;
141931
- }
141932
- if (typeof raw.pinnedCertSha256 === "string" && raw.pinnedCertSha256.length > 0)
141933
- cfg.pinnedCertSha256 = raw.pinnedCertSha256;
141934
142011
  return cfg;
141935
142012
  }
141936
- function loadSlayzoneConfig(configPath = getSlayzoneConfigPath()) {
142013
+ function coerceHubState(raw) {
142014
+ const state = {};
142015
+ if (typeof raw.runnerTransportSecret === "string" && raw.runnerTransportSecret.length > 0)
142016
+ state.runnerTransportSecret = raw.runnerTransportSecret;
142017
+ return state;
142018
+ }
142019
+ function readJsonObject(path27) {
141937
142020
  let raw;
141938
142021
  try {
141939
- raw = (0, import_node_fs.readFileSync)(configPath, "utf8");
142022
+ raw = (0, import_node_fs.readFileSync)(path27, "utf8");
141940
142023
  } catch (err) {
141941
- if (err.code === "ENOENT") return {};
142024
+ if (err.code === "ENOENT") return null;
141942
142025
  process.stderr.write(
141943
- `[slayzone-config] cannot read ${configPath}: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
142026
+ `[slayzone-config] cannot read ${path27}: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
141944
142027
  `
141945
142028
  );
141946
- return {};
142029
+ return null;
141947
142030
  }
141948
142031
  let parsed;
141949
142032
  try {
141950
142033
  parsed = JSON.parse(raw);
141951
142034
  } catch (err) {
141952
142035
  process.stderr.write(
141953
- `[slayzone-config] ${configPath} is not valid JSON: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
142036
+ `[slayzone-config] ${path27} is not valid JSON: ${err instanceof Error ? err.message : String(err)} \u2014 using empty config
141954
142037
  `
141955
142038
  );
141956
- return {};
142039
+ return null;
141957
142040
  }
141958
142041
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
141959
- process.stderr.write(`[slayzone-config] ${configPath} is not a JSON object \u2014 using empty config
142042
+ process.stderr.write(`[slayzone-config] ${path27} is not a JSON object \u2014 using empty config
141960
142043
  `);
141961
- return {};
142044
+ return null;
141962
142045
  }
141963
- return coerce(parsed);
142046
+ return parsed;
141964
142047
  }
141965
- function saveSlayzoneConfig(cfg, configPath = getSlayzoneConfigPath()) {
141966
- const dir = (0, import_node_path.dirname)(configPath);
142048
+ function writeJsonAtomic(path27, data) {
142049
+ const dir = (0, import_node_path.dirname)(path27);
141967
142050
  (0, import_node_fs.mkdirSync)(dir, { recursive: true, mode: 448 });
141968
- const tmpPath = `${configPath}.tmp-${process.pid}-${Date.now()}`;
141969
- (0, import_node_fs.writeFileSync)(tmpPath, `${JSON.stringify(cfg, null, 2)}
142051
+ const tmpPath = `${path27}.tmp-${process.pid}-${Date.now()}`;
142052
+ (0, import_node_fs.writeFileSync)(tmpPath, `${JSON.stringify(data, null, 2)}
141970
142053
  `, { mode: 384 });
141971
142054
  try {
141972
- (0, import_node_fs.renameSync)(tmpPath, configPath);
142055
+ (0, import_node_fs.renameSync)(tmpPath, path27);
141973
142056
  } catch (err) {
141974
142057
  (0, import_node_fs.rmSync)(tmpPath, { force: true });
141975
142058
  throw err;
141976
142059
  }
141977
142060
  }
141978
- function updateSlayzoneConfig(patch, configPath = getSlayzoneConfigPath()) {
141979
- const current = loadSlayzoneConfig(configPath);
141980
- const merged = { ...current };
141981
- for (const [k, v2] of Object.entries(patch)) {
141982
- if (v2 !== void 0) merged[k] = v2;
141983
- }
141984
- saveSlayzoneConfig(merged, configPath);
141985
- return merged;
142061
+ function loadHubConfigFile(path27 = getHubConfigFilePath()) {
142062
+ const raw = readJsonObject(path27);
142063
+ if (raw) return coerceHubConfig(raw);
142064
+ const legacy = readJsonObject(legacyConfigFilePathFor(path27));
142065
+ return legacy ? coerceHubConfig(legacy) : {};
142066
+ }
142067
+ function loadHubStateFile(path27 = getHubStateFilePath()) {
142068
+ const raw = readJsonObject(path27);
142069
+ if (raw) return coerceHubState(raw);
142070
+ const legacy = readJsonObject(legacyConfigFilePathFor(path27));
142071
+ return legacy ? coerceHubState(legacy) : {};
142072
+ }
142073
+ function saveHubStateFile(state, path27 = getHubStateFilePath()) {
142074
+ writeJsonAtomic(path27, state);
141986
142075
  }
141987
- function ensureHubAuthSecret(configPath = getSlayzoneConfigPath()) {
141988
- const existing = loadSlayzoneConfig(configPath);
142076
+ function ensureHubAuthSecret(path27 = getHubStateFilePath()) {
142077
+ const existing = loadHubStateFile(path27);
141989
142078
  if (existing.runnerTransportSecret) return existing.runnerTransportSecret;
141990
142079
  const candidate = (0, import_node_crypto.randomBytes)(32).toString("hex");
141991
142080
  const merged = { ...existing, runnerTransportSecret: candidate };
141992
- (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(configPath), { recursive: true, mode: 448 });
142081
+ (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(path27), { recursive: true, mode: 448 });
141993
142082
  try {
141994
- (0, import_node_fs.writeFileSync)(configPath, `${JSON.stringify(merged, null, 2)}
142083
+ (0, import_node_fs.writeFileSync)(path27, `${JSON.stringify(merged, null, 2)}
141995
142084
  `, { flag: "wx", mode: 384 });
141996
142085
  return candidate;
141997
142086
  } catch (err) {
141998
142087
  if (err.code !== "EEXIST") throw err;
141999
142088
  }
142000
- const afterRace = loadSlayzoneConfig(configPath);
142001
- if (afterRace.runnerTransportSecret) return afterRace.runnerTransportSecret;
142002
- const finalCfg = updateSlayzoneConfig({ runnerTransportSecret: candidate }, configPath);
142003
- return finalCfg.runnerTransportSecret ?? candidate;
142089
+ const afterRace = readJsonObject(path27);
142090
+ const afterRaceState = afterRace ? coerceHubState(afterRace) : {};
142091
+ if (afterRaceState.runnerTransportSecret) return afterRaceState.runnerTransportSecret;
142092
+ const finalState = updateHubStateFile({ runnerTransportSecret: candidate }, path27);
142093
+ return finalState.runnerTransportSecret ?? candidate;
142094
+ }
142095
+ function updateHubStateFile(patch, path27 = getHubStateFilePath()) {
142096
+ const current = readJsonObject(path27);
142097
+ const merged = current ? coerceHubState(current) : {};
142098
+ for (const [k, v2] of Object.entries(patch)) {
142099
+ if (v2 !== void 0) merged[k] = v2;
142100
+ }
142101
+ saveHubStateFile(merged, path27);
142102
+ return merged;
142103
+ }
142104
+ function updateJsonFile(patch, path27) {
142105
+ const current = readJsonObject(path27) ?? {};
142106
+ const merged = { ...current };
142107
+ for (const [k, v2] of Object.entries(patch)) {
142108
+ if (v2 !== void 0) merged[k] = v2;
142109
+ }
142110
+ writeJsonAtomic(path27, merged);
142004
142111
  }
142005
142112
 
142006
142113
  // ../../shared/platform/src/config-prompt.ts
@@ -142022,7 +142129,7 @@ async function confirm(io, question, { defaultYes = true } = {}) {
142022
142129
  return raw === "y" || raw === "yes";
142023
142130
  }
142024
142131
  async function runInteractiveConfig(opts) {
142025
- const configPath = opts.configPath ?? getSlayzoneConfigPath();
142132
+ const configPath = opts.configPath;
142026
142133
  const ownIo = opts.io === void 0;
142027
142134
  const io = opts.io ?? createStdioPromptIO();
142028
142135
  try {
@@ -142049,7 +142156,7 @@ async function runInteractiveConfig(opts) {
142049
142156
  if (saved) {
142050
142157
  const patch = {};
142051
142158
  for (const { field, config: config3 } of collected) patch[field.configKey] = config3;
142052
- updateSlayzoneConfig(patch, configPath);
142159
+ updateJsonFile(patch, configPath);
142053
142160
  io.write(`Saved ${configPath}`);
142054
142161
  } else {
142055
142162
  io.write("Not saved \u2014 using these values for this run only.");
@@ -153389,7 +153496,7 @@ async function setDefaultTemplate(db, projectId, templateId) {
153389
153496
  }
153390
153497
 
153391
153498
  // ../../domains/task/src/server/artifact-store.ts
153392
- var import_node_path4 = __toESM(require("node:path"), 1);
153499
+ var import_node_path3 = __toESM(require("node:path"), 1);
153393
153500
  var import_node_fs6 = require("node:fs");
153394
153501
 
153395
153502
  // ../../domains/task/src/shared/types.ts
@@ -153929,7 +154036,7 @@ var updateTaskInputSchema = external_exports.object({
153929
154036
  // ../../domains/task-artifacts/src/server/blob-store.ts
153930
154037
  var import_node_crypto6 = require("node:crypto");
153931
154038
  var import_node_fs5 = require("node:fs");
153932
- var import_node_path3 = __toESM(require("node:path"), 1);
154039
+ var import_node_path2 = __toESM(require("node:path"), 1);
153933
154040
 
153934
154041
  // ../../domains/task-artifacts/src/server/errors.ts
153935
154042
  var VersionError = class extends Error {
@@ -153953,13 +154060,13 @@ function isVersionError(err) {
153953
154060
  var BlobStore = class {
153954
154061
  rootDir;
153955
154062
  constructor(dataDir) {
153956
- this.rootDir = import_node_path3.default.join(dataDir, "blobs");
154063
+ this.rootDir = import_node_path2.default.join(dataDir, "blobs");
153957
154064
  }
153958
154065
  dirFor(hash2) {
153959
- return import_node_path3.default.join(this.rootDir, hash2.slice(0, 2));
154066
+ return import_node_path2.default.join(this.rootDir, hash2.slice(0, 2));
153960
154067
  }
153961
154068
  blobPath(hash2) {
153962
- return import_node_path3.default.join(this.dirFor(hash2), hash2.slice(2));
154069
+ return import_node_path2.default.join(this.dirFor(hash2), hash2.slice(2));
153963
154070
  }
153964
154071
  has(hash2) {
153965
154072
  return (0, import_node_fs5.existsSync)(this.blobPath(hash2));
@@ -153989,9 +154096,9 @@ var BlobStore = class {
153989
154096
  return { hash: hash2, size: buf.length, created: false };
153990
154097
  }
153991
154098
  (0, import_node_fs5.mkdirSync)(this.dirFor(hash2), { recursive: true });
153992
- const tmpDir = import_node_path3.default.join(this.rootDir, ".tmp");
154099
+ const tmpDir = import_node_path2.default.join(this.rootDir, ".tmp");
153993
154100
  (0, import_node_fs5.mkdirSync)(tmpDir, { recursive: true });
153994
- const tmpPath = import_node_path3.default.join(tmpDir, (0, import_node_crypto6.randomUUID)());
154101
+ const tmpPath = import_node_path2.default.join(tmpDir, (0, import_node_crypto6.randomUUID)());
153995
154102
  (0, import_node_fs5.writeFileSync)(tmpPath, buf);
153996
154103
  try {
153997
154104
  (0, import_node_fs5.renameSync)(tmpPath, finalPath);
@@ -154019,7 +154126,7 @@ var BlobStore = class {
154019
154126
  const hashes = [];
154020
154127
  for (const shard of (0, import_node_fs5.readdirSync)(this.rootDir)) {
154021
154128
  if (shard === ".tmp" || shard.length !== 2) continue;
154022
- const shardDir = import_node_path3.default.join(this.rootDir, shard);
154129
+ const shardDir = import_node_path2.default.join(this.rootDir, shard);
154023
154130
  for (const rest of (0, import_node_fs5.readdirSync)(shardDir)) {
154024
154131
  hashes.push(shard + rest);
154025
154132
  }
@@ -154217,7 +154324,7 @@ Diff.prototype = {
154217
154324
  tokenize: function tokenize(value) {
154218
154325
  return Array.from(value);
154219
154326
  },
154220
- join: function join4(chars) {
154327
+ join: function join3(chars) {
154221
154328
  return chars.join("");
154222
154329
  },
154223
154330
  postProcess: function postProcess(changeObjects) {
@@ -155297,7 +155404,7 @@ function buildFolderPathResolver(folders) {
155297
155404
  const f = byId.get(id);
155298
155405
  if (!f) return "";
155299
155406
  const parent = f.parent_id;
155300
- return parent ? import_node_path4.default.join(folderPath(parent), f.name) : f.name;
155407
+ return parent ? import_node_path3.default.join(folderPath(parent), f.name) : f.name;
155301
155408
  }
155302
155409
  return folderPath;
155303
155410
  }
@@ -155318,14 +155425,14 @@ function collectFolderAndDescendants(folders, rootId) {
155318
155425
  return targetIds;
155319
155426
  }
155320
155427
  function createArtifactStore(dataDir) {
155321
- const artifactsDir2 = import_node_path4.default.join(dataDir, "artifacts");
155428
+ const artifactsDir2 = import_node_path3.default.join(dataDir, "artifacts");
155322
155429
  function getArtifactFilePath2(taskId, artifactId, title) {
155323
155430
  const ext = getExtensionFromTitle(title) || ".txt";
155324
- return import_node_path4.default.join(artifactsDir2, taskId, `${artifactId}${ext}`);
155431
+ return import_node_path3.default.join(artifactsDir2, taskId, `${artifactId}${ext}`);
155325
155432
  }
155326
155433
  function getLegacyArtifactFilePath(taskId, artifactId, title) {
155327
155434
  const ext = getExtensionFromTitle(title) || ".txt";
155328
- return import_node_path4.default.join(dataDir, "assets", taskId, `${artifactId}${ext}`);
155435
+ return import_node_path3.default.join(dataDir, "assets", taskId, `${artifactId}${ext}`);
155329
155436
  }
155330
155437
  async function getRow(db, id) {
155331
155438
  return await db.prepare("SELECT * FROM task_artifacts WHERE id = ?").get(id);
@@ -155455,7 +155562,7 @@ function createArtifactStore(dataDir) {
155455
155562
  dataDir,
155456
155563
  taskId: data.taskId,
155457
155564
  sourcePath: data.sourcePath,
155458
- title: data.title ?? import_node_path4.default.basename(data.sourcePath)
155565
+ title: data.title ?? import_node_path3.default.basename(data.sourcePath)
155459
155566
  });
155460
155567
  return parseArtifact(row);
155461
155568
  },
@@ -155491,7 +155598,7 @@ function createArtifactStore(dataDir) {
155491
155598
  };
155492
155599
  },
155493
155600
  cleanupTaskArtifacts(taskId) {
155494
- const taskDir = import_node_path4.default.join(artifactsDir2, taskId);
155601
+ const taskDir = import_node_path3.default.join(artifactsDir2, taskId);
155495
155602
  if ((0, import_node_fs6.existsSync)(taskDir)) (0, import_node_fs6.rmSync)(taskDir, { recursive: true, force: true });
155496
155603
  },
155497
155604
  // --- Versions ---
@@ -156114,12 +156221,12 @@ function redactValue(value) {
156114
156221
  var filesystemBlobWriter = {
156115
156222
  write(bytes, extension) {
156116
156223
  const { mkdirSync: mkdirSync20, writeFileSync: writeFileSync13 } = require("node:fs");
156117
- const { join: join30 } = require("node:path");
156224
+ const { join: join29 } = require("node:path");
156118
156225
  const { getStorageDir: getStorageDir2 } = (init_src(), __toCommonJS(src_exports));
156119
- const dir = join30(getStorageDir2(), "diagnostics");
156226
+ const dir = join29(getStorageDir2(), "diagnostics");
156120
156227
  mkdirSync20(dir, { recursive: true });
156121
156228
  const name = `blob-${Date.now()}-${bytes.length}.${extension}`;
156122
- const path27 = join30(dir, name);
156229
+ const path27 = join29(dir, name);
156123
156230
  writeFileSync13(path27, bytes);
156124
156231
  return path27;
156125
156232
  }
@@ -158511,7 +158618,7 @@ var ClaudeAdapter = class {
158511
158618
  // ../../domains/terminal/src/server/adapters/codex-adapter.ts
158512
158619
  var import_promises4 = require("node:fs/promises");
158513
158620
  var import_node_os2 = require("node:os");
158514
- var import_node_path5 = require("node:path");
158621
+ var import_node_path4 = require("node:path");
158515
158622
 
158516
158623
  // ../../domains/terminal/src/server/adapters/types.ts
158517
158624
  function defaultEncodeSubmit(text) {
@@ -158644,7 +158751,7 @@ var CodexAdapter = class _CodexAdapter {
158644
158751
  }
158645
158752
  ];
158646
158753
  for (const dp of datePaths) {
158647
- const dir = (0, import_node_path5.join)(
158754
+ const dir = (0, import_node_path4.join)(
158648
158755
  (0, import_node_os2.homedir)(),
158649
158756
  ".codex",
158650
158757
  "sessions",
@@ -158655,14 +158762,14 @@ var CodexAdapter = class _CodexAdapter {
158655
158762
  try {
158656
158763
  const files = (await (0, import_promises4.readdir)(dir)).filter((f) => f.endsWith(".jsonl")).sort().reverse();
158657
158764
  for (const file2 of files) {
158658
- const info2 = await (0, import_promises4.stat)((0, import_node_path5.join)(dir, file2));
158765
+ const info2 = await (0, import_promises4.stat)((0, import_node_path4.join)(dir, file2));
158659
158766
  if (info2.birthtimeMs < spawnedAt - 5e3) break;
158660
158767
  const match = file2.match(
158661
158768
  /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/i
158662
158769
  );
158663
158770
  if (!match) continue;
158664
158771
  let firstLine;
158665
- const fh = await (0, import_promises4.open)((0, import_node_path5.join)(dir, file2), "r");
158772
+ const fh = await (0, import_promises4.open)((0, import_node_path4.join)(dir, file2), "r");
158666
158773
  try {
158667
158774
  const buf = Buffer.alloc(4096);
158668
158775
  const { bytesRead } = await fh.read({ buffer: buf, length: 4096 });
@@ -160655,9 +160762,9 @@ async function buildMcpEnv(db, taskId, mode, sessionId, projectId, remote) {
160655
160762
  if (resolvedProjectId) env2.SLAYZONE_PROJECT_ID = resolvedProjectId;
160656
160763
  if (sessionId) env2.SLAYZONE_SESSION_ID = sessionId;
160657
160764
  const hookCapable = Boolean(mode && HOOK_SUPPORTED_AGENT_IDS.has(mode));
160765
+ env2.SLAYZONE_ROOT = getSlayzoneHomeDir();
160658
160766
  function setHookIdentity() {
160659
160767
  env2.SLAYZONE_AGENT_ID = mode;
160660
- env2.SLAYZONE_ROOT = getSlayzoneHomeDir();
160661
160768
  const ctx = {
160662
160769
  v: 1,
160663
160770
  agentId: mode,
@@ -167818,6 +167925,7 @@ function parseProject(row) {
167818
167925
  if (!row) return null;
167819
167926
  return {
167820
167927
  ...row,
167928
+ starred: Boolean(row.starred),
167821
167929
  columns_config: parseColumnsConfig(row.columns_config),
167822
167930
  execution_context: row.execution_context ? (() => {
167823
167931
  try {
@@ -167886,6 +167994,10 @@ async function updateProject(db, data, iconsDir2) {
167886
167994
  values.push(data.autoCreateWorktreeOnTaskCreate ? 1 : 0);
167887
167995
  }
167888
167996
  }
167997
+ if (data.starred !== void 0) {
167998
+ fields.push("starred = ?");
167999
+ values.push(data.starred ? 1 : 0);
168000
+ }
167889
168001
  if (data.worktreeSourceBranch !== void 0) {
167890
168002
  fields.push("worktree_source_branch = ?");
167891
168003
  values.push(data.worktreeSourceBranch);
@@ -170531,7 +170643,7 @@ var processesRouter = router({
170531
170643
  });
170532
170644
 
170533
170645
  // ../../shared/transport/src/server/routers/projects.ts
170534
- var import_node_path6 = require("node:path");
170646
+ var import_node_path5 = require("node:path");
170535
170647
  init_zod();
170536
170648
  var createProjectInput = external_exports.object({
170537
170649
  name: external_exports.string().min(1),
@@ -170540,7 +170652,7 @@ var createProjectInput = external_exports.object({
170540
170652
  columnsConfig: external_exports.array(external_exports.unknown()).optional()
170541
170653
  });
170542
170654
  var updateProjectInput = external_exports.unknown();
170543
- var iconsDir = (dataRoot) => (0, import_node_path6.join)(dataRoot, "project-icons");
170655
+ var iconsDir = (dataRoot) => (0, import_node_path5.join)(dataRoot, "project-icons");
170544
170656
  var projectsRouter = router({
170545
170657
  list: publicProcedure.query(({ ctx }) => listAllProjects(ctx.db)),
170546
170658
  create: publicProcedure.input(createProjectInput).mutation(({ ctx, input }) => createProject(ctx.db, input)),
@@ -171483,6 +171595,16 @@ async function listHibernatedSessionIds(db) {
171483
171595
  const rows = await db.prepare("SELECT task_id FROM terminal_tabs WHERE hibernated = 1 AND is_main = 1").all();
171484
171596
  return rows.map((r) => `${r.task_id}:${r.task_id}`);
171485
171597
  }
171598
+ async function listAutoRestoreTaskIds(db) {
171599
+ const rows = await db.prepare(
171600
+ `SELECT tt.task_id FROM terminal_tabs tt
171601
+ JOIN tasks t ON t.id = tt.task_id
171602
+ WHERE tt.is_main = 1 AND tt.mode != 'terminal'
171603
+ AND tt.was_spawned = 1 AND tt.hibernated = 0
171604
+ AND t.deleted_at IS NULL`
171605
+ ).all();
171606
+ return rows.map((r) => r.task_id);
171607
+ }
171486
171608
 
171487
171609
  // ../../domains/task-terminals/src/server/tabs-store.ts
171488
171610
  function rowToTab(row) {
@@ -171623,6 +171745,9 @@ var taskTerminalsRouter = router({
171623
171745
  list: publicProcedure.input(external_exports.object({ taskId: external_exports.string() })).query(({ ctx, input }) => listTabsForTask(ctx.db, input.taskId)),
171624
171746
  /** Main-tab session ids flagged hibernated — seeds the renderer's 💤 dots at boot. */
171625
171747
  listHibernatedSessions: publicProcedure.query(({ ctx }) => listHibernatedSessionIds(ctx.db)),
171748
+ /** Task ids whose main session was alive at last shutdown and isn't
171749
+ * hibernated — the boot-restore set (see `listAutoRestoreTaskIds`). */
171750
+ listAutoRestoreTasks: publicProcedure.query(({ ctx }) => listAutoRestoreTaskIds(ctx.db)),
171626
171751
  create: publicProcedure.input(createInput4).mutation(({ ctx, input }) => createTabRow(ctx.db, input)),
171627
171752
  split: publicProcedure.input(external_exports.object({ tabId: external_exports.string() })).mutation(({ ctx, input }) => splitTabRow(ctx.db, input.tabId)),
171628
171753
  moveToGroup: publicProcedure.input(external_exports.object({ tabId: external_exports.string(), targetGroupId: external_exports.string().nullable() })).mutation(({ ctx, input }) => moveTabToGroup(ctx.db, input.tabId, input.targetGroupId)),
@@ -185749,30 +185874,30 @@ var import_node_crypto19 = require("node:crypto");
185749
185874
  var import_node_fs13 = require("node:fs");
185750
185875
  var import_promises13 = require("node:fs/promises");
185751
185876
  var import_node_os3 = require("node:os");
185752
- var import_node_path8 = require("node:path");
185877
+ var import_node_path7 = require("node:path");
185753
185878
  var import_promises14 = require("node:stream/promises");
185754
185879
 
185755
185880
  // ../../shared/transport/src/server/http/rest-api/artifacts/shared.ts
185756
- var import_node_path7 = require("node:path");
185881
+ var import_node_path6 = require("node:path");
185757
185882
  init_src();
185758
185883
  function getArtifactsDataRoot() {
185759
185884
  return getStorageDir();
185760
185885
  }
185761
- var artifactsDir = (0, import_node_path7.join)(getArtifactsDataRoot(), "artifacts");
185886
+ var artifactsDir = (0, import_node_path6.join)(getArtifactsDataRoot(), "artifacts");
185762
185887
  function getArtifactFilePath(taskId, artifactId, title) {
185763
185888
  const ext = getExtensionFromTitle(title) || ".txt";
185764
- return (0, import_node_path7.join)(artifactsDir, taskId, `${artifactId}${ext}`);
185889
+ return (0, import_node_path6.join)(artifactsDir, taskId, `${artifactId}${ext}`);
185765
185890
  }
185766
185891
  function resolveArtifactFilePath(taskId, artifactId, title) {
185767
185892
  const ext = getExtensionFromTitle(title) || ".txt";
185768
- return (0, import_node_path7.join)(getArtifactsDataRoot(), "artifacts", taskId, `${artifactId}${ext}`);
185893
+ return (0, import_node_path6.join)(getArtifactsDataRoot(), "artifacts", taskId, `${artifactId}${ext}`);
185769
185894
  }
185770
185895
 
185771
185896
  // ../../shared/transport/src/server/http/rest-api/artifacts/content.ts
185772
185897
  async function stageRequestBody(req) {
185773
- const stagingDir = (0, import_node_path8.join)((0, import_node_os3.tmpdir)(), "slayzone-artifact-uploads");
185898
+ const stagingDir = (0, import_node_path7.join)((0, import_node_os3.tmpdir)(), "slayzone-artifact-uploads");
185774
185899
  (0, import_node_fs13.mkdirSync)(stagingDir, { recursive: true });
185775
- const tmpPath = (0, import_node_path8.join)(stagingDir, (0, import_node_crypto19.randomUUID)());
185900
+ const tmpPath = (0, import_node_path7.join)(stagingDir, (0, import_node_crypto19.randomUUID)());
185776
185901
  await (0, import_promises14.pipeline)(req, (0, import_node_fs13.createWriteStream)(tmpPath));
185777
185902
  return tmpPath;
185778
185903
  }
@@ -185948,7 +186073,18 @@ function registerArtifactsCrudRoutes(app, deps4) {
185948
186073
  res.status(resolved.status).json({ ok: false, error: resolved.error });
185949
186074
  return;
185950
186075
  }
185951
- res.json({ ok: true, data: resolved.row });
186076
+ const row = resolved.row;
186077
+ res.json({
186078
+ ok: true,
186079
+ data: {
186080
+ ...row,
186081
+ filePath: resolveArtifactFilePath(
186082
+ String(row.task_id),
186083
+ row.id,
186084
+ String(row.title ?? "")
186085
+ )
186086
+ }
186087
+ });
185952
186088
  } catch (err) {
185953
186089
  res.status(500).json({ ok: false, error: err instanceof Error ? err.message : String(err) });
185954
186090
  }
@@ -186253,7 +186389,7 @@ var import_node_crypto20 = require("node:crypto");
186253
186389
  var import_node_fs14 = require("node:fs");
186254
186390
  var import_promises15 = require("node:fs/promises");
186255
186391
  var import_node_os4 = require("node:os");
186256
- var import_node_path9 = require("node:path");
186392
+ var import_node_path8 = require("node:path");
186257
186393
  var import_promises16 = require("node:stream/promises");
186258
186394
  function store3() {
186259
186395
  return createArtifactStore(getArtifactsDataRoot());
@@ -186299,9 +186435,9 @@ function parseAuthor(type2, id) {
186299
186435
  return { type: type2, id: typeof id === "string" && id ? id : null };
186300
186436
  }
186301
186437
  async function stageRequestBody2(req) {
186302
- const stagingDir = (0, import_node_path9.join)((0, import_node_os4.tmpdir)(), "slayzone-artifact-uploads");
186438
+ const stagingDir = (0, import_node_path8.join)((0, import_node_os4.tmpdir)(), "slayzone-artifact-uploads");
186303
186439
  (0, import_node_fs14.mkdirSync)(stagingDir, { recursive: true });
186304
- const tmpPath = (0, import_node_path9.join)(stagingDir, (0, import_node_crypto20.randomUUID)());
186440
+ const tmpPath = (0, import_node_path8.join)(stagingDir, (0, import_node_crypto20.randomUUID)());
186305
186441
  await (0, import_promises16.pipeline)(req, (0, import_node_fs14.createWriteStream)(tmpPath));
186306
186442
  return tmpPath;
186307
186443
  }
@@ -186527,7 +186663,7 @@ function registerOpenArtifactRoute(app, deps4) {
186527
186663
  }
186528
186664
 
186529
186665
  // ../../shared/transport/src/server/http/rest-api/artifacts/export-pdf.ts
186530
- var import_node_path10 = require("node:path");
186666
+ var import_node_path9 = require("node:path");
186531
186667
  var import_node_fs15 = require("node:fs");
186532
186668
  function registerArtifactsExportPdfRoute(app, deps4) {
186533
186669
  app.post("/api/artifacts/:id/export/pdf", async (req, res) => {
@@ -186562,7 +186698,7 @@ function registerArtifactsExportPdfRoute(app, deps4) {
186562
186698
  const html2 = isMermaid ? exporter.buildMermaidPdfHtml(content, title) : exporter.buildPdfHtml(content, mode, title);
186563
186699
  try {
186564
186700
  const pdfBuffer = await exporter.renderToPdf(html2, isMermaid);
186565
- (0, import_node_fs15.mkdirSync)((0, import_node_path10.dirname)(outputPath), { recursive: true });
186701
+ (0, import_node_fs15.mkdirSync)((0, import_node_path9.dirname)(outputPath), { recursive: true });
186566
186702
  (0, import_node_fs15.writeFileSync)(outputPath, pdfBuffer);
186567
186703
  res.json({ ok: true, path: outputPath });
186568
186704
  } catch (err) {
@@ -186572,7 +186708,7 @@ function registerArtifactsExportPdfRoute(app, deps4) {
186572
186708
  }
186573
186709
 
186574
186710
  // ../../shared/transport/src/server/http/rest-api/artifacts/export-png.ts
186575
- var import_node_path11 = require("node:path");
186711
+ var import_node_path10 = require("node:path");
186576
186712
  var import_node_fs16 = require("node:fs");
186577
186713
  function registerArtifactsExportPngRoute(app, deps4) {
186578
186714
  app.post("/api/artifacts/:id/export/png", async (req, res) => {
@@ -186610,7 +186746,7 @@ function registerArtifactsExportPngRoute(app, deps4) {
186610
186746
  }
186611
186747
  try {
186612
186748
  const pngBuffer = await exporter.renderToPng(html2);
186613
- (0, import_node_fs16.mkdirSync)((0, import_node_path11.dirname)(outputPath), { recursive: true });
186749
+ (0, import_node_fs16.mkdirSync)((0, import_node_path10.dirname)(outputPath), { recursive: true });
186614
186750
  (0, import_node_fs16.writeFileSync)(outputPath, pngBuffer);
186615
186751
  res.json({ ok: true, path: outputPath });
186616
186752
  } catch (err) {
@@ -186620,7 +186756,7 @@ function registerArtifactsExportPngRoute(app, deps4) {
186620
186756
  }
186621
186757
 
186622
186758
  // ../../shared/transport/src/server/http/rest-api/artifacts/export-html.ts
186623
- var import_node_path12 = require("node:path");
186759
+ var import_node_path11 = require("node:path");
186624
186760
  var import_node_fs17 = require("node:fs");
186625
186761
  function registerArtifactsExportHtmlRoute(app, deps4) {
186626
186762
  app.post("/api/artifacts/:id/export/html", async (req, res) => {
@@ -186653,7 +186789,7 @@ function registerArtifactsExportHtmlRoute(app, deps4) {
186653
186789
  const content = (0, import_node_fs17.readFileSync)(srcPath, "utf-8");
186654
186790
  const isMermaid = mode === "mermaid-preview";
186655
186791
  const html2 = isMermaid ? exporter.buildMermaidPdfHtml(content, title) : exporter.buildPdfHtml(content, mode, title);
186656
- (0, import_node_fs17.mkdirSync)((0, import_node_path12.dirname)(outputPath), { recursive: true });
186792
+ (0, import_node_fs17.mkdirSync)((0, import_node_path11.dirname)(outputPath), { recursive: true });
186657
186793
  (0, import_node_fs17.writeFileSync)(outputPath, html2, "utf-8");
186658
186794
  res.json({ ok: true, path: outputPath });
186659
186795
  });
@@ -187304,7 +187440,7 @@ function registerBrowserContentRoute(app, deps4) {
187304
187440
 
187305
187441
  // ../../shared/transport/src/server/http/rest-api/browser/screenshot.ts
187306
187442
  var import_node_os5 = require("node:os");
187307
- var import_node_path13 = require("node:path");
187443
+ var import_node_path12 = require("node:path");
187308
187444
  var import_node_crypto21 = require("node:crypto");
187309
187445
  var import_node_fs18 = require("node:fs");
187310
187446
  function registerBrowserScreenshotRoute(app, deps4) {
@@ -187318,12 +187454,12 @@ function registerBrowserScreenshotRoute(app, deps4) {
187318
187454
  res.status(500).json({ error: "Captured image is empty" });
187319
187455
  return;
187320
187456
  }
187321
- const dir = (0, import_node_path13.join)((0, import_node_os5.tmpdir)(), "slayzone", "browser-screenshots");
187457
+ const dir = (0, import_node_path12.join)((0, import_node_os5.tmpdir)(), "slayzone", "browser-screenshots");
187322
187458
  (0, import_node_fs18.mkdirSync)(dir, { recursive: true });
187323
187459
  try {
187324
187460
  const cutoff = Date.now() - 36e5;
187325
187461
  for (const f of (0, import_node_fs18.readdirSync)(dir)) {
187326
- const fp = (0, import_node_path13.join)(dir, f);
187462
+ const fp = (0, import_node_path12.join)(dir, f);
187327
187463
  try {
187328
187464
  if ((0, import_node_fs18.statSync)(fp).mtimeMs < cutoff) (0, import_node_fs18.unlinkSync)(fp);
187329
187465
  } catch {
@@ -187331,7 +187467,7 @@ function registerBrowserScreenshotRoute(app, deps4) {
187331
187467
  }
187332
187468
  } catch {
187333
187469
  }
187334
- const filePath = (0, import_node_path13.join)(dir, `${(0, import_node_crypto21.randomUUID)()}.png`);
187470
+ const filePath = (0, import_node_path12.join)(dir, `${(0, import_node_crypto21.randomUUID)()}.png`);
187335
187471
  (0, import_node_fs18.writeFileSync)(filePath, image.toPNG());
187336
187472
  res.json({ ok: true, path: filePath });
187337
187473
  } catch (err) {
@@ -188417,7 +188553,7 @@ function createMcpRestApp(deps4) {
188417
188553
 
188418
188554
  // ../../domains/hub-auth/src/server/auth.ts
188419
188555
  var import_node_fs20 = require("node:fs");
188420
- var import_node_path15 = require("node:path");
188556
+ var import_node_path14 = require("node:path");
188421
188557
  var import_node_sqlite = require("node:sqlite");
188422
188558
 
188423
188559
  // ../../../node_modules/.pnpm/@better-auth+api-key@1.6.23_@better-auth+core@1.6.23_@better-auth+utils@0.4.2_@better-f_efec3e750119bc24bd5a4522a96cf31b/node_modules/@better-auth/api-key/dist/version-Cd4fCeRN.mjs
@@ -188949,7 +189085,7 @@ init_ip();
188949
189085
  var import_node_fs19 = __toESM(require("node:fs"), 1);
188950
189086
  var import_promises17 = __toESM(require("node:fs/promises"), 1);
188951
189087
  var import_node_os6 = __toESM(require("node:os"), 1);
188952
- var import_node_path14 = __toESM(require("node:path"), 1);
189088
+ var import_node_path13 = __toESM(require("node:path"), 1);
188953
189089
  init_env();
188954
189090
  init_dist4();
188955
189091
  init_base64();
@@ -189189,7 +189325,7 @@ async function readRootPackageJson() {
189189
189325
  try {
189190
189326
  const cwd = process.cwd();
189191
189327
  if (!cwd) return void 0;
189192
- const raw = await import_promises17.default.readFile(import_node_path14.default.join(cwd, "package.json"), "utf-8");
189328
+ const raw = await import_promises17.default.readFile(import_node_path13.default.join(cwd, "package.json"), "utf-8");
189193
189329
  packageJSONCache = JSON.parse(raw);
189194
189330
  return packageJSONCache;
189195
189331
  } catch {
@@ -189200,7 +189336,7 @@ async function getPackageVersion(pkg) {
189200
189336
  try {
189201
189337
  const cwd = process.cwd();
189202
189338
  if (!cwd) throw new Error("no-cwd");
189203
- const pkgJsonPath = import_node_path14.default.join(cwd, "node_modules", pkg, "package.json");
189339
+ const pkgJsonPath = import_node_path13.default.join(cwd, "node_modules", pkg, "package.json");
189204
189340
  const raw = await import_promises17.default.readFile(pkgJsonPath, "utf-8");
189205
189341
  return JSON.parse(raw).version || await getVersionFromLocalPackageJson(pkg) || void 0;
189206
189342
  } catch {
@@ -192529,7 +192665,7 @@ function buildAuth(config3, database) {
192529
192665
  });
192530
192666
  }
192531
192667
  async function createHubAuth(config3) {
192532
- (0, import_node_fs20.mkdirSync)((0, import_node_path15.dirname)(config3.dbPath), { recursive: true });
192668
+ (0, import_node_fs20.mkdirSync)((0, import_node_path14.dirname)(config3.dbPath), { recursive: true });
192533
192669
  const database = new import_node_sqlite.DatabaseSync(config3.dbPath);
192534
192670
  database.exec("PRAGMA journal_mode = WAL;");
192535
192671
  const auth = buildAuth(config3, database);
@@ -193061,7 +193197,7 @@ async function removeHubUser(auth, email3) {
193061
193197
  // ../../domains/hub-identity/src/server/hub-identity.ts
193062
193198
  var import_node_crypto26 = require("node:crypto");
193063
193199
  var import_node_fs21 = require("node:fs");
193064
- var import_node_path16 = require("node:path");
193200
+ var import_node_path15 = require("node:path");
193065
193201
  var x509 = __toESM(require_x509_cjs(), 1);
193066
193202
  var cryptoProvider = import_node_crypto26.webcrypto;
193067
193203
  var IDENTITY_DIR = "identity";
@@ -193082,9 +193218,9 @@ var SAN_NAMES = [
193082
193218
  { type: "ip", value: "127.0.0.1" }
193083
193219
  ];
193084
193220
  async function loadOrCreateHubIdentity(dir) {
193085
- const identityDir = (0, import_node_path16.join)(dir, IDENTITY_DIR);
193086
- const keyPath = (0, import_node_path16.join)(identityDir, KEY_FILE);
193087
- const certPath = (0, import_node_path16.join)(identityDir, CERT_FILE);
193221
+ const identityDir = (0, import_node_path15.join)(dir, IDENTITY_DIR);
193222
+ const keyPath = (0, import_node_path15.join)(identityDir, KEY_FILE);
193223
+ const certPath = (0, import_node_path15.join)(identityDir, CERT_FILE);
193088
193224
  const keyRaw = readFileOrNull(keyPath);
193089
193225
  const certRaw = readFileOrNull(certPath);
193090
193226
  const hadArtifacts = keyRaw !== null || certRaw !== null;
@@ -193200,7 +193336,7 @@ function fsyncDir(dir) {
193200
193336
  function sweepStaleTmp(dir) {
193201
193337
  try {
193202
193338
  for (const name of (0, import_node_fs21.readdirSync)(dir)) {
193203
- if (name.endsWith(TMP_SUFFIX)) (0, import_node_fs21.rmSync)((0, import_node_path16.join)(dir, name), { force: true });
193339
+ if (name.endsWith(TMP_SUFFIX)) (0, import_node_fs21.rmSync)((0, import_node_path15.join)(dir, name), { force: true });
193204
193340
  }
193205
193341
  } catch {
193206
193342
  }
@@ -193217,7 +193353,7 @@ init_src();
193217
193353
 
193218
193354
  // src/db.ts
193219
193355
  var import_better_sqlite32 = __toESM(require("better-sqlite3"), 1);
193220
- var import_node_path18 = __toESM(require("node:path"), 1);
193356
+ var import_node_path17 = __toESM(require("node:path"), 1);
193221
193357
  init_src();
193222
193358
 
193223
193359
  // ../../domains/terminal/src/server/chat-queue-txns.ts
@@ -193793,7 +193929,7 @@ var templatesTxns = {
193793
193929
  };
193794
193930
 
193795
193931
  // ../../domains/task-artifacts/src/server/artifact-txns.ts
193796
- var import_node_path17 = require("node:path");
193932
+ var import_node_path16 = require("node:path");
193797
193933
  var import_node_fs22 = require("node:fs");
193798
193934
  var import_node_crypto27 = require("node:crypto");
193799
193935
  function seedInitialVersionsInWorker(rawDb, blobStore, artifactsDir2) {
@@ -193817,7 +193953,7 @@ function seedInitialVersionsInWorker(rawDb, blobStore, artifactsDir2) {
193817
193953
  const setCurrent = db.prepare("UPDATE task_artifacts SET current_version_id = ? WHERE id = ?");
193818
193954
  for (const row of needsSeed) {
193819
193955
  const ext = getExtensionFromTitle(row.title) || ".txt";
193820
- const filePath = (0, import_node_path17.join)(artifactsDir2, row.task_id, `${row.id}${ext}`);
193956
+ const filePath = (0, import_node_path16.join)(artifactsDir2, row.task_id, `${row.id}${ext}`);
193821
193957
  if (!(0, import_node_fs22.existsSync)(filePath)) {
193822
193958
  skippedMissing++;
193823
193959
  continue;
@@ -197677,6 +197813,18 @@ ${body}` : `${renderedFrontmatter}
197677
197813
  up: (db) => {
197678
197814
  db.exec(`ALTER TABLE task_artifacts ADD COLUMN zoom_pct INTEGER DEFAULT NULL;`);
197679
197815
  }
197816
+ },
197817
+ {
197818
+ version: 153,
197819
+ up: (db) => {
197820
+ db.exec(`ALTER TABLE projects ADD COLUMN starred INTEGER NOT NULL DEFAULT 0;`);
197821
+ }
197822
+ },
197823
+ {
197824
+ version: 154,
197825
+ up: (db) => {
197826
+ db.exec(`ALTER TABLE processes ADD COLUMN pid INTEGER DEFAULT NULL;`);
197827
+ }
197680
197828
  }
197681
197829
  ];
197682
197830
  var LATEST_MIGRATION_VERSION = migrations[migrations.length - 1].version;
@@ -197737,7 +197885,7 @@ function bootstrapSchema(db) {
197737
197885
  // src/db.ts
197738
197886
  function getDatabasePathFromEnv() {
197739
197887
  const name = getDbName(process.env.SLAYZONE_DEV !== "1");
197740
- return import_node_path18.default.join(getStorageDir(), name);
197888
+ return import_node_path17.default.join(getStorageDir(), name);
197741
197889
  }
197742
197890
  var SyncSlayzoneDb = class {
197743
197891
  constructor(db) {
@@ -197820,13 +197968,13 @@ function openServerDiagnosticsDatabase() {
197820
197968
 
197821
197969
  // src/composition.ts
197822
197970
  var import_node_events6 = require("node:events");
197823
- var import_node_path20 = require("node:path");
197971
+ var import_node_path19 = require("node:path");
197824
197972
  var import_node_os7 = require("node:os");
197825
197973
 
197826
197974
  // src/shell-native.ts
197827
197975
  var import_node_child_process7 = require("node:child_process");
197828
197976
  var import_promises18 = require("node:fs/promises");
197829
- var import_node_path19 = require("node:path");
197977
+ var import_node_path18 = require("node:path");
197830
197978
  function openCommand(p2) {
197831
197979
  switch (process.platform) {
197832
197980
  case "darwin":
@@ -197844,7 +197992,7 @@ function revealCommand(p2) {
197844
197992
  case "win32":
197845
197993
  return ["explorer", [`/select,${p2}`]];
197846
197994
  default:
197847
- return ["xdg-open", [(0, import_node_path19.dirname)(p2)]];
197995
+ return ["xdg-open", [(0, import_node_path18.dirname)(p2)]];
197848
197996
  }
197849
197997
  }
197850
197998
  function openPath(absPath) {
@@ -199139,8 +199287,8 @@ function getDesktopBridgeRestUrl() {
199139
199287
 
199140
199288
  // src/build-info.ts
199141
199289
  function getServerBuildInfo() {
199142
- const commit = true ? "e148666c" : "dev";
199143
- const builtAt = true ? "2026-08-05T08:39:09.134Z" : "unknown";
199290
+ const commit = true ? "447107dc" : "dev";
199291
+ const builtAt = true ? "2026-08-05T23:22:30.305Z" : "unknown";
199144
199292
  return { commit, builtAt, buildId: `${commit}@${builtAt}` };
199145
199293
  }
199146
199294
 
@@ -203097,6 +203245,9 @@ function createDbProcessPersistence(db) {
203097
203245
  },
203098
203246
  remove(id) {
203099
203247
  return db.prepare("DELETE FROM processes WHERE id = ?").run(id).then(() => void 0);
203248
+ },
203249
+ updatePid(id, pid) {
203250
+ return db.prepare("UPDATE processes SET pid = ? WHERE id = ?").run(pid, id).then(() => void 0);
203100
203251
  }
203101
203252
  };
203102
203253
  }
@@ -203104,9 +203255,7 @@ function createDbProcessPersistence(db) {
203104
203255
  // ../../domains/processes/src/server/process-backend.ts
203105
203256
  var import_child_process10 = require("child_process");
203106
203257
  init_src();
203107
- function killProcessTree(child, signal = "SIGTERM") {
203108
- const pid = child.pid;
203109
- if (pid == null) return;
203258
+ function killPidTree(pid, signal = "SIGTERM") {
203110
203259
  if (process.platform === "win32") {
203111
203260
  try {
203112
203261
  (0, import_child_process10.execFileSync)("taskkill", ["/T", "/F", "/PID", String(pid)]);
@@ -203119,6 +203268,19 @@ function killProcessTree(child, signal = "SIGTERM") {
203119
203268
  }
203120
203269
  }
203121
203270
  }
203271
+ function killProcessTree(child, signal = "SIGTERM") {
203272
+ const pid = child.pid;
203273
+ if (pid == null) return;
203274
+ killPidTree(pid, signal);
203275
+ }
203276
+ function getCommandLine(pid) {
203277
+ if (process.platform === "win32") return Promise.resolve(null);
203278
+ return new Promise((resolve5) => {
203279
+ (0, import_child_process10.execFile)("ps", ["-o", "command=", "-p", String(pid)], { timeout: 2e3 }, (err, stdout2) => {
203280
+ resolve5(err ? null : stdout2.trim() || null);
203281
+ });
203282
+ });
203283
+ }
203122
203284
  function makeLocalHandle(child) {
203123
203285
  const dataSubs = /* @__PURE__ */ new Set();
203124
203286
  const exitSubs = /* @__PURE__ */ new Set();
@@ -203160,6 +203322,10 @@ var localProcessBackend = {
203160
203322
  if (spec.env) Object.assign(env2, spec.env);
203161
203323
  const child = (0, import_child_process10.spawn)(file2, args, { cwd: spec.cwd, env: env2, detached: !isWin });
203162
203324
  return makeLocalHandle(child);
203325
+ },
203326
+ getCommandLine,
203327
+ killByPid(pid, sig) {
203328
+ killPidTree(pid, sig ?? "SIGTERM");
203163
203329
  }
203164
203330
  };
203165
203331
  var backend = localProcessBackend;
@@ -203202,7 +203368,10 @@ async function initProcessManagerWith(p2) {
203202
203368
  cwd: row.cwd,
203203
203369
  autoRestart: row.auto_restart === 1,
203204
203370
  status: "stopped",
203205
- pid: null,
203371
+ // Carried over from the last spawn, if the app never got to clear it (an
203372
+ // uncontrolled exit) — reapStaleIfNeeded() checks and clears it before the
203373
+ // next restartProcess()/spawnProcess() actually spawns.
203374
+ pid: row.pid,
203206
203375
  exitCode: null,
203207
203376
  logBuffer: [],
203208
203377
  handle: null,
@@ -203282,12 +203451,14 @@ function doSpawn(proc) {
203282
203451
  proc.exitCode = null;
203283
203452
  proc.processTitle = null;
203284
203453
  proc.oscTitleSet = false;
203454
+ void persistence?.updatePid(proc.id, proc.pid);
203285
203455
  startTitlePolling2(proc);
203286
203456
  handle.onData((chunk) => handleProcessData(proc, chunk));
203287
203457
  handle.onExit(({ code }) => {
203288
203458
  if (proc.handle !== handle) return;
203289
203459
  stopTitlePolling2(proc);
203290
203460
  proc.pid = null;
203461
+ void persistence?.updatePid(proc.id, null);
203291
203462
  proc.handle = null;
203292
203463
  proc.exitCode = code;
203293
203464
  proc.processTitle = null;
@@ -203307,6 +203478,46 @@ function doSpawn(proc) {
203307
203478
  }
203308
203479
  });
203309
203480
  }
203481
+ function sleep3(ms) {
203482
+ return new Promise((resolve5) => setTimeout(resolve5, ms));
203483
+ }
203484
+ function commandsLikelyMatch(persisted, live) {
203485
+ const p2 = persisted.trim();
203486
+ const l = live.trim();
203487
+ if (!p2 || !l) return false;
203488
+ return l === p2 || l.endsWith(p2) || p2.endsWith(l);
203489
+ }
203490
+ var REAP_POLL_INTERVAL_MS = 200;
203491
+ var REAP_POLL_TIMEOUT_MS = 2e3;
203492
+ async function reapStaleIfNeeded(proc) {
203493
+ const stalePid = proc.pid;
203494
+ if (proc.handle || stalePid == null) return;
203495
+ const backend2 = getProcessBackend();
203496
+ const liveCommand = await backend2.getCommandLine(stalePid);
203497
+ if (!liveCommand || !commandsLikelyMatch(proc.command, liveCommand)) {
203498
+ if (liveCommand) {
203499
+ pushLog(
203500
+ proc,
203501
+ `[pid ${stalePid} from a previous run no longer matches this command \u2014 leaving it running]`
203502
+ );
203503
+ }
203504
+ proc.pid = null;
203505
+ void persistence?.updatePid(proc.id, null);
203506
+ return;
203507
+ }
203508
+ pushLog(proc, `[reaping leftover process from a previous run: pid ${stalePid}]`);
203509
+ backend2.killByPid(stalePid, "SIGTERM");
203510
+ const deadline = Date.now() + REAP_POLL_TIMEOUT_MS;
203511
+ while (Date.now() < deadline && await backend2.getCommandLine(stalePid)) {
203512
+ await sleep3(REAP_POLL_INTERVAL_MS);
203513
+ }
203514
+ if (await backend2.getCommandLine(stalePid)) {
203515
+ backend2.killByPid(stalePid, "SIGKILL");
203516
+ await sleep3(REAP_POLL_INTERVAL_MS);
203517
+ }
203518
+ proc.pid = null;
203519
+ void persistence?.updatePid(proc.id, null);
203520
+ }
203310
203521
  function createProcess(projectId, taskId, label, command, cwd, autoRestart) {
203311
203522
  const id = (0, import_crypto15.randomUUID)();
203312
203523
  const proc = {
@@ -203333,7 +203544,7 @@ function createProcess(projectId, taskId, label, command, cwd, autoRestart) {
203333
203544
  void persistence?.insert({ id, taskId, projectId, label, command, cwd, autoRestart });
203334
203545
  return id;
203335
203546
  }
203336
- function spawnProcess(projectId, taskId, label, command, cwd, autoRestart) {
203547
+ async function spawnProcess(projectId, taskId, label, command, cwd, autoRestart) {
203337
203548
  if (isShuttingDown3) throw new Error("Cannot spawn process while app is shutting down.");
203338
203549
  const id = (0, import_crypto15.randomUUID)();
203339
203550
  const proc = {
@@ -203358,6 +203569,7 @@ function spawnProcess(projectId, taskId, label, command, cwd, autoRestart) {
203358
203569
  };
203359
203570
  processes.set(id, proc);
203360
203571
  void persistence?.insert({ id, taskId, projectId, label, command, cwd, autoRestart });
203572
+ await reapStaleIfNeeded(proc);
203361
203573
  doSpawn(proc);
203362
203574
  return id;
203363
203575
  }
@@ -203383,6 +203595,7 @@ function stopProcess(id) {
203383
203595
  const handle = proc.handle;
203384
203596
  proc.handle = null;
203385
203597
  proc.pid = null;
203598
+ void persistence?.updatePid(proc.id, null);
203386
203599
  proc.spawnedAt = null;
203387
203600
  if (handle) handle.kill();
203388
203601
  setStatus(proc, "stopped");
@@ -203399,15 +203612,17 @@ function killProcess(id) {
203399
203612
  void persistence?.remove(id);
203400
203613
  return true;
203401
203614
  }
203402
- function restartProcess(id) {
203615
+ async function restartProcess(id) {
203403
203616
  if (isShuttingDown3) return false;
203404
203617
  const proc = processes.get(id);
203405
203618
  if (!proc) return false;
203406
203619
  stopTitlePolling2(proc);
203620
+ const hadLiveHandle = proc.handle != null;
203407
203621
  if (proc.handle) proc.handle.kill();
203408
203622
  proc.handle = null;
203409
203623
  proc.logBuffer.push("[restarting...]");
203410
203624
  setStatus(proc, "running");
203625
+ if (!hadLiveHandle) await reapStaleIfNeeded(proc);
203411
203626
  setTimeout(() => doSpawn(proc), 500);
203412
203627
  return true;
203413
203628
  }
@@ -204881,6 +205096,16 @@ function createRoutingProcessBackend(options) {
204881
205096
  () => finalize2(entry, null, "spawn-failed")
204882
205097
  );
204883
205098
  return handle;
205099
+ },
205100
+ // Crash-reap (process-manager.ts's reapStaleIfNeeded) is a local-backend-only
205101
+ // feature: it depends on inspecting/killing a bare OS pid, and a routed
205102
+ // session only ever exposes the runner's own sessionId/key, not one the hub
205103
+ // can act on independently. `getCommandLine` -> null is the same "can't
205104
+ // verify, so don't touch it" signal `localProcessBackend` returns on win32.
205105
+ getCommandLine() {
205106
+ return Promise.resolve(null);
205107
+ },
205108
+ killByPid() {
204884
205109
  }
204885
205110
  };
204886
205111
  }
@@ -205337,7 +205562,7 @@ function composeServer(opts) {
205337
205562
  }
205338
205563
  });
205339
205564
  bootBestEffort("startup-purge", () => purgeStaleAndOrphanedTasks(db));
205340
- startArtifactWatcher((0, import_node_path20.join)(dataRoot, "artifacts"));
205565
+ startArtifactWatcher((0, import_node_path19.join)(dataRoot, "artifacts"));
205341
205566
  const stubPtyWindow = {
205342
205567
  isDestroyed: () => false,
205343
205568
  webContents: { send: () => {
@@ -205520,7 +205745,7 @@ function composeServer(opts) {
205520
205745
  appGetVersion: () => "0.0.0-server",
205521
205746
  // Real directory (node os.homedir) — it is only a dialog default, and the
205522
205747
  // dialog itself is the stub that fails loud.
205523
- appGetDownloadsDir: async () => (0, import_node_path20.join)((0, import_node_os7.homedir)(), "Downloads"),
205748
+ appGetDownloadsDir: async () => (0, import_node_path19.join)((0, import_node_os7.homedir)(), "Downloads"),
205524
205749
  appGetTrpcPort: async () => boundPort,
205525
205750
  // Graceful read-path defaults (flag getters / cosmetics) — a throwing stub
205526
205751
  // here would break harmless renderer reads post-flip for no gain.
@@ -205856,7 +206081,7 @@ function composeServer(opts) {
205856
206081
  setRemoteMcpEnvProvider(createRemoteMcpEnvProvider({ getBoundPort: () => boundPort }));
205857
206082
  runnersReady = (async () => {
205858
206083
  const hubAuth = await createHubAuth({
205859
- dbPath: (0, import_node_path20.join)(dataRoot, "hub-auth.sqlite"),
206084
+ dbPath: (0, import_node_path19.join)(dataRoot, "hub-auth.sqlite"),
205860
206085
  // better-auth baseURL: a fixed loopback constant. Runners authenticate via
205861
206086
  // api-key/bearer (not cookies/redirects), so this is internal plumbing and
205862
206087
  // never needs an operator override — the SLAYZONE_RUNNER_TRANSPORT_BASE_URL
@@ -205947,20 +206172,20 @@ function deriveRunnerHubUrl(opts) {
205947
206172
  // src/sidecar-socket.ts
205948
206173
  var import_node_net = require("node:net");
205949
206174
  var import_node_fs23 = require("node:fs");
205950
- var import_node_path21 = require("node:path");
206175
+ var import_node_path20 = require("node:path");
205951
206176
  var import_node_os8 = require("node:os");
205952
206177
  init_src();
205953
206178
  var MAX_SOCKET_PATH = 100;
205954
206179
  var MAX_FRAME_BYTES = 1024 * 1024;
205955
206180
  function resolveSidecarSocketPath() {
205956
- const rootPath = (0, import_node_path21.join)(getSlayzoneHomeDir(), "run", "sidecar.sock");
206181
+ const rootPath = (0, import_node_path20.join)(getSlayzoneHomeDir(), "run", "sidecar.sock");
205957
206182
  if (rootPath.length <= MAX_SOCKET_PATH) return rootPath;
205958
206183
  const xdg = process.env.XDG_RUNTIME_DIR;
205959
- if (xdg && xdg.trim()) return (0, import_node_path21.join)(xdg, "slayzone", "sidecar.sock");
206184
+ if (xdg && xdg.trim()) return (0, import_node_path20.join)(xdg, "slayzone", "sidecar.sock");
205960
206185
  if (process.platform === "darwin") {
205961
- return (0, import_node_path21.join)((0, import_node_os8.homedir)(), "Library", "Application Support", "SlayZone", "run", "sidecar.sock");
206186
+ return (0, import_node_path20.join)((0, import_node_os8.homedir)(), "Library", "Application Support", "SlayZone", "run", "sidecar.sock");
205962
206187
  }
205963
- return (0, import_node_path21.join)((0, import_node_os8.homedir)(), ".slayzone", "run", "sidecar.sock");
206188
+ return (0, import_node_path20.join)((0, import_node_os8.homedir)(), ".slayzone", "run", "sidecar.sock");
205964
206189
  }
205965
206190
  function frame(message2) {
205966
206191
  const body = Buffer.from(JSON.stringify(message2), "utf8");
@@ -205974,8 +206199,8 @@ function startSidecarSocketServer(opts) {
205974
206199
  });
205975
206200
  const socketPath = resolveSidecarSocketPath();
205976
206201
  try {
205977
- (0, import_node_fs23.mkdirSync)((0, import_node_path21.dirname)(socketPath), { recursive: true, mode: 448 });
205978
- (0, import_node_fs23.chmodSync)((0, import_node_path21.dirname)(socketPath), 448);
206202
+ (0, import_node_fs23.mkdirSync)((0, import_node_path20.dirname)(socketPath), { recursive: true, mode: 448 });
206203
+ (0, import_node_fs23.chmodSync)((0, import_node_path20.dirname)(socketPath), 448);
205979
206204
  } catch {
205980
206205
  }
205981
206206
  try {
@@ -206143,12 +206368,12 @@ function handleHealth(state, req, res) {
206143
206368
 
206144
206369
  // src/log.ts
206145
206370
  var import_node_fs24 = require("node:fs");
206146
- var import_node_path22 = __toESM(require("node:path"), 1);
206371
+ var import_node_path21 = __toESM(require("node:path"), 1);
206147
206372
  var MAX_BYTES = 5 * 1024 * 1024;
206148
206373
  function createLogger2(dataRoot) {
206149
- const dir = import_node_path22.default.join(dataRoot, "logs");
206374
+ const dir = import_node_path21.default.join(dataRoot, "logs");
206150
206375
  (0, import_node_fs24.mkdirSync)(dir, { recursive: true });
206151
- const file2 = import_node_path22.default.join(dir, "sidecar.log");
206376
+ const file2 = import_node_path21.default.join(dir, "sidecar.log");
206152
206377
  try {
206153
206378
  if ((0, import_node_fs24.existsSync)(file2) && (0, import_node_fs24.statSync)(file2).size > MAX_BYTES) {
206154
206379
  (0, import_node_fs24.renameSync)(file2, `${file2}.1`);
@@ -206528,7 +206753,7 @@ function applyStandaloneHubConfig() {
206528
206753
  if (!process.env.SLAYZONE_ROOT) {
206529
206754
  process.env.SLAYZONE_ROOT = process.cwd();
206530
206755
  }
206531
- const cfg = loadSlayzoneConfig();
206756
+ const cfg = loadHubConfigFile();
206532
206757
  setIfUnset("SLAYZONE_MODE", cfg.mode);
206533
206758
  setIfUnset(
206534
206759
  "SLAYZONE_HUB_ADDRESS",
@@ -206546,11 +206771,12 @@ function applyStandaloneHubConfig() {
206546
206771
  // src/bin.ts
206547
206772
  async function maybeInteractiveSetup() {
206548
206773
  if (!canPrompt()) return;
206549
- const cfg = loadSlayzoneConfig();
206774
+ const cfg = loadHubConfigFile();
206550
206775
  if ((process.env.SLAYZONE_HUB_PUBLIC_ADDRESS ?? cfg.publicAddress ?? cfg.publicUrl) !== void 0)
206551
206776
  return;
206552
206777
  await runInteractiveConfig({
206553
- title: "Hub setup \u2014 values to save to config.json:",
206778
+ title: "Hub setup \u2014 values to save to hub.config.json:",
206779
+ configPath: getHubConfigFilePath(),
206554
206780
  fields: [
206555
206781
  {
206556
206782
  configKey: "publicAddress",