@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.
- package/dist/agents/cursor-runner.cjs +74 -59
- package/dist/agents/cursor-runner.js +10 -9
- package/dist/{agents-7NIX44RB.js → agents-GUEKGV7V.js} +6 -6
- package/dist/{agents-DU7DHY7A.js → agents-OCGAZCKT.js} +5 -5
- package/dist/{chunk-OFF5AFCR.js → chunk-4CDCTYTM.js} +5 -4
- package/dist/{chunk-XOYQ7LNQ.js → chunk-4NAW5BAQ.js} +3 -3
- package/dist/{chunk-4OJMZ6P2.js → chunk-4WV7C7WP.js} +3 -3
- package/dist/{chunk-DWP25N32.js → chunk-5X7GRP5W.js} +44 -20
- package/dist/{chunk-4HOFVKPC.js → chunk-74YJHND6.js} +43 -19
- package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
- package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
- package/dist/{chunk-GBY7OOMB.js → chunk-NZBDVBCP.js} +1 -1
- package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
- package/dist/{chunk-K3TIQXOH.js → chunk-U3IVCVLH.js} +2 -2
- package/dist/{chunk-FZCIQYNQ.js → chunk-VGPLXQIH.js} +1 -1
- package/dist/chunk-VHX673DI.js +32 -0
- package/dist/{chunk-ZMROW673.js → chunk-WCU3FHEI.js} +1 -1
- package/dist/{chunk-7WC5UWEB.js → chunk-X3NIPGQT.js} +1 -1
- package/dist/{chunk-ZYEFCSZJ.js → chunk-XTZQL7OU.js} +1 -1
- package/dist/{chunk-5KSLD4MU.js → chunk-YJ2WV5TZ.js} +5 -4
- package/dist/{coordinator-prompt-4KCALEKD.js → coordinator-prompt-QMV6YEP5.js} +3 -3
- package/dist/{coordinator-prompt-FML4I5AR.js → coordinator-prompt-XCBHAOGE.js} +3 -3
- package/dist/cursor-recover-NOQYOFRF.js +76 -0
- package/dist/{cursor-recover-JBTIDARH.js → cursor-recover-QSLWEZNA.js} +12 -7
- package/dist/{global-workspace-CSWABOG5.js → global-workspace-SBKXKQFS.js} +4 -4
- package/dist/{global-workspace-H4YNASM6.js → global-workspace-Z37MNYU6.js} +4 -4
- package/dist/index.cjs +301 -227
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -8
- package/dist/mcp/run-stdio.cjs +296 -224
- package/dist/mcp/run-stdio.js +7 -7
- package/dist/{orchestrator-NXPANCZA.js → orchestrator-4PKR6AZJ.js} +7 -7
- package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-MKTZYWTI.js} +8 -8
- package/dist/{thread-store-OEALWU7Y.js → thread-store-JR235AWK.js} +3 -1
- package/dist/{thread-store-LPTBVW5C.js → thread-store-PMH3BMB6.js} +3 -1
- package/dist/{workspaces-HJ3EVATC.js → workspaces-C3TJJFY3.js} +5 -5
- package/dist/{workspaces-QG6PGFQR.js → workspaces-M4OICPWF.js} +5 -5
- package/dist/{worktree-IW3BX26B.js → worktree-7AEKZSEX.js} +2 -2
- package/dist/{worktree-OTFQO2W7.js → worktree-MRSTQ32S.js} +2 -2
- package/package.json +1 -1
- package/dist/cursor-recover-ZUJG6XRQ.js +0 -42
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
summarizeTurnStderr,
|
|
29
29
|
toolDescription,
|
|
30
30
|
turnFailChatText
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-4CDCTYTM.js";
|
|
32
32
|
import {
|
|
33
33
|
addWorkspace,
|
|
34
34
|
ensureWorkspace,
|
|
35
35
|
removeWorkspace,
|
|
36
36
|
syncWorkspacesFromThreads
|
|
37
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
745
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-Z37MNYU6.js");
|
|
746
746
|
if (isGlobalThread2(thread)) {
|
|
747
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
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-
|
|
2413
|
+
const { getAdapter: getAdapter2 } = await import("./agents-OCGAZCKT.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-
|
|
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-
|
|
4956
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-4PKR6AZJ.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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
isGlobalRepoPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4NAW5BAQ.js";
|
|
6
6
|
import {
|
|
7
7
|
ensureGhPreferOrigin,
|
|
8
8
|
resolveRepoRoot
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WCU3FHEI.js";
|
|
10
10
|
import {
|
|
11
11
|
appDataDir
|
|
12
12
|
} from "./chunk-BD2ICC4D.js";
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
writeFileSync,
|
|
18
18
|
readdirSync
|
|
19
19
|
} from "fs";
|
|
20
|
+
import { basename } from "path";
|
|
20
21
|
import lockfile from "proper-lockfile";
|
|
21
22
|
function nowIso() {
|
|
22
23
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -119,7 +120,8 @@ function writeThread(thread) {
|
|
|
119
120
|
function idPath(id) {
|
|
120
121
|
return id;
|
|
121
122
|
}
|
|
122
|
-
function isThreadRecordFile(
|
|
123
|
+
function isThreadRecordFile(nameOrPath) {
|
|
124
|
+
const name = basename(nameOrPath);
|
|
123
125
|
return name.endsWith(".json") && !name.endsWith(".live.json");
|
|
124
126
|
}
|
|
125
127
|
function listThreads(opts) {
|
|
@@ -178,6 +180,7 @@ export {
|
|
|
178
180
|
withThreadLock,
|
|
179
181
|
readThread,
|
|
180
182
|
writeThread,
|
|
183
|
+
isThreadRecordFile,
|
|
181
184
|
listThreads,
|
|
182
185
|
deleteThreadRecord,
|
|
183
186
|
updateThread,
|
|
@@ -130,7 +130,7 @@ function summarizeTurnStderr(tail, maxChars = 500) {
|
|
|
130
130
|
function looksLikeInvalidAgentSession(text) {
|
|
131
131
|
const lower = text.trim().toLowerCase();
|
|
132
132
|
if (!lower) return false;
|
|
133
|
-
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);
|
|
133
|
+
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);
|
|
134
134
|
}
|
|
135
135
|
function looksLikeRetryableRunnerCrash(text) {
|
|
136
136
|
if (looksLikeAgentFailureMessage(text)) return false;
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
writeFileSync,
|
|
20
20
|
readdirSync
|
|
21
21
|
} from "fs";
|
|
22
|
+
import { basename } from "path";
|
|
22
23
|
import lockfile from "proper-lockfile";
|
|
23
24
|
function nowIso() {
|
|
24
25
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -121,7 +122,8 @@ function writeThread(thread) {
|
|
|
121
122
|
function idPath(id) {
|
|
122
123
|
return id;
|
|
123
124
|
}
|
|
124
|
-
function isThreadRecordFile(
|
|
125
|
+
function isThreadRecordFile(nameOrPath) {
|
|
126
|
+
const name = basename(nameOrPath);
|
|
125
127
|
return name.endsWith(".json") && !name.endsWith(".live.json");
|
|
126
128
|
}
|
|
127
129
|
function listThreads(opts) {
|
|
@@ -180,6 +182,7 @@ export {
|
|
|
180
182
|
withThreadLock,
|
|
181
183
|
readThread,
|
|
182
184
|
writeThread,
|
|
185
|
+
isThreadRecordFile,
|
|
183
186
|
listThreads,
|
|
184
187
|
deleteThreadRecord,
|
|
185
188
|
updateThread,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4WV7C7WP.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGhPreferOrigin,
|
|
6
6
|
resolveRepoRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VGPLXQIH.js";
|
|
8
8
|
import {
|
|
9
9
|
appDataDir
|
|
10
10
|
} from "./chunk-QZQEXME2.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appDataDir
|
|
3
|
+
} from "./chunk-QZQEXME2.js";
|
|
4
|
+
|
|
5
|
+
// src/agents/cursor-store.ts
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
var CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
8
|
+
function cursorSdkStoreDir(threadId) {
|
|
9
|
+
const root = join(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
10
|
+
const id = sanitizeCursorStoreSegment(threadId);
|
|
11
|
+
if (!id) return root;
|
|
12
|
+
return join(root, "threads", id);
|
|
13
|
+
}
|
|
14
|
+
function cursorSdkRunsNdjsonPath(threadId) {
|
|
15
|
+
return join(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
16
|
+
}
|
|
17
|
+
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
18
|
+
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
19
|
+
const shared = cursorSdkRunsNdjsonPath(null);
|
|
20
|
+
if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
|
|
21
|
+
return [shared];
|
|
22
|
+
}
|
|
23
|
+
return [scoped, shared];
|
|
24
|
+
}
|
|
25
|
+
function sanitizeCursorStoreSegment(threadId) {
|
|
26
|
+
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
cursorSdkStoreDir,
|
|
31
|
+
cursorSdkRunsNdjsonSearchPaths
|
|
32
|
+
};
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-EKIDHL2T.js";
|
|
8
8
|
import {
|
|
9
9
|
isOrchestratorThread
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4WV7C7WP.js";
|
|
11
11
|
import {
|
|
12
12
|
applyAgentRunnerHeapEnv,
|
|
13
13
|
applyNodeLaunch,
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
packagedMcpStdioPath,
|
|
21
21
|
parseCursorRunnerLine,
|
|
22
22
|
resolveNodeLaunch
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NZBDVBCP.js";
|
|
24
24
|
import {
|
|
25
25
|
codexUnattendedGitConfigArgs,
|
|
26
26
|
mergeAgentGitAuthEnv,
|
|
27
27
|
resolveAgentGitAuthEnv,
|
|
28
28
|
resolveCodexGitWritableRoots
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-VGPLXQIH.js";
|
|
30
30
|
import {
|
|
31
31
|
claudeChromeEnabled,
|
|
32
32
|
loadAppSettings,
|
|
@@ -1595,7 +1595,7 @@ var claudeAdapter = {
|
|
|
1595
1595
|
);
|
|
1596
1596
|
}
|
|
1597
1597
|
const mode = permissionMode(thread);
|
|
1598
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
1598
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-SBKXKQFS.js");
|
|
1599
1599
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1600
1600
|
const injectedServers = await buildInjectedMcpServers({
|
|
1601
1601
|
includeSideboard: true,
|
|
@@ -2295,6 +2295,7 @@ var cursorAdapter = {
|
|
|
2295
2295
|
const req = {
|
|
2296
2296
|
prompt,
|
|
2297
2297
|
cwd: thread.worktreePath,
|
|
2298
|
+
threadId: thread.id,
|
|
2298
2299
|
agentId,
|
|
2299
2300
|
model: thread.model,
|
|
2300
2301
|
effort: thread.effort,
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
enrichWorkspacesWithGithub,
|
|
8
8
|
ensureGlobalCoordinatorCwd,
|
|
9
9
|
formatWorkspaceInventory
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-X3NIPGQT.js";
|
|
11
|
+
import "./chunk-VGPLXQIH.js";
|
|
12
12
|
import "./chunk-FKOIHGKV.js";
|
|
13
13
|
import "./chunk-4NR5FL46.js";
|
|
14
14
|
import "./chunk-4TR3HZFT.js";
|
|
15
15
|
import "./chunk-JT7R45JB.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-HPAWHIZ3.js";
|
|
17
17
|
import "./chunk-77WWLBCI.js";
|
|
18
18
|
import "./chunk-QZQEXME2.js";
|
|
19
19
|
import "./chunk-DVM4ID64.js";
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
enrichWorkspacesWithGithub,
|
|
10
10
|
ensureGlobalCoordinatorCwd,
|
|
11
11
|
formatWorkspaceInventory
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XTZQL7OU.js";
|
|
13
|
+
import "./chunk-WCU3FHEI.js";
|
|
14
14
|
import "./chunk-B3SJXYIJ.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-RG737OWT.js";
|
|
16
16
|
import "./chunk-KPIYENTF.js";
|
|
17
17
|
import "./chunk-SGEVS5SY.js";
|
|
18
18
|
import "./chunk-NSTQ6QKD.js";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
appDataDir
|
|
5
|
+
} from "./chunk-BD2ICC4D.js";
|
|
6
|
+
|
|
7
|
+
// src/agents/cursor-recover.ts
|
|
8
|
+
import { existsSync, readFileSync } from "fs";
|
|
9
|
+
|
|
10
|
+
// src/agents/cursor-store.ts
|
|
11
|
+
import { join } from "path";
|
|
12
|
+
var CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
13
|
+
function cursorSdkStoreDir(threadId) {
|
|
14
|
+
const root = join(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
15
|
+
const id = sanitizeCursorStoreSegment(threadId);
|
|
16
|
+
if (!id) return root;
|
|
17
|
+
return join(root, "threads", id);
|
|
18
|
+
}
|
|
19
|
+
function cursorSdkRunsNdjsonPath(threadId) {
|
|
20
|
+
return join(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
21
|
+
}
|
|
22
|
+
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
23
|
+
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
24
|
+
const shared = cursorSdkRunsNdjsonPath(null);
|
|
25
|
+
if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
|
|
26
|
+
return [shared];
|
|
27
|
+
}
|
|
28
|
+
return [scoped, shared];
|
|
29
|
+
}
|
|
30
|
+
function sanitizeCursorStoreSegment(threadId) {
|
|
31
|
+
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/agents/cursor-recover.ts
|
|
35
|
+
function recoverFinishedCursorRun(opts) {
|
|
36
|
+
const agentId = opts.agentId.trim();
|
|
37
|
+
if (!agentId) return null;
|
|
38
|
+
let best = null;
|
|
39
|
+
for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
|
|
40
|
+
const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
|
|
41
|
+
if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
|
|
42
|
+
}
|
|
43
|
+
return best;
|
|
44
|
+
}
|
|
45
|
+
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
46
|
+
if (!existsSync(runsPath)) return null;
|
|
47
|
+
try {
|
|
48
|
+
const lines = readFileSync(runsPath, "utf8").split("\n");
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
const trimmed = line.trim();
|
|
52
|
+
if (!trimmed) continue;
|
|
53
|
+
let row;
|
|
54
|
+
try {
|
|
55
|
+
row = JSON.parse(trimmed);
|
|
56
|
+
} catch {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (row.agentId !== agentId) continue;
|
|
60
|
+
if (row.status !== "finished") continue;
|
|
61
|
+
if (typeof row.result !== "string" || !row.result.trim()) continue;
|
|
62
|
+
const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
|
|
63
|
+
const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
|
|
64
|
+
if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
|
|
65
|
+
if (!best || endedAt >= best.endedAt) {
|
|
66
|
+
best = { runId: row.runId || "", result: row.result.trim(), endedAt };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return best;
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
recoverFinishedCursorRun
|
|
76
|
+
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
2
|
+
cursorSdkRunsNdjsonSearchPaths
|
|
3
|
+
} from "./chunk-VHX673DI.js";
|
|
4
|
+
import "./chunk-QZQEXME2.js";
|
|
6
5
|
|
|
7
6
|
// src/agents/cursor-recover.ts
|
|
8
7
|
import { existsSync, readFileSync } from "fs";
|
|
9
|
-
import { join } from "path";
|
|
10
8
|
function recoverFinishedCursorRun(opts) {
|
|
11
9
|
const agentId = opts.agentId.trim();
|
|
12
10
|
if (!agentId) return null;
|
|
13
|
-
|
|
11
|
+
let best = null;
|
|
12
|
+
for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
|
|
13
|
+
const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
|
|
14
|
+
if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
|
|
15
|
+
}
|
|
16
|
+
return best;
|
|
17
|
+
}
|
|
18
|
+
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
14
19
|
if (!existsSync(runsPath)) return null;
|
|
15
20
|
try {
|
|
16
21
|
const lines = readFileSync(runsPath, "utf8").split("\n");
|
|
@@ -29,7 +34,7 @@ function recoverFinishedCursorRun(opts) {
|
|
|
29
34
|
if (typeof row.result !== "string" || !row.result.trim()) continue;
|
|
30
35
|
const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
|
|
31
36
|
const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
|
|
32
|
-
if (createdAt <
|
|
37
|
+
if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
|
|
33
38
|
if (!best || endedAt >= best.endedAt) {
|
|
34
39
|
best = { runId: row.runId || "", result: row.result.trim(), endedAt };
|
|
35
40
|
}
|
|
@@ -15,14 +15,14 @@ import {
|
|
|
15
15
|
orchestratorSessionPoisonedByBuiltins,
|
|
16
16
|
slackCoordinatorSourceRef,
|
|
17
17
|
takenTeamSlugsForOrchestration
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-4WV7C7WP.js";
|
|
19
|
+
import "./chunk-X3NIPGQT.js";
|
|
20
|
+
import "./chunk-VGPLXQIH.js";
|
|
21
21
|
import "./chunk-FKOIHGKV.js";
|
|
22
22
|
import "./chunk-4NR5FL46.js";
|
|
23
23
|
import "./chunk-4TR3HZFT.js";
|
|
24
24
|
import "./chunk-JT7R45JB.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-HPAWHIZ3.js";
|
|
26
26
|
import "./chunk-77WWLBCI.js";
|
|
27
27
|
import {
|
|
28
28
|
globalAgentCwd
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
orchestratorSessionPoisonedByBuiltins,
|
|
18
18
|
slackCoordinatorSourceRef,
|
|
19
19
|
takenTeamSlugsForOrchestration
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-4NAW5BAQ.js";
|
|
21
|
+
import "./chunk-XTZQL7OU.js";
|
|
22
|
+
import "./chunk-WCU3FHEI.js";
|
|
23
23
|
import "./chunk-B3SJXYIJ.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-RG737OWT.js";
|
|
25
25
|
import "./chunk-KPIYENTF.js";
|
|
26
26
|
import "./chunk-SGEVS5SY.js";
|
|
27
27
|
import "./chunk-NSTQ6QKD.js";
|