@sideboard-ai/core 0.1.252 → 0.1.254

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 (27) hide show
  1. package/dist/{agents-B66CNEPB.js → agents-FSUI5MET.js} +3 -3
  2. package/dist/{agents-C7T4US6D.js → agents-HZP7YEKC.js} +3 -3
  3. package/dist/{chunk-AQQWP2TL.js → chunk-553IEH7O.js} +52 -25
  4. package/dist/{chunk-NYXDZCMP.js → chunk-63YSFXLT.js} +72 -2
  5. package/dist/{chunk-SJ3IUYG2.js → chunk-BYRZS2S2.js} +2 -2
  6. package/dist/{chunk-4DGYMF7H.js → chunk-F7ANS66U.js} +16 -4
  7. package/dist/{chunk-PV4KCI2S.js → chunk-HCNCZPDL.js} +72 -2
  8. package/dist/{chunk-6IP4FWMK.js → chunk-PJK24CN3.js} +2 -2
  9. package/dist/{chunk-BHPGORIY.js → chunk-R4DWUBOL.js} +22 -5
  10. package/dist/{chunk-FKGVQKRX.js → chunk-Y7CS2WGJ.js} +53 -26
  11. package/dist/{coordinator-prompt-A2JJ5X7B.js → coordinator-prompt-HZUWK3NP.js} +2 -2
  12. package/dist/{coordinator-prompt-BX2R5EMW.js → coordinator-prompt-Y6S6USNS.js} +2 -2
  13. package/dist/{global-workspace-PUJEGSOB.js → global-workspace-4JCITHB6.js} +2 -2
  14. package/dist/{global-workspace-JJRPZNTY.js → global-workspace-YA7U4M2N.js} +2 -2
  15. package/dist/index.cjs +727 -606
  16. package/dist/index.d.cts +26 -9
  17. package/dist/index.d.ts +26 -9
  18. package/dist/index.js +24 -14
  19. package/dist/mcp/run-stdio.cjs +141 -29
  20. package/dist/mcp/run-stdio.js +21 -14
  21. package/dist/{orchestrator-O3V4UH73.js → orchestrator-LWADJQTN.js} +4 -4
  22. package/dist/{orchestrator-O3TVI7SN.js → orchestrator-VHJZEVGA.js} +4 -4
  23. package/dist/{workspaces-FUOZIR3V.js → workspaces-4KHEUPEX.js} +2 -2
  24. package/dist/{workspaces-V3PZRTY5.js → workspaces-IXZD7EC4.js} +2 -2
  25. package/dist/{worktree-UK62JCYF.js → worktree-DAAF64UU.js} +3 -1
  26. package/dist/{worktree-4DNK2CK6.js → worktree-S3FOMEQ2.js} +3 -1
  27. package/package.json +1 -1
