@sideboard-ai/core 0.1.172 → 0.1.174
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-CTWLBPCV.js → agents-LMPVUPOH.js} +3 -3
- package/dist/{agents-7UTRNLXQ.js → agents-ZWYRGFZB.js} +3 -3
- package/dist/{chunk-QYZYDO3F.js → chunk-7JIYKYLL.js} +26 -5
- package/dist/{chunk-PXNOT6NV.js → chunk-7O53GXTA.js} +26 -5
- package/dist/{chunk-3F7AXVIL.js → chunk-CUA4S537.js} +3 -3
- package/dist/{chunk-QYJS7LYE.js → chunk-HJPGIETB.js} +204 -145
- package/dist/{chunk-6X6KMUI2.js → chunk-TPPZXZTA.js} +3 -3
- package/dist/{chunk-234EKD2F.js → chunk-VCVBICMZ.js} +1 -1
- package/dist/{chunk-ZTVBIBLB.js → chunk-YEPVWJ3R.js} +200 -143
- package/dist/{chunk-2RM6BZQ2.js → chunk-ZY7K4T37.js} +1 -1
- package/dist/{coordinator-prompt-PM6MPYYB.js → coordinator-prompt-K3HXEPFD.js} +2 -2
- package/dist/{coordinator-prompt-7CTI6HRH.js → coordinator-prompt-LJKA2ODR.js} +2 -2
- package/dist/{global-workspace-CRJ6ZVIY.js → global-workspace-KA7T26F5.js} +2 -2
- package/dist/{global-workspace-CMYSFRCM.js → global-workspace-VDFSU3DD.js} +2 -2
- package/dist/index.cjs +324 -238
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -6
- package/dist/mcp/run-stdio.cjs +336 -250
- package/dist/mcp/run-stdio.js +4 -4
- package/dist/{orchestrator-RW4IVITI.js → orchestrator-DMSSC4SV.js} +4 -4
- package/dist/{orchestrator-VPT4SXXD.js → orchestrator-VMUZJFTZ.js} +4 -4
- package/dist/{workspaces-L73MCDFA.js → workspaces-GOGBPATJ.js} +2 -2
- package/dist/{workspaces-UYSD2STS.js → workspaces-UR7YEFMZ.js} +2 -2
- package/dist/{worktree-SQD3DBYC.js → worktree-LC4VRWDM.js} +1 -1
- package/dist/{worktree-WVEDT3FM.js → worktree-UTDBQXSS.js} +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4054,18 +4054,35 @@ function teamSlugFromName(name) {
|
|
|
4054
4054
|
function normalizeTakenSlug(raw) {
|
|
4055
4055
|
return raw.toLowerCase().replace(/^thread\//, "").replace(/\/+$/, "");
|
|
4056
4056
|
}
|
|
4057
|
+
function soccerTokenFromTakenSlug(raw) {
|
|
4058
|
+
const normalized = normalizeTakenSlug(raw);
|
|
4059
|
+
if (!normalized) return null;
|
|
4060
|
+
const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
|
|
4061
|
+
const lookup = withoutTicket || normalized;
|
|
4062
|
+
const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
|
|
4063
|
+
const base = suffixMatch?.[1] ?? lookup;
|
|
4064
|
+
const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
|
|
4065
|
+
if (!team) return null;
|
|
4066
|
+
return suffixMatch ? `${team.slug}-${suffixMatch[2]}` : team.slug;
|
|
4067
|
+
}
|
|
4068
|
+
function addTakenSlug(out, raw) {
|
|
4069
|
+
const normalized = normalizeTakenSlug(raw);
|
|
4070
|
+
if (!normalized) return;
|
|
4071
|
+
out.add(normalized);
|
|
4072
|
+
const token = soccerTokenFromTakenSlug(normalized);
|
|
4073
|
+
if (token) out.add(token);
|
|
4074
|
+
}
|
|
4057
4075
|
function takenSlugsFromThread(thread) {
|
|
4058
4076
|
const out = /* @__PURE__ */ new Set();
|
|
4059
4077
|
const titleSlug = thread.title ? teamSlugFromName(thread.title) : null;
|
|
4060
4078
|
if (titleSlug) out.add(normalizeTakenSlug(titleSlug));
|
|
4061
4079
|
if (thread.branchName?.trim()) {
|
|
4062
|
-
|
|
4063
|
-
if (branch) out.add(branch);
|
|
4080
|
+
addTakenSlug(out, thread.branchName.trim());
|
|
4064
4081
|
}
|
|
4065
4082
|
if (thread.worktreePath) {
|
|
4066
4083
|
const parts = thread.worktreePath.replace(/\/+$/, "").split("/");
|
|
4067
4084
|
const dir = parts[parts.length - 1];
|
|
4068
|
-
if (dir) out
|
|
4085
|
+
if (dir) addTakenSlug(out, dir);
|
|
4069
4086
|
}
|
|
4070
4087
|
return [...out];
|
|
4071
4088
|
}
|
|
@@ -7323,12 +7340,16 @@ function collectTakenTeamSlugs(repoPath) {
|
|
|
7323
7340
|
if ((0, import_node_fs18.existsSync)(root)) {
|
|
7324
7341
|
for (const entry of (0, import_node_fs18.readdirSync)(root, { withFileTypes: true })) {
|
|
7325
7342
|
if (entry.isDirectory() && entry.name !== ".DS_Store") {
|
|
7326
|
-
|
|
7343
|
+
for (const slug of takenSlugsFromThread({ worktreePath: entry.name })) {
|
|
7344
|
+
taken.add(slug);
|
|
7345
|
+
}
|
|
7327
7346
|
}
|
|
7328
7347
|
}
|
|
7329
7348
|
}
|
|
7330
7349
|
for (const slug of listLocalThreadBranchSlugs(repoPath)) {
|
|
7331
|
-
|
|
7350
|
+
for (const token of takenSlugsFromThread({ branchName: slug })) {
|
|
7351
|
+
taken.add(token);
|
|
7352
|
+
}
|
|
7332
7353
|
}
|
|
7333
7354
|
for (const thread of listThreads({ includeArchived: true })) {
|
|
7334
7355
|
if (!sameRepoPath(thread.repoPath, repoPath)) continue;
|
|
@@ -13672,6 +13693,62 @@ var init_agents = __esm({
|
|
|
13672
13693
|
}
|
|
13673
13694
|
});
|
|
13674
13695
|
|
|
13696
|
+
// src/hook/worktree-pkg-cache.ts
|
|
13697
|
+
function worktreePkgCacheRoot(worktreePath) {
|
|
13698
|
+
return (0, import_node_path36.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
|
|
13699
|
+
}
|
|
13700
|
+
function worktreePkgCacheEnv(worktreePath) {
|
|
13701
|
+
const root = worktreePkgCacheRoot(worktreePath);
|
|
13702
|
+
const store = (0, import_node_path36.join)(root, "pnpm-store");
|
|
13703
|
+
const pnpmCache = (0, import_node_path36.join)(root, "pnpm");
|
|
13704
|
+
const npmCache = (0, import_node_path36.join)(root, "npm");
|
|
13705
|
+
const nodeGyp = (0, import_node_path36.join)(root, "node-gyp");
|
|
13706
|
+
const electron = (0, import_node_path36.join)(root, "electron");
|
|
13707
|
+
return {
|
|
13708
|
+
npm_config_store_dir: store,
|
|
13709
|
+
PNPM_STORE_DIR: store,
|
|
13710
|
+
npm_config_cache_dir: pnpmCache,
|
|
13711
|
+
npm_config_cache: npmCache,
|
|
13712
|
+
npm_config_devdir: nodeGyp,
|
|
13713
|
+
// @electron/get — do not set ELECTRON_CACHE (stripNestedElectronEnv).
|
|
13714
|
+
electron_config_cache: electron
|
|
13715
|
+
};
|
|
13716
|
+
}
|
|
13717
|
+
function isSet(value) {
|
|
13718
|
+
return value != null && value.trim() !== "";
|
|
13719
|
+
}
|
|
13720
|
+
function fillGroup(env, keys, values) {
|
|
13721
|
+
if (keys.some((key) => isSet(env[key]))) return;
|
|
13722
|
+
for (const key of keys) {
|
|
13723
|
+
const value = values[key];
|
|
13724
|
+
if (value) env[key] = value;
|
|
13725
|
+
}
|
|
13726
|
+
}
|
|
13727
|
+
function ensureWorktreePkgCacheDirs(worktreePath) {
|
|
13728
|
+
if (!(0, import_node_fs36.existsSync)(worktreePath)) return;
|
|
13729
|
+
(0, import_node_fs36.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
|
|
13730
|
+
}
|
|
13731
|
+
function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
13732
|
+
const cwd = worktreePath.trim();
|
|
13733
|
+
if (!cwd) return;
|
|
13734
|
+
const next = worktreePkgCacheEnv(cwd);
|
|
13735
|
+
fillGroup(env, ["npm_config_store_dir", "PNPM_STORE_DIR"], next);
|
|
13736
|
+
fillGroup(env, ["npm_config_cache_dir"], next);
|
|
13737
|
+
fillGroup(env, ["npm_config_cache"], next);
|
|
13738
|
+
fillGroup(env, ["npm_config_devdir"], next);
|
|
13739
|
+
fillGroup(env, ["electron_config_cache"], next);
|
|
13740
|
+
ensureWorktreePkgCacheDirs(cwd);
|
|
13741
|
+
}
|
|
13742
|
+
var import_node_fs36, import_node_path36, WORKTREE_PKG_CACHE_REL;
|
|
13743
|
+
var init_worktree_pkg_cache = __esm({
|
|
13744
|
+
"src/hook/worktree-pkg-cache.ts"() {
|
|
13745
|
+
"use strict";
|
|
13746
|
+
import_node_fs36 = require("fs");
|
|
13747
|
+
import_node_path36 = require("path");
|
|
13748
|
+
WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
|
|
13749
|
+
}
|
|
13750
|
+
});
|
|
13751
|
+
|
|
13675
13752
|
// src/agents/cursor-stream-coalesce.ts
|
|
13676
13753
|
function isTextEvent(event) {
|
|
13677
13754
|
return event.type === "stdout" || event.type === "thinking";
|
|
@@ -13774,6 +13851,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
13774
13851
|
const env = childEnvWithAppSettings(cmd.env);
|
|
13775
13852
|
applyPromptCacheTtlEnv(thread.agent, env);
|
|
13776
13853
|
applyAgentRunnerHeapEnv(env);
|
|
13854
|
+
if (!isOrchestratorThread(thread)) {
|
|
13855
|
+
applyWorktreePkgCacheEnv(env, thread.worktreePath);
|
|
13856
|
+
}
|
|
13777
13857
|
try {
|
|
13778
13858
|
if (isOrchestratorThread(thread)) {
|
|
13779
13859
|
mergeAgentGitAuthEnv(env, await resolveAgentGitAuthEnv(env));
|
|
@@ -13881,6 +13961,7 @@ var init_spawn = __esm({
|
|
|
13881
13961
|
init_agents();
|
|
13882
13962
|
init_orchestrator_capable();
|
|
13883
13963
|
init_message_parts();
|
|
13964
|
+
init_worktree_pkg_cache();
|
|
13884
13965
|
init_node_launch();
|
|
13885
13966
|
init_path();
|
|
13886
13967
|
init_usage();
|
|
@@ -14358,7 +14439,7 @@ function buildSessionSeed(messages, opts) {
|
|
|
14358
14439
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
14359
14440
|
if (keep[i]) continue;
|
|
14360
14441
|
const next = used + blocks[i].length + 2;
|
|
14361
|
-
if (next > maxChars && used > 0)
|
|
14442
|
+
if (next > maxChars && used > 0) continue;
|
|
14362
14443
|
keep[i] = true;
|
|
14363
14444
|
used = next;
|
|
14364
14445
|
}
|
|
@@ -14811,21 +14892,21 @@ function shouldRefreshReviewRequestTemplate(content) {
|
|
|
14811
14892
|
return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
|
|
14812
14893
|
}
|
|
14813
14894
|
function readTextIfPresent(abs) {
|
|
14814
|
-
if (!(0,
|
|
14895
|
+
if (!(0, import_node_fs37.existsSync)(abs)) return null;
|
|
14815
14896
|
try {
|
|
14816
|
-
const content = (0,
|
|
14897
|
+
const content = (0, import_node_fs37.readFileSync)(abs, "utf8");
|
|
14817
14898
|
return content.trim() ? content : null;
|
|
14818
14899
|
} catch {
|
|
14819
14900
|
return null;
|
|
14820
14901
|
}
|
|
14821
14902
|
}
|
|
14822
14903
|
function readLocalGuidelines(worktreePath) {
|
|
14823
|
-
const localAbs = (0,
|
|
14904
|
+
const localAbs = (0, import_node_path37.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
14824
14905
|
const localContent = readTextIfPresent(localAbs);
|
|
14825
14906
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
14826
14907
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
14827
14908
|
}
|
|
14828
|
-
const legacyAbs = (0,
|
|
14909
|
+
const legacyAbs = (0, import_node_path37.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
14829
14910
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
14830
14911
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
14831
14912
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -14849,27 +14930,27 @@ function contextGuidelines(content, source) {
|
|
|
14849
14930
|
};
|
|
14850
14931
|
}
|
|
14851
14932
|
function writeContextGuidelines(worktreePath, content) {
|
|
14852
|
-
const abs = (0,
|
|
14853
|
-
(0,
|
|
14933
|
+
const abs = (0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH);
|
|
14934
|
+
(0, import_node_fs37.mkdirSync)((0, import_node_path37.dirname)(abs), { recursive: true });
|
|
14854
14935
|
const body = content.endsWith("\n") ? content : `${content}
|
|
14855
14936
|
`;
|
|
14856
|
-
(0,
|
|
14937
|
+
(0, import_node_fs37.writeFileSync)(abs, body, "utf8");
|
|
14857
14938
|
return body;
|
|
14858
14939
|
}
|
|
14859
14940
|
function readSideboardReview(worktreePath, repoPath) {
|
|
14860
|
-
const fromWorktree = readTextIfPresent((0,
|
|
14941
|
+
const fromWorktree = readTextIfPresent((0, import_node_path37.join)(worktreePath, REPO_REVIEW_PATH));
|
|
14861
14942
|
if (fromWorktree) return fromWorktree;
|
|
14862
14943
|
const repo = repoPath?.replace(/\/+$/, "");
|
|
14863
14944
|
const wt = worktreePath.replace(/\/+$/, "");
|
|
14864
14945
|
if (!repo || repo === wt) return null;
|
|
14865
|
-
return readTextIfPresent((0,
|
|
14946
|
+
return readTextIfPresent((0, import_node_path37.join)(repo, REPO_REVIEW_PATH));
|
|
14866
14947
|
}
|
|
14867
14948
|
function ensureReviewGuidelinesFile(worktreePath, repoPath) {
|
|
14868
|
-
const skillContent = readTextIfPresent((0,
|
|
14949
|
+
const skillContent = readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
14869
14950
|
if (skillContent) {
|
|
14870
14951
|
return { ...skillGuidelines(skillContent, "skill"), wrote: false };
|
|
14871
14952
|
}
|
|
14872
|
-
const contextContent = readTextIfPresent((0,
|
|
14953
|
+
const contextContent = readTextIfPresent((0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH));
|
|
14873
14954
|
if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
|
|
14874
14955
|
return { ...contextGuidelines(contextContent, "local"), wrote: false };
|
|
14875
14956
|
}
|
|
@@ -14907,7 +14988,7 @@ function buildReviewRequestAttachment(content, opts) {
|
|
|
14907
14988
|
};
|
|
14908
14989
|
}
|
|
14909
14990
|
function readExistingReviewRequestFile(worktreePath) {
|
|
14910
|
-
return readTextIfPresent((0,
|
|
14991
|
+
return readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path37.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
|
|
14911
14992
|
}
|
|
14912
14993
|
async function requestReview(threadRef, send2) {
|
|
14913
14994
|
const from = findThreadByRef(threadRef);
|
|
@@ -14934,13 +15015,13 @@ async function requestReview(threadRef, send2) {
|
|
|
14934
15015
|
const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
|
|
14935
15016
|
return { tab: started, from };
|
|
14936
15017
|
}
|
|
14937
|
-
var import_node_crypto8,
|
|
15018
|
+
var import_node_crypto8, import_node_fs37, import_node_path37, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
|
|
14938
15019
|
var init_request_review = __esm({
|
|
14939
15020
|
"src/review/request-review.ts"() {
|
|
14940
15021
|
"use strict";
|
|
14941
15022
|
import_node_crypto8 = require("crypto");
|
|
14942
|
-
|
|
14943
|
-
|
|
15023
|
+
import_node_fs37 = require("fs");
|
|
15024
|
+
import_node_path37 = require("path");
|
|
14944
15025
|
init_global_workspace();
|
|
14945
15026
|
init_chat_tabs();
|
|
14946
15027
|
init_thread_store();
|
|
@@ -14966,9 +15047,9 @@ function matchSimpleGlob(pattern, name) {
|
|
|
14966
15047
|
return new RegExp(`^${escaped}$`).test(name);
|
|
14967
15048
|
}
|
|
14968
15049
|
function readWorktreeInclude(repoPath) {
|
|
14969
|
-
const path2 = (0,
|
|
14970
|
-
if (!(0,
|
|
14971
|
-
return (0,
|
|
15050
|
+
const path2 = (0, import_node_path38.join)(repoPath, ".worktreeinclude");
|
|
15051
|
+
if (!(0, import_node_fs38.existsSync)(path2)) return [];
|
|
15052
|
+
return (0, import_node_fs38.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
14972
15053
|
}
|
|
14973
15054
|
function resolveFilesToCopy(repoPath) {
|
|
14974
15055
|
const fromInclude = readWorktreeInclude(repoPath);
|
|
@@ -14978,10 +15059,10 @@ function resolveFilesToCopy(repoPath) {
|
|
|
14978
15059
|
if (settings?.fileIncludeGlobs?.length) {
|
|
14979
15060
|
const matched = [];
|
|
14980
15061
|
try {
|
|
14981
|
-
for (const entry of (0,
|
|
15062
|
+
for (const entry of (0, import_node_fs38.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
14982
15063
|
if (!entry.isFile()) continue;
|
|
14983
15064
|
for (const glob of settings.fileIncludeGlobs) {
|
|
14984
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
15065
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path38.basename)(glob), entry.name)) {
|
|
14985
15066
|
matched.push(entry.name);
|
|
14986
15067
|
break;
|
|
14987
15068
|
}
|
|
@@ -14993,7 +15074,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
14993
15074
|
}
|
|
14994
15075
|
const defaults = [];
|
|
14995
15076
|
try {
|
|
14996
|
-
for (const entry of (0,
|
|
15077
|
+
for (const entry of (0, import_node_fs38.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
14997
15078
|
if (entry.isFile() && entry.name.startsWith(".env")) {
|
|
14998
15079
|
defaults.push(entry.name);
|
|
14999
15080
|
}
|
|
@@ -15007,11 +15088,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
15007
15088
|
const patterns = resolveFilesToCopy(repoPath);
|
|
15008
15089
|
const copied = [];
|
|
15009
15090
|
for (const rel of patterns) {
|
|
15010
|
-
const src = (0,
|
|
15011
|
-
if (!(0,
|
|
15012
|
-
const dest = (0,
|
|
15013
|
-
(0,
|
|
15014
|
-
(0,
|
|
15091
|
+
const src = (0, import_node_path38.join)(repoPath, rel);
|
|
15092
|
+
if (!(0, import_node_fs38.existsSync)(src)) continue;
|
|
15093
|
+
const dest = (0, import_node_path38.join)(worktreePath, rel);
|
|
15094
|
+
(0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(dest), { recursive: true });
|
|
15095
|
+
(0, import_node_fs38.copyFileSync)(src, dest);
|
|
15015
15096
|
copied.push(rel);
|
|
15016
15097
|
}
|
|
15017
15098
|
return copied;
|
|
@@ -15046,7 +15127,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
15046
15127
|
const env = stripNestedElectronEnv({
|
|
15047
15128
|
...baseEnv ?? process.env
|
|
15048
15129
|
});
|
|
15049
|
-
const name = opts.workspaceName ?? (0,
|
|
15130
|
+
const name = opts.workspaceName ?? (0, import_node_path38.basename)(opts.worktreePath);
|
|
15050
15131
|
const ports = opts.ports ?? [];
|
|
15051
15132
|
const primary = ports[0];
|
|
15052
15133
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -15069,6 +15150,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
15069
15150
|
env[`CONDUCTOR_PORT_${i}`] = String(p);
|
|
15070
15151
|
}
|
|
15071
15152
|
}
|
|
15153
|
+
applyWorktreePkgCacheEnv(env, opts.worktreePath);
|
|
15072
15154
|
return env;
|
|
15073
15155
|
}
|
|
15074
15156
|
function pipeLines(stream, onLine) {
|
|
@@ -15308,17 +15390,18 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
15308
15390
|
done: handle.done
|
|
15309
15391
|
};
|
|
15310
15392
|
}
|
|
15311
|
-
var
|
|
15393
|
+
var import_node_fs38, import_node_net, import_node_path38, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
|
|
15312
15394
|
var init_conductor = __esm({
|
|
15313
15395
|
"src/hook/conductor.ts"() {
|
|
15314
15396
|
"use strict";
|
|
15315
|
-
|
|
15397
|
+
import_node_fs38 = require("fs");
|
|
15316
15398
|
import_node_net = require("net");
|
|
15317
|
-
|
|
15399
|
+
import_node_path38 = require("path");
|
|
15318
15400
|
import_execa4 = require("execa");
|
|
15319
15401
|
import_node_readline3 = require("readline");
|
|
15320
15402
|
init_settings();
|
|
15321
15403
|
init_nested_electron_env();
|
|
15404
|
+
init_worktree_pkg_cache();
|
|
15322
15405
|
init_convention_setup();
|
|
15323
15406
|
init_cursor_worktrees();
|
|
15324
15407
|
init_git_auth_mode();
|
|
@@ -15341,9 +15424,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15341
15424
|
repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
|
|
15342
15425
|
);
|
|
15343
15426
|
const homeRoot = sideboardWorkspacesDir();
|
|
15344
|
-
if ((0,
|
|
15427
|
+
if ((0, import_node_fs39.existsSync)(homeRoot)) {
|
|
15345
15428
|
try {
|
|
15346
|
-
for (const entry of (0,
|
|
15429
|
+
for (const entry of (0, import_node_fs39.readdirSync)(homeRoot, { withFileTypes: true })) {
|
|
15347
15430
|
if (!entry.isDirectory()) continue;
|
|
15348
15431
|
void entry;
|
|
15349
15432
|
}
|
|
@@ -15353,7 +15436,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15353
15436
|
const orphans = [];
|
|
15354
15437
|
const seen = /* @__PURE__ */ new Set();
|
|
15355
15438
|
for (const repoPath of repos) {
|
|
15356
|
-
if (!repoPath || !(0,
|
|
15439
|
+
if (!repoPath || !(0, import_node_fs39.existsSync)(repoPath)) continue;
|
|
15357
15440
|
try {
|
|
15358
15441
|
const wts = await listWorktrees(repoPath);
|
|
15359
15442
|
for (const wt of wts) {
|
|
@@ -15364,7 +15447,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15364
15447
|
seen.add(path2);
|
|
15365
15448
|
let mtimeMs = 0;
|
|
15366
15449
|
try {
|
|
15367
|
-
mtimeMs = (0,
|
|
15450
|
+
mtimeMs = (0, import_node_fs39.statSync)(path2).mtimeMs;
|
|
15368
15451
|
} catch {
|
|
15369
15452
|
mtimeMs = 0;
|
|
15370
15453
|
}
|
|
@@ -15374,16 +15457,16 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15374
15457
|
}
|
|
15375
15458
|
try {
|
|
15376
15459
|
const root = worktreesRoot(repoPath);
|
|
15377
|
-
if ((0,
|
|
15378
|
-
for (const entry of (0,
|
|
15460
|
+
if ((0, import_node_fs39.existsSync)(root)) {
|
|
15461
|
+
for (const entry of (0, import_node_fs39.readdirSync)(root, { withFileTypes: true })) {
|
|
15379
15462
|
if (!entry.isDirectory()) continue;
|
|
15380
|
-
const path2 = (0,
|
|
15463
|
+
const path2 = (0, import_node_path39.join)(root, entry.name).replace(/\/$/, "");
|
|
15381
15464
|
if (known.has(path2) || seen.has(path2)) continue;
|
|
15382
|
-
if (!(0,
|
|
15465
|
+
if (!(0, import_node_fs39.existsSync)((0, import_node_path39.join)(path2, ".git"))) continue;
|
|
15383
15466
|
seen.add(path2);
|
|
15384
15467
|
let mtimeMs = 0;
|
|
15385
15468
|
try {
|
|
15386
|
-
mtimeMs = (0,
|
|
15469
|
+
mtimeMs = (0, import_node_fs39.statSync)(path2).mtimeMs;
|
|
15387
15470
|
} catch {
|
|
15388
15471
|
mtimeMs = Date.now();
|
|
15389
15472
|
}
|
|
@@ -15444,12 +15527,12 @@ function worktreeCleanupSettings() {
|
|
|
15444
15527
|
autoCleanupOrphans: a.autoCleanupOrphans
|
|
15445
15528
|
};
|
|
15446
15529
|
}
|
|
15447
|
-
var
|
|
15530
|
+
var import_node_fs39, import_node_path39;
|
|
15448
15531
|
var init_orphan_cleanup = __esm({
|
|
15449
15532
|
"src/git/orphan-cleanup.ts"() {
|
|
15450
15533
|
"use strict";
|
|
15451
|
-
|
|
15452
|
-
|
|
15534
|
+
import_node_fs39 = require("fs");
|
|
15535
|
+
import_node_path39 = require("path");
|
|
15453
15536
|
init_worktree();
|
|
15454
15537
|
init_thread_store();
|
|
15455
15538
|
init_paths();
|
|
@@ -15552,12 +15635,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
15552
15635
|
if (!url) throw new Error("Clone URL is required");
|
|
15553
15636
|
let name = opts.name?.trim();
|
|
15554
15637
|
if (!name) {
|
|
15555
|
-
const leaf = (0,
|
|
15638
|
+
const leaf = (0, import_node_path40.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
15556
15639
|
name = leaf || "repo";
|
|
15557
15640
|
}
|
|
15558
15641
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
15559
|
-
const dest = (0,
|
|
15560
|
-
if ((0,
|
|
15642
|
+
const dest = (0, import_node_path40.join)(sideboardReposDir(), name);
|
|
15643
|
+
if ((0, import_node_fs40.existsSync)(dest)) {
|
|
15561
15644
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
15562
15645
|
const workspace2 = await ensureWorkspace(repoPath2);
|
|
15563
15646
|
return { repoPath: repoPath2, workspace: workspace2 };
|
|
@@ -15572,12 +15655,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
15572
15655
|
const workspace = await ensureWorkspace(repoPath);
|
|
15573
15656
|
return { repoPath, workspace };
|
|
15574
15657
|
}
|
|
15575
|
-
var
|
|
15658
|
+
var import_node_fs40, import_node_path40, import_execa6;
|
|
15576
15659
|
var init_clone_repo = __esm({
|
|
15577
15660
|
"src/git/clone-repo.ts"() {
|
|
15578
15661
|
"use strict";
|
|
15579
|
-
|
|
15580
|
-
|
|
15662
|
+
import_node_fs40 = require("fs");
|
|
15663
|
+
import_node_path40 = require("path");
|
|
15581
15664
|
import_execa6 = require("execa");
|
|
15582
15665
|
init_paths();
|
|
15583
15666
|
init_workspaces();
|
|
@@ -15682,7 +15765,7 @@ function jobAlive(pid) {
|
|
|
15682
15765
|
}
|
|
15683
15766
|
function processGroupAlive(pgid) {
|
|
15684
15767
|
if (process.platform === "win32") return false;
|
|
15685
|
-
if (!Number.isInteger(pgid) || pgid <=
|
|
15768
|
+
if (!Number.isInteger(pgid) || pgid <= 1) return false;
|
|
15686
15769
|
try {
|
|
15687
15770
|
process.kill(-pgid, 0);
|
|
15688
15771
|
return true;
|
|
@@ -15695,24 +15778,24 @@ function jobTreeAlive(pid) {
|
|
|
15695
15778
|
return jobAlive(pid) || processGroupAlive(pid);
|
|
15696
15779
|
}
|
|
15697
15780
|
function readIntFile(file) {
|
|
15698
|
-
if (!(0,
|
|
15699
|
-
const n = Number.parseInt((0,
|
|
15781
|
+
if (!(0, import_node_fs41.existsSync)(file)) return null;
|
|
15782
|
+
const n = Number.parseInt((0, import_node_fs41.readFileSync)(file, "utf8").trim(), 10);
|
|
15700
15783
|
return Number.isInteger(n) ? n : null;
|
|
15701
15784
|
}
|
|
15702
15785
|
function jobDir(root, id, legacy = false) {
|
|
15703
|
-
return (0,
|
|
15786
|
+
return (0, import_node_path41.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
|
|
15704
15787
|
}
|
|
15705
15788
|
function resolveJobDir(root, id) {
|
|
15706
15789
|
const modern = jobDir(root, id, false);
|
|
15707
|
-
if ((0,
|
|
15790
|
+
if ((0, import_node_fs41.existsSync)(modern)) return modern;
|
|
15708
15791
|
const legacy = jobDir(root, id, true);
|
|
15709
|
-
if ((0,
|
|
15792
|
+
if ((0, import_node_fs41.existsSync)(legacy)) return legacy;
|
|
15710
15793
|
return modern;
|
|
15711
15794
|
}
|
|
15712
15795
|
function listJobIdsIn(root, rel) {
|
|
15713
|
-
const dir = (0,
|
|
15714
|
-
if (!(0,
|
|
15715
|
-
return (0,
|
|
15796
|
+
const dir = (0, import_node_path41.join)(root, rel);
|
|
15797
|
+
if (!(0, import_node_fs41.existsSync)(dir)) return [];
|
|
15798
|
+
return (0, import_node_fs41.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
|
|
15716
15799
|
}
|
|
15717
15800
|
function listRunningDetachedJobs(worktreePath) {
|
|
15718
15801
|
const root = worktreePath.trim();
|
|
@@ -15724,8 +15807,8 @@ function listRunningDetachedJobs(worktreePath) {
|
|
|
15724
15807
|
const running = [];
|
|
15725
15808
|
for (const id of ids) {
|
|
15726
15809
|
const dir = resolveJobDir(root, id);
|
|
15727
|
-
const pid = readIntFile((0,
|
|
15728
|
-
if (
|
|
15810
|
+
const pid = readIntFile((0, import_node_path41.join)(dir, "pid"));
|
|
15811
|
+
if (jobTreeAlive(pid)) running.push(id);
|
|
15729
15812
|
}
|
|
15730
15813
|
return running.sort();
|
|
15731
15814
|
}
|
|
@@ -15777,13 +15860,13 @@ function planJobContinue(opts) {
|
|
|
15777
15860
|
return { action: "none" };
|
|
15778
15861
|
}
|
|
15779
15862
|
function tailProgress(logFile, maxLines = 12) {
|
|
15780
|
-
if (!(0,
|
|
15781
|
-
const lines = (0,
|
|
15863
|
+
if (!(0, import_node_fs41.existsSync)(logFile)) return "(no log yet)";
|
|
15864
|
+
const lines = (0, import_node_fs41.readFileSync)(logFile, "utf8").split("\n");
|
|
15782
15865
|
return lines.slice(-maxLines).join("\n");
|
|
15783
15866
|
}
|
|
15784
15867
|
function readLogLines(file) {
|
|
15785
|
-
if (!(0,
|
|
15786
|
-
const lines = (0,
|
|
15868
|
+
if (!(0, import_node_fs41.existsSync)(file)) return [];
|
|
15869
|
+
const lines = (0, import_node_fs41.readFileSync)(file, "utf8").split("\n");
|
|
15787
15870
|
if (lines.length && lines[lines.length - 1] === "") lines.pop();
|
|
15788
15871
|
return lines;
|
|
15789
15872
|
}
|
|
@@ -15794,15 +15877,15 @@ function takeDelta(logFile, cursorFile) {
|
|
|
15794
15877
|
return { delta: lines.slice(start).join("\n"), nextCursor: lines.length };
|
|
15795
15878
|
}
|
|
15796
15879
|
function snapshotJob(dir) {
|
|
15797
|
-
const pid = readIntFile((0,
|
|
15880
|
+
const pid = readIntFile((0, import_node_path41.join)(dir, "pid"));
|
|
15798
15881
|
const running = jobTreeAlive(pid);
|
|
15799
15882
|
return {
|
|
15800
15883
|
pid,
|
|
15801
15884
|
running,
|
|
15802
|
-
exitCode: readIntFile((0,
|
|
15803
|
-
log: (0,
|
|
15804
|
-
cursor: (0,
|
|
15805
|
-
progress: tailProgress((0,
|
|
15885
|
+
exitCode: readIntFile((0, import_node_path41.join)(dir, "exit")),
|
|
15886
|
+
log: (0, import_node_path41.join)(dir, "log"),
|
|
15887
|
+
cursor: (0, import_node_path41.join)(dir, "present.cursor"),
|
|
15888
|
+
progress: tailProgress((0, import_node_path41.join)(dir, "log"))
|
|
15806
15889
|
};
|
|
15807
15890
|
}
|
|
15808
15891
|
function toResult(id, snap, extra) {
|
|
@@ -15811,8 +15894,8 @@ function toResult(id, snap, extra) {
|
|
|
15811
15894
|
const stillRunning = snap.running && !ok;
|
|
15812
15895
|
const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
|
|
15813
15896
|
try {
|
|
15814
|
-
(0,
|
|
15815
|
-
(0,
|
|
15897
|
+
(0, import_node_fs41.mkdirSync)((0, import_node_path41.dirname)(snap.cursor), { recursive: true });
|
|
15898
|
+
(0, import_node_fs41.writeFileSync)(snap.cursor, `${nextCursor}
|
|
15816
15899
|
`);
|
|
15817
15900
|
} catch {
|
|
15818
15901
|
}
|
|
@@ -15839,7 +15922,7 @@ async function waitForDetachedJob(cwd, id, opts) {
|
|
|
15839
15922
|
const dir = resolveJobDir(root, jobId);
|
|
15840
15923
|
const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
|
|
15841
15924
|
const sleep2 = opts?.sleep ?? sleepMs;
|
|
15842
|
-
if (!(0,
|
|
15925
|
+
if (!(0, import_node_fs41.existsSync)(dir)) {
|
|
15843
15926
|
return {
|
|
15844
15927
|
stillRunning: false,
|
|
15845
15928
|
ok: false,
|
|
@@ -15885,10 +15968,10 @@ function killProcessTree(pid, signal) {
|
|
|
15885
15968
|
}
|
|
15886
15969
|
function appendJobLog(logFile, line) {
|
|
15887
15970
|
try {
|
|
15888
|
-
(0,
|
|
15971
|
+
(0, import_node_fs41.mkdirSync)((0, import_node_path41.dirname)(logFile), { recursive: true });
|
|
15889
15972
|
const body = line.endsWith("\n") ? line : `${line}
|
|
15890
15973
|
`;
|
|
15891
|
-
(0,
|
|
15974
|
+
(0, import_node_fs41.appendFileSync)(logFile, body);
|
|
15892
15975
|
} catch {
|
|
15893
15976
|
}
|
|
15894
15977
|
}
|
|
@@ -15898,7 +15981,7 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
15898
15981
|
const dir = resolveJobDir(root, jobId);
|
|
15899
15982
|
const sleep2 = opts?.sleep ?? sleepMs;
|
|
15900
15983
|
const why = opts?.reason?.trim() ?? "";
|
|
15901
|
-
if (!(0,
|
|
15984
|
+
if (!(0, import_node_fs41.existsSync)(dir)) {
|
|
15902
15985
|
return {
|
|
15903
15986
|
stillRunning: false,
|
|
15904
15987
|
ok: false,
|
|
@@ -15934,10 +16017,10 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
15934
16017
|
killProcessTree(targetPid, "SIGKILL");
|
|
15935
16018
|
await sleep2(100);
|
|
15936
16019
|
}
|
|
15937
|
-
const exitFile = (0,
|
|
15938
|
-
if (!(0,
|
|
16020
|
+
const exitFile = (0, import_node_path41.join)(dir, "exit");
|
|
16021
|
+
if (!(0, import_node_fs41.existsSync)(exitFile)) {
|
|
15939
16022
|
try {
|
|
15940
|
-
(0,
|
|
16023
|
+
(0, import_node_fs41.writeFileSync)(exitFile, "1\n");
|
|
15941
16024
|
} catch {
|
|
15942
16025
|
}
|
|
15943
16026
|
}
|
|
@@ -15957,12 +16040,12 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
15957
16040
|
hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
|
|
15958
16041
|
};
|
|
15959
16042
|
}
|
|
15960
|
-
var
|
|
16043
|
+
var import_node_fs41, import_node_path41, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
|
|
15961
16044
|
var init_wait_for_job = __esm({
|
|
15962
16045
|
"src/mcp/wait-for-job.ts"() {
|
|
15963
16046
|
"use strict";
|
|
15964
|
-
|
|
15965
|
-
|
|
16047
|
+
import_node_fs41 = require("fs");
|
|
16048
|
+
import_node_path41 = require("path");
|
|
15966
16049
|
init_workspace_scratch();
|
|
15967
16050
|
init_wait_for_turn();
|
|
15968
16051
|
MAX_JOB_CONTINUES = 8;
|
|
@@ -17099,7 +17182,7 @@ function reuseLiveThread(input, repoPath, match) {
|
|
|
17099
17182
|
}
|
|
17100
17183
|
async function createThread(input, _onSetupLine) {
|
|
17101
17184
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
17102
|
-
if (!(0,
|
|
17185
|
+
if (!(0, import_node_fs42.existsSync)(repoPath)) {
|
|
17103
17186
|
throw new Error(`Repo not found: ${repoPath}`);
|
|
17104
17187
|
}
|
|
17105
17188
|
const reused = reuseLiveThread(input, repoPath, {
|
|
@@ -17280,11 +17363,11 @@ async function listLinearIssues(agent, repoPath) {
|
|
|
17280
17363
|
}
|
|
17281
17364
|
return adapter.listLinearIssues(repoPath);
|
|
17282
17365
|
}
|
|
17283
|
-
var
|
|
17366
|
+
var import_node_fs42;
|
|
17284
17367
|
var init_create = __esm({
|
|
17285
17368
|
"src/threads/create.ts"() {
|
|
17286
17369
|
"use strict";
|
|
17287
|
-
|
|
17370
|
+
import_node_fs42 = require("fs");
|
|
17288
17371
|
init_detect();
|
|
17289
17372
|
init_worktree();
|
|
17290
17373
|
init_home_board();
|
|
@@ -17404,20 +17487,20 @@ function writeTurnLive(threadId, progress) {
|
|
|
17404
17487
|
const path2 = threadLivePath(threadId);
|
|
17405
17488
|
const tmp = `${path2}.${process.pid}.tmp`;
|
|
17406
17489
|
try {
|
|
17407
|
-
(0,
|
|
17408
|
-
(0,
|
|
17490
|
+
(0, import_node_fs43.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
|
|
17491
|
+
(0, import_node_fs43.renameSync)(tmp, path2);
|
|
17409
17492
|
} catch {
|
|
17410
17493
|
try {
|
|
17411
|
-
(0,
|
|
17494
|
+
(0, import_node_fs43.unlinkSync)(tmp);
|
|
17412
17495
|
} catch {
|
|
17413
17496
|
}
|
|
17414
17497
|
}
|
|
17415
17498
|
}
|
|
17416
17499
|
function readTurnLive(threadId) {
|
|
17417
17500
|
const path2 = threadLivePath(threadId);
|
|
17418
|
-
if (!(0,
|
|
17501
|
+
if (!(0, import_node_fs43.existsSync)(path2)) return null;
|
|
17419
17502
|
try {
|
|
17420
|
-
const raw = JSON.parse((0,
|
|
17503
|
+
const raw = JSON.parse((0, import_node_fs43.readFileSync)(path2, "utf8"));
|
|
17421
17504
|
if (!raw || typeof raw.summary !== "string") return null;
|
|
17422
17505
|
return raw;
|
|
17423
17506
|
} catch {
|
|
@@ -17429,17 +17512,17 @@ function clearTurnLive(threadId) {
|
|
|
17429
17512
|
if (buf?.timer) clearTimeout(buf.timer);
|
|
17430
17513
|
buffers.delete(threadId);
|
|
17431
17514
|
const path2 = threadLivePath(threadId);
|
|
17432
|
-
if (!(0,
|
|
17515
|
+
if (!(0, import_node_fs43.existsSync)(path2)) return;
|
|
17433
17516
|
try {
|
|
17434
|
-
(0,
|
|
17517
|
+
(0, import_node_fs43.unlinkSync)(path2);
|
|
17435
17518
|
} catch {
|
|
17436
17519
|
}
|
|
17437
17520
|
}
|
|
17438
|
-
var
|
|
17521
|
+
var import_node_fs43, buffers, FLUSH_MS, MAX_PARTS;
|
|
17439
17522
|
var init_turn_live = __esm({
|
|
17440
17523
|
"src/store/turn-live.ts"() {
|
|
17441
17524
|
"use strict";
|
|
17442
|
-
|
|
17525
|
+
import_node_fs43 = require("fs");
|
|
17443
17526
|
init_message_parts();
|
|
17444
17527
|
init_paths();
|
|
17445
17528
|
buffers = /* @__PURE__ */ new Map();
|
|
@@ -17659,7 +17742,7 @@ var init_quota_failover = __esm({
|
|
|
17659
17742
|
// src/threads/adopt.ts
|
|
17660
17743
|
function thisModuleFile() {
|
|
17661
17744
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
17662
|
-
return cjsFile || process.argv[1] || (0,
|
|
17745
|
+
return cjsFile || process.argv[1] || (0, import_node_path42.join)(process.cwd(), "package.json");
|
|
17663
17746
|
}
|
|
17664
17747
|
function openReadonlySqlite(file) {
|
|
17665
17748
|
const req = (0, import_node_module4.createRequire)(thisModuleFile());
|
|
@@ -17677,21 +17760,21 @@ function mapAgentType(raw) {
|
|
|
17677
17760
|
return null;
|
|
17678
17761
|
}
|
|
17679
17762
|
function resolveConductorCursorAgentId(workspacePath) {
|
|
17680
|
-
if (!workspacePath || !(0,
|
|
17763
|
+
if (!workspacePath || !(0, import_node_fs44.existsSync)(CURSOR_SDK_STORE)) return null;
|
|
17681
17764
|
const normalized = workspacePath.replace(/\/$/, "");
|
|
17682
17765
|
let best = null;
|
|
17683
17766
|
let hashes;
|
|
17684
17767
|
try {
|
|
17685
|
-
hashes = (0,
|
|
17768
|
+
hashes = (0, import_node_fs44.readdirSync)(CURSOR_SDK_STORE);
|
|
17686
17769
|
} catch {
|
|
17687
17770
|
return null;
|
|
17688
17771
|
}
|
|
17689
17772
|
for (const hash of hashes) {
|
|
17690
|
-
const agentsFile = (0,
|
|
17691
|
-
if (!(0,
|
|
17773
|
+
const agentsFile = (0, import_node_path42.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
17774
|
+
if (!(0, import_node_fs44.existsSync)(agentsFile)) continue;
|
|
17692
17775
|
let text7;
|
|
17693
17776
|
try {
|
|
17694
|
-
text7 = (0,
|
|
17777
|
+
text7 = (0, import_node_fs44.readFileSync)(agentsFile, "utf8");
|
|
17695
17778
|
} catch {
|
|
17696
17779
|
continue;
|
|
17697
17780
|
}
|
|
@@ -17715,7 +17798,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
17715
17798
|
return best?.agentId ?? null;
|
|
17716
17799
|
}
|
|
17717
17800
|
async function adoptThread(input) {
|
|
17718
|
-
if (!(0,
|
|
17801
|
+
if (!(0, import_node_fs44.existsSync)(input.worktreePath)) {
|
|
17719
17802
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
17720
17803
|
}
|
|
17721
17804
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
@@ -17744,18 +17827,18 @@ function conductorDbPath() {
|
|
|
17744
17827
|
return CONDUCTOR_DB;
|
|
17745
17828
|
}
|
|
17746
17829
|
function listConductorWorkspaces() {
|
|
17747
|
-
if (!(0,
|
|
17830
|
+
if (!(0, import_node_fs44.existsSync)(CONDUCTOR_DB)) {
|
|
17748
17831
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
17749
17832
|
}
|
|
17750
|
-
const tmp = (0,
|
|
17751
|
-
const snapshot = (0,
|
|
17833
|
+
const tmp = (0, import_node_fs44.mkdtempSync)((0, import_node_path42.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
|
|
17834
|
+
const snapshot = (0, import_node_path42.join)(tmp, "conductor.db");
|
|
17752
17835
|
try {
|
|
17753
|
-
(0,
|
|
17836
|
+
(0, import_node_fs44.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
17754
17837
|
for (const suffix of ["-wal", "-shm"]) {
|
|
17755
17838
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
17756
|
-
if ((0,
|
|
17839
|
+
if ((0, import_node_fs44.existsSync)(src)) {
|
|
17757
17840
|
try {
|
|
17758
|
-
(0,
|
|
17841
|
+
(0, import_node_fs44.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
17759
17842
|
} catch {
|
|
17760
17843
|
}
|
|
17761
17844
|
}
|
|
@@ -17831,22 +17914,22 @@ function listConductorWorkspaces() {
|
|
|
17831
17914
|
db.close();
|
|
17832
17915
|
}
|
|
17833
17916
|
} finally {
|
|
17834
|
-
(0,
|
|
17917
|
+
(0, import_node_fs44.rmSync)(tmp, { recursive: true, force: true });
|
|
17835
17918
|
}
|
|
17836
17919
|
}
|
|
17837
17920
|
function importConductorWorkspace(workspaceId) {
|
|
17838
|
-
if (!(0,
|
|
17921
|
+
if (!(0, import_node_fs44.existsSync)(CONDUCTOR_DB)) {
|
|
17839
17922
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
17840
17923
|
}
|
|
17841
|
-
const tmp = (0,
|
|
17842
|
-
const snapshot = (0,
|
|
17924
|
+
const tmp = (0, import_node_fs44.mkdtempSync)((0, import_node_path42.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
|
|
17925
|
+
const snapshot = (0, import_node_path42.join)(tmp, "conductor.db");
|
|
17843
17926
|
try {
|
|
17844
|
-
(0,
|
|
17927
|
+
(0, import_node_fs44.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
17845
17928
|
for (const suffix of ["-wal", "-shm"]) {
|
|
17846
17929
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
17847
|
-
if ((0,
|
|
17930
|
+
if ((0, import_node_fs44.existsSync)(src)) {
|
|
17848
17931
|
try {
|
|
17849
|
-
(0,
|
|
17932
|
+
(0, import_node_fs44.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
17850
17933
|
} catch {
|
|
17851
17934
|
}
|
|
17852
17935
|
}
|
|
@@ -17864,7 +17947,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
17864
17947
|
).get(workspaceId);
|
|
17865
17948
|
if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
|
|
17866
17949
|
const worktreePath = String(row.workspacePath);
|
|
17867
|
-
if (!(0,
|
|
17950
|
+
if (!(0, import_node_fs44.existsSync)(worktreePath)) {
|
|
17868
17951
|
throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
|
|
17869
17952
|
}
|
|
17870
17953
|
let sessionId = null;
|
|
@@ -17927,31 +18010,31 @@ function importConductorWorkspace(workspaceId) {
|
|
|
17927
18010
|
db.close();
|
|
17928
18011
|
}
|
|
17929
18012
|
} finally {
|
|
17930
|
-
(0,
|
|
18013
|
+
(0, import_node_fs44.rmSync)(tmp, { recursive: true, force: true });
|
|
17931
18014
|
}
|
|
17932
18015
|
}
|
|
17933
18016
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
17934
18017
|
return importConductorWorkspace(workspaceId);
|
|
17935
18018
|
}
|
|
17936
|
-
var import_node_child_process4,
|
|
18019
|
+
var import_node_child_process4, import_node_fs44, import_node_os13, import_node_path42, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
17937
18020
|
var init_adopt = __esm({
|
|
17938
18021
|
"src/threads/adopt.ts"() {
|
|
17939
18022
|
"use strict";
|
|
17940
18023
|
import_node_child_process4 = require("child_process");
|
|
17941
|
-
|
|
18024
|
+
import_node_fs44 = require("fs");
|
|
17942
18025
|
import_node_os13 = require("os");
|
|
17943
|
-
|
|
18026
|
+
import_node_path42 = require("path");
|
|
17944
18027
|
import_node_module4 = require("module");
|
|
17945
18028
|
init_worktree();
|
|
17946
18029
|
init_thread_store();
|
|
17947
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
18030
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path42.join)(
|
|
17948
18031
|
process.env.HOME ?? "",
|
|
17949
18032
|
"Library",
|
|
17950
18033
|
"Application Support",
|
|
17951
18034
|
"com.conductor.app"
|
|
17952
18035
|
);
|
|
17953
|
-
CONDUCTOR_DB = (0,
|
|
17954
|
-
CURSOR_SDK_STORE = (0,
|
|
18036
|
+
CONDUCTOR_DB = (0, import_node_path42.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
18037
|
+
CURSOR_SDK_STORE = (0, import_node_path42.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
17955
18038
|
}
|
|
17956
18039
|
});
|
|
17957
18040
|
|
|
@@ -18018,7 +18101,7 @@ async function openStackLayer(input, _onSetupLine) {
|
|
|
18018
18101
|
let createdWorktree = false;
|
|
18019
18102
|
const trees = await listWorktrees(repoPath);
|
|
18020
18103
|
const checkedOut = trees.find((w) => w.branch === branchName);
|
|
18021
|
-
if (checkedOut?.path && (0,
|
|
18104
|
+
if (checkedOut?.path && (0, import_node_fs45.existsSync)(checkedOut.path)) {
|
|
18022
18105
|
if (input.reuseExistingWorktree !== false) {
|
|
18023
18106
|
worktreePath = checkedOut.path;
|
|
18024
18107
|
} else {
|
|
@@ -18160,7 +18243,7 @@ async function initStackFromThread(input, onSetupLine) {
|
|
|
18160
18243
|
async function createPrStack(input, onSetupLine) {
|
|
18161
18244
|
await requireAgent(input.agent);
|
|
18162
18245
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
18163
|
-
if (!(0,
|
|
18246
|
+
if (!(0, import_node_fs45.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
|
|
18164
18247
|
if (!input.branches.length) throw new Error("At least one branch name required");
|
|
18165
18248
|
const status = await detectGhStack(repoPath);
|
|
18166
18249
|
if (!status.available) throw new Error(status.reason);
|
|
@@ -18227,7 +18310,7 @@ async function createPrStack(input, onSetupLine) {
|
|
|
18227
18310
|
}
|
|
18228
18311
|
}
|
|
18229
18312
|
const claimed = new Set(threads.map((t) => t.worktreePath));
|
|
18230
|
-
if (!claimed.has(bootstrap.worktreePath) && (0,
|
|
18313
|
+
if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs45.existsSync)(bootstrap.worktreePath)) {
|
|
18231
18314
|
try {
|
|
18232
18315
|
await removeWorktree(repoPath, bootstrap.worktreePath, {
|
|
18233
18316
|
deleteBranch: bootstrap.branchName
|
|
@@ -18247,11 +18330,11 @@ function stackAgentDefaultsFrom(input) {
|
|
|
18247
18330
|
planMode: input.planMode
|
|
18248
18331
|
};
|
|
18249
18332
|
}
|
|
18250
|
-
var
|
|
18333
|
+
var import_node_fs45;
|
|
18251
18334
|
var init_stack_layers = __esm({
|
|
18252
18335
|
"src/threads/stack-layers.ts"() {
|
|
18253
18336
|
"use strict";
|
|
18254
|
-
|
|
18337
|
+
import_node_fs45 = require("fs");
|
|
18255
18338
|
init_detect();
|
|
18256
18339
|
init_run();
|
|
18257
18340
|
init_stack();
|
|
@@ -18264,7 +18347,7 @@ var init_stack_layers = __esm({
|
|
|
18264
18347
|
|
|
18265
18348
|
// src/diff/diff.ts
|
|
18266
18349
|
async function inspectGitWorktree(worktreePath) {
|
|
18267
|
-
if (!worktreePath || !(0,
|
|
18350
|
+
if (!worktreePath || !(0, import_node_fs46.existsSync)(worktreePath)) return "missing_worktree";
|
|
18268
18351
|
const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
|
|
18269
18352
|
reject: false
|
|
18270
18353
|
});
|
|
@@ -18272,7 +18355,7 @@ async function inspectGitWorktree(worktreePath) {
|
|
|
18272
18355
|
return "ok";
|
|
18273
18356
|
}
|
|
18274
18357
|
async function initializeGitRepository(worktreePath) {
|
|
18275
|
-
if (!worktreePath || !(0,
|
|
18358
|
+
if (!worktreePath || !(0, import_node_fs46.existsSync)(worktreePath)) {
|
|
18276
18359
|
throw new Error("Worktree not found");
|
|
18277
18360
|
}
|
|
18278
18361
|
const status = await inspectGitWorktree(worktreePath);
|
|
@@ -18406,11 +18489,11 @@ new file mode 100644
|
|
|
18406
18489
|
};
|
|
18407
18490
|
}
|
|
18408
18491
|
async function untrackedPatch(worktreePath, path2, maxHunk) {
|
|
18409
|
-
const abs = (0,
|
|
18492
|
+
const abs = (0, import_node_path43.join)(worktreePath, path2);
|
|
18410
18493
|
try {
|
|
18411
|
-
const st = (0,
|
|
18494
|
+
const st = (0, import_node_fs46.statSync)(abs);
|
|
18412
18495
|
if (st.isFile() && st.size > maxHunk) {
|
|
18413
|
-
const buf = (0,
|
|
18496
|
+
const buf = (0, import_node_fs46.readFileSync)(abs).subarray(0, maxHunk);
|
|
18414
18497
|
return syntheticAddPatch(path2, buf.toString("utf8"), maxHunk);
|
|
18415
18498
|
}
|
|
18416
18499
|
} catch {
|
|
@@ -18899,8 +18982,8 @@ function isImageRelativePath(relativePath) {
|
|
|
18899
18982
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
18900
18983
|
assertSafeRelativePath(relativePath);
|
|
18901
18984
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
18902
|
-
const abs = (0,
|
|
18903
|
-
const st = (0,
|
|
18985
|
+
const abs = (0, import_node_path43.join)(worktreePath, relativePath);
|
|
18986
|
+
const st = (0, import_node_fs46.statSync)(abs);
|
|
18904
18987
|
if (!st.isFile()) {
|
|
18905
18988
|
throw new Error(`Not a file: ${relativePath}`);
|
|
18906
18989
|
}
|
|
@@ -18909,7 +18992,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
18909
18992
|
`File too large to upload (${st.size} bytes; max ${maxBytes})`
|
|
18910
18993
|
);
|
|
18911
18994
|
}
|
|
18912
|
-
const buf = (0,
|
|
18995
|
+
const buf = (0, import_node_fs46.readFileSync)(abs);
|
|
18913
18996
|
return {
|
|
18914
18997
|
path: relativePath,
|
|
18915
18998
|
contentBase64: buf.toString("base64"),
|
|
@@ -18919,12 +19002,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
18919
19002
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
18920
19003
|
assertSafeRelativePath(relativePath);
|
|
18921
19004
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
18922
|
-
const abs = (0,
|
|
18923
|
-
const st = (0,
|
|
19005
|
+
const abs = (0, import_node_path43.join)(worktreePath, relativePath);
|
|
19006
|
+
const st = (0, import_node_fs46.statSync)(abs);
|
|
18924
19007
|
if (!st.isFile()) {
|
|
18925
19008
|
throw new Error(`Not a file: ${relativePath}`);
|
|
18926
19009
|
}
|
|
18927
|
-
const buf = (0,
|
|
19010
|
+
const buf = (0, import_node_fs46.readFileSync)(abs);
|
|
18928
19011
|
if (isImageRelativePath(relativePath)) {
|
|
18929
19012
|
const maxImageBytes = Math.max(maxBytes, 15e6);
|
|
18930
19013
|
const truncated2 = buf.length > maxImageBytes;
|
|
@@ -18967,9 +19050,9 @@ function assertSafeRelativePath(relativePath) {
|
|
|
18967
19050
|
}
|
|
18968
19051
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
18969
19052
|
assertSafeRelativePath(relativePath);
|
|
18970
|
-
const abs = (0,
|
|
18971
|
-
(0,
|
|
18972
|
-
(0,
|
|
19053
|
+
const abs = (0, import_node_path43.join)(worktreePath, relativePath);
|
|
19054
|
+
(0, import_node_fs46.mkdirSync)((0, import_node_path43.dirname)(abs), { recursive: true });
|
|
19055
|
+
(0, import_node_fs46.writeFileSync)(abs, content, "utf8");
|
|
18973
19056
|
return { path: relativePath };
|
|
18974
19057
|
}
|
|
18975
19058
|
async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
@@ -18986,12 +19069,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
18986
19069
|
truncated: full.files.length > maxFiles
|
|
18987
19070
|
};
|
|
18988
19071
|
}
|
|
18989
|
-
var
|
|
19072
|
+
var import_node_fs46, import_node_path43, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
|
|
18990
19073
|
var init_diff = __esm({
|
|
18991
19074
|
"src/diff/diff.ts"() {
|
|
18992
19075
|
"use strict";
|
|
18993
|
-
|
|
18994
|
-
|
|
19076
|
+
import_node_fs46 = require("fs");
|
|
19077
|
+
import_node_path43 = require("path");
|
|
18995
19078
|
init_run();
|
|
18996
19079
|
init_worktree();
|
|
18997
19080
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -19267,7 +19350,7 @@ function parseFrontmatter(content) {
|
|
|
19267
19350
|
}
|
|
19268
19351
|
function readSkill(skillMd, source) {
|
|
19269
19352
|
try {
|
|
19270
|
-
const content = (0,
|
|
19353
|
+
const content = (0, import_node_fs47.readFileSync)(skillMd, "utf8");
|
|
19271
19354
|
const { name: fmName, description } = parseFrontmatter(content);
|
|
19272
19355
|
const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
|
|
19273
19356
|
const name = fmName || dirName;
|
|
@@ -19286,19 +19369,19 @@ function readSkill(skillMd, source) {
|
|
|
19286
19369
|
}
|
|
19287
19370
|
}
|
|
19288
19371
|
function scanSkillsDir(dir, source, out) {
|
|
19289
|
-
if (!(0,
|
|
19372
|
+
if (!(0, import_node_fs47.existsSync)(dir)) return;
|
|
19290
19373
|
let entries;
|
|
19291
19374
|
try {
|
|
19292
|
-
entries = (0,
|
|
19375
|
+
entries = (0, import_node_fs47.readdirSync)(dir);
|
|
19293
19376
|
} catch {
|
|
19294
19377
|
return;
|
|
19295
19378
|
}
|
|
19296
19379
|
for (const entry of entries) {
|
|
19297
19380
|
if (entry.startsWith(".")) continue;
|
|
19298
|
-
const skillMd = (0,
|
|
19299
|
-
if (!(0,
|
|
19381
|
+
const skillMd = (0, import_node_path44.join)(dir, entry, "SKILL.md");
|
|
19382
|
+
if (!(0, import_node_fs47.existsSync)(skillMd)) continue;
|
|
19300
19383
|
try {
|
|
19301
|
-
if (!(0,
|
|
19384
|
+
if (!(0, import_node_fs47.statSync)(skillMd).isFile()) continue;
|
|
19302
19385
|
} catch {
|
|
19303
19386
|
continue;
|
|
19304
19387
|
}
|
|
@@ -19307,24 +19390,24 @@ function scanSkillsDir(dir, source, out) {
|
|
|
19307
19390
|
}
|
|
19308
19391
|
}
|
|
19309
19392
|
function scanClaudePluginSkills(pluginsRoot, out) {
|
|
19310
|
-
if (!(0,
|
|
19393
|
+
if (!(0, import_node_fs47.existsSync)(pluginsRoot)) return;
|
|
19311
19394
|
const walk = (dir, depth, lookingForSkillsDir) => {
|
|
19312
19395
|
if (depth > 7) return;
|
|
19313
19396
|
let entries;
|
|
19314
19397
|
try {
|
|
19315
|
-
entries = (0,
|
|
19398
|
+
entries = (0, import_node_fs47.readdirSync)(dir);
|
|
19316
19399
|
} catch {
|
|
19317
19400
|
return;
|
|
19318
19401
|
}
|
|
19319
19402
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
19320
|
-
const skill = readSkill((0,
|
|
19403
|
+
const skill = readSkill((0, import_node_path44.join)(dir, "SKILL.md"), "cli");
|
|
19321
19404
|
if (skill) out.push(skill);
|
|
19322
19405
|
}
|
|
19323
19406
|
for (const entry of entries) {
|
|
19324
19407
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
19325
|
-
const full = (0,
|
|
19408
|
+
const full = (0, import_node_path44.join)(dir, entry);
|
|
19326
19409
|
try {
|
|
19327
|
-
if (!(0,
|
|
19410
|
+
if (!(0, import_node_fs47.statSync)(full).isDirectory()) continue;
|
|
19328
19411
|
} catch {
|
|
19329
19412
|
continue;
|
|
19330
19413
|
}
|
|
@@ -19342,17 +19425,17 @@ function discoverSkills(worktreePath) {
|
|
|
19342
19425
|
const home = (0, import_node_os14.homedir)();
|
|
19343
19426
|
const collected = [];
|
|
19344
19427
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
19345
|
-
scanSkillsDir((0,
|
|
19428
|
+
scanSkillsDir((0, import_node_path44.join)(worktreePath, rel), "workspace", collected);
|
|
19346
19429
|
}
|
|
19347
19430
|
for (const abs of [
|
|
19348
|
-
(0,
|
|
19349
|
-
(0,
|
|
19350
|
-
(0,
|
|
19351
|
-
(0,
|
|
19431
|
+
(0, import_node_path44.join)(home, ".claude/skills"),
|
|
19432
|
+
(0, import_node_path44.join)(home, ".cursor/skills"),
|
|
19433
|
+
(0, import_node_path44.join)(home, ".sideboard/skills"),
|
|
19434
|
+
(0, import_node_path44.join)(home, ".brightsy/skills")
|
|
19352
19435
|
]) {
|
|
19353
19436
|
scanSkillsDir(abs, "user", collected);
|
|
19354
19437
|
}
|
|
19355
|
-
scanClaudePluginSkills((0,
|
|
19438
|
+
scanClaudePluginSkills((0, import_node_path44.join)(home, ".claude/plugins"), collected);
|
|
19356
19439
|
collected.push(...bundledSkills());
|
|
19357
19440
|
const rank = {
|
|
19358
19441
|
workspace: 0,
|
|
@@ -19378,7 +19461,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
19378
19461
|
\u2026(truncated)` : body;
|
|
19379
19462
|
}
|
|
19380
19463
|
}
|
|
19381
|
-
const raw = (0,
|
|
19464
|
+
const raw = (0, import_node_fs47.readFileSync)(skillPath, "utf8");
|
|
19382
19465
|
if (raw.startsWith("---")) {
|
|
19383
19466
|
const end = raw.indexOf("\n---", 3);
|
|
19384
19467
|
if (end >= 0) {
|
|
@@ -19392,13 +19475,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
19392
19475
|
|
|
19393
19476
|
\u2026(truncated)` : raw;
|
|
19394
19477
|
}
|
|
19395
|
-
var
|
|
19478
|
+
var import_node_fs47, import_node_os14, import_node_path44, BUNDLED_SKILL_PREFIX;
|
|
19396
19479
|
var init_discover = __esm({
|
|
19397
19480
|
"src/skills/discover.ts"() {
|
|
19398
19481
|
"use strict";
|
|
19399
|
-
|
|
19482
|
+
import_node_fs47 = require("fs");
|
|
19400
19483
|
import_node_os14 = require("os");
|
|
19401
|
-
|
|
19484
|
+
import_node_path44 = require("path");
|
|
19402
19485
|
init_long_running();
|
|
19403
19486
|
BUNDLED_SKILL_PREFIX = "bundled:";
|
|
19404
19487
|
}
|
|
@@ -19492,8 +19575,8 @@ var init_expand = __esm({
|
|
|
19492
19575
|
// src/skills/detached-job-path.ts
|
|
19493
19576
|
function detachedJobScriptIn(dir) {
|
|
19494
19577
|
for (const name of DETACHED_JOB_FILENAMES) {
|
|
19495
|
-
const script = (0,
|
|
19496
|
-
if ((0,
|
|
19578
|
+
const script = (0, import_node_path45.join)(dir, "scripts", name);
|
|
19579
|
+
if ((0, import_node_fs48.existsSync)(script)) return script;
|
|
19497
19580
|
}
|
|
19498
19581
|
return null;
|
|
19499
19582
|
}
|
|
@@ -19505,11 +19588,11 @@ function packagedDetachedJobPath() {
|
|
|
19505
19588
|
function resolveDetachedJobScript() {
|
|
19506
19589
|
const packaged = packagedDetachedJobPath();
|
|
19507
19590
|
if (packaged) return packaged;
|
|
19508
|
-
let dir = (0,
|
|
19591
|
+
let dir = (0, import_node_path45.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
|
|
19509
19592
|
for (let i = 0; i < 8; i++) {
|
|
19510
19593
|
const candidate = detachedJobScriptIn(dir);
|
|
19511
19594
|
if (candidate) return candidate;
|
|
19512
|
-
const parent = (0,
|
|
19595
|
+
const parent = (0, import_node_path45.dirname)(dir);
|
|
19513
19596
|
if (parent === dir) break;
|
|
19514
19597
|
dir = parent;
|
|
19515
19598
|
}
|
|
@@ -19520,12 +19603,12 @@ function formatDetachedJobInvoke(scriptPath) {
|
|
|
19520
19603
|
if (resolved) return `node ${JSON.stringify(resolved)}`;
|
|
19521
19604
|
return "node scripts/detached-job.cjs";
|
|
19522
19605
|
}
|
|
19523
|
-
var
|
|
19606
|
+
var import_node_fs48, import_node_path45, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
|
|
19524
19607
|
var init_detached_job_path = __esm({
|
|
19525
19608
|
"src/skills/detached-job-path.ts"() {
|
|
19526
19609
|
"use strict";
|
|
19527
|
-
|
|
19528
|
-
|
|
19610
|
+
import_node_fs48 = require("fs");
|
|
19611
|
+
import_node_path45 = require("path");
|
|
19529
19612
|
import_node_url3 = require("url");
|
|
19530
19613
|
init_packaged_runtime();
|
|
19531
19614
|
import_meta3 = {};
|
|
@@ -19705,11 +19788,13 @@ function formatPrGateDirective() {
|
|
|
19705
19788
|
}
|
|
19706
19789
|
function formatProcessGuideDirective(opts) {
|
|
19707
19790
|
const worktree = opts?.worktreePath?.trim();
|
|
19708
|
-
const hasGraphSkill = !!worktree && (0,
|
|
19709
|
-
const hasReviewSkill = !!worktree && (0,
|
|
19791
|
+
const hasGraphSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
|
|
19792
|
+
const hasReviewSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/review/SKILL.md"));
|
|
19793
|
+
const hasInstallSkill = !!worktree && (0, import_node_fs49.existsSync)((0, import_node_path46.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
|
|
19710
19794
|
return [
|
|
19711
19795
|
"Process guides (recurring work only):",
|
|
19712
19796
|
hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
|
|
19797
|
+
hasInstallSkill ? "- After merge-from-main / lockfile change, or a hung `pnpm install`: follow `.claude/skills/worktree-install/SKILL.md` (`/worktree-install`). Use the worktree-local store Sideboard already set; do not share `~/.pnpm-store` across concurrent worktrees." : null,
|
|
19713
19798
|
"- If this same shape of work will happen again, write `.claude/skills/<kebab-name>/SKILL.md` in this worktree (Claude Code project skill; Sideboard `/name`, Claude Code, and `attach` all load it). Not under `.sideboard/skills/`. Point Codex/OpenCode at it from `AGENTS.md`.",
|
|
19714
19799
|
hasReviewSkill ? "- Merge-readiness notes go in `.claude/skills/review/SKILL.md` (edit it; do not create another review skill)." : "- Merge-readiness notes go in `.context/review.md` (copied from `.sideboard/review.md` when that file exists). Do not create a review skill.",
|
|
19715
19800
|
"- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
|
|
@@ -19743,12 +19828,12 @@ function formatArtifactDirective() {
|
|
|
19743
19828
|
function formatUiReminder() {
|
|
19744
19829
|
return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). ask_user only for a real multiple-choice (not hellos or \u201Cwhat next?\u201D) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable.";
|
|
19745
19830
|
}
|
|
19746
|
-
var
|
|
19831
|
+
var import_node_fs49, import_node_path46, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
|
|
19747
19832
|
var init_instructions = __esm({
|
|
19748
19833
|
"src/agents/instructions.ts"() {
|
|
19749
19834
|
"use strict";
|
|
19750
|
-
|
|
19751
|
-
|
|
19835
|
+
import_node_fs49 = require("fs");
|
|
19836
|
+
import_node_path46 = require("path");
|
|
19752
19837
|
init_git_auth_mode();
|
|
19753
19838
|
init_worktree_labels();
|
|
19754
19839
|
init_detached_job_path();
|
|
@@ -20101,40 +20186,40 @@ __export(plan_file_exports, {
|
|
|
20101
20186
|
writePlanFile: () => writePlanFile
|
|
20102
20187
|
});
|
|
20103
20188
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
20104
|
-
const gitignoreAbs = (0,
|
|
20105
|
-
if ((0,
|
|
20106
|
-
(0,
|
|
20107
|
-
(0,
|
|
20189
|
+
const gitignoreAbs = (0, import_node_path47.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
20190
|
+
if ((0, import_node_fs50.existsSync)(gitignoreAbs)) return;
|
|
20191
|
+
(0, import_node_fs50.mkdirSync)((0, import_node_path47.dirname)(gitignoreAbs), { recursive: true });
|
|
20192
|
+
(0, import_node_fs50.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
20108
20193
|
}
|
|
20109
20194
|
function planFileAbs(worktreePath) {
|
|
20110
|
-
return (0,
|
|
20195
|
+
return (0, import_node_path47.join)(worktreePath, PLAN_FILE_REL);
|
|
20111
20196
|
}
|
|
20112
20197
|
function readTextIfPresent2(abs) {
|
|
20113
|
-
if (!(0,
|
|
20198
|
+
if (!(0, import_node_fs50.existsSync)(abs)) return null;
|
|
20114
20199
|
try {
|
|
20115
|
-
const content = (0,
|
|
20200
|
+
const content = (0, import_node_fs50.readFileSync)(abs, "utf8");
|
|
20116
20201
|
return content.trim() ? content : null;
|
|
20117
20202
|
} catch {
|
|
20118
20203
|
return null;
|
|
20119
20204
|
}
|
|
20120
20205
|
}
|
|
20121
20206
|
function readPlanFile(worktreePath) {
|
|
20122
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
20207
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path47.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path47.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
20123
20208
|
}
|
|
20124
20209
|
function writePlanFile(worktreePath, content) {
|
|
20125
20210
|
ensureAttachmentsGitignore(worktreePath);
|
|
20126
20211
|
const abs = planFileAbs(worktreePath);
|
|
20127
|
-
(0,
|
|
20212
|
+
(0, import_node_fs50.mkdirSync)((0, import_node_path47.dirname)(abs), { recursive: true });
|
|
20128
20213
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
20129
|
-
(0,
|
|
20214
|
+
(0, import_node_fs50.writeFileSync)(abs, body, "utf8");
|
|
20130
20215
|
return PLAN_FILE_REL;
|
|
20131
20216
|
}
|
|
20132
|
-
var
|
|
20217
|
+
var import_node_fs50, import_node_path47;
|
|
20133
20218
|
var init_plan_file = __esm({
|
|
20134
20219
|
"src/plan/plan-file.ts"() {
|
|
20135
20220
|
"use strict";
|
|
20136
|
-
|
|
20137
|
-
|
|
20221
|
+
import_node_fs50 = require("fs");
|
|
20222
|
+
import_node_path47 = require("path");
|
|
20138
20223
|
init_workspace_scratch();
|
|
20139
20224
|
init_plan_present();
|
|
20140
20225
|
init_plan_present();
|
|
@@ -20182,13 +20267,13 @@ var init_sync_branch = __esm({
|
|
|
20182
20267
|
|
|
20183
20268
|
// src/agents/cursor-store.ts
|
|
20184
20269
|
function cursorSdkStoreDir(threadId) {
|
|
20185
|
-
const root = (0,
|
|
20270
|
+
const root = (0, import_node_path48.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
20186
20271
|
const id = sanitizeCursorStoreSegment(threadId);
|
|
20187
20272
|
if (!id) return root;
|
|
20188
|
-
return (0,
|
|
20273
|
+
return (0, import_node_path48.join)(root, "threads", id);
|
|
20189
20274
|
}
|
|
20190
20275
|
function cursorSdkRunsNdjsonPath(threadId) {
|
|
20191
|
-
return (0,
|
|
20276
|
+
return (0, import_node_path48.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
20192
20277
|
}
|
|
20193
20278
|
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
20194
20279
|
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
@@ -20201,11 +20286,11 @@ function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
|
20201
20286
|
function sanitizeCursorStoreSegment(threadId) {
|
|
20202
20287
|
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
20203
20288
|
}
|
|
20204
|
-
var
|
|
20289
|
+
var import_node_path48, CURSOR_SDK_STORE_DIR;
|
|
20205
20290
|
var init_cursor_store = __esm({
|
|
20206
20291
|
"src/agents/cursor-store.ts"() {
|
|
20207
20292
|
"use strict";
|
|
20208
|
-
|
|
20293
|
+
import_node_path48 = require("path");
|
|
20209
20294
|
init_paths();
|
|
20210
20295
|
CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
20211
20296
|
}
|
|
@@ -20227,9 +20312,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
20227
20312
|
return best;
|
|
20228
20313
|
}
|
|
20229
20314
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
20230
|
-
if (!(0,
|
|
20315
|
+
if (!(0, import_node_fs51.existsSync)(runsPath)) return null;
|
|
20231
20316
|
try {
|
|
20232
|
-
const lines = (0,
|
|
20317
|
+
const lines = (0, import_node_fs51.readFileSync)(runsPath, "utf8").split("\n");
|
|
20233
20318
|
let best = null;
|
|
20234
20319
|
for (const line of lines) {
|
|
20235
20320
|
const trimmed = line.trim();
|
|
@@ -20255,11 +20340,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
20255
20340
|
return null;
|
|
20256
20341
|
}
|
|
20257
20342
|
}
|
|
20258
|
-
var
|
|
20343
|
+
var import_node_fs51;
|
|
20259
20344
|
var init_cursor_recover = __esm({
|
|
20260
20345
|
"src/agents/cursor-recover.ts"() {
|
|
20261
20346
|
"use strict";
|
|
20262
|
-
|
|
20347
|
+
import_node_fs51 = require("fs");
|
|
20263
20348
|
init_cursor_store();
|
|
20264
20349
|
}
|
|
20265
20350
|
});
|
|
@@ -20391,13 +20476,13 @@ async function startOrchestration(opts) {
|
|
|
20391
20476
|
}
|
|
20392
20477
|
return updated;
|
|
20393
20478
|
}
|
|
20394
|
-
var import_node_events,
|
|
20479
|
+
var import_node_events, import_node_fs52, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
|
|
20395
20480
|
var init_orchestrator = __esm({
|
|
20396
20481
|
"src/orchestrator/orchestrator.ts"() {
|
|
20397
20482
|
"use strict";
|
|
20398
20483
|
import_node_events = require("events");
|
|
20399
20484
|
init_outbound_watch();
|
|
20400
|
-
|
|
20485
|
+
import_node_fs52 = require("fs");
|
|
20401
20486
|
init_error_detail();
|
|
20402
20487
|
init_run();
|
|
20403
20488
|
init_stale_lock();
|
|
@@ -20570,7 +20655,7 @@ var init_orchestrator = __esm({
|
|
|
20570
20655
|
}
|
|
20571
20656
|
continue;
|
|
20572
20657
|
}
|
|
20573
|
-
if (!(0,
|
|
20658
|
+
if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
|
|
20574
20659
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
20575
20660
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
20576
20661
|
continue;
|
|
@@ -21115,9 +21200,10 @@ var init_orchestrator = __esm({
|
|
|
21115
21200
|
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
21116
21201
|
});
|
|
21117
21202
|
thread = this.requireThread(threadId);
|
|
21203
|
+
const gitPrompt = expandCanonicalGitRequest(prompt);
|
|
21118
21204
|
const { agentPrompt: expandedPrompt } = expandComposerPrompt(
|
|
21119
21205
|
thread.worktreePath,
|
|
21120
|
-
|
|
21206
|
+
gitPrompt,
|
|
21121
21207
|
{
|
|
21122
21208
|
attachments: sentAttachments ?? thread.attachments
|
|
21123
21209
|
}
|
|
@@ -21159,13 +21245,13 @@ var init_orchestrator = __esm({
|
|
|
21159
21245
|
artifactReminder,
|
|
21160
21246
|
longRunningReminder
|
|
21161
21247
|
].filter(Boolean).join("\n\n") || void 0;
|
|
21162
|
-
const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(
|
|
21248
|
+
const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(prompt) ? formatPrGateDirective() : null;
|
|
21163
21249
|
const agentPrompt = [
|
|
21164
21250
|
thread.planMode ? PLAN_MODE_INSTRUCTION : null,
|
|
21165
21251
|
orchestrationReminder,
|
|
21166
21252
|
prGateDirective,
|
|
21167
21253
|
slackReplyContext,
|
|
21168
|
-
|
|
21254
|
+
expandedPrompt
|
|
21169
21255
|
].filter(Boolean).join("\n\n");
|
|
21170
21256
|
if (thread.attachments.length > 0) {
|
|
21171
21257
|
updateThread(threadId, { attachments: [] });
|
|
@@ -22460,7 +22546,7 @@ var init_orchestrator = __esm({
|
|
|
22460
22546
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
22461
22547
|
return restored2;
|
|
22462
22548
|
}
|
|
22463
|
-
if (!(0,
|
|
22549
|
+
if (!(0, import_node_fs52.existsSync)(thread.worktreePath)) {
|
|
22464
22550
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
22465
22551
|
throw new Error(
|
|
22466
22552
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -25090,7 +25176,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
25090
25176
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
25091
25177
|
var import_zod8 = require("zod");
|
|
25092
25178
|
var import_node_crypto13 = require("crypto");
|
|
25093
|
-
var
|
|
25179
|
+
var import_node_path51 = require("path");
|
|
25094
25180
|
init_orchestrator();
|
|
25095
25181
|
init_worktree();
|
|
25096
25182
|
init_global_workspace();
|
|
@@ -26674,27 +26760,27 @@ init_gh_errors();
|
|
|
26674
26760
|
init_git_auth_mode();
|
|
26675
26761
|
|
|
26676
26762
|
// src/board/load-home-board.ts
|
|
26677
|
-
var
|
|
26678
|
-
var
|
|
26763
|
+
var import_node_fs54 = require("fs");
|
|
26764
|
+
var import_node_path50 = require("path");
|
|
26679
26765
|
init_worktree();
|
|
26680
26766
|
init_paths();
|
|
26681
26767
|
|
|
26682
26768
|
// src/board/board-pins.ts
|
|
26683
26769
|
var import_node_crypto12 = require("crypto");
|
|
26684
|
-
var
|
|
26685
|
-
var
|
|
26770
|
+
var import_node_fs53 = require("fs");
|
|
26771
|
+
var import_node_path49 = require("path");
|
|
26686
26772
|
init_paths();
|
|
26687
26773
|
init_home_board();
|
|
26688
26774
|
var FILE = "home-board-pins.json";
|
|
26689
26775
|
var VERSION = 1;
|
|
26690
26776
|
function pinsFile() {
|
|
26691
|
-
return (0,
|
|
26777
|
+
return (0, import_node_path49.join)(appDataDir(), FILE);
|
|
26692
26778
|
}
|
|
26693
26779
|
function readDisk() {
|
|
26694
26780
|
const path2 = pinsFile();
|
|
26695
|
-
if (!(0,
|
|
26781
|
+
if (!(0, import_node_fs53.existsSync)(path2)) return [];
|
|
26696
26782
|
try {
|
|
26697
|
-
const raw = JSON.parse((0,
|
|
26783
|
+
const raw = JSON.parse((0, import_node_fs53.readFileSync)(path2, "utf8"));
|
|
26698
26784
|
if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
|
|
26699
26785
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
26700
26786
|
} catch {
|
|
@@ -26702,8 +26788,8 @@ function readDisk() {
|
|
|
26702
26788
|
}
|
|
26703
26789
|
}
|
|
26704
26790
|
function writeDisk(items) {
|
|
26705
|
-
(0,
|
|
26706
|
-
(0,
|
|
26791
|
+
(0, import_node_fs53.mkdirSync)(appDataDir(), { recursive: true });
|
|
26792
|
+
(0, import_node_fs53.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
|
|
26707
26793
|
}
|
|
26708
26794
|
function listBoardPins() {
|
|
26709
26795
|
return readDisk();
|
|
@@ -26755,7 +26841,7 @@ function replaceBoardPins(items) {
|
|
|
26755
26841
|
}
|
|
26756
26842
|
function clearBoardPins() {
|
|
26757
26843
|
try {
|
|
26758
|
-
(0,
|
|
26844
|
+
(0, import_node_fs53.unlinkSync)(pinsFile());
|
|
26759
26845
|
} catch {
|
|
26760
26846
|
}
|
|
26761
26847
|
}
|
|
@@ -26772,7 +26858,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
26772
26858
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
26773
26859
|
}
|
|
26774
26860
|
function cacheFile() {
|
|
26775
|
-
return (0,
|
|
26861
|
+
return (0, import_node_path50.join)(appDataDir(), "home-board-cache.json");
|
|
26776
26862
|
}
|
|
26777
26863
|
function emptyInputs() {
|
|
26778
26864
|
return {
|
|
@@ -26798,9 +26884,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
26798
26884
|
}
|
|
26799
26885
|
function readDiskCache() {
|
|
26800
26886
|
const path2 = cacheFile();
|
|
26801
|
-
if (!(0,
|
|
26887
|
+
if (!(0, import_node_fs54.existsSync)(path2)) return null;
|
|
26802
26888
|
try {
|
|
26803
|
-
const raw = JSON.parse((0,
|
|
26889
|
+
const raw = JSON.parse((0, import_node_fs54.readFileSync)(path2, "utf8"));
|
|
26804
26890
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
26805
26891
|
return null;
|
|
26806
26892
|
}
|
|
@@ -26814,14 +26900,14 @@ function readDiskCache() {
|
|
|
26814
26900
|
}
|
|
26815
26901
|
function writeDiskCache(entry) {
|
|
26816
26902
|
try {
|
|
26817
|
-
(0,
|
|
26818
|
-
(0,
|
|
26903
|
+
(0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
|
|
26904
|
+
(0, import_node_fs54.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
26819
26905
|
} catch {
|
|
26820
26906
|
}
|
|
26821
26907
|
}
|
|
26822
26908
|
function deleteDiskCache() {
|
|
26823
26909
|
try {
|
|
26824
|
-
(0,
|
|
26910
|
+
(0, import_node_fs54.unlinkSync)(cacheFile());
|
|
26825
26911
|
} catch {
|
|
26826
26912
|
}
|
|
26827
26913
|
}
|
|
@@ -27129,7 +27215,7 @@ async function startMcpServer() {
|
|
|
27129
27215
|
async () => {
|
|
27130
27216
|
const threads = orch.getThreads(true);
|
|
27131
27217
|
const lines = threads.map((t) => {
|
|
27132
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
27218
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path51.basename)(t.repoPath) || t.repoPath;
|
|
27133
27219
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
27134
27220
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
27135
27221
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -29631,7 +29717,7 @@ async function handleSlackInbound(msg, opts) {
|
|
|
29631
29717
|
log(`skip superseded ${msg.kind} ${msg.ts}`);
|
|
29632
29718
|
return;
|
|
29633
29719
|
}
|
|
29634
|
-
const agent = coerceOrchestratorAgent(opts.agent ??
|
|
29720
|
+
const agent = coerceOrchestratorAgent(opts.agent ?? resolveOrchestratorDefaults().agent);
|
|
29635
29721
|
const workspaces = refreshWorkspaces2();
|
|
29636
29722
|
for (const ws of workspaces) {
|
|
29637
29723
|
await getOrchestrator().reconcile(ws.path).catch(() => void 0);
|
|
@@ -29788,7 +29874,7 @@ async function runSlackListen(opts = {}) {
|
|
|
29788
29874
|
const log = opts.onLog ?? console.log;
|
|
29789
29875
|
const connected = listSlackWorkspacesRaw();
|
|
29790
29876
|
const orch = getOrchestrator();
|
|
29791
|
-
const agent = coerceOrchestratorAgent(opts.agent ??
|
|
29877
|
+
const agent = coerceOrchestratorAgent(opts.agent ?? resolveOrchestratorDefaults().agent);
|
|
29792
29878
|
let inboundGeneration = 0;
|
|
29793
29879
|
const off = orch.on((event) => {
|
|
29794
29880
|
if (event.type !== "turn_finished") return;
|
|
@@ -30089,9 +30175,9 @@ var import_node_http3 = require("http");
|
|
|
30089
30175
|
var import_ws3 = require("ws");
|
|
30090
30176
|
|
|
30091
30177
|
// src/slack/relay-static.ts
|
|
30092
|
-
var
|
|
30178
|
+
var import_node_fs55 = require("fs");
|
|
30093
30179
|
var import_promises = require("fs/promises");
|
|
30094
|
-
var
|
|
30180
|
+
var import_node_path52 = __toESM(require("path"), 1);
|
|
30095
30181
|
var TYPES = {
|
|
30096
30182
|
".css": "text/css; charset=utf-8",
|
|
30097
30183
|
".html": "text/html; charset=utf-8",
|
|
@@ -30122,9 +30208,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
30122
30208
|
return null;
|
|
30123
30209
|
}
|
|
30124
30210
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
30125
|
-
const rootResolved =
|
|
30126
|
-
const candidate =
|
|
30127
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
30211
|
+
const rootResolved = import_node_path52.default.resolve(root);
|
|
30212
|
+
const candidate = import_node_path52.default.resolve(rootResolved, `.${pathname}`);
|
|
30213
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path52.default.sep)) {
|
|
30128
30214
|
return null;
|
|
30129
30215
|
}
|
|
30130
30216
|
return candidate;
|
|
@@ -30138,7 +30224,7 @@ async function fileSize(file) {
|
|
|
30138
30224
|
}
|
|
30139
30225
|
}
|
|
30140
30226
|
function sendFile(req, res, file, size) {
|
|
30141
|
-
const ext =
|
|
30227
|
+
const ext = import_node_path52.default.extname(file).toLowerCase();
|
|
30142
30228
|
res.writeHead(200, {
|
|
30143
30229
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
30144
30230
|
"Content-Length": size,
|
|
@@ -30148,7 +30234,7 @@ function sendFile(req, res, file, size) {
|
|
|
30148
30234
|
res.end();
|
|
30149
30235
|
return true;
|
|
30150
30236
|
}
|
|
30151
|
-
(0,
|
|
30237
|
+
(0, import_node_fs55.createReadStream)(file).pipe(res);
|
|
30152
30238
|
return true;
|
|
30153
30239
|
}
|
|
30154
30240
|
async function tryServeStatic(req, res, root) {
|
|
@@ -30157,7 +30243,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
30157
30243
|
if (!candidate) return false;
|
|
30158
30244
|
const direct = await fileSize(candidate);
|
|
30159
30245
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
30160
|
-
const asIndex =
|
|
30246
|
+
const asIndex = import_node_path52.default.join(candidate, "index.html");
|
|
30161
30247
|
const indexSize = await fileSize(asIndex);
|
|
30162
30248
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
30163
30249
|
return false;
|