@sideboard-ai/core 0.1.110 → 0.1.115
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 +32 -23
- package/dist/agents/cursor-runner.js +3 -3
- package/dist/{agents-WK54VP7J.js → agents-3X3EFCQY.js} +7 -7
- package/dist/{agents-MQDW3YXL.js → agents-AHAFC6FR.js} +10 -10
- package/dist/{chunk-4EWPKYOU.js → chunk-4OJMZ6P2.js} +2 -2
- package/dist/{chunk-VOJSO3RM.js → chunk-66XTXHR3.js} +277 -49
- package/dist/{chunk-KQBI5HNT.js → chunk-7WC5UWEB.js} +2 -2
- package/dist/{chunk-WIHKHR5R.js → chunk-AXQ4ZWHK.js} +5 -0
- package/dist/{chunk-RSIWPLRG.js → chunk-C6OBY6IC.js} +268 -27
- package/dist/{chunk-EAAB4EK5.js → chunk-DCNR7NAL.js} +44 -32
- package/dist/{chunk-LGXBYZZA.js → chunk-DVM4ID64.js} +69 -13
- package/dist/{chunk-2GO3YKBA.js → chunk-EKIDHL2T.js} +4 -4
- package/dist/{chunk-C4KHDW3U.js → chunk-FZCIQYNQ.js} +1 -1
- package/dist/{chunk-7KWYXGIU.js → chunk-K3TIQXOH.js} +2 -2
- package/dist/{chunk-3KETJKYA.js → chunk-KPIYENTF.js} +69 -13
- package/dist/{chunk-XOZDAVOP.js → chunk-MZ6HJ7VL.js} +52 -35
- package/dist/{chunk-3UOKB6VQ.js → chunk-SLU5JVKD.js} +282 -228
- package/dist/{chunk-VOD3HFLP.js → chunk-XOYQ7LNQ.js} +2 -2
- package/dist/{chunk-7YKXHBIW.js → chunk-YMRT2DU6.js} +3 -3
- package/dist/{chunk-YXDR43ZC.js → chunk-ZMROW673.js} +5 -5
- package/dist/{chunk-YFAXVUY2.js → chunk-ZRCX43LS.js} +2 -2
- package/dist/{chunk-AROMOP3C.js → chunk-ZYEFCSZJ.js} +2 -2
- package/dist/{connected-teams-M5XNXRI5.js → connected-teams-O6D4PM7A.js} +2 -2
- package/dist/{connected-teams-J4I5AKMR.js → connected-teams-ZCOU6KCD.js} +2 -2
- package/dist/{coordinator-prompt-AR66L3N4.js → coordinator-prompt-4KCALEKD.js} +3 -3
- package/dist/{coordinator-prompt-BHMLWL64.js → coordinator-prompt-FML4I5AR.js} +3 -3
- package/dist/{global-workspace-XSUFEIAQ.js → global-workspace-CSWABOG5.js} +4 -4
- package/dist/{global-workspace-SKFODUQQ.js → global-workspace-H4YNASM6.js} +4 -4
- package/dist/index.cjs +825 -443
- package/dist/index.d.cts +53 -1
- package/dist/index.d.ts +53 -1
- package/dist/index.js +33 -15
- package/dist/mcp/run-stdio.cjs +947 -644
- package/dist/mcp/run-stdio.js +18 -14
- package/dist/{orchestrator-SCATSB3O.js → orchestrator-GKLYKLRC.js} +8 -8
- package/dist/{orchestrator-FCZVCKBK.js → orchestrator-TXASYNHT.js} +10 -10
- package/dist/{run-XKTAJRWF.js → run-USF6FRKV.js} +3 -1
- package/dist/{run-CFKZPY7F.js → run-XQKGHQZ2.js} +3 -1
- package/dist/{workspaces-XAQVKTLO.js → workspaces-HJ3EVATC.js} +5 -5
- package/dist/{workspaces-HV3J4TTW.js → workspaces-QG6PGFQR.js} +5 -5
- package/dist/{worktree-XFJED3VU.js → worktree-IW3BX26B.js} +2 -2
- package/dist/{worktree-N2EV24EE.js → worktree-OTFQO2W7.js} +2 -2
- package/package.json +1 -1
|
@@ -96,6 +96,34 @@ function withExportedPath(command, pathValue) {
|
|
|
96
96
|
return `export PATH=${posixShellSingleQuote(pathValue)} && ${trimmed}`;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// src/git/stale-lock.ts
|
|
100
|
+
import { existsSync as existsSync2, statSync, unlinkSync } from "fs";
|
|
101
|
+
import { join as join2 } from "path";
|
|
102
|
+
var STALE_INDEX_LOCK_MS = 2e4;
|
|
103
|
+
function isIndexLockError(text) {
|
|
104
|
+
return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text);
|
|
105
|
+
}
|
|
106
|
+
function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
|
|
107
|
+
const lockPath = join2(gitDir, "index.lock");
|
|
108
|
+
try {
|
|
109
|
+
if (!existsSync2(lockPath)) return null;
|
|
110
|
+
if (now - statSync(lockPath).mtimeMs < maxAgeMs) return null;
|
|
111
|
+
unlinkSync(lockPath);
|
|
112
|
+
return lockPath;
|
|
113
|
+
} catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
|
|
118
|
+
const now = Date.now();
|
|
119
|
+
const removed = [];
|
|
120
|
+
for (const dir of new Set(gitDirs)) {
|
|
121
|
+
const cleared = clearStaleIndexLock(dir, maxAgeMs, now);
|
|
122
|
+
if (cleared) removed.push(cleared);
|
|
123
|
+
}
|
|
124
|
+
return removed;
|
|
125
|
+
}
|
|
126
|
+
|
|
99
127
|
// src/git/run.ts
|
|
100
128
|
async function run(file, args, opts) {
|
|
101
129
|
ensureAgentPath();
|
|
@@ -123,6 +151,21 @@ async function run(file, args, opts) {
|
|
|
123
151
|
throw err;
|
|
124
152
|
}
|
|
125
153
|
}
|
|
154
|
+
async function resolveGitDirsForLockRecovery(cwd, env = {}) {
|
|
155
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
156
|
+
const [gitDir, commonDir] = await Promise.all([
|
|
157
|
+
run("git", ["rev-parse", "--absolute-git-dir"], { cwd, reject: false, env, timeoutMs: 5e3 }),
|
|
158
|
+
run("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
|
|
159
|
+
cwd,
|
|
160
|
+
reject: false,
|
|
161
|
+
env,
|
|
162
|
+
timeoutMs: 5e3
|
|
163
|
+
})
|
|
164
|
+
]);
|
|
165
|
+
if (gitDir.exitCode === 0 && gitDir.stdout.trim()) dirs.add(gitDir.stdout.trim());
|
|
166
|
+
if (commonDir.exitCode === 0 && commonDir.stdout.trim()) dirs.add(commonDir.stdout.trim());
|
|
167
|
+
return [...dirs];
|
|
168
|
+
}
|
|
126
169
|
async function git(args, cwd, opts) {
|
|
127
170
|
const prefix = [];
|
|
128
171
|
if (opts?.config) {
|
|
@@ -131,21 +174,32 @@ async function git(args, cwd, opts) {
|
|
|
131
174
|
prefix.push("-c", `${key}=${value}`);
|
|
132
175
|
}
|
|
133
176
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
reject: opts?.reject,
|
|
137
|
-
timeoutMs: opts?.timeoutMs,
|
|
177
|
+
const gitArgs = ["--no-pager", ...prefix, ...args];
|
|
178
|
+
const env = {
|
|
138
179
|
// Never block forever on a credential/SSH prompt inside MCP / Electron.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
180
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
181
|
+
GIT_ASKPASS: process.env.GIT_ASKPASS || "echo",
|
|
182
|
+
SSH_ASKPASS: process.env.SSH_ASKPASS || "echo",
|
|
183
|
+
GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes -o ConnectTimeout=15",
|
|
184
|
+
GCM_INTERACTIVE: "never",
|
|
185
|
+
GH_PROMPT_DISABLED: "1",
|
|
186
|
+
...opts?.env
|
|
187
|
+
};
|
|
188
|
+
let result = await run("git", gitArgs, { cwd, reject: false, timeoutMs: opts?.timeoutMs, env });
|
|
189
|
+
if (result.exitCode !== 0 && isIndexLockError(result.stderr)) {
|
|
190
|
+
const gitDirs = await resolveGitDirsForLockRecovery(cwd, env);
|
|
191
|
+
const cleared = clearStaleIndexLocks(gitDirs);
|
|
192
|
+
if (cleared.length > 0) {
|
|
193
|
+
result = await run("git", gitArgs, { cwd, reject: false, timeoutMs: opts?.timeoutMs, env });
|
|
147
194
|
}
|
|
148
|
-
}
|
|
195
|
+
}
|
|
196
|
+
if ((opts?.reject ?? true) && result.exitCode !== 0) {
|
|
197
|
+
throw new Error(
|
|
198
|
+
`Command failed with exit code ${result.exitCode}: git ${gitArgs.join(" ")}
|
|
199
|
+
${result.stderr}`
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return result;
|
|
149
203
|
}
|
|
150
204
|
async function gh(args, cwd, opts) {
|
|
151
205
|
return run("gh", args, {
|
|
@@ -173,7 +227,9 @@ export {
|
|
|
173
227
|
posixShellSingleQuote,
|
|
174
228
|
resolveCommandBinarySync,
|
|
175
229
|
withExportedPath,
|
|
230
|
+
clearStaleIndexLocks,
|
|
176
231
|
run,
|
|
232
|
+
resolveGitDirsForLockRecovery,
|
|
177
233
|
git,
|
|
178
234
|
gh,
|
|
179
235
|
resolveGhAuthToken
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-QZQEXME2.js";
|
|
4
4
|
import {
|
|
5
5
|
run
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DVM4ID64.js";
|
|
7
7
|
|
|
8
8
|
// src/brightsy/connected-teams.ts
|
|
9
9
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -36,7 +36,7 @@ function saveBrightsyConfig(cfg) {
|
|
|
36
36
|
|
|
37
37
|
// src/brightsy/accounts.ts
|
|
38
38
|
async function loadConnectedTeams() {
|
|
39
|
-
const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-
|
|
39
|
+
const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-ZCOU6KCD.js");
|
|
40
40
|
return listConnectedBrightsyTeams2();
|
|
41
41
|
}
|
|
42
42
|
async function runBrightsyTeamsJson(args) {
|
|
@@ -68,7 +68,7 @@ async function getBrightsySession() {
|
|
|
68
68
|
const data = await runBrightsyTeamsJson([]);
|
|
69
69
|
const accounts = Array.isArray(data.teams) ? data.teams : [];
|
|
70
70
|
const active = data.active ?? accounts.find((a) => a.active) ?? null;
|
|
71
|
-
const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-
|
|
71
|
+
const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-ZCOU6KCD.js");
|
|
72
72
|
const connectedTeams = ensureCliTeamTracked2(
|
|
73
73
|
active ? { id: active.id, slug: active.slug, name: active.name } : void 0
|
|
74
74
|
);
|
|
@@ -108,7 +108,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
|
|
|
108
108
|
return { cfg, target: data.active };
|
|
109
109
|
}
|
|
110
110
|
async function switchBrightsyAccount(accountIdOrSlug) {
|
|
111
|
-
const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-
|
|
111
|
+
const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-ZCOU6KCD.js");
|
|
112
112
|
await connectBrightsyTeam2(accountIdOrSlug);
|
|
113
113
|
return getBrightsySession();
|
|
114
114
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4OJMZ6P2.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGhPreferOrigin,
|
|
6
6
|
resolveRepoRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FZCIQYNQ.js";
|
|
8
8
|
import {
|
|
9
9
|
appDataDir
|
|
10
10
|
} from "./chunk-QZQEXME2.js";
|
|
@@ -99,6 +99,34 @@ function withExportedPath(command, pathValue) {
|
|
|
99
99
|
return `export PATH=${posixShellSingleQuote(pathValue)} && ${trimmed}`;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
// src/git/stale-lock.ts
|
|
103
|
+
import { existsSync as existsSync2, statSync, unlinkSync } from "fs";
|
|
104
|
+
import { join as join2 } from "path";
|
|
105
|
+
var STALE_INDEX_LOCK_MS = 2e4;
|
|
106
|
+
function isIndexLockError(text) {
|
|
107
|
+
return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text);
|
|
108
|
+
}
|
|
109
|
+
function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
|
|
110
|
+
const lockPath = join2(gitDir, "index.lock");
|
|
111
|
+
try {
|
|
112
|
+
if (!existsSync2(lockPath)) return null;
|
|
113
|
+
if (now - statSync(lockPath).mtimeMs < maxAgeMs) return null;
|
|
114
|
+
unlinkSync(lockPath);
|
|
115
|
+
return lockPath;
|
|
116
|
+
} catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
|
|
121
|
+
const now = Date.now();
|
|
122
|
+
const removed = [];
|
|
123
|
+
for (const dir of new Set(gitDirs)) {
|
|
124
|
+
const cleared = clearStaleIndexLock(dir, maxAgeMs, now);
|
|
125
|
+
if (cleared) removed.push(cleared);
|
|
126
|
+
}
|
|
127
|
+
return removed;
|
|
128
|
+
}
|
|
129
|
+
|
|
102
130
|
// src/git/run.ts
|
|
103
131
|
async function run(file, args, opts) {
|
|
104
132
|
ensureAgentPath();
|
|
@@ -126,6 +154,21 @@ async function run(file, args, opts) {
|
|
|
126
154
|
throw err;
|
|
127
155
|
}
|
|
128
156
|
}
|
|
157
|
+
async function resolveGitDirsForLockRecovery(cwd, env = {}) {
|
|
158
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
159
|
+
const [gitDir, commonDir] = await Promise.all([
|
|
160
|
+
run("git", ["rev-parse", "--absolute-git-dir"], { cwd, reject: false, env, timeoutMs: 5e3 }),
|
|
161
|
+
run("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
|
|
162
|
+
cwd,
|
|
163
|
+
reject: false,
|
|
164
|
+
env,
|
|
165
|
+
timeoutMs: 5e3
|
|
166
|
+
})
|
|
167
|
+
]);
|
|
168
|
+
if (gitDir.exitCode === 0 && gitDir.stdout.trim()) dirs.add(gitDir.stdout.trim());
|
|
169
|
+
if (commonDir.exitCode === 0 && commonDir.stdout.trim()) dirs.add(commonDir.stdout.trim());
|
|
170
|
+
return [...dirs];
|
|
171
|
+
}
|
|
129
172
|
async function git(args, cwd, opts) {
|
|
130
173
|
const prefix = [];
|
|
131
174
|
if (opts?.config) {
|
|
@@ -134,21 +177,32 @@ async function git(args, cwd, opts) {
|
|
|
134
177
|
prefix.push("-c", `${key}=${value}`);
|
|
135
178
|
}
|
|
136
179
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
reject: opts?.reject,
|
|
140
|
-
timeoutMs: opts?.timeoutMs,
|
|
180
|
+
const gitArgs = ["--no-pager", ...prefix, ...args];
|
|
181
|
+
const env = {
|
|
141
182
|
// Never block forever on a credential/SSH prompt inside MCP / Electron.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
183
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
184
|
+
GIT_ASKPASS: process.env.GIT_ASKPASS || "echo",
|
|
185
|
+
SSH_ASKPASS: process.env.SSH_ASKPASS || "echo",
|
|
186
|
+
GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes -o ConnectTimeout=15",
|
|
187
|
+
GCM_INTERACTIVE: "never",
|
|
188
|
+
GH_PROMPT_DISABLED: "1",
|
|
189
|
+
...opts?.env
|
|
190
|
+
};
|
|
191
|
+
let result = await run("git", gitArgs, { cwd, reject: false, timeoutMs: opts?.timeoutMs, env });
|
|
192
|
+
if (result.exitCode !== 0 && isIndexLockError(result.stderr)) {
|
|
193
|
+
const gitDirs = await resolveGitDirsForLockRecovery(cwd, env);
|
|
194
|
+
const cleared = clearStaleIndexLocks(gitDirs);
|
|
195
|
+
if (cleared.length > 0) {
|
|
196
|
+
result = await run("git", gitArgs, { cwd, reject: false, timeoutMs: opts?.timeoutMs, env });
|
|
150
197
|
}
|
|
151
|
-
}
|
|
198
|
+
}
|
|
199
|
+
if ((opts?.reject ?? true) && result.exitCode !== 0) {
|
|
200
|
+
throw new Error(
|
|
201
|
+
`Command failed with exit code ${result.exitCode}: git ${gitArgs.join(" ")}
|
|
202
|
+
${result.stderr}`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
152
206
|
}
|
|
153
207
|
async function gh(args, cwd, opts) {
|
|
154
208
|
return run("gh", args, {
|
|
@@ -176,7 +230,9 @@ export {
|
|
|
176
230
|
posixShellSingleQuote,
|
|
177
231
|
resolveCommandBinarySync,
|
|
178
232
|
withExportedPath,
|
|
233
|
+
clearStaleIndexLocks,
|
|
179
234
|
run,
|
|
235
|
+
resolveGitDirsForLockRecovery,
|
|
180
236
|
git,
|
|
181
237
|
gh,
|
|
182
238
|
resolveGhAuthToken
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import {
|
|
4
4
|
PLAN_MODE_INSTRUCTION,
|
|
5
5
|
applyAgentEvent,
|
|
6
|
+
applyAgentRunnerHeapEnv,
|
|
6
7
|
applyTurnUsage,
|
|
7
8
|
contextTokens,
|
|
8
9
|
fallbackTurnFailDetail,
|
|
@@ -10,9 +11,12 @@ import {
|
|
|
10
11
|
formatTurnExitError,
|
|
11
12
|
getAdapter,
|
|
12
13
|
isBrightsyNdjsonLine,
|
|
14
|
+
isPollWrapperToolName,
|
|
13
15
|
isSessionQuotaLimit,
|
|
16
|
+
liveActivitySummary,
|
|
14
17
|
looksLikeAgentFailureMessage,
|
|
15
18
|
looksLikeInvalidAgentSession,
|
|
19
|
+
looksLikeV8Oom,
|
|
16
20
|
normalizeParseResult,
|
|
17
21
|
parseBrightsyCliLine,
|
|
18
22
|
parseSessionQuotaResetAt,
|
|
@@ -24,13 +28,13 @@ import {
|
|
|
24
28
|
summarizeTurnStderr,
|
|
25
29
|
toolDescription,
|
|
26
30
|
turnFailChatText
|
|
27
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-66XTXHR3.js";
|
|
28
32
|
import {
|
|
29
33
|
addWorkspace,
|
|
30
34
|
ensureWorkspace,
|
|
31
35
|
removeWorkspace,
|
|
32
36
|
syncWorkspacesFromThreads
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ZRCX43LS.js";
|
|
34
38
|
import {
|
|
35
39
|
extractPresentedPlan,
|
|
36
40
|
readPlanFile,
|
|
@@ -51,14 +55,14 @@ import {
|
|
|
51
55
|
isOrchestratorThread,
|
|
52
56
|
isSlackCoordinatorThread,
|
|
53
57
|
orchestratorSessionPoisonedByBuiltins
|
|
54
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-XOYQ7LNQ.js";
|
|
55
59
|
import {
|
|
56
60
|
SLACK_REPLY_FORMATTING,
|
|
57
61
|
coordinatorSystemPrompt,
|
|
58
62
|
coordinatorTurnReminder,
|
|
59
63
|
enrichWorkspacesWithGithub,
|
|
60
64
|
ensureGlobalCoordinatorCwd
|
|
61
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-ZYEFCSZJ.js";
|
|
62
66
|
import {
|
|
63
67
|
addPrStackLayer,
|
|
64
68
|
allocateTeamName,
|
|
@@ -101,7 +105,7 @@ import {
|
|
|
101
105
|
threadDisplayLabel,
|
|
102
106
|
withRepoGitLock,
|
|
103
107
|
worktreeNameFromPath
|
|
104
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-ZMROW673.js";
|
|
105
109
|
import {
|
|
106
110
|
ATTACHMENTS_DIR,
|
|
107
111
|
LEGACY_ATTACHMENTS_DIR,
|
|
@@ -119,6 +123,14 @@ import {
|
|
|
119
123
|
withThreadLock,
|
|
120
124
|
writeThread
|
|
121
125
|
} from "./chunk-KYOTBZ6S.js";
|
|
126
|
+
import {
|
|
127
|
+
clearStaleIndexLocks,
|
|
128
|
+
enrichPathWithNpmGlobalBin,
|
|
129
|
+
ensureAgentPath,
|
|
130
|
+
git,
|
|
131
|
+
resolveGitDirsForLockRecovery,
|
|
132
|
+
run
|
|
133
|
+
} from "./chunk-KPIYENTF.js";
|
|
122
134
|
import {
|
|
123
135
|
childEnvWithAppSettings,
|
|
124
136
|
isSecureFileEncrypted,
|
|
@@ -148,12 +160,6 @@ import {
|
|
|
148
160
|
workspaceSettingsSourceLabel,
|
|
149
161
|
worktreesRoot
|
|
150
162
|
} from "./chunk-BD2ICC4D.js";
|
|
151
|
-
import {
|
|
152
|
-
enrichPathWithNpmGlobalBin,
|
|
153
|
-
ensureAgentPath,
|
|
154
|
-
git,
|
|
155
|
-
run
|
|
156
|
-
} from "./chunk-3KETJKYA.js";
|
|
157
163
|
|
|
158
164
|
// src/orchestrator/orchestrator.ts
|
|
159
165
|
import { EventEmitter } from "events";
|
|
@@ -699,6 +705,11 @@ function createAgentStreamCoalescer(emit, opts) {
|
|
|
699
705
|
return;
|
|
700
706
|
}
|
|
701
707
|
if (!event.data) return;
|
|
708
|
+
if (event.type === "thinking" && event.replace) {
|
|
709
|
+
flush2();
|
|
710
|
+
emit(event);
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
702
713
|
if (pending && pending.type === event.type && parentKey(pending) === parentKey(event)) {
|
|
703
714
|
pending.data += event.data;
|
|
704
715
|
} else {
|
|
@@ -731,9 +742,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
731
742
|
`Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
|
|
732
743
|
);
|
|
733
744
|
}
|
|
734
|
-
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-
|
|
745
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H4YNASM6.js");
|
|
735
746
|
if (isGlobalThread2(thread)) {
|
|
736
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
747
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-FML4I5AR.js");
|
|
737
748
|
ensureGlobalCoordinatorCwd2(
|
|
738
749
|
isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
|
|
739
750
|
);
|
|
@@ -750,6 +761,7 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
750
761
|
}
|
|
751
762
|
const env = childEnvWithAppSettings(cmd.env);
|
|
752
763
|
applyPromptCacheTtlEnv(thread.agent, env);
|
|
764
|
+
applyAgentRunnerHeapEnv(env);
|
|
753
765
|
try {
|
|
754
766
|
if (isOrchestratorThread(thread)) {
|
|
755
767
|
mergeAgentGitAuthEnv(env, await resolveAgentGitAuthEnv(env));
|
|
@@ -2398,7 +2410,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
2398
2410
|
return readThread(thread.id) ?? thread;
|
|
2399
2411
|
}
|
|
2400
2412
|
async function listLinearIssues(agent, repoPath) {
|
|
2401
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
2413
|
+
const { getAdapter: getAdapter2 } = await import("./agents-AHAFC6FR.js");
|
|
2402
2414
|
await requireAgent(agent, { requireLinear: true });
|
|
2403
2415
|
const adapter = getAdapter2(agent);
|
|
2404
2416
|
if (!adapter.listLinearIssues) {
|
|
@@ -2446,21 +2458,13 @@ function summarizeTurnLive(parts) {
|
|
|
2446
2458
|
(p) => p.type === "tool"
|
|
2447
2459
|
);
|
|
2448
2460
|
const lastTool = tools[tools.length - 1];
|
|
2449
|
-
const
|
|
2450
|
-
const
|
|
2461
|
+
const interesting = [...tools].reverse().find((t) => !isPollWrapperToolName(t.name)) ?? lastTool;
|
|
2462
|
+
const lastToolLabel = interesting ? interesting.description || toolDescription(interesting.name, interesting.input) || interesting.name : void 0;
|
|
2451
2463
|
const thinking = lastText(parts, "thinking");
|
|
2452
2464
|
const text = lastText(parts, "text");
|
|
2453
2465
|
const excerptRaw = thinking || text;
|
|
2454
2466
|
const excerpt = excerptRaw.length > 280 ? `${excerptRaw.slice(-280)}` : excerptRaw || void 0;
|
|
2455
|
-
|
|
2456
|
-
if (lastToolLabel) {
|
|
2457
|
-
const verb = running ? lastToolLabel : `Finished ${lastToolLabel}`;
|
|
2458
|
-
summary = tools.length > 1 ? `${verb} (${tools.length} tools)` : verb;
|
|
2459
|
-
} else if (thinking) {
|
|
2460
|
-
summary = "Thinking\u2026";
|
|
2461
|
-
} else if (text) {
|
|
2462
|
-
summary = "Writing reply\u2026";
|
|
2463
|
-
}
|
|
2467
|
+
const summary = liveActivitySummary(parts);
|
|
2464
2468
|
return {
|
|
2465
2469
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2466
2470
|
summary,
|
|
@@ -2710,8 +2714,12 @@ var CONDUCTOR_APP_SUPPORT = join9(
|
|
|
2710
2714
|
);
|
|
2711
2715
|
var CONDUCTOR_DB = join9(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
2712
2716
|
var CURSOR_SDK_STORE = join9(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
2717
|
+
function thisModuleFile() {
|
|
2718
|
+
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
2719
|
+
return cjsFile || process.argv[1] || join9(process.cwd(), "package.json");
|
|
2720
|
+
}
|
|
2713
2721
|
function openReadonlySqlite(file) {
|
|
2714
|
-
const req = createRequire(
|
|
2722
|
+
const req = createRequire(thisModuleFile());
|
|
2715
2723
|
const Database = req("better-sqlite3");
|
|
2716
2724
|
return new Database(file, { readonly: true, fileMustExist: true });
|
|
2717
2725
|
}
|
|
@@ -2768,7 +2776,7 @@ async function adoptThread(input) {
|
|
|
2768
2776
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
2769
2777
|
}
|
|
2770
2778
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
2771
|
-
const { stdout: branch } = await import("./run-
|
|
2779
|
+
const { stdout: branch } = await import("./run-USF6FRKV.js").then(
|
|
2772
2780
|
({ git: git2 }) => git2(["rev-parse", "--abbrev-ref", "HEAD"], input.worktreePath)
|
|
2773
2781
|
);
|
|
2774
2782
|
const thread = createEmptyThread({
|
|
@@ -2783,7 +2791,7 @@ async function adoptThread(input) {
|
|
|
2783
2791
|
messages: input.messages ?? []
|
|
2784
2792
|
});
|
|
2785
2793
|
writeThread(thread);
|
|
2786
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
2794
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HJ3EVATC.js");
|
|
2787
2795
|
await ensureWorkspace2(repoPath);
|
|
2788
2796
|
return thread;
|
|
2789
2797
|
}
|
|
@@ -4080,7 +4088,7 @@ async function confirmLand(thread, opts) {
|
|
|
4080
4088
|
if (preview.dirty) {
|
|
4081
4089
|
committed = await commitAll(thread.worktreePath, meta.commitMessage);
|
|
4082
4090
|
}
|
|
4083
|
-
const { git: git2 } = await import("./run-
|
|
4091
|
+
const { git: git2 } = await import("./run-USF6FRKV.js");
|
|
4084
4092
|
const { stdout: headOut } = await git2(
|
|
4085
4093
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
4086
4094
|
thread.worktreePath,
|
|
@@ -4929,7 +4937,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
4929
4937
|
${prompt}`;
|
|
4930
4938
|
}
|
|
4931
4939
|
async function defaultDeps() {
|
|
4932
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
4940
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-GKLYKLRC.js");
|
|
4933
4941
|
const orch = getOrchestrator2();
|
|
4934
4942
|
return {
|
|
4935
4943
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -5721,7 +5729,15 @@ var Orchestrator = class {
|
|
|
5721
5729
|
hasSession: Boolean(this.requireThread(threadId).sessionId)
|
|
5722
5730
|
})) {
|
|
5723
5731
|
updateThread(threadId, { sessionId: null });
|
|
5724
|
-
|
|
5732
|
+
try {
|
|
5733
|
+
const gitDirs = await resolveGitDirsForLockRecovery(thread.worktreePath);
|
|
5734
|
+
const clearedLocks = clearStaleIndexLocks(gitDirs, 2e3);
|
|
5735
|
+
if (clearedLocks.length > 0) {
|
|
5736
|
+
pushTurnStderr(stderrTail, "Cleared a stale git lock left by the crashed agent process");
|
|
5737
|
+
}
|
|
5738
|
+
} catch {
|
|
5739
|
+
}
|
|
5740
|
+
const retryNote = looksLikeInvalidAgentSession(detail) ? "Agent session missing \u2014 starting a fresh session" : looksLikeV8Oom(detail) ? "Agent ran out of memory \u2014 starting a fresh session" : "Agent runner crashed \u2014 restarting Node once";
|
|
5725
5741
|
pushTurnStderr(stderrTail, retryNote);
|
|
5726
5742
|
this.emit({
|
|
5727
5743
|
type: "turn_output",
|
|
@@ -6193,13 +6209,14 @@ var Orchestrator = class {
|
|
|
6193
6209
|
const text = (lastAgent?.text ?? "").trim() || (thread.status === "error" ? lastError ?? "" : "");
|
|
6194
6210
|
const stillRunning = thread.status === "running" || thread.status === "queued";
|
|
6195
6211
|
const live = stillRunning ? readTurnLive(thread.id) : null;
|
|
6212
|
+
const queuedHint = thread.status === "queued" && !live?.summary ? "Queued \u2014 waiting for a concurrency slot" : null;
|
|
6196
6213
|
return {
|
|
6197
6214
|
text,
|
|
6198
6215
|
status: thread.status,
|
|
6199
6216
|
sessionId: thread.sessionId,
|
|
6200
6217
|
lastError,
|
|
6201
6218
|
stillRunning,
|
|
6202
|
-
progress: live?.summary ??
|
|
6219
|
+
progress: live?.summary ?? queuedHint,
|
|
6203
6220
|
lastActivityAt: live?.updatedAt ?? null
|
|
6204
6221
|
};
|
|
6205
6222
|
}
|
|
@@ -6668,7 +6685,7 @@ var Orchestrator = class {
|
|
|
6668
6685
|
this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
|
|
6669
6686
|
if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
|
|
6670
6687
|
try {
|
|
6671
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
6688
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-HJ3EVATC.js");
|
|
6672
6689
|
await ensureWorkspace2(thread.repoPath);
|
|
6673
6690
|
} catch {
|
|
6674
6691
|
}
|
|
@@ -6722,7 +6739,7 @@ var Orchestrator = class {
|
|
|
6722
6739
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
6723
6740
|
);
|
|
6724
6741
|
}
|
|
6725
|
-
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-
|
|
6742
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-OTFQO2W7.js");
|
|
6726
6743
|
const slug = thread.worktreePath.split("/").pop();
|
|
6727
6744
|
const dest = thread.worktreePath;
|
|
6728
6745
|
await withRepoGitLock(thread.repoPath, async () => {
|
|
@@ -6830,7 +6847,7 @@ async function startOrchestration(opts) {
|
|
|
6830
6847
|
sourceRef: "default",
|
|
6831
6848
|
...createOpts
|
|
6832
6849
|
}).catch(async () => {
|
|
6833
|
-
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-
|
|
6850
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-OTFQO2W7.js");
|
|
6834
6851
|
const repo = await resolveRepoRoot2(repoPath);
|
|
6835
6852
|
const def = await resolveDefaultBranch2(repo);
|
|
6836
6853
|
return orch.createThread({
|