@slayzone/hub 0.36.0-beta.15 → 0.36.0-beta.16

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
@@ -18724,9 +18724,7 @@ async function acquireLock(lockPath) {
18724
18724
  continue;
18725
18725
  }
18726
18726
  if (Date.now() > deadline) {
18727
- throw new Error(
18728
- `[fs-utils] timed out after ${LOCK_TIMEOUT_MS}ms waiting for ${lockPath}`
18729
- );
18727
+ throw new Error(`[fs-utils] timed out after ${LOCK_TIMEOUT_MS}ms waiting for ${lockPath}`);
18730
18728
  }
18731
18729
  await sleep2(5 + Math.floor(Math.random() * 10));
18732
18730
  }
@@ -22586,7 +22584,7 @@ var require_graceful_fs = __commonJS({
22586
22584
  gracefulQueue = "___graceful-fs.queue";
22587
22585
  previousSymbol = "___graceful-fs.previous";
22588
22586
  }
22589
- function noop7() {
22587
+ function noop8() {
22590
22588
  }
22591
22589
  function publishQueue(context2, queue2) {
22592
22590
  Object.defineProperty(context2, gracefulQueue, {
@@ -22595,7 +22593,7 @@ var require_graceful_fs = __commonJS({
22595
22593
  }
22596
22594
  });
22597
22595
  }
22598
- var debug = noop7;
22596
+ var debug = noop8;
22599
22597
  if (util2.debuglog)
22600
22598
  debug = util2.debuglog("gfs4");
22601
22599
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
@@ -32823,9 +32821,9 @@ var require_Set = __commonJS({
32823
32821
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/noop.js
32824
32822
  var require_noop = __commonJS({
32825
32823
  "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/noop.js"(exports2, module2) {
32826
- function noop7() {
32824
+ function noop8() {
32827
32825
  }
32828
- module2.exports = noop7;
32826
+ module2.exports = noop8;
32829
32827
  }
32830
32828
  });
32831
32829
 
@@ -32847,10 +32845,10 @@ var require_setToArray = __commonJS({
32847
32845
  var require_createSet = __commonJS({
32848
32846
  "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createSet.js"(exports2, module2) {
32849
32847
  var Set2 = require_Set();
32850
- var noop7 = require_noop();
32848
+ var noop8 = require_noop();
32851
32849
  var setToArray = require_setToArray();
32852
32850
  var INFINITY = 1 / 0;
32853
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop7 : function(values) {
32851
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop8 : function(values) {
32854
32852
  return new Set2(values);
32855
32853
  };
32856
32854
  module2.exports = createSet;
@@ -42318,10 +42316,10 @@ var require_streamx = __commonJS({
42318
42316
  this.stream._duplexState |= READ_PIPE_DRAINED;
42319
42317
  this.pipeTo = pipeTo;
42320
42318
  this.pipeline = new Pipeline(this.stream, pipeTo, cb);
42321
- if (cb) this.stream.on("error", noop7);
42319
+ if (cb) this.stream.on("error", noop8);
42322
42320
  if (isStreamx(pipeTo)) {
42323
42321
  pipeTo._writableState.pipeline = this.pipeline;
42324
- if (cb) pipeTo.on("error", noop7);
42322
+ if (cb) pipeTo.on("error", noop8);
42325
42323
  pipeTo.on("finish", this.pipeline.finished.bind(this.pipeline));
42326
42324
  } else {
42327
42325
  const onerror = this.pipeline.done.bind(this.pipeline, pipeTo);
@@ -43042,7 +43040,7 @@ var require_streamx = __commonJS({
43042
43040
  function defaultByteLength(data) {
43043
43041
  return isTypedArray2(data) ? data.byteLength : 1024;
43044
43042
  }
43045
- function noop7() {
43043
+ function noop8() {
43046
43044
  }
43047
43045
  function abort() {
43048
43046
  this.destroy(new Error("Stream aborted."));
@@ -43424,7 +43422,7 @@ var require_extract = __commonJS({
43424
43422
  this._stream = null;
43425
43423
  this._missing = 0;
43426
43424
  this._longHeader = false;
43427
- this._callback = noop7;
43425
+ this._callback = noop8;
43428
43426
  this._locked = false;
43429
43427
  this._finished = false;
43430
43428
  this._pax = null;
@@ -43557,7 +43555,7 @@ var require_extract = __commonJS({
43557
43555
  }
43558
43556
  _continueWrite(err) {
43559
43557
  const cb = this._callback;
43560
- this._callback = noop7;
43558
+ this._callback = noop8;
43561
43559
  cb(err);
43562
43560
  }
43563
43561
  _write(data, cb) {
@@ -43627,7 +43625,7 @@ var require_extract = __commonJS({
43627
43625
  }
43628
43626
  function onentry(header, stream, callback) {
43629
43627
  entryCallback = callback;
43630
- stream.on("error", noop7);
43628
+ stream.on("error", noop8);
43631
43629
  if (promiseResolve) {
43632
43630
  promiseResolve({ value: stream, done: false });
43633
43631
  promiseResolve = promiseReject = null;
@@ -43658,7 +43656,7 @@ var require_extract = __commonJS({
43658
43656
  module2.exports = function extract2(opts) {
43659
43657
  return new Extract(opts);
43660
43658
  };
43661
- function noop7() {
43659
+ function noop8() {
43662
43660
  }
43663
43661
  function overflow(size) {
43664
43662
  size &= 511;
@@ -43786,7 +43784,7 @@ var require_pack = __commonJS({
43786
43784
  var Pack = class extends Readable2 {
43787
43785
  constructor(opts) {
43788
43786
  super(opts);
43789
- this._drain = noop7;
43787
+ this._drain = noop8;
43790
43788
  this._finalized = false;
43791
43789
  this._finalizing = false;
43792
43790
  this._pending = [];
@@ -43798,7 +43796,7 @@ var require_pack = __commonJS({
43798
43796
  callback = buffer;
43799
43797
  buffer = null;
43800
43798
  }
43801
- if (!callback) callback = noop7;
43799
+ if (!callback) callback = noop8;
43802
43800
  if (!header.size || header.type === "symlink") header.size = 0;
43803
43801
  if (!header.type) header.type = modeToType(header.mode);
43804
43802
  if (!header.mode) header.mode = header.type === "directory" ? DMODE : FMODE;
@@ -43873,7 +43871,7 @@ var require_pack = __commonJS({
43873
43871
  }
43874
43872
  _doDrain() {
43875
43873
  const drain = this._drain;
43876
- this._drain = noop7;
43874
+ this._drain = noop8;
43877
43875
  drain();
43878
43876
  }
43879
43877
  _predestroy() {
@@ -43909,7 +43907,7 @@ var require_pack = __commonJS({
43909
43907
  }
43910
43908
  return "file";
43911
43909
  }
43912
- function noop7() {
43910
+ function noop8() {
43913
43911
  }
43914
43912
  function overflow(self2, size) {
43915
43913
  size &= 511;
@@ -142030,7 +142028,8 @@ function coerceHubConfig(raw) {
142030
142028
  if (typeof raw.publicAddress === "string" && raw.publicAddress.length > 0)
142031
142029
  cfg.publicAddress = raw.publicAddress;
142032
142030
  if (raw.mode === "local" || raw.mode === "remote") cfg.mode = raw.mode;
142033
- if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0) cfg.hubName = raw.hubName.trim();
142031
+ if (typeof raw.hubName === "string" && raw.hubName.trim().length > 0)
142032
+ cfg.hubName = raw.hubName.trim();
142034
142033
  if (typeof raw.port === "number" && Number.isInteger(raw.port)) cfg.port = raw.port;
142035
142034
  if (typeof raw.publicUrl === "string" && raw.publicUrl.length > 0) cfg.publicUrl = raw.publicUrl;
142036
142035
  return cfg;
@@ -142174,7 +142173,9 @@ async function runInteractiveConfig(opts) {
142174
142173
  io.write("");
142175
142174
  io.write(opts.title ?? "Configuration to save:");
142176
142175
  for (const { field, config: config3 } of collected) {
142177
- io.write(` ${field.configKey}: ${Array.isArray(config3) ? config3.join(", ") : String(config3)}`);
142176
+ io.write(
142177
+ ` ${field.configKey}: ${Array.isArray(config3) ? config3.join(", ") : String(config3)}`
142178
+ );
142178
142179
  }
142179
142180
  io.write("");
142180
142181
  const saved = await confirm(io, `Save to ${configPath}?`, { defaultYes: true });
@@ -145074,8 +145075,7 @@ function setTaskDeps(deps4) {
145074
145075
  taskOnMutation = deps4.onMutation;
145075
145076
  }
145076
145077
  function getTaskOps() {
145077
- if (!taskOps)
145078
- throw new Error("taskOps not initialized \u2014 call setTaskDeps() in main host first");
145078
+ if (!taskOps) throw new Error("taskOps not initialized \u2014 call setTaskDeps() in main host first");
145079
145079
  return taskOps;
145080
145080
  }
145081
145081
  function getTaskOnMutation() {
@@ -145179,9 +145179,7 @@ function setRunnersDeps(deps4) {
145179
145179
  }
145180
145180
  function getRunnersDeps() {
145181
145181
  if (!runnersDeps)
145182
- throw new Error(
145183
- "runnersDeps not initialized \u2014 composeServer/server host have not wired it yet"
145184
- );
145182
+ throw new Error("runnersDeps not initialized \u2014 composeServer/server host have not wired it yet");
145185
145183
  return runnersDeps;
145186
145184
  }
145187
145185
  function getRunnersDepsOrNull() {
@@ -146208,7 +146206,11 @@ var appLevelRouter = router({
146208
146206
  delete: publicProcedure.input(external_exports.object({ filename: external_exports.string() })).mutation(({ input }) => getBackupOps().delete(input.filename)),
146209
146207
  restore: publicProcedure.input(external_exports.object({ filename: external_exports.string() })).mutation(({ input }) => getBackupOps().restore(input.filename)),
146210
146208
  getSettings: publicProcedure.query(() => getBackupOps().getSettings()),
146211
- setSettings: publicProcedure.input(anyInput).mutation(({ input }) => getBackupOps().setSettings(input)),
146209
+ setSettings: publicProcedure.input(anyInput).mutation(
146210
+ ({ input }) => getBackupOps().setSettings(
146211
+ input
146212
+ )
146213
+ ),
146212
146214
  revealInFinder: publicProcedure.mutation(() => getBackupOps().revealInFinder())
146213
146215
  }),
146214
146216
  // Clipboard
@@ -146309,9 +146311,7 @@ var appLevelRouter = router({
146309
146311
  setLabFlag: publicProcedure.input(external_exports.object({ key: external_exports.enum(["labs_tests_panel", "labs_loop_mode"]), on: external_exports.boolean() })).mutation(({ input }) => getAppDeps().appSetLabFlag(input.key, input.on)),
146310
146312
  isLoopModeEnabled: publicProcedure.query(() => getAppDeps().appIsLoopModeEnabled()),
146311
146313
  getZoomFactor: publicProcedure.query(() => getAppDeps().appGetZoomFactor()),
146312
- getProtocolClientStatus: publicProcedure.query(
146313
- () => getAppDeps().appGetProtocolClientStatus()
146314
- ),
146314
+ getProtocolClientStatus: publicProcedure.query(() => getAppDeps().appGetProtocolClientStatus()),
146315
146315
  getRendererZoomFactor: publicProcedure.query(() => getAppDeps().appGetRendererZoomFactor()),
146316
146316
  checkCliInstalled: publicProcedure.query(() => getAppDeps().appCheckCliInstalled()),
146317
146317
  installCli: publicProcedure.mutation(() => getAppDeps().appInstallCli()),
@@ -146397,7 +146397,9 @@ var appLevelRouter = router({
146397
146397
  removeCss: publicProcedure.input(external_exports.object({ viewId: external_exports.string(), key: external_exports.string() })).mutation(({ input }) => getAppDeps().browser.removeCss(input.viewId, input.key)),
146398
146398
  setZoom: publicProcedure.input(external_exports.object({ viewId: external_exports.string(), factor: external_exports.number() })).mutation(({ input }) => getAppDeps().browser.setZoom(input.viewId, input.factor)),
146399
146399
  focus: publicProcedure.input(external_exports.object({ viewId: external_exports.string() })).mutation(({ input }) => getAppDeps().browser.focus(input.viewId)),
146400
- findInPage: publicProcedure.input(external_exports.object({ viewId: external_exports.string(), text: external_exports.string(), options: anyInput.optional() })).mutation(({ input }) => getAppDeps().browser.findInPage(input.viewId, input.text, input.options)),
146400
+ findInPage: publicProcedure.input(external_exports.object({ viewId: external_exports.string(), text: external_exports.string(), options: anyInput.optional() })).mutation(
146401
+ ({ input }) => getAppDeps().browser.findInPage(input.viewId, input.text, input.options)
146402
+ ),
146401
146403
  stopFindInPage: publicProcedure.input(
146402
146404
  external_exports.object({
146403
146405
  viewId: external_exports.string(),
@@ -146579,7 +146581,11 @@ var appLevelRouter = router({
146579
146581
  ),
146580
146582
  claimAndCloseOther: publicProcedure.input(external_exports.object({ taskId: external_exports.string(), panelId: external_exports.string() })).mutation(({ ctx, input }) => {
146581
146583
  if (ctx.windowId == null) throw new Error("windowId required");
146582
- return getAppDeps().taskWindows.claimAndCloseOther(input.taskId, input.panelId, ctx.windowId);
146584
+ return getAppDeps().taskWindows.claimAndCloseOther(
146585
+ input.taskId,
146586
+ input.panelId,
146587
+ ctx.windowId
146588
+ );
146583
146589
  }),
146584
146590
  claimSession: publicProcedure.input(external_exports.object({ sessionId: external_exports.string() })).mutation(({ ctx, input }) => {
146585
146591
  if (ctx.windowId == null) throw new Error("windowId required");
@@ -156526,24 +156532,21 @@ function createArtifactStore(dataDir) {
156526
156532
  ]) {
156527
156533
  if (data[key] !== void 0) setKeys.push(key);
156528
156534
  }
156529
- const row = await db.namedTxn(
156530
- "task-artifacts:update",
156531
- {
156532
- dataDir,
156533
- id: data.id,
156534
- mutateVersion: data.mutateVersion,
156535
- title: data.title,
156536
- folderId: data.folderId,
156537
- renderMode: data.renderMode,
156538
- viewMode: data.viewMode,
156539
- readabilityOverride: data.readabilityOverride,
156540
- widthOverride: data.widthOverride,
156541
- zoomPct: data.zoomPct,
156542
- language: data.language,
156543
- content: data.content,
156544
- setKeys
156545
- }
156546
- );
156535
+ const row = await db.namedTxn("task-artifacts:update", {
156536
+ dataDir,
156537
+ id: data.id,
156538
+ mutateVersion: data.mutateVersion,
156539
+ title: data.title,
156540
+ folderId: data.folderId,
156541
+ renderMode: data.renderMode,
156542
+ viewMode: data.viewMode,
156543
+ readabilityOverride: data.readabilityOverride,
156544
+ widthOverride: data.widthOverride,
156545
+ zoomPct: data.zoomPct,
156546
+ language: data.language,
156547
+ content: data.content,
156548
+ setKeys
156549
+ });
156547
156550
  if (row === null) return null;
156548
156551
  return parseArtifact(row ?? void 0);
156549
156552
  },
@@ -156761,23 +156764,22 @@ function createArtifactStore(dataDir) {
156761
156764
  return rows.map(parseFolder).filter(Boolean);
156762
156765
  },
156763
156766
  async getOrCreateFolderByName(db, data) {
156764
- const row = await db.namedTxn(
156765
- "task-artifacts:folders:getOrCreateByName",
156766
- { taskId: data.taskId, name: data.name }
156767
- );
156767
+ const row = await db.namedTxn("task-artifacts:folders:getOrCreateByName", {
156768
+ taskId: data.taskId,
156769
+ name: data.name
156770
+ });
156768
156771
  return parseFolder(row);
156769
156772
  },
156770
156773
  async createFolder(db, data) {
156771
- const row = await db.namedTxn(
156772
- "task-artifacts:folders:create",
156773
- { taskId: data.taskId, parentId: data.parentId ?? null, name: data.name }
156774
- );
156774
+ const row = await db.namedTxn("task-artifacts:folders:create", {
156775
+ taskId: data.taskId,
156776
+ parentId: data.parentId ?? null,
156777
+ name: data.name
156778
+ });
156775
156779
  return parseFolder(row);
156776
156780
  },
156777
156781
  async updateFolder(db, data) {
156778
- const existing = await db.prepare("SELECT * FROM artifact_folders WHERE id = ?").get(
156779
- data.id
156780
- );
156782
+ const existing = await db.prepare("SELECT * FROM artifact_folders WHERE id = ?").get(data.id);
156781
156783
  if (!existing) return null;
156782
156784
  const sets = [];
156783
156785
  const values = [];
@@ -156840,9 +156842,7 @@ async function downloadArtifactFile(host, db, dataDir, id) {
156840
156842
  }
156841
156843
  async function downloadArtifactFolder(host, db, dataDir, folderId) {
156842
156844
  const store4 = createArtifactStore(dataDir);
156843
- const folder = await db.prepare("SELECT * FROM artifact_folders WHERE id = ?").get(
156844
- folderId
156845
- );
156845
+ const folder = await db.prepare("SELECT * FROM artifact_folders WHERE id = ?").get(folderId);
156846
156846
  if (!folder) return false;
156847
156847
  const result = await host.showOpenDialog({
156848
156848
  title: "Download Folder To",
@@ -156864,7 +156864,11 @@ async function downloadArtifactFolder(host, db, dataDir, folderId) {
156864
156864
  "SELECT * FROM task_artifacts WHERE task_id = ? AND folder_id IN (" + [...targetIds].map(() => "?").join(",") + ")"
156865
156865
  ).all(taskId, ...targetIds);
156866
156866
  for (const artifact of artifacts) {
156867
- const srcPath = store4.getArtifactFilePath(taskId, artifact.id, artifact.title);
156867
+ const srcPath = store4.getArtifactFilePath(
156868
+ taskId,
156869
+ artifact.id,
156870
+ artifact.title
156871
+ );
156868
156872
  if (!(0, import_fs6.existsSync)(srcPath)) continue;
156869
156873
  const folderRel = rootParentPath === "." ? folderPath(artifact.folder_id) : import_path9.default.relative(rootParentPath, folderPath(artifact.folder_id));
156870
156874
  (0, import_fs6.copyFileSync)(srcPath, import_path9.default.join(destRoot, folderRel, artifact.title));
@@ -156940,7 +156944,11 @@ async function downloadAllArtifactsAsZip(host, db, dataDir, taskId) {
156940
156944
  const archive2 = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
156941
156945
  archive2.pipe(output);
156942
156946
  for (const artifact of allArtifacts) {
156943
- const srcPath = store4.getArtifactFilePath(taskId, artifact.id, artifact.title);
156947
+ const srcPath = store4.getArtifactFilePath(
156948
+ taskId,
156949
+ artifact.id,
156950
+ artifact.title
156951
+ );
156944
156952
  if (!(0, import_fs6.existsSync)(srcPath)) continue;
156945
156953
  const folderId = artifact.folder_id;
156946
156954
  const rel = folderId ? import_path9.default.join(folderPath(folderId), artifact.title) : artifact.title;
@@ -157008,11 +157016,7 @@ async function recordConversation(db, args) {
157008
157016
  json_set(coalesce(provider_config, '{}'), ?, NULL),
157009
157017
  ?, NULL)
157010
157018
  WHERE id = ?`,
157011
- params: [
157012
- `$."${mode}".conversationId`,
157013
- `$."${mode}".chatConversationId`,
157014
- taskId
157015
- ]
157019
+ params: [`$."${mode}".conversationId`, `$."${mode}".chatConversationId`, taskId]
157016
157020
  });
157017
157021
  const legacyCol = MODE_LEGACY_COL[mode];
157018
157022
  if (legacyCol) {
@@ -157315,10 +157319,10 @@ async function confirmSessionConversation(db, args) {
157315
157319
  return origin;
157316
157320
  }
157317
157321
  async function markSessionDead(db, sessionId) {
157318
- await db.run(
157319
- `UPDATE agent_sessions SET status = 'dead', ended_at = ? WHERE id = ?`,
157320
- [Date.now(), sessionId]
157321
- );
157322
+ await db.run(`UPDATE agent_sessions SET status = 'dead', ended_at = ? WHERE id = ?`, [
157323
+ Date.now(),
157324
+ sessionId
157325
+ ]);
157322
157326
  }
157323
157327
  async function bindSessionToTask(db, args) {
157324
157328
  const res = await db.run(
@@ -160145,7 +160149,9 @@ var AntigravityAdapter = class _AntigravityAdapter {
160145
160149
  }
160146
160150
  detectError(data) {
160147
160151
  const stripped = _AntigravityAdapter.stripAnsi(data);
160148
- if (/ANTIGRAVITY_TOKEN environment variable not found|not (?:logged in|authenticated)/i.test(stripped)) {
160152
+ if (/ANTIGRAVITY_TOKEN environment variable not found|not (?:logged in|authenticated)/i.test(
160153
+ stripped
160154
+ )) {
160149
160155
  return {
160150
160156
  code: "MISSING_API_KEY",
160151
160157
  message: "Antigravity not authenticated (ANTIGRAVITY_TOKEN not set / signed out)",
@@ -160527,7 +160533,8 @@ async function readClaudeTranscriptMeta(filePath, maxLines = 200) {
160527
160533
  continue;
160528
160534
  }
160529
160535
  if (meta3.cwd == null && typeof rec.cwd === "string") meta3.cwd = rec.cwd;
160530
- if (meta3.gitBranch == null && typeof rec.gitBranch === "string") meta3.gitBranch = rec.gitBranch;
160536
+ if (meta3.gitBranch == null && typeof rec.gitBranch === "string")
160537
+ meta3.gitBranch = rec.gitBranch;
160531
160538
  if (meta3.firstTsMs == null && typeof rec.timestamp === "string") {
160532
160539
  const t3 = Date.parse(rec.timestamp);
160533
160540
  if (!Number.isNaN(t3)) meta3.firstTsMs = t3;
@@ -161726,7 +161733,13 @@ var CodexChatSession = class {
161726
161733
  }
161727
161734
  /** Codex tool-ish completed items → `tool-result`. Returns null otherwise. */
161728
161735
  toToolResult(item) {
161729
- const toolTypes = ["commandExecution", "fileChange", "mcpToolCall", "dynamicToolCall", "webSearch"];
161736
+ const toolTypes = [
161737
+ "commandExecution",
161738
+ "fileChange",
161739
+ "mcpToolCall",
161740
+ "dynamicToolCall",
161741
+ "webSearch"
161742
+ ];
161730
161743
  if (!toolTypes.includes(item.type)) return null;
161731
161744
  const status = typeof item.status === "string" ? item.status : "";
161732
161745
  const isError2 = status === "failed" || status === "declined" || item.success === false;
@@ -161888,10 +161901,11 @@ function getPtyHostBridge() {
161888
161901
  return bridge;
161889
161902
  }
161890
161903
  function onPtyHostBus(channel, listener) {
161904
+ const opaque = listener;
161891
161905
  if (configured) {
161892
- bridge.bus.on(channel, listener);
161906
+ bridge.bus.on(channel, opaque);
161893
161907
  } else {
161894
- pendingBusSubs.push([channel, listener]);
161908
+ pendingBusSubs.push([channel, opaque]);
161895
161909
  }
161896
161910
  }
161897
161911
 
@@ -161952,6 +161966,9 @@ async function buildMcpEnv(db, taskId, mode, sessionId, projectId, remote) {
161952
161966
  return env2;
161953
161967
  }
161954
161968
  const serverPort = globalThis.__serverPort;
161969
+ if (serverPort) {
161970
+ env2.SLAYZONE_HUB_ADDRESS = `127.0.0.1:${serverPort}`;
161971
+ }
161955
161972
  if (serverPort && hookCapable) {
161956
161973
  env2.SLAYZONE_AGENT_HOOK_URL = `http://127.0.0.1:${serverPort}${AGENT_HOOK_PATH}`;
161957
161974
  setHookIdentity();
@@ -161969,26 +161986,27 @@ function createDbPtySessionLedger(db) {
161969
161986
  };
161970
161987
  }
161971
161988
  function mapModeRow(row) {
161989
+ const r = row;
161972
161990
  let usageConfig = null;
161973
- if (row.usage_config) {
161991
+ if (r.usage_config) {
161974
161992
  try {
161975
- usageConfig = JSON.parse(row.usage_config);
161993
+ usageConfig = JSON.parse(r.usage_config);
161976
161994
  } catch {
161977
161995
  }
161978
161996
  }
161979
161997
  return {
161980
- id: row.id,
161981
- label: row.label,
161982
- type: row.type,
161983
- initialCommand: row.initial_command,
161984
- resumeCommand: row.resume_command,
161985
- headlessCommand: row.headless_command ?? null,
161986
- defaultFlags: row.default_flags,
161987
- enabled: Boolean(row.enabled),
161988
- isBuiltin: Boolean(row.is_builtin),
161989
- order: row.order,
161990
- patternWorking: row.pattern_working,
161991
- patternError: row.pattern_error,
161998
+ id: r.id,
161999
+ label: r.label,
162000
+ type: r.type,
162001
+ initialCommand: r.initial_command,
162002
+ resumeCommand: r.resume_command,
162003
+ headlessCommand: r.headless_command ?? null,
162004
+ defaultFlags: r.default_flags,
162005
+ enabled: Boolean(r.enabled),
162006
+ isBuiltin: Boolean(r.is_builtin),
162007
+ order: r.order,
162008
+ patternWorking: r.pattern_working,
162009
+ patternError: r.pattern_error,
161992
162010
  usageConfig
161993
162011
  };
161994
162012
  }
@@ -162190,7 +162208,8 @@ var StateMachine = class {
162190
162208
  unregister(sessionId) {
162191
162209
  const pending = this.sessions.get(sessionId)?.pendingTarget ?? null;
162192
162210
  this.clearTimer(sessionId);
162193
- if (pending) this.onTrace?.({ kind: "canceled", sessionId, canceledTarget: pending, reason: "unregister" });
162211
+ if (pending)
162212
+ this.onTrace?.({ kind: "canceled", sessionId, canceledTarget: pending, reason: "unregister" });
162194
162213
  this.sessions.delete(sessionId);
162195
162214
  }
162196
162215
  getState(sessionId) {
@@ -162200,10 +162219,21 @@ var StateMachine = class {
162200
162219
  const session = this.sessions.get(sessionId);
162201
162220
  if (!session) return;
162202
162221
  const hadPending = session.pendingTarget;
162203
- this.onTrace?.({ kind: "request", sessionId, fromState: session.state, toState: newState, hadPending });
162222
+ this.onTrace?.({
162223
+ kind: "request",
162224
+ sessionId,
162225
+ fromState: session.state,
162226
+ toState: newState,
162227
+ hadPending
162228
+ });
162204
162229
  if (hadPending) {
162205
162230
  this.clearTimer(sessionId);
162206
- this.onTrace?.({ kind: "canceled", sessionId, canceledTarget: hadPending, reason: "new_request" });
162231
+ this.onTrace?.({
162232
+ kind: "canceled",
162233
+ sessionId,
162234
+ canceledTarget: hadPending,
162235
+ reason: "new_request"
162236
+ });
162207
162237
  }
162208
162238
  if (session.state === newState) {
162209
162239
  this.onTrace?.({ kind: "skipped_same", sessionId, state: session.state });
@@ -162216,7 +162246,13 @@ var StateMachine = class {
162216
162246
  this.onChange(sessionId, newState, oldState);
162217
162247
  } else {
162218
162248
  session.pendingTarget = newState;
162219
- this.onTrace?.({ kind: "queued", sessionId, fromState: session.state, toState: newState, debounceMs: DEBOUNCE_DEFAULT });
162249
+ this.onTrace?.({
162250
+ kind: "queued",
162251
+ sessionId,
162252
+ fromState: session.state,
162253
+ toState: newState,
162254
+ debounceMs: DEBOUNCE_DEFAULT
162255
+ });
162220
162256
  this.timers.set(
162221
162257
  sessionId,
162222
162258
  setTimeout(() => {
@@ -162244,7 +162280,8 @@ var StateMachine = class {
162244
162280
  for (const [sessionId, timer] of this.timers.entries()) {
162245
162281
  clearTimeout(timer);
162246
162282
  const pending = this.sessions.get(sessionId)?.pendingTarget ?? null;
162247
- if (pending) this.onTrace?.({ kind: "canceled", sessionId, canceledTarget: pending, reason: "dispose" });
162283
+ if (pending)
162284
+ this.onTrace?.({ kind: "canceled", sessionId, canceledTarget: pending, reason: "dispose" });
162248
162285
  }
162249
162286
  this.timers.clear();
162250
162287
  this.sessions.clear();
@@ -162451,8 +162488,11 @@ function createLineSplitter(onLine) {
162451
162488
  }
162452
162489
  function childProcessToHandle(child) {
162453
162490
  const attach = (stream, cb) => {
162454
- if (!stream) return { dispose: () => {
162455
- } };
162491
+ if (!stream)
162492
+ return {
162493
+ dispose: () => {
162494
+ }
162495
+ };
162456
162496
  const listener = (c) => cb(typeof c === "string" ? c : c.toString());
162457
162497
  stream.on("data", listener);
162458
162498
  return {
@@ -163742,8 +163782,14 @@ async function createPty(opts) {
163742
163782
  return { success: false, error: "Cannot create PTY while app is shutting down." };
163743
163783
  }
163744
163784
  const getWin = () => sessions2.get(sessionId)?.win ?? originalWin;
163745
- sessionTaskMap.set(sessionId, opts.taskId !== void 0 ? opts.taskId ?? "" : splitTaskId(sessionId));
163746
- sessionTabMap.set(sessionId, opts.tabId !== void 0 ? opts.tabId ?? "" : splitTabRowId(sessionId));
163785
+ sessionTaskMap.set(
163786
+ sessionId,
163787
+ opts.taskId !== void 0 ? opts.taskId ?? "" : splitTaskId(sessionId)
163788
+ );
163789
+ sessionTabMap.set(
163790
+ sessionId,
163791
+ opts.tabId !== void 0 ? opts.tabId ?? "" : splitTabRowId(sessionId)
163792
+ );
163747
163793
  const taskId = taskIdFromSessionId(sessionId);
163748
163794
  const runnerId = opts.runnerId ?? null;
163749
163795
  const createStartedAt = Date.now();
@@ -164011,6 +164057,8 @@ async function createPty(opts) {
164011
164057
  }
164012
164058
  }
164013
164059
  const shellSpawnMs = Date.now() - spawnStartTs;
164060
+ const spawnConfirmation = ptyProcess.whenSpawned;
164061
+ const isHubLocalProcess = runnerId == null && !opts.adoptPty;
164014
164062
  sessions2.set(sessionId, {
164015
164063
  win: originalWin,
164016
164064
  pty: ptyProcess,
@@ -164107,6 +164155,12 @@ async function createPty(opts) {
164107
164155
  clearStartupTimeout();
164108
164156
  clearEarlyExitWatchdog();
164109
164157
  const exitSession = sessions2.get(sessionId);
164158
+ if (exitSession) {
164159
+ try {
164160
+ exitSession.pty.kill();
164161
+ } catch {
164162
+ }
164163
+ }
164110
164164
  if (exitSession?.sessionIdAutoDetectTimer) {
164111
164165
  clearTimeout(exitSession.sessionIdAutoDetectTimer);
164112
164166
  }
@@ -164155,7 +164209,12 @@ async function createPty(opts) {
164155
164209
  } catch {
164156
164210
  }
164157
164211
  try {
164158
- exitWin.webContents.send("pty:exit", sessionId, exitCode, exitSession?.error?.code ?? null);
164212
+ exitWin.webContents.send(
164213
+ "pty:exit",
164214
+ sessionId,
164215
+ exitCode,
164216
+ exitSession?.error?.code ?? null
164217
+ );
164159
164218
  } catch {
164160
164219
  }
164161
164220
  }
@@ -164516,7 +164575,11 @@ async function createPty(opts) {
164516
164575
  if (resuming && !session.error) {
164517
164576
  const transcriptGone = terminalMode === "claude-code" && exitCode !== 0 && !!resolvedExistingId && !claudeTranscriptExists(cwd, resolvedExistingId);
164518
164577
  if (transcriptGone) {
164519
- session.error = { code: "SESSION_NOT_FOUND", message: "Session not found", recoverable: false };
164578
+ session.error = {
164579
+ code: "SESSION_NOT_FOUND",
164580
+ message: "Session not found",
164581
+ recoverable: false
164582
+ };
164520
164583
  } else {
164521
164584
  const scanned = session.adapter.detectError(session.buffer.toString());
164522
164585
  if (scanned) session.error = scanned;
@@ -164627,36 +164690,69 @@ async function createPty(opts) {
164627
164690
  armStartupTimeout(ptyProcess);
164628
164691
  schedulePostSpawnCommand(ptyProcess);
164629
164692
  startTitlePolling(sessions2.get(sessionId), ptyProcess);
164630
- earlyExitWatchdog = setTimeout(() => {
164631
- const session = sessions2.get(sessionId);
164632
- if (!session || firstOutputTs !== null) return;
164633
- const pid = session.pty.pid;
164634
- if (typeof pid !== "number" || pid <= 0) {
164635
- recordDiagnosticEvent({
164636
- level: "warn",
164637
- source: "pty",
164638
- event: "pty.missed_exit_recovered",
164639
- sessionId,
164640
- taskId: taskIdFromSessionId(sessionId),
164641
- payload: { reason: "invalid_pid" }
164642
- });
164643
- finalizeSessionExit(-1);
164644
- return;
164645
- }
164646
- try {
164647
- process.kill(pid, 0);
164648
- } catch {
164649
- recordDiagnosticEvent({
164650
- level: "warn",
164651
- source: "pty",
164652
- event: "pty.missed_exit_recovered",
164653
- sessionId,
164654
- taskId: taskIdFromSessionId(sessionId),
164655
- payload: { reason: "pid_not_running", pid }
164656
- });
164657
- finalizeSessionExit(-1);
164658
- }
164659
- }, 300);
164693
+ if (spawnConfirmation) {
164694
+ void spawnConfirmation.then(
164695
+ ({ pid }) => {
164696
+ const session = sessions2.get(sessionId);
164697
+ if (!session || session.pty !== ptyProcess || finalized) return;
164698
+ if (typeof pid === "number" && pid > 0) return;
164699
+ recordDiagnosticEvent({
164700
+ level: "warn",
164701
+ source: "pty",
164702
+ event: "pty.missed_exit_recovered",
164703
+ sessionId,
164704
+ taskId: taskIdFromSessionId(sessionId),
164705
+ payload: { reason: "confirmed_without_pid" }
164706
+ });
164707
+ finalizeSessionExit(-1);
164708
+ },
164709
+ (err) => {
164710
+ const session = sessions2.get(sessionId);
164711
+ if (!session || session.pty !== ptyProcess || finalized) return;
164712
+ recordDiagnosticEvent({
164713
+ level: "warn",
164714
+ source: "pty",
164715
+ event: "pty.missed_exit_recovered",
164716
+ sessionId,
164717
+ taskId: taskIdFromSessionId(sessionId),
164718
+ message: err instanceof Error ? err.message : String(err),
164719
+ payload: { reason: "spawn_refused" }
164720
+ });
164721
+ finalizeSessionExit(-1);
164722
+ }
164723
+ );
164724
+ } else if (isHubLocalProcess) {
164725
+ earlyExitWatchdog = setTimeout(() => {
164726
+ const session = sessions2.get(sessionId);
164727
+ if (!session || firstOutputTs !== null) return;
164728
+ const pid = session.pty.pid;
164729
+ if (typeof pid !== "number" || pid <= 0) {
164730
+ recordDiagnosticEvent({
164731
+ level: "warn",
164732
+ source: "pty",
164733
+ event: "pty.missed_exit_recovered",
164734
+ sessionId,
164735
+ taskId: taskIdFromSessionId(sessionId),
164736
+ payload: { reason: "invalid_pid" }
164737
+ });
164738
+ finalizeSessionExit(-1);
164739
+ return;
164740
+ }
164741
+ try {
164742
+ process.kill(pid, 0);
164743
+ } catch {
164744
+ recordDiagnosticEvent({
164745
+ level: "warn",
164746
+ source: "pty",
164747
+ event: "pty.missed_exit_recovered",
164748
+ sessionId,
164749
+ taskId: taskIdFromSessionId(sessionId),
164750
+ payload: { reason: "pid_not_running", pid }
164751
+ });
164752
+ finalizeSessionExit(-1);
164753
+ }
164754
+ }, 300);
164755
+ }
164660
164756
  if (resuming) {
164661
164757
  setTimeout(() => {
164662
164758
  const session = sessions2.get(sessionId);
@@ -164928,9 +165024,7 @@ onPtyHostBus(
164928
165024
  );
164929
165025
  var ENSURE_ALIVE_RETRY_MS = 250;
164930
165026
  function requestEnsureAlive(taskId, opts) {
164931
- const liveWindow = mainWindow && !mainWindow.isDestroyed() ? mainWindow : getPtyHostBridge().getAllWindows().find(
164932
- (w) => !w.isDestroyed() && !w.webContents.getURL().startsWith("data:")
164933
- ) ?? null;
165027
+ const liveWindow = mainWindow && !mainWindow.isDestroyed() ? mainWindow : getPtyHostBridge().getAllWindows().find((w) => !w.isDestroyed() && !w.webContents.getURL().startsWith("data:")) ?? null;
164934
165028
  if (!liveWindow) return Promise.resolve("no-window");
164935
165029
  recordDiagnosticEvent({
164936
165030
  level: "info",
@@ -167698,6 +167792,7 @@ SUMMARY: <2-3 sentences explaining what each branch changed and why they conflic
167698
167792
  }
167699
167793
 
167700
167794
  // ../../domains/task/src/server/ops/shared.ts
167795
+ var TASK_ORDER_BY = `ORDER BY t."order" ASC, t.created_at DESC, t.rowid DESC`;
167701
167796
  var defaultWorktreeExecAdapters = {
167702
167797
  // The in-process impls run on the hub, so they IGNORE `taskId` — it exists only
167703
167798
  // so a routing impl can resolve which runner the work belongs to.
@@ -168020,7 +168115,13 @@ async function createWorktreeForTask(db, taskId, projectId, taskTitle, repoName)
168020
168115
  const parentBranch = await runtimeAdapters.worktrees.getCurrentBranch(taskId, repoPath);
168021
168116
  const sourceBranch = projectRow.worktree_source_branch ?? void 0;
168022
168117
  try {
168023
- await runtimeAdapters.worktrees.createWorktree(taskId, repoPath, worktreePath, branch, sourceBranch);
168118
+ await runtimeAdapters.worktrees.createWorktree(
168119
+ taskId,
168120
+ repoPath,
168121
+ worktreePath,
168122
+ branch,
168123
+ sourceBranch
168124
+ );
168024
168125
  } catch (err) {
168025
168126
  if (await runtimeAdapters.worktrees.pathExists(taskId, worktreePath)) {
168026
168127
  await db.run(
@@ -168091,7 +168192,12 @@ async function createWorktreeForTask(db, taskId, projectId, taskTitle, repoName)
168091
168192
  payload: { worktreePath }
168092
168193
  });
168093
168194
  }
168094
- void runtimeAdapters.worktrees.runWorktreeSetupScript(taskId, worktreePath, repoPath, sourceBranch);
168195
+ void runtimeAdapters.worktrees.runWorktreeSetupScript(
168196
+ taskId,
168197
+ worktreePath,
168198
+ repoPath,
168199
+ sourceBranch
168200
+ );
168095
168201
  }
168096
168202
  async function updateTask(db, data) {
168097
168203
  const existing = await db.get(
@@ -168304,10 +168410,7 @@ async function updateTask(db, data) {
168304
168410
  merged[data.terminalMode] = { ...merged[data.terminalMode], flags: defaultFlags };
168305
168411
  }
168306
168412
  }
168307
- const modesToCompare = /* @__PURE__ */ new Set([
168308
- ...Object.keys(current),
168309
- ...Object.keys(merged)
168310
- ]);
168413
+ const modesToCompare = /* @__PURE__ */ new Set([...Object.keys(current), ...Object.keys(merged)]);
168311
168414
  for (const m of modesToCompare) {
168312
168415
  const oldId = current[m]?.conversationId ?? null;
168313
168416
  const newId = merged[m]?.conversationId ?? null;
@@ -168520,9 +168623,10 @@ async function updateTask(db, data) {
168520
168623
  runtimeAdapters.killPtysByTaskId(data.id);
168521
168624
  }
168522
168625
  if (reachedTerminal && !fields.some((f) => f.startsWith("snoozed_until"))) {
168523
- await db.run("UPDATE tasks SET snoozed_until = NULL WHERE id = ? AND snoozed_until IS NOT NULL", [
168524
- data.id
168525
- ]);
168626
+ await db.run(
168627
+ "UPDATE tasks SET snoozed_until = NULL WHERE id = ? AND snoozed_until IS NOT NULL",
168628
+ [data.id]
168629
+ );
168526
168630
  }
168527
168631
  if (revived) {
168528
168632
  runtimeAdapters.requestPtyRespawn(data.id);
@@ -168538,7 +168642,7 @@ async function getAllTasksOp(db) {
168538
168642
  FROM tasks t
168539
168643
  LEFT JOIN external_links el ON el.task_id = t.id AND el.provider = 'linear'
168540
168644
  WHERE t.deleted_at IS NULL
168541
- ORDER BY t."order" ASC, t.created_at DESC`
168645
+ ${TASK_ORDER_BY}`
168542
168646
  );
168543
168647
  return parseAndColorTasks(db, rows);
168544
168648
  }
@@ -168550,7 +168654,7 @@ async function getByProjectOp(db, projectId) {
168550
168654
  FROM tasks t
168551
168655
  LEFT JOIN external_links el ON el.task_id = t.id AND el.provider = 'linear'
168552
168656
  WHERE t.project_id = ? AND t.archived_at IS NULL AND t.deleted_at IS NULL
168553
- ORDER BY t."order" ASC, t.created_at DESC`,
168657
+ ${TASK_ORDER_BY}`,
168554
168658
  [projectId]
168555
168659
  );
168556
168660
  return parseAndColorTasks(db, rows);
@@ -168621,7 +168725,9 @@ async function insertTaskRow(db, row) {
168621
168725
  priority: row.priority
168622
168726
  });
168623
168727
  await db.namedTxn("task:insert-row", { insertSql: INSERT_SQL, insertParams, events });
168624
- const fetched = await db.get("SELECT * FROM tasks WHERE id = ?", [row.id]);
168728
+ const fetched = await db.get("SELECT * FROM tasks WHERE id = ?", [
168729
+ row.id
168730
+ ]);
168625
168731
  return parseTask(fetched);
168626
168732
  }
168627
168733
 
@@ -168702,13 +168808,7 @@ async function createTaskOp(db, data, deps4) {
168702
168808
  SET repo_name = ?, worktree_path = ?, worktree_parent_branch = ?, base_dir = ?, updated_at = datetime('now')
168703
168809
  WHERE id = ?
168704
168810
  `,
168705
- [
168706
- parent.repo_name,
168707
- parent.worktree_path,
168708
- parent.worktree_parent_branch,
168709
- parent.base_dir,
168710
- id
168711
- ]
168811
+ [parent.repo_name, parent.worktree_path, parent.worktree_parent_branch, parent.base_dir, id]
168712
168812
  );
168713
168813
  }
168714
168814
  } else {
@@ -168773,7 +168873,7 @@ async function getSubTasksOp(db, parentId) {
168773
168873
  FROM tasks t
168774
168874
  LEFT JOIN external_links el ON el.task_id = t.id AND el.provider = 'linear'
168775
168875
  WHERE t.parent_id = ? AND t.archived_at IS NULL AND t.deleted_at IS NULL
168776
- ORDER BY t."order" ASC, t.created_at DESC`,
168876
+ ${TASK_ORDER_BY}`,
168777
168877
  [parentId]
168778
168878
  );
168779
168879
  return parseAndColorTasks(db, rows);
@@ -168806,7 +168906,9 @@ async function updateTaskOp(db, data, deps4) {
168806
168906
  // ../../domains/task/src/server/ops/delete.ts
168807
168907
  async function deleteTaskOp(db, id, deps4) {
168808
168908
  const { ipcMain, onMutation } = deps4;
168809
- const previousRow = await db.get("SELECT * FROM tasks WHERE id = ?", [id]);
168909
+ const previousRow = await db.get("SELECT * FROM tasks WHERE id = ?", [
168910
+ id
168911
+ ]);
168810
168912
  const previousTask = parseTask(previousRow);
168811
168913
  const linkCount = (await db.get(
168812
168914
  "SELECT COUNT(*) as count FROM external_links WHERE task_id = ?",
@@ -169127,10 +169229,10 @@ async function getBlockingOp(db, taskId) {
169127
169229
 
169128
169230
  // ../../domains/task/src/server/ops/deps-add-blocker.ts
169129
169231
  async function addBlockerOp(db, taskId, blockerTaskId) {
169130
- await db.run(
169131
- "INSERT OR IGNORE INTO task_dependencies (task_id, blocks_task_id) VALUES (?, ?)",
169132
- [blockerTaskId, taskId]
169133
- );
169232
+ await db.run("INSERT OR IGNORE INTO task_dependencies (task_id, blocks_task_id) VALUES (?, ?)", [
169233
+ blockerTaskId,
169234
+ taskId
169235
+ ]);
169134
169236
  }
169135
169237
 
169136
169238
  // ../../domains/task/src/server/ops/deps-remove-blocker.ts
@@ -169144,7 +169246,11 @@ async function removeBlockerOp(db, taskId, blockerTaskId) {
169144
169246
  // ../../domains/task/src/server/ops/deps-set-blockers.ts
169145
169247
  async function setBlockersOp(db, taskId, blockerTaskIds) {
169146
169248
  const ops4 = [
169147
- { type: "run", sql: "DELETE FROM task_dependencies WHERE blocks_task_id = ?", params: [taskId] },
169249
+ {
169250
+ type: "run",
169251
+ sql: "DELETE FROM task_dependencies WHERE blocks_task_id = ?",
169252
+ params: [taskId]
169253
+ },
169148
169254
  ...blockerTaskIds.map(
169149
169255
  (blockerTaskId) => ({
169150
169256
  type: "run",
@@ -169344,9 +169450,7 @@ async function uploadProjectIcon(db, iconsDir2, projectId, sourcePath) {
169344
169450
  }
169345
169451
  async function reorderProjects(db, projectIds) {
169346
169452
  if (!Array.isArray(projectIds) || projectIds.length === 0) return;
169347
- const { count } = await db.get(
169348
- "SELECT COUNT(*) AS count FROM projects"
169349
- );
169453
+ const { count } = await db.get("SELECT COUNT(*) AS count FROM projects");
169350
169454
  if (projectIds.length !== count)
169351
169455
  throw new Error(`Expected ${count} project IDs, got ${projectIds.length}`);
169352
169456
  await db.batchTxn(
@@ -169479,7 +169583,7 @@ async function loadBoardDataOp(db) {
169479
169583
  FROM tasks t
169480
169584
  LEFT JOIN external_links el ON el.task_id = t.id AND el.provider = 'linear'
169481
169585
  WHERE t.deleted_at IS NULL
169482
- ORDER BY t."order" ASC, t.created_at DESC`
169586
+ ${TASK_ORDER_BY}`
169483
169587
  );
169484
169588
  const projectRows = await db.all(
169485
169589
  "SELECT * FROM projects ORDER BY sort_order"
@@ -169512,9 +169616,7 @@ async function loadBoardDataOp(db) {
169512
169616
  var LEGACY_COLS = ["claude", "codex", "cursor", "gemini", "opencode"];
169513
169617
  async function collectReferencedConversationIds(db) {
169514
169618
  const cols = LEGACY_COLS.map((c) => `${c}_conversation_id`).join(", ");
169515
- const rows = await db.all(
169516
- `SELECT provider_config, ${cols} FROM tasks`
169517
- );
169619
+ const rows = await db.all(`SELECT provider_config, ${cols} FROM tasks`);
169518
169620
  const ids = /* @__PURE__ */ new Set();
169519
169621
  for (const row of rows) {
169520
169622
  for (const c of LEGACY_COLS) {
@@ -170074,13 +170176,7 @@ async function listActivityEventsForTask(db, taskId, options = {}) {
170074
170176
  ORDER BY created_at DESC, id DESC
170075
170177
  LIMIT ?
170076
170178
  `,
170077
- [
170078
- taskId,
170079
- options.before.createdAt,
170080
- options.before.createdAt,
170081
- options.before.id,
170082
- limit + 1
170083
- ]
170179
+ [taskId, options.before.createdAt, options.before.createdAt, options.before.id, limit + 1]
170084
170180
  ) : await db.all(
170085
170181
  `
170086
170182
  SELECT *
@@ -170166,10 +170262,9 @@ var AutomationEngine = class {
170166
170262
  taskEvents.on("task:updated", ({ taskId, projectId, oldStatus }) => {
170167
170263
  if (oldStatus === void 0) return;
170168
170264
  void (async () => {
170169
- const row = await this.db.get(
170170
- "SELECT status FROM tasks WHERE id = ?",
170171
- [taskId]
170172
- );
170265
+ const row = await this.db.get("SELECT status FROM tasks WHERE id = ?", [
170266
+ taskId
170267
+ ]);
170173
170268
  if (!row) return;
170174
170269
  if (oldStatus === row.status) return;
170175
170270
  await this.handleEvent({
@@ -170192,7 +170287,8 @@ var AutomationEngine = class {
170192
170287
  await this.handleEvent({ type: "task_archived", taskId, projectId, depth: 0 });
170193
170288
  })();
170194
170289
  });
170195
- bus.on("db:taskTags:setForTask:done", (_event, taskId, tagIds) => {
170290
+ bus.on("db:taskTags:setForTask:done", (...args) => {
170291
+ const [, taskId, tagIds] = args;
170196
170292
  void (async () => {
170197
170293
  const task = await this.db.get(
170198
170294
  "SELECT project_id FROM tasks WHERE id = ?",
@@ -171122,17 +171218,20 @@ function subscribeFileWatcher(rootPath, listener) {
171122
171218
  }
171123
171219
  const prev = debounceMap2.get(relPath);
171124
171220
  if (prev) clearTimeout(prev);
171125
- debounceMap2.set(relPath, setTimeout(() => {
171126
- debounceMap2.delete(relPath);
171127
- const abs = path23.join(root, relPath);
171128
- const exists = fs16.existsSync(abs);
171129
- const event = {
171130
- type: exists ? "changed" : "deleted",
171131
- root,
171132
- relPath
171133
- };
171134
- for (const l of listeners) l(event);
171135
- }, 100));
171221
+ debounceMap2.set(
171222
+ relPath,
171223
+ setTimeout(() => {
171224
+ debounceMap2.delete(relPath);
171225
+ const abs = path23.join(root, relPath);
171226
+ const exists = fs16.existsSync(abs);
171227
+ const event = {
171228
+ type: exists ? "changed" : "deleted",
171229
+ root,
171230
+ relPath
171231
+ };
171232
+ for (const l of listeners) l(event);
171233
+ }, 100)
171234
+ );
171136
171235
  });
171137
171236
  watchers.set(root, { watcher: watcher2, listeners, debounceMap: debounceMap2 });
171138
171237
  return () => unsubscribe(root, listener);
@@ -171173,7 +171272,9 @@ var fileEditorRouter = router({
171173
171272
  delete: publicProcedure.input(external_exports.object({ rootPath: external_exports.string(), targetPath: external_exports.string() })).mutation(({ input }) => {
171174
171273
  deletePath(input.rootPath, input.targetPath);
171175
171274
  }),
171176
- copyIn: publicProcedure.input(external_exports.object({ rootPath: external_exports.string(), absoluteSrc: external_exports.string(), targetDir: external_exports.string().optional() })).mutation(({ input }) => copyIn(input.rootPath, input.absoluteSrc, input.targetDir)),
171275
+ copyIn: publicProcedure.input(
171276
+ external_exports.object({ rootPath: external_exports.string(), absoluteSrc: external_exports.string(), targetDir: external_exports.string().optional() })
171277
+ ).mutation(({ input }) => copyIn(input.rootPath, input.absoluteSrc, input.targetDir)),
171177
171278
  copy: publicProcedure.input(external_exports.object({ rootPath: external_exports.string(), srcPath: external_exports.string(), destPath: external_exports.string() })).mutation(({ input }) => {
171178
171279
  copy2(input.rootPath, input.srcPath, input.destPath);
171179
171280
  }),
@@ -171333,120 +171434,68 @@ init_zod();
171333
171434
  var anyInput3 = external_exports.unknown();
171334
171435
  var integrationsRouter = router({
171335
171436
  // Connections
171336
- connectGithub: publicProcedure.input(anyInput3).mutation(
171337
- ({ input }) => getIntegrationOps().connectGithub(input)
171338
- ),
171339
- connectLinear: publicProcedure.input(anyInput3).mutation(
171340
- ({ input }) => getIntegrationOps().connectLinear(input)
171341
- ),
171342
- connectJira: publicProcedure.input(anyInput3).mutation(
171343
- ({ input }) => getIntegrationOps().connectJira(input)
171344
- ),
171345
- getJiraTransitions: publicProcedure.input(external_exports.object({ taskId: external_exports.string() })).query(
171346
- ({ input }) => getIntegrationOps().getJiraTransitions(input.taskId)
171347
- ),
171348
- updateConnection: publicProcedure.input(anyInput3).mutation(
171349
- ({ input }) => getIntegrationOps().updateConnection(input)
171350
- ),
171437
+ connectGithub: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().connectGithub(input)),
171438
+ connectLinear: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().connectLinear(input)),
171439
+ connectJira: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().connectJira(input)),
171440
+ getJiraTransitions: publicProcedure.input(external_exports.object({ taskId: external_exports.string() })).query(({ input }) => getIntegrationOps().getJiraTransitions(input.taskId)),
171441
+ updateConnection: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().updateConnection(input)),
171351
171442
  listConnections: publicProcedure.input(external_exports.object({ provider: external_exports.string().optional() }).optional()).query(({ input }) => getIntegrationOps().listConnections(input?.provider)),
171352
171443
  getConnectionUsage: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).query(({ input }) => getIntegrationOps().getConnectionUsage(input.connectionId)),
171353
171444
  disconnect: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).mutation(({ input }) => getIntegrationOps().disconnect(input.connectionId)),
171354
- clearProjectProvider: publicProcedure.input(anyInput3).mutation(
171355
- ({ input }) => getIntegrationOps().clearProjectProvider(input)
171356
- ),
171445
+ clearProjectProvider: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().clearProjectProvider(input)),
171357
171446
  getProjectConnection: publicProcedure.input(external_exports.object({ projectId: external_exports.string(), provider: external_exports.string() })).query(
171358
171447
  ({ input }) => getIntegrationOps().getProjectConnection(input.projectId, input.provider)
171359
171448
  ),
171360
- setProjectConnection: publicProcedure.input(anyInput3).mutation(
171361
- ({ input }) => getIntegrationOps().setProjectConnection(input)
171362
- ),
171363
- clearProjectConnection: publicProcedure.input(anyInput3).mutation(
171364
- ({ input }) => getIntegrationOps().clearProjectConnection(input)
171365
- ),
171449
+ setProjectConnection: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().setProjectConnection(input)),
171450
+ clearProjectConnection: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().clearProjectConnection(input)),
171366
171451
  // Github
171367
171452
  listGithubRepositories: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).query(({ input }) => getIntegrationOps().listGithubRepositories(input.connectionId)),
171368
171453
  listGithubProjects: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).query(({ input }) => getIntegrationOps().listGithubProjects(input.connectionId)),
171369
- listGithubIssues: publicProcedure.input(anyInput3).query(
171370
- ({ input }) => getIntegrationOps().listGithubIssues(input)
171371
- ),
171372
- importGithubIssues: publicProcedure.input(anyInput3).mutation(
171373
- ({ input }) => getIntegrationOps().importGithubIssues(input)
171374
- ),
171375
- listGithubRepositoryIssues: publicProcedure.input(anyInput3).query(
171376
- ({ input }) => getIntegrationOps().listGithubRepositoryIssues(input)
171377
- ),
171378
- importGithubRepositoryIssues: publicProcedure.input(anyInput3).mutation(
171379
- ({ input }) => getIntegrationOps().importGithubRepositoryIssues(input)
171380
- ),
171454
+ listGithubIssues: publicProcedure.input(anyInput3).query(({ input }) => getIntegrationOps().listGithubIssues(input)),
171455
+ importGithubIssues: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().importGithubIssues(input)),
171456
+ listGithubRepositoryIssues: publicProcedure.input(anyInput3).query(({ input }) => getIntegrationOps().listGithubRepositoryIssues(input)),
171457
+ importGithubRepositoryIssues: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().importGithubRepositoryIssues(input)),
171381
171458
  // Linear
171382
171459
  listLinearTeams: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).query(({ input }) => getIntegrationOps().listLinearTeams(input.connectionId)),
171383
171460
  listLinearProjects: publicProcedure.input(external_exports.object({ connectionId: external_exports.string(), teamId: external_exports.string() })).query(({ input }) => getIntegrationOps().listLinearProjects(input.connectionId, input.teamId)),
171384
- listLinearIssues: publicProcedure.input(anyInput3).query(
171385
- ({ input }) => getIntegrationOps().listLinearIssues(input)
171386
- ),
171387
- importLinearIssues: publicProcedure.input(anyInput3).mutation(
171388
- ({ input }) => getIntegrationOps().importLinearIssues(input)
171389
- ),
171461
+ listLinearIssues: publicProcedure.input(anyInput3).query(({ input }) => getIntegrationOps().listLinearIssues(input)),
171462
+ importLinearIssues: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().importLinearIssues(input)),
171390
171463
  // Project mapping
171391
- setProjectMapping: publicProcedure.input(anyInput3).mutation(
171392
- ({ input }) => getIntegrationOps().setProjectMapping(input)
171393
- ),
171464
+ setProjectMapping: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().setProjectMapping(input)),
171394
171465
  getProjectMapping: publicProcedure.input(external_exports.object({ projectId: external_exports.string(), provider: external_exports.string() })).query(
171395
171466
  ({ input }) => getIntegrationOps().getProjectMapping(input.projectId, input.provider)
171396
171467
  ),
171397
171468
  // Sync
171398
- syncNow: publicProcedure.input(anyInput3).mutation(
171399
- ({ input }) => getIntegrationOps().syncNow(input)
171400
- ),
171469
+ syncNow: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().syncNow(input)),
171401
171470
  getTaskSyncStatus: publicProcedure.input(external_exports.object({ taskId: external_exports.string(), provider: external_exports.string() })).query(
171402
171471
  ({ input }) => getIntegrationOps().getTaskSyncStatus(input.taskId, input.provider)
171403
171472
  ),
171404
171473
  getBatchTaskSyncStatus: publicProcedure.input(external_exports.object({ taskIds: external_exports.array(external_exports.string()), provider: external_exports.string() })).query(
171405
171474
  ({ input }) => getIntegrationOps().getBatchTaskSyncStatus(input.taskIds, input.provider)
171406
171475
  ),
171407
- pushTask: publicProcedure.input(anyInput3).mutation(
171408
- ({ input }) => getIntegrationOps().pushTask(input)
171409
- ),
171410
- pullTask: publicProcedure.input(anyInput3).mutation(
171411
- ({ input }) => getIntegrationOps().pullTask(input)
171412
- ),
171476
+ pushTask: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().pushTask(input)),
171477
+ pullTask: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().pullTask(input)),
171413
171478
  getLink: publicProcedure.input(external_exports.object({ taskId: external_exports.string(), provider: external_exports.string() })).query(({ input }) => getIntegrationOps().getLink(input.taskId, input.provider)),
171414
171479
  unlinkTask: publicProcedure.input(external_exports.object({ taskId: external_exports.string(), provider: external_exports.string() })).mutation(({ input }) => getIntegrationOps().unlinkTask(input.taskId, input.provider)),
171415
- pushUnlinkedTasks: publicProcedure.input(anyInput3).mutation(
171416
- ({ input }) => getIntegrationOps().pushUnlinkedTasks(input)
171417
- ),
171418
- fetchProviderStatuses: publicProcedure.input(anyInput3).mutation(
171419
- ({ input }) => getIntegrationOps().fetchProviderStatuses(input)
171420
- ),
171480
+ pushUnlinkedTasks: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().pushUnlinkedTasks(input)),
171481
+ fetchProviderStatuses: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().fetchProviderStatuses(input)),
171421
171482
  applyStatusSync: publicProcedure.input(anyInput3).mutation(
171422
171483
  // Returns the updated project; the ops impl reads it via the worker DB
171423
171484
  // (.get() → unknown), so assert the row shape at this API boundary.
171424
171485
  ({ input }) => getIntegrationOps().applyStatusSync(input)
171425
171486
  ),
171426
- resyncProviderStatuses: publicProcedure.input(anyInput3).mutation(
171427
- ({ input }) => getIntegrationOps().resyncProviderStatuses(input)
171428
- ),
171487
+ resyncProviderStatuses: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().resyncProviderStatuses(input)),
171429
171488
  // Generic provider-dispatched
171430
171489
  listProviderGroups: publicProcedure.input(external_exports.object({ connectionId: external_exports.string() })).query(({ input }) => getIntegrationOps().listProviderGroups(input.connectionId)),
171431
171490
  listProviderScopes: publicProcedure.input(external_exports.object({ connectionId: external_exports.string(), groupId: external_exports.string() })).query(
171432
171491
  ({ input }) => getIntegrationOps().listProviderScopes(input.connectionId, input.groupId)
171433
171492
  ),
171434
- listProviderIssues: publicProcedure.input(anyInput3).query(
171435
- ({ input }) => getIntegrationOps().listProviderIssues(input)
171436
- ),
171437
- importProviderIssues: publicProcedure.input(anyInput3).mutation(
171438
- ({ input }) => getIntegrationOps().importProviderIssues(input)
171439
- ),
171493
+ listProviderIssues: publicProcedure.input(anyInput3).query(({ input }) => getIntegrationOps().listProviderIssues(input)),
171494
+ importProviderIssues: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().importProviderIssues(input)),
171440
171495
  // Test channels (E2E only — no-op in production renderer)
171441
- testSeedGithubConnection: publicProcedure.input(anyInput3).mutation(
171442
- ({ input }) => getIntegrationOps().testSeedGithubConnection(input)
171443
- ),
171444
- testSetGithubRepositories: publicProcedure.input(anyInput3).mutation(
171445
- ({ input }) => getIntegrationOps().testSetGithubRepositories(input)
171446
- ),
171447
- testSetGithubRepositoryIssues: publicProcedure.input(anyInput3).mutation(
171448
- ({ input }) => getIntegrationOps().testSetGithubRepositoryIssues(input)
171449
- ),
171496
+ testSeedGithubConnection: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().testSeedGithubConnection(input)),
171497
+ testSetGithubRepositories: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().testSetGithubRepositories(input)),
171498
+ testSetGithubRepositoryIssues: publicProcedure.input(anyInput3).mutation(({ input }) => getIntegrationOps().testSetGithubRepositoryIssues(input)),
171450
171499
  testClearGithubMocks: publicProcedure.mutation(() => getIntegrationOps().testClearGithubMocks())
171451
171500
  });
171452
171501
 
@@ -171660,7 +171709,14 @@ var anyInput4 = external_exports.unknown();
171660
171709
  var processesRouter = router({
171661
171710
  create: publicProcedure.input(anyInput4).mutation(({ input }) => {
171662
171711
  const i = input;
171663
- return getProcessesDeps().create(i.projectId, i.taskId, i.label, i.command, i.cwd, i.autoRestart);
171712
+ return getProcessesDeps().create(
171713
+ i.projectId,
171714
+ i.taskId,
171715
+ i.label,
171716
+ i.command,
171717
+ i.cwd,
171718
+ i.autoRestart
171719
+ );
171664
171720
  }),
171665
171721
  spawn: publicProcedure.input(anyInput4).mutation(({ input }) => {
171666
171722
  const i = input;
@@ -171740,7 +171796,9 @@ var projectGroupsRouter = router({
171740
171796
  list: publicProcedure.query(({ ctx }) => listProjectGroups(ctx.db)),
171741
171797
  create: publicProcedure.input(external_exports.object({ name: external_exports.string().optional() }).optional()).mutation(({ ctx, input }) => createProjectGroup(ctx.db, input ?? {})),
171742
171798
  createFolderWithProjects: publicProcedure.input(external_exports.object({ projectIds: external_exports.array(external_exports.string()) })).mutation(({ ctx, input }) => createFolderWithProjects(ctx.db, input.projectIds)),
171743
- update: publicProcedure.input(external_exports.object({ id: external_exports.string(), name: external_exports.string().optional(), collapsed: external_exports.boolean().optional() })).mutation(({ ctx, input }) => updateProjectGroup(ctx.db, input)),
171799
+ update: publicProcedure.input(
171800
+ external_exports.object({ id: external_exports.string(), name: external_exports.string().optional(), collapsed: external_exports.boolean().optional() })
171801
+ ).mutation(({ ctx, input }) => updateProjectGroup(ctx.db, input)),
171744
171802
  delete: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(({ ctx, input }) => deleteProjectGroup(ctx.db, input.id)),
171745
171803
  moveProject: publicProcedure.input(
171746
171804
  external_exports.object({
@@ -171768,7 +171826,9 @@ var ptyRouter = router({
171768
171826
  modesUpdate: publicProcedure.input(external_exports.object({ id: external_exports.string(), updates: anyInput5 })).mutation(({ input }) => ops2().terminalModesUpdate(input.id, input.updates)),
171769
171827
  modesDelete: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(({ input }) => ops2().terminalModesDelete(input.id)),
171770
171828
  modesRestoreDefaults: publicProcedure.mutation(() => ops2().terminalModesRestoreDefaults()),
171771
- modesResetToDefaultState: publicProcedure.mutation(() => ops2().terminalModesResetToDefaultState()),
171829
+ modesResetToDefaultState: publicProcedure.mutation(
171830
+ () => ops2().terminalModesResetToDefaultState()
171831
+ ),
171772
171832
  // PTY ops
171773
171833
  create: publicProcedure.input(anyInput5).mutation(({ input }) => ops2().ptyCreate(input)),
171774
171834
  // Test-only (PLAYWRIGHT): capture createPty opts at the spawn chokepoint (no spawn).
@@ -171796,9 +171856,7 @@ var ptyRouter = router({
171796
171856
  interrupt: publicProcedure.input(external_exports.object({ sessionId: external_exports.string() })).mutation(({ input }) => ops2().ptyInterrupt(input.sessionId)),
171797
171857
  // Renderer→main ensure-alive ACK — resolves the pending requestEnsureAlive
171798
171858
  // waiter by reqId. Mirrors the legacy `pty:ensure-alive:ack` IPC.
171799
- ackEnsureAlive: publicProcedure.input(
171800
- external_exports.object({ reqId: external_exports.number(), result: external_exports.enum(["ok", "already-alive", "error"]) })
171801
- ).mutation(({ input }) => ops2().ptyAckEnsureAlive(input.reqId, input.result)),
171859
+ ackEnsureAlive: publicProcedure.input(external_exports.object({ reqId: external_exports.number(), result: external_exports.enum(["ok", "already-alive", "error"]) })).mutation(({ input }) => ops2().ptyAckEnsureAlive(input.reqId, input.result)),
171802
171860
  exists: publicProcedure.input(external_exports.object({ sessionId: external_exports.string() })).query(({ input }) => ops2().ptyExists(input.sessionId)),
171803
171861
  getBuffer: publicProcedure.input(external_exports.object({ sessionId: external_exports.string() })).query(({ input }) => ops2().ptyGetBuffer(input.sessionId)),
171804
171862
  clearBuffer: publicProcedure.input(external_exports.object({ sessionId: external_exports.string() })).mutation(({ input }) => ops2().ptyClearBuffer(input.sessionId)),
@@ -172270,7 +172328,9 @@ function parseCapabilities(json3) {
172270
172328
  init_zod();
172271
172329
  var themeInput = external_exports.enum(["light", "dark", "system"]);
172272
172330
  var settingsRouter = router({
172273
- get: publicProcedure.input(external_exports.object({ key: external_exports.string() })).query(async ({ ctx, input }) => await SettingsService.forDatabase(ctx.db).get(input.key) ?? null),
172331
+ get: publicProcedure.input(external_exports.object({ key: external_exports.string() })).query(
172332
+ async ({ ctx, input }) => await SettingsService.forDatabase(ctx.db).get(input.key) ?? null
172333
+ ),
172274
172334
  set: publicProcedure.input(external_exports.object({ key: external_exports.string(), value: external_exports.string() })).mutation(({ ctx, input }) => SettingsService.forDatabase(ctx.db).set(input.key, input.value)),
172275
172335
  getAll: publicProcedure.query(({ ctx }) => SettingsService.forDatabase(ctx.db).getAll()),
172276
172336
  // --- Theme (Electron nativeTheme — host-only, via injected AppDeps) ---
@@ -172447,7 +172507,8 @@ var taskRouter = router({
172447
172507
  }
172448
172508
  throw e;
172449
172509
  }
172450
- if (!r) throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "createTaskOp returned null" });
172510
+ if (!r)
172511
+ throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "createTaskOp returned null" });
172451
172512
  return r;
172452
172513
  }),
172453
172514
  getSubTasks: publicProcedure.input(external_exports.object({ parentId: external_exports.string() })).query(({ ctx, input }) => ops3().getSubTasksOp(ctx.db, input.parentId)),
@@ -172660,7 +172721,13 @@ var artifactsRouter = router({
172660
172721
  store(ctx.dataRoot).cleanupTaskArtifacts(input.taskId);
172661
172722
  }),
172662
172723
  // --- Versions ---
172663
- versionsList: publicProcedure.input(external_exports.object({ artifactId: external_exports.string(), limit: external_exports.number().optional(), offset: external_exports.number().optional() })).query(({ ctx, input }) => store(ctx.dataRoot).listArtifactVersions(ctx.db, input)),
172724
+ versionsList: publicProcedure.input(
172725
+ external_exports.object({
172726
+ artifactId: external_exports.string(),
172727
+ limit: external_exports.number().optional(),
172728
+ offset: external_exports.number().optional()
172729
+ })
172730
+ ).query(({ ctx, input }) => store(ctx.dataRoot).listArtifactVersions(ctx.db, input)),
172664
172731
  versionsRead: publicProcedure.input(external_exports.object({ artifactId: external_exports.string(), versionRef })).query(({ ctx, input }) => store(ctx.dataRoot).readArtifactVersion(ctx.db, input)),
172665
172732
  versionsCreate: publicProcedure.input(external_exports.object({ artifactId: external_exports.string(), name: external_exports.string().nullable().optional() })).mutation(({ ctx, input }) => store(ctx.dataRoot).createArtifactVersion(ctx.db, input)),
172666
172733
  versionsRename: publicProcedure.input(external_exports.object({ artifactId: external_exports.string(), versionRef, newName: external_exports.string().nullable() })).mutation(({ ctx, input }) => store(ctx.dataRoot).renameArtifactVersion(ctx.db, input)),
@@ -172683,7 +172750,9 @@ var artifactsRouter = router({
172683
172750
  foldersDelete: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(({ ctx, input }) => store(ctx.dataRoot).deleteFolder(ctx.db, input.id)),
172684
172751
  foldersReorder: publicProcedure.input(external_exports.object({ parentId: external_exports.string().nullable(), folderIds: external_exports.array(external_exports.string()) })).mutation(({ ctx, input }) => store(ctx.dataRoot).reorderFolders(ctx.db, input)),
172685
172752
  // --- Download (needs the Electron host via AppDeps) ---
172686
- downloadFile: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(({ ctx, input }) => downloadArtifactFile(downloadHost(), ctx.db, ctx.dataRoot, input.id)),
172753
+ downloadFile: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(
172754
+ ({ ctx, input }) => downloadArtifactFile(downloadHost(), ctx.db, ctx.dataRoot, input.id)
172755
+ ),
172687
172756
  downloadFolder: publicProcedure.input(external_exports.object({ folderId: external_exports.string() })).mutation(
172688
172757
  ({ ctx, input }) => downloadArtifactFolder(downloadHost(), ctx.db, ctx.dataRoot, input.folderId)
172689
172758
  ),
@@ -173056,7 +173125,9 @@ async function reorderCategories(db, ids) {
173056
173125
  );
173057
173126
  }
173058
173127
  async function listProfiles(db) {
173059
- const row = await db.get("SELECT value FROM settings WHERE key = 'test_profiles'");
173128
+ const row = await db.get(
173129
+ "SELECT value FROM settings WHERE key = 'test_profiles'"
173130
+ );
173060
173131
  let userProfiles = [];
173061
173132
  if (row) {
173062
173133
  try {
@@ -173067,7 +173138,9 @@ async function listProfiles(db) {
173067
173138
  return [...DEFAULT_PROFILES, ...userProfiles];
173068
173139
  }
173069
173140
  async function saveProfile(db, profile) {
173070
- const row = await db.get("SELECT value FROM settings WHERE key = 'test_profiles'");
173141
+ const row = await db.get(
173142
+ "SELECT value FROM settings WHERE key = 'test_profiles'"
173143
+ );
173071
173144
  let profiles = [];
173072
173145
  if (row) {
173073
173146
  try {
@@ -173083,7 +173156,9 @@ async function saveProfile(db, profile) {
173083
173156
  ]);
173084
173157
  }
173085
173158
  async function deleteProfile(db, id) {
173086
- const row = await db.get("SELECT value FROM settings WHERE key = 'test_profiles'");
173159
+ const row = await db.get(
173160
+ "SELECT value FROM settings WHERE key = 'test_profiles'"
173161
+ );
173087
173162
  if (!row) return;
173088
173163
  let profiles = [];
173089
173164
  try {
@@ -173202,11 +173277,10 @@ async function toggleFileLabel(db, projectId, filePath, labelId) {
173202
173277
  [projectId, filePath, labelId]
173203
173278
  );
173204
173279
  } else {
173205
- await db.run("INSERT INTO test_file_labels (project_id, file_path, label_id) VALUES (?, ?, ?)", [
173206
- projectId,
173207
- filePath,
173208
- labelId
173209
- ]);
173280
+ await db.run(
173281
+ "INSERT INTO test_file_labels (project_id, file_path, label_id) VALUES (?, ?, ?)",
173282
+ [projectId, filePath, labelId]
173283
+ );
173210
173284
  }
173211
173285
  }
173212
173286
 
@@ -173240,7 +173314,9 @@ var testPanelRouter = router({
173240
173314
  deleteLabel: publicProcedure.input(external_exports.object({ id: external_exports.string() })).mutation(({ ctx, input }) => deleteLabel(ctx.db, input.id)),
173241
173315
  // File label assignments + notes
173242
173316
  getFileLabels: publicProcedure.input(external_exports.object({ projectId: external_exports.string() })).query(({ ctx, input }) => listFileLabels(ctx.db, input.projectId)),
173243
- toggleFileLabel: publicProcedure.input(external_exports.object({ projectId: external_exports.string(), filePath: external_exports.string(), labelId: external_exports.string() })).mutation(({ ctx, input }) => toggleFileLabel(ctx.db, input.projectId, input.filePath, input.labelId)),
173317
+ toggleFileLabel: publicProcedure.input(external_exports.object({ projectId: external_exports.string(), filePath: external_exports.string(), labelId: external_exports.string() })).mutation(
173318
+ ({ ctx, input }) => toggleFileLabel(ctx.db, input.projectId, input.filePath, input.labelId)
173319
+ ),
173244
173320
  getFileNotes: publicProcedure.input(external_exports.object({ projectId: external_exports.string() })).query(({ ctx, input }) => listFileNotes(ctx.db, input.projectId)),
173245
173321
  setFileNote: publicProcedure.input(external_exports.object({ projectId: external_exports.string(), filePath: external_exports.string(), note: external_exports.string() })).mutation(({ ctx, input }) => setFileNote(ctx.db, input.projectId, input.filePath, input.note))
173246
173322
  });
@@ -173319,7 +173395,9 @@ var worktreesRouter = router({
173319
173395
  discardFile: publicProcedure.input(obj({ path: s, filePath: s, untracked: external_exports.boolean().optional() })).mutation(({ input }) => discardFile(input.path, input.filePath, input.untracked)),
173320
173396
  stageAll: publicProcedure.input(obj({ path: s })).mutation(({ input }) => stageAll(input.path)),
173321
173397
  unstageAll: publicProcedure.input(obj({ path: s })).mutation(({ input }) => unstageAll(input.path)),
173322
- getFileDiff: publicProcedure.input(obj({ repoPath: s, filePath: s, staged: external_exports.boolean(), opts: u.optional() })).query(({ input }) => getFileDiff(input.repoPath, input.filePath, input.staged, input.opts)),
173398
+ getFileDiff: publicProcedure.input(obj({ repoPath: s, filePath: s, staged: external_exports.boolean(), opts: u.optional() })).query(
173399
+ ({ input }) => getFileDiff(input.repoPath, input.filePath, input.staged, input.opts)
173400
+ ),
173323
173401
  getUntrackedFileDiff: publicProcedure.input(obj({ repoPath: s, filePath: s })).query(({ input }) => getUntrackedFileDiff(input.repoPath, input.filePath)),
173324
173402
  getConflictContent: publicProcedure.input(obj({ repoPath: s, filePath: s })).query(({ input }) => getConflictContent(input.repoPath, input.filePath)),
173325
173403
  writeResolvedFile: publicProcedure.input(obj({ repoPath: s, filePath: s, content: s })).mutation(({ input }) => writeResolvedFile(input.repoPath, input.filePath, input.content)),
@@ -173367,7 +173445,14 @@ var worktreesRouter = router({
173367
173445
  resolveChildBranches: publicProcedure.input(obj({ path: s, baseBranch: s })).query(({ input }) => resolveChildBranches(input.path, input.baseBranch)),
173368
173446
  resolveCopyBehavior: publicProcedure.input(obj({ projectId: s.optional() })).query(({ ctx, input }) => resolveCopyBehavior(ctx.db, input.projectId)),
173369
173447
  getIgnoredFileTree: publicProcedure.input(obj({ repoPath: s })).query(({ input }) => getIgnoredFileTree(input.repoPath)),
173370
- copyIgnoredFiles: publicProcedure.input(obj({ repoPath: s, worktreePath: s, paths: external_exports.array(s), mode: external_exports.enum(["all", "custom"]).optional() })).mutation(
173448
+ copyIgnoredFiles: publicProcedure.input(
173449
+ obj({
173450
+ repoPath: s,
173451
+ worktreePath: s,
173452
+ paths: external_exports.array(s),
173453
+ mode: external_exports.enum(["all", "custom"]).optional()
173454
+ })
173455
+ ).mutation(
173371
173456
  ({ input }) => copyIgnoredFiles(
173372
173457
  input.repoPath,
173373
173458
  input.worktreePath,
@@ -185175,7 +185260,13 @@ function registerGetTaskRoute(app, deps4) {
185175
185260
  app.get("/api/tasks/:id", async (req, res) => {
185176
185261
  try {
185177
185262
  const db = deps4.db;
185178
- const resolved = await resolveByIdPrefix(db, "tasks", req.params.id, "Task", "id");
185263
+ const resolved = await resolveByIdPrefix(
185264
+ db,
185265
+ "tasks",
185266
+ req.params.id,
185267
+ "Task",
185268
+ "id"
185269
+ );
185179
185270
  if (isResolveFailure(resolved)) {
185180
185271
  res.status(resolved.status).json({ ok: false, error: resolved.error });
185181
185272
  return;
@@ -185237,7 +185328,13 @@ function registerTaskSubtasksRoutes(app, deps4) {
185237
185328
  app.get("/api/tasks/:id/subtasks", async (req, res) => {
185238
185329
  try {
185239
185330
  const db = deps4.db;
185240
- const parent = await resolveByIdPrefix(db, "tasks", req.params.id, "Task", "id");
185331
+ const parent = await resolveByIdPrefix(
185332
+ db,
185333
+ "tasks",
185334
+ req.params.id,
185335
+ "Task",
185336
+ "id"
185337
+ );
185241
185338
  if (isResolveFailure(parent)) {
185242
185339
  res.status(parent.status).json({ ok: false, error: parent.error });
185243
185340
  return;
@@ -186603,8 +186700,9 @@ async function createArtifactFromStream(req, res, deps4) {
186603
186700
  } catch (err) {
186604
186701
  res.status(500).json({ ok: false, error: err instanceof Error ? err.message : String(err) });
186605
186702
  } finally {
186606
- if (tmpPath) await (0, import_promises13.unlink)(tmpPath).catch(() => {
186607
- });
186703
+ if (tmpPath)
186704
+ await (0, import_promises13.unlink)(tmpPath).catch(() => {
186705
+ });
186608
186706
  }
186609
186707
  }
186610
186708
  function registerArtifactsContentRoutes(app, deps4) {
@@ -186627,7 +186725,11 @@ function registerArtifactsContentRoutes(app, deps4) {
186627
186725
  const artifact = resolved.row;
186628
186726
  const filePath = resolveArtifactFilePath(artifact.task_id, artifact.id, artifact.title);
186629
186727
  if (!(0, import_node_fs14.existsSync)(filePath)) {
186630
- res.status(404).json({ ok: false, code: "ARTIFACT_FILE_MISSING", error: "Artifact file not found on disk." });
186728
+ res.status(404).json({
186729
+ ok: false,
186730
+ code: "ARTIFACT_FILE_MISSING",
186731
+ error: "Artifact file not found on disk."
186732
+ });
186631
186733
  return;
186632
186734
  }
186633
186735
  const { size } = (0, import_node_fs14.statSync)(filePath);
@@ -186679,8 +186781,9 @@ function registerArtifactsContentRoutes(app, deps4) {
186679
186781
  } catch (err) {
186680
186782
  res.status(500).json({ ok: false, error: err instanceof Error ? err.message : String(err) });
186681
186783
  } finally {
186682
- if (tmpPath) await (0, import_promises13.unlink)(tmpPath).catch(() => {
186683
- });
186784
+ if (tmpPath)
186785
+ await (0, import_promises13.unlink)(tmpPath).catch(() => {
186786
+ });
186684
186787
  }
186685
186788
  });
186686
186789
  }
@@ -186724,11 +186827,7 @@ function registerArtifactsCrudRoutes(app, deps4) {
186724
186827
  ok: true,
186725
186828
  data: {
186726
186829
  ...row,
186727
- filePath: resolveArtifactFilePath(
186728
- String(row.task_id),
186729
- row.id,
186730
- String(row.title ?? "")
186731
- )
186830
+ filePath: resolveArtifactFilePath(String(row.task_id), row.id, String(row.title ?? ""))
186732
186831
  }
186733
186832
  });
186734
186833
  } catch (err) {
@@ -186881,7 +186980,11 @@ function registerArtifactsCrudRoutes(app, deps4) {
186881
186980
  if (!parent) return;
186882
186981
  parentId = parent.id;
186883
186982
  }
186884
- const folder = await store2().createFolder(db, { taskId: task.row.id, name: body.name, parentId });
186983
+ const folder = await store2().createFolder(db, {
186984
+ taskId: task.row.id,
186985
+ name: body.name,
186986
+ parentId
186987
+ });
186885
186988
  if (!folder) {
186886
186989
  res.status(500).json({ ok: false, error: "Failed to create folder" });
186887
186990
  return;
@@ -187097,10 +187200,7 @@ async function writeContent(req, res, deps4, idPrefix, append) {
187097
187200
  }
187098
187201
  const mutateRef = parseRef2(queryString(req.query.mutateVersionRef));
187099
187202
  const mutateCurrent = queryString(req.query.mutateVersion) != null;
187100
- const author = parseAuthor(
187101
- queryString(req.query.authorType),
187102
- queryString(req.query.authorId)
187103
- );
187203
+ const author = parseAuthor(queryString(req.query.authorType), queryString(req.query.authorId));
187104
187204
  tmpPath = await stageRequestBody2(req);
187105
187205
  const { artifact: updated, version: version3 } = await store3().writeArtifactContent(deps4.db, {
187106
187206
  artifactId: artifact.id,
@@ -187118,8 +187218,9 @@ async function writeContent(req, res, deps4, idPrefix, append) {
187118
187218
  } catch (err) {
187119
187219
  sendError(res, err);
187120
187220
  } finally {
187121
- if (tmpPath) await (0, import_promises15.unlink)(tmpPath).catch(() => {
187122
- });
187221
+ if (tmpPath)
187222
+ await (0, import_promises15.unlink)(tmpPath).catch(() => {
187223
+ });
187123
187224
  }
187124
187225
  }
187125
187226
  function registerArtifactsVersionsRoutes(app, deps4) {
@@ -188371,6 +188472,33 @@ function registerRunnersJoinTokenRoute(app, deps4) {
188371
188472
  });
188372
188473
  }
188373
188474
 
188475
+ // ../../shared/transport/src/server/http/rest-api/runners/list.ts
188476
+ function registerRunnersListRoute(app, deps4) {
188477
+ app.get("/api/runners", async (_req, res) => {
188478
+ try {
188479
+ const rows = await listRunners(deps4.db);
188480
+ const gateway = deps4.runners?.getGateway?.() ?? null;
188481
+ const liveIds = new Set((gateway?.listRunners() ?? []).map((r) => r.runnerId));
188482
+ const usableIds = new Set((gateway?.listUsableRunners() ?? []).map((r) => r.runnerId));
188483
+ res.json(
188484
+ rows.map((row) => ({
188485
+ id: row.id,
188486
+ name: row.name,
188487
+ platform: row.platform,
188488
+ lastSeenAt: row.last_seen_at,
188489
+ connected: liveIds.has(row.id),
188490
+ usable: usableIds.has(row.id)
188491
+ }))
188492
+ );
188493
+ } catch (err) {
188494
+ res.status(500).json({
188495
+ error: "failed to list runners",
188496
+ message: err instanceof Error ? err.message : String(err)
188497
+ });
188498
+ }
188499
+ });
188500
+ }
188501
+
188374
188502
  // ../../shared/transport/src/server/http/rest-api/hub/users.ts
188375
188503
  function isLoopbackAddress2(addr) {
188376
188504
  if (!addr) return false;
@@ -188548,6 +188676,7 @@ function registerRestApi(app, deps4) {
188548
188676
  registerTabsRenameRoute(app, deps4);
188549
188677
  registerResolveSessionTaskRoute(app, deps4);
188550
188678
  registerRunnersJoinTokenRoute(app, deps4);
188679
+ registerRunnersListRoute(app, deps4);
188551
188680
  registerHubUsersRoutes(app, deps4);
188552
188681
  registerBrowserUrlRoute(app, deps4);
188553
188682
  registerBrowserNavigateRoute(app, deps4);
@@ -188593,9 +188722,7 @@ function registerGetCurrentTaskIdTool(server, deps4) {
188593
188722
  "Preferred first step before other task tools. Returns the current task ID. Pass task_id explicitly (recommended from local $SLAYZONE_TASK_ID env var in task terminals). If $SLAYZONE_TASK_ID is empty (pre-warmed agent), pass session_id from $SLAYZONE_SESSION_ID instead.",
188594
188723
  {
188595
188724
  task_id: external_exports.string().optional().describe("Optional explicit task ID (recommended: pass $SLAYZONE_TASK_ID)"),
188596
- session_id: external_exports.string().optional().describe(
188597
- "Fallback when $SLAYZONE_TASK_ID is empty \u2014 pass $SLAYZONE_SESSION_ID instead"
188598
- )
188725
+ session_id: external_exports.string().optional().describe("Fallback when $SLAYZONE_TASK_ID is empty \u2014 pass $SLAYZONE_SESSION_ID instead")
188599
188726
  },
188600
188727
  async ({ task_id, session_id }) => {
188601
188728
  const resolvedTaskId = await resolveCurrentTaskId(deps4.db, task_id, session_id);
@@ -188731,9 +188858,7 @@ function registerCreateSubtaskTool(server, deps4) {
188731
188858
  "Create a subtask under a parent task. Prefer calling get_current_task_id first, then pass that as parent_task_id. In task terminals, you can source parent_task_id from local $SLAYZONE_TASK_ID. If that's empty (pre-warmed agent), pass session_id from $SLAYZONE_SESSION_ID instead.",
188732
188859
  {
188733
188860
  parent_task_id: external_exports.string().optional().describe("Parent task ID (recommended: pass $SLAYZONE_TASK_ID)"),
188734
- session_id: external_exports.string().optional().describe(
188735
- "Fallback when $SLAYZONE_TASK_ID is empty \u2014 pass $SLAYZONE_SESSION_ID instead"
188736
- ),
188861
+ session_id: external_exports.string().optional().describe("Fallback when $SLAYZONE_TASK_ID is empty \u2014 pass $SLAYZONE_SESSION_ID instead"),
188737
188862
  title: external_exports.string().describe("Subtask title"),
188738
188863
  description: external_exports.string().nullable().optional().describe("Subtask description (null to clear)"),
188739
188864
  status: external_exports.string().optional().describe("Initial status (default: first non-terminal project status)"),
@@ -188741,7 +188866,16 @@ function registerCreateSubtaskTool(server, deps4) {
188741
188866
  assignee: external_exports.string().nullable().optional().describe("Assignee name (null to clear)"),
188742
188867
  due_date: external_exports.string().nullable().optional().describe("Due date ISO string (null to clear)")
188743
188868
  },
188744
- async ({ parent_task_id, session_id, due_date, title, description, status, priority, assignee }) => {
188869
+ async ({
188870
+ parent_task_id,
188871
+ session_id,
188872
+ due_date,
188873
+ title,
188874
+ description,
188875
+ status,
188876
+ priority,
188877
+ assignee
188878
+ }) => {
188745
188879
  const resolvedParentId = await resolveCurrentTaskId(deps4.db, parent_task_id, session_id);
188746
188880
  if (!resolvedParentId) {
188747
188881
  return {
@@ -194346,7 +194480,9 @@ function tryDeleteConnectionIfUnusedSync(db, connectionId) {
194346
194480
  if (!connection) {
194347
194481
  return;
194348
194482
  }
194349
- db.prepare("DELETE FROM settings WHERE key = ?").run(credentialSettingKey(connection.credential_ref));
194483
+ db.prepare("DELETE FROM settings WHERE key = ?").run(
194484
+ credentialSettingKey(connection.credential_ref)
194485
+ );
194350
194486
  db.prepare("DELETE FROM integration_connections WHERE id = ?").run(connectionId);
194351
194487
  }
194352
194488
  var integrationTxns = {
@@ -196940,18 +197076,14 @@ ${body}` : `${renderedFrontmatter}
196940
197076
  if (viewState) {
196941
197077
  const pinned = viewState.treePinnedTaskIds;
196942
197078
  if (Array.isArray(pinned)) {
196943
- const setPinned = db.prepare(
196944
- "UPDATE tasks SET pinned = 1, pin_order = ? WHERE id = ?"
196945
- );
197079
+ const setPinned = db.prepare("UPDATE tasks SET pinned = 1, pin_order = ? WHERE id = ?");
196946
197080
  pinned.forEach((id, index) => {
196947
197081
  if (typeof id === "string") setPinned.run(index, id);
196948
197082
  });
196949
197083
  }
196950
197084
  const collapsed = viewState.treeCollapsedTaskIds;
196951
197085
  if (Array.isArray(collapsed)) {
196952
- const setCollapsed = db.prepare(
196953
- "UPDATE tasks SET tree_collapsed = 1 WHERE id = ?"
196954
- );
197086
+ const setCollapsed = db.prepare("UPDATE tasks SET tree_collapsed = 1 WHERE id = ?");
196955
197087
  for (const id of collapsed) {
196956
197088
  if (typeof id === "string") setCollapsed.run(id);
196957
197089
  }
@@ -196965,9 +197097,7 @@ ${body}` : `${renderedFrontmatter}
196965
197097
  }
196966
197098
  const prefix = "commit_graph:task:";
196967
197099
  const graphRows = db.prepare("SELECT key, value FROM settings WHERE key LIKE 'commit_graph:task:%'").all();
196968
- const setGraphConfig = db.prepare(
196969
- "UPDATE tasks SET commit_graph_config = ? WHERE id = ?"
196970
- );
197100
+ const setGraphConfig = db.prepare("UPDATE tasks SET commit_graph_config = ? WHERE id = ?");
196971
197101
  for (const row of graphRows) {
196972
197102
  const taskId = row.key.slice(prefix.length);
196973
197103
  if (taskId && row.value) setGraphConfig.run(row.value, taskId);
@@ -198097,7 +198227,9 @@ var artifactsTxns = {
198097
198227
  return selectFolder(db, id);
198098
198228
  },
198099
198229
  "task-artifacts:folders:getOrCreateByName": (db, p2) => {
198100
- const existing = db.prepare("SELECT * FROM artifact_folders WHERE task_id = ? AND parent_id IS NULL AND name = ?").get(p2.taskId, p2.name);
198230
+ const existing = db.prepare(
198231
+ "SELECT * FROM artifact_folders WHERE task_id = ? AND parent_id IS NULL AND name = ?"
198232
+ ).get(p2.taskId, p2.name);
198101
198233
  if (existing) return existing;
198102
198234
  const id = (0, import_crypto14.randomUUID)();
198103
198235
  const maxOrder = db.prepare(
@@ -198215,7 +198347,13 @@ var artifactTxns = {
198215
198347
  author: p2.author
198216
198348
  }),
198217
198349
  "artifacts:rename-version": (db, p2) => renameVersion(asDbLike(db), betterSqliteTxn(db), p2.artifactId, p2.ref, p2.newName),
198218
- "artifacts:prune-versions": (db, p2) => pruneVersions(asDbLike(db), betterSqliteTxn(db), new BlobStore(p2.dataDir), p2.artifactId, p2.opts),
198350
+ "artifacts:prune-versions": (db, p2) => pruneVersions(
198351
+ asDbLike(db),
198352
+ betterSqliteTxn(db),
198353
+ new BlobStore(p2.dataDir),
198354
+ p2.artifactId,
198355
+ p2.opts
198356
+ ),
198219
198357
  "artifacts:seed-initial-versions": (db, p2) => seedInitialVersionsInWorker(db, new BlobStore(p2.dataDir), p2.artifactsDir),
198220
198358
  // --- Read paths (no write, but multi-statement) ---
198221
198359
  // These resolve refs / walk parent chains / read blobs across several
@@ -198417,7 +198555,16 @@ var projectsTxns = {
198417
198555
  INSERT INTO projects (id, name, color, path, columns_config, sort_order, created_at, updated_at)
198418
198556
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)
198419
198557
  `);
198420
- stmt.run(p2.id, p2.name, p2.color, p2.path, p2.columnsConfigJson, nextOrder, p2.createdAt, p2.updatedAt);
198558
+ stmt.run(
198559
+ p2.id,
198560
+ p2.name,
198561
+ p2.color,
198562
+ p2.path,
198563
+ p2.columnsConfigJson,
198564
+ nextOrder,
198565
+ p2.createdAt,
198566
+ p2.updatedAt
198567
+ );
198421
198568
  return db.prepare("SELECT * FROM projects WHERE id = ?").get(p2.id);
198422
198569
  })(),
198423
198570
  // UPDATE projects, then (when columns changed) remap unknown task statuses,
@@ -198917,7 +199064,9 @@ var SyncSlayzoneDb = class {
198917
199064
  this.db.exec(sql2);
198918
199065
  }
198919
199066
  async batchTxn(ops4) {
198920
- return this.db.transaction(() => ops4.map((op) => this.db.prepare(op.sql)[op.type](...op.params)))();
199067
+ return this.db.transaction(
199068
+ () => ops4.map((op) => this.db.prepare(op.sql)[op.type](...op.params))
199069
+ )();
198921
199070
  }
198922
199071
  async namedTxn(name, params) {
198923
199072
  const fn2 = domainTxnRegistry[name];
@@ -200296,8 +200445,8 @@ function getDesktopBridgeCapUrl() {
200296
200445
 
200297
200446
  // src/build-info.ts
200298
200447
  function getServerBuildInfo() {
200299
- const commit = true ? "1f05f475" : "dev";
200300
- const builtAt = true ? "2026-08-07T06:59:13.700Z" : "unknown";
200448
+ const commit = true ? "b9d5f72c" : "dev";
200449
+ const builtAt = true ? "2026-08-08T22:50:52.470Z" : "unknown";
200301
200450
  return { commit, builtAt, buildId: `${commit}@${builtAt}` };
200302
200451
  }
200303
200452
 
@@ -201047,19 +201196,13 @@ function toSettingKey(ref) {
201047
201196
  async function storeCredential(db, ref, secret) {
201048
201197
  if (await cipherAvailable()) {
201049
201198
  const encrypted = await cipher.encryptString(secret);
201050
- await db.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)").run(
201051
- toSettingKey(ref),
201052
- encrypted.toString("base64")
201053
- );
201199
+ await db.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)").run(toSettingKey(ref), encrypted.toString("base64"));
201054
201200
  return;
201055
201201
  }
201056
201202
  if (!await allowPlaintextFallback()) {
201057
201203
  throw new Error("OS secure credential storage is unavailable on this machine");
201058
201204
  }
201059
- await db.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)").run(
201060
- toSettingKey(ref),
201061
- `${PLAINTEXT_PREFIX}${secret}`
201062
- );
201205
+ await db.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)").run(toSettingKey(ref), `${PLAINTEXT_PREFIX}${secret}`);
201063
201206
  }
201064
201207
  async function readCredential(db, ref) {
201065
201208
  const row = await db.prepare("SELECT value FROM settings WHERE key = ?").get(toSettingKey(ref));
@@ -203946,7 +204089,10 @@ function createIntegrationOps(db, _options) {
203946
204089
  const updatedTask = await getTaskById(db, task.id);
203947
204090
  await persistNormalizedBaseline(db, link.id, updatedTask, remoteIssue);
203948
204091
  const pullProjectColumns = await db.prepare("SELECT columns_config FROM projects WHERE id = ?").get(task.project_id);
203949
- if (isTerminalStatus(localStatus, parseColumnsConfig(pullProjectColumns?.columns_config ?? null))) {
204092
+ if (isTerminalStatus(
204093
+ localStatus,
204094
+ parseColumnsConfig(pullProjectColumns?.columns_config ?? null)
204095
+ )) {
203950
204096
  onTaskReachedTerminal(task.id);
203951
204097
  }
203952
204098
  await db.prepare(
@@ -204040,9 +204186,7 @@ function createIntegrationOps(db, _options) {
204040
204186
  await db.prepare(
204041
204187
  `UPDATE tasks SET status = ?, updated_at = datetime('now') WHERE project_id = ? AND status NOT IN (${placeholders})`
204042
204188
  ).run(defaultStatus, input.projectId, ...newStatusIds);
204043
- await db.prepare("DELETE FROM integration_state_mappings WHERE project_mapping_id = ?").run(
204044
- mapping.id
204045
- );
204189
+ await db.prepare("DELETE FROM integration_state_mappings WHERE project_mapping_id = ?").run(mapping.id);
204046
204190
  for (const status of input.statuses) {
204047
204191
  const colId = providerIdToColumnId.get(status.id);
204048
204192
  if (!colId) continue;
@@ -205325,7 +205469,11 @@ var DuplexRpc = class {
205325
205469
  if (this.opts.onPeerRequest) {
205326
205470
  this.opts.onPeerRequest(msg.method, msg.params, rawId);
205327
205471
  } else {
205328
- this.respondError(rawId, JSON_RPC_METHOD_NOT_FOUND, `method not found: ${msg.method}`);
205472
+ this.respondError(
205473
+ rawId,
205474
+ JSON_RPC_METHOD_NOT_FOUND,
205475
+ `method not found: ${msg.method}`
205476
+ );
205329
205477
  }
205330
205478
  } else {
205331
205479
  this.opts.onNotification?.(msg.method, msg.params);
@@ -205555,7 +205703,11 @@ function createHubRunnerGateway(options) {
205555
205703
  } else if (method === RunnerToHubMethods.hello) {
205556
205704
  void handleHello(conn, params, id);
205557
205705
  } else {
205558
- conn.rpc.respondError(id, RunnerTransportErrorCodes.unauthorized, "authenticate with enroll or hello first");
205706
+ conn.rpc.respondError(
205707
+ id,
205708
+ RunnerTransportErrorCodes.unauthorized,
205709
+ "authenticate with enroll or hello first"
205710
+ );
205559
205711
  protocolError(conn, `request '${method}' before authentication`);
205560
205712
  }
205561
205713
  return;
@@ -205574,7 +205726,11 @@ function createHubRunnerGateway(options) {
205574
205726
  }
205575
205727
  case RunnerToHubMethods.enroll:
205576
205728
  case RunnerToHubMethods.hello:
205577
- conn.rpc.respondError(id, RunnerTransportErrorCodes.unauthorized, "session already authenticated");
205729
+ conn.rpc.respondError(
205730
+ id,
205731
+ RunnerTransportErrorCodes.unauthorized,
205732
+ "session already authenticated"
205733
+ );
205578
205734
  return;
205579
205735
  default:
205580
205736
  conn.rpc.respondError(id, JSON_RPC_METHOD_NOT_FOUND, `method not found: ${method}`);
@@ -205672,7 +205828,10 @@ function createHubRunnerGateway(options) {
205672
205828
  const conn = getConnection2(runnerId);
205673
205829
  if (!conn) {
205674
205830
  return Promise.reject(
205675
- new RpcError(RunnerTransportErrorCodes.unknownRunner, `runner '${runnerId}' is not connected`)
205831
+ new RpcError(
205832
+ RunnerTransportErrorCodes.unknownRunner,
205833
+ `runner '${runnerId}' is not connected`
205834
+ )
205676
205835
  );
205677
205836
  }
205678
205837
  return conn.rpc.request(method, params, timeoutMs);
@@ -205681,7 +205840,9 @@ function createHubRunnerGateway(options) {
205681
205840
  getConnection2(runnerId)?.rpc.notify(method, params);
205682
205841
  },
205683
205842
  listRunners() {
205684
- return [...byRunnerId.values()].filter((conn) => conn.descriptor !== null).map((conn) => ({ ...conn.descriptor }));
205843
+ return [...byRunnerId.values()].filter(
205844
+ (conn) => conn.descriptor !== null
205845
+ ).map((conn) => ({ ...conn.descriptor }));
205685
205846
  },
205686
205847
  listUsableRunners() {
205687
205848
  return [...byRunnerId.values()].filter(isUsable).map((conn) => ({ ...conn.descriptor }));
@@ -205992,7 +206153,7 @@ function createRoutingPtyBackend(options) {
205992
206153
  exitEmitter
205993
206154
  };
205994
206155
  sessions3.set(key, entry);
205995
- let pid = 0;
206156
+ let pid = null;
205996
206157
  const handle = {
205997
206158
  get pid() {
205998
206159
  return pid;
@@ -206059,7 +206220,7 @@ function createRoutingPtyBackend(options) {
206059
206220
  const runnerId = resolveRunnerId(spec);
206060
206221
  if (runnerId == null) throw new NoRunnerAvailableError(`terminal session ${spec.sessionId}`);
206061
206222
  const { entry, handle, setPid } = register(runnerId, spec.sessionId, spec.file, false);
206062
- void gateway.request(runnerId, HubToRunnerMethods.ptySpawn, {
206223
+ const whenSpawned = gateway.request(runnerId, HubToRunnerMethods.ptySpawn, {
206063
206224
  sessionId: spec.sessionId,
206064
206225
  command: spec.file,
206065
206226
  args: spec.args,
@@ -206070,11 +206231,17 @@ function createRoutingPtyBackend(options) {
206070
206231
  }).then(
206071
206232
  (res) => {
206072
206233
  const parsed = ptySpawnResultSchema.safeParse(res);
206073
- if (parsed.success) setPid(parsed.data.pid);
206234
+ const spawnedPid = parsed.success ? parsed.data.pid : null;
206235
+ setPid(spawnedPid);
206236
+ return { pid: spawnedPid };
206074
206237
  },
206075
- () => finalize2(entry, null, "spawn-failed")
206238
+ (err) => {
206239
+ finalize2(entry, null, "spawn-failed");
206240
+ throw err;
206241
+ }
206076
206242
  );
206077
- return handle;
206243
+ void whenSpawned.catch(noop6);
206244
+ return Object.assign(handle, { whenSpawned });
206078
206245
  }
206079
206246
  };
206080
206247
  }
@@ -206294,8 +206461,10 @@ function createRoutingChatBackend(options) {
206294
206461
  console.error("[routing-chat] onSpawn listener threw:", err);
206295
206462
  }
206296
206463
  });
206297
- return { dispose: () => {
206298
- } };
206464
+ return {
206465
+ dispose: () => {
206466
+ }
206467
+ };
206299
206468
  }
206300
206469
  spawnCbs.push(cb);
206301
206470
  return {
@@ -206361,8 +206530,7 @@ function createRemoteWorktreeAdapters(options) {
206361
206530
  },
206362
206531
  async copyIgnoredFiles(taskId, repoPath, worktreePath, behavior, customPaths) {
206363
206532
  const runnerId = await resolveRunnerId(taskId);
206364
- if (runnerId == null)
206365
- throw new NoRunnerAvailableError(`ignored-file copy for task ${taskId}`);
206533
+ if (runnerId == null) throw new NoRunnerAvailableError(`ignored-file copy for task ${taskId}`);
206366
206534
  await gateway.request(runnerId, HubToRunnerMethods.gitCopyIgnoredFiles, {
206367
206535
  repoPath,
206368
206536
  worktreePath,
@@ -206373,7 +206541,9 @@ function createRemoteWorktreeAdapters(options) {
206373
206541
  async getCurrentBranch(taskId, repoPath) {
206374
206542
  const runnerId = await resolveRunnerId(taskId);
206375
206543
  if (runnerId == null) throw new NoRunnerAvailableError(`git branch read for task ${taskId}`);
206376
- const res = await gateway.request(runnerId, HubToRunnerMethods.gitGetCurrentBranch, { repoPath });
206544
+ const res = await gateway.request(runnerId, HubToRunnerMethods.gitGetCurrentBranch, {
206545
+ repoPath
206546
+ });
206377
206547
  return gitGetCurrentBranchResultSchema.parse(res).branch;
206378
206548
  },
206379
206549
  async isGitRepo(taskId, path30) {
@@ -206622,15 +206792,12 @@ function wireIntegrationPush(opts) {
206622
206792
  opts.taskBus.on("db:tasks:update:done", (_event, taskId) => {
206623
206793
  void pushTaskAfterEdit2(opts.db, taskId, { pushGithubTask: opts.pushGithubTask });
206624
206794
  });
206625
- opts.taskBus.on(
206626
- "db:tasks:create:done",
206627
- (_event, taskId, projectId) => {
206628
- void pushNewTaskToProviders2(opts.db, taskId, projectId).then(async () => {
206629
- const hasLink = await opts.db.prepare("SELECT 1 FROM external_links WHERE task_id = ? LIMIT 1").get(taskId);
206630
- if (hasLink) opts.notifyTasksChanged();
206631
- });
206632
- }
206633
- );
206795
+ opts.taskBus.on("db:tasks:create:done", (_event, taskId, projectId) => {
206796
+ void pushNewTaskToProviders2(opts.db, taskId, projectId).then(async () => {
206797
+ const hasLink = await opts.db.prepare("SELECT 1 FROM external_links WHERE task_id = ? LIMIT 1").get(taskId);
206798
+ if (hasLink) opts.notifyTasksChanged();
206799
+ });
206800
+ });
206634
206801
  opts.taskBus.on("db:tasks:archive:done", (_event, taskId) => {
206635
206802
  void pushArchiveToProviders2(opts.db, taskId);
206636
206803
  });
@@ -206686,9 +206853,7 @@ async function writeBackupNames(db, names) {
206686
206853
  await db.prepare("INSERT OR REPLACE INTO settings (key, value) VALUES (?, ?)").run("backup_names", JSON.stringify(names));
206687
206854
  }
206688
206855
  async function getBackupSettings(db) {
206689
- const row = await db.prepare("SELECT value FROM settings WHERE key = ?").get(
206690
- "backup_settings"
206691
- );
206856
+ const row = await db.prepare("SELECT value FROM settings WHERE key = ?").get("backup_settings");
206692
206857
  if (!row) return { ...DEFAULT_BACKUP_SETTINGS };
206693
206858
  try {
206694
206859
  return { ...DEFAULT_BACKUP_SETTINGS, ...JSON.parse(row.value) };
@@ -206829,6 +206994,8 @@ function unavailable(name) {
206829
206994
  function stub(name) {
206830
206995
  return ((..._args) => unavailable(name));
206831
206996
  }
206997
+ var noop7 = () => {
206998
+ };
206832
206999
  function composeServer(opts) {
206833
207000
  const { db, dataRoot } = opts;
206834
207001
  const supervised = !opts.standalone;
@@ -206876,7 +207043,9 @@ function composeServer(opts) {
206876
207043
  };
206877
207044
  const bootBestEffort = (label, run2) => {
206878
207045
  void run2().catch((err) => {
206879
- console.warn(`[hub] boot step "${label}" skipped: ${err instanceof Error ? err.message : String(err)}`);
207046
+ console.warn(
207047
+ `[hub] boot step "${label}" skipped: ${err instanceof Error ? err.message : String(err)}`
207048
+ );
206880
207049
  });
206881
207050
  };
206882
207051
  const authEvents2 = new TypedEmitter();
@@ -206971,8 +207140,7 @@ function composeServer(opts) {
206971
207140
  startArtifactWatcher((0, import_node_path22.join)(dataRoot, "artifacts"));
206972
207141
  const stubPtyWindow = {
206973
207142
  isDestroyed: () => false,
206974
- webContents: { send: () => {
206975
- }, getURL: () => "" }
207143
+ webContents: { send: noop7, getURL: () => "" }
206976
207144
  };
206977
207145
  configurePtyHost({
206978
207146
  getAllWindows: () => [stubPtyWindow],
@@ -207103,7 +207271,6 @@ function composeServer(opts) {
207103
207271
  decryptString: (encrypted) => hostCipher.decryptStringFromB64(encrypted.toString("base64"))
207104
207272
  });
207105
207273
  }
207106
- const feedbackOps = buildFeedbackOps(db);
207107
207274
  bootBestEffort("process-manager-init", () => initProcessManager(db));
207108
207275
  setProcessesDeps({
207109
207276
  create: createProcess,
@@ -207215,15 +207382,11 @@ function composeServer(opts) {
207215
207382
  appWindowGetContentBounds: () => null,
207216
207383
  appWindowGetDisplayScaleFactor: () => null,
207217
207384
  // Window-cosmetic setters no-op off-window in the Electron host too.
207218
- appWindowSetTrafficLightPosition: () => {
207219
- },
207220
- appWindowSetWindowButtonVisibility: () => {
207221
- },
207222
- appFocusRenderer: () => {
207223
- },
207385
+ appWindowSetTrafficLightPosition: noop7,
207386
+ appWindowSetWindowButtonVisibility: noop7,
207387
+ appFocusRenderer: noop7,
207224
207388
  // No window to raise on a headless host.
207225
- appRaiseMainWindow: () => {
207226
- },
207389
+ appRaiseMainWindow: noop7,
207227
207390
  // No OS nativeTheme off-Electron. Default the preference to "system" so the
207228
207391
  // renderer resolves dark/light from `prefers-color-scheme` (ThemeContext);
207229
207392
  // an explicit light/dark still applies for the session. (Cross-restart
@@ -207240,8 +207403,7 @@ function composeServer(opts) {
207240
207403
  decryptStringFromB64: stub("credentialCipher.decryptStringFromB64")
207241
207404
  },
207242
207405
  // No native menu on a headless host.
207243
- appRebuildMenuForShortcuts: () => {
207244
- },
207406
+ appRebuildMenuForShortcuts: noop7,
207245
207407
  // Chromium-fork GitHub OAuth start. Unlike the Electron host (which blocks
207246
207408
  // waiting for the deep-link and returns the code inline), the fork CANNOT
207247
207409
  // receive the callback here — slayzone:// routes to the C++ shell → the
@@ -207284,8 +207446,8 @@ function composeServer(opts) {
207284
207446
  artifactBuildExportHtml: stub("artifactBuildExportHtml"),
207285
207447
  artifactRenderPdfToFile: stub("artifactRenderPdfToFile"),
207286
207448
  artifactRenderPngToFile: stub("artifactRenderPngToFile"),
207287
- windowClose: () => {
207288
- },
207449
+ // No OS window owns this process — nothing to close.
207450
+ windowClose: noop7,
207289
207451
  browser: {
207290
207452
  createView: stub("browser.createView"),
207291
207453
  destroyView: stub("browser.destroyView"),
@@ -207358,12 +207520,11 @@ function composeServer(opts) {
207358
207520
  events: silentEmitter
207359
207521
  },
207360
207522
  webview: {
207361
- registerBrowserTab: () => {
207362
- },
207363
- unregisterBrowserTab: () => {
207364
- },
207365
- setActiveBrowserTab: () => {
207366
- },
207523
+ // Browser-tab bookkeeping exists to drive native z-order; there are no
207524
+ // native child views here, so registration has nothing to track.
207525
+ registerBrowserTab: noop7,
207526
+ unregisterBrowserTab: noop7,
207527
+ setActiveBrowserTab: noop7,
207367
207528
  closeDevTools: stub("webview.closeDevTools"),
207368
207529
  isDevToolsOpened: () => false,
207369
207530
  disableDeviceEmulation: stub("webview.disableDeviceEmulation"),
@@ -207379,8 +207540,7 @@ function composeServer(opts) {
207379
207540
  open: stub("taskWindows.open"),
207380
207541
  close: stub("taskWindows.close"),
207381
207542
  list: () => [],
207382
- setPrimaryActive: () => {
207383
- },
207543
+ setPrimaryActive: noop7,
207384
207544
  getPrimaryActive: () => null,
207385
207545
  claimPanel: stub("taskWindows.claimPanel"),
207386
207546
  releasePanel: stub("taskWindows.releasePanel"),
@@ -207433,7 +207593,11 @@ function composeServer(opts) {
207433
207593
  // (setRunnerListenerInfo feeds them once the /runners listener binds).
207434
207594
  runners: {
207435
207595
  getHubUrl: () => runnerHubUrl,
207436
- getCertFingerprint: () => runnerCertFingerprint
207596
+ getCertFingerprint: () => runnerCertFingerprint,
207597
+ // Same late-bound ref the tRPC `runners.list` reads, so the REST twin
207598
+ // (`GET /api/runners`, what `slay runner ls` calls) can never report a
207599
+ // different connection status than the app's Runners tab.
207600
+ getGateway: () => runnerGatewayRef
207437
207601
  },
207438
207602
  // Operator account management for the loopback-only `/api/hub/users` routes
207439
207603
  // (`slay hub users add|ls|rm`) — the ONLY way to create an account now that
@@ -208038,7 +208202,15 @@ async function startServer(cfg = {}) {
208038
208202
  // Same bit `hub.describe` reports over /trpc — mirrored on /health so a
208039
208203
  // client can learn "this hub needs a sign-in" without opening a socket.
208040
208204
  authRequired: hubAuthRequired,
208041
- runnersConnected: () => runnerGateway?.listRunners().length ?? 0
208205
+ // `listUsableRunners`, NOT `listRunners` — its own docstring names itself the
208206
+ // single authority for "can this runner do work right now?" and warns that the
208207
+ // raw map means only "socket is open", including a runner that has stopped
208208
+ // responding but not yet been reaped. `/health.runnersConnected` is read as a
208209
+ // READINESS gate (an e2e worker waits on it before dispatching), so the raw
208210
+ // count reports `connected: true` for a runner that cannot take work — the
208211
+ // symptom recorded in e2e/global-setup.ts: a fresh worker's gate satisfied in
208212
+ // ~14ms by a runner that process never spawned, which then dies mid-test.
208213
+ runnersConnected: () => runnerGateway?.listUsableRunners().length ?? 0
208042
208214
  };
208043
208215
  const remote = isRemoteMode();
208044
208216
  if (remote && !hubIdentity) {