@sideboard-ai/core 0.1.10 → 0.1.15
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-OAX7XPKX.js → agents-RO3AJ76Q.js} +1 -1
- package/dist/{chunk-2M4OHXYX.js → chunk-3OJG4LP4.js} +2 -2
- package/dist/{chunk-LL7DTZ5B.js → chunk-L44AX7IG.js} +113 -24
- package/dist/{chunk-E4PWXO2C.js → chunk-MAWKQA2Y.js} +52 -23
- package/dist/{chunk-WMCPLDW3.js → chunk-MEI4AXV4.js} +1 -1
- package/dist/{chunk-TLJH3L2C.js → chunk-MGSJQMJA.js} +40 -4
- package/dist/{chunk-2R5VV4BA.js → chunk-TNIAXABV.js} +1 -1
- package/dist/{coordinator-prompt-6R2TX4WQ.js → coordinator-prompt-G6T7ORT3.js} +2 -2
- package/dist/{global-workspace-R44HGBU6.js → global-workspace-H642B5OI.js} +3 -3
- package/dist/index.cjs +205 -38
- package/dist/index.d.cts +70 -3
- package/dist/index.d.ts +70 -3
- package/dist/index.js +18 -6
- package/dist/mcp/run-stdio.cjs +185 -38
- package/dist/mcp/run-stdio.js +6 -6
- package/dist/{workspaces-TCJFYI35.js → workspaces-4EREGLB7.js} +4 -4
- package/dist/{worktree-NGFDN3J4.js → worktree-ZDHZMLSJ.js} +3 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureGlobalCoordinatorCwd
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TNIAXABV.js";
|
|
4
4
|
import {
|
|
5
5
|
allocateTeamName,
|
|
6
6
|
takenSlugsFromThread,
|
|
7
7
|
teamSlugFromName
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-L44AX7IG.js";
|
|
9
9
|
import {
|
|
10
10
|
createEmptyThread,
|
|
11
11
|
listThreads,
|
|
@@ -459,6 +459,54 @@ function worktreeDisplayLabelForGroup(threads) {
|
|
|
459
459
|
return threadDisplayLabel(canonical);
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
+
// src/git/gh-errors.ts
|
|
463
|
+
function isGhRateLimitError(text) {
|
|
464
|
+
return /API rate limit (already )?exceeded/i.test(text) || /rate limit exceeded/i.test(text);
|
|
465
|
+
}
|
|
466
|
+
function formatRateLimitResetHint(resetEpochSec, nowMs = Date.now()) {
|
|
467
|
+
const ms = resetEpochSec * 1e3 - nowMs;
|
|
468
|
+
if (ms <= 0) return "soon";
|
|
469
|
+
const mins = Math.max(1, Math.ceil(ms / 6e4));
|
|
470
|
+
if (mins < 60) {
|
|
471
|
+
return `in about ${mins} minute${mins === 1 ? "" : "s"}`;
|
|
472
|
+
}
|
|
473
|
+
const hours = Math.ceil(mins / 60);
|
|
474
|
+
return `in about ${hours} hour${hours === 1 ? "" : "s"}`;
|
|
475
|
+
}
|
|
476
|
+
function extractGhErrorDetail(text) {
|
|
477
|
+
const trimmed = text.trim();
|
|
478
|
+
if (!trimmed) return "";
|
|
479
|
+
const graphql = trimmed.match(/\bGraphQL:\s*(.+)$/im);
|
|
480
|
+
if (graphql?.[1]) return `GraphQL: ${graphql[1].trim()}`;
|
|
481
|
+
const http = trimmed.match(/\bHTTP\s+\d{3}:\s*(.+)$/im);
|
|
482
|
+
if (http?.[1]) return `HTTP: ${http[1].trim()}`;
|
|
483
|
+
const lines = trimmed.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
484
|
+
if (lines.length > 1 && /^Command failed with exit code/i.test(lines[0])) {
|
|
485
|
+
return lines.slice(1).join(" ").trim() || lines[0];
|
|
486
|
+
}
|
|
487
|
+
return trimmed;
|
|
488
|
+
}
|
|
489
|
+
function formatGhLandError(raw, opts) {
|
|
490
|
+
const trimmed = raw.trim();
|
|
491
|
+
if (trimmed.startsWith("GitHub API rate limit exceeded.")) {
|
|
492
|
+
return trimmed;
|
|
493
|
+
}
|
|
494
|
+
const detail = extractGhErrorDetail(raw);
|
|
495
|
+
if (isGhRateLimitError(raw) || isGhRateLimitError(detail)) {
|
|
496
|
+
const when = opts?.resetAt ? ` Try again ${formatRateLimitResetHint(opts.resetAt, opts.nowMs)}.` : " Wait a few minutes and try again.";
|
|
497
|
+
const pushNote = opts?.pushed === false ? "" : " Your branch was already pushed.";
|
|
498
|
+
return `GitHub API rate limit exceeded.${pushNote}${when} Or create the pull request in the browser (Push & open on GitHub).`;
|
|
499
|
+
}
|
|
500
|
+
return detail || "Failed to create or update pull request";
|
|
501
|
+
}
|
|
502
|
+
function formatIpcInvokeError(err) {
|
|
503
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
504
|
+
msg = msg.replace(/^Error invoking remote method '[^']+':\s*/i, "");
|
|
505
|
+
msg = msg.replace(/^ExecaError:\s*/i, "");
|
|
506
|
+
msg = msg.replace(/^Error:\s*/i, "");
|
|
507
|
+
return formatGhLandError(msg);
|
|
508
|
+
}
|
|
509
|
+
|
|
462
510
|
// src/git/pr-gates.ts
|
|
463
511
|
function buildMergeGateChecks(gate, opts = {}) {
|
|
464
512
|
const rows = [];
|
|
@@ -547,6 +595,24 @@ function buildMergeGateChecks(gate, opts = {}) {
|
|
|
547
595
|
}
|
|
548
596
|
|
|
549
597
|
// src/git/worktree.ts
|
|
598
|
+
async function lookupGithubGraphqlReset(cwd) {
|
|
599
|
+
const result = await gh(["api", "rate_limit"], cwd, { reject: false });
|
|
600
|
+
if (result.exitCode !== 0 || !result.stdout.trim()) return void 0;
|
|
601
|
+
try {
|
|
602
|
+
const data = JSON.parse(result.stdout);
|
|
603
|
+
const reset = data.resources?.graphql?.reset;
|
|
604
|
+
return typeof reset === "number" ? reset : void 0;
|
|
605
|
+
} catch {
|
|
606
|
+
return void 0;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
async function formatPrCreateFailure(raw, cwd) {
|
|
610
|
+
if (!isGhRateLimitError(raw)) {
|
|
611
|
+
return formatGhLandError(raw);
|
|
612
|
+
}
|
|
613
|
+
const resetAt = await lookupGithubGraphqlReset(cwd);
|
|
614
|
+
return formatGhLandError(raw, { resetAt });
|
|
615
|
+
}
|
|
550
616
|
function slugify(input) {
|
|
551
617
|
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
|
|
552
618
|
}
|
|
@@ -861,6 +927,37 @@ async function getPrChecks(cwd, selector) {
|
|
|
861
927
|
});
|
|
862
928
|
return [...gateRows, ...ciChecks];
|
|
863
929
|
}
|
|
930
|
+
async function getPrMeta(cwd, selector) {
|
|
931
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
932
|
+
const viewArgs = [
|
|
933
|
+
"pr",
|
|
934
|
+
"view",
|
|
935
|
+
selector,
|
|
936
|
+
"--json",
|
|
937
|
+
"number,title,url,state,isDraft,reviewDecision,baseRefName,headRefName"
|
|
938
|
+
];
|
|
939
|
+
if (slug) viewArgs.push("--repo", slug);
|
|
940
|
+
const { stdout, exitCode, stderr } = await gh(viewArgs, cwd, { reject: false });
|
|
941
|
+
if (exitCode !== 0 || !stdout.trim()) {
|
|
942
|
+
if (/no pull requests found/i.test(stderr)) return null;
|
|
943
|
+
return null;
|
|
944
|
+
}
|
|
945
|
+
try {
|
|
946
|
+
const view = JSON.parse(stdout);
|
|
947
|
+
return {
|
|
948
|
+
number: Number(view.number),
|
|
949
|
+
title: String(view.title ?? ""),
|
|
950
|
+
url: String(view.url ?? ""),
|
|
951
|
+
state: String(view.state ?? ""),
|
|
952
|
+
isDraft: Boolean(view.isDraft),
|
|
953
|
+
reviewDecision: typeof view.reviewDecision === "string" && view.reviewDecision ? view.reviewDecision : null,
|
|
954
|
+
baseRefName: String(view.baseRefName ?? ""),
|
|
955
|
+
headRefName: String(view.headRefName ?? "")
|
|
956
|
+
};
|
|
957
|
+
} catch {
|
|
958
|
+
return null;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
864
961
|
async function getPrDetails(cwd, selector) {
|
|
865
962
|
const slug = await resolveGithubRepoSlug(cwd);
|
|
866
963
|
const viewArgs = [
|
|
@@ -882,7 +979,6 @@ async function getPrDetails(cwd, selector) {
|
|
|
882
979
|
"additions",
|
|
883
980
|
"deletions",
|
|
884
981
|
"changedFiles",
|
|
885
|
-
"commits",
|
|
886
982
|
"comments",
|
|
887
983
|
"reviews"
|
|
888
984
|
].join(",")
|
|
@@ -901,14 +997,7 @@ async function getPrDetails(cwd, selector) {
|
|
|
901
997
|
} catch {
|
|
902
998
|
throw new Error(stderr.trim() || "gh pr view returned invalid JSON");
|
|
903
999
|
}
|
|
904
|
-
let checks = [];
|
|
905
|
-
try {
|
|
906
|
-
checks = await getPrChecks(cwd, selector) ?? [];
|
|
907
|
-
} catch {
|
|
908
|
-
checks = [];
|
|
909
|
-
}
|
|
910
1000
|
const author = view.author ?? {};
|
|
911
|
-
const commits = Array.isArray(view.commits) ? view.commits : [];
|
|
912
1001
|
const comments = Array.isArray(view.comments) ? view.comments : [];
|
|
913
1002
|
const reviews = Array.isArray(view.reviews) ? view.reviews : [];
|
|
914
1003
|
return {
|
|
@@ -925,19 +1014,8 @@ async function getPrDetails(cwd, selector) {
|
|
|
925
1014
|
additions: Number(view.additions ?? 0),
|
|
926
1015
|
deletions: Number(view.deletions ?? 0),
|
|
927
1016
|
changedFiles: Number(view.changedFiles ?? 0),
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
const authors = Array.isArray(row.authors) ? row.authors.map((a) => {
|
|
931
|
-
const actor = a;
|
|
932
|
-
return { login: actor.login ?? "unknown", name: actor.name ?? null };
|
|
933
|
-
}) : [];
|
|
934
|
-
return {
|
|
935
|
-
oid: String(row.oid ?? ""),
|
|
936
|
-
messageHeadline: String(row.messageHeadline ?? ""),
|
|
937
|
-
committedDate: String(row.committedDate ?? ""),
|
|
938
|
-
authors
|
|
939
|
-
};
|
|
940
|
-
}),
|
|
1017
|
+
// Commits live in Changes; omit from GraphQL to save rate-limit points.
|
|
1018
|
+
commits: [],
|
|
941
1019
|
comments: comments.map((c) => {
|
|
942
1020
|
const row = c;
|
|
943
1021
|
const a = row.author ?? {};
|
|
@@ -957,7 +1035,8 @@ async function getPrDetails(cwd, selector) {
|
|
|
957
1035
|
submittedAt: normalizeGhTime(row.submittedAt)
|
|
958
1036
|
};
|
|
959
1037
|
}),
|
|
960
|
-
|
|
1038
|
+
// CI lives in Checks tab via getPrChecks — nesting burned GraphQL points.
|
|
1039
|
+
checks: []
|
|
961
1040
|
};
|
|
962
1041
|
}
|
|
963
1042
|
async function fetchPrHead(repoPath, number, localBranch) {
|
|
@@ -1187,8 +1266,12 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
1187
1266
|
opts.head
|
|
1188
1267
|
];
|
|
1189
1268
|
if (opts.draft) args.push("--draft");
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1269
|
+
const created = await gh(args, worktreePath, { reject: false });
|
|
1270
|
+
if (created.exitCode !== 0) {
|
|
1271
|
+
const raw = created.stderr.trim() || created.stdout.trim() || "gh pr create failed";
|
|
1272
|
+
throw new Error(await formatPrCreateFailure(raw, worktreePath));
|
|
1273
|
+
}
|
|
1274
|
+
const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
|
|
1192
1275
|
return url;
|
|
1193
1276
|
}
|
|
1194
1277
|
function suggestSlug(source) {
|
|
@@ -1252,6 +1335,11 @@ export {
|
|
|
1252
1335
|
threadDisplayLabel,
|
|
1253
1336
|
worktreeDisplayLabel,
|
|
1254
1337
|
worktreeDisplayLabelForGroup,
|
|
1338
|
+
isGhRateLimitError,
|
|
1339
|
+
formatRateLimitResetHint,
|
|
1340
|
+
extractGhErrorDetail,
|
|
1341
|
+
formatGhLandError,
|
|
1342
|
+
formatIpcInvokeError,
|
|
1255
1343
|
slugify,
|
|
1256
1344
|
resolveRepoRoot,
|
|
1257
1345
|
parseGithubSlugFromRemoteUrl,
|
|
@@ -1264,6 +1352,7 @@ export {
|
|
|
1264
1352
|
resolvePrSelector,
|
|
1265
1353
|
detectLocalMergeConflicts,
|
|
1266
1354
|
getPrChecks,
|
|
1355
|
+
getPrMeta,
|
|
1267
1356
|
getPrDetails,
|
|
1268
1357
|
fetchPrHead,
|
|
1269
1358
|
resolveWorktreeStartPoint,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ensureWorkspace,
|
|
4
4
|
removeWorkspace,
|
|
5
5
|
syncWorkspacesFromThreads
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MGSJQMJA.js";
|
|
7
7
|
import {
|
|
8
8
|
GLOBAL_WORKSPACE_ID,
|
|
9
9
|
createGlobalChat,
|
|
@@ -13,19 +13,19 @@ import {
|
|
|
13
13
|
isGlobalThread,
|
|
14
14
|
isOrchestratorThread,
|
|
15
15
|
orchestratorSessionPoisonedByBuiltins
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3OJG4LP4.js";
|
|
17
17
|
import {
|
|
18
18
|
coordinatorSystemPrompt,
|
|
19
19
|
coordinatorTurnReminder,
|
|
20
20
|
enrichWorkspacesWithGithub,
|
|
21
21
|
ensureGlobalCoordinatorCwd
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TNIAXABV.js";
|
|
23
23
|
import {
|
|
24
24
|
PLAN_MODE_INSTRUCTION,
|
|
25
25
|
allAdapters,
|
|
26
26
|
getAdapter,
|
|
27
27
|
parseBrightsyCliLine
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-MEI4AXV4.js";
|
|
29
29
|
import {
|
|
30
30
|
childEnvWithAppSettings,
|
|
31
31
|
getLinearApiKey,
|
|
@@ -41,9 +41,11 @@ import {
|
|
|
41
41
|
createOrUpdatePr,
|
|
42
42
|
createThreadWorktree,
|
|
43
43
|
fetchPrHead,
|
|
44
|
+
formatGhLandError,
|
|
44
45
|
getPr,
|
|
45
46
|
getPrChecks,
|
|
46
47
|
getPrDetails,
|
|
48
|
+
getPrMeta,
|
|
47
49
|
isDirty,
|
|
48
50
|
isPlaceholderBranch,
|
|
49
51
|
listBranches,
|
|
@@ -61,7 +63,7 @@ import {
|
|
|
61
63
|
takenSlugsFromThread,
|
|
62
64
|
threadDisplayLabel,
|
|
63
65
|
worktreeNameFromPath
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-L44AX7IG.js";
|
|
65
67
|
import {
|
|
66
68
|
appendMessage,
|
|
67
69
|
createEmptyThread,
|
|
@@ -429,9 +431,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
429
431
|
`Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
|
|
430
432
|
);
|
|
431
433
|
}
|
|
432
|
-
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-
|
|
434
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-H642B5OI.js");
|
|
433
435
|
if (isGlobalThread2(thread)) {
|
|
434
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
436
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-G6T7ORT3.js");
|
|
435
437
|
ensureGlobalCoordinatorCwd2();
|
|
436
438
|
}
|
|
437
439
|
const adapter = getAdapter(thread.agent);
|
|
@@ -2157,15 +2159,24 @@ async function confirmLand(thread, opts) {
|
|
|
2157
2159
|
const head = headOut.trim();
|
|
2158
2160
|
const branch = head && head !== "HEAD" ? head : thread.branchName;
|
|
2159
2161
|
await pushBranch(thread.worktreePath, branch);
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2162
|
+
try {
|
|
2163
|
+
const prUrl = await createOrUpdatePr(thread.worktreePath, {
|
|
2164
|
+
title: meta.title,
|
|
2165
|
+
body: meta.body,
|
|
2166
|
+
base: preview.target,
|
|
2167
|
+
head: branch,
|
|
2168
|
+
draft: opts?.draft,
|
|
2169
|
+
web: opts?.web
|
|
2170
|
+
});
|
|
2171
|
+
return { prUrl, pushed: true, committed };
|
|
2172
|
+
} catch (err) {
|
|
2173
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
2174
|
+
if (raw.startsWith("GitHub API rate limit exceeded.")) throw err;
|
|
2175
|
+
if (/Command failed with exit code|API rate limit/i.test(raw)) {
|
|
2176
|
+
throw new Error(formatGhLandError(raw));
|
|
2177
|
+
}
|
|
2178
|
+
throw err;
|
|
2179
|
+
}
|
|
2169
2180
|
}
|
|
2170
2181
|
|
|
2171
2182
|
// src/threads/create.ts
|
|
@@ -2246,7 +2257,7 @@ async function createThread(input, onSetupLine) {
|
|
|
2246
2257
|
return readThread(thread.id) ?? thread;
|
|
2247
2258
|
}
|
|
2248
2259
|
async function listLinearIssues(agent, repoPath) {
|
|
2249
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
2260
|
+
const { getAdapter: getAdapter2 } = await import("./agents-RO3AJ76Q.js");
|
|
2250
2261
|
await requireAgent(agent, { requireLinear: true });
|
|
2251
2262
|
const adapter = getAdapter2(agent);
|
|
2252
2263
|
if (!adapter.listLinearIssues) {
|
|
@@ -2462,7 +2473,7 @@ async function adoptThread(input) {
|
|
|
2462
2473
|
messages: input.messages ?? []
|
|
2463
2474
|
});
|
|
2464
2475
|
writeThread(thread);
|
|
2465
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
2476
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4EREGLB7.js");
|
|
2466
2477
|
await ensureWorkspace2(repoPath);
|
|
2467
2478
|
return thread;
|
|
2468
2479
|
}
|
|
@@ -3038,7 +3049,7 @@ var Orchestrator = class {
|
|
|
3038
3049
|
return thread;
|
|
3039
3050
|
}
|
|
3040
3051
|
listWorkspaces() {
|
|
3041
|
-
const fromThreads = listThreads({ includeArchived:
|
|
3052
|
+
const fromThreads = listThreads({ includeArchived: false }).map((t) => t.repoPath);
|
|
3042
3053
|
return syncWorkspacesFromThreads(fromThreads);
|
|
3043
3054
|
}
|
|
3044
3055
|
async addWorkspace(repoPath) {
|
|
@@ -3655,8 +3666,8 @@ var Orchestrator = class {
|
|
|
3655
3666
|
if (result.prUrl) {
|
|
3656
3667
|
const patch = { prUrl: result.prUrl };
|
|
3657
3668
|
try {
|
|
3658
|
-
const
|
|
3659
|
-
if (
|
|
3669
|
+
const meta = await getPrMeta(thread.worktreePath, result.prUrl);
|
|
3670
|
+
if (meta?.title) patch.prTitle = meta.title;
|
|
3660
3671
|
} catch {
|
|
3661
3672
|
}
|
|
3662
3673
|
updateThread(thread.id, patch);
|
|
@@ -3689,6 +3700,24 @@ var Orchestrator = class {
|
|
|
3689
3700
|
if (!selector) return null;
|
|
3690
3701
|
return getPrChecks(cwd, selector);
|
|
3691
3702
|
}
|
|
3703
|
+
async getPrMeta(threadRef) {
|
|
3704
|
+
const { thread, selector, cwd } = await this.withPrSelector(threadRef);
|
|
3705
|
+
if (!selector) return null;
|
|
3706
|
+
const meta = await getPrMeta(cwd, selector);
|
|
3707
|
+
if (meta) {
|
|
3708
|
+
const patch = {};
|
|
3709
|
+
if (meta.url && meta.url !== thread.prUrl) patch.prUrl = meta.url;
|
|
3710
|
+
if (meta.title && meta.title !== thread.prTitle) patch.prTitle = meta.title;
|
|
3711
|
+
if (Object.keys(patch).length > 0) {
|
|
3712
|
+
updateThread(thread.id, patch);
|
|
3713
|
+
const latest = this.requireThread(thread.id);
|
|
3714
|
+
if (!latest.userSetTitle && meta.title && latest.title !== meta.title) {
|
|
3715
|
+
updateThread(thread.id, { title: meta.title });
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
return meta;
|
|
3720
|
+
}
|
|
3692
3721
|
async getPrDetails(threadRef) {
|
|
3693
3722
|
const { thread, selector, cwd } = await this.withPrSelector(threadRef);
|
|
3694
3723
|
if (!selector) return null;
|
|
@@ -3810,7 +3839,7 @@ var Orchestrator = class {
|
|
|
3810
3839
|
return setStatus(thread.id, "idle");
|
|
3811
3840
|
}
|
|
3812
3841
|
if (!existsSync10(thread.worktreePath)) {
|
|
3813
|
-
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-
|
|
3842
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-ZDHZMLSJ.js");
|
|
3814
3843
|
const { execa: execa6 } = await import("execa");
|
|
3815
3844
|
const slug = thread.worktreePath.split("/").pop();
|
|
3816
3845
|
const dest = thread.worktreePath;
|
|
@@ -3887,7 +3916,7 @@ async function startOrchestration(opts) {
|
|
|
3887
3916
|
sourceRef: "default",
|
|
3888
3917
|
...createOpts
|
|
3889
3918
|
}).catch(async () => {
|
|
3890
|
-
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-
|
|
3919
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-ZDHZMLSJ.js");
|
|
3891
3920
|
const repo = await resolveRepoRoot2(repoPath);
|
|
3892
3921
|
const def = await resolveDefaultBranch2(repo);
|
|
3893
3922
|
return createThread({
|
|
@@ -719,7 +719,7 @@ var claudeAdapter = {
|
|
|
719
719
|
);
|
|
720
720
|
}
|
|
721
721
|
const mode = permissionMode(thread);
|
|
722
|
-
const { isOrchestratorThread } = await import("./global-workspace-
|
|
722
|
+
const { isOrchestratorThread } = await import("./global-workspace-H642B5OI.js");
|
|
723
723
|
const isOrchestrator = isOrchestratorThread(thread);
|
|
724
724
|
const injectedServers = await buildInjectedMcpServers({
|
|
725
725
|
includeSideboard: isOrchestrator,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3OJG4LP4.js";
|
|
4
4
|
import {
|
|
5
5
|
resolveRepoRoot
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L44AX7IG.js";
|
|
7
7
|
import {
|
|
8
8
|
appDataDir
|
|
9
9
|
} from "./chunk-M37RITA6.js";
|
|
@@ -14,6 +14,9 @@ import { basename, join } from "path";
|
|
|
14
14
|
function workspacesFile() {
|
|
15
15
|
return join(appDataDir(), "workspaces.json");
|
|
16
16
|
}
|
|
17
|
+
function removedWorkspacesFile() {
|
|
18
|
+
return join(appDataDir(), "removed-workspaces.json");
|
|
19
|
+
}
|
|
17
20
|
function readAll() {
|
|
18
21
|
const path = workspacesFile();
|
|
19
22
|
if (!existsSync(path)) return [];
|
|
@@ -28,12 +31,41 @@ function writeAll(list) {
|
|
|
28
31
|
mkdirSync(appDataDir(), { recursive: true });
|
|
29
32
|
writeFileSync(workspacesFile(), JSON.stringify(list, null, 2), "utf8");
|
|
30
33
|
}
|
|
34
|
+
function readRemoved() {
|
|
35
|
+
const path = removedWorkspacesFile();
|
|
36
|
+
if (!existsSync(path)) return /* @__PURE__ */ new Set();
|
|
37
|
+
try {
|
|
38
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
39
|
+
return new Set(Array.isArray(raw) ? raw.filter((p) => typeof p === "string") : []);
|
|
40
|
+
} catch {
|
|
41
|
+
return /* @__PURE__ */ new Set();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function writeRemoved(paths) {
|
|
45
|
+
mkdirSync(appDataDir(), { recursive: true });
|
|
46
|
+
writeFileSync(removedWorkspacesFile(), JSON.stringify([...paths].sort(), null, 2), "utf8");
|
|
47
|
+
}
|
|
48
|
+
function rememberRemoved(repoPath) {
|
|
49
|
+
const next = readRemoved();
|
|
50
|
+
next.add(repoPath);
|
|
51
|
+
writeRemoved(next);
|
|
52
|
+
}
|
|
53
|
+
function forgetRemoved(repoPath) {
|
|
54
|
+
const next = readRemoved();
|
|
55
|
+
if (!next.delete(repoPath)) return;
|
|
56
|
+
writeRemoved(next);
|
|
57
|
+
}
|
|
31
58
|
function listWorkspaces() {
|
|
32
|
-
|
|
59
|
+
const all = readAll();
|
|
60
|
+
const valid = all.filter((w) => Boolean(w.path) && w.path !== "/" && w.path !== ".");
|
|
61
|
+
if (valid.length !== all.length) writeAll(valid);
|
|
62
|
+
return valid.sort((a, b) => a.name.localeCompare(b.name));
|
|
33
63
|
}
|
|
34
64
|
async function addWorkspace(repoPath) {
|
|
35
65
|
const root = await resolveRepoRoot(repoPath);
|
|
66
|
+
if (!root || root === "/") throw new Error(`Invalid repo path: ${repoPath}`);
|
|
36
67
|
if (!existsSync(root)) throw new Error(`Repo not found: ${root}`);
|
|
68
|
+
forgetRemoved(root);
|
|
37
69
|
const current = readAll();
|
|
38
70
|
const existing = current.find((w) => w.path === root);
|
|
39
71
|
if (existing) return existing;
|
|
@@ -47,16 +79,20 @@ async function addWorkspace(repoPath) {
|
|
|
47
79
|
}
|
|
48
80
|
function removeWorkspace(repoPath) {
|
|
49
81
|
writeAll(readAll().filter((w) => w.path !== repoPath));
|
|
82
|
+
rememberRemoved(repoPath);
|
|
50
83
|
}
|
|
51
84
|
async function ensureWorkspace(repoPath) {
|
|
52
85
|
return addWorkspace(repoPath);
|
|
53
86
|
}
|
|
54
87
|
function syncWorkspacesFromThreads(repoPaths) {
|
|
55
88
|
const current = readAll();
|
|
89
|
+
const removed = readRemoved();
|
|
56
90
|
const byPath = new Map(current.map((w) => [w.path, w]));
|
|
57
91
|
let dirty = false;
|
|
58
92
|
for (const path of repoPaths) {
|
|
59
|
-
if (!path || isGlobalRepoPath(path) || byPath.has(path))
|
|
93
|
+
if (!path || path === "/" || isGlobalRepoPath(path) || byPath.has(path) || removed.has(path)) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
60
96
|
if (!existsSync(path)) continue;
|
|
61
97
|
const ws = {
|
|
62
98
|
path,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
enrichWorkspacesWithGithub,
|
|
7
7
|
ensureGlobalCoordinatorCwd,
|
|
8
8
|
formatWorkspaceInventory
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-TNIAXABV.js";
|
|
10
|
+
import "./chunk-L44AX7IG.js";
|
|
11
11
|
import "./chunk-HYRHI3QU.js";
|
|
12
12
|
import "./chunk-M37RITA6.js";
|
|
13
13
|
import "./chunk-AJ6ROGD7.js";
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
orchestrationTitleNeedsSoccerNickname,
|
|
12
12
|
orchestratorSessionPoisonedByBuiltins,
|
|
13
13
|
takenTeamSlugsForOrchestration
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-3OJG4LP4.js";
|
|
15
|
+
import "./chunk-TNIAXABV.js";
|
|
16
|
+
import "./chunk-L44AX7IG.js";
|
|
17
17
|
import "./chunk-HYRHI3QU.js";
|
|
18
18
|
import {
|
|
19
19
|
globalAgentCwd
|