@vibedeckx/darwin-arm64 0.3.45 → 0.3.48

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 +452 -94
  2. package/package.json +5 -1
package/dist/bin.js CHANGED
@@ -188008,7 +188008,7 @@ var mapRule = (row) => ({
188008
188008
  });
188009
188009
  var createWorkspaceRepos = (kdb, h) => ({
188010
188010
  tasks: {
188011
- create: async ({ id, project_id, title, description, status, priority, assigned_branch }) => {
188011
+ create: async ({ id, project_id, title, description, status, priority, assigned_branch, source }) => {
188012
188012
  await kdb.insertInto("tasks").values((eb) => ({
188013
188013
  id,
188014
188014
  project_id,
@@ -188017,10 +188017,25 @@ var createWorkspaceRepos = (kdb, h) => ({
188017
188017
  status: status ?? "todo",
188018
188018
  priority: priority ?? "medium",
188019
188019
  assigned_branch: assigned_branch ?? null,
188020
- position: eb.selectFrom("tasks").select(sql`coalesce(max(position), -1) + 1`.as("next_position")).where("project_id", "=", project_id)
188021
- })).execute();
188022
- const row = await kdb.selectFrom("tasks").selectAll().where("id", "=", id).executeTakeFirstOrThrow();
188023
- return mapTask2(row);
188020
+ position: eb.selectFrom("tasks").select(sql`coalesce(max(position), -1) + 1`.as("next_position")).where("project_id", "=", project_id),
188021
+ source_session_id: source?.session_id ?? null,
188022
+ source_tool_use_id: source?.tool_use_id ?? null,
188023
+ source_item_index: source?.item_index ?? null
188024
+ // DO NOTHING only for a proposal, so a concurrent replay races into
188025
+ // idx_tasks_source and is resolved below (same argument as
188026
+ // scheduledTasks.create); a plain insert keeps failing loudly.
188027
+ })).$if(!!source, (qb) => qb.onConflict((oc) => oc.doNothing())).execute();
188028
+ const row = await kdb.selectFrom("tasks").selectAll().where("id", "=", id).executeTakeFirst();
188029
+ if (row) return mapTask2(row);
188030
+ if (source) {
188031
+ const existing = await kdb.selectFrom("tasks").selectAll().where("project_id", "=", project_id).where("source_session_id", "=", source.session_id).where("source_tool_use_id", "=", source.tool_use_id).where("source_item_index", "=", source.item_index).executeTakeFirst();
188032
+ if (existing) return mapTask2(existing);
188033
+ }
188034
+ throw new Error(`Failed to create task ${id}`);
188035
+ },
188036
+ listOpenIdsBySourceSession: async (sessionId) => {
188037
+ const rows = await kdb.selectFrom("tasks").select("id").where("source_session_id", "=", sessionId).where("source_tool_use_id", "is not", null).where("archived_at", "is", null).where("status", "in", ["todo", "in_progress"]).orderBy("id", "asc").execute();
188038
+ return rows.map((row) => row.id);
188024
188039
  },
188025
188040
  getByProjectId: async (projectId, opts) => {
188026
188041
  let query = kdb.selectFrom("tasks").selectAll().where("project_id", "=", projectId);
@@ -205293,6 +205308,16 @@ var initializeSchema = (db) => {
205293
205308
  if (!hasArchivedAtColumn) {
205294
205309
  db.exec("ALTER TABLE tasks ADD COLUMN archived_at INTEGER DEFAULT NULL");
205295
205310
  }
205311
+ const taskSourceInfo = db.prepare("PRAGMA table_info(tasks)").all();
205312
+ if (!taskSourceInfo.some((col) => col.name === "source_session_id")) {
205313
+ db.exec("ALTER TABLE tasks ADD COLUMN source_session_id TEXT");
205314
+ }
205315
+ if (!taskSourceInfo.some((col) => col.name === "source_tool_use_id")) {
205316
+ db.exec("ALTER TABLE tasks ADD COLUMN source_tool_use_id TEXT");
205317
+ }
205318
+ if (!taskSourceInfo.some((col) => col.name === "source_item_index")) {
205319
+ db.exec("ALTER TABLE tasks ADD COLUMN source_item_index INTEGER");
205320
+ }
205296
205321
  const sessionTableInfo = db.prepare("PRAGMA table_info(agent_sessions)").all();
205297
205322
  const hasWorktreePathColumn = sessionTableInfo.some((col) => col.name === "worktree_path");
205298
205323
  if (hasWorktreePathColumn) {
@@ -206132,6 +206157,12 @@ var initializeSchema = (db) => {
206132
206157
  );
206133
206158
  `);
206134
206159
  db.exec(`
206160
+ -- Idempotency for agent-proposed tasks, one row per proposed item; same
206161
+ -- reasoning as idx_scheduled_tasks_source. Also serves the retention-hold
206162
+ -- lookup by source session.
206163
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_source
206164
+ ON tasks(source_session_id, source_tool_use_id, source_item_index)
206165
+ WHERE source_tool_use_id IS NOT NULL;
206135
206166
  CREATE INDEX IF NOT EXISTS idx_tasks_project_archived_position_id
206136
206167
  ON tasks(project_id, archived_at, position ASC, id ASC);
206137
206168
  CREATE INDEX IF NOT EXISTS idx_tasks_project_archived_status_position_id
@@ -206493,6 +206524,8 @@ var SESSION_TOOLS_MCP_PATH = "/api/session-mcp";
206493
206524
  var SESSION_TOOLS_MCP_SERVER_NAME = "vibedeckx";
206494
206525
  var PROPOSE_SCHEDULE_TOOL = "propose_schedule";
206495
206526
  var CANONICAL_PROPOSE_SCHEDULE_TOOL = `mcp__${SESSION_TOOLS_MCP_SERVER_NAME}__${PROPOSE_SCHEDULE_TOOL}`;
206527
+ var PROPOSE_TASK_TOOL = "propose_task";
206528
+ var CANONICAL_PROPOSE_TASK_TOOL = `mcp__${SESSION_TOOLS_MCP_SERVER_NAME}__${PROPOSE_TASK_TOOL}`;
206496
206529
  var PROPOSE_SCHEDULE_DESCRIPTION = [
206497
206530
  "Propose a recurring scheduled check to the user. This is the only way to schedule work in this",
206498
206531
  "environment. Call it in either situation:",
@@ -206526,12 +206559,15 @@ var PROPOSE_SCHEDULE_DESCRIPTION = [
206526
206559
  "Project, execution target and branch are taken from this session \u2014 do not describe them here."
206527
206560
  ].join("\n");
206528
206561
  var ARTIFACT_PATH_HINT = "Files for the user to look at: when you produce a screenshot, image, or report file for the user, write its absolute path on its own line in your reply so it can be previewed.";
206562
+ var TASK_ROUTING_HINT = `Tasks: when the user asks to record something as a task or to-do for later, call \`${CANONICAL_PROPOSE_TASK_TOOL}\` to propose it, and do not do the work itself now. Never call it, or suggest creating a task, unless the user asks.`;
206529
206563
  var SESSION_TOOLS_MCP_INSTRUCTIONS = [
206530
206564
  `\`${PROPOSE_SCHEDULE_TOOL}\` is the only way to schedule work in this environment.`,
206531
206565
  'When the user asks for anything recurring \u2014 nightly, hourly, every morning, on a cron, "keep',
206532
206566
  'watching" \u2014 call it instead of writing a crontab entry, systemd timer, or setInterval loop.',
206533
206567
  "Scheduling inside the user's own product remains ordinary coding work.",
206534
206568
  "",
206569
+ TASK_ROUTING_HINT,
206570
+ "",
206535
206571
  ARTIFACT_PATH_HINT
206536
206572
  ].join("\n");
206537
206573
  var SESSION_TOOLS_SYSTEM_PROMPT_HINT = [
@@ -206539,6 +206575,7 @@ var SESSION_TOOLS_SYSTEM_PROMPT_HINT = [
206539
206575
  `morning, on a cron, "keep watching"), call the \`${CANONICAL_PROPOSE_SCHEDULE_TOOL}\` tool. That`,
206540
206576
  "is the only way to schedule work here \u2014 do not hand-roll a crontab entry, systemd timer, or",
206541
206577
  "setInterval loop for it. Writing scheduling into the user's own project is still normal coding.",
206578
+ TASK_ROUTING_HINT,
206542
206579
  ARTIFACT_PATH_HINT
206543
206580
  ].join(" ");
206544
206581
  var PROPOSE_SCHEDULE_INPUT_SCHEMA = {
@@ -206580,19 +206617,96 @@ function parseProposeScheduleArgs(args) {
206580
206617
  }
206581
206618
  return { ok: true, value: { name: name25, cron_expr: cronExpr, run_type, content, ...timezone ? { timezone } : {} } };
206582
206619
  }
206583
- var PROPOSE_SCHEDULE_ALIASES = new Set(
206620
+ var PROPOSE_TASK_DESCRIPTION = [
206621
+ "Propose one or more tasks for the project's task list: work to be done LATER, recorded so it",
206622
+ `isn't lost. Call this only when the user asks to record work as a task ("make this a task",`,
206623
+ '"add a to-do for the skipped test"). Never call it on your own initiative.',
206624
+ "",
206625
+ 'Do not do the work. Even when the task reads like an instruction ("add error handling to X"),',
206626
+ "the user is asking you to write it down, not to carry it out now.",
206627
+ "",
206628
+ "The proposal is shown to the user as a confirmation card; it does NOT create anything by itself",
206629
+ "and this call does not wait for the user. Say you have proposed the task (never that you created",
206630
+ "it) and continue.",
206631
+ "",
206632
+ "Each description must be self-contained: the task may be picked up later in a fresh session with",
206633
+ "none of this conversation's context. Cover the background, the relevant files, what remains to",
206634
+ "be done, and how to tell it is finished. Propose several tasks in one call when the user asks to",
206635
+ "split the work.",
206636
+ "",
206637
+ "Project and source session are taken from this session \u2014 do not describe them here."
206638
+ ].join("\n");
206639
+ var PROPOSE_TASK_INPUT_SCHEMA = {
206640
+ type: "object",
206641
+ properties: {
206642
+ tasks: {
206643
+ type: "array",
206644
+ minItems: 1,
206645
+ maxItems: 5,
206646
+ description: "The tasks to propose, usually one.",
206647
+ items: {
206648
+ type: "object",
206649
+ properties: {
206650
+ title: { type: "string", description: 'Short, specific title, e.g. "Cover remote path in retention-hold tests"' },
206651
+ description: { type: "string", description: "Self-contained description: background, relevant files, remaining work, definition of done." },
206652
+ priority: { type: "string", enum: ["low", "medium", "high", "urgent"], description: "Optional; defaults to medium." }
206653
+ },
206654
+ required: ["title", "description"]
206655
+ }
206656
+ }
206657
+ },
206658
+ required: ["tasks"]
206659
+ };
206660
+ var PROPOSE_TASK_ACK = "Proposal shown to the user as a confirmation card. Nothing has been created yet \u2014 the user decides whether to accept it. Tell the user you PROPOSED the task and that they can confirm it on the card above. Do not start working on it.";
206661
+ var PROPOSE_TASK_MAX_ITEMS = 5;
206662
+ var TASK_TITLE_MAX = 200;
206663
+ var TASK_DESCRIPTION_MAX = 2e4;
206664
+ var TASK_PRIORITIES = ["low", "medium", "high", "urgent"];
206665
+ function parseProposeTaskArgs(args) {
206666
+ const raw = args.tasks;
206667
+ if (!Array.isArray(raw) || raw.length === 0) return { ok: false, error: "tasks must be a non-empty array" };
206668
+ if (raw.length > PROPOSE_TASK_MAX_ITEMS) {
206669
+ return { ok: false, error: `propose at most ${PROPOSE_TASK_MAX_ITEMS} tasks at a time` };
206670
+ }
206671
+ const tasks = [];
206672
+ for (const [i, item] of raw.entries()) {
206673
+ const obj = item && typeof item === "object" ? item : {};
206674
+ const title = str(obj.title);
206675
+ if (!title) return { ok: false, error: `tasks[${i}].title is required` };
206676
+ if (title.length > TASK_TITLE_MAX) {
206677
+ return { ok: false, error: `tasks[${i}].title must be at most ${TASK_TITLE_MAX} characters` };
206678
+ }
206679
+ const description = str(obj.description);
206680
+ if (!description) return { ok: false, error: `tasks[${i}].description is required` };
206681
+ if (description.length > TASK_DESCRIPTION_MAX) {
206682
+ return { ok: false, error: `tasks[${i}].description must be at most ${TASK_DESCRIPTION_MAX} characters` };
206683
+ }
206684
+ const priorityRaw = str(obj.priority)?.toLowerCase();
206685
+ if (priorityRaw && !TASK_PRIORITIES.includes(priorityRaw)) {
206686
+ return { ok: false, error: `tasks[${i}].priority must be one of: ${TASK_PRIORITIES.join(", ")}` };
206687
+ }
206688
+ tasks.push({ title, description, priority: priorityRaw || "medium" });
206689
+ }
206690
+ return { ok: true, value: tasks };
206691
+ }
206692
+ var aliasesOf = (tool2, canonical) => new Set(
206584
206693
  [
206585
- PROPOSE_SCHEDULE_TOOL,
206586
- CANONICAL_PROPOSE_SCHEDULE_TOOL,
206587
- `${SESSION_TOOLS_MCP_SERVER_NAME}.${PROPOSE_SCHEDULE_TOOL}`,
206588
- `${SESSION_TOOLS_MCP_SERVER_NAME}/${PROPOSE_SCHEDULE_TOOL}`,
206589
- `${SESSION_TOOLS_MCP_SERVER_NAME}__${PROPOSE_SCHEDULE_TOOL}`,
206590
- `${SESSION_TOOLS_MCP_SERVER_NAME}-${PROPOSE_SCHEDULE_TOOL}`
206694
+ tool2,
206695
+ canonical,
206696
+ `${SESSION_TOOLS_MCP_SERVER_NAME}.${tool2}`,
206697
+ `${SESSION_TOOLS_MCP_SERVER_NAME}/${tool2}`,
206698
+ `${SESSION_TOOLS_MCP_SERVER_NAME}__${tool2}`,
206699
+ `${SESSION_TOOLS_MCP_SERVER_NAME}-${tool2}`
206591
206700
  ].map((n) => n.toLowerCase())
206592
206701
  );
206702
+ var SESSION_TOOL_ALIASES = [
206703
+ [aliasesOf(PROPOSE_SCHEDULE_TOOL, CANONICAL_PROPOSE_SCHEDULE_TOOL), CANONICAL_PROPOSE_SCHEDULE_TOOL],
206704
+ [aliasesOf(PROPOSE_TASK_TOOL, CANONICAL_PROPOSE_TASK_TOOL), CANONICAL_PROPOSE_TASK_TOOL]
206705
+ ];
206593
206706
  function canonicalizeSessionToolName(tool2, server) {
206594
206707
  if (server !== void 0 && server.trim().toLowerCase() !== SESSION_TOOLS_MCP_SERVER_NAME) return tool2;
206595
- return PROPOSE_SCHEDULE_ALIASES.has(tool2.trim().toLowerCase()) ? CANONICAL_PROPOSE_SCHEDULE_TOOL : tool2;
206708
+ const key2 = tool2.trim().toLowerCase();
206709
+ return SESSION_TOOL_ALIASES.find(([aliases]) => aliases.has(key2))?.[1] ?? tool2;
206596
206710
  }
206597
206711
  async function mintSessionToolsMcpConfig(deps, args) {
206598
206712
  const origin = args.origin?.trim();
@@ -208252,6 +208366,48 @@ function scheduleHoldSource(storage2) {
208252
208366
  listHolders: (sessionId) => storage2.scheduledTasks.listIdsBySourceSession(sessionId)
208253
208367
  };
208254
208368
  }
208369
+ function taskHoldSource(storage2) {
208370
+ return {
208371
+ kind: "task",
208372
+ listHolders: (sessionId) => storage2.tasks.listOpenIdsBySourceSession(sessionId)
208373
+ };
208374
+ }
208375
+ function subscribeTaskHoldSync(eventBus, holds) {
208376
+ return eventBus.subscribe((event) => {
208377
+ if (event.type !== "task:updated") return;
208378
+ const sourceSessionId = event.task.source_session_id;
208379
+ if (typeof sourceSessionId !== "string" || !sourceSessionId) return;
208380
+ void holds.sync(sourceSessionId).catch((error48) => {
208381
+ console.warn(`[RetentionHolds] task hold sync for ${sourceSessionId} deferred:`, error48);
208382
+ });
208383
+ });
208384
+ }
208385
+ function taskHoldsSource(task) {
208386
+ return !!task.source_session_id && !!task.source_tool_use_id && task.archived_at === null && (task.status === "todo" || task.status === "in_progress");
208387
+ }
208388
+ async function applyTaskChange(deps, taskId, apply, revert) {
208389
+ const existing = await deps.storage.tasks.getById(taskId);
208390
+ if (!existing?.source_session_id) return apply();
208391
+ return deps.retentionHolds.exclusive(existing.source_session_id, async (syncNow) => {
208392
+ const before = await deps.storage.tasks.getById(taskId);
208393
+ if (!before) return void 0;
208394
+ const task = await apply();
208395
+ if (!task || taskHoldsSource(before) || !taskHoldsSource(task)) return task;
208396
+ try {
208397
+ await syncNow();
208398
+ return task;
208399
+ } catch (error48) {
208400
+ await revert(before);
208401
+ await syncNow().catch(() => void 0);
208402
+ throw error48;
208403
+ }
208404
+ });
208405
+ }
208406
+ function revertTaskPatch(storage2, taskId, patch) {
208407
+ return (before) => storage2.tasks.update(taskId, Object.fromEntries(
208408
+ Object.keys(patch).filter((key2) => patch[key2] !== void 0).map((key2) => [key2, before[key2]])
208409
+ ));
208410
+ }
208255
208411
 
208256
208412
  // src/agent-session-manager.ts
208257
208413
  import { spawn as spawn3 } from "child_process";
@@ -208347,7 +208503,7 @@ var ClaudeCodeProvider = class {
208347
208503
  permissionMode,
208348
208504
  Object.keys(mcpServers).length > 0 ? buildClaudeMcpConfigArg(mcpServers) : void 0,
208349
208505
  model,
208350
- sessionToolsMcp ? [CANONICAL_PROPOSE_SCHEDULE_TOOL] : void 0,
208506
+ sessionToolsMcp ? [CANONICAL_PROPOSE_SCHEDULE_TOOL, CANONICAL_PROPOSE_TASK_TOOL] : void 0,
208351
208507
  sessionToolsMcp ? SESSION_TOOLS_SYSTEM_PROMPT_HINT : void 0
208352
208508
  );
208353
208509
  }
@@ -230672,6 +230828,7 @@ async function appendRemoteGrantContext(storage2, sessionId, userId, content) {
230672
230828
  // src/utils/conversation-title.ts
230673
230829
  var TITLE_MAX_CHARS = 60;
230674
230830
  var VSCHEDULE_BLOCK_RE = /<vschedule(?:\s[^>]*)?>[\s\S]*?<\/vschedule>/g;
230831
+ var VTASK_BLOCK_RE = /<vtask(?:\s[^>]*)?>[\s\S]*?<\/vtask>/g;
230675
230832
  var AI_TIMEOUT_MS = 15e3;
230676
230833
  var MAX_INPUT_CHARS = 2e3;
230677
230834
  var SYSTEM_PROMPT = "You write very short, descriptive titles for chat conversations. Reply with the title only \u2014 no quotes, no trailing punctuation, no markdown, no prefixes like 'Title:'. Use the same language as the user's message. Keep it under 8 words and 50 characters.";
@@ -230688,7 +230845,7 @@ async function isChatModelConfigured(storage2, userId) {
230688
230845
  }
230689
230846
  function extractUserText(content) {
230690
230847
  const text2 = typeof content === "string" ? content : content.filter((p2) => p2.type === "text").map((p2) => p2.text).join(" ");
230691
- return stripRemoteGrantContext(text2.replace(VSCHEDULE_BLOCK_RE, ""));
230848
+ return stripRemoteGrantContext(text2.replace(VSCHEDULE_BLOCK_RE, "").replace(VTASK_BLOCK_RE, ""));
230692
230849
  }
230693
230850
  function snippetTitle(text2) {
230694
230851
  const trimmed = text2.trim();
@@ -231054,6 +231211,15 @@ function normalizeAgentProcessSettings(value) {
231054
231211
  }
231055
231212
  return { maxResidentAgentProcesses };
231056
231213
  }
231214
+ var AGENT_PROCESS_SETTING_KEY = "agentProcesses";
231215
+ function parseStoredAgentProcessSettings(saved) {
231216
+ if (!saved) return null;
231217
+ try {
231218
+ return normalizeAgentProcessSettings(JSON.parse(saved));
231219
+ } catch {
231220
+ return null;
231221
+ }
231222
+ }
231057
231223
  function isResidentProcessInScope(candidate, scope) {
231058
231224
  return candidate.projectId === scope.projectId && candidate.branch === scope.branch;
231059
231225
  }
@@ -231862,14 +232028,28 @@ var AgentSessionManager = class {
231862
232028
  lastActiveAt: session.lastActiveAt
231863
232029
  })).sort((a, b2) => a.lastActiveAt - b2.lastActiveAt);
231864
232030
  }
231865
- async getMaxResidentAgentProcesses() {
231866
- const saved = await this.storage.settings.get("agentProcesses");
231867
- if (!saved) return normalizeAgentProcessSettings(void 0).maxResidentAgentProcesses;
231868
- try {
231869
- return normalizeAgentProcessSettings(JSON.parse(saved)).maxResidentAgentProcesses;
231870
- } catch {
231871
- return normalizeAgentProcessSettings(void 0).maxResidentAgentProcesses;
232031
+ /**
232032
+ * Where the resident limit is read from. A hub keeps it per user and applies
232033
+ * the project owner's value; a reverse-connect worker (set by
232034
+ * shared-services) belongs to one user and reads the machine-wide value the
232035
+ * hub pushed into its `settings`.
232036
+ */
232037
+ residentLimitIsMachineWide = false;
232038
+ async getMaxResidentAgentProcesses(projectId) {
232039
+ const machineWide = async () => parseStoredAgentProcessSettings(await this.storage.settings.get(AGENT_PROCESS_SETTING_KEY));
232040
+ let settings = null;
232041
+ if (!this.residentLimitIsMachineWide) {
232042
+ try {
232043
+ const ownerId = await this.storage.projects.getOwnerId(projectId) ?? "local";
232044
+ settings = parseStoredAgentProcessSettings(
232045
+ await this.storage.userSettings.get(ownerId, AGENT_PROCESS_SETTING_KEY)
232046
+ );
232047
+ } catch (error48) {
232048
+ console.warn("[AgentSession] reading the owner's resident limit failed:", error48);
232049
+ }
231872
232050
  }
232051
+ settings ??= await machineWide();
232052
+ return (settings ?? DEFAULT_AGENT_PROCESS_SETTINGS).maxResidentAgentProcesses;
231873
232053
  }
231874
232054
  async withCapacityLock(work) {
231875
232055
  const previous = this.capacityQueue;
@@ -231887,7 +232067,7 @@ var AgentSessionManager = class {
231887
232067
  }
231888
232068
  async ensureResidentCapacity(scope, options) {
231889
232069
  await this.withCapacityLock(async () => {
231890
- const maxResidentAgentProcesses = await this.getMaxResidentAgentProcesses();
232070
+ const maxResidentAgentProcesses = await this.getMaxResidentAgentProcesses(scope.projectId);
231891
232071
  const live = [...this.sessions.values()].filter(
231892
232072
  (session) => session.id !== options?.excludeSessionId && session.projectId === scope.projectId && session.branch === scope.branch && this.isProcessAlive(session)
231893
232073
  );
@@ -238596,6 +238776,7 @@ function createRemoteProjectSessionReader(options) {
238596
238776
  }
238597
238777
  };
238598
238778
  }
238779
+ var applyTaskChangeDirectly = (_taskId, apply) => apply();
238599
238780
  var emptySchema = external_exports.object({}).strict();
238600
238781
  var selectorSchema = external_exports.string().min(1).max(MAX_TOOL_SELECTOR_ID);
238601
238782
  var taskStatusSchema = external_exports.enum(["todo", "in_progress", "done", "cancelled"]);
@@ -239103,10 +239284,15 @@ async function createProjectChatTools(options) {
239103
239284
  const current = await storage2.tasks.getById(taskId);
239104
239285
  if (!current || current.project_id !== projectId) throw new Error("Task is no longer authorized");
239105
239286
  await validateAssignedBranch(assignedBranch);
239106
- const updated = await storage2.tasks.update(taskId, {
239287
+ const storagePatch = {
239107
239288
  ...patch,
239108
239289
  ...assignedBranch !== void 0 ? { assigned_branch: assignedBranch } : {}
239109
- });
239290
+ };
239291
+ const updated = await (options.applyTaskChange ?? applyTaskChangeDirectly)(
239292
+ taskId,
239293
+ () => storage2.tasks.update(taskId, storagePatch),
239294
+ revertTaskPatch(storage2, taskId, storagePatch)
239295
+ );
239110
239296
  if (!updated) throw new Error("Task update failed");
239111
239297
  await touch("task", taskId);
239112
239298
  await finishOperation(operation, "completed", { taskId, title: updated.title });
@@ -240802,10 +240988,15 @@ var ProjectChatManager = class {
240802
240988
  }
240803
240989
  try {
240804
240990
  const { assignedBranch, ...patch } = payload.patch;
240805
- const updated = await this.storage.tasks.update(payload.taskId, {
240991
+ const storagePatch = {
240806
240992
  ...patch,
240807
240993
  ...assignedBranch !== void 0 ? { assigned_branch: assignedBranch } : {}
240808
- });
240994
+ };
240995
+ const updated = await (this.toolDependencies?.applyTaskChange ?? applyTaskChangeDirectly)(
240996
+ payload.taskId,
240997
+ () => this.storage.tasks.update(payload.taskId, storagePatch),
240998
+ revertTaskPatch(this.storage, payload.taskId, storagePatch)
240999
+ );
240809
241000
  if (!updated) throw new Error("Task update failed");
240810
241001
  } catch (error48) {
240811
241002
  console.warn(`[ProjectChat] task update ${operation.id} remains retryable:`, boundedStreamError(error48).message);
@@ -247567,6 +247758,47 @@ async function pushRetentionToWorkers(deps, days, userId) {
247567
247758
  return Promise.all(servers.map((server) => pushRetentionToWorker(deps, server, days)));
247568
247759
  }
247569
247760
 
247761
+ // src/agent-process-downlink.ts
247762
+ var AGENT_PROCESS_DOWNLINK_PATH = "/api/settings/agent-processes";
247763
+ async function readUserAgentProcessSettings(storage2, userId) {
247764
+ return parseStoredAgentProcessSettings(await storage2.userSettings.get(userId, AGENT_PROCESS_SETTING_KEY));
247765
+ }
247766
+ async function resolveUserAgentProcessSettings(storage2, userId) {
247767
+ return await readUserAgentProcessSettings(storage2, userId) ?? parseStoredAgentProcessSettings(await storage2.settings.get(AGENT_PROCESS_SETTING_KEY)) ?? DEFAULT_AGENT_PROCESS_SETTINGS;
247768
+ }
247769
+ async function pushAgentProcessSettingsToWorker(deps, server, settings) {
247770
+ try {
247771
+ const result = await proxyToRemoteAuto(
247772
+ server.id,
247773
+ "PUT",
247774
+ AGENT_PROCESS_DOWNLINK_PATH,
247775
+ settings,
247776
+ { reverseConnectManager: deps.reverseConnectManager, timeoutMs: deps.timeoutMs ?? 1e4 }
247777
+ );
247778
+ if (result.ok) return { remoteServerId: server.id, name: server.name, status: "applied" };
247779
+ if (result.errorCode === "network_error") {
247780
+ return { remoteServerId: server.id, name: server.name, status: "offline" };
247781
+ }
247782
+ return {
247783
+ remoteServerId: server.id,
247784
+ name: server.name,
247785
+ status: "error",
247786
+ detail: result.errorCode === "timeout" ? "timed out" : `worker responded ${result.status}`
247787
+ };
247788
+ } catch (error48) {
247789
+ return {
247790
+ remoteServerId: server.id,
247791
+ name: server.name,
247792
+ status: "error",
247793
+ detail: error48 instanceof Error ? error48.message : String(error48)
247794
+ };
247795
+ }
247796
+ }
247797
+ async function pushAgentProcessSettingsToWorkers(deps, userId, settings) {
247798
+ const servers = await deps.storage.remoteServers.getAll(userId);
247799
+ return Promise.all(servers.map((server) => pushAgentProcessSettingsToWorker(deps, server, settings)));
247800
+ }
247801
+
247570
247802
  // src/search/refresh.ts
247571
247803
  var DEFAULT_TTL_MS = 3e4;
247572
247804
  var DEFAULT_DEADLINE_MS = 5e3;
@@ -248791,6 +249023,7 @@ function assertProjectChatStarted(result) {
248791
249023
  var sharedServices = async (fastify2, opts) => {
248792
249024
  const processManager = new ProcessManager(opts.storage);
248793
249025
  const agentSessionManager = new AgentSessionManager(opts.storage);
249026
+ agentSessionManager.residentLimitIsMachineWide = opts.isReverseConnectWorker ?? false;
248794
249027
  const agentSessionLifecycle = new AgentSessionLifecycleService({
248795
249028
  storage: opts.storage,
248796
249029
  runtime: agentSessionManager
@@ -248832,6 +249065,12 @@ var sharedServices = async (fastify2, opts) => {
248832
249065
  }
248833
249066
  }
248834
249067
  const reverseConnectManager = new ReverseConnectManager();
249068
+ const retentionHolds = new RetentionHoldSync({
249069
+ storage: opts.storage,
249070
+ reverseConnectManager,
249071
+ remoteSessionMap,
249072
+ sources: [scheduleHoldSource(opts.storage), taskHoldSource(opts.storage)]
249073
+ });
248835
249074
  const browserManager = new BrowserManager();
248836
249075
  const remoteExecutorMonitor = new RemoteExecutorMonitor(reverseConnectManager, eventBus, opts.storage, remoteExecutorMap);
248837
249076
  const scheduler = new SchedulerService(opts.storage, processManager, {
@@ -248865,6 +249104,7 @@ var sharedServices = async (fastify2, opts) => {
248865
249104
  toolDependencies: {
248866
249105
  agentSessionManager,
248867
249106
  remoteSessions: projectChatRemoteSessions,
249107
+ applyTaskChange: (taskId, apply, revert) => applyTaskChange({ storage: opts.storage, retentionHolds }, taskId, apply, revert),
248868
249108
  mutationServices: {
248869
249109
  // Prepared-session lifecycle §10.3: one `start` under the operation's
248870
249110
  // own idempotency key. A replay of the same operation returns the
@@ -249085,13 +249325,8 @@ var sharedServices = async (fastify2, opts) => {
249085
249325
  fastify2.decorate("reverseConnectManager", reverseConnectManager);
249086
249326
  fastify2.decorate("browserManager", browserManager);
249087
249327
  fastify2.decorate("scheduler", scheduler);
249088
- const retentionHolds = new RetentionHoldSync({
249089
- storage: opts.storage,
249090
- reverseConnectManager,
249091
- remoteSessionMap,
249092
- sources: [scheduleHoldSource(opts.storage)]
249093
- });
249094
249328
  fastify2.decorate("retentionHolds", retentionHolds);
249329
+ subscribeTaskHoldSync(eventBus, retentionHolds);
249095
249330
  const releaseStaleHolds = (remoteServerId) => {
249096
249331
  void retentionHolds.releaseStale(remoteServerId).then((failed) => {
249097
249332
  if (failed > 0) console.warn(`[RetentionHolds] ${failed} session(s) on ${remoteServerId} not re-synced`);
@@ -249211,6 +249446,14 @@ var sharedServices = async (fastify2, opts) => {
249211
249446
  console.warn(`[SessionRetention] worker ${result.name} is too old to receive the retention window`);
249212
249447
  }
249213
249448
  })().catch((error48) => console.warn("[SessionRetention] downlink on connect failed:", error48));
249449
+ void (async () => {
249450
+ const server = await opts.storage.remoteServers.getById(remoteServerId);
249451
+ const ownerId = await opts.storage.remoteServers.getOwnerId(remoteServerId);
249452
+ if (!server || !ownerId) return;
249453
+ const settings = await readUserAgentProcessSettings(opts.storage, ownerId);
249454
+ if (!settings) return;
249455
+ await pushAgentProcessSettingsToWorker({ storage: opts.storage, reverseConnectManager }, server, settings);
249456
+ })().catch((error48) => console.warn("[AgentProcesses] downlink on connect failed:", error48));
249214
249457
  });
249215
249458
  notificationService.start();
249216
249459
  notificationService.requestDrain();
@@ -256956,7 +257199,46 @@ var project_activity_routes_default = (0, import_fastify_plugin18.default)(route
256956
257199
  // src/routes/task-routes.ts
256957
257200
  var import_fastify_plugin19 = __toESM(require_plugin2(), 1);
256958
257201
  import { randomUUID as randomUUID22 } from "crypto";
257202
+
257203
+ // src/routes/source-sessions.ts
257204
+ var SOURCE_ID_MAX = 200;
257205
+ var validSourceId = (value) => typeof value === "string" && value.length > 0 && value.length <= SOURCE_ID_MAX && value.trim() === value;
257206
+ async function isProjectSourceSession(storage2, sessionId, projectId) {
257207
+ const sourceSession = await storage2.agentSessions.getById(sessionId);
257208
+ return sourceSession ? sourceSession.project_id === projectId : !!await storage2.remoteSessionMappings.getAuthorizedByLocal(sessionId, projectId);
257209
+ }
257210
+ async function resolveSourceSessions(storage2, ids) {
257211
+ const unique = [...new Set(ids)];
257212
+ const remoteIds = unique.filter((id) => id.startsWith("remote-"));
257213
+ const remoteTitles = await storage2.searchCache.getCachedSessionTitles(remoteIds);
257214
+ const branchOf2 = async (row) => {
257215
+ if (!row) return null;
257216
+ const registered = row.workspace_checkout_id ? await storage2.workspaceRegistry.getCheckoutById(row.workspace_checkout_id) : void 0;
257217
+ return (registered ? registered.workspace.branch : row.branch) || null;
257218
+ };
257219
+ const out = /* @__PURE__ */ new Map();
257220
+ await Promise.all(unique.map(async (id) => {
257221
+ if (id.startsWith("remote-")) {
257222
+ const mapping = await storage2.remoteSessionMappings.getByLocal(id);
257223
+ out.set(id, {
257224
+ id,
257225
+ exists: !!mapping,
257226
+ branch: await branchOf2(mapping),
257227
+ title: remoteTitles.get(id) ?? null
257228
+ });
257229
+ return;
257230
+ }
257231
+ const session = await storage2.agentSessions.getById(id);
257232
+ out.set(id, { id, exists: !!session, branch: await branchOf2(session), title: session?.title ?? null });
257233
+ }));
257234
+ return out;
257235
+ }
257236
+
257237
+ // src/routes/task-routes.ts
257238
+ var SOURCE_ITEM_INDEX_MAX = 100;
256959
257239
  var routes18 = async (fastify2) => {
257240
+ const applyHoldingChange = (taskId, apply, revert) => applyTaskChange(fastify2, taskId, apply, revert);
257241
+ const holdFailed = (error48) => `Could not protect the source session from retention: ${error48 instanceof Error ? error48.message : String(error48)}`;
256960
257242
  fastify2.get(
256961
257243
  "/api/projects/:projectId/tasks",
256962
257244
  async (req, reply) => {
@@ -256968,7 +257250,16 @@ var routes18 = async (fastify2) => {
256968
257250
  }
256969
257251
  const includeArchived = req.query.includeArchived === "true";
256970
257252
  const tasks = await fastify2.storage.tasks.getByProjectId(req.params.projectId, { includeArchived });
256971
- return reply.code(200).send({ tasks });
257253
+ const sources = await resolveSourceSessions(
257254
+ fastify2.storage,
257255
+ tasks.flatMap((t) => t.source_session_id ? [t.source_session_id] : [])
257256
+ );
257257
+ return reply.code(200).send({
257258
+ tasks: tasks.map((t) => ({
257259
+ ...t,
257260
+ source_session: t.source_session_id ? sources.get(t.source_session_id) ?? null : null
257261
+ }))
257262
+ });
256972
257263
  }
256973
257264
  );
256974
257265
  fastify2.get(
@@ -256992,10 +257283,23 @@ var routes18 = async (fastify2) => {
256992
257283
  if (!project) {
256993
257284
  return reply.code(404).send({ error: "Project not found" });
256994
257285
  }
256995
- const { title: providedTitle, description, status, priority, assigned_branch } = req.body;
257286
+ const { title: providedTitle, description, status, priority } = req.body;
257287
+ let { assigned_branch } = req.body;
256996
257288
  if (!description) {
256997
257289
  return reply.code(400).send({ error: "description is required" });
256998
257290
  }
257291
+ let source = null;
257292
+ if (req.body.source) {
257293
+ const { session_id, tool_use_id, item_index } = req.body.source;
257294
+ if (!validSourceId(session_id) || !validSourceId(tool_use_id) || typeof item_index !== "number" || !Number.isInteger(item_index) || item_index < 0 || item_index > SOURCE_ITEM_INDEX_MAX) {
257295
+ return reply.code(400).send({ error: "Invalid source" });
257296
+ }
257297
+ if (!await isProjectSourceSession(fastify2.storage, session_id, req.params.projectId)) {
257298
+ return reply.code(400).send({ error: "Invalid source" });
257299
+ }
257300
+ source = { session_id, tool_use_id, item_index };
257301
+ assigned_branch = null;
257302
+ }
256999
257303
  let title = providedTitle;
257000
257304
  if (!title) {
257001
257305
  try {
@@ -257020,16 +257324,44 @@ Description: ${description}`,
257020
257324
  }
257021
257325
  }
257022
257326
  const id = randomUUID22();
257023
- const task = await fastify2.storage.tasks.create({
257327
+ const insert = () => fastify2.storage.tasks.create({
257024
257328
  id,
257025
257329
  project_id: req.params.projectId,
257026
257330
  title,
257027
257331
  description,
257028
257332
  status,
257029
257333
  priority,
257030
- assigned_branch
257334
+ assigned_branch,
257335
+ source
257031
257336
  });
257032
- return reply.code(201).send({ task });
257337
+ let task;
257338
+ if (source) {
257339
+ const sourceSessionId = source.session_id;
257340
+ try {
257341
+ task = await fastify2.retentionHolds.exclusive(sourceSessionId, async (syncNow) => {
257342
+ const row = await insert();
257343
+ try {
257344
+ await syncNow();
257345
+ return row;
257346
+ } catch (error48) {
257347
+ if (row.id === id) {
257348
+ await fastify2.storage.tasks.delete(row.id);
257349
+ await syncNow().catch(() => void 0);
257350
+ }
257351
+ throw error48;
257352
+ }
257353
+ });
257354
+ } catch (error48) {
257355
+ return reply.code(502).send({ error: holdFailed(error48) });
257356
+ }
257357
+ } else {
257358
+ task = await insert();
257359
+ }
257360
+ const created = task.id === id;
257361
+ if (created) {
257362
+ fastify2.eventBus.emit({ type: "task:created", projectId: req.params.projectId, task: { ...task } });
257363
+ }
257364
+ return reply.code(created ? 201 : 200).send({ task });
257033
257365
  });
257034
257366
  fastify2.put("/api/tasks/:id", async (req, reply) => {
257035
257367
  const userId = requireUserFacingUserId(req, reply);
@@ -257042,14 +257374,25 @@ Description: ${description}`,
257042
257374
  if (!project) {
257043
257375
  return reply.code(404).send({ error: "Task not found" });
257044
257376
  }
257045
- const task = await fastify2.storage.tasks.update(req.params.id, {
257377
+ const patch = {
257046
257378
  title: req.body.title,
257047
257379
  description: req.body.description,
257048
257380
  status: req.body.status,
257049
257381
  priority: req.body.priority,
257050
257382
  assigned_branch: req.body.assigned_branch,
257051
257383
  position: req.body.position
257052
- });
257384
+ };
257385
+ let task;
257386
+ try {
257387
+ task = await applyHoldingChange(
257388
+ req.params.id,
257389
+ () => fastify2.storage.tasks.update(req.params.id, patch),
257390
+ revertTaskPatch(fastify2.storage, req.params.id, patch)
257391
+ );
257392
+ } catch (error48) {
257393
+ return reply.code(502).send({ error: holdFailed(error48) });
257394
+ }
257395
+ if (task) fastify2.eventBus.emit({ type: "task:updated", projectId: existing.project_id, task: { ...task } });
257053
257396
  return reply.code(200).send({ task });
257054
257397
  });
257055
257398
  fastify2.delete("/api/tasks/:id", async (req, reply) => {
@@ -257064,6 +257407,12 @@ Description: ${description}`,
257064
257407
  return reply.code(404).send({ error: "Task not found" });
257065
257408
  }
257066
257409
  await fastify2.storage.tasks.delete(req.params.id);
257410
+ fastify2.eventBus.emit({ type: "task:deleted", projectId: existing.project_id, taskId: req.params.id });
257411
+ if (existing.source_session_id) {
257412
+ await fastify2.retentionHolds.sync(existing.source_session_id).catch((error48) => {
257413
+ console.warn(`[RetentionHolds] release for ${existing.source_session_id} deferred:`, error48);
257414
+ });
257415
+ }
257067
257416
  return reply.code(200).send({ success: true });
257068
257417
  });
257069
257418
  fastify2.post("/api/tasks/:id/archive", async (req, reply) => {
@@ -257078,6 +257427,7 @@ Description: ${description}`,
257078
257427
  return reply.code(404).send({ error: "Task not found" });
257079
257428
  }
257080
257429
  const task = await fastify2.storage.tasks.archive(req.params.id);
257430
+ if (task) fastify2.eventBus.emit({ type: "task:updated", projectId: existing.project_id, task: { ...task } });
257081
257431
  return reply.code(200).send({ task });
257082
257432
  });
257083
257433
  fastify2.post("/api/tasks/:id/unarchive", async (req, reply) => {
@@ -257091,7 +257441,17 @@ Description: ${description}`,
257091
257441
  if (!project) {
257092
257442
  return reply.code(404).send({ error: "Task not found" });
257093
257443
  }
257094
- const task = await fastify2.storage.tasks.unarchive(req.params.id);
257444
+ let task;
257445
+ try {
257446
+ task = await applyHoldingChange(
257447
+ req.params.id,
257448
+ () => fastify2.storage.tasks.unarchive(req.params.id),
257449
+ () => fastify2.storage.tasks.archive(req.params.id)
257450
+ );
257451
+ } catch (error48) {
257452
+ return reply.code(502).send({ error: holdFailed(error48) });
257453
+ }
257454
+ if (task) fastify2.eventBus.emit({ type: "task:updated", projectId: existing.project_id, task: { ...task } });
257095
257455
  return reply.code(200).send({ task });
257096
257456
  });
257097
257457
  fastify2.put("/api/projects/:projectId/tasks/reorder", async (req, reply) => {
@@ -258265,18 +258625,11 @@ var DEFAULT_CONVERSATION_SETTINGS = {
258265
258625
  agentFontSize: 16,
258266
258626
  chatFontSize: 15,
258267
258627
  filesTreeFontSize: 14,
258268
- filesContentFontSize: 14
258628
+ filesContentFontSize: 14,
258629
+ tasksFontSize: 14
258269
258630
  };
258270
258631
  var CONV_FONT_SIZE_MIN = 12;
258271
258632
  var CONV_FONT_SIZE_MAX = 22;
258272
- function readStoredAgentProcessSettings(saved) {
258273
- if (!saved) return normalizeAgentProcessSettings(void 0);
258274
- try {
258275
- return normalizeAgentProcessSettings(JSON.parse(saved));
258276
- } catch {
258277
- return normalizeAgentProcessSettings(void 0);
258278
- }
258279
- }
258280
258633
  function validateConvFontSize(value, field) {
258281
258634
  if (typeof value !== "number" || !Number.isFinite(value)) {
258282
258635
  return `${field} must be a finite number`;
@@ -258297,11 +258650,13 @@ function readStoredConversationSettings(saved) {
258297
258650
  const chatValid = typeof parsed.chatFontSize === "number" && validateConvFontSize(parsed.chatFontSize, "chatFontSize") === null;
258298
258651
  const filesTreeValid = typeof parsed.filesTreeFontSize === "number" && validateConvFontSize(parsed.filesTreeFontSize, "filesTreeFontSize") === null;
258299
258652
  const filesContentValid = typeof parsed.filesContentFontSize === "number" && validateConvFontSize(parsed.filesContentFontSize, "filesContentFontSize") === null;
258653
+ const tasksValid = typeof parsed.tasksFontSize === "number" && validateConvFontSize(parsed.tasksFontSize, "tasksFontSize") === null;
258300
258654
  return {
258301
258655
  agentFontSize: agentValid ? parsed.agentFontSize : DEFAULT_CONVERSATION_SETTINGS.agentFontSize,
258302
258656
  chatFontSize: chatValid ? parsed.chatFontSize : DEFAULT_CONVERSATION_SETTINGS.chatFontSize,
258303
258657
  filesTreeFontSize: filesTreeValid ? parsed.filesTreeFontSize : DEFAULT_CONVERSATION_SETTINGS.filesTreeFontSize,
258304
- filesContentFontSize: filesContentValid ? parsed.filesContentFontSize : DEFAULT_CONVERSATION_SETTINGS.filesContentFontSize
258658
+ filesContentFontSize: filesContentValid ? parsed.filesContentFontSize : DEFAULT_CONVERSATION_SETTINGS.filesContentFontSize,
258659
+ tasksFontSize: tasksValid ? parsed.tasksFontSize : DEFAULT_CONVERSATION_SETTINGS.tasksFontSize
258305
258660
  };
258306
258661
  } catch {
258307
258662
  return DEFAULT_CONVERSATION_SETTINGS;
@@ -258314,12 +258669,17 @@ function requireSettingsUser(req, reply) {
258314
258669
  }
258315
258670
  var routes22 = async (fastify2) => {
258316
258671
  fastify2.get("/api/settings/agent-processes", async (req, reply) => {
258317
- if (requireAuth(req, reply) === null) return;
258318
- const saved = await fastify2.storage.settings.get("agentProcesses");
258319
- return reply.code(200).send(readStoredAgentProcessSettings(saved));
258672
+ const auth2 = requireAuth(req, reply);
258673
+ if (auth2 === null) return;
258674
+ if (fastify2.isReverseConnectWorker) {
258675
+ const saved = await fastify2.storage.settings.get(AGENT_PROCESS_SETTING_KEY);
258676
+ return reply.code(200).send(parseStoredAgentProcessSettings(saved) ?? DEFAULT_AGENT_PROCESS_SETTINGS);
258677
+ }
258678
+ return reply.code(200).send(await resolveUserAgentProcessSettings(fastify2.storage, resolveUserId(auth2)));
258320
258679
  });
258321
258680
  fastify2.put("/api/settings/agent-processes", async (req, reply) => {
258322
- if (requireAuth(req, reply) === null) return;
258681
+ const auth2 = requireAuth(req, reply);
258682
+ if (auth2 === null) return;
258323
258683
  const value = req.body?.maxResidentAgentProcesses;
258324
258684
  if (typeof value !== "number" || !Number.isInteger(value) || value < AGENT_PROCESS_SETTINGS_LIMITS.min || value > AGENT_PROCESS_SETTINGS_LIMITS.max) {
258325
258685
  return reply.code(400).send({
@@ -258327,8 +258687,18 @@ var routes22 = async (fastify2) => {
258327
258687
  });
258328
258688
  }
258329
258689
  const config2 = { maxResidentAgentProcesses: value };
258330
- await fastify2.storage.settings.set("agentProcesses", JSON.stringify(config2));
258331
- return reply.code(200).send(config2);
258690
+ if (fastify2.isReverseConnectWorker) {
258691
+ await fastify2.storage.settings.set(AGENT_PROCESS_SETTING_KEY, JSON.stringify(config2));
258692
+ return reply.code(200).send(config2);
258693
+ }
258694
+ const userId = resolveUserId(auth2);
258695
+ await fastify2.storage.userSettings.set(userId, AGENT_PROCESS_SETTING_KEY, JSON.stringify(config2));
258696
+ const workers = await pushAgentProcessSettingsToWorkers(
258697
+ { storage: fastify2.storage, reverseConnectManager: fastify2.reverseConnectManager },
258698
+ userId,
258699
+ config2
258700
+ );
258701
+ return reply.code(200).send({ ...config2, workers });
258332
258702
  });
258333
258703
  fastify2.get("/api/settings/session-retention", async (req, reply) => {
258334
258704
  if (requireAuth(req, reply) === null) return;
@@ -258598,7 +258968,7 @@ var routes22 = async (fastify2) => {
258598
258968
  fastify2.put("/api/settings/conversation", async (req, reply) => {
258599
258969
  const userId = requireSettingsUser(req, reply);
258600
258970
  if (userId === null) return;
258601
- const { agentFontSize, chatFontSize, filesTreeFontSize, filesContentFontSize } = req.body;
258971
+ const { agentFontSize, chatFontSize, filesTreeFontSize, filesContentFontSize, tasksFontSize } = req.body;
258602
258972
  if (agentFontSize !== void 0) {
258603
258973
  const err = validateConvFontSize(agentFontSize, "agentFontSize");
258604
258974
  if (err) return reply.code(400).send({ error: err });
@@ -258615,16 +258985,21 @@ var routes22 = async (fastify2) => {
258615
258985
  const err = validateConvFontSize(filesContentFontSize, "filesContentFontSize");
258616
258986
  if (err) return reply.code(400).send({ error: err });
258617
258987
  }
258988
+ if (tasksFontSize !== void 0) {
258989
+ const err = validateConvFontSize(tasksFontSize, "tasksFontSize");
258990
+ if (err) return reply.code(400).send({ error: err });
258991
+ }
258618
258992
  const existing = readStoredConversationSettings(await fastify2.storage.userSettings.get(userId, "conversation"));
258619
258993
  const updated = {
258620
258994
  agentFontSize: agentFontSize ?? existing.agentFontSize,
258621
258995
  chatFontSize: chatFontSize ?? existing.chatFontSize,
258622
258996
  filesTreeFontSize: filesTreeFontSize ?? existing.filesTreeFontSize,
258623
- filesContentFontSize: filesContentFontSize ?? existing.filesContentFontSize
258997
+ filesContentFontSize: filesContentFontSize ?? existing.filesContentFontSize,
258998
+ tasksFontSize: tasksFontSize ?? existing.tasksFontSize
258624
258999
  };
258625
259000
  await fastify2.storage.userSettings.set(userId, "conversation", JSON.stringify(updated));
258626
259001
  console.log(
258627
- `[Settings] Conversation updated: agentFontSize=${updated.agentFontSize}, chatFontSize=${updated.chatFontSize}, filesTreeFontSize=${updated.filesTreeFontSize}, filesContentFontSize=${updated.filesContentFontSize}`
259002
+ `[Settings] Conversation updated: agentFontSize=${updated.agentFontSize}, chatFontSize=${updated.chatFontSize}, filesTreeFontSize=${updated.filesTreeFontSize}, filesContentFontSize=${updated.filesContentFontSize}, tasksFontSize=${updated.tasksFontSize}`
258628
259003
  );
258629
259004
  return reply.code(200).send(updated);
258630
259005
  });
@@ -267052,6 +267427,11 @@ var TOOLS2 = [
267052
267427
  name: PROPOSE_SCHEDULE_TOOL,
267053
267428
  description: PROPOSE_SCHEDULE_DESCRIPTION,
267054
267429
  inputSchema: PROPOSE_SCHEDULE_INPUT_SCHEMA
267430
+ },
267431
+ {
267432
+ name: PROPOSE_TASK_TOOL,
267433
+ description: PROPOSE_TASK_DESCRIPTION,
267434
+ inputSchema: PROPOSE_TASK_INPUT_SCHEMA
267055
267435
  }
267056
267436
  ];
267057
267437
  var textResult2 = (text2, isError = false) => ({
@@ -267074,6 +267454,10 @@ var routes33 = async (fastify2) => {
267074
267454
  return payload;
267075
267455
  };
267076
267456
  const callTool = (toolName, args) => {
267457
+ if (toolName === PROPOSE_TASK_TOOL) {
267458
+ const parsed2 = parseProposeTaskArgs(args);
267459
+ return parsed2.ok ? textResult2(PROPOSE_TASK_ACK) : textResult2(parsed2.error, true);
267460
+ }
267077
267461
  if (toolName !== PROPOSE_SCHEDULE_TOOL) return textResult2(`Unknown tool: ${toolName}`, true);
267078
267462
  const parsed = parseProposeScheduleArgs(args);
267079
267463
  if (!parsed.ok) return textResult2(parsed.error, true);
@@ -267126,8 +267510,6 @@ import { randomUUID as randomUUID29 } from "crypto";
267126
267510
  import path20 from "path";
267127
267511
  var RUN_TYPES = ["command", "prompt"];
267128
267512
  var CWD_MODES = ["branch", "directory"];
267129
- var SOURCE_ID_MAX = 200;
267130
- var validSourceId = (value) => typeof value === "string" && value.length > 0 && value.length <= SOURCE_ID_MAX && value.trim() === value;
267131
267513
  function validRequestId(value) {
267132
267514
  return typeof value === "string" && value.length > 0 && value.length <= 200 && value.trim() === value;
267133
267515
  }
@@ -267167,32 +267549,6 @@ var routes34 = async (fastify2) => {
267167
267549
  }
267168
267550
  return schedule;
267169
267551
  };
267170
- const resolveSourceSessions = async (ids) => {
267171
- const unique = [...new Set(ids)];
267172
- const remoteIds = unique.filter((id) => id.startsWith("remote-"));
267173
- const remoteTitles = await fastify2.storage.searchCache.getCachedSessionTitles(remoteIds);
267174
- const branchOf2 = async (row) => {
267175
- if (!row) return null;
267176
- const registered = row.workspace_checkout_id ? await fastify2.storage.workspaceRegistry.getCheckoutById(row.workspace_checkout_id) : void 0;
267177
- return (registered ? registered.workspace.branch : row.branch) || null;
267178
- };
267179
- const out = /* @__PURE__ */ new Map();
267180
- await Promise.all(unique.map(async (id) => {
267181
- if (id.startsWith("remote-")) {
267182
- const mapping = await fastify2.storage.remoteSessionMappings.getByLocal(id);
267183
- out.set(id, {
267184
- id,
267185
- exists: !!mapping,
267186
- branch: await branchOf2(mapping),
267187
- title: remoteTitles.get(id) ?? null
267188
- });
267189
- return;
267190
- }
267191
- const session = await fastify2.storage.agentSessions.getById(id);
267192
- out.set(id, { id, exists: !!session, branch: await branchOf2(session), title: session?.title ?? null });
267193
- }));
267194
- return out;
267195
- };
267196
267552
  fastify2.get(
267197
267553
  "/api/projects/:projectId/schedules",
267198
267554
  async (req, reply) => {
@@ -267203,6 +267559,7 @@ var routes34 = async (fastify2) => {
267203
267559
  const schedules = await fastify2.storage.scheduledTasks.getByProjectId(req.params.projectId);
267204
267560
  const lastRuns = await fastify2.storage.scheduledTaskRuns.getLastByScheduleIds(schedules.map((s3) => s3.id));
267205
267561
  const sources = await resolveSourceSessions(
267562
+ fastify2.storage,
267206
267563
  schedules.flatMap((s3) => s3.source_session_id ? [s3.source_session_id] : [])
267207
267564
  );
267208
267565
  return reply.code(200).send({
@@ -267247,11 +267604,7 @@ var routes34 = async (fastify2) => {
267247
267604
  if (!validSourceId(b2.source.session_id) || !validSourceId(b2.source.tool_use_id)) {
267248
267605
  return reply.code(400).send({ error: "Invalid source" });
267249
267606
  }
267250
- const sourceSession = await fastify2.storage.agentSessions.getById(b2.source.session_id);
267251
- const owned = sourceSession ? sourceSession.project_id === req.params.projectId : !!await fastify2.storage.remoteSessionMappings.getAuthorizedByLocal(
267252
- b2.source.session_id,
267253
- req.params.projectId
267254
- );
267607
+ const owned = await isProjectSourceSession(fastify2.storage, b2.source.session_id, req.params.projectId);
267255
267608
  if (!owned) return reply.code(400).send({ error: "Invalid source" });
267256
267609
  source = { session_id: b2.source.session_id, tool_use_id: b2.source.tool_use_id };
267257
267610
  }
@@ -268177,6 +268530,7 @@ var createServer = async (opts) => {
268177
268530
  server.decorate("authEnabled", authEnabled);
268178
268531
  server.decorate("uiBuildId", uiBuildId);
268179
268532
  server.decorate("noLocalProjects", noLocalProjects);
268533
+ server.decorate("isReverseConnectWorker", acceptRemote);
268180
268534
  registerTraceContext(server);
268181
268535
  server.addHook("onRequest", (req, reply, done) => {
268182
268536
  reply.header("access-control-allow-origin", "*");
@@ -268229,7 +268583,7 @@ var createServer = async (opts) => {
268229
268583
  // the entry rather than offering a control that cannot do anything.
268230
268584
  crossRemoteSessionGrants: crossRemoteMcpEnabled() && authEnabled
268231
268585
  }));
268232
- server.register(shared_services_default, { storage: opts.storage, authEnabled });
268586
+ server.register(shared_services_default, { storage: opts.storage, authEnabled, isReverseConnectWorker: acceptRemote });
268233
268587
  server.register(import_websocket2.default);
268234
268588
  server.register(import_multipart.default, {
268235
268589
  limits: { fileSize: 50 * 1024 * 1024, files: 50 }
@@ -268629,6 +268983,10 @@ var WORKER_CAPABILITIES = {
268629
268983
  // session out of the worker's own retention sweep — retention-holds.ts.
268630
268984
  "http:PUT /api/path/retention-holds/:param": { since: "0.3.45", summary: "\u4E0B\u53D1\u4F1A\u8BDD\u4FDD\u7559\u9501(\u9632\u4FDD\u7559\u671F\u6E05\u7406)" },
268631
268985
  "http:GET /api/path/retention-holds": { since: "0.3.45", summary: "\u5217\u51FA\u6301\u6709\u4FDD\u7559\u9501\u7684\u4F1A\u8BDD(\u91CA\u653E\u8FC7\u671F\u9501)" },
268986
+ // Resident agent process limit downlink (agent-process-downlink.ts). Reuses
268987
+ // the operator PUT that has existed since the resident pool shipped, so no
268988
+ // worker release is needed; the worker skips onward fan-out by process mode.
268989
+ "http:PUT /api/settings/agent-processes": { since: "0.1.30", summary: "\u4E0B\u53D1\u5E38\u9A7B agent \u8FDB\u7A0B\u4E0A\u9650" },
268632
268990
  // --- Search / notifications / cross-remote ---
268633
268991
  "http:GET /api/path/search-catalog": { since: "0.2.0", summary: "\u641C\u7D22\u76EE\u5F55\u5FEB\u7167" },
268634
268992
  // Empirically probed: 0.2.15 → 404, 0.2.16 → 400 (route exists).
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@vibedeckx/darwin-arm64",
3
- "version": "0.3.45",
3
+ "version": "0.3.48",
4
4
  "description": "Vibedeckx platform binaries for macOS ARM64",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/vibedeckx/vibedeckx.git"
8
+ },
5
9
  "os": [
6
10
  "darwin"
7
11
  ],