@sideboard-ai/core 0.1.292 → 0.1.293

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 (33) hide show
  1. package/dist/agents/cursor-runner.cjs +329 -36
  2. package/dist/agents/cursor-runner.js +318 -17
  3. package/dist/{agents-4BBCKITL.js → agents-SITR5V6F.js} +3 -3
  4. package/dist/{agents-XAKSP653.js → agents-WT72O5A3.js} +3 -3
  5. package/dist/{chunk-2IXKTAIT.js → chunk-2VGLZIU6.js} +37 -13
  6. package/dist/{chunk-GBAACE3C.js → chunk-4YXXLWDI.js} +3 -3
  7. package/dist/{chunk-4VXWLY3L.js → chunk-IP5WSADC.js} +9 -9
  8. package/dist/{chunk-QOUTSISS.js → chunk-LSHGJI4S.js} +10 -10
  9. package/dist/{chunk-O4324MXE.js → chunk-PO3PDNMV.js} +1 -1
  10. package/dist/{chunk-LUQ7MIVD.js → chunk-RPCKGO3J.js} +3 -3
  11. package/dist/{chunk-5HPMKLJ7.js → chunk-UO5C2L2G.js} +37 -13
  12. package/dist/{chunk-G74TSBJ3.js → chunk-WRDKJRWF.js} +3 -3
  13. package/dist/{chunk-VNCPRMIK.js → chunk-XZW3BXZW.js} +3 -3
  14. package/dist/{chunk-V3BSO2O6.js → chunk-ZRQWV3MS.js} +1 -1
  15. package/dist/{conductor-UFJXJPTF.js → conductor-MAYZSFL6.js} +3 -3
  16. package/dist/{conductor-5MNGC25D.js → conductor-P7XPGYF4.js} +3 -3
  17. package/dist/{coordinator-prompt-5Q66Y5KW.js → coordinator-prompt-NAM5JHLT.js} +2 -2
  18. package/dist/{coordinator-prompt-BYPEW6DE.js → coordinator-prompt-OZFKNCM3.js} +2 -2
  19. package/dist/{global-workspace-BTH2YGDZ.js → global-workspace-CTFQDG7G.js} +2 -2
  20. package/dist/{global-workspace-YKOYXSB2.js → global-workspace-UGR6FQXI.js} +2 -2
  21. package/dist/index.cjs +47 -13
  22. package/dist/index.d.cts +10 -4
  23. package/dist/index.d.ts +10 -4
  24. package/dist/index.js +17 -7
  25. package/dist/mcp/run-stdio.cjs +37 -13
  26. package/dist/mcp/run-stdio.js +5 -5
  27. package/dist/{orchestrator-EQSK2RMI.js → orchestrator-4QVF6CE2.js} +5 -5
  28. package/dist/{orchestrator-GSOW3RPA.js → orchestrator-BOGVTCWI.js} +5 -5
  29. package/dist/{workspaces-ELO2YVTU.js → workspaces-QNKFBA63.js} +2 -2
  30. package/dist/{workspaces-RFD6I4FM.js → workspaces-YNZXVBSF.js} +2 -2
  31. package/dist/{worktree-ADVQ6X6C.js → worktree-EMCWDPZJ.js} +1 -1
  32. package/dist/{worktree-TN7DZDJZ.js → worktree-ERRH4TAG.js} +1 -1
  33. package/package.json +1 -1
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-VNCPRMIK.js";
17
+ } from "./chunk-XZW3BXZW.js";
18
18
  import {
19
19
  REVIEW_TAB_TITLE,
20
20
  applyWorktreePkgCacheEnv,
@@ -53,7 +53,7 @@ import {
53
53
  worktreeDevProcessKey,
54
54
  worktreeRunProcessKey,
55
55
  worktreeSetupProcessKey
56
- } from "./chunk-GBAACE3C.js";
56
+ } from "./chunk-4YXXLWDI.js";
57
57
  import {
58
58
  applyAgentEvent,
59
59
  clipAgentEventForPaint,
@@ -100,7 +100,7 @@ import {
100
100
  stageAbsolutePathsAsAttachments,
101
101
  stageBuffersAsAttachments,
102
102
  syncWorkspacesFromThreads
103
- } from "./chunk-V3BSO2O6.js";
103
+ } from "./chunk-ZRQWV3MS.js";
104
104
  import {
105
105
  addPrStackLayer,
106
106
  allocateTeamSlug,
@@ -142,7 +142,7 @@ import {
142
142
  resolveRepoRoot,
143
143
  switchWorktreeBranch,
144
144
  withRepoGitLock
145
- } from "./chunk-2IXKTAIT.js";
145
+ } from "./chunk-2VGLZIU6.js";
146
146
  import {
147
147
  agentNicknameFromWorktreePath,
148
148
  appendMessage,
@@ -451,9 +451,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
451
451
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
452
452
  );