@@ -25,7 +25,7 @@ import {
25
25
  resolveQuotaFallbackAgent,
26
26
  stripBrightsyNdjsonNoise,
27
27
  toolDescription
28
- } from "./chunk-BHPGORIY.js";
28
+ } from "./chunk-R4DWUBOL.js";
29
29
  import {
30
30
  SLACK_REPLY_FORMATTING,
31
31
  addWorkspace,
@@ -48,7 +48,7 @@ import {
48
48
  stageAbsolutePathsAsAttachments,
49
49
  stageBuffersAsAttachments,
50
50
  syncWorkspacesFromThreads
51
- } from "./chunk-SJ3IUYG2.js";
51
+ } from "./chunk-BYRZS2S2.js";
52
52
  import {
53
53
  addPrStackLayer,
54
54
  allocateTeamName,
@@ -91,6 +91,7 @@ import {
91
91
  resolveGithubRepoSlug,
92
92
  resolvePrSelector,
93
93
  resolveRepoRoot,
94
+ switchWorktreeBranch,
94
95
  takenSlugsFromThread,
95
96
  threadDisplayLabel,
96
97
  ticketSlugForBranch,
@@ -98,7 +99,7 @@ import {
98
99
  worktreeDisplayLabelForGroup,
99
100
  worktreeNameFromPath,
100
101
  worktreeSlugForTicket
101
- } from "./chunk-NYXDZCMP.js";
102
+ } from "./chunk-63YSFXLT.js";
102
103
  import {
103
104
  ATTACHMENTS_DIR,
104
105
  DETACHED_JOBS_DIR,
@@ -136,6 +137,7 @@ import {
136
137
  applyTurnUsage,
137
138
  assertOrchestratorCapableAgent,
138
139
  autoCleanupHistoryEnabled,
140
+ caffeinateWhileSchedulesEnabled,
139
141
  childEnvWithAppSettings,
140
142
  coerceOrchestratorAgent,
141
143
  contextTokens,
@@ -443,9 +445,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
443
445
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
444
446
  );
445
447
  }
446
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-PUJEGSOB.js");
448
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-4JCITHB6.js");
447
449
  if (isGlobalThread2(thread)) {
448
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-BX2R5EMW.js");
450
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-Y6S6USNS.js");
449
451
  ensureGlobalCoordinatorCwd2(
450
452
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
451
453
  );
@@ -4335,7 +4337,7 @@ async function createThread(input, _onSetupLine) {
4335
4337
  return readThread(thread.id) ?? thread;
4336
4338
  }
4337
4339
  async function listLinearIssues(agent, repoPath) {
4338
- const { getAdapter: getAdapter2 } = await import("./agents-B66CNEPB.js");
4340
+ const { getAdapter: getAdapter2 } = await import("./agents-FSUI5MET.js");
4339
4341
  await requireAgent(agent, { requireLinear: true });
4340
4342
  const adapter = getAdapter2(agent);
4341
4343
  if (!adapter.listLinearIssues) {
@@ -4808,7 +4810,7 @@ async function adoptThread(input) {
4808
4810
  messages: input.messages ?? []
4809
4811
  });
4810
4812
  writeThread(thread);
4811
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FUOZIR3V.js");
4813
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4KHEUPEX.js");
4812
4814
  await ensureWorkspace2(repoPath);
4813
4815
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-RXZPTCNH.js");
4814
4816
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6807,11 +6809,15 @@ function formatWorktreeDirective(thread, opts) {
6807
6809
  lines.push("");
6808
6810
  lines.push(formatDevAccessHint(opts?.activeRuns));
6809
6811
  lines.push("");
6812
+ lines.push(
6813
+ "Schedules: `create_schedule` / `list_schedules` (`at` / `every` / `cron`). `threadId=self` continues this chat; omit threadId for a new Global chat. Fires only while Sideboard.app is running. A future job turns on Settings \u2192 Advanced \u2192 Caffeinate while schedules are enabled."
6814
+ );
6815
+ lines.push("");
6810
6816
  lines.push(formatProcessGuideDirective({ worktreePath: thread.worktreePath }));
6811
6817
  return lines.join("\n");
6812
6818
  }
6813
6819
  function formatWorktreeReminder() {
6814
- return "Sideboard worktree: stay in this cwd for all file and git work. Push and open PRs against origin, never upstream. Do not edit the main repo checkout. If a goal is given (Greptile 5/5, CI green), watch-fix-push until it lands \u2014 do not watch after every push.";
6820
+ return "Sideboard worktree: stay in this cwd for all file and git work. Push and open PRs against origin, never upstream. Do not edit the main repo checkout. If a goal is given (Greptile 5/5, CI green), watch-fix-push until it lands \u2014 do not watch after every push. Schedules: create_schedule (at / every / cron; threadId=self for this chat).";
6815
6821
  }
6816
6822
  var PR_GOAL_RE = /greptile|\bci\b.*\b(green|pass)|checks?\s+(pass|green)|until\s+.*\b(pass|green|merge|clean)|\bfix ci\b|watch[- ]fix[- ]push/i;
6817
6823
  function mentionsPrGoal(prompt) {
@@ -7305,7 +7311,7 @@ function resolveScheduleThreadId(raw, env = process.env) {
7305
7311
  const value = raw?.trim() || "";
7306
7312
  if (!value) return null;
7307
7313
  if (value.toLowerCase() === "self") {
7308
- return env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
7314
+ return env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || env.SIDEBOARD_THREAD_ID?.trim() || null;
7309
7315
  }
7310
7316
  return value;
7311
7317
  }
@@ -7442,6 +7448,17 @@ function listSchedules() {
7442
7448
  function hasEnabledSchedules() {
7443
7449
  return listSchedules().some((row) => row.enabled);
7444
7450
  }
7451
+ function scheduleNeedsCaffeinate(task, now = /* @__PURE__ */ new Date()) {
7452
+ if (!task.enabled) return false;
7453
+ const at = new Date(task.nextRunAt);
7454
+ if (Number.isNaN(at.getTime())) return false;
7455
+ return at.getTime() > now.getTime();
7456
+ }
7457
+ function ensureCaffeinateForFutureSchedule(task) {
7458
+ if (!scheduleNeedsCaffeinate(task)) return;
7459
+ if (caffeinateWhileSchedulesEnabled()) return;
7460
+ updateAdvancedSettings({ caffeinateWhileSchedules: true });
7461
+ }
7445
7462
  function getSchedule(id) {
7446
7463
  const key = id.trim();
7447
7464
  if (!key) return null;
@@ -7454,6 +7471,7 @@ function createSchedule(input) {
7454
7471
  const rows = readAll();
7455
7472
  rows.push(task);
7456
7473
  writeAll(rows);
7474
+ ensureCaffeinateForFutureSchedule(task);
7457
7475
  return task;
7458
7476
  }
7459
7477
  function updateSchedule(id, patch) {
@@ -7480,6 +7498,7 @@ function updateSchedule(id, patch) {
7480
7498
  };
7481
7499
  rows[idx] = next;
7482
7500
  writeAll(rows);
7501
+ ensureCaffeinateForFutureSchedule(next);
7483
7502
  return next;
7484
7503
  }
7485
7504
  function deleteSchedule(id) {
@@ -7520,7 +7539,7 @@ function formatScheduledPrompt(name, prompt) {
7520
7539
  ${prompt}`;
7521
7540
  }
7522
7541
  async function defaultDeps() {
7523
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-O3V4UH73.js");
7542
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-LWADJQTN.js");
7524
7543
  const orch = getOrchestrator2();
7525
7544
  return {
7526
7545
  findThread: (id) => findThreadByRef(id),
@@ -7540,19 +7559,9 @@ async function fireSchedule(id) {
7540
7559
  try {
7541
7560
  const deps = fireHooks ?? await defaultDeps();
7542
7561
  const prompt = formatScheduledPrompt(schedule.name, schedule.prompt);
7543
- if (schedule.threadId) {
7544
- const thread = deps.findThread(schedule.threadId);
7545
- if (!thread || thread.status === "archived") {
7546
- return recordScheduleRun(schedule.id, {
7547
- lastError: thread ? `Orchestration chat ${schedule.threadId} is archived` : `Orchestration chat not found: ${schedule.threadId}`
7548
- });
7549
- }
7550
- if (!isOrchestratorThread(thread)) {
7551
- return recordScheduleRun(schedule.id, {
7552
- lastError: `Thread ${schedule.threadId} is not an orchestration chat`
7553
- });
7554
- }
7555
- const sent = await deps.send(thread.id, prompt);
7562
+ const target = schedule.threadId ? deps.findThread(schedule.threadId) : null;
7563
+ if (target && target.status !== "archived") {
7564
+ const sent = await deps.send(target.id, prompt);
7556
7565
  return recordScheduleRun(schedule.id, {
7557
7566
  lastThreadId: sent.id,
7558
7567
  lastError: null
@@ -7563,6 +7572,9 @@ async function fireSchedule(id) {
7563
7572
  agent: pickAgent(schedule),
7564
7573
  model: schedule.model
7565
7574
  });
7575
+ if (schedule.threadId && schedule.when.kind !== "once") {
7576
+ updateSchedule(schedule.id, { threadId: created.id });
7577
+ }
7566
7578
  return recordScheduleRun(schedule.id, {
7567
7579
  lastThreadId: created.id,
7568
7580
  lastError: null
@@ -10085,6 +10097,20 @@ var Orchestrator = class {
10085
10097
  if (!next) throw new Error("Title cannot be empty");
10086
10098
  return updateThread(thread.id, { title: next, userSetTitle: true });
10087
10099
  }
10100
+ async switchThreadBranch(threadRef, branchName) {
10101
+ const thread = this.requireThread(threadRef);
10102
+ this.assertNotGlobal(thread, "Switch branch");
10103
+ if (thread.status === "running") {
10104
+ throw new Error("Stop the agent before switching branches");
10105
+ }
10106
+ await switchWorktreeBranch({
10107
+ repoPath: thread.repoPath,
10108
+ worktreePath: thread.worktreePath,
10109
+ branchName
10110
+ });
10111
+ await syncThreadBranchFromGit(thread.id);
10112
+ return this.requireThread(thread.id);
10113
+ }
10088
10114
  setAttachments(threadRef, attachments) {
10089
10115
  return updateThread(this.requireThread(threadRef).id, { attachments });
10090
10116
  }
@@ -10153,7 +10179,7 @@ var Orchestrator = class {
10153
10179
  this.enforceHistoryRetention();
10154
10180
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
10155
10181
  try {
10156
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-FUOZIR3V.js");
10182
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4KHEUPEX.js");
10157
10183
  await ensureWorkspace2(thread.repoPath);
10158
10184
  } catch {
10159
10185
  }
@@ -10207,7 +10233,7 @@ var Orchestrator = class {
10207
10233
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
10208
10234
  );
10209
10235
  }
10210
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-4DNK2CK6.js");
10236
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-S3FOMEQ2.js");
10211
10237
  const slug = thread.worktreePath.split("/").pop();
10212
10238
  const dest = thread.worktreePath;
10213
10239
  await withRepoGitLock(thread.repoPath, async () => {
@@ -10317,7 +10343,7 @@ async function startOrchestration(opts) {
10317
10343
  sourceRef: "default",
10318
10344
  ...createOpts
10319
10345
  }).catch(async () => {
10320
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-4DNK2CK6.js");
10346
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-S3FOMEQ2.js");
10321
10347
  const repo = await resolveRepoRoot2(repoPath);
10322
10348
  const def = await resolveDefaultBranch2(repo);
10323
10349
  return orch.createThread({
@@ -10381,6 +10407,7 @@ export {
10381
10407
  formatScheduleWhen,
10382
10408
  listSchedules,
10383
10409
  hasEnabledSchedules,
10410
+ scheduleNeedsCaffeinate,
10384
10411
  getSchedule,
10385
10412
  createSchedule,
10386
10413
  updateSchedule,
@@ -9,8 +9,8 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-6IP4FWMK.js";
13
- import "./chunk-PV4KCI2S.js";
12
+ } from "./chunk-PJK24CN3.js";
13
+ import "./chunk-HCNCZPDL.js";
14
14
  import "./chunk-D6JWYJ4P.js";
15
15
  import "./chunk-RJC2MKXN.js";
16
16
  import "./chunk-H547WSSZ.js";
@@ -7,8 +7,8 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-SJ3IUYG2.js";
11
- import "./chunk-NYXDZCMP.js";
10
+ } from "./chunk-BYRZS2S2.js";
11
+ import "./chunk-63YSFXLT.js";
12
12
  import "./chunk-6K64FJDD.js";
13
13
  import "./chunk-2P4XKWV2.js";
14
14
  import "./chunk-KJM3E3NF.js";
@@ -15,8 +15,8 @@ import {
15
15
  orchestratorSessionPoisonedByBuiltins,
16
16
  slackCoordinatorSourceRef,
17
17
  takenTeamSlugsForOrchestration
18
- } from "./chunk-SJ3IUYG2.js";
19
- import "./chunk-NYXDZCMP.js";
18
+ } from "./chunk-BYRZS2S2.js";
19
+ import "./chunk-63YSFXLT.js";
20
20
  import "./chunk-6K64FJDD.js";
21
21
  import "./chunk-2P4XKWV2.js";
22
22
  import "./chunk-KJM3E3NF.js";
@@ -17,8 +17,8 @@ import {
17
17
  orchestratorSessionPoisonedByBuiltins,
18
18
  slackCoordinatorSourceRef,
19
19
  takenTeamSlugsForOrchestration
20
- } from "./chunk-6IP4FWMK.js";
21
- import "./chunk-PV4KCI2S.js";
20
+ } from "./chunk-PJK24CN3.js";
21
+ import "./chunk-HCNCZPDL.js";
22
22
  import "./chunk-D6JWYJ4P.js";
23
23
  import "./chunk-RJC2MKXN.js";
24
24
  import "./chunk-H547WSSZ.js";