@sideboard-ai/core 0.1.116 → 0.1.120

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-HOIXQEP5.js} +6 -6
  4. package/dist/{agents-DU7DHY7A.js → agents-XTABRYO5.js} +5 -5
  5. package/dist/{chunk-4HOFVKPC.js → chunk-4LRPW6QM.js} +43 -19
  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-AFM6442E.js} +44 -20
  9. package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
  10. package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
  11. package/dist/{chunk-GBY7OOMB.js → chunk-NZBDVBCP.js} +1 -1
  12. package/dist/{chunk-5KSLD4MU.js → chunk-QI7VC4EG.js} +92 -62
  13. package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
  14. package/dist/{chunk-OFF5AFCR.js → chunk-TDNM7QZJ.js} +92 -62
  15. package/dist/{chunk-K3TIQXOH.js → chunk-U3IVCVLH.js} +2 -2
  16. package/dist/{chunk-FZCIQYNQ.js → chunk-VGPLXQIH.js} +1 -1
  17. package/dist/chunk-VHX673DI.js +32 -0
  18. package/dist/{chunk-ZMROW673.js → chunk-WCU3FHEI.js} +1 -1
  19. package/dist/{chunk-7WC5UWEB.js → chunk-X3NIPGQT.js} +1 -1
  20. package/dist/{chunk-ZYEFCSZJ.js → chunk-XTZQL7OU.js} +1 -1
  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 +388 -285
  28. package/dist/index.d.cts +13 -2
  29. package/dist/index.d.ts +13 -2
  30. package/dist/index.js +10 -8
  31. package/dist/mcp/run-stdio.cjs +383 -282
  32. package/dist/mcp/run-stdio.js +7 -7
  33. package/dist/{orchestrator-NXPANCZA.js → orchestrator-3LJIG6XG.js} +7 -7
  34. package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-NWNKWZLB.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-QI7VC4EG.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-TDNM7QZJ.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,
@@ -28,13 +28,13 @@ import {
28
28
  summarizeTurnStderr,
29
29
  toolDescription,
30
30
  turnFailChatText
31
- } from "./chunk-OFF5AFCR.js";
31
+ } from "./chunk-TDNM7QZJ.js";
32
32
  import {
33
33
  addWorkspace,
34
34
  ensureWorkspace,
35
35
  removeWorkspace,
36
36
  syncWorkspacesFromThreads
37
- } from "./chunk-ZRCX43LS.js";
37
+ } from "./chunk-BKVDZV7X.js";
38
38
  import {
39
39
  extractPresentedPlan,
40
40
  readPlanFile,
@@ -55,14 +55,14 @@ import {
55
55
  isOrchestratorThread,
56
56
  isSlackCoordinatorThread,
57
57
  orchestratorSessionPoisonedByBuiltins
58
- } from "./chunk-XOYQ7LNQ.js";
58
+ } from "./chunk-4NAW5BAQ.js";
59
59
  import {
60
60
  SLACK_REPLY_FORMATTING,
61
61
  coordinatorSystemPrompt,
62
62
  coordinatorTurnReminder,
63
63
  enrichWorkspacesWithGithub,
64
64
  ensureGlobalCoordinatorCwd
65
- } from "./chunk-ZYEFCSZJ.js";
65
+ } from "./chunk-XTZQL7OU.js";
66
66
  import {
67
67
  addPrStackLayer,
68
68
  allocateTeamName,
@@ -105,7 +105,7 @@ import {
105
105
  threadDisplayLabel,
106
106
  withRepoGitLock,
107
107
  worktreeNameFromPath
108
- } from "./chunk-ZMROW673.js";
108
+ } from "./chunk-WCU3FHEI.js";
109
109
  import {
110
110
  ATTACHMENTS_DIR,
111
111
  LEGACY_ATTACHMENTS_DIR,
@@ -122,7 +122,7 @@ import {
122
122
  updateThread,
123
123
  withThreadLock,
124
124
  writeThread
125
- } from "./chunk-KYOTBZ6S.js";
125
+ } from "./chunk-RG737OWT.js";
126
126
  import {
127
127
  clearStaleIndexLocks,
128
128
  enrichPathWithNpmGlobalBin,
@@ -742,9 +742,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
742
742
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
743
743
  );
744
744
  }
745
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H4YNASM6.js");
745
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-Z37MNYU6.js");
746
746
  if (isGlobalThread2(thread)) {
747
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-FML4I5AR.js");
747
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-XCBHAOGE.js");
748
748
  ensureGlobalCoordinatorCwd2(
749
749
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
750
750
  );
@@ -2410,7 +2410,7 @@ async function createThread(input, _onSetupLine) {
2410
2410
  return readThread(thread.id) ?? thread;
2411
2411
  }
2412
2412
  async function listLinearIssues(agent, repoPath) {
2413
- const { getAdapter: getAdapter2 } = await import("./agents-DU7DHY7A.js");
2413
+ const { getAdapter: getAdapter2 } = await import("./agents-XTABRYO5.js");
2414
2414
  await requireAgent(agent, { requireLinear: true });
2415
2415
  const adapter = getAdapter2(agent);
2416
2416
  if (!adapter.listLinearIssues) {
@@ -2506,7 +2506,7 @@ function noteTurnLiveEvent(threadId, event) {
2506
2506
  buffers.delete(threadId);
2507
2507
  return;
2508
2508
  }
2509
- const immediate = event.type === "tool_use" || event.type === "tool_result";
2509
+ const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
2510
2510
  if (immediate) flush(threadId);
2511
2511
  else scheduleFlush(threadId);
2512
2512
  }
@@ -2546,6 +2546,21 @@ function clearTurnLive(threadId) {
2546
2546
  }
2547
2547
  }
2548
2548
 
2549
+ // src/orchestrator/reconcile-heal.ts
2550
+ var RECONCILE_HEAL_MIN_MS = 2e3;
2551
+ var SKIP = /* @__PURE__ */ new Set([
2552
+ "stdout",
2553
+ "thinking",
2554
+ "usage",
2555
+ "stderr",
2556
+ "tool_result"
2557
+ ]);
2558
+ function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
2559
+ if (SKIP.has(eventType)) return false;
2560
+ if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
2561
+ return true;
2562
+ }
2563
+
2549
2564
  // src/threads/fork-worktree.ts