453
453
  }
454
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-YKOYXSB2.js");
454
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-UGR6FQXI.js");
455
455
  if (isGlobalThread2(thread)) {
456
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-5Q66Y5KW.js");
456
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-NAM5JHLT.js");
457
457
  ensureGlobalCoordinatorCwd2(
458
458
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
459
459
  );
@@ -2740,7 +2740,7 @@ async function createThread(input, _onSetupLine) {
2740
2740
  return readThread(thread.id) ?? thread;
2741
2741
  }
2742
2742
  async function listLinearIssues(agent, repoPath) {
2743
- const { getAdapter: getAdapter2 } = await import("./agents-4BBCKITL.js");
2743
+ const { getAdapter: getAdapter2 } = await import("./agents-SITR5V6F.js");
2744
2744
  await requireAgent(agent, { requireLinear: true });
2745
2745
  const adapter = getAdapter2(agent);
2746
2746
  if (!adapter.listLinearIssues) {
@@ -3251,7 +3251,7 @@ async function adoptThread(input) {
3251
3251
  messages: input.messages ?? []
3252
3252
  });
3253
3253
  writeThread(thread);
3254
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-RFD6I4FM.js");
3254
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-YNZXVBSF.js");
3255
3255
  await addWorkspace2(repoPath);
3256
3256
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-RXZPTCNH.js");
3257
3257
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -6170,7 +6170,7 @@ function formatScheduledPrompt(name, prompt) {
6170
6170
  ${prompt}`;
6171
6171
  }
6172
6172
  async function defaultDeps() {
6173
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-GSOW3RPA.js");
6173
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-BOGVTCWI.js");
6174
6174
  const orch = getOrchestrator2();
6175
6175
  return {
6176
6176
  findThread: (id) => findThreadByRef(id),
@@ -9042,7 +9042,7 @@ async function startOrchestration(opts) {
9042
9042
  sourceRef: "default",
9043
9043
  ...createOpts
9044
9044
  }).catch(async () => {
9045
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-TN7DZDJZ.js");
9045
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ERRH4TAG.js");
9046
9046
  const repo = await resolveRepoRoot2(repoPath);
9047
9047
  const def = await resolveDefaultBranch2(repo);
9048
9048
  return orch.createThread({
@@ -5,7 +5,7 @@ import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveGithubRepoSlug,
7
7
  resolveRepoRoot
8
- } from "./chunk-5HPMKLJ7.js";
8
+ } from "./chunk-UO5C2L2G.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -24,13 +24,13 @@ import {
24
24
  } from "./chunk-AFLNFGGB.js";
25
25
  import {
26
26
  isOrchestratorThread
27
- } from "./chunk-O4324MXE.js";
27
+ } from "./chunk-PO3PDNMV.js";
28
28
  import {
29
29
  codexUnattendedGitConfigArgs,
30
30
  mergeAgentGitAuthEnv,
31
31
  resolveAgentGitAuthEnv,
32
32
  resolveCodexGitWritableRoots
33
- } from "./chunk-5HPMKLJ7.js";
33
+ } from "./chunk-UO5C2L2G.js";
34
34
  import {
35
35
  npmGlobalNodeModules,
36
36
  run
@@ -2015,7 +2015,7 @@ var claudeAdapter = {
2015
2015
  );
2016
2016
  }
2017
2017
  const mode = permissionMode(thread);
2018
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-BTH2YGDZ.js");
2018
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-CTFQDG7G.js");
2019
2019
  const isOrchestrator = isOrchestratorThread2(thread);
2020
2020
  const rpc = worktreeAgentRpc(isOrchestrator);
2021
2021
  const injectedServers = await buildInjectedMcpServers({
@@ -1984,15 +1984,8 @@ async function fetchOriginForWorktree(repoPath, sourceRef, opts) {
1984
1984
  async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
1985
1985
  try {
1986
1986
  const branch = opts?.branch?.trim() || await resolveDefaultBranch(repoPath, { network: false });
1987
- const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], repoPath, {
1988
- reject: false
1989
- });
1990
- const current = head.stdout.trim();
1991
- if (head.exitCode !== 0 || !current || current === "HEAD" || current !== branch) {
1992
- return { updated: false, reason: "not-on-default" };
1993
- }
1994
- if (await isDirty(repoPath)) {
1995
- return { updated: false, reason: "dirty" };
1987
+ if (!branch || branch === "HEAD" || branch.includes("..")) {
1988
+ return { updated: false, reason: "ff-failed" };
1996
1989
  }
1997
1990
  const remote = `origin/${branch}`;
1998
1991
  const remoteOk = await git(["rev-parse", "--verify", remote], repoPath, {
@@ -2001,8 +1994,27 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
2001
1994
  if (remoteOk.exitCode !== 0) {
2002
1995
  return { updated: false, reason: "no-origin-tip" };
2003
1996
  }
1997
+ const worktrees = await listWorktrees(repoPath);
1998
+ if (worktrees.length === 0) {
1999
+ return { updated: false, reason: "ff-failed" };
2000
+ }
2001
+ const checkout = worktrees.find((entry) => entry.branch === branch) ?? null;
2002
+ const localRef = `refs/heads/${branch}`;
2003
+ const localOk = await git(["rev-parse", "--verify", localRef], repoPath, {
2004
+ reject: false
2005
+ });
2006
+ if (localOk.exitCode !== 0) {
2007
+ if (checkout) return { updated: false, reason: "ff-failed" };
2008
+ const created = await git(["branch", "--track", branch, remote], repoPath, {
2009
+ reject: false
2010
+ });
2011
+ if (created.exitCode !== 0) {
2012
+ return { updated: false, reason: "ff-failed" };
2013
+ }
2014
+ return { updated: true, reason: "updated" };
2015
+ }
2004
2016
  const ancestor = await git(
2005
- ["merge-base", "--is-ancestor", "HEAD", remote],
2017
+ ["merge-base", "--is-ancestor", localRef, remote],
2006
2018
  repoPath,
2007
2019
  { reject: false }
2008
2020
  );
@@ -2010,7 +2022,7 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
2010
2022
  return { updated: false, reason: "diverged" };
2011
2023
  }
2012
2024
  const behind = await git(
2013
- ["rev-list", "--count", `HEAD..${remote}`],
2025
+ ["rev-list", "--count", `${localRef}..${remote}`],
2014
2026
  repoPath,
2015
2027
  { reject: false }
2016
2028
  );
@@ -2018,10 +2030,22 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
2018
2030
  if (behind.exitCode !== 0 || !Number.isFinite(n) || n <= 0) {
2019
2031
  return { updated: false, reason: "already-current" };
2020
2032
  }
2021
- const ff = await git(["merge", "--ff-only", remote], repoPath, {
2033
+ if (checkout) {
2034
+ if (await isDirty(checkout.path)) {
2035
+ return { updated: false, reason: "dirty" };
2036
+ }
2037
+ const ff = await git(["merge", "--ff-only", remote], checkout.path, {
2038
+ reject: false
2039
+ });
2040
+ if (ff.exitCode !== 0) {
2041
+ return { updated: false, reason: "ff-failed" };
2042
+ }
2043
+ return { updated: true, reason: "updated" };
2044
+ }
2045
+ const moved = await git(["branch", "-f", branch, remote], repoPath, {
2022
2046
  reject: false
2023
2047
  });
2024
- if (ff.exitCode !== 0) {
2048
+ if (moved.exitCode !== 0) {
2025
2049
  return { updated: false, reason: "ff-failed" };
2026
2050
  }
2027
2051
  return { updated: true, reason: "updated" };
@@ -11,11 +11,11 @@ import {
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-O4324MXE.js";
14
+ } from "./chunk-PO3PDNMV.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
18
- } from "./chunk-5HPMKLJ7.js";
18
+ } from "./chunk-UO5C2L2G.js";
19
19
  import {
20
20
  ATTACHMENTS_DIR,
21
21
  DETACHED_JOBS_DIR,
@@ -1674,7 +1674,7 @@ var PORT_RANGE_SIZE = 10;
1674
1674
  var RECLAIM_RETRY_DELAY_MS = 40;
1675
1675
  var RECLAIM_TRIES = 8;
1676
1676
  async function killReclaimable(ports, worktreePath, signal) {
1677
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-5MNGC25D.js");
1677
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-P7XPGYF4.js");
1678
1678
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1679
1679
  else killListenersOnPorts2(ports);
1680
1680
  }
@@ -12,13 +12,13 @@ import {
12
12
  } from "./chunk-YSLCWCMJ.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-V3BSO2O6.js";
15
+ } from "./chunk-ZRQWV3MS.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
19
19
  resolveAgentGitAuthEnv,
20
20
  resolveCodexGitWritableRoots
21
- } from "./chunk-2IXKTAIT.js";
21
+ } from "./chunk-2VGLZIU6.js";
22
22
  import {
23
23
  loadBrightsyConfig
24
24
  } from "./chunk-33KDPEK4.js";
@@ -1752,7 +1752,7 @@ var claudeAdapter = {
1752
1752
  );
1753
1753
  }
1754
1754
  const mode = permissionMode(thread);
1755
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-YKOYXSB2.js");
1755
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-UGR6FQXI.js");
1756
1756
  const isOrchestrator = isOrchestratorThread2(thread);
1757
1757
  const rpc = worktreeAgentRpc(isOrchestrator);
1758
1758
  const injectedServers = await buildInjectedMcpServers({
@@ -3,7 +3,7 @@ import {
3
3
  ensureGhPreferOrigin,
4
4
  resolveGithubRepoSlug,
5
5
  resolveRepoRoot
6
- } from "./chunk-2IXKTAIT.js";
6
+ } from "./chunk-2VGLZIU6.js";
7
7
  import {
8
8
  allocateTeamName,
9
9
  createEmptyThread,
@@ -31,10 +31,10 @@ import {
31
31
  tryReservePort,
32
32
  tryReservePorts,
33
33
  worktreeRunPortsPath
34
- } from "./chunk-GBAACE3C.js";
34
+ } from "./chunk-4YXXLWDI.js";
35
35
  import "./chunk-YSLCWCMJ.js";
36
- import "./chunk-V3BSO2O6.js";
37
- import "./chunk-2IXKTAIT.js";
36
+ import "./chunk-ZRQWV3MS.js";
37
+ import "./chunk-2VGLZIU6.js";
38
38
  import "./chunk-QB5MDOHL.js";
39
39
  import "./chunk-2P4XKWV2.js";
40
40
  import "./chunk-MIVX7QKI.js";
@@ -33,10 +33,10 @@ import {
33
33
  tryReservePort,
34
34
  tryReservePorts,
35
35
  worktreeRunPortsPath
36
- } from "./chunk-G74TSBJ3.js";
36
+ } from "./chunk-WRDKJRWF.js";
37
37
  import "./chunk-AFLNFGGB.js";
38
- import "./chunk-O4324MXE.js";
39
- import "./chunk-5HPMKLJ7.js";
38
+ import "./chunk-PO3PDNMV.js";
39
+ import "./chunk-UO5C2L2G.js";
40
40
  import "./chunk-N2WW62LF.js";
41
41
  import "./chunk-DD67JWTN.js";
42
42
  import "./chunk-2UG25RMK.js";
@@ -7,8 +7,8 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-V3BSO2O6.js";
11
- import "./chunk-2IXKTAIT.js";
10
+ } from "./chunk-ZRQWV3MS.js";
11
+ import "./chunk-2VGLZIU6.js";
12
12
  import "./chunk-QB5MDOHL.js";
13
13
  import "./chunk-2P4XKWV2.js";
14
14
  import "./chunk-6K64FJDD.js";
@@ -9,8 +9,8 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-O4324MXE.js";
13
- import "./chunk-5HPMKLJ7.js";
12
+ } from "./chunk-PO3PDNMV.js";
13
+ import "./chunk-UO5C2L2G.js";
14
14
  import "./chunk-N2WW62LF.js";
15
15
  import "./chunk-DD67JWTN.js";
16
16
  import "./chunk-2UG25RMK.js";
@@ -20,8 +20,8 @@ import {
20
20
  remoteCoordinatorSourceRef,
21
21
  slackCoordinatorSourceRef,
22
22
  takenTeamSlugsForOrchestration
23
- } from "./chunk-O4324MXE.js";
24
- import "./chunk-5HPMKLJ7.js";
23
+ } from "./chunk-PO3PDNMV.js";
24
+ import "./chunk-UO5C2L2G.js";
25
25
  import "./chunk-N2WW62LF.js";
26
26
  import "./chunk-DD67JWTN.js";
27
27
  import "./chunk-2UG25RMK.js";
@@ -18,8 +18,8 @@ import {
18
18
  remoteCoordinatorSourceRef,
19
19
  slackCoordinatorSourceRef,
20
20
  takenTeamSlugsForOrchestration
21
- } from "./chunk-V3BSO2O6.js";
22
- import "./chunk-2IXKTAIT.js";
21
+ } from "./chunk-ZRQWV3MS.js";
22
+ import "./chunk-2VGLZIU6.js";
23
23
  import "./chunk-QB5MDOHL.js";
24
24
  import "./chunk-2P4XKWV2.js";
25
25
  import "./chunk-6K64FJDD.js";
package/dist/index.cjs CHANGED
@@ -10260,15 +10260,8 @@ async function fetchOriginForWorktree(repoPath, sourceRef, opts) {
10260
10260
  async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10261
10261
  try {
10262
10262
  const branch = opts?.branch?.trim() || await resolveDefaultBranch(repoPath, { network: false });
10263
- const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], repoPath, {
10264
- reject: false
10265
- });
10266
- const current = head.stdout.trim();
10267
- if (head.exitCode !== 0 || !current || current === "HEAD" || current !== branch) {
10268
- return { updated: false, reason: "not-on-default" };
10269
- }
10270
- if (await isDirty(repoPath)) {
10271
- return { updated: false, reason: "dirty" };
10263
+ if (!branch || branch === "HEAD" || branch.includes("..")) {
10264
+ return { updated: false, reason: "ff-failed" };
10272
10265
  }
10273
10266
  const remote = `origin/${branch}`;
10274
10267
  const remoteOk = await git(["rev-parse", "--verify", remote], repoPath, {
@@ -10277,8 +10270,27 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10277
10270
  if (remoteOk.exitCode !== 0) {
10278
10271
  return { updated: false, reason: "no-origin-tip" };
10279
10272
  }
10273
+ const worktrees = await listWorktrees(repoPath);
10274
+ if (worktrees.length === 0) {
10275
+ return { updated: false, reason: "ff-failed" };
10276
+ }
10277
+ const checkout = worktrees.find((entry) => entry.branch === branch) ?? null;
10278
+ const localRef = `refs/heads/${branch}`;
10279
+ const localOk = await git(["rev-parse", "--verify", localRef], repoPath, {
10280
+ reject: false
10281
+ });
10282
+ if (localOk.exitCode !== 0) {
10283
+ if (checkout) return { updated: false, reason: "ff-failed" };
10284
+ const created = await git(["branch", "--track", branch, remote], repoPath, {
10285
+ reject: false
10286
+ });
10287
+ if (created.exitCode !== 0) {
10288
+ return { updated: false, reason: "ff-failed" };
10289
+ }
10290
+ return { updated: true, reason: "updated" };
10291
+ }
10280
10292
  const ancestor = await git(
10281
- ["merge-base", "--is-ancestor", "HEAD", remote],
10293
+ ["merge-base", "--is-ancestor", localRef, remote],
10282
10294
  repoPath,
10283
10295
  { reject: false }
10284
10296
  );
@@ -10286,7 +10298,7 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10286
10298
  return { updated: false, reason: "diverged" };
10287
10299
  }
10288
10300
  const behind = await git(
10289
- ["rev-list", "--count", `HEAD..${remote}`],
10301
+ ["rev-list", "--count", `${localRef}..${remote}`],
10290
10302
  repoPath,
10291
10303
  { reject: false }
10292
10304
  );
@@ -10294,10 +10306,22 @@ async function fastForwardMainCheckoutIfSafe(repoPath, opts) {
10294
10306
  if (behind.exitCode !== 0 || !Number.isFinite(n) || n <= 0) {
10295
10307
  return { updated: false, reason: "already-current" };
10296
10308
  }
10297
- const ff = await git(["merge", "--ff-only", remote], repoPath, {
10309
+ if (checkout) {
10310
+ if (await isDirty(checkout.path)) {
10311
+ return { updated: false, reason: "dirty" };
10312
+ }
10313
+ const ff = await git(["merge", "--ff-only", remote], checkout.path, {
10314
+ reject: false
10315
+ });
10316
+ if (ff.exitCode !== 0) {
10317
+ return { updated: false, reason: "ff-failed" };
10318
+ }
10319
+ return { updated: true, reason: "updated" };
10320
+ }
10321
+ const moved = await git(["branch", "-f", branch, remote], repoPath, {
10298
10322
  reject: false
10299
10323
  });
10300
- if (ff.exitCode !== 0) {
10324
+ if (moved.exitCode !== 0) {
10301
10325
  return { updated: false, reason: "ff-failed" };
10302
10326
  }
10303
10327
  return { updated: true, reason: "updated" };
@@ -40667,6 +40691,7 @@ function refreshPhoneViewerLogin(force = false) {
40667
40691
  }
40668
40692
 
40669
40693
  // src/remote/phone-transcript.ts
40694
+ init_wait_for_job();
40670
40695
  init_turn_live();
40671
40696
 
40672
40697
  // src/remote/phone-stream.ts
@@ -40691,6 +40716,11 @@ function phoneStreamFlushNow(event) {
40691
40716
  var PHONE_USER_PREFIX = "Phone\n\n";
40692
40717
  var TRANSCRIPT_LIMIT = 40;
40693
40718
  var MESSAGE_LIMIT = 4e3;
40719
+ var CRASH_CONTINUE_PREFIX = "The previous agent process ended before it finished.";
40720
+ function isHostContinuePrompt(text7) {
40721
+ const trimmed = text7.trim();
40722
+ return isJobContinuePrompt(trimmed) || trimmed.startsWith(CRASH_CONTINUE_PREFIX);
40723
+ }
40694
40724
  function phoneVisibleText(role, text7) {
40695
40725
  const trimmed = text7.trim();
40696
40726
  if (role === "user" && trimmed.startsWith(PHONE_USER_PREFIX)) {
@@ -40716,6 +40746,9 @@ function listPhoneMessages(thread) {
40716
40746
  const out = [];
40717
40747
  for (const message of thread.messages) {
40718
40748
  if (message.role !== "user" && message.role !== "agent") continue;
40749
+ if (message.origin === "continue" || message.role === "user" && isHostContinuePrompt(message.text)) {
40750
+ continue;
40751
+ }
40719
40752
  const names = (message.attachments ?? []).map((item) => item.name.trim()).filter(Boolean);
40720
40753
  const visible = [phoneVisibleText(message.role, message.text), names.length ? names.join(", ") : ""].filter(Boolean).join("\n");
40721
40754
  const text7 = message.role === "agent" ? phoneArtifactText(visible, message.parts, MESSAGE_LIMIT) : clip(visible, MESSAGE_LIMIT);
@@ -40724,6 +40757,7 @@ function listPhoneMessages(thread) {
40724
40757
  }
40725
40758
  const live = withLiveTail(thread, out);
40726
40759
  for (const prompt of thread.queue) {
40760
+ if (isHostContinuePrompt(prompt)) continue;
40727
40761
  const text7 = clip(phoneVisibleText("user", prompt), MESSAGE_LIMIT);
40728
40762
  if (text7) live.push({ role: "user", text: text7 });
40729
40763
  }
package/dist/index.d.cts CHANGED
@@ -2396,12 +2396,18 @@ declare function fetchOriginForWorktree(repoPath: string, sourceRef: string, opt
2396
2396
  }): Promise<boolean>;
2397
2397
  type FastForwardMainResult = {
2398
2398
  updated: boolean;
2399
- reason: 'updated' | 'already-current' | 'not-on-default' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2399
+ reason: 'updated' | 'already-current' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2400
2400
  };
2401
2401
  /**
2402
- * Fast-forward the project-folder checkout to `origin/<default>` when that is
2403
- * safe: already on the default branch, clean, and a strict ancestor of the
2404
- * remote tip. Never checkout, reset, or merge if it would not fast-forward.
2402
+ * Fast-forward the local default branch to `origin/<default>` when that is a
2403
+ * strict fast-forward.
2404
+ *
2405
+ * Sidecar worktrees do the work, so the project folder is often on some other
2406
+ * branch and `refs/heads/<default>` would otherwise stay stale after every
2407
+ * fetch. When that branch is not checked out anywhere, move the ref only
2408
+ * (`git branch -f`). When it is checked out and that worktree is clean,
2409
+ * `git merge --ff-only` updates the working tree too. Never checkout, reset,
2410
+ * or move a diverged or dirty branch.
2405
2411
  */
2406
2412
  declare function fastForwardMainCheckoutIfSafe(repoPath: string, opts?: {
2407
2413
  branch?: string;
package/dist/index.d.ts CHANGED
@@ -2396,12 +2396,18 @@ declare function fetchOriginForWorktree(repoPath: string, sourceRef: string, opt
2396
2396
  }): Promise<boolean>;
2397
2397
  type FastForwardMainResult = {
2398
2398
  updated: boolean;
2399
- reason: 'updated' | 'already-current' | 'not-on-default' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2399
+ reason: 'updated' | 'already-current' | 'dirty' | 'diverged' | 'no-origin-tip' | 'ff-failed';
2400
2400
  };
2401
2401
  /**
2402
- * Fast-forward the project-folder checkout to `origin/<default>` when that is
2403
- * safe: already on the default branch, clean, and a strict ancestor of the
2404
- * remote tip. Never checkout, reset, or merge if it would not fast-forward.
2402
+ * Fast-forward the local default branch to `origin/<default>` when that is a
2403
+ * strict fast-forward.
2404
+ *
2405
+ * Sidecar worktrees do the work, so the project folder is often on some other
2406
+ * branch and `refs/heads/<default>` would otherwise stay stale after every
2407
+ * fetch. When that branch is not checked out anywhere, move the ref only
2408
+ * (`git branch -f`). When it is checked out and that worktree is clean,
2409
+ * `git merge --ff-only` updates the working tree too. Never checkout, reset,
2410
+ * or move a diverged or dirty branch.
2405
2411
  */
2406
2412
  declare function fastForwardMainCheckoutIfSafe(repoPath: string, opts?: {
2407
2413
  branch?: string;
package/dist/index.js CHANGED
@@ -186,7 +186,7 @@ import {
186
186
  worktreeBoardStatus,
187
187
  worktreeCleanupSettings,
188
188
  writeWorktreeFile
189
- } from "./chunk-QOUTSISS.js";
189
+ } from "./chunk-LSHGJI4S.js";
190
190
  import {
191
191
  LEGACY_PLAN_FILE_REL,
192
192
  PLAN_FILE_NAME,
@@ -281,7 +281,7 @@ import {
281
281
  userMcpNamesToDisable,
282
282
  worktreeMcpToolNames,
283
283
  writeInjectedMcpConfig
284
- } from "./chunk-VNCPRMIK.js";
284
+ } from "./chunk-XZW3BXZW.js";
285
285
  import {
286
286
  brightsyMcpServerName,
287
287
  connectBrightsyTeam,
@@ -356,6 +356,7 @@ import {
356
356
  getRunScript,
357
357
  isAskUserToolName,
358
358
  isIncompleteTaskState,
359
+ isJobContinuePrompt,
359
360
  isOtherWorktreeListenerCwd,
360
361
  isPlanQuestionAnswersMessage,
361
362
  isTerminalTaskState,
@@ -408,7 +409,7 @@ import {
408
409
  workspaceAgentChatSummaries,
409
410
  worktreeRunPortsPath,
410
411
  wrapReviewSkillMarkdown
411
- } from "./chunk-GBAACE3C.js";
412
+ } from "./chunk-4YXXLWDI.js";
412
413
  import {
413
414
  STDERR_EVENT_MAX_CHARS,
414
415
  STDOUT_EVENT_MAX_CHARS,
@@ -608,7 +609,7 @@ import {
608
609
  stageBuffersAsAttachments,
609
610
  syncWorkspacesFromThreads,
610
611
  takenTeamSlugsForOrchestration
611
- } from "./chunk-V3BSO2O6.js";
612
+ } from "./chunk-ZRQWV3MS.js";
612
613
  import {
613
614
  GITHUB_PR_BODY_MAX_CHARS,
614
615
  GITHUB_PR_BODY_SAFE_CHARS,
@@ -696,7 +697,7 @@ import {
696
697
  suggestSlug,
697
698
  switchWorktreeBranch,
698
699
  warmGithubAgentAuth
699
- } from "./chunk-2IXKTAIT.js";
700
+ } from "./chunk-2VGLZIU6.js";
700
701
  import {
701
702
  FAMOUS_SOCCER_TEAMS,
702
703
  allocateTeamName,
@@ -5126,7 +5127,7 @@ async function handleJobStop(params, _ctx) {
5126
5127
  return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
5127
5128
  }
5128
5129
  async function defaultTurnWait(ref, timeoutMs) {
5129
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-GSOW3RPA.js");
5130
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-BOGVTCWI.js");
5130
5131
  const orch = getOrchestrator2();
5131
5132
  const thread = await orch.waitForTurn(ref, timeoutMs, {
5132
5133
  resolveIfStillRunning: true
@@ -9939,6 +9940,11 @@ function phoneStreamFlushNow(event) {
9939
9940
  var PHONE_USER_PREFIX = "Phone\n\n";
9940
9941
  var TRANSCRIPT_LIMIT = 40;
9941
9942
  var MESSAGE_LIMIT = 4e3;
9943
+ var CRASH_CONTINUE_PREFIX = "The previous agent process ended before it finished.";
9944
+ function isHostContinuePrompt(text5) {
9945
+ const trimmed = text5.trim();
9946
+ return isJobContinuePrompt(trimmed) || trimmed.startsWith(CRASH_CONTINUE_PREFIX);
9947
+ }
9942
9948
  function phoneVisibleText(role, text5) {
9943
9949
  const trimmed = text5.trim();
9944
9950
  if (role === "user" && trimmed.startsWith(PHONE_USER_PREFIX)) {
@@ -9964,6 +9970,9 @@ function listPhoneMessages(thread) {
9964
9970
  const out = [];
9965
9971
  for (const message of thread.messages) {
9966
9972
  if (message.role !== "user" && message.role !== "agent") continue;
9973
+ if (message.origin === "continue" || message.role === "user" && isHostContinuePrompt(message.text)) {
9974
+ continue;
9975
+ }
9967
9976
  const names = (message.attachments ?? []).map((item) => item.name.trim()).filter(Boolean);
9968
9977
  const visible = [phoneVisibleText(message.role, message.text), names.length ? names.join(", ") : ""].filter(Boolean).join("\n");
9969
9978
  const text5 = message.role === "agent" ? phoneArtifactText(visible, message.parts, MESSAGE_LIMIT) : clip(visible, MESSAGE_LIMIT);
@@ -9972,6 +9981,7 @@ function listPhoneMessages(thread) {
9972
9981
  }
9973
9982
  const live = withLiveTail(thread, out);
9974
9983
  for (const prompt of thread.queue) {
9984
+ if (isHostContinuePrompt(prompt)) continue;
9975
9985
  const text5 = clip(phoneVisibleText("user", prompt), MESSAGE_LIMIT);
9976
9986
  if (text5) live.push({ role: "user", text: text5 });
9977
9987
  }
@@ -13230,7 +13240,7 @@ async function continueSourceThread(threadId, prompt) {
13230
13240
  await continueOnReply(threadId, prompt);
13231
13241
  return;
13232
13242
  }
13233
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-GSOW3RPA.js");
13243
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-BOGVTCWI.js");
13234
13244
  await getOrchestrator2().send(threadId, prompt);
13235
13245
  } catch {
13236
13246
  }