@sideboard-ai/core 0.1.116 → 0.1.117

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 (42) hide show
  1. package/dist/agents/cursor-runner.cjs +74 -59
  2. package/dist/agents/cursor-runner.js +10 -9
  3. package/dist/{agents-7NIX44RB.js → agents-GUEKGV7V.js} +6 -6
  4. package/dist/{agents-DU7DHY7A.js → agents-OCGAZCKT.js} +5 -5
  5. package/dist/{chunk-OFF5AFCR.js → chunk-4CDCTYTM.js} +5 -4
  6. package/dist/{chunk-XOYQ7LNQ.js → chunk-4NAW5BAQ.js} +3 -3
  7. package/dist/{chunk-4OJMZ6P2.js → chunk-4WV7C7WP.js} +3 -3
  8. package/dist/{chunk-DWP25N32.js → chunk-5X7GRP5W.js} +44 -20
  9. package/dist/{chunk-4HOFVKPC.js → chunk-74YJHND6.js} +43 -19
  10. package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
  11. package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
  12. package/dist/{chunk-GBY7OOMB.js → chunk-NZBDVBCP.js} +1 -1
  13. package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
  14. package/dist/{chunk-K3TIQXOH.js → chunk-U3IVCVLH.js} +2 -2
  15. package/dist/{chunk-FZCIQYNQ.js → chunk-VGPLXQIH.js} +1 -1
  16. package/dist/chunk-VHX673DI.js +32 -0
  17. package/dist/{chunk-ZMROW673.js → chunk-WCU3FHEI.js} +1 -1
  18. package/dist/{chunk-7WC5UWEB.js → chunk-X3NIPGQT.js} +1 -1
  19. package/dist/{chunk-ZYEFCSZJ.js → chunk-XTZQL7OU.js} +1 -1
  20. package/dist/{chunk-5KSLD4MU.js → chunk-YJ2WV5TZ.js} +5 -4
  21. package/dist/{coordinator-prompt-4KCALEKD.js → coordinator-prompt-QMV6YEP5.js} +3 -3
  22. package/dist/{coordinator-prompt-FML4I5AR.js → coordinator-prompt-XCBHAOGE.js} +3 -3
  23. package/dist/cursor-recover-NOQYOFRF.js +76 -0
  24. package/dist/{cursor-recover-JBTIDARH.js → cursor-recover-QSLWEZNA.js} +12 -7
  25. package/dist/{global-workspace-CSWABOG5.js → global-workspace-SBKXKQFS.js} +4 -4
  26. package/dist/{global-workspace-H4YNASM6.js → global-workspace-Z37MNYU6.js} +4 -4
  27. package/dist/index.cjs +301 -227
  28. package/dist/index.d.cts +7 -1
  29. package/dist/index.d.ts +7 -1
  30. package/dist/index.js +10 -8
  31. package/dist/mcp/run-stdio.cjs +296 -224
  32. package/dist/mcp/run-stdio.js +7 -7
  33. package/dist/{orchestrator-NXPANCZA.js → orchestrator-4PKR6AZJ.js} +7 -7
  34. package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-MKTZYWTI.js} +8 -8
  35. package/dist/{thread-store-OEALWU7Y.js → thread-store-JR235AWK.js} +3 -1
  36. package/dist/{thread-store-LPTBVW5C.js → thread-store-PMH3BMB6.js} +3 -1
  37. package/dist/{workspaces-HJ3EVATC.js → workspaces-C3TJJFY3.js} +5 -5
  38. package/dist/{workspaces-QG6PGFQR.js → workspaces-M4OICPWF.js} +5 -5
  39. package/dist/{worktree-IW3BX26B.js → worktree-7AEKZSEX.js} +2 -2
  40. package/dist/{worktree-OTFQO2W7.js → worktree-MRSTQ32S.js} +2 -2
  41. package/package.json +1 -1
  42. package/dist/cursor-recover-ZUJG6XRQ.js +0 -42
@@ -4,7 +4,6 @@
4
4
  // src/agents/cursor-runner.ts
5
5
  var import_sdk = require("@cursor/sdk");
6
6
  var import_node_fs10 = require("fs");
7
- var import_node_path11 = require("path");
8
7
  var import_node_readline2 = require("readline");
9
8
 
10
9
  // src/hook/nested-electron-env.ts