2550
2565
  function requireThread2(idOrRef) {
2551
2566
  const thread = findThreadByRef(idOrRef) ?? null;
@@ -2791,7 +2806,7 @@ async function adoptThread(input) {
2791
2806
  messages: input.messages ?? []
2792
2807
  });
2793
2808
  writeThread(thread);
2794
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HJ3EVATC.js");
2809
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-C3TJJFY3.js");
2795
2810
  await ensureWorkspace2(repoPath);
2796
2811
  return thread;
2797
2812
  }
@@ -4938,7 +4953,7 @@ function formatScheduledPrompt(name, prompt) {
4938
4953
  ${prompt}`;
4939
4954
  }
4940
4955
  async function defaultDeps() {
4941
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NXPANCZA.js");
4956
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-3LJIG6XG.js");
4942
4957
  const orch = getOrchestrator2();
4943
4958
  return {
4944
4959
  findThread: (id) => findThreadByRef(id),
@@ -5072,6 +5087,8 @@ var Orchestrator = class {
5072
5087
  draining = /* @__PURE__ */ new Set();
5073
5088
  /** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
5074
5089
  startingTurns = /* @__PURE__ */ new Set();
5090
+ /** Last sync thread-file read for false-stop heal (throttled per thread). */
5091
+ lastReconcileHealAt = /* @__PURE__ */ new Map();
5075
5092
  /**
5076
5093
  * Threads intentionally force-stopped. Prevents runTurn from re-asserting
5077
5094
  * `running` after spawn, and from overwriting `stopped` with idle/error when
@@ -5669,7 +5686,13 @@ var Orchestrator = class {
5669
5686
  if (event.type === "stderr" && typeof event.data === "string") {
5670
5687
  pushTurnStderr(stderrTail, event.data);
5671
5688
  }
5672
- if (event.type !== "stdout" && event.type !== "thinking") {
5689
+ const now = Date.now();
5690
+ if (shouldReadThreadToHealReconcile(
5691
+ event.type,
5692
+ this.lastReconcileHealAt.get(threadId),
5693
+ now
5694
+ )) {
5695
+ this.lastReconcileHealAt.set(threadId, now);
5673
5696
  const live = readThread(threadId);
5674
5697
  if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
5675
5698
  setStatus(threadId, "running");
@@ -5709,11 +5732,12 @@ var Orchestrator = class {
5709
5732
  if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
5710
5733
  const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
5711
5734
  if (sessionId) {
5712
- const { recoverFinishedCursorRun } = await import("./cursor-recover-JBTIDARH.js");
5735
+ const { recoverFinishedCursorRun } = await import("./cursor-recover-NOQYOFRF.js");
5713
5736
  for (let i = 0; i < 8; i++) {
5714
5737
  const recovered = recoverFinishedCursorRun({
5715
5738
  agentId: sessionId,
5716
- startedAfterMs: turnStartedAt - 5e3
5739
+ startedAfterMs: turnStartedAt - 5e3,
5740
+ threadId
5717
5741
  });
5718
5742
  if (recovered?.result) {
5719
5743
  assistantText = recovered.result;
@@ -6686,7 +6710,7 @@ var Orchestrator = class {
6686
6710
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
6687
6711
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
6688
6712
  try {
6689
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HJ3EVATC.js");
6713
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-C3TJJFY3.js");
6690
6714
  await ensureWorkspace2(thread.repoPath);
6691
6715
  } catch {
6692
6716
  }
@@ -6740,7 +6764,7 @@ var Orchestrator = class {
6740
6764
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
6741
6765
  );
6742
6766
  }
6743
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-OTFQO2W7.js");
6767
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-MRSTQ32S.js");
6744
6768
  const slug = thread.worktreePath.split("/").pop();
6745
6769
  const dest = thread.worktreePath;
6746
6770
  await withRepoGitLock(thread.repoPath, async () => {
@@ -6848,7 +6872,7 @@ async function startOrchestration(opts) {
6848
6872
  sourceRef: "default",
6849
6873
  ...createOpts
6850
6874
  }).catch(async () => {
6851
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-OTFQO2W7.js");
6875
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-MRSTQ32S.js");
6852
6876
  const repo = await resolveRepoRoot2(repoPath);
6853
6877
  const def = await resolveDefaultBranch2(repo);
6854
6878
  return orch.createThread({
@@ -6858,7 +6882,7 @@ async function startOrchestration(opts) {
6858
6882
  repoPath: repo
6859
6883
  });
6860
6884
  });
6861
- const { updateThread: upd } = await import("./thread-store-LPTBVW5C.js");
6885
+ const { updateThread: upd } = await import("./thread-store-PMH3BMB6.js");
6862
6886
  const updated = upd(thread.id, {
6863
6887
  sourceType: "orchestration",
6864
6888
  sourceRef: goal
@@ -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";