@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.
- package/dist/agents/cursor-runner.cjs +74 -59
- package/dist/agents/cursor-runner.js +10 -9
- package/dist/{agents-7NIX44RB.js → agents-HOIXQEP5.js} +6 -6
- package/dist/{agents-DU7DHY7A.js → agents-XTABRYO5.js} +5 -5
- package/dist/{chunk-4HOFVKPC.js → chunk-4LRPW6QM.js} +43 -19
- 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-AFM6442E.js} +44 -20
- 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-5KSLD4MU.js → chunk-QI7VC4EG.js} +92 -62
- package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
- package/dist/{chunk-OFF5AFCR.js → chunk-TDNM7QZJ.js} +92 -62
- 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/{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 +388 -285
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +10 -8
- package/dist/mcp/run-stdio.cjs +383 -282
- package/dist/mcp/run-stdio.js +7 -7
- package/dist/{orchestrator-NXPANCZA.js → orchestrator-3LJIG6XG.js} +7 -7
- package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-NWNKWZLB.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
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
} from "./chunk-YMRT2DU6.js";
|
|
10
10
|
import {
|
|
11
11
|
isOrchestratorThread
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4NAW5BAQ.js";
|
|
13
13
|
import {
|
|
14
14
|
codexUnattendedGitConfigArgs,
|
|
15
15
|
mergeAgentGitAuthEnv,
|
|
16
16
|
resolveAgentGitAuthEnv,
|
|
17
17
|
resolveCodexGitWritableRoots
|
|
18
|
-
} from "./chunk-
|
|
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;
|
|
@@ -903,6 +903,11 @@ function parseDiffStat(result) {
|
|
|
903
903
|
}
|
|
904
904
|
return {};
|
|
905
905
|
}
|
|
906
|
+
function withPartTimes(next, prev) {
|
|
907
|
+
const now = Date.now();
|
|
908
|
+
const startedAt = prev && typeof prev.startedAt === "number" ? prev.startedAt : now;
|
|
909
|
+
return { ...next, startedAt, updatedAt: now };
|
|
910
|
+
}
|
|
906
911
|
function applyAgentEvent(parts, event) {
|
|
907
912
|
if (event.type === "stdout") {
|
|
908
913
|
const data = event.data;
|
|
@@ -910,17 +915,22 @@ function applyAgentEvent(parts, event) {
|
|
|
910
915
|
const next = [...parts];
|
|
911
916
|
const last = next[next.length - 1];
|
|
912
917
|
if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
|
|
913
|
-
next[next.length - 1] =
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
+
next[next.length - 1] = withPartTimes(
|
|
919
|
+
{
|
|
920
|
+
type: "text",
|
|
921
|
+
text: last.text + data,
|
|
922
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
923
|
+
},
|
|
924
|
+
last
|
|
925
|
+
);
|
|
918
926
|
} else {
|
|
919
|
-
next.push(
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
927
|
+
next.push(
|
|
928
|
+
withPartTimes({
|
|
929
|
+
type: "text",
|
|
930
|
+
text: data,
|
|
931
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
932
|
+
})
|
|
933
|
+
);
|
|
924
934
|
}
|
|
925
935
|
return next;
|
|
926
936
|
}
|
|
@@ -932,34 +942,44 @@ function applyAgentEvent(parts, event) {
|
|
|
932
942
|
for (let i = next.length - 1; i >= 0; i--) {
|
|
933
943
|
const prev = next[i];
|
|
934
944
|
if (prev?.type === "thinking" && sameParentId(prev.parentId, event.parentId)) {
|
|
935
|
-
next[i] =
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
945
|
+
next[i] = withPartTimes(
|
|
946
|
+
{
|
|
947
|
+
type: "thinking",
|
|
948
|
+
text: data,
|
|
949
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
950
|
+
},
|
|
951
|
+
prev
|
|
952
|
+
);
|
|
940
953
|
return next;
|
|
941
954
|
}
|
|
942
955
|
}
|
|
943
|
-
next.push(
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
956
|
+
next.push(
|
|
957
|
+
withPartTimes({
|
|
958
|
+
type: "thinking",
|
|
959
|
+
text: data,
|
|
960
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
961
|
+
})
|
|
962
|
+
);
|
|
948
963
|
return next;
|
|
949
964
|
}
|
|
950
965
|
const last = next[next.length - 1];
|
|
951
966
|
if (last?.type === "thinking" && sameParentId(last.parentId, event.parentId)) {
|
|
952
|
-
next[next.length - 1] =
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
967
|
+
next[next.length - 1] = withPartTimes(
|
|
968
|
+
{
|
|
969
|
+
type: "thinking",
|
|
970
|
+
text: last.text + data,
|
|
971
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
972
|
+
},
|
|
973
|
+
last
|
|
974
|
+
);
|
|
957
975
|
} else {
|
|
958
|
-
next.push(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
976
|
+
next.push(
|
|
977
|
+
withPartTimes({
|
|
978
|
+
type: "thinking",
|
|
979
|
+
text: data,
|
|
980
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
981
|
+
})
|
|
982
|
+
);
|
|
963
983
|
}
|
|
964
984
|
return next;
|
|
965
985
|
}
|
|
@@ -975,22 +995,25 @@ function applyAgentEvent(parts, event) {
|
|
|
975
995
|
...input ?? {}
|
|
976
996
|
};
|
|
977
997
|
const mergedRecord = Object.keys(mergedInput).length > 0 ? mergedInput : void 0;
|
|
978
|
-
next[existing] =
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
998
|
+
next[existing] = withPartTimes(
|
|
999
|
+
{
|
|
1000
|
+
...prev,
|
|
1001
|
+
name: event.name || prev.name,
|
|
1002
|
+
input: mergedRecord,
|
|
1003
|
+
description: toolDescription(event.name || prev.name, mergedRecord),
|
|
1004
|
+
detail: toolDetail(event.name || prev.name, mergedRecord) ?? prev.detail,
|
|
1005
|
+
filePath: toolFilePath(mergedRecord) ?? prev.filePath,
|
|
1006
|
+
additions: diff.additions ?? prev.additions,
|
|
1007
|
+
deletions: diff.deletions ?? prev.deletions,
|
|
1008
|
+
parentId: event.parentId ?? prev.parentId
|
|
1009
|
+
},
|
|
1010
|
+
prev
|
|
1011
|
+
);
|
|
989
1012
|
return next;
|
|
990
1013
|
}
|
|
991
1014
|
return [
|
|
992
1015
|
...parts,
|
|
993
|
-
{
|
|
1016
|
+
withPartTimes({
|
|
994
1017
|
type: "tool",
|
|
995
1018
|
id: event.id,
|
|
996
1019
|
name: event.name,
|
|
@@ -1001,7 +1024,7 @@ function applyAgentEvent(parts, event) {
|
|
|
1001
1024
|
filePath: toolFilePath(input),
|
|
1002
1025
|
...event.parentId ? { parentId: event.parentId } : {},
|
|
1003
1026
|
...diff
|
|
1004
|
-
}
|
|
1027
|
+
})
|
|
1005
1028
|
];
|
|
1006
1029
|
}
|
|
1007
1030
|
if (event.type === "tool_result") {
|
|
@@ -1011,7 +1034,7 @@ function applyAgentEvent(parts, event) {
|
|
|
1011
1034
|
if (existing < 0) {
|
|
1012
1035
|
return [
|
|
1013
1036
|
...parts,
|
|
1014
|
-
{
|
|
1037
|
+
withPartTimes({
|
|
1015
1038
|
type: "tool",
|
|
1016
1039
|
id: event.id,
|
|
1017
1040
|
name: "tool",
|
|
@@ -1019,22 +1042,25 @@ function applyAgentEvent(parts, event) {
|
|
|
1019
1042
|
status: event.isError ? "error" : "running",
|
|
1020
1043
|
result: event.content,
|
|
1021
1044
|
...event.parentId ? { parentId: event.parentId } : {}
|
|
1022
|
-
}
|
|
1045
|
+
})
|
|
1023
1046
|
];
|
|
1024
1047
|
}
|
|
1025
1048
|
return parts.map((p, i) => {
|
|
1026
1049
|
if (i !== existing || p.type !== "tool") return p;
|
|
1027
1050
|
if (p.status === "done" || p.status === "error") return p;
|
|
1028
|
-
return
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1051
|
+
return withPartTimes(
|
|
1052
|
+
{
|
|
1053
|
+
...p,
|
|
1054
|
+
result: event.content ?? p.result
|
|
1055
|
+
},
|
|
1056
|
+
p
|
|
1057
|
+
);
|
|
1032
1058
|
});
|
|
1033
1059
|
}
|
|
1034
1060
|
if (existing < 0) {
|
|
1035
1061
|
return [
|
|
1036
1062
|
...parts,
|
|
1037
|
-
{
|
|
1063
|
+
withPartTimes({
|
|
1038
1064
|
type: "tool",
|
|
1039
1065
|
id: event.id,
|
|
1040
1066
|
name: "tool",
|
|
@@ -1044,18 +1070,21 @@ function applyAgentEvent(parts, event) {
|
|
|
1044
1070
|
...event.parentId ? { parentId: event.parentId } : {},
|
|
1045
1071
|
...fromResult.additions != null ? { additions: fromResult.additions } : {},
|
|
1046
1072
|
...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
|
|
1047
|
-
}
|
|
1073
|
+
})
|
|
1048
1074
|
];
|
|
1049
1075
|
}
|
|
1050
1076
|
return parts.map((p, i) => {
|
|
1051
1077
|
if (i !== existing || p.type !== "tool") return p;
|
|
1052
|
-
return
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1078
|
+
return withPartTimes(
|
|
1079
|
+
{
|
|
1080
|
+
...p,
|
|
1081
|
+
status: event.isError ? "error" : "done",
|
|
1082
|
+
result: event.content,
|
|
1083
|
+
...fromResult.additions != null ? { additions: fromResult.additions } : {},
|
|
1084
|
+
...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
|
|
1085
|
+
},
|
|
1086
|
+
p
|
|
1087
|
+
);
|
|
1059
1088
|
});
|
|
1060
1089
|
}
|
|
1061
1090
|
return parts;
|
|
@@ -1913,7 +1942,7 @@ var claudeAdapter = {
|
|
|
1913
1942
|
);
|
|
1914
1943
|
}
|
|
1915
1944
|
const mode = permissionMode(thread);
|
|
1916
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
1945
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-Z37MNYU6.js");
|
|
1917
1946
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1918
1947
|
const injectedServers = await buildInjectedMcpServers({
|
|
1919
1948
|
includeSideboard: true,
|
|
@@ -2854,6 +2883,7 @@ var cursorAdapter = {
|
|
|
2854
2883
|
const req = {
|
|
2855
2884
|
prompt,
|
|
2856
2885
|
cwd: thread.worktreePath,
|
|
2886
|
+
threadId: thread.id,
|
|
2857
2887
|
agentId,
|
|
2858
2888
|
model: thread.model,
|
|
2859
2889
|
effort: thread.effort,
|
|
@@ -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,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";
|