@vibedeckx/darwin-arm64 0.3.10 → 0.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/bin.js +498 -344
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -13356,12 +13356,12 @@ var require_semver = __commonJS({
13356
13356
  }
13357
13357
  function replaceHyphen(comp, options) {
13358
13358
  const r = HYPHENRANGE_REGEXP;
13359
- return comp.replace(r, (_3, from, fM, fm, fp36, fpr, fb, to, tM, tm, tp, tpr) => {
13359
+ return comp.replace(r, (_3, from, fM, fm, fp35, fpr, fb, to, tM, tm, tp, tpr) => {
13360
13360
  if (isX(fM)) {
13361
13361
  from = "";
13362
13362
  } else if (isX(fm)) {
13363
13363
  from = `>=${fM}.0.0${options?.includePrerelease ? "-0" : ""}`;
13364
- } else if (isX(fp36)) {
13364
+ } else if (isX(fp35)) {
13365
13365
  from = `>=${fM}.${fm}.0${options?.includePrerelease ? "-0" : ""}`;
13366
13366
  } else if (fpr) {
13367
13367
  from = `>=${from}`;
@@ -87525,12 +87525,12 @@ var require_range = __commonJS({
87525
87525
  debug("replaceGTE0", comp, options);
87526
87526
  return comp.trim().replace(re2[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
87527
87527
  };
87528
- var hyphenReplace = (incPr) => ($0, from, fM, fm, fp36, fpr, fb, to, tM, tm, tp, tpr) => {
87528
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp35, fpr, fb, to, tM, tm, tp, tpr) => {
87529
87529
  if (isX(fM)) {
87530
87530
  from = "";
87531
87531
  } else if (isX(fm)) {
87532
87532
  from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
87533
- } else if (isX(fp36)) {
87533
+ } else if (isX(fp35)) {
87534
87534
  from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
87535
87535
  } else if (fpr) {
87536
87536
  from = `>=${from}`;
@@ -90111,8 +90111,8 @@ var require_pretty_print = __commonJS({
90111
90111
  serializedRoute += serializeMetaData(route.metaData);
90112
90112
  return serializedRoute;
90113
90113
  }
90114
- function mergeSimilarRoutes(routes35) {
90115
- return routes35.reduce((mergedRoutes, route) => {
90114
+ function mergeSimilarRoutes(routes34) {
90115
+ return routes34.reduce((mergedRoutes, route) => {
90116
90116
  for (const nodeRoute of mergedRoutes) {
90117
90117
  if (deepEqual(route.opts.constraints, nodeRoute.opts.constraints) && deepEqual(route.metaData, nodeRoute.metaData)) {
90118
90118
  nodeRoute.method += ", " + route.method;
@@ -90124,18 +90124,18 @@ var require_pretty_print = __commonJS({
90124
90124
  }, []);
90125
90125
  }
90126
90126
  function serializeNode(node, prefix, options) {
90127
- let routes35 = node.routes;
90127
+ let routes34 = node.routes;
90128
90128
  if (options.method === void 0) {
90129
- routes35 = routes35.map(normalizeRoute);
90129
+ routes34 = routes34.map(normalizeRoute);
90130
90130
  }
90131
- routes35 = routes35.map((route) => {
90131
+ routes34 = routes34.map((route) => {
90132
90132
  route.metaData = getRouteMetaData(route, options);
90133
90133
  return route;
90134
90134
  });
90135
90135
  if (options.method === void 0) {
90136
- routes35 = mergeSimilarRoutes(routes35);
90136
+ routes34 = mergeSimilarRoutes(routes34);
90137
90137
  }
90138
- return routes35.map(serializeRoute).join(`
90138
+ return routes34.map(serializeRoute).join(`
90139
90139
  ${prefix}`);
90140
90140
  }
90141
90141
  function buildObjectTree(node, tree, prefix, options) {
@@ -91402,9 +91402,9 @@ var require_find_my_way = __commonJS({
91402
91402
  pathIndex = paramEndIndex;
91403
91403
  }
91404
91404
  };
91405
- Router.prototype._rebuild = function(routes35) {
91405
+ Router.prototype._rebuild = function(routes34) {
91406
91406
  this.reset();
91407
- for (const route of routes35) {
91407
+ for (const route of routes34) {
91408
91408
  const { method, path: path22, opts, handler, store } = route;
91409
91409
  this._on(method, path22, opts, handler, store);
91410
91410
  }
@@ -93805,7 +93805,7 @@ var require_parse_url = __commonJS({
93805
93805
  var require_form_data = __commonJS({
93806
93806
  "../../node_modules/.pnpm/light-my-request@6.6.0/node_modules/light-my-request/lib/form-data.js"(exports, module) {
93807
93807
  "use strict";
93808
- var { randomUUID: randomUUID24 } = __require("node:crypto");
93808
+ var { randomUUID: randomUUID23 } = __require("node:crypto");
93809
93809
  var { Readable: Readable4 } = __require("node:stream");
93810
93810
  var textEncoder;
93811
93811
  function isFormDataLike(payload) {
@@ -93813,7 +93813,7 @@ var require_form_data = __commonJS({
93813
93813
  }
93814
93814
  function formDataToStream(formdata) {
93815
93815
  textEncoder = textEncoder ?? new TextEncoder();
93816
- const boundary = `----formdata-${randomUUID24()}`;
93816
+ const boundary = `----formdata-${randomUUID23()}`;
93817
93817
  const prefix = `--${boundary}\r
93818
93818
  Content-Disposition: form-data`;
93819
93819
  const escape2 = (str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
@@ -100612,8 +100612,8 @@ var require_commonjs6 = __commonJS({
100612
100612
  return this.#fullpath = this.name;
100613
100613
  }
100614
100614
  const pv = p2.fullpath();
100615
- const fp36 = pv + (!p2.parent ? "" : this.sep) + name25;
100616
- return this.#fullpath = fp36;
100615
+ const fp35 = pv + (!p2.parent ? "" : this.sep) + name25;
100616
+ return this.#fullpath = fp35;
100617
100617
  }
100618
100618
  /**
100619
100619
  * On platforms other than windows, this is identical to fullpath.
@@ -105329,7 +105329,7 @@ var require_static = __commonJS({
105329
105329
  var { fileURLToPath: fileURLToPath4 } = __require("node:url");
105330
105330
  var { statSync: statSync2 } = __require("node:fs");
105331
105331
  var { glob } = require_commonjs7();
105332
- var fp36 = require_plugin2();
105332
+ var fp35 = require_plugin2();
105333
105333
  var send = require_send2();
105334
105334
  var encodingNegotiator = require_accept_negotiator();
105335
105335
  var contentDisposition = require_content_disposition();
@@ -105433,7 +105433,7 @@ var require_static = __commonJS({
105433
105433
  } else {
105434
105434
  const indexes = new Set(opts.index === void 0 ? ["index.html"] : [].concat(opts.index));
105435
105435
  const indexDirs = /* @__PURE__ */ new Map();
105436
- const routes35 = /* @__PURE__ */ new Set();
105436
+ const routes34 = /* @__PURE__ */ new Set();
105437
105437
  const roots = Array.isArray(sendOptions.root) ? sendOptions.root : [sendOptions.root];
105438
105438
  for (let rootPath of roots) {
105439
105439
  rootPath = rootPath.split(path22.win32.sep).join(path22.posix.sep);
@@ -105449,10 +105449,10 @@ var require_static = __commonJS({
105449
105449
  for (let file2 of files) {
105450
105450
  file2 = file2.split(path22.win32.sep).join(path22.posix.sep);
105451
105451
  const route = prefix + file2;
105452
- if (routes35.has(route)) {
105452
+ if (routes34.has(route)) {
105453
105453
  continue;
105454
105454
  }
105455
- routes35.add(route);
105455
+ routes34.add(route);
105456
105456
  setUpHeadAndGet(routeOpts, route, `/${file2}`, rootPath);
105457
105457
  const key2 = path22.posix.basename(route);
105458
105458
  if (indexes.has(key2) && !indexDirs.has(key2)) {
@@ -105747,7 +105747,7 @@ var require_static = __commonJS({
105747
105747
  throw err;
105748
105748
  }
105749
105749
  }
105750
- module.exports = fp36(fastifyStatic2, {
105750
+ module.exports = fp35(fastifyStatic2, {
105751
105751
  fastify: "5.x",
105752
105752
  name: "@fastify/static"
105753
105753
  });
@@ -112390,7 +112390,7 @@ var require_websocket2 = __commonJS({
112390
112390
  var { ServerResponse } = __require("node:http");
112391
112391
  var { PassThrough } = __require("node:stream");
112392
112392
  var { randomBytes: randomBytes3 } = __require("node:crypto");
112393
- var fp36 = require_plugin2();
112393
+ var fp35 = require_plugin2();
112394
112394
  var WebSocket2 = require_ws();
112395
112395
  var Duplexify = require_duplexify();
112396
112396
  var kWs = /* @__PURE__ */ Symbol("ws-socket");
@@ -112576,7 +112576,7 @@ var require_websocket2 = __commonJS({
112576
112576
  }
112577
112577
  next();
112578
112578
  }
112579
- module.exports = fp36(fastifyWebsocket2, {
112579
+ module.exports = fp35(fastifyWebsocket2, {
112580
112580
  fastify: "5.x",
112581
112581
  name: "@fastify/websocket"
112582
112582
  });
@@ -115020,7 +115020,7 @@ var require_multipart2 = __commonJS({
115020
115020
  "use strict";
115021
115021
  var Busboy = require_main();
115022
115022
  var os2 = __require("node:os");
115023
- var fp36 = require_plugin2();
115023
+ var fp35 = require_plugin2();
115024
115024
  var { createWriteStream: createWriteStream2 } = __require("node:fs");
115025
115025
  var { unlink: unlink2 } = __require("node:fs/promises");
115026
115026
  var path22 = __require("node:path");
@@ -115469,7 +115469,7 @@ var require_multipart2 = __commonJS({
115469
115469
  }
115470
115470
  });
115471
115471
  }
115472
- module.exports = fp36(fastifyMultipart2, {
115472
+ module.exports = fp35(fastifyMultipart2, {
115473
115473
  fastify: "5.x",
115474
115474
  name: "@fastify/multipart"
115475
115475
  });
@@ -169021,11 +169021,11 @@ function buildCommand(builderArgs) {
169021
169021
  }
169022
169022
  };
169023
169023
  }
169024
- function* generateRouteMapHelpLines(routes35, docs, args) {
169024
+ function* generateRouteMapHelpLines(routes34, docs, args) {
169025
169025
  const { brief, fullDescription, hideRoute } = docs;
169026
169026
  const { headers } = args.text;
169027
169027
  yield args.ansiColor ? `\x1B[1m${headers.usage}\x1B[22m` : headers.usage;
169028
- for (const [name25, route] of Object.entries(routes35)) {
169028
+ for (const [name25, route] of Object.entries(routes34)) {
169029
169029
  if (!hideRoute || !hideRoute[name25] || args.includeHidden) {
169030
169030
  const externalRouteName = args.config.caseStyle === "convert-camel-to-kebab" ? convertCamelCaseToKebabCase(name25) : name25;
169031
169031
  yield ` ${route.formatUsageLine({
@@ -169055,7 +169055,7 @@ function* generateRouteMapHelpLines(routes35, docs, args) {
169055
169055
  }
169056
169056
  yield "";
169057
169057
  yield args.ansiColor ? `\x1B[1m${headers.commands}\x1B[22m` : headers.commands;
169058
- const visibleRoutes = Object.entries(routes35).filter(
169058
+ const visibleRoutes = Object.entries(routes34).filter(
169059
169059
  ([name25]) => !hideRoute || !hideRoute[name25] || args.includeHidden
169060
169060
  );
169061
169061
  const rows = visibleRoutes.map(([internalRouteName, route]) => {
@@ -169083,24 +169083,24 @@ function* generateRouteMapHelpLines(routes35, docs, args) {
169083
169083
  }
169084
169084
  }
169085
169085
  function buildRouteMap({
169086
- routes: routes35,
169086
+ routes: routes34,
169087
169087
  defaultCommand: defaultCommandRoute,
169088
169088
  docs,
169089
169089
  aliases
169090
169090
  }) {
169091
- if (Object.entries(routes35).length === 0) {
169091
+ if (Object.entries(routes34).length === 0) {
169092
169092
  throw new InternalError("Route map must contain at least one route");
169093
169093
  }
169094
169094
  const activeAliases = aliases ?? {};
169095
169095
  const aliasesByRoute = /* @__PURE__ */ new Map();
169096
169096
  for (const [alias, routeName] of Object.entries(activeAliases)) {
169097
- if (alias in routes35) {
169097
+ if (alias in routes34) {
169098
169098
  throw new InternalError(`Cannot use "${alias}" as an alias when a route with that name already exists`);
169099
169099
  }
169100
169100
  const routeAliases = aliasesByRoute.get(routeName) ?? [];
169101
169101
  aliasesByRoute.set(routeName, [...routeAliases, alias]);
169102
169102
  }
169103
- const defaultCommand = defaultCommandRoute ? routes35[defaultCommandRoute] : void 0;
169103
+ const defaultCommand = defaultCommandRoute ? routes34[defaultCommandRoute] : void 0;
169104
169104
  if (defaultCommand && defaultCommand.kind === RouteMapSymbol) {
169105
169105
  throw new InternalError(
169106
169106
  `Cannot use "${defaultCommandRoute}" as the default command because it is not a Command`
@@ -169109,7 +169109,7 @@ function buildRouteMap({
169109
169109
  const resolveRouteName = (input) => {
169110
169110
  if (input in activeAliases) {
169111
169111
  return activeAliases[input];
169112
- } else if (input in routes35) {
169112
+ } else if (input in routes34) {
169113
169113
  return input;
169114
169114
  }
169115
169115
  };
@@ -169127,7 +169127,7 @@ function buildRouteMap({
169127
169127
  return `${args.prefix.join(" ")} ${routeNames.join("|")} ...`;
169128
169128
  },
169129
169129
  formatHelp: (config2) => {
169130
- const lines = [...generateRouteMapHelpLines(routes35, docs, config2)];
169130
+ const lines = [...generateRouteMapHelpLines(routes34, docs, config2)];
169131
169131
  const text2 = lines.join("\n");
169132
169132
  return text2 + "\n";
169133
169133
  },
@@ -169170,11 +169170,11 @@ function buildRouteMap({
169170
169170
  },
169171
169171
  getRoutingTargetForInput: (input) => {
169172
169172
  const routeName = input in activeAliases ? activeAliases[input] : input;
169173
- return routes35[routeName];
169173
+ return routes34[routeName];
169174
169174
  },
169175
169175
  getAllEntries() {
169176
169176
  const hiddenRoutes = docs.hideRoute;
169177
- return Object.entries(routes35).map(([originalRouteName, target]) => {
169177
+ return Object.entries(routes34).map(([originalRouteName, target]) => {
169178
169178
  return {
169179
169179
  name: {
169180
169180
  original: originalRouteName,
@@ -186340,10 +186340,6 @@ var createRemoteServerRepos = (kdb, _h) => ({
186340
186340
  // src/storage/repositories/executors.ts
186341
186341
  var mapExecutor = (row) => ({
186342
186342
  ...row,
186343
- // The DB column is nullable (legacy DDL), but every real caller supplies a
186344
- // group_id (routes/executor-routes.ts requires it; scheduler.ts/
186345
- // process-routes.ts pass ""), so this never actually surfaces null.
186346
- group_id: row.group_id ?? "",
186347
186343
  executor_type: row.executor_type || "command",
186348
186344
  prompt_provider: row.prompt_provider ?? null,
186349
186345
  pty: fromDbBool(row.pty),
@@ -186367,49 +186363,19 @@ var mapRemoteExecutorProcess = (row) => ({
186367
186363
  machine_id: row.machine_id
186368
186364
  });
186369
186365
  var createExecutorRepos = (kdb, h) => ({
186370
- executorGroups: {
186371
- create: async ({ id, project_id, name: name25, branch }) => {
186372
- await kdb.insertInto("executor_groups").values({ id, project_id, name: name25, branch }).execute();
186373
- const row = await kdb.selectFrom("executor_groups").selectAll().where("id", "=", id).executeTakeFirstOrThrow();
186374
- return row;
186375
- },
186376
- getByProjectId: async (projectId) => {
186377
- return kdb.selectFrom("executor_groups").selectAll().where("project_id", "=", projectId).orderBy("created_at", "asc").execute();
186378
- },
186379
- getById: async (id) => {
186380
- return kdb.selectFrom("executor_groups").selectAll().where("id", "=", id).executeTakeFirst();
186381
- },
186382
- getByBranch: async (projectId, branch) => {
186383
- return kdb.selectFrom("executor_groups").selectAll().where("project_id", "=", projectId).where("branch", "=", branch).executeTakeFirst();
186384
- },
186385
- createIfBranchFree: async ({ id, project_id, name: name25, branch }) => {
186386
- const result = await kdb.insertInto("executor_groups").values({ id, project_id, name: name25, branch }).onConflict((oc) => oc.columns(["project_id", "branch"]).doNothing()).executeTakeFirst();
186387
- const group2 = await kdb.selectFrom("executor_groups").selectAll().where("project_id", "=", project_id).where("branch", "=", branch).executeTakeFirstOrThrow();
186388
- return { created: (result?.numInsertedOrUpdatedRows ?? 0n) > 0n, group: group2 };
186389
- },
186390
- update: async (id, opts) => {
186391
- if (opts.name !== void 0) {
186392
- await kdb.updateTable("executor_groups").set({ name: opts.name }).where("id", "=", id).execute();
186393
- }
186394
- return kdb.selectFrom("executor_groups").selectAll().where("id", "=", id).executeTakeFirst();
186395
- },
186396
- delete: async (id) => {
186397
- await kdb.deleteFrom("executor_groups").where("id", "=", id).execute();
186398
- }
186399
- },
186400
186366
  executors: {
186401
- create: async ({ id, project_id, group_id, name: name25, command, executor_type, prompt_provider, cwd, pty: pty2 }) => {
186367
+ create: async ({ id, project_id, workspace_id, name: name25, command, executor_type, prompt_provider, cwd, pty: pty2 }) => {
186402
186368
  await kdb.insertInto("executors").values((eb) => ({
186403
186369
  id,
186404
186370
  project_id,
186405
- group_id,
186371
+ workspace_id,
186406
186372
  name: name25,
186407
186373
  command,
186408
186374
  executor_type: executor_type ?? "command",
186409
186375
  prompt_provider: prompt_provider ?? null,
186410
186376
  cwd: cwd ?? null,
186411
186377
  pty: h.toDbBool(pty2 !== false),
186412
- position: eb.selectFrom("executors").select(sql`coalesce(max(position), -1) + 1`.as("next_position")).where("group_id", "=", group_id)
186378
+ position: eb.selectFrom("executors").select(sql`coalesce(max(position), -1) + 1`.as("next_position")).where("workspace_id", "=", workspace_id)
186413
186379
  })).execute();
186414
186380
  const row = await kdb.selectFrom("executors").selectAll().where("id", "=", id).executeTakeFirstOrThrow();
186415
186381
  return mapExecutor(row);
@@ -186418,8 +186384,8 @@ var createExecutorRepos = (kdb, h) => ({
186418
186384
  const rows = await kdb.selectFrom("executors").selectAll().where("project_id", "=", projectId).orderBy("position", "asc").execute();
186419
186385
  return rows.map(mapExecutor);
186420
186386
  },
186421
- getByGroupId: async (groupId) => {
186422
- const rows = await kdb.selectFrom("executors").selectAll().where("group_id", "=", groupId).orderBy("position", "asc").execute();
186387
+ getByWorkspaceId: async (workspaceId) => {
186388
+ const rows = await kdb.selectFrom("executors").selectAll().where("workspace_id", "=", workspaceId).orderBy("position", "asc").execute();
186423
186389
  return rows.map(mapExecutor);
186424
186390
  },
186425
186391
  getById: async (id) => {
@@ -186456,10 +186422,10 @@ var createExecutorRepos = (kdb, h) => ({
186456
186422
  delete: async (id) => {
186457
186423
  await kdb.deleteFrom("executors").where("id", "=", id).execute();
186458
186424
  },
186459
- reorder: async (groupId, orderedIds) => {
186425
+ reorder: async (workspaceId, orderedIds) => {
186460
186426
  await kdb.transaction().execute(async (trx) => {
186461
186427
  for (let i = 0; i < orderedIds.length; i++) {
186462
- await trx.updateTable("executors").set({ position: i }).where("id", "=", orderedIds[i]).where("group_id", "=", groupId).execute();
186428
+ await trx.updateTable("executors").set({ position: i }).where("id", "=", orderedIds[i]).where("workspace_id", "=", workspaceId).execute();
186463
186429
  }
186464
186430
  });
186465
186431
  }
@@ -187361,6 +187327,10 @@ var createAgentSessionRepos = (kdb, h) => ({
187361
187327
  }
187362
187328
  },
187363
187329
  workspaceBindingMigration: {
187330
+ listUnboundLocalProjects: async () => {
187331
+ const rows = await kdb.selectFrom("agent_sessions as s").innerJoin("projects as p", "p.id", "s.project_id").select(["p.id", "p.path"]).where("s.workspace_checkout_id", "is", null).where("p.path", "is not", null).where("p.path", "<>", "").groupBy(["p.id", "p.path"]).execute();
187332
+ return rows.map((row) => ({ id: row.id, path: row.path }));
187333
+ },
187364
187334
  backfill: async ({ kind, dryRun = true, batchSize = 100, afterId = "" }) => {
187365
187335
  const limit = Math.max(1, Math.min(1e3, batchSize));
187366
187336
  const source = kind === "local" ? await kdb.selectFrom("agent_sessions").select(["id", "project_id", "branch"]).where("workspace_checkout_id", "is", null).where("id", ">", afterId).orderBy("id", "asc").limit(limit).execute() : await kdb.selectFrom("remote_session_mappings").select(["local_session_id as id", "project_id", "branch", "remote_server_id"]).where("workspace_checkout_id", "is", null).where("local_session_id", ">", afterId).orderBy("local_session_id", "asc").limit(limit).execute();
@@ -203465,6 +203435,14 @@ var createWorkspaceRegistryRepo = (kdb, h) => ({
203465
203435
  }
203466
203436
  };
203467
203437
  },
203438
+ getWorkspaceById: async (workspaceId) => {
203439
+ const row = await kdb.selectFrom("workspaces").selectAll().where("id", "=", workspaceId).executeTakeFirst();
203440
+ return row ? mapWorkspace(row) : void 0;
203441
+ },
203442
+ getWorkspaceByProjectBranch: async (projectId, branch) => {
203443
+ const row = await kdb.selectFrom("workspaces").selectAll().where("project_id", "=", projectId).where("branch", "=", branch).executeTakeFirst();
203444
+ return row ? mapWorkspace(row) : void 0;
203445
+ },
203468
203446
  markCheckoutDeleted: async (checkoutId) => {
203469
203447
  await kdb.transaction().execute(async (trx) => {
203470
203448
  const checkout = await trx.selectFrom("workspace_checkouts").select(["workspace_id", "deleted_at"]).where("id", "=", checkoutId).executeTakeFirst();
@@ -203726,20 +203704,10 @@ var createDatabase = (dbPath) => {
203726
203704
  CREATE INDEX IF NOT EXISTS idx_project_chat_operations_thread_status_created_id
203727
203705
  ON project_chat_operations(thread_id, status, created_at, id);
203728
203706
 
203729
- CREATE TABLE IF NOT EXISTS executor_groups (
203730
- id TEXT PRIMARY KEY,
203731
- project_id TEXT NOT NULL,
203732
- name TEXT NOT NULL,
203733
- branch TEXT NOT NULL DEFAULT '',
203734
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
203735
- UNIQUE(project_id, branch),
203736
- FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
203737
- );
203738
-
203739
203707
  CREATE TABLE IF NOT EXISTS executors (
203740
203708
  id TEXT PRIMARY KEY,
203741
203709
  project_id TEXT NOT NULL,
203742
- group_id TEXT,
203710
+ workspace_id TEXT NOT NULL,
203743
203711
  name TEXT NOT NULL,
203744
203712
  command TEXT NOT NULL,
203745
203713
  executor_type TEXT DEFAULT 'command',
@@ -203750,7 +203718,7 @@ var createDatabase = (dbPath) => {
203750
203718
  disabled_targets TEXT DEFAULT '[]',
203751
203719
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
203752
203720
  FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
203753
- FOREIGN KEY (group_id) REFERENCES executor_groups(id) ON DELETE CASCADE
203721
+ FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE
203754
203722
  );
203755
203723
 
203756
203724
  CREATE TABLE IF NOT EXISTS executor_processes (
@@ -204261,31 +204229,6 @@ var createDatabase = (dbPath) => {
204261
204229
  db.exec("CREATE INDEX IF NOT EXISTS idx_projects_user_id ON projects(user_id)");
204262
204230
  }
204263
204231
  db.exec("UPDATE projects SET user_id = 'local' WHERE user_id = ''");
204264
- const hasGroupIdColumn = tableInfo.some((col) => col.name === "group_id");
204265
- if (!hasGroupIdColumn) {
204266
- db.exec(`
204267
- CREATE TABLE IF NOT EXISTS executor_groups (
204268
- id TEXT PRIMARY KEY,
204269
- project_id TEXT NOT NULL,
204270
- name TEXT NOT NULL,
204271
- branch TEXT NOT NULL DEFAULT '',
204272
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
204273
- UNIQUE(project_id, branch),
204274
- FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
204275
- )
204276
- `);
204277
- db.exec("ALTER TABLE executors ADD COLUMN group_id TEXT REFERENCES executor_groups(id) ON DELETE CASCADE");
204278
- const projects = db.prepare("SELECT DISTINCT project_id FROM executors").all();
204279
- for (const { project_id } of projects) {
204280
- const groupId = `default-${project_id}`;
204281
- db.prepare(
204282
- "INSERT OR IGNORE INTO executor_groups (id, project_id, name, branch) VALUES (@id, @project_id, 'Default', '')"
204283
- ).run({ id: groupId, project_id });
204284
- db.prepare(
204285
- "UPDATE executors SET group_id = @group_id WHERE project_id = @project_id AND group_id IS NULL"
204286
- ).run({ group_id: groupId, project_id });
204287
- }
204288
- }
204289
204232
  const taskTableInfo = db.prepare("PRAGMA table_info(tasks)").all();
204290
204233
  const hasAssignedBranchColumn = taskTableInfo.some((col) => col.name === "assigned_branch");
204291
204234
  if (!hasAssignedBranchColumn) {
@@ -205111,6 +205054,79 @@ var createDatabase = (dbPath) => {
205111
205054
  db.prepare(`DELETE FROM global_settings WHERE key IN (${placeholders})`).run(...USER_LEVEL_KEYS);
205112
205055
  });
205113
205056
  migrateUserSettings();
205057
+ const executorColsForWorkspace = db.prepare("PRAGMA table_info(executors)").all();
205058
+ if (executorColsForWorkspace.some((col) => col.name === "group_id")) {
205059
+ db.transaction(() => {
205060
+ const ensureWorkspace = db.prepare(
205061
+ `INSERT INTO workspaces (id, project_id, branch, status, error)
205062
+ VALUES (@id, @project_id, @branch, 'archived', NULL)
205063
+ ON CONFLICT(project_id, branch) DO NOTHING`
205064
+ );
205065
+ const groups = db.prepare(`
205066
+ SELECT DISTINCT g.project_id AS project_id, g.branch AS branch
205067
+ FROM executor_groups g
205068
+ JOIN executors e ON e.group_id = g.id
205069
+ JOIN projects p ON p.id = g.project_id
205070
+ `).all();
205071
+ for (const group2 of groups) {
205072
+ ensureWorkspace.run({ id: crypto5.randomUUID(), project_id: group2.project_id, branch: group2.branch });
205073
+ }
205074
+ const orphanProjects = db.prepare(`
205075
+ SELECT DISTINCT e.project_id AS project_id
205076
+ FROM executors e
205077
+ JOIN projects p ON p.id = e.project_id
205078
+ WHERE e.group_id IS NULL
205079
+ OR NOT EXISTS (SELECT 1 FROM executor_groups g WHERE g.id = e.group_id)
205080
+ `).all();
205081
+ for (const { project_id } of orphanProjects) {
205082
+ ensureWorkspace.run({ id: crypto5.randomUUID(), project_id, branch: "" });
205083
+ }
205084
+ db.exec(`
205085
+ CREATE TABLE executors_workspace_new (
205086
+ id TEXT PRIMARY KEY,
205087
+ project_id TEXT NOT NULL,
205088
+ workspace_id TEXT NOT NULL,
205089
+ name TEXT NOT NULL,
205090
+ command TEXT NOT NULL,
205091
+ executor_type TEXT DEFAULT 'command',
205092
+ prompt_provider TEXT,
205093
+ cwd TEXT,
205094
+ pty INTEGER DEFAULT 1,
205095
+ position INTEGER DEFAULT 0,
205096
+ disabled_targets TEXT DEFAULT '[]',
205097
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
205098
+ FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
205099
+ FOREIGN KEY (workspace_id) REFERENCES workspaces(id) ON DELETE CASCADE
205100
+ );
205101
+
205102
+ INSERT INTO executors_workspace_new
205103
+ (id, project_id, workspace_id, name, command, executor_type,
205104
+ prompt_provider, cwd, pty, position, disabled_targets, created_at)
205105
+ SELECT e.id, e.project_id, w.id, e.name, e.command, e.executor_type,
205106
+ e.prompt_provider, e.cwd, e.pty,
205107
+ ROW_NUMBER() OVER (
205108
+ PARTITION BY w.id ORDER BY e.position, e.created_at, e.id
205109
+ ) - 1,
205110
+ e.disabled_targets, e.created_at
205111
+ FROM executors e
205112
+ LEFT JOIN executor_groups g ON g.id = e.group_id
205113
+ JOIN workspaces w
205114
+ ON w.project_id = e.project_id AND w.branch = COALESCE(g.branch, '');
205115
+ `);
205116
+ const dropped = db.prepare(
205117
+ "SELECT COUNT(*) AS n FROM executors WHERE id NOT IN (SELECT id FROM executors_workspace_new)"
205118
+ ).get().n;
205119
+ if (dropped > 0) {
205120
+ console.warn(`[storage] executor\u2192workspace migration skipped ${dropped} executor(s) with no surviving project`);
205121
+ }
205122
+ db.exec(`
205123
+ DROP TABLE executors;
205124
+ ALTER TABLE executors_workspace_new RENAME TO executors;
205125
+ DROP TABLE IF EXISTS executor_groups;
205126
+ `);
205127
+ })();
205128
+ }
205129
+ db.exec("CREATE INDEX IF NOT EXISTS idx_executors_workspace ON executors(workspace_id, position)");
205114
205130
  db.pragma("foreign_keys = ON");
205115
205131
  return db;
205116
205132
  };
@@ -206338,6 +206354,92 @@ ${GREEN}Done${info}${RESET}
206338
206354
  }
206339
206355
  return terminals;
206340
206356
  }
206357
+ /**
206358
+ * Running processes — executor runs and interactive terminals alike — whose
206359
+ * working directory is `root` or below it. Used to clear a worktree before
206360
+ * it is deleted out from under them.
206361
+ *
206362
+ * Matching is by cwd rather than by branch on purpose: only terminals carry
206363
+ * a `branch`, executor runs are always recorded with `branch: null`, and on
206364
+ * a reverse-connect worker they are path-based with no executor row to join
206365
+ * through. The cwd is the one identity every spawn path records.
206366
+ */
206367
+ getRunningProcessIdsUnderPath(root) {
206368
+ const resolvedRoot = path5.resolve(root);
206369
+ const ids = [];
206370
+ for (const [id, proc] of this.processes) {
206371
+ const relative = path5.relative(resolvedRoot, path5.resolve(proc.projectPath));
206372
+ const outside = relative === ".." || relative.startsWith(`..${path5.sep}`) || path5.isAbsolute(relative);
206373
+ if (relative !== "" && outside) continue;
206374
+ if (this.isRunning(id)) ids.push(id);
206375
+ }
206376
+ return ids;
206377
+ }
206378
+ /**
206379
+ * True once the tracked process has genuinely exited (or is no longer
206380
+ * tracked at all).
206381
+ *
206382
+ * Deliberately not `!isRunning()`: that helper treats `ChildProcess.killed`
206383
+ * as exited, and Node sets `killed` the moment a signal is *delivered*, so
206384
+ * it would report success while the process is still winding down. Real
206385
+ * exit is only observable through `exitCode`/`signalCode` for a child, or
206386
+ * the "finished" log the PTY exit handler appends.
206387
+ */
206388
+ hasExited(processId) {
206389
+ const runningProcess = this.processes.get(processId);
206390
+ if (!runningProcess) return true;
206391
+ if (runningProcess.isPty) {
206392
+ return runningProcess.logs[runningProcess.logs.length - 1]?.type === "finished";
206393
+ }
206394
+ const childProcess2 = runningProcess.process;
206395
+ return childProcess2.exitCode !== null || childProcess2.signalCode !== null;
206396
+ }
206397
+ async waitForExit(processId, timeoutMs) {
206398
+ const deadline = Date.now() + timeoutMs;
206399
+ while (!this.hasExited(processId)) {
206400
+ if (Date.now() >= deadline) return false;
206401
+ await new Promise((resolve3) => setTimeout(resolve3, 25));
206402
+ }
206403
+ return true;
206404
+ }
206405
+ signalProcessGroup(processId, signal) {
206406
+ const runningProcess = this.processes.get(processId);
206407
+ if (!runningProcess) return;
206408
+ const pid = runningProcess.isPty ? runningProcess.process.pid : runningProcess.process.pid;
206409
+ if (!pid) return;
206410
+ try {
206411
+ process.kill(-pid, signal);
206412
+ } catch {
206413
+ try {
206414
+ process.kill(pid, signal);
206415
+ } catch {
206416
+ }
206417
+ }
206418
+ }
206419
+ /**
206420
+ * Stop a process and confirm it actually exited, escalating to SIGKILL when
206421
+ * SIGTERM is ignored. Returns false if it is still alive after that.
206422
+ *
206423
+ * `stop()` alone is not enough for a caller that needs the working directory
206424
+ * to be free — deleting a worktree — because it reports only that a signal
206425
+ * was delivered. SIGTERM is asynchronous and can be trapped or ignored, so
206426
+ * the process may still be writing into the tree when `stop()` resolves.
206427
+ *
206428
+ * What this confirms is the exit of the tracked process, and with it
206429
+ * whatever else shared its process group. A grandchild that detached into
206430
+ * its own group or session is not observable here and is not covered.
206431
+ */
206432
+ async stopAndWait(processId, opts) {
206433
+ await this.stop(processId);
206434
+ if (await this.waitForExit(processId, opts?.termGraceMs ?? 3e3)) return true;
206435
+ console.warn(`[ProcessManager] Process ${processId} ignored SIGTERM, escalating to SIGKILL`);
206436
+ this.signalProcessGroup(processId, "SIGKILL");
206437
+ const exited = await this.waitForExit(processId, opts?.killGraceMs ?? 2e3);
206438
+ if (!exited) {
206439
+ console.error(`[ProcessManager] Process ${processId} survived SIGKILL \u2014 cannot confirm exit`);
206440
+ }
206441
+ return exited;
206442
+ }
206341
206443
  /**
206342
206444
  * Get all processes for a given executor ID with their status and logs
206343
206445
  */
@@ -207410,8 +207512,12 @@ function reconcileWorktreeBranches(projectPath, entries, sessionBranches = [], r
207410
207512
  }
207411
207513
  const rootEntry = entries[0];
207412
207514
  const rootAnchor = rootEntry ? registryByPath.get(path6.resolve(rootEntry.path)) : void 0;
207413
- const rootDrifted = Boolean(rootAnchor) && rootEntry?.branch != null && rootEntry.branch !== rootAnchor.expectedBranch;
207414
- const worktrees = [rootDrifted ? { branch: null, currentBranch: rootEntry?.branch ?? null } : { branch: null }];
207515
+ const rootExpectedBranch = rootAnchor?.expectedBranch || void 0;
207516
+ const rootDrifted = rootExpectedBranch !== void 0 && rootEntry?.branch != null && rootEntry.branch !== rootExpectedBranch;
207517
+ const root = { branch: null };
207518
+ if (rootExpectedBranch) root.expectedBranch = rootExpectedBranch;
207519
+ if (rootDrifted) root.currentBranch = rootEntry?.branch ?? null;
207520
+ const worktrees = [root];
207415
207521
  for (let i = 1; i < entries.length; i++) {
207416
207522
  const entry = entries[i];
207417
207523
  const anchor = registryByPath.get(path6.resolve(entry.path));
@@ -207458,6 +207564,15 @@ async function getRegisteredWorktreeBranches(storage, projectId, projectPath) {
207458
207564
  if (existing.checkout.status === "creating" || existing.checkout.status === "error") {
207459
207565
  await storage.workspaceRegistry.setCheckoutStatus(existing.checkout.id, "ready");
207460
207566
  }
207567
+ if (index === 0 && existing.checkout.expected_branch === "" && entry.branch) {
207568
+ await storage.workspaceRegistry.registerReadyCheckout({
207569
+ projectId,
207570
+ branch: existing.workspace.branch,
207571
+ targetId: "local",
207572
+ worktreePath: entry.path,
207573
+ expectedBranch: entry.branch
207574
+ });
207575
+ }
207461
207576
  continue;
207462
207577
  }
207463
207578
  if (registeredPaths.has(resolvedPath) || entry.branch === null && index > 0) continue;
@@ -230144,6 +230259,16 @@ var AgentSessionManager = class {
230144
230259
  }
230145
230260
  return results;
230146
230261
  }
230262
+ /**
230263
+ * Ids of the sessions in one workspace that still own a live child process,
230264
+ * whatever their turn status. Deliberately broader than
230265
+ * `getRunningResidentProcesses`, which also demands `status === "running"`:
230266
+ * a resident process idling between turns is exactly the one that would be
230267
+ * orphaned when its worktree is deleted.
230268
+ */
230269
+ getLiveSessionIdsForBranch(projectId, branch) {
230270
+ return [...this.sessions.values()].filter((session) => session.projectId === projectId && session.branch === branch && this.isProcessAlive(session)).map((session) => session.id);
230271
+ }
230147
230272
  /**
230148
230273
  * Check if a session is running
230149
230274
  */
@@ -230156,8 +230281,11 @@ var AgentSessionManager = class {
230156
230281
  * (like pressing ESC in Claude Code). The session becomes dormant so the
230157
230282
  * next user message will spawn a fresh process with full context replay.
230158
230283
  * The WebSocket stays alive so the UI remains connected.
230284
+ *
230285
+ * `opts.note` overrides the system entry written into the conversation, for
230286
+ * stops the user did not press Stop for (e.g. the worktree being deleted).
230159
230287
  */
230160
- async stopSession(sessionId) {
230288
+ async stopSession(sessionId, opts) {
230161
230289
  const session = this.sessions.get(sessionId);
230162
230290
  if (!session) {
230163
230291
  return false;
@@ -230176,7 +230304,7 @@ var AgentSessionManager = class {
230176
230304
  session.store.currentAssistantIndex = null;
230177
230305
  await this.pushEntry(sessionId, {
230178
230306
  type: "system",
230179
- content: "Session stopped by user.",
230307
+ content: opts?.note ?? "Session stopped by user.",
230180
230308
  timestamp: Date.now()
230181
230309
  });
230182
230310
  await this.endActiveTurn(session, "stopped");
@@ -230200,6 +230328,41 @@ var AgentSessionManager = class {
230200
230328
  return false;
230201
230329
  }
230202
230330
  }
230331
+ /**
230332
+ * Stop a session and confirm its agent process actually exited, escalating
230333
+ * to SIGKILL when SIGTERM is ignored. Returns false if the process is still
230334
+ * alive after that.
230335
+ *
230336
+ * `stopSession` returns as soon as the signal has been sent, which is fine
230337
+ * for the Stop button but not for a caller that is about to delete the
230338
+ * session's working directory: an agent that traps SIGTERM to flush state
230339
+ * would keep writing into a tree that no longer exists.
230340
+ *
230341
+ * Confirms the tracked agent process, and with it whatever else shared its
230342
+ * process group. A grandchild that detached into its own group or session
230343
+ * (an MCP server started with `setsid`, say) is not observable here.
230344
+ */
230345
+ async stopSessionAndWait(sessionId, opts) {
230346
+ const proc = this.sessions.get(sessionId)?.process ?? null;
230347
+ const stopped = await this.stopSession(sessionId, { note: opts?.note });
230348
+ if (!stopped || !proc) return stopped;
230349
+ if (await this.waitForProcessExit(proc, opts?.termGraceMs ?? 3e3)) return true;
230350
+ console.warn(`[AgentSession] Session ${sessionId} ignored SIGTERM, escalating to SIGKILL`);
230351
+ this.killProcess(proc, "SIGKILL");
230352
+ const exited = await this.waitForProcessExit(proc, opts?.killGraceMs ?? 2e3);
230353
+ if (!exited) {
230354
+ console.error(`[AgentSession] Session ${sessionId} survived SIGKILL \u2014 cannot confirm exit`);
230355
+ }
230356
+ return exited;
230357
+ }
230358
+ async waitForProcessExit(proc, timeoutMs) {
230359
+ const deadline = Date.now() + timeoutMs;
230360
+ while (proc.exitCode === null && proc.signalCode === null) {
230361
+ if (Date.now() >= deadline) return false;
230362
+ await new Promise((resolve3) => setTimeout(resolve3, 25));
230363
+ }
230364
+ return true;
230365
+ }
230203
230366
  async hibernateSession(sessionId) {
230204
230367
  const session = this.sessions.get(sessionId);
230205
230368
  if (!session) return false;
@@ -232735,12 +232898,12 @@ var ChatSessionManager = class {
232735
232898
  console.log(`[ChatSession] handleExecutorFinished: executor not found`);
232736
232899
  return;
232737
232900
  }
232738
- const group2 = await this.storage.executorGroups.getById(executor.group_id);
232739
- if (!group2) {
232740
- console.log(`[ChatSession] handleExecutorFinished: group not found for executor.group_id=${executor.group_id}`);
232901
+ const workspace = await this.storage.workspaceRegistry.getWorkspaceById(executor.workspace_id);
232902
+ if (!workspace) {
232903
+ console.log(`[ChatSession] handleExecutorFinished: workspace not found for executor.workspace_id=${executor.workspace_id}`);
232741
232904
  return;
232742
232905
  }
232743
- const branch = group2.branch || null;
232906
+ const branch = workspace.branch || null;
232744
232907
  const key2 = `${event.projectId}:${branch ?? ""}`;
232745
232908
  const sessionId = this.sessionIndex.get(key2);
232746
232909
  if (!sessionId) {
@@ -233767,11 +233930,11 @@ var ChatSessionManager = class {
233767
233930
  tailLines: external_exports.number().min(1).max(100).default(20).describe("Number of recent output lines to include per executor")
233768
233931
  }),
233769
233932
  execute: async ({ tailLines }) => {
233770
- const group2 = await storage.executorGroups.getByBranch(projectId, branch ?? "");
233771
- if (!group2) {
233772
- return { executors: [], message: "No executor group found for this workspace." };
233933
+ const workspace = await storage.workspaceRegistry.getWorkspaceByProjectBranch(projectId, branch ?? "");
233934
+ if (!workspace) {
233935
+ return { executors: [], message: "No workspace found for this branch." };
233773
233936
  }
233774
- const executors = await storage.executors.getByGroupId(group2.id);
233937
+ const executors = await storage.executors.getByWorkspaceId(workspace.id);
233775
233938
  const now3 = Date.now();
233776
233939
  const results = await Promise.all(executors.map(async (executor) => {
233777
233940
  const lastRow = await storage.executorProcesses.getLastByExecutorId(executor.id);
@@ -233813,11 +233976,11 @@ var ChatSessionManager = class {
233813
233976
  remote: external_exports.string().optional().describe("Remote server name or ID to run the executor on. If omitted, uses project executor_mode or runs locally.")
233814
233977
  }),
233815
233978
  execute: async ({ executorName, remote }) => {
233816
- const group2 = await storage.executorGroups.getByBranch(projectId, branch ?? "");
233817
- if (!group2) {
233818
- return { success: false, message: "No executor group found for this workspace." };
233979
+ const workspace = await storage.workspaceRegistry.getWorkspaceByProjectBranch(projectId, branch ?? "");
233980
+ if (!workspace) {
233981
+ return { success: false, message: "No workspace found for this branch." };
233819
233982
  }
233820
- const executors = await storage.executors.getByGroupId(group2.id);
233983
+ const executors = await storage.executors.getByWorkspaceId(workspace.id);
233821
233984
  const executor = executors.find(
233822
233985
  (e) => e.name.toLowerCase() === executorName.toLowerCase()
233823
233986
  );
@@ -233953,11 +234116,11 @@ var ChatSessionManager = class {
233953
234116
  remote: external_exports.string().optional().describe("Remote server name or ID where the executor is running. If omitted, auto-detects.")
233954
234117
  }),
233955
234118
  execute: async ({ executorName, remote }) => {
233956
- const group2 = await storage.executorGroups.getByBranch(projectId, branch ?? "");
233957
- if (!group2) {
233958
- return { success: false, message: "No executor group found for this workspace." };
234119
+ const workspace = await storage.workspaceRegistry.getWorkspaceByProjectBranch(projectId, branch ?? "");
234120
+ if (!workspace) {
234121
+ return { success: false, message: "No workspace found for this branch." };
233959
234122
  }
233960
- const executors = await storage.executors.getByGroupId(group2.id);
234123
+ const executors = await storage.executors.getByWorkspaceId(workspace.id);
233961
234124
  const executor = executors.find(
233962
234125
  (e) => e.name.toLowerCase() === executorName.toLowerCase()
233963
234126
  );
@@ -239675,7 +239838,7 @@ var SchedulerService = class {
239675
239838
  const executor = {
239676
239839
  id: `schedule-${task.id}`,
239677
239840
  project_id: task.project_id,
239678
- group_id: "",
239841
+ workspace_id: "",
239679
239842
  name: task.name,
239680
239843
  command: buildRunContent(task),
239681
239844
  executor_type: task.run_type,
@@ -240242,9 +240405,8 @@ async function registerReportedWorktrees(storage, opts) {
240242
240405
  }
240243
240406
  }
240244
240407
  async function syncLocalWorkspaceRegistry(storage) {
240245
- const projects = await storage.projects.getAll();
240408
+ const projects = await storage.workspaceBindingMigration.listUnboundLocalProjects();
240246
240409
  for (const project of projects) {
240247
- if (!project.path) continue;
240248
240410
  try {
240249
240411
  await getRegisteredWorktreeBranches(storage, project.id, project.path);
240250
240412
  } catch (error48) {
@@ -241456,91 +241618,15 @@ var routes5 = async (fastify2) => {
241456
241618
  };
241457
241619
  var project_remote_routes_default = (0, import_fastify_plugin6.default)(routes5, { name: "project-remote-routes" });
241458
241620
 
241459
- // src/routes/executor-group-routes.ts
241621
+ // src/routes/executor-routes.ts
241460
241622
  var import_fastify_plugin7 = __toESM(require_plugin2(), 1);
241461
241623
  import { randomUUID as randomUUID11 } from "crypto";
241462
- var routes6 = async (fastify2) => {
241463
- fastify2.get(
241464
- "/api/projects/:projectId/executor-groups",
241465
- async (req, reply) => {
241466
- const userId = requireUserFacingUserId(req, reply);
241467
- if (userId === null) return;
241468
- const project = await fastify2.storage.projects.getById(req.params.projectId, userId);
241469
- if (!project) {
241470
- return reply.code(404).send({ error: "Project not found" });
241471
- }
241472
- const groups = await fastify2.storage.executorGroups.getByProjectId(req.params.projectId);
241473
- return reply.code(200).send({ groups });
241474
- }
241475
- );
241476
- fastify2.get(
241477
- "/api/projects/:projectId/executor-groups/by-branch",
241478
- async (req, reply) => {
241479
- const userId = requireUserFacingUserId(req, reply);
241480
- if (userId === null) return;
241481
- const project = await fastify2.storage.projects.getById(req.params.projectId, userId);
241482
- if (!project) {
241483
- return reply.code(404).send({ error: "Project not found" });
241484
- }
241485
- const branch = req.query.branch ?? "";
241486
- const group2 = await fastify2.storage.executorGroups.getByBranch(req.params.projectId, branch);
241487
- if (!group2) {
241488
- return reply.code(404).send({ error: "Executor group not found for this branch" });
241489
- }
241490
- return reply.code(200).send({ group: group2 });
241491
- }
241492
- );
241493
- fastify2.post("/api/projects/:projectId/executor-groups", async (req, reply) => {
241494
- const userId = requireUserFacingUserId(req, reply);
241495
- if (userId === null) return;
241496
- const project = await fastify2.storage.projects.getById(req.params.projectId, userId);
241497
- if (!project) {
241498
- return reply.code(404).send({ error: "Project not found" });
241499
- }
241500
- const { name: name25, branch } = req.body;
241501
- const id = randomUUID11();
241502
- const result = await fastify2.storage.executorGroups.createIfBranchFree({
241503
- id,
241504
- project_id: req.params.projectId,
241505
- name: name25,
241506
- branch
241507
- });
241508
- if (!result.created) {
241509
- return reply.code(409).send({ error: "An executor group already exists for this branch" });
241510
- }
241511
- return reply.code(201).send({ group: result.group });
241512
- });
241513
- fastify2.put("/api/executor-groups/:id", async (req, reply) => {
241514
- const existing = await fastify2.storage.executorGroups.getById(req.params.id);
241515
- if (!existing) {
241516
- return reply.code(404).send({ error: "Executor group not found" });
241517
- }
241518
- const group2 = await fastify2.storage.executorGroups.update(req.params.id, req.body);
241519
- return reply.code(200).send({ group: group2 });
241520
- });
241521
- fastify2.delete(
241522
- "/api/executor-groups/:id",
241523
- async (req, reply) => {
241524
- const existing = await fastify2.storage.executorGroups.getById(req.params.id);
241525
- if (!existing) {
241526
- return reply.code(404).send({ error: "Executor group not found" });
241527
- }
241528
- await fastify2.storage.executorGroups.delete(req.params.id);
241529
- return reply.code(200).send({ success: true });
241530
- }
241531
- );
241532
- };
241533
- var executor_group_routes_default = (0, import_fastify_plugin7.default)(routes6, { name: "executor-group-routes" });
241534
-
241535
- // src/routes/executor-routes.ts
241536
- var import_fastify_plugin8 = __toESM(require_plugin2(), 1);
241537
- import { randomUUID as randomUUID12 } from "crypto";
241538
241624
  function normalizeSqlTimestamp(value) {
241539
241625
  if (!value) return null;
241540
241626
  if (value.includes("T") && /(Z|[+-]\d{2}:?\d{2})$/.test(value)) return value;
241541
241627
  return value.replace(" ", "T") + "Z";
241542
241628
  }
241543
- var routes7 = async (fastify2) => {
241629
+ var routes6 = async (fastify2) => {
241544
241630
  fastify2.get(
241545
241631
  "/api/projects/:projectId/executors",
241546
241632
  async (req, reply) => {
@@ -241550,7 +241636,16 @@ var routes7 = async (fastify2) => {
241550
241636
  if (!project) {
241551
241637
  return reply.code(404).send({ error: "Project not found" });
241552
241638
  }
241553
- const executors = req.query.groupId ? await fastify2.storage.executors.getByGroupId(req.query.groupId) : await fastify2.storage.executors.getByProjectId(req.params.projectId);
241639
+ let executors;
241640
+ if (req.query.branch === void 0) {
241641
+ executors = await fastify2.storage.executors.getByProjectId(req.params.projectId);
241642
+ } else {
241643
+ const workspace = await fastify2.storage.workspaceRegistry.getWorkspaceByProjectBranch(
241644
+ req.params.projectId,
241645
+ req.query.branch
241646
+ );
241647
+ executors = workspace ? await fastify2.storage.executors.getByWorkspaceId(workspace.id) : [];
241648
+ }
241554
241649
  const executorIds = executors.map((e) => e.id);
241555
241650
  const hasLocal = !!project.path;
241556
241651
  const hasRemotes = (await fastify2.storage.projectRemotes.getByProject(req.params.projectId)).length > 0;
@@ -241592,17 +241687,24 @@ var routes7 = async (fastify2) => {
241592
241687
  if (!project) {
241593
241688
  return reply.code(404).send({ error: "Project not found" });
241594
241689
  }
241595
- const { name: name25, command, executor_type, prompt_provider, cwd, pty: pty2, group_id } = req.body;
241596
- if (!group_id) {
241597
- return reply.code(400).send({ error: "group_id is required" });
241690
+ const { name: name25, command, executor_type, prompt_provider, cwd, pty: pty2, branch } = req.body;
241691
+ if (branch === void 0) {
241692
+ return reply.code(400).send({ error: "branch is required" });
241693
+ }
241694
+ const workspace = await fastify2.storage.workspaceRegistry.getWorkspaceByProjectBranch(
241695
+ req.params.projectId,
241696
+ branch
241697
+ );
241698
+ if (!workspace) {
241699
+ return reply.code(400).send({ error: "No workspace for this branch" });
241598
241700
  }
241599
241701
  const parsedType2 = executor_type === "prompt" ? "prompt" : "command";
241600
241702
  const parsedProvider = prompt_provider === "codex" ? "codex" : "claude";
241601
- const id = randomUUID12();
241703
+ const id = randomUUID11();
241602
241704
  const executor = await fastify2.storage.executors.create({
241603
241705
  id,
241604
241706
  project_id: req.params.projectId,
241605
- group_id,
241707
+ workspace_id: workspace.id,
241606
241708
  name: name25,
241607
241709
  command,
241608
241710
  executor_type: parsedType2,
@@ -241661,31 +241763,38 @@ var routes7 = async (fastify2) => {
241661
241763
  if (!project) {
241662
241764
  return reply.code(404).send({ error: "Project not found" });
241663
241765
  }
241664
- const { orderedIds, groupId } = req.body;
241766
+ const { orderedIds, branch } = req.body;
241665
241767
  if (!Array.isArray(orderedIds)) {
241666
241768
  return reply.code(400).send({ error: "orderedIds must be an array" });
241667
241769
  }
241668
- if (!groupId) {
241669
- return reply.code(400).send({ error: "groupId is required" });
241770
+ if (branch === void 0) {
241771
+ return reply.code(400).send({ error: "branch is required" });
241670
241772
  }
241671
- const existingExecutors = await fastify2.storage.executors.getByGroupId(groupId);
241773
+ const workspace = await fastify2.storage.workspaceRegistry.getWorkspaceByProjectBranch(
241774
+ req.params.projectId,
241775
+ branch
241776
+ );
241777
+ if (!workspace) {
241778
+ return reply.code(400).send({ error: "No workspace for this branch" });
241779
+ }
241780
+ const existingExecutors = await fastify2.storage.executors.getByWorkspaceId(workspace.id);
241672
241781
  const existingIds = new Set(existingExecutors.map((e) => e.id));
241673
241782
  for (const id of orderedIds) {
241674
241783
  if (!existingIds.has(id)) {
241675
- return reply.code(400).send({ error: `Executor ${id} not found in group` });
241784
+ return reply.code(400).send({ error: `Executor ${id} not found in workspace` });
241676
241785
  }
241677
241786
  }
241678
- await fastify2.storage.executors.reorder(groupId, orderedIds);
241787
+ await fastify2.storage.executors.reorder(workspace.id, orderedIds);
241679
241788
  return reply.code(200).send({ success: true });
241680
241789
  });
241681
241790
  };
241682
- var executor_routes_default = (0, import_fastify_plugin8.default)(routes7, { name: "executor-routes" });
241791
+ var executor_routes_default = (0, import_fastify_plugin7.default)(routes6, { name: "executor-routes" });
241683
241792
 
241684
241793
  // src/routes/process-routes.ts
241685
- var import_fastify_plugin9 = __toESM(require_plugin2(), 1);
241794
+ var import_fastify_plugin8 = __toESM(require_plugin2(), 1);
241686
241795
  import path9 from "path";
241687
- import { randomUUID as randomUUID13 } from "crypto";
241688
- var routes8 = async (fastify2) => {
241796
+ import { randomUUID as randomUUID12 } from "crypto";
241797
+ var routes7 = async (fastify2) => {
241689
241798
  fastify2.post("/api/path/execute", async (req, reply) => {
241690
241799
  const userId = requireAuth(req, reply);
241691
241800
  if (userId === null) return;
@@ -241702,9 +241811,9 @@ var routes8 = async (fastify2) => {
241702
241811
  const resolvedBase = resolveWorktreePath(projectPath, branch ?? null);
241703
241812
  const resolvedCwd = cwd ? path9.join(resolvedBase, cwd) : null;
241704
241813
  const tempExecutor = {
241705
- id: randomUUID13(),
241814
+ id: randomUUID12(),
241706
241815
  project_id: project.id,
241707
- group_id: "",
241816
+ workspace_id: "",
241708
241817
  name: "remote-command",
241709
241818
  command,
241710
241819
  executor_type: executor_type === "prompt" ? "prompt" : "command",
@@ -241734,7 +241843,11 @@ var routes8 = async (fastify2) => {
241734
241843
  if (!project) {
241735
241844
  return reply.code(404).send({ error: "Project not found" });
241736
241845
  }
241737
- const branch = req.body?.branch;
241846
+ const workspace = await fastify2.storage.workspaceRegistry.getWorkspaceById(executor.workspace_id);
241847
+ if (!workspace) {
241848
+ return reply.code(400).send({ error: "Executor's workspace no longer exists" });
241849
+ }
241850
+ const branch = workspace.branch || null;
241738
241851
  let executorMode = req.body?.target || project.executor_mode;
241739
241852
  let useRemoteExecutor = executorMode !== "local";
241740
241853
  if (useRemoteExecutor && executorMode === "remote") {
@@ -241897,10 +242010,10 @@ var routes8 = async (fastify2) => {
241897
242010
  return reply.code(200).send({ processes });
241898
242011
  });
241899
242012
  };
241900
- var process_routes_default = (0, import_fastify_plugin9.default)(routes8, { name: "process-routes" });
242013
+ var process_routes_default = (0, import_fastify_plugin8.default)(routes7, { name: "process-routes" });
241901
242014
 
241902
242015
  // src/routes/worktree-routes.ts
241903
- var import_fastify_plugin10 = __toESM(require_plugin2(), 1);
242016
+ var import_fastify_plugin9 = __toESM(require_plugin2(), 1);
241904
242017
  import { mkdir as mkdir3 } from "fs/promises";
241905
242018
 
241906
242019
  // src/utils/path-project.ts
@@ -241946,7 +242059,37 @@ async function syncRemoteWorktreeList(fastify2, projectId, remote, data) {
241946
242059
  worktrees
241947
242060
  });
241948
242061
  }
241949
- var routes9 = async (fastify2) => {
242062
+ var WorktreeBusyError = class extends Error {
242063
+ };
242064
+ async function stopWorkspaceActivity(fastify2, opts) {
242065
+ const sessionIds = [...new Set(
242066
+ opts.projectIds.filter((id) => Boolean(id)).flatMap((id) => fastify2.agentSessionManager.getLiveSessionIdsForBranch(id, opts.branch))
242067
+ )];
242068
+ const processIds = fastify2.processManager.getRunningProcessIdsUnderPath(opts.worktreePath);
242069
+ if (sessionIds.length === 0 && processIds.length === 0) return;
242070
+ const survivors = [];
242071
+ const confirm = async (label, stop) => {
242072
+ try {
242073
+ if (!await stop()) survivors.push(label);
242074
+ } catch (error48) {
242075
+ console.error(`[worktree] Failed to stop ${label} before delete:`, error48);
242076
+ survivors.push(label);
242077
+ }
242078
+ };
242079
+ await Promise.all(sessionIds.map((sessionId) => confirm(`session ${sessionId}`, () => fastify2.agentSessionManager.stopSessionAndWait(sessionId, {
242080
+ note: "Session stopped: its worktree is being deleted."
242081
+ }))));
242082
+ await Promise.all(processIds.map((processId) => confirm(`process ${processId}`, () => fastify2.processManager.stopAndWait(processId))));
242083
+ if (survivors.length > 0) {
242084
+ throw new WorktreeBusyError(
242085
+ `Worktree still has running work that could not be stopped (${survivors.join(", ")}). Nothing was deleted; retry in a moment.`
242086
+ );
242087
+ }
242088
+ console.log(
242089
+ `[worktree] Stopped ${sessionIds.length} session(s) and ${processIds.length} process(es) in ${opts.worktreePath}`
242090
+ );
242091
+ }
242092
+ var routes8 = async (fastify2) => {
241950
242093
  fastify2.get("/api/path/branches", async (req, reply) => {
241951
242094
  const projectPath = req.query.path;
241952
242095
  if (!projectPath) {
@@ -242080,6 +242223,11 @@ var routes9 = async (fastify2) => {
242080
242223
  }
242081
242224
  } catch {
242082
242225
  }
242226
+ await stopWorkspaceActivity(fastify2, {
242227
+ projectIds: [pathProject?.id, `path:${projectPath}`],
242228
+ branch,
242229
+ worktreePath: worktreeAbsPath
242230
+ });
242083
242231
  let branchToDelete = null;
242084
242232
  try {
242085
242233
  const entries = parseGitWorktreeList(projectPath);
@@ -242110,9 +242258,11 @@ var routes9 = async (fastify2) => {
242110
242258
  return reply.code(200).send({ success: true });
242111
242259
  } catch (error48) {
242112
242260
  const errorMessage = error48 instanceof Error ? error48.message : "Unknown error";
242261
+ const busy = error48 instanceof WorktreeBusyError;
242113
242262
  if (registered && !worktreeRemoved) {
242114
- await fastify2.storage.workspaceRegistry.setCheckoutStatus(registered.checkout.id, "error", errorMessage).catch((registryError) => console.error("[worktree] Failed to record delete error:", registryError));
242263
+ await fastify2.storage.workspaceRegistry.setCheckoutStatus(registered.checkout.id, busy ? "ready" : "error", busy ? null : errorMessage).catch((registryError) => console.error("[worktree] Failed to record delete error:", registryError));
242115
242264
  }
242265
+ if (busy) return reply.code(409).send({ error: errorMessage });
242116
242266
  return reply.code(500).send({ error: `Failed to delete worktree: ${errorMessage}` });
242117
242267
  }
242118
242268
  });
@@ -242322,6 +242472,11 @@ var routes9 = async (fastify2) => {
242322
242472
  } catch (err) {
242323
242473
  if (err instanceof Error && err.message.includes("uncommitted changes")) throw err;
242324
242474
  }
242475
+ await stopWorkspaceActivity(fastify2, {
242476
+ projectIds: [project.id],
242477
+ branch,
242478
+ worktreePath: worktreeAbsPath
242479
+ });
242325
242480
  let branchToDelete = null;
242326
242481
  try {
242327
242482
  const entries = parseGitWorktreeList(project.path);
@@ -242352,7 +242507,7 @@ var routes9 = async (fastify2) => {
242352
242507
  } catch (error48) {
242353
242508
  if (registered && !worktreeRemoved) {
242354
242509
  const message = error48 instanceof Error ? error48.message : "Local deletion failed";
242355
- const status = message.includes("uncommitted changes") ? "ready" : "error";
242510
+ const status = message.includes("uncommitted changes") || error48 instanceof WorktreeBusyError ? "ready" : "error";
242356
242511
  await fastify2.storage.workspaceRegistry.setCheckoutStatus(registered.checkout.id, status, status === "error" ? message : null).catch((registryError) => console.error("[worktree] Failed to record local delete error:", registryError));
242357
242512
  }
242358
242513
  throw error48;
@@ -242364,7 +242519,7 @@ var routes9 = async (fastify2) => {
242364
242519
  return reply.code(200).send({ success: true });
242365
242520
  } catch (error48) {
242366
242521
  const errorMessage = error48 instanceof Error ? error48.message : "Unknown error";
242367
- if (errorMessage.includes("uncommitted changes")) {
242522
+ if (errorMessage.includes("uncommitted changes") || error48 instanceof WorktreeBusyError) {
242368
242523
  return reply.code(409).send({ error: errorMessage });
242369
242524
  }
242370
242525
  return reply.code(500).send({ error: `Failed to delete worktree: ${errorMessage}` });
@@ -242627,10 +242782,10 @@ var routes9 = async (fastify2) => {
242627
242782
  });
242628
242783
  });
242629
242784
  };
242630
- var worktree_routes_default = (0, import_fastify_plugin10.default)(routes9, { name: "worktree-routes" });
242785
+ var worktree_routes_default = (0, import_fastify_plugin9.default)(routes8, { name: "worktree-routes" });
242631
242786
 
242632
242787
  // src/routes/diff-routes.ts
242633
- var import_fastify_plugin11 = __toESM(require_plugin2(), 1);
242788
+ var import_fastify_plugin10 = __toESM(require_plugin2(), 1);
242634
242789
  import path10 from "path";
242635
242790
  import { readFileSync as readFileSync4 } from "fs";
242636
242791
  import { execFileSync as execFileSync5 } from "child_process";
@@ -242938,7 +243093,7 @@ async function getUntrackedFiles(cwd) {
242938
243093
  }
242939
243094
  return files;
242940
243095
  }
242941
- var routes10 = async (fastify2) => {
243096
+ var routes9 = async (fastify2) => {
242942
243097
  fastify2.get("/api/path/diff", async (req, reply) => {
242943
243098
  const projectPath = req.query.path;
242944
243099
  if (!projectPath) {
@@ -243129,10 +243284,10 @@ var routes10 = async (fastify2) => {
243129
243284
  }
243130
243285
  });
243131
243286
  };
243132
- var diff_routes_default = (0, import_fastify_plugin11.default)(routes10, { name: "diff-routes" });
243287
+ var diff_routes_default = (0, import_fastify_plugin10.default)(routes9, { name: "diff-routes" });
243133
243288
 
243134
243289
  // src/routes/file-routes.ts
243135
- var import_fastify_plugin12 = __toESM(require_plugin2(), 1);
243290
+ var import_fastify_plugin11 = __toESM(require_plugin2(), 1);
243136
243291
  import path11 from "path";
243137
243292
  import fs2 from "fs/promises";
243138
243293
  import { createReadStream, constants as fsConstants } from "fs";
@@ -243355,7 +243510,7 @@ async function searchSymbol(basePath33, symbol26) {
243355
243510
  }
243356
243511
  return { hits, truncated };
243357
243512
  }
243358
- var routes11 = async (fastify2) => {
243513
+ var routes10 = async (fastify2) => {
243359
243514
  fastify2.get("/api/path/browse", async (req, reply) => {
243360
243515
  const projectPath = req.query.path;
243361
243516
  if (!projectPath) {
@@ -243916,17 +244071,17 @@ var routes11 = async (fastify2) => {
243916
244071
  }
243917
244072
  });
243918
244073
  };
243919
- var file_routes_default = (0, import_fastify_plugin12.default)(routes11, { name: "file-routes" });
244074
+ var file_routes_default = (0, import_fastify_plugin11.default)(routes10, { name: "file-routes" });
243920
244075
 
243921
244076
  // src/routes/agent-session-routes.ts
243922
- var import_fastify_plugin13 = __toESM(require_plugin2(), 1);
244077
+ var import_fastify_plugin12 = __toESM(require_plugin2(), 1);
243923
244078
 
243924
244079
  // src/utils/paste-file.ts
243925
244080
  import { chmod, mkdir as mkdir4, open } from "node:fs/promises";
243926
244081
  import { constants as fsConstants2 } from "node:fs";
243927
244082
  import { tmpdir as tmpdir2 } from "node:os";
243928
244083
  import path12 from "node:path";
243929
- import { randomUUID as randomUUID14 } from "node:crypto";
244084
+ import { randomUUID as randomUUID13 } from "node:crypto";
243930
244085
  var PASTE_DIR = path12.join(tmpdir2(), "vibedeckx-pastes");
243931
244086
  var DIR_MODE = 448;
243932
244087
  var FILE_MODE = 384;
@@ -243934,7 +244089,7 @@ var FILE_FLAGS = fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_E
243934
244089
  async function writePasteToTempFile(content) {
243935
244090
  await mkdir4(PASTE_DIR, { recursive: true, mode: DIR_MODE });
243936
244091
  await chmod(PASTE_DIR, DIR_MODE);
243937
- const filePath = path12.join(PASTE_DIR, `${randomUUID14()}.txt`);
244092
+ const filePath = path12.join(PASTE_DIR, `${randomUUID13()}.txt`);
243938
244093
  const handle = await open(filePath, FILE_FLAGS, FILE_MODE);
243939
244094
  try {
243940
244095
  await handle.writeFile(content, "utf8");
@@ -244292,7 +244447,7 @@ async function distillConversation(storage, userId, messages, conversation, main
244292
244447
  }
244293
244448
 
244294
244449
  // src/routes/agent-session-routes.ts
244295
- import { createHash as createHash6, randomUUID as randomUUID15 } from "crypto";
244450
+ import { createHash as createHash6, randomUUID as randomUUID14 } from "crypto";
244296
244451
 
244297
244452
  // src/protocol/model-suggestions.ts
244298
244453
  var MODEL_SUGGESTIONS = {
@@ -244317,8 +244472,8 @@ function messageTextLength(content) {
244317
244472
  }
244318
244473
  return n;
244319
244474
  }
244320
- var routes12 = async (fastify2) => {
244321
- const instructionReceiverToken = randomUUID15();
244475
+ var routes11 = async (fastify2) => {
244476
+ const instructionReceiverToken = randomUUID14();
244322
244477
  const instructionDeliveryLocks = /* @__PURE__ */ new Map();
244323
244478
  async function serializeInstructionDelivery(key2, effect) {
244324
244479
  const previous = instructionDeliveryLocks.get(key2) ?? Promise.resolve();
@@ -244973,7 +245128,7 @@ var routes12 = async (fastify2) => {
244973
245128
  return reply.code(400).send({ error: "Project has no local path" });
244974
245129
  }
244975
245130
  try {
244976
- const preSessionId = randomUUID15();
245131
+ const preSessionId = randomUUID14();
244977
245132
  const crossRemoteMcp = await mintCrossRemoteMcpConfig(
244978
245133
  { storage: fastify2.storage },
244979
245134
  { userId, sessionId: preSessionId, sourceRemoteServerId: null }
@@ -245529,7 +245684,7 @@ var routes12 = async (fastify2) => {
245529
245684
  messages
245530
245685
  });
245531
245686
  }
245532
- const preSessionId = randomUUID15();
245687
+ const preSessionId = randomUUID14();
245533
245688
  const crossRemoteMcp = await mintCrossRemoteMcpConfig(
245534
245689
  { storage: fastify2.storage },
245535
245690
  { userId, sessionId: preSessionId, sourceRemoteServerId: null }
@@ -245789,10 +245944,10 @@ var routes12 = async (fastify2) => {
245789
245944
  return reply.code(200).send({ success: true, favorited });
245790
245945
  });
245791
245946
  };
245792
- var agent_session_routes_default = (0, import_fastify_plugin13.default)(routes12, { name: "agent-session-routes" });
245947
+ var agent_session_routes_default = (0, import_fastify_plugin12.default)(routes11, { name: "agent-session-routes" });
245793
245948
 
245794
245949
  // src/routes/branch-activity-routes.ts
245795
- var import_fastify_plugin14 = __toESM(require_plugin2(), 1);
245950
+ var import_fastify_plugin13 = __toESM(require_plugin2(), 1);
245796
245951
  function toResponse(map2) {
245797
245952
  return {
245798
245953
  branches: Array.from(map2.entries()).map(([branch, state]) => ({
@@ -245807,7 +245962,7 @@ function fromResponse(resp) {
245807
245962
  resp.branches.map((b2) => [b2.branch ?? "", { activity: b2.activity, since: b2.since }])
245808
245963
  );
245809
245964
  }
245810
- var routes13 = async (fastify2) => {
245965
+ var routes12 = async (fastify2) => {
245811
245966
  function proxyAuto(remoteServerId, method, apiPath, body) {
245812
245967
  return proxyToRemoteAuto(remoteServerId, method, apiPath, body, {
245813
245968
  reverseConnectManager: fastify2.reverseConnectManager
@@ -245872,10 +246027,10 @@ var routes13 = async (fastify2) => {
245872
246027
  }
245873
246028
  );
245874
246029
  };
245875
- var branch_activity_routes_default = (0, import_fastify_plugin14.default)(routes13, { name: "branch-activity-routes" });
246030
+ var branch_activity_routes_default = (0, import_fastify_plugin13.default)(routes12, { name: "branch-activity-routes" });
245876
246031
 
245877
246032
  // src/routes/merge-status-routes.ts
245878
- var import_fastify_plugin15 = __toESM(require_plugin2(), 1);
246033
+ var import_fastify_plugin14 = __toESM(require_plugin2(), 1);
245879
246034
  function resolveTargets(comparisons, storedTargets) {
245880
246035
  const sources = [];
245881
246036
  const effective = comparisons.map((comparison) => {
@@ -245989,7 +246144,7 @@ function sendComputed(reply, repoPath, comparisons, repository) {
245989
246144
  return reply.code(statusCode).send({ error: message });
245990
246145
  }
245991
246146
  }
245992
- var routes14 = async (fastify2) => {
246147
+ var routes13 = async (fastify2) => {
245993
246148
  fastify2.post(
245994
246149
  "/api/path/branches/merge-status",
245995
246150
  async (req, reply) => {
@@ -246111,11 +246266,11 @@ var routes14 = async (fastify2) => {
246111
246266
  }
246112
246267
  );
246113
246268
  };
246114
- var merge_status_routes_default = (0, import_fastify_plugin15.default)(routes14, { name: "merge-status-routes" });
246269
+ var merge_status_routes_default = (0, import_fastify_plugin14.default)(routes13, { name: "merge-status-routes" });
246115
246270
 
246116
246271
  // src/routes/chat-session-routes.ts
246117
- var import_fastify_plugin16 = __toESM(require_plugin2(), 1);
246118
- var routes15 = async (fastify2) => {
246272
+ var import_fastify_plugin15 = __toESM(require_plugin2(), 1);
246273
+ var routes14 = async (fastify2) => {
246119
246274
  const getAuthorizedSession = (req, reply, sessionId) => {
246120
246275
  const authResult = requireUserFacingUserId(req, reply);
246121
246276
  if (authResult === null) return null;
@@ -246220,11 +246375,11 @@ var routes15 = async (fastify2) => {
246220
246375
  return reply.send({ ok: true });
246221
246376
  });
246222
246377
  };
246223
- var chat_session_routes_default = (0, import_fastify_plugin16.default)(routes15, { name: "chat-session-routes" });
246378
+ var chat_session_routes_default = (0, import_fastify_plugin15.default)(routes14, { name: "chat-session-routes" });
246224
246379
 
246225
246380
  // src/routes/project-chat-routes.ts
246226
- var import_fastify_plugin17 = __toESM(require_plugin2(), 1);
246227
- import { createHash as createHash7, randomUUID as randomUUID16 } from "crypto";
246381
+ var import_fastify_plugin16 = __toESM(require_plugin2(), 1);
246382
+ import { createHash as createHash7, randomUUID as randomUUID15 } from "crypto";
246228
246383
  var MAX_TITLE_LENGTH = 200;
246229
246384
  var MAX_MESSAGE_LENGTH = 1e5;
246230
246385
  var THREAD_PAGE_LIMIT = 50;
@@ -246336,7 +246491,7 @@ function parseWorkspaceSelectionBody(body) {
246336
246491
  if (!requestId || requestId.length > MAX_TOOL_SELECTOR_ID || !workspaceId || workspaceId.length > MAX_TOOL_SELECTOR_ID) return null;
246337
246492
  return { requestId, workspaceId };
246338
246493
  }
246339
- var routes16 = async (fastify2) => {
246494
+ var routes15 = async (fastify2) => {
246340
246495
  const getOwnedThread = async (req, reply, threadId) => {
246341
246496
  const authResult = requireAuth(req, reply);
246342
246497
  if (authResult === null) return null;
@@ -246392,20 +246547,20 @@ var routes16 = async (fastify2) => {
246392
246547
  if (!project) return reply.code(404).send({ error: "Project not found" });
246393
246548
  const body = parseCreateBody(req.body);
246394
246549
  if (!body) return reply.code(400).send({ error: "Body must contain only an optional non-empty message" });
246395
- const createRequestId = body.createRequestId ?? randomUUID16();
246550
+ const createRequestId = body.createRequestId ?? randomUUID15();
246396
246551
  const createPayloadHash = createHash7("sha256").update(JSON.stringify({ message: body.message ?? null })).digest("hex");
246397
246552
  let accepted;
246398
246553
  try {
246399
246554
  accepted = await fastify2.storage.projectChatThreads.createIdempotent({
246400
- id: randomUUID16(),
246555
+ id: randomUUID15(),
246401
246556
  project_id: projectId,
246402
246557
  user_id: userId,
246403
246558
  title: null,
246404
246559
  create_request_id: createRequestId,
246405
246560
  create_payload_hash: createPayloadHash,
246406
246561
  ...body.message !== void 0 ? { initialTurn: {
246407
- messageId: randomUUID16(),
246408
- workItemId: randomUUID16(),
246562
+ messageId: randomUUID15(),
246563
+ workItemId: randomUUID15(),
246409
246564
  content: body.message
246410
246565
  } } : {}
246411
246566
  });
@@ -246555,10 +246710,10 @@ var routes16 = async (fastify2) => {
246555
246710
  }
246556
246711
  });
246557
246712
  };
246558
- var project_chat_routes_default = (0, import_fastify_plugin17.default)(routes16, { name: "project-chat-routes" });
246713
+ var project_chat_routes_default = (0, import_fastify_plugin16.default)(routes15, { name: "project-chat-routes" });
246559
246714
 
246560
246715
  // src/routes/project-activity-routes.ts
246561
- var import_fastify_plugin18 = __toESM(require_plugin2(), 1);
246716
+ var import_fastify_plugin17 = __toESM(require_plugin2(), 1);
246562
246717
 
246563
246718
  // src/project-activity.ts
246564
246719
  var RECENT_THREAD_LIMIT = 5;
@@ -246650,7 +246805,7 @@ async function getProjectActivity(storage, projectId, userId) {
246650
246805
  }
246651
246806
 
246652
246807
  // src/routes/project-activity-routes.ts
246653
- var routes17 = async (fastify2) => {
246808
+ var routes16 = async (fastify2) => {
246654
246809
  fastify2.get(
246655
246810
  "/api/projects/:projectId/activity",
246656
246811
  async (req, reply) => {
@@ -246666,12 +246821,12 @@ var routes17 = async (fastify2) => {
246666
246821
  }
246667
246822
  );
246668
246823
  };
246669
- var project_activity_routes_default = (0, import_fastify_plugin18.default)(routes17);
246824
+ var project_activity_routes_default = (0, import_fastify_plugin17.default)(routes16);
246670
246825
 
246671
246826
  // src/routes/task-routes.ts
246672
- var import_fastify_plugin19 = __toESM(require_plugin2(), 1);
246673
- import { randomUUID as randomUUID17 } from "crypto";
246674
- var routes18 = async (fastify2) => {
246827
+ var import_fastify_plugin18 = __toESM(require_plugin2(), 1);
246828
+ import { randomUUID as randomUUID16 } from "crypto";
246829
+ var routes17 = async (fastify2) => {
246675
246830
  fastify2.get(
246676
246831
  "/api/projects/:projectId/tasks",
246677
246832
  async (req, reply) => {
@@ -246734,7 +246889,7 @@ Description: ${description}`,
246734
246889
  title = description.length > 50 ? description.slice(0, 50) + "..." : description;
246735
246890
  }
246736
246891
  }
246737
- const id = randomUUID17();
246892
+ const id = randomUUID16();
246738
246893
  const task = await fastify2.storage.tasks.create({
246739
246894
  id,
246740
246895
  project_id: req.params.projectId,
@@ -246831,12 +246986,12 @@ Description: ${description}`,
246831
246986
  return reply.code(200).send({ success: true });
246832
246987
  });
246833
246988
  };
246834
- var task_routes_default = (0, import_fastify_plugin19.default)(routes18, { name: "task-routes" });
246989
+ var task_routes_default = (0, import_fastify_plugin18.default)(routes17, { name: "task-routes" });
246835
246990
 
246836
246991
  // src/routes/rule-routes.ts
246837
- var import_fastify_plugin20 = __toESM(require_plugin2(), 1);
246838
- import { randomUUID as randomUUID18 } from "crypto";
246839
- var routes19 = async (fastify2) => {
246992
+ var import_fastify_plugin19 = __toESM(require_plugin2(), 1);
246993
+ import { randomUUID as randomUUID17 } from "crypto";
246994
+ var routes18 = async (fastify2) => {
246840
246995
  fastify2.get(
246841
246996
  "/api/projects/:projectId/rules",
246842
246997
  async (req, reply) => {
@@ -246862,7 +247017,7 @@ var routes19 = async (fastify2) => {
246862
247017
  if (!name25 || !content) {
246863
247018
  return reply.code(400).send({ error: "name and content are required" });
246864
247019
  }
246865
- const id = randomUUID18();
247020
+ const id = randomUUID17();
246866
247021
  const rule = await fastify2.storage.rules.create({
246867
247022
  id,
246868
247023
  project_id: req.params.projectId,
@@ -246922,12 +247077,12 @@ var routes19 = async (fastify2) => {
246922
247077
  return reply.code(200).send({ success: true });
246923
247078
  });
246924
247079
  };
246925
- var rule_routes_default = (0, import_fastify_plugin20.default)(routes19, { name: "rule-routes" });
247080
+ var rule_routes_default = (0, import_fastify_plugin19.default)(routes18, { name: "rule-routes" });
246926
247081
 
246927
247082
  // src/routes/command-routes.ts
246928
- var import_fastify_plugin21 = __toESM(require_plugin2(), 1);
246929
- import { randomUUID as randomUUID19 } from "crypto";
246930
- var routes20 = async (fastify2) => {
247083
+ var import_fastify_plugin20 = __toESM(require_plugin2(), 1);
247084
+ import { randomUUID as randomUUID18 } from "crypto";
247085
+ var routes19 = async (fastify2) => {
246931
247086
  fastify2.get(
246932
247087
  "/api/projects/:projectId/commands",
246933
247088
  async (req, reply) => {
@@ -246953,7 +247108,7 @@ var routes20 = async (fastify2) => {
246953
247108
  if (!name25 || !content) {
246954
247109
  return reply.code(400).send({ error: "name and content are required" });
246955
247110
  }
246956
- const id = randomUUID19();
247111
+ const id = randomUUID18();
246957
247112
  const command = await fastify2.storage.commands.create({
246958
247113
  id,
246959
247114
  project_id: req.params.projectId,
@@ -246996,10 +247151,10 @@ var routes20 = async (fastify2) => {
246996
247151
  return reply.code(200).send({ success: true });
246997
247152
  });
246998
247153
  };
246999
- var command_routes_default = (0, import_fastify_plugin21.default)(routes20, { name: "command-routes" });
247154
+ var command_routes_default = (0, import_fastify_plugin20.default)(routes19, { name: "command-routes" });
247000
247155
 
247001
247156
  // src/routes/workflow-run-routes.ts
247002
- var import_fastify_plugin22 = __toESM(require_plugin2(), 1);
247157
+ var import_fastify_plugin21 = __toESM(require_plugin2(), 1);
247003
247158
  function parseReviewerAgentType(raw) {
247004
247159
  if (raw === void 0) return void 0;
247005
247160
  return typeof raw === "string" && REVIEWER_AGENT_TYPES.has(raw) ? raw : null;
@@ -247033,7 +247188,7 @@ function errStatus(err) {
247033
247188
  return 500;
247034
247189
  }
247035
247190
  }
247036
- async function routes21(fastify2) {
247191
+ async function routes20(fastify2) {
247037
247192
  const durableReviewFlights = /* @__PURE__ */ new Map();
247038
247193
  const projectLocalSession = async (session) => {
247039
247194
  const reader = fastify2.storage.agentSessions.getActivityById;
@@ -247600,10 +247755,10 @@ async function routes21(fastify2) {
247600
247755
  return reply.send({ runs });
247601
247756
  });
247602
247757
  }
247603
- var workflow_run_routes_default = (0, import_fastify_plugin22.default)(routes21, { name: "workflow-run-routes" });
247758
+ var workflow_run_routes_default = (0, import_fastify_plugin21.default)(routes20, { name: "workflow-run-routes" });
247604
247759
 
247605
247760
  // src/routes/settings-routes.ts
247606
- var import_fastify_plugin23 = __toESM(require_plugin2(), 1);
247761
+ var import_fastify_plugin22 = __toESM(require_plugin2(), 1);
247607
247762
  var SettingsValidationError = class extends Error {
247608
247763
  };
247609
247764
  var DEFAULT_PROXY_CONFIG = { type: "none", host: "", port: 0 };
@@ -247667,7 +247822,7 @@ function requireSettingsUser(req, reply) {
247667
247822
  if (auth === null) return null;
247668
247823
  return resolveUserId(auth);
247669
247824
  }
247670
- var routes22 = async (fastify2) => {
247825
+ var routes21 = async (fastify2) => {
247671
247826
  fastify2.get("/api/settings/agent-processes", async (req, reply) => {
247672
247827
  if (requireAuth(req, reply) === null) return;
247673
247828
  const saved = await fastify2.storage.settings.get("agentProcesses");
@@ -247941,11 +248096,11 @@ var routes22 = async (fastify2) => {
247941
248096
  return reply.code(200).send(updated);
247942
248097
  });
247943
248098
  };
247944
- var settings_routes_default = (0, import_fastify_plugin23.default)(routes22, { name: "settings-routes" });
248099
+ var settings_routes_default = (0, import_fastify_plugin22.default)(routes21, { name: "settings-routes" });
247945
248100
 
247946
248101
  // src/routes/translate-routes.ts
247947
- var import_fastify_plugin24 = __toESM(require_plugin2(), 1);
247948
- var routes23 = async (fastify2) => {
248102
+ var import_fastify_plugin23 = __toESM(require_plugin2(), 1);
248103
+ var routes22 = async (fastify2) => {
247949
248104
  fastify2.post(
247950
248105
  "/api/translate",
247951
248106
  async (req, reply) => {
@@ -247986,13 +248141,13 @@ ${text2}`,
247986
248141
  }
247987
248142
  );
247988
248143
  };
247989
- var translate_routes_default = (0, import_fastify_plugin24.default)(routes23, { name: "translate-routes" });
248144
+ var translate_routes_default = (0, import_fastify_plugin23.default)(routes22, { name: "translate-routes" });
247990
248145
 
247991
248146
  // src/routes/websocket-routes.ts
247992
- var import_fastify_plugin25 = __toESM(require_plugin2(), 1);
248147
+ var import_fastify_plugin24 = __toESM(require_plugin2(), 1);
247993
248148
 
247994
248149
  // src/routes/executor-stream-handlers.ts
247995
- import { randomUUID as randomUUID20 } from "crypto";
248150
+ import { randomUUID as randomUUID19 } from "crypto";
247996
248151
  function attachLocalProcessStream(fastify2, processId, send, onTerminal) {
247997
248152
  const noop4 = { cleanup: () => {
247998
248153
  }, handleInput: () => {
@@ -248068,7 +248223,7 @@ function attachRemoteProcessStream(fastify2, processId, send, onTerminal) {
248068
248223
  return;
248069
248224
  }
248070
248225
  console.log(`[diag:remote-stop] ${(/* @__PURE__ */ new Date()).toISOString()} attach processId=${processId} executorId=${info.executorId} server=${info.remoteServerId} transport=reverse-connect remoteProcessId=${info.remoteProcessId}`);
248071
- const channelId = randomUUID20();
248226
+ const channelId = randomUUID19();
248072
248227
  const wsPath = `/api/executor-processes/${info.remoteProcessId}/logs`;
248073
248228
  const adapter = new VirtualWsAdapter(
248074
248229
  (data) => fastify2.reverseConnectManager.sendChannelData(info.remoteServerId, channelId, data),
@@ -248300,7 +248455,7 @@ function attachWsHeartbeat(socket, { label, intervalMs = DEFAULT_INTERVAL_MS, ke
248300
248455
  }
248301
248456
 
248302
248457
  // src/routes/websocket-routes.ts
248303
- var routes24 = async (fastify2) => {
248458
+ var routes23 = async (fastify2) => {
248304
248459
  fastify2.reverseConnectManager.setStatusChangeHandler((remoteServerId, status) => {
248305
248460
  if (status !== "online") return;
248306
248461
  const cache2 = fastify2.remotePatchCache;
@@ -248733,10 +248888,10 @@ var routes24 = async (fastify2) => {
248733
248888
  );
248734
248889
  });
248735
248890
  };
248736
- var websocket_routes_default = (0, import_fastify_plugin25.default)(routes24, { name: "websocket-routes" });
248891
+ var websocket_routes_default = (0, import_fastify_plugin24.default)(routes23, { name: "websocket-routes" });
248737
248892
 
248738
248893
  // src/routes/reverse-connect-routes.ts
248739
- var import_fastify_plugin26 = __toESM(require_plugin2(), 1);
248894
+ var import_fastify_plugin25 = __toESM(require_plugin2(), 1);
248740
248895
  import { randomBytes as randomBytes2, createHash as createHash8, verify as cryptoVerify } from "crypto";
248741
248896
 
248742
248897
  // src/utils/rate-limited-warn.ts
@@ -248781,7 +248936,7 @@ function extractReportedVersion(frame) {
248781
248936
  var MACHINE_HANDSHAKE_TIMEOUT_MS = 5e3;
248782
248937
  var REJECT_LOG_WINDOW_MS = 3e4;
248783
248938
  var REJECT_LOG_MAX_KEYS = 500;
248784
- var routes25 = async (fastify2) => {
248939
+ var routes24 = async (fastify2) => {
248785
248940
  const logRejectedUpgrade = createRateLimitedWarn(REJECT_LOG_WINDOW_MS, REJECT_LOG_MAX_KEYS);
248786
248941
  fastify2.get("/api/reverse-connect/identity", async (req, reply) => {
248787
248942
  const token = req.headers["x-vibedeckx-connect-token"];
@@ -248915,10 +249070,10 @@ var routes25 = async (fastify2) => {
248915
249070
  );
248916
249071
  });
248917
249072
  };
248918
- var reverse_connect_routes_default = (0, import_fastify_plugin26.default)(routes25, { name: "reverse-connect-routes" });
249073
+ var reverse_connect_routes_default = (0, import_fastify_plugin25.default)(routes24, { name: "reverse-connect-routes" });
248919
249074
 
248920
249075
  // src/routes/event-routes.ts
248921
- var import_fastify_plugin27 = __toESM(require_plugin2(), 1);
249076
+ var import_fastify_plugin26 = __toESM(require_plugin2(), 1);
248922
249077
  function toWireEvent(event) {
248923
249078
  if (event.type === "executor:stopped" && (event.tailOutput !== void 0 || event.finalResult !== void 0)) {
248924
249079
  const { tailOutput: _tailOutput, finalResult: _finalResult, ...rest } = event;
@@ -248926,7 +249081,7 @@ function toWireEvent(event) {
248926
249081
  }
248927
249082
  return event;
248928
249083
  }
248929
- var routes26 = async (fastify2) => {
249084
+ var routes25 = async (fastify2) => {
248930
249085
  fastify2.get("/api/events", async (req, reply) => {
248931
249086
  let userId = null;
248932
249087
  if (fastify2.authEnabled) {
@@ -248981,10 +249136,10 @@ var routes26 = async (fastify2) => {
248981
249136
  await reply;
248982
249137
  });
248983
249138
  };
248984
- var event_routes_default = (0, import_fastify_plugin27.default)(routes26, { name: "event-routes" });
249139
+ var event_routes_default = (0, import_fastify_plugin26.default)(routes25, { name: "event-routes" });
248985
249140
 
248986
249141
  // src/routes/terminal-routes.ts
248987
- var import_fastify_plugin28 = __toESM(require_plugin2(), 1);
249142
+ var import_fastify_plugin27 = __toESM(require_plugin2(), 1);
248988
249143
  import path13 from "path";
248989
249144
  async function getRemoteConfig5(fastify2, project, remoteServerId) {
248990
249145
  const remotes = await fastify2.storage.projectRemotes.getByProject(project.id);
@@ -248995,7 +249150,7 @@ async function getRemoteConfig5(fastify2, project, remoteServerId) {
248995
249150
  remotePath: target.remote_path
248996
249151
  };
248997
249152
  }
248998
- var routes27 = async (fastify2) => {
249153
+ var routes26 = async (fastify2) => {
248999
249154
  fastify2.post("/api/path/terminals", async (req, reply) => {
249000
249155
  const { path: projectPath, branch } = req.body;
249001
249156
  if (!projectPath) {
@@ -249171,11 +249326,11 @@ var routes27 = async (fastify2) => {
249171
249326
  }
249172
249327
  );
249173
249328
  };
249174
- var terminal_routes_default = (0, import_fastify_plugin28.default)(routes27, { name: "terminal-routes" });
249329
+ var terminal_routes_default = (0, import_fastify_plugin27.default)(routes26, { name: "terminal-routes" });
249175
249330
 
249176
249331
  // src/routes/browser-routes.ts
249177
- var import_fastify_plugin29 = __toESM(require_plugin2(), 1);
249178
- var routes28 = async (fastify2) => {
249332
+ var import_fastify_plugin28 = __toESM(require_plugin2(), 1);
249333
+ var routes27 = async (fastify2) => {
249179
249334
  const ensureProjectAccess = async (req, reply) => {
249180
249335
  const userId = requireUserFacingUserId(req, reply);
249181
249336
  if (userId === null) return null;
@@ -249246,11 +249401,11 @@ var routes28 = async (fastify2) => {
249246
249401
  return reply.code(200).send({ ok: true });
249247
249402
  });
249248
249403
  };
249249
- var browser_routes_default = (0, import_fastify_plugin29.default)(routes28, { name: "browser-routes" });
249404
+ var browser_routes_default = (0, import_fastify_plugin28.default)(routes27, { name: "browser-routes" });
249250
249405
 
249251
249406
  // src/routes/browser-proxy-routes.ts
249252
- var import_fastify_plugin30 = __toESM(require_plugin2(), 1);
249253
- import { randomUUID as randomUUID21 } from "crypto";
249407
+ var import_fastify_plugin29 = __toESM(require_plugin2(), 1);
249408
+ import { randomUUID as randomUUID20 } from "crypto";
249254
249409
 
249255
249410
  // src/utils/ssrf-guard.ts
249256
249411
  var import_undici2 = __toESM(require_undici(), 1);
@@ -249745,7 +249900,7 @@ function generateInjectedScript(projectId, targetOrigin, proxyWsPrefix) {
249745
249900
  })();
249746
249901
  </script>`;
249747
249902
  }
249748
- var routes29 = async (fastify2) => {
249903
+ var routes28 = async (fastify2) => {
249749
249904
  fastify2.get("/api/projects/:id/browser/proxy/*", async (req, reply) => {
249750
249905
  const userId = requireUserFacingOrTrustedProxyUserId(req, reply);
249751
249906
  if (userId === null) return;
@@ -249840,7 +249995,7 @@ var routes29 = async (fastify2) => {
249840
249995
  const rcm = fastify2.reverseConnectManager;
249841
249996
  if (resolved.remoteServerId && rcm.isConnected(resolved.remoteServerId)) {
249842
249997
  const remoteServerId = resolved.remoteServerId;
249843
- const channelId = randomUUID21();
249998
+ const channelId = randomUUID20();
249844
249999
  const parsed = new URL(resolved.fetchUrl);
249845
250000
  const wsPath = parsed.pathname;
249846
250001
  const wsQuery = parsed.search ? parsed.search.slice(1) : void 0;
@@ -249917,10 +250072,10 @@ var routes29 = async (fastify2) => {
249917
250072
  });
249918
250073
  });
249919
250074
  };
249920
- var browser_proxy_routes_default = (0, import_fastify_plugin30.default)(routes29, { name: "browser-proxy-routes" });
250075
+ var browser_proxy_routes_default = (0, import_fastify_plugin29.default)(routes28, { name: "browser-proxy-routes" });
249921
250076
 
249922
250077
  // src/routes/cross-remote-target-routes.ts
249923
- var import_fastify_plugin31 = __toESM(require_plugin2(), 1);
250078
+ var import_fastify_plugin30 = __toESM(require_plugin2(), 1);
249924
250079
  import path14 from "path";
249925
250080
  import { promises as fs3 } from "fs";
249926
250081
 
@@ -250000,7 +250155,7 @@ var clampTimeoutMs = (timeoutSec) => {
250000
250155
  const requested = typeof timeoutSec === "number" && Number.isFinite(timeoutSec) && timeoutSec > 0 ? timeoutSec : DEFAULT_TIMEOUT_SEC;
250001
250156
  return Math.min(requested, MAX_TIMEOUT_SEC) * 1e3;
250002
250157
  };
250003
- var routes30 = async (fastify2) => {
250158
+ var routes29 = async (fastify2) => {
250004
250159
  fastify2.post(
250005
250160
  "/api/path/cross-remote/exec",
250006
250161
  async (request, reply) => {
@@ -250108,10 +250263,10 @@ var routes30 = async (fastify2) => {
250108
250263
  return reply.send(result);
250109
250264
  });
250110
250265
  };
250111
- var cross_remote_target_routes_default = (0, import_fastify_plugin31.default)(routes30, { name: "cross-remote-target-routes" });
250266
+ var cross_remote_target_routes_default = (0, import_fastify_plugin30.default)(routes29, { name: "cross-remote-target-routes" });
250112
250267
 
250113
250268
  // src/routes/cross-remote-mcp-routes.ts
250114
- var import_fastify_plugin32 = __toESM(require_plugin2(), 1);
250269
+ var import_fastify_plugin31 = __toESM(require_plugin2(), 1);
250115
250270
  var PROTOCOL_VERSION = "2024-11-05";
250116
250271
  var AUDIT_ARGS_MAX = 1024;
250117
250272
  var NOT_ACCESSIBLE = "remote not found or not accessible";
@@ -250214,7 +250369,7 @@ var textResult = (text2, isError = false) => ({
250214
250369
  content: [{ type: "text", text: text2 }],
250215
250370
  ...isError ? { isError: true } : {}
250216
250371
  });
250217
- var routes31 = async (fastify2) => {
250372
+ var routes30 = async (fastify2) => {
250218
250373
  const guard = new SessionConcurrencyGuard();
250219
250374
  let cachedSecret;
250220
250375
  const getSecret = () => {
@@ -250335,11 +250490,11 @@ var routes31 = async (fastify2) => {
250335
250490
  }
250336
250491
  });
250337
250492
  };
250338
- var cross_remote_mcp_routes_default = (0, import_fastify_plugin32.default)(routes31, { name: "cross-remote-mcp-routes" });
250493
+ var cross_remote_mcp_routes_default = (0, import_fastify_plugin31.default)(routes30, { name: "cross-remote-mcp-routes" });
250339
250494
 
250340
250495
  // src/routes/schedule-routes.ts
250341
- var import_fastify_plugin33 = __toESM(require_plugin2(), 1);
250342
- import { randomUUID as randomUUID22 } from "crypto";
250496
+ var import_fastify_plugin32 = __toESM(require_plugin2(), 1);
250497
+ import { randomUUID as randomUUID21 } from "crypto";
250343
250498
  import path15 from "path";
250344
250499
  var RUN_TYPES = ["command", "prompt"];
250345
250500
  var CWD_MODES = ["branch", "directory"];
@@ -250357,7 +250512,7 @@ function validateResolved(b2) {
250357
250512
  if (cronError) return `Invalid cron expression: ${cronError}`;
250358
250513
  return null;
250359
250514
  }
250360
- var routes32 = async (fastify2) => {
250515
+ var routes31 = async (fastify2) => {
250361
250516
  const sendTerminalManualOutcome = (reply, request, replay) => {
250362
250517
  if (!request.terminalStatus || request.terminalResponseStatus === null) return null;
250363
250518
  const common = { runId: request.runId, status: request.terminalStatus, durable: true, replay };
@@ -250428,7 +250583,7 @@ var routes32 = async (fastify2) => {
250428
250583
  return reply.code(400).send({ error: "Unknown remote target" });
250429
250584
  }
250430
250585
  const schedule = await fastify2.storage.scheduledTasks.create({
250431
- id: randomUUID22(),
250586
+ id: randomUUID21(),
250432
250587
  project_id: req.params.projectId,
250433
250588
  name: b2.name.trim(),
250434
250589
  cron_expr: resolved.cron_expr,
@@ -250588,7 +250743,7 @@ var routes32 = async (fastify2) => {
250588
250743
  }
250589
250744
  );
250590
250745
  };
250591
- var schedule_routes_default = (0, import_fastify_plugin33.default)(routes32, { name: "schedule-routes" });
250746
+ var schedule_routes_default = (0, import_fastify_plugin32.default)(routes31, { name: "schedule-routes" });
250592
250747
 
250593
250748
  // src/search/catalog.ts
250594
250749
  var parseDbTimestamp5 = (ts) => {
@@ -250888,10 +251043,10 @@ var searchRoutes = async (fastify2) => {
250888
251043
  var search_routes_default = searchRoutes;
250889
251044
 
250890
251045
  // src/routes/notification-routes.ts
250891
- var import_fastify_plugin34 = __toESM(require_plugin2(), 1);
251046
+ var import_fastify_plugin33 = __toESM(require_plugin2(), 1);
250892
251047
  var MAX_LIMIT = 500;
250893
251048
  var DEFAULT_LIMIT = 100;
250894
- var routes33 = async (fastify2) => {
251049
+ var routes32 = async (fastify2) => {
250895
251050
  fastify2.get(
250896
251051
  "/api/notifications",
250897
251052
  async (req, reply) => {
@@ -250923,7 +251078,7 @@ var routes33 = async (fastify2) => {
250923
251078
  return reply.code(200).send({ ok: true });
250924
251079
  });
250925
251080
  };
250926
- var notification_routes_default = (0, import_fastify_plugin34.default)(routes33, { name: "notification-routes" });
251081
+ var notification_routes_default = (0, import_fastify_plugin33.default)(routes32, { name: "notification-routes" });
250927
251082
 
250928
251083
  // ../../node_modules/.pnpm/@clerk+fastify@3.1.2_fastify@5.7.2_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@clerk/fastify/dist/chunk-RY4T2JMQ.mjs
250929
251084
  import { Readable as Readable2 } from "stream";
@@ -250975,7 +251130,7 @@ var requestToProxyRequest = (req) => {
250975
251130
 
250976
251131
  // ../../node_modules/.pnpm/@clerk+fastify@3.1.2_fastify@5.7.2_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@clerk/fastify/dist/index.mjs
250977
251132
  init_dist();
250978
- var import_fastify_plugin35 = __toESM(require_plugin2(), 1);
251133
+ var import_fastify_plugin34 = __toESM(require_plugin2(), 1);
250979
251134
 
250980
251135
  // ../../node_modules/.pnpm/@clerk+backend@3.2.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@clerk/backend/dist/internal.mjs
250981
251136
  init_chunk_JW73PKED();
@@ -251263,7 +251418,7 @@ var plugin = (instance, opts, done) => {
251263
251418
  instance.addHook(hookName, withClerkMiddleware(opts));
251264
251419
  done();
251265
251420
  };
251266
- var clerkPlugin = (0, import_fastify_plugin35.default)(plugin, {
251421
+ var clerkPlugin = (0, import_fastify_plugin34.default)(plugin, {
251267
251422
  name: "@clerk/fastify",
251268
251423
  fastify: "5.x"
251269
251424
  });
@@ -252185,7 +252340,6 @@ var createServer = async (opts) => {
252185
252340
  server.register(worker_stats_routes_default);
252186
252341
  server.register(project_remote_routes_default);
252187
252342
  server.register(search_routes_default);
252188
- server.register(executor_group_routes_default);
252189
252343
  server.register(executor_routes_default);
252190
252344
  server.register(schedule_routes_default);
252191
252345
  server.register(process_routes_default);
@@ -252819,7 +252973,7 @@ var ReverseConnectClient = class {
252819
252973
 
252820
252974
  // src/connect-daemon.ts
252821
252975
  import { spawn as spawn5 } from "node:child_process";
252822
- import { randomUUID as randomUUID23 } from "node:crypto";
252976
+ import { randomUUID as randomUUID22 } from "node:crypto";
252823
252977
  import fs8 from "node:fs";
252824
252978
  import path19 from "node:path";
252825
252979
  var CONNECT_DAEMON_CHILD_ENV = "VIBEDECKX_INTERNAL_CONNECT_DAEMON";
@@ -253213,7 +253367,7 @@ function createDaemonStateLockCandidate(lockPath) {
253213
253367
  schemaVersion: 1,
253214
253368
  pid: process.pid,
253215
253369
  processStartTicks,
253216
- nonce: randomUUID23()
253370
+ nonce: randomUUID22()
253217
253371
  };
253218
253372
  const candidatePath = `${lockPath}.candidate-${process.pid}-${owner.nonce}`;
253219
253373
  fs8.mkdirSync(candidatePath, { mode: 448 });
@@ -254581,7 +254735,7 @@ var connectRoutes = buildRouteMap({
254581
254735
  defaultCommand: "run",
254582
254736
  docs: { brief: "Connect to a Vibedeckx server as an inbound node" }
254583
254737
  });
254584
- var routes34 = buildRouteMap({
254738
+ var routes33 = buildRouteMap({
254585
254739
  routes: {
254586
254740
  start: startCommand,
254587
254741
  connect: connectRoutes
@@ -254591,7 +254745,7 @@ var routes34 = buildRouteMap({
254591
254745
  brief: "Vibedeckx - AI-powered app generator"
254592
254746
  }
254593
254747
  });
254594
- var program = buildApplication(routes34, {
254748
+ var program = buildApplication(routes33, {
254595
254749
  name: "vibedeckx",
254596
254750
  versionInfo: {
254597
254751
  currentVersion: readPackageVersion()