@@ -24,62 +23,32 @@ var STRIP_NESTED_ELECTRON_THEN_EXEC = [
24
23
  'exec "$@"'
25
24
  ].join("; ");
26
25
 
27
- // src/store/paths.ts
28
- var import_node_path4 = require("path");
29
- var import_node_os2 = require("os");
30
- var import_node_path5 = require("path");
31
- var import_node_fs4 = require("fs");
32
-
33
- // src/hook/settings.ts
34
- var import_node_fs3 = require("fs");
35
- var import_node_os = require("os");
36
- var import_node_path3 = require("path");
37
- var import_smol_toml = require("smol-toml");
38
-
39
- // src/hook/convention-setup.ts
40
- var import_node_fs = require("fs");
41
- var import_node_path = require("path");
42
-
43
- // src/hook/cursor-worktrees.ts
44
- var import_node_fs2 = require("fs");
45
- var import_node_path2 = require("path");
46
- var import_execa = require("execa");
47
- var import_node_readline = require("readline");
48
-
49
- // src/store/paths.ts
50
- function appDataDir() {
51
- const override = process.env.SIDEBOARD_APP_DATA?.trim();
52
- const base = override ? override : process.platform === "darwin" ? (0, import_node_path5.join)((0, import_node_os2.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path5.join)(process.env.APPDATA ?? (0, import_node_path5.join)((0, import_node_os2.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path5.join)((0, import_node_os2.homedir)(), ".local", "share", "sideboard");
53
- (0, import_node_fs4.mkdirSync)(base, { recursive: true });
54
- return base;
55
- }
56
-
57
26
  // src/agents/cursor-ripgrep.ts
58
- var import_node_fs9 = require("fs");
27
+ var import_node_fs5 = require("fs");
59
28
  var import_node_module = require("module");
60
- var import_node_path10 = require("path");
29
+ var import_node_path5 = require("path");
61
30
 
62
31
  // src/agents/node-launch.ts
63
- var import_node_fs8 = require("fs");
64
- var import_node_os4 = require("os");
65
- var import_node_path9 = require("path");
32
+ var import_node_fs4 = require("fs");
33
+ var import_node_os2 = require("os");
34
+ var import_node_path4 = require("path");
66
35
 
67
36
  // src/git/run.ts
68
- var import_execa2 = require("execa");
37
+ var import_execa = require("execa");
69
38
 
70
39
  // src/agents/path.ts
71
- var import_node_fs5 = require("fs");
40
+ var import_node_fs = require("fs");
72
41
  var import_node_child_process = require("child_process");
73
- var import_node_os3 = require("os");
74
- var import_node_path6 = require("path");
42
+ var import_node_os = require("os");
43
+ var import_node_path = require("path");
75
44
 
76
45
  // src/git/stale-lock.ts
77
- var import_node_fs6 = require("fs");
78
- var import_node_path7 = require("path");
46
+ var import_node_fs2 = require("fs");
47
+ var import_node_path2 = require("path");
79
48
 
80
49
  // src/agents/packaged-runtime.ts
81
- var import_node_fs7 = require("fs");
82
- var import_node_path8 = require("path");
50
+ var import_node_fs3 = require("fs");
51
+ var import_node_path3 = require("path");
83
52
  function electronResourcesPath() {
84
53
  const resources = process.resourcesPath;
85
54
  if (typeof resources !== "string" || !resources) return null;
@@ -88,14 +57,14 @@ function electronResourcesPath() {
88
57
  function packagedCursorRuntimeDir() {
89
58
  const resources = electronResourcesPath();
90
59
  if (!resources) return null;
91
- const dir = (0, import_node_path8.join)(resources, "cursor-runtime");
92
- if (!(0, import_node_fs7.existsSync)((0, import_node_path8.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
60
+ const dir = (0, import_node_path3.join)(resources, "cursor-runtime");
61
+ if (!(0, import_node_fs3.existsSync)((0, import_node_path3.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
93
62
  return dir;
94
63
  }
95
64
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
96
65
  const dir = packagedCursorRuntimeDir();
97
66
  if (!dir) return null;
98
- return (0, import_node_path8.join)(dir, "node_modules", platformPkg, "bin", binName);
67
+ return (0, import_node_path3.join)(dir, "node_modules", platformPkg, "bin", binName);
99
68
  }
100
69
 
101
70
  // src/agents/node-launch.ts
@@ -107,7 +76,7 @@ function unpackedAsarPath(filePath) {
107
76
  if (!isAsarPath(filePath)) return null;
108
77
  const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
109
78
  if (unpacked === filePath) return null;
110
- return (0, import_node_fs8.existsSync)(unpacked) ? unpacked : null;
79
+ return (0, import_node_fs4.existsSync)(unpacked) ? unpacked : null;
111
80
  }
112
81
  function nodeReadableScriptPath(scriptPath) {
113
82
  return unpackedAsarPath(scriptPath) ?? scriptPath;
@@ -123,21 +92,21 @@ function platformRipgrepPackage() {
123
92
  }
124
93
  function usableRipgrepPath(candidate) {
125
94
  const raw = candidate?.trim();
126
- if (!raw || !(0, import_node_path10.isAbsolute)(raw)) return null;
95
+ if (!raw || !(0, import_node_path5.isAbsolute)(raw)) return null;
127
96
  const readable = nodeReadableScriptPath(raw);
128
- if (!(0, import_node_fs9.existsSync)(readable) || isAsarPath(readable)) return null;
97
+ if (!(0, import_node_fs5.existsSync)(readable) || isAsarPath(readable)) return null;
129
98
  return readable;
130
99
  }
131
100
  function walkForBundledRipgrep(startFile) {
132
101
  if (!startFile) return null;
133
102
  const pkg = platformRipgrepPackage();
134
103
  const name = rgBinaryName();
135
- let dir = (0, import_node_path10.dirname)((0, import_node_path10.resolve)(startFile));
136
- const root = (0, import_node_path10.parse)(dir).root;
104
+ let dir = (0, import_node_path5.dirname)((0, import_node_path5.resolve)(startFile));
105
+ const root = (0, import_node_path5.parse)(dir).root;
137
106
  while (dir !== root) {
138
- const hit = usableRipgrepPath((0, import_node_path10.join)(dir, "node_modules", pkg, "bin", name));
107
+ const hit = usableRipgrepPath((0, import_node_path5.join)(dir, "node_modules", pkg, "bin", name));
139
108
  if (hit) return hit;
140
- const next = (0, import_node_path10.dirname)(dir);
109
+ const next = (0, import_node_path5.dirname)(dir);
141
110
  if (next === dir) break;
142
111
  dir = next;
143
112
  }
@@ -147,7 +116,7 @@ function requireResolveBundledRipgrep(fromFile) {
147
116
  try {
148
117
  const req = (0, import_node_module.createRequire)(fromFile);
149
118
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
150
- return usableRipgrepPath((0, import_node_path10.join)((0, import_node_path10.dirname)(pkgJson), "bin", rgBinaryName()));
119
+ return usableRipgrepPath((0, import_node_path5.join)((0, import_node_path5.dirname)(pkgJson), "bin", rgBinaryName()));
151
120
  } catch {
152
121
  return null;
153
122
  }
@@ -172,6 +141,51 @@ function ensureCursorRipgrepPath(opts) {
172
141
  return path;
173
142
  }
174
143
 
144
+ // src/agents/cursor-store.ts
145
+ var import_node_path11 = require("path");
146
+
147
+ // src/store/paths.ts
148
+ var import_node_path9 = require("path");
149
+ var import_node_os4 = require("os");
150
+ var import_node_path10 = require("path");
151
+ var import_node_fs9 = require("fs");
152
+
153
+ // src/hook/settings.ts
154
+ var import_node_fs8 = require("fs");
155
+ var import_node_os3 = require("os");
156
+ var import_node_path8 = require("path");
157
+ var import_smol_toml = require("smol-toml");
158
+
159
+ // src/hook/convention-setup.ts
160
+ var import_node_fs6 = require("fs");
161
+ var import_node_path6 = require("path");
162
+
163
+ // src/hook/cursor-worktrees.ts
164
+ var import_node_fs7 = require("fs");
165
+ var import_node_path7 = require("path");
166
+ var import_execa2 = require("execa");
167
+ var import_node_readline = require("readline");
168
+
169
+ // src/store/paths.ts
170
+ function appDataDir() {
171
+ const override = process.env.SIDEBOARD_APP_DATA?.trim();
172
+ const base = override ? override : process.platform === "darwin" ? (0, import_node_path10.join)((0, import_node_os4.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path10.join)(process.env.APPDATA ?? (0, import_node_path10.join)((0, import_node_os4.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path10.join)((0, import_node_os4.homedir)(), ".local", "share", "sideboard");
173
+ (0, import_node_fs9.mkdirSync)(base, { recursive: true });
174
+ return base;
175
+ }
176
+
177
+ // src/agents/cursor-store.ts
178
+ var CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
179
+ function cursorSdkStoreDir(threadId) {
180
+ const root = (0, import_node_path11.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
181
+ const id = sanitizeCursorStoreSegment(threadId);
182
+ if (!id) return root;
183
+ return (0, import_node_path11.join)(root, "threads", id);
184
+ }
185
+ function sanitizeCursorStoreSegment(threadId) {
186
+ return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
187
+ }
188
+
175
189
  // src/agents/cursor-session.ts
176
190
  function cursorErrorMessage(err) {
177
191
  if (err instanceof Error) return err.message.trim();
@@ -187,7 +201,8 @@ function isUnresumableCursorSession(err) {
187
201
  if (name === "AgentNotFoundError") return true;
188
202
  const lower = cursorErrorMessage(err).toLowerCase();
189
203
  if (!lower) return false;
190
- return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /cannot resume/.test(lower);
204
+ return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || // Shared JSONL last-write-wins: `Run run-… not found for agent agent-…`
205
+ /\brun\b.{0,80}\bnot found for agent\b/.test(lower) || /cannot resume/.test(lower);
191
206
  }
192
207
  function cursorSessionRecoveryMessage(err, agentId) {
193
208
  const detail = cursorErrorMessage(err) || "unresumable session";
@@ -581,8 +596,8 @@ function modelSelection(model, opts) {
581
596
  }
582
597
  return params.length > 0 ? { id, params } : { id };
583
598
  }
584
- function localAgentStore() {
585
- const root = (0, import_node_path11.join)(appDataDir(), "cursor-sdk-store");
599
+ function localAgentStore(threadId) {
600
+ const root = cursorSdkStoreDir(threadId);
586
601
  (0, import_node_fs10.mkdirSync)(root, { recursive: true });
587
602
  return new import_sdk.JsonlLocalAgentStore(root);
588
603
  }
@@ -641,7 +656,7 @@ async function main() {
641
656
  fast: Boolean(req.fast)
642
657
  });
643
658
  const mode = req.planMode ? "plan" : "agent";
644
- const store = localAgentStore();
659
+ const store = localAgentStore(req.threadId);
645
660
  const local = withCursorLocalHangGuards({ cwd: req.cwd, store });
646
661
  const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
647
662
  const createOpts = {
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ cursorSdkStoreDir
4
+ } from "../chunk-VHX673DI.js";
2
5
  import {
3
6
  createAgentStreamCoalescer
4
7
  } from "../chunk-AXQ4ZWHK.js";
@@ -7,19 +10,16 @@ import {
7
10
  cursorSdkMessageToEvents,
8
11
  ensureCursorRipgrepPath,
9
12
  formatUnknownDetail
10
- } from "../chunk-GBY7OOMB.js";
13
+ } from "../chunk-NZBDVBCP.js";
11
14
  import {
12
15
  dropNestedElectronEnvFromProcess
13
16
  } from "../chunk-4TR3HZFT.js";
14
- import {
15
- appDataDir
16
- } from "../chunk-QZQEXME2.js";
17
+ import "../chunk-QZQEXME2.js";
17
18
  import "../chunk-DVM4ID64.js";
18
19
 
19
20
  // src/agents/cursor-runner.ts
20
21
  import { Agent, CursorAgentError, JsonlLocalAgentStore } from "@cursor/sdk";
21
22
  import { mkdirSync } from "fs";
22
- import { join } from "path";
23
23
  import { createInterface } from "readline";
24
24
 
25
25
  // src/agents/cursor-session.ts
@@ -37,7 +37,8 @@ function isUnresumableCursorSession(err) {
37
37
  if (name === "AgentNotFoundError") return true;
38
38
  const lower = cursorErrorMessage(err).toLowerCase();
39
39
  if (!lower) return false;
40
- return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /cannot resume/.test(lower);
40
+ return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || // Shared JSONL last-write-wins: `Run run-… not found for agent agent-…`
41
+ /\brun\b.{0,80}\bnot found for agent\b/.test(lower) || /cannot resume/.test(lower);
41
42
  }
42
43
  function cursorSessionRecoveryMessage(err, agentId) {
43
44
  const detail = cursorErrorMessage(err) || "unresumable session";
@@ -116,8 +117,8 @@ function modelSelection(model, opts) {
116
117
  }
117
118
  return params.length > 0 ? { id, params } : { id };
118
119
  }
119
- function localAgentStore() {
120
- const root = join(appDataDir(), "cursor-sdk-store");
120
+ function localAgentStore(threadId) {
121
+ const root = cursorSdkStoreDir(threadId);
121
122
  mkdirSync(root, { recursive: true });
122
123
  return new JsonlLocalAgentStore(root);
123
124
  }
@@ -176,7 +177,7 @@ async function main() {
176
177
  fast: Boolean(req.fast)
177
178
  });
178
179
  const mode = req.planMode ? "plan" : "agent";
179
- const store = localAgentStore();
180
+ const store = localAgentStore(req.threadId);
180
181
  const local = withCursorLocalHangGuards({ cwd: req.cwd, store });
181
182
  const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
182
183
  const createOpts = {
@@ -28,25 +28,25 @@ import {
28
28
  resolveCursorModelId,
29
29
  resolveLoginCommand,
30
30
  resolveQuotaFallbackAgent
31
- } from "./chunk-5KSLD4MU.js";
31
+ } from "./chunk-YJ2WV5TZ.js";
32
32
  import "./chunk-EKIDHL2T.js";
33
33
  import {
34
34
  ORCHESTRATOR_AGENT_KINDS,
35
35
  assertOrchestratorCapableAgent,
36
36
  coerceOrchestratorAgent,
37
37
  isOrchestratorCapableAgent
38
- } from "./chunk-4OJMZ6P2.js";
39
- import "./chunk-7WC5UWEB.js";
38
+ } from "./chunk-4WV7C7WP.js";
39
+ import "./chunk-X3NIPGQT.js";
40
40
  import {
41
41
  cursorSdkMessageToEvents,
42
42
  parseCursorRunnerLine
43
- } from "./chunk-GBY7OOMB.js";
44
- import "./chunk-FZCIQYNQ.js";
43
+ } from "./chunk-NZBDVBCP.js";
44
+ import "./chunk-VGPLXQIH.js";
45
45
  import "./chunk-FKOIHGKV.js";
46
46
  import "./chunk-4NR5FL46.js";
47
47
  import "./chunk-4TR3HZFT.js";
48
48
  import "./chunk-JT7R45JB.js";
49
- import "./chunk-A4VZXJEJ.js";
49
+ import "./chunk-HPAWHIZ3.js";
50
50
  import "./chunk-77WWLBCI.js";
51
51
  import "./chunk-QZQEXME2.js";
52
52
  import {
@@ -32,18 +32,18 @@ import {
32
32
  resolveCursorModelId,
33
33
  resolveLoginCommand,
34
34
  resolveQuotaFallbackAgent
35
- } from "./chunk-OFF5AFCR.js";
35
+ } from "./chunk-4CDCTYTM.js";
36
36
  import "./chunk-YMRT2DU6.js";
37
37
  import {
38
38
  ORCHESTRATOR_AGENT_KINDS,
39
39
  assertOrchestratorCapableAgent,
40
40
  coerceOrchestratorAgent,
41
41
  isOrchestratorCapableAgent
42
- } from "./chunk-XOYQ7LNQ.js";
43
- import "./chunk-ZYEFCSZJ.js";
44
- import "./chunk-ZMROW673.js";
42
+ } from "./chunk-4NAW5BAQ.js";
43
+ import "./chunk-XTZQL7OU.js";
44
+ import "./chunk-WCU3FHEI.js";
45
45
  import "./chunk-B3SJXYIJ.js";
46
- import "./chunk-KYOTBZ6S.js";
46
+ import "./chunk-RG737OWT.js";
47
47
  import {
48
48
  conductorBundledBinDir,
49
49
  enrichPathWithNpmGlobalBin,
@@ -9,13 +9,13 @@ import {
9
9
  } from "./chunk-YMRT2DU6.js";
10
10
  import {
11
11
  isOrchestratorThread
12
- } from "./chunk-XOYQ7LNQ.js";
12
+ } from "./chunk-4NAW5BAQ.js";
13
13
  import {
14
14
  codexUnattendedGitConfigArgs,
15
15
  mergeAgentGitAuthEnv,
16
16
  resolveAgentGitAuthEnv,
17
17
  resolveCodexGitWritableRoots
18
- } from "./chunk-ZMROW673.js";
18
+ } from "./chunk-WCU3FHEI.js";
19
19
  import {
20
20
  enrichPathWithNpmGlobalBin,
21
21
  isConductorBundledCli,
@@ -237,7 +237,7 @@ function summarizeTurnStderr(tail, maxChars = 500) {
237
237
  function looksLikeInvalidAgentSession(text) {
238
238
  const lower = text.trim().toLowerCase();
239
239
  if (!lower) return false;
240
- return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower);
240
+ return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /\brun\b.{0,80}\bnot found for agent\b/.test(lower);
241
241
  }
242
242
  function looksLikeRetryableRunnerCrash(text) {
243
243
  if (looksLikeAgentFailureMessage(text)) return false;
@@ -1913,7 +1913,7 @@ var claudeAdapter = {
1913
1913
  );
1914
1914
  }
1915
1915
  const mode = permissionMode(thread);
1916
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-H4YNASM6.js");
1916
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-Z37MNYU6.js");
1917
1917
  const isOrchestrator = isOrchestratorThread2(thread);
1918
1918
  const injectedServers = await buildInjectedMcpServers({
1919
1919
  includeSideboard: true,
@@ -2854,6 +2854,7 @@ var cursorAdapter = {
2854
2854
  const req = {
2855
2855
  prompt,
2856
2856
  cwd: thread.worktreePath,
2857
+ threadId: thread.id,
2857
2858
  agentId,
2858
2859
  model: thread.model,
2859
2860
  effort: thread.effort,
@@ -2,18 +2,18 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-ZYEFCSZJ.js";
5
+ } from "./chunk-XTZQL7OU.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-ZMROW673.js";
10
+ } from "./chunk-WCU3FHEI.js";
11
11
  import {
12
12
  createEmptyThread,
13
13
  listThreads,
14
14
  updateThread,
15
15
  writeThread
16
- } from "./chunk-KYOTBZ6S.js";
16
+ } from "./chunk-RG737OWT.js";
17
17
  import {
18
18
  resolveNewThreadOptions,
19
19
  resolveThreadDefaults
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-7WC5UWEB.js";
3
+ } from "./chunk-X3NIPGQT.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-FZCIQYNQ.js";
8
+ } from "./chunk-VGPLXQIH.js";
9
9
  import {
10
10
  resolveNewThreadOptions,
11
11
  resolveThreadDefaults
@@ -15,7 +15,7 @@ import {
15
15
  listThreads,
16
16
  updateThread,
17
17
  writeThread
18
- } from "./chunk-A4VZXJEJ.js";
18
+ } from "./chunk-HPAWHIZ3.js";
19
19
  import {
20
20
  globalAgentCwd
21
21
  } from "./chunk-QZQEXME2.js";
@@ -17,13 +17,13 @@ import {
17
17
  resolveQuotaFallbackAgent,
18
18
  stripBrightsyNdjsonNoise,
19
19
  toolDescription
20
- } from "./chunk-5KSLD4MU.js";
20
+ } from "./chunk-YJ2WV5TZ.js";
21
21
  import {
22
22
  addWorkspace,
23
23
  ensureWorkspace,
24
24
  removeWorkspace,
25
25
  syncWorkspacesFromThreads
26
- } from "./chunk-K3TIQXOH.js";
26
+ } from "./chunk-U3IVCVLH.js";
27
27
  import {
28
28
  assertOrchestratorCapableAgent,
29
29
  coerceOrchestratorAgent,
@@ -36,14 +36,14 @@ import {
36
36
  isOrchestratorThread,
37
37
  isSlackCoordinatorThread,
38
38
  orchestratorSessionPoisonedByBuiltins
39
- } from "./chunk-4OJMZ6P2.js";
39
+ } from "./chunk-4WV7C7WP.js";
40
40
  import {
41
41
  SLACK_REPLY_FORMATTING,
42
42
  coordinatorSystemPrompt,
43
43
  coordinatorTurnReminder,
44
44
  enrichWorkspacesWithGithub,
45
45
  ensureGlobalCoordinatorCwd
46
- } from "./chunk-7WC5UWEB.js";
46
+ } from "./chunk-X3NIPGQT.js";
47
47
  import {
48
48
  extractPresentedPlan,
49
49
  readPlanFile,
@@ -63,7 +63,7 @@ import {
63
63
  shouldRetryFailedAgentTurn,
64
64
  summarizeTurnStderr,
65
65
  turnFailChatText
66
- } from "./chunk-GBY7OOMB.js";
66
+ } from "./chunk-NZBDVBCP.js";
67
67
  import {
68
68
  releaseCaffeinateHoldForThread
69
69
  } from "./chunk-DCOZABNT.js";
@@ -109,7 +109,7 @@ import {
109
109
  threadDisplayLabel,
110
110
  withRepoGitLock,
111
111
  worktreeNameFromPath
112
- } from "./chunk-FZCIQYNQ.js";
112
+ } from "./chunk-VGPLXQIH.js";
113
113
  import {
114
114
  ATTACHMENTS_DIR,
115
115
  LEGACY_ATTACHMENTS_DIR,
@@ -145,7 +145,7 @@ import {
145
145
  updateThread,
146
146
  withThreadLock,
147
147
  writeThread
148
- } from "./chunk-A4VZXJEJ.js";
148
+ } from "./chunk-HPAWHIZ3.js";
149
149
  import {
150
150
  appDataDir,
151
151
  findConventionSetup,
@@ -755,9 +755,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
755
755
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
756
756
  );
757
757
  }
758
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-CSWABOG5.js");
758
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-SBKXKQFS.js");
759
759
  if (isGlobalThread2(thread)) {
760
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-4KCALEKD.js");
760
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-QMV6YEP5.js");
761
761
  ensureGlobalCoordinatorCwd2(
762
762
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
763
763
  );
@@ -2455,7 +2455,7 @@ async function createThread(input, _onSetupLine) {
2455
2455
  return readThread(thread.id) ?? thread;
2456
2456
  }
2457
2457
  async function listLinearIssues(agent, repoPath) {
2458
- const { getAdapter: getAdapter2 } = await import("./agents-7NIX44RB.js");
2458
+ const { getAdapter: getAdapter2 } = await import("./agents-GUEKGV7V.js");
2459
2459
  await requireAgent(agent, { requireLinear: true });
2460
2460
  const adapter = getAdapter2(agent);
2461
2461
  if (!adapter.listLinearIssues) {
@@ -2551,7 +2551,7 @@ function noteTurnLiveEvent(threadId, event) {
2551
2551
  buffers.delete(threadId);
2552
2552
  return;
2553
2553
  }
2554
- const immediate = event.type === "tool_use" || event.type === "tool_result";
2554
+ const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
2555
2555
  if (immediate) flush(threadId);
2556
2556
  else scheduleFlush(threadId);
2557
2557
  }
@@ -2591,6 +2591,21 @@ function clearTurnLive(threadId) {
2591
2591
  }
2592
2592
  }
2593
2593
 
2594
+ // src/orchestrator/reconcile-heal.ts
2595
+ var RECONCILE_HEAL_MIN_MS = 2e3;
2596
+ var SKIP = /* @__PURE__ */ new Set([
2597
+ "stdout",
2598
+ "thinking",
2599
+ "usage",
2600
+ "stderr",
2601
+ "tool_result"
2602
+ ]);
2603
+ function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
2604
+ if (SKIP.has(eventType)) return false;
2605
+ if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
2606
+ return true;
2607
+ }
2608
+
2594
2609
  // src/threads/fork-worktree.ts
2595
2610
  function requireThread2(idOrRef) {
2596
2611
  const thread = findThreadByRef(idOrRef) ?? null;
@@ -2836,7 +2851,7 @@ async function adoptThread(input) {
2836
2851
  messages: input.messages ?? []
2837
2852
  });
2838
2853
  writeThread(thread);
2839
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-QG6PGFQR.js");
2854
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-M4OICPWF.js");
2840
2855
  await ensureWorkspace2(repoPath);
2841
2856
  return thread;
2842
2857
  }
@@ -5109,7 +5124,7 @@ function formatScheduledPrompt(name, prompt) {
5109
5124
  ${prompt}`;
5110
5125
  }
5111
5126
  async function defaultDeps() {
5112
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-ZY4RUJKT.js");
5127
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-MKTZYWTI.js");
5113
5128
  const orch = getOrchestrator2();
5114
5129
  return {
5115
5130
  findThread: (id) => findThreadByRef(id),
@@ -5243,6 +5258,8 @@ var Orchestrator = class {
5243
5258
  draining = /* @__PURE__ */ new Set();
5244
5259
  /** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
5245
5260
  startingTurns = /* @__PURE__ */ new Set();
5261
+ /** Last sync thread-file read for false-stop heal (throttled per thread). */
5262
+ lastReconcileHealAt = /* @__PURE__ */ new Map();
5246
5263
  /**
5247
5264
  * Threads intentionally force-stopped. Prevents runTurn from re-asserting
5248
5265
  * `running` after spawn, and from overwriting `stopped` with idle/error when
@@ -5840,7 +5857,13 @@ var Orchestrator = class {
5840
5857
  if (event.type === "stderr" && typeof event.data === "string") {
5841
5858
  pushTurnStderr(stderrTail, event.data);
5842
5859
  }
5843
- if (event.type !== "stdout" && event.type !== "thinking") {
5860
+ const now = Date.now();
5861
+ if (shouldReadThreadToHealReconcile(
5862
+ event.type,
5863
+ this.lastReconcileHealAt.get(threadId),
5864
+ now
5865
+ )) {
5866
+ this.lastReconcileHealAt.set(threadId, now);
5844
5867
  const live = readThread(threadId);
5845
5868
  if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
5846
5869
  setStatus(threadId, "running");
@@ -5880,11 +5903,12 @@ var Orchestrator = class {
5880
5903
  if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
5881
5904
  const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
5882
5905
  if (sessionId) {
5883
- const { recoverFinishedCursorRun } = await import("./cursor-recover-ZUJG6XRQ.js");
5906
+ const { recoverFinishedCursorRun } = await import("./cursor-recover-QSLWEZNA.js");
5884
5907
  for (let i = 0; i < 8; i++) {
5885
5908
  const recovered = recoverFinishedCursorRun({
5886
5909
  agentId: sessionId,
5887
- startedAfterMs: turnStartedAt - 5e3
5910
+ startedAfterMs: turnStartedAt - 5e3,
5911
+ threadId
5888
5912
  });
5889
5913
  if (recovered?.result) {
5890
5914
  assistantText = recovered.result;
@@ -6857,7 +6881,7 @@ var Orchestrator = class {
6857
6881
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
6858
6882
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
6859
6883
  try {
6860
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-QG6PGFQR.js");
6884
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-M4OICPWF.js");
6861
6885
  await ensureWorkspace2(thread.repoPath);
6862
6886
  } catch {
6863
6887
  }
@@ -6911,7 +6935,7 @@ var Orchestrator = class {
6911
6935
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
6912
6936
  );
6913
6937
  }
6914
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-IW3BX26B.js");
6938
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-7AEKZSEX.js");
6915
6939
  const slug = thread.worktreePath.split("/").pop();
6916
6940
  const dest = thread.worktreePath;
6917
6941
  await withRepoGitLock(thread.repoPath, async () => {
@@ -7019,7 +7043,7 @@ async function startOrchestration(opts) {
7019
7043
  sourceRef: "default",
7020
7044
  ...createOpts
7021
7045
  }).catch(async () => {
7022
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-IW3BX26B.js");
7046
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-7AEKZSEX.js");
7023
7047
  const repo = await resolveRepoRoot2(repoPath);
7024
7048
  const def = await resolveDefaultBranch2(repo);
7025
7049
  return orch.createThread({
@@ -7029,7 +7053,7 @@ async function startOrchestration(opts) {
7029
7053
  repoPath: repo
7030
7054
  });
7031
7055
  });
7032
- const { updateThread: upd } = await import("./thread-store-OEALWU7Y.js");
7056
+ const { updateThread: upd } = await import("./thread-store-JR235AWK.js");
7033
7057
  const updated = upd(thread.id, {
7034
7058
  sourceType: "orchestration",
7035
7059
  sourceRef: goal