@sideboard-ai/core 0.1.340 → 0.1.342
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/{abletime-OGOHNRVB.js → abletime-MSIMJKKQ.js} +4 -4
- package/dist/{abletime-TNONAVJG.js → abletime-ZIYFR4SI.js} +4 -4
- package/dist/{abletime-oauth-DAZEUQJI.js → abletime-oauth-2RUKRZYZ.js} +3 -3
- package/dist/{abletime-oauth-TYDQ73GK.js → abletime-oauth-IQZ3LOB2.js} +3 -3
- package/dist/{abletime-rest-B4VI46MI.js → abletime-rest-7YAO5B74.js} +3 -3
- package/dist/{abletime-rest-3FWZGTX6.js → abletime-rest-UBLSGMSA.js} +3 -3
- package/dist/{agents-QFXIBIKJ.js → agents-7DCNOMFP.js} +8 -8
- package/dist/{agents-6MSZHZOM.js → agents-LNZ465IM.js} +8 -8
- package/dist/{app-settings-KOSVLMO5.js → app-settings-FS7TM55D.js} +11 -1
- package/dist/{app-settings-YS5AUJTF.js → app-settings-Q2F57NVK.js} +11 -1
- package/dist/{chunk-BD7QARIJ.js → chunk-2BLJ726H.js} +6 -5
- package/dist/{chunk-SYTTUNX6.js → chunk-3DMRQB4Y.js} +1 -1
- package/dist/{chunk-OMKTX7ZW.js → chunk-3J3XOIHF.js} +3 -3
- package/dist/{chunk-W6J3ZWLJ.js → chunk-4HELMBYR.js} +2 -2
- package/dist/{chunk-HNW5KMGK.js → chunk-4PXHJA5K.js} +2 -2
- package/dist/{chunk-QWFNKOGA.js → chunk-4TTTEKNV.js} +2 -2
- package/dist/{chunk-EVYOONTE.js → chunk-5BFEHSHO.js} +6 -5
- package/dist/{chunk-EZZY3EAZ.js → chunk-5HUR77ZH.js} +666 -62
- package/dist/{chunk-5TVRPOVS.js → chunk-5SJGR3VS.js} +1 -1
- package/dist/{chunk-I2C5ZRVO.js → chunk-5TS3KVGI.js} +1 -1
- package/dist/{chunk-5FGQTB2Z.js → chunk-6RO2AOE5.js} +2 -2
- package/dist/{chunk-FEGRY7NL.js → chunk-A4ZI7SA3.js} +3 -3
- package/dist/{chunk-DYUAVL5S.js → chunk-BIM24I3O.js} +1 -0
- package/dist/{chunk-KAIOL2M5.js → chunk-D7US5R4H.js} +1 -1
- package/dist/{chunk-NHLTTT5G.js → chunk-DEQLDEYR.js} +7 -6
- package/dist/{chunk-ELDHERAD.js → chunk-DZF25KTX.js} +661 -56
- package/dist/{chunk-4OVQGZEI.js → chunk-G3UV3GXJ.js} +48 -26
- package/dist/{chunk-Q73I6I2K.js → chunk-GUIJMZQG.js} +1 -1
- package/dist/{chunk-AFSLMWQK.js → chunk-JHT3CYLT.js} +42 -3
- package/dist/{chunk-BDQFZAE6.js → chunk-JX3OWNOT.js} +43 -3
- package/dist/{chunk-6ABL7HZN.js → chunk-LDJT3TLN.js} +10 -8
- package/dist/{chunk-LYJ5AVK4.js → chunk-LHU6ZBFB.js} +2 -2
- package/dist/{chunk-WSZIJNAR.js → chunk-NDBMDHQ5.js} +5 -5
- package/dist/{chunk-PEJ3N5VE.js → chunk-NGIGRAZB.js} +7 -6
- package/dist/{chunk-4BRO5LNX.js → chunk-O2IRQAFB.js} +3 -3
- package/dist/{chunk-5KH3EQ2C.js → chunk-ORO4ENZR.js} +1 -0
- package/dist/{chunk-ERCYQTJU.js → chunk-RTZO2YJC.js} +48 -26
- package/dist/{chunk-VHHEQP5V.js → chunk-S3DTEGMK.js} +11 -9
- package/dist/{chunk-N6TGSJVC.js → chunk-S3UGLMGE.js} +31 -0
- package/dist/{chunk-FCBUDWP6.js → chunk-SLLTEMIL.js} +2 -2
- package/dist/{chunk-23KYDM2U.js → chunk-TKEYXNXY.js} +31 -0
- package/dist/{chunk-4SP26Z6H.js → chunk-WO7VF4FG.js} +5 -5
- package/dist/{conductor-LEPTWN2U.js → conductor-4SWJM5FS.js} +6 -6
- package/dist/{conductor-AUUXCJZT.js → conductor-Q433HU77.js} +6 -6
- package/dist/{coordinator-prompt-VO42IZWS.js → coordinator-prompt-5QHWCO7V.js} +4 -4
- package/dist/{coordinator-prompt-CIWWP2P6.js → coordinator-prompt-Z7PPP45X.js} +4 -4
- package/dist/{global-workspace-FKXLFKYX.js → global-workspace-DL4K4K7O.js} +4 -4
- package/dist/{global-workspace-MCAREQI7.js → global-workspace-VDCZMFCZ.js} +4 -4
- package/dist/index.cjs +1018 -188
- package/dist/index.d.cts +57 -7
- package/dist/index.d.ts +57 -7
- package/dist/index.js +135 -30
- package/dist/{linear-P3LP455O.js → linear-JE4WAZ3W.js} +2 -2
- package/dist/{linear-5E2WI4QQ.js → linear-UXMDJAD4.js} +2 -2
- package/dist/{linear-list-Y3INIBYH.js → linear-list-I4NAOWPN.js} +1 -1
- package/dist/{linear-list-AXK62DPW.js → linear-list-KDLU7QWX.js} +1 -1
- package/dist/mcp/run-stdio.cjs +922 -114
- package/dist/mcp/run-stdio.js +119 -27
- package/dist/{optional-cli-6J6C4I3X.js → optional-cli-7QXXPEN6.js} +3 -3
- package/dist/{optional-cli-X6I35UNI.js → optional-cli-RUUCLNSM.js} +4 -4
- package/dist/{orchestrator-JTFCNXVR.js → orchestrator-BPCM4OP3.js} +11 -11
- package/dist/{orchestrator-NOQDMYLB.js → orchestrator-HIWWPWL5.js} +11 -11
- package/dist/{thread-store-DCO5MZWJ.js → thread-store-HETUMDVA.js} +2 -2
- package/dist/{thread-store-QGBPSZU2.js → thread-store-ILM2ZJCB.js} +2 -2
- package/dist/{workspaces-D6FQCZRK.js → workspaces-EIIHHH4S.js} +4 -4
- package/dist/{workspaces-Y25L2EPV.js → workspaces-MX4W4SSB.js} +4 -4
- package/dist/{worktree-S4YOAYRA.js → worktree-BD3EJE24.js} +5 -3
- package/dist/{worktree-GWS77LWX.js → worktree-QBVLKACU.js} +5 -3
- package/package.json +1 -1
package/dist/mcp/run-stdio.cjs
CHANGED
|
@@ -1404,6 +1404,7 @@ function toolDescription(name, input) {
|
|
|
1404
1404
|
if (/get_orchestrator$/i.test(name)) return "Get orchestrator";
|
|
1405
1405
|
else if (/notify_orchestrator$/i.test(name)) return "Notify orchestrator";
|
|
1406
1406
|
else if (/set_workspace_tags$/i.test(name)) return "Set workspace tags";
|
|
1407
|
+
else if (/set_wake_on_github_edges$/i.test(name)) return "Wake on CI / review";
|
|
1407
1408
|
if (/(?:list|set|delete)_env$/i.test(name)) return /list_env$/i.test(name) ? "List env vars" : /set_env$/i.test(name) ? "Set env var" : "Delete env var";
|
|
1408
1409
|
if (/list_schedules$/i.test(name)) return "List automations";
|
|
1409
1410
|
if (/create_schedule$/i.test(name)) {
|
|
@@ -4879,6 +4880,9 @@ __export(app_settings_exports, {
|
|
|
4879
4880
|
GITHUB_GIT_AUTH_MODES: () => GITHUB_GIT_AUTH_MODES,
|
|
4880
4881
|
HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
|
|
4881
4882
|
ISSUE_SOURCE_LABELS: () => ISSUE_SOURCE_LABELS,
|
|
4883
|
+
MAX_ORCH_THREADS_DEFAULT: () => MAX_ORCH_THREADS_DEFAULT,
|
|
4884
|
+
MAX_ORCH_THREADS_MAX: () => MAX_ORCH_THREADS_MAX,
|
|
4885
|
+
MAX_ORCH_THREADS_MIN: () => MAX_ORCH_THREADS_MIN,
|
|
4882
4886
|
PROFILE_NOTES_MAX: () => PROFILE_NOTES_MAX,
|
|
4883
4887
|
REVIEW_LABEL_MAX: () => REVIEW_LABEL_MAX,
|
|
4884
4888
|
USAGE_ON_LIMIT_VALUES: () => USAGE_ON_LIMIT_VALUES,
|
|
@@ -4941,6 +4945,7 @@ __export(app_settings_exports, {
|
|
|
4941
4945
|
issueSourceLabel: () => issueSourceLabel,
|
|
4942
4946
|
loadAppSettings: () => loadAppSettings,
|
|
4943
4947
|
maxConcurrentAgents: () => maxConcurrentAgents,
|
|
4948
|
+
maxOrchThreads: () => maxOrchThreads,
|
|
4944
4949
|
normalizeReviewLabel: () => normalizeReviewLabel,
|
|
4945
4950
|
orchestrationQuotaFallbackAgent: () => orchestrationQuotaFallbackAgent,
|
|
4946
4951
|
orchestrationQuotaOnLimit: () => orchestrationQuotaOnLimit,
|
|
@@ -4979,6 +4984,7 @@ __export(app_settings_exports, {
|
|
|
4979
4984
|
updateOpencodeSettings: () => updateOpencodeSettings,
|
|
4980
4985
|
updateProjectProfileSettings: () => updateProjectProfileSettings,
|
|
4981
4986
|
usageOnLimit: () => usageOnLimit,
|
|
4987
|
+
wakeOrchestratorOnGithubEdgesEnabled: () => wakeOrchestratorOnGithubEdgesEnabled,
|
|
4982
4988
|
writeViewerContext: () => writeViewerContext
|
|
4983
4989
|
});
|
|
4984
4990
|
function isAgentDoneSound(value) {
|
|
@@ -5381,6 +5387,9 @@ function normalizeAdvanced(raw) {
|
|
|
5381
5387
|
if (typeof source.cowboyMode === "boolean") {
|
|
5382
5388
|
out.cowboyMode = source.cowboyMode;
|
|
5383
5389
|
}
|
|
5390
|
+
if (typeof source.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
5391
|
+
out.wakeOrchestratorOnGithubEdges = source.wakeOrchestratorOnGithubEdges;
|
|
5392
|
+
}
|
|
5384
5393
|
if (typeof source.showCost === "boolean") {
|
|
5385
5394
|
out.showCost = source.showCost;
|
|
5386
5395
|
}
|
|
@@ -5399,6 +5408,9 @@ function normalizeAdvanced(raw) {
|
|
|
5399
5408
|
if (typeof source.maxConcurrent === "number" && Number.isFinite(source.maxConcurrent)) {
|
|
5400
5409
|
out.maxConcurrent = Math.max(1, Math.min(32, Math.floor(source.maxConcurrent)));
|
|
5401
5410
|
}
|
|
5411
|
+
if (typeof source.maxOrchThreads === "number" && Number.isFinite(source.maxOrchThreads)) {
|
|
5412
|
+
out.maxOrchThreads = clampMaxOrchThreads(source.maxOrchThreads);
|
|
5413
|
+
}
|
|
5402
5414
|
if (typeof source.worktreeMaxCount === "number" && Number.isFinite(source.worktreeMaxCount)) {
|
|
5403
5415
|
out.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(source.worktreeMaxCount)));
|
|
5404
5416
|
}
|
|
@@ -6269,6 +6281,9 @@ function updateAdvancedSettings(patch) {
|
|
|
6269
6281
|
if (typeof patch.cowboyMode === "boolean") {
|
|
6270
6282
|
advanced.cowboyMode = patch.cowboyMode;
|
|
6271
6283
|
}
|
|
6284
|
+
if (typeof patch.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
6285
|
+
advanced.wakeOrchestratorOnGithubEdges = patch.wakeOrchestratorOnGithubEdges;
|
|
6286
|
+
}
|
|
6272
6287
|
if (typeof patch.showCost === "boolean") {
|
|
6273
6288
|
advanced.showCost = patch.showCost;
|
|
6274
6289
|
}
|
|
@@ -6292,6 +6307,9 @@ function updateAdvancedSettings(patch) {
|
|
|
6292
6307
|
if (typeof patch.maxConcurrent === "number" && Number.isFinite(patch.maxConcurrent)) {
|
|
6293
6308
|
advanced.maxConcurrent = Math.max(1, Math.min(32, Math.floor(patch.maxConcurrent)));
|
|
6294
6309
|
}
|
|
6310
|
+
if (typeof patch.maxOrchThreads === "number" && Number.isFinite(patch.maxOrchThreads)) {
|
|
6311
|
+
advanced.maxOrchThreads = clampMaxOrchThreads(patch.maxOrchThreads);
|
|
6312
|
+
}
|
|
6295
6313
|
if (typeof patch.worktreeMaxCount === "number" && Number.isFinite(patch.worktreeMaxCount)) {
|
|
6296
6314
|
advanced.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(patch.worktreeMaxCount)));
|
|
6297
6315
|
}
|
|
@@ -6374,6 +6392,9 @@ function deleteBranchOnPurgeEnabled(settings = loadAppSettings()) {
|
|
|
6374
6392
|
function cowboyModeEnabled(settings = loadAppSettings()) {
|
|
6375
6393
|
return Boolean(settings.advanced.cowboyMode);
|
|
6376
6394
|
}
|
|
6395
|
+
function wakeOrchestratorOnGithubEdgesEnabled(settings = loadAppSettings()) {
|
|
6396
|
+
return Boolean(settings.advanced.wakeOrchestratorOnGithubEdges);
|
|
6397
|
+
}
|
|
6377
6398
|
function showCostEnabled(settings = loadAppSettings()) {
|
|
6378
6399
|
return Boolean(settings.advanced.showCost);
|
|
6379
6400
|
}
|
|
@@ -6425,6 +6446,14 @@ function maxConcurrentAgents(settings = loadAppSettings()) {
|
|
|
6425
6446
|
}
|
|
6426
6447
|
return 5;
|
|
6427
6448
|
}
|
|
6449
|
+
function clampMaxOrchThreads(n) {
|
|
6450
|
+
return Math.max(MAX_ORCH_THREADS_MIN, Math.min(MAX_ORCH_THREADS_MAX, Math.floor(n)));
|
|
6451
|
+
}
|
|
6452
|
+
function maxOrchThreads(settings = loadAppSettings()) {
|
|
6453
|
+
const n = settings.advanced.maxOrchThreads;
|
|
6454
|
+
if (typeof n === "number" && Number.isFinite(n)) return clampMaxOrchThreads(n);
|
|
6455
|
+
return MAX_ORCH_THREADS_DEFAULT;
|
|
6456
|
+
}
|
|
6428
6457
|
function resolveClaudeExecutable(settings = loadAppSettings()) {
|
|
6429
6458
|
return resolveAgentExecutable("claude", settings);
|
|
6430
6459
|
}
|
|
@@ -6505,7 +6534,7 @@ function childEnvWithAppSettings(extra) {
|
|
|
6505
6534
|
function harnessEnvKey(harness) {
|
|
6506
6535
|
return HARNESS_ENV_KEYS[harness];
|
|
6507
6536
|
}
|
|
6508
|
-
var import_node_crypto2, import_node_fs15, import_node_os6, import_node_path16, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, DEFAULT_CLI_BIN;
|
|
6537
|
+
var import_node_crypto2, import_node_fs15, import_node_os6, import_node_path16, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, MAX_ORCH_THREADS_DEFAULT, MAX_ORCH_THREADS_MIN, MAX_ORCH_THREADS_MAX, DEFAULT_CLI_BIN;
|
|
6509
6538
|
var init_app_settings = __esm({
|
|
6510
6539
|
"src/store/app-settings.ts"() {
|
|
6511
6540
|
"use strict";
|
|
@@ -6602,6 +6631,9 @@ var init_app_settings = __esm({
|
|
|
6602
6631
|
};
|
|
6603
6632
|
CONFIRM_ACCOUNT = "Show the user the proposed account context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
|
|
6604
6633
|
CONFIRM_PROJECT = "Show the user the proposed project context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
|
|
6634
|
+
MAX_ORCH_THREADS_DEFAULT = 5;
|
|
6635
|
+
MAX_ORCH_THREADS_MIN = 1;
|
|
6636
|
+
MAX_ORCH_THREADS_MAX = 32;
|
|
6605
6637
|
DEFAULT_CLI_BIN = {
|
|
6606
6638
|
claude: "claude",
|
|
6607
6639
|
codex: "codex",
|
|
@@ -7550,11 +7582,16 @@ async function listCursorPrs(repoPath, slug, opts, head) {
|
|
|
7550
7582
|
}
|
|
7551
7583
|
}
|
|
7552
7584
|
const { stdout, exitCode } = await originCli(args, repoPath, { reject: false, timeoutMs: 2e4 });
|
|
7553
|
-
if (exitCode !== 0
|
|
7585
|
+
if (exitCode !== 0) {
|
|
7586
|
+
if (opts?.strict) throw new Error(`origin pr list failed (${exitCode})`);
|
|
7587
|
+
return [];
|
|
7588
|
+
}
|
|
7589
|
+
if (!stdout.trim()) return [];
|
|
7554
7590
|
let parsed;
|
|
7555
7591
|
try {
|
|
7556
7592
|
parsed = JSON.parse(stdout);
|
|
7557
7593
|
} catch {
|
|
7594
|
+
if (opts?.strict) throw new Error("origin pr list returned invalid JSON");
|
|
7558
7595
|
return [];
|
|
7559
7596
|
}
|
|
7560
7597
|
if (!Array.isArray(parsed)) return [];
|
|
@@ -7656,21 +7693,23 @@ async function fetchCursorPrHead(repoPath, slug, number, localBranch) {
|
|
|
7656
7693
|
throw new Error((result.stderr || result.stdout).trim() || `git fetch origin ${head} failed`);
|
|
7657
7694
|
}
|
|
7658
7695
|
}
|
|
7659
|
-
async function
|
|
7696
|
+
async function cursorPrCiChecks(repoPath, slug, selector) {
|
|
7660
7697
|
const { stdout, exitCode, stderr } = await originCli(
|
|
7661
7698
|
["pr", "checks", selector, ...repoArgs(slug), "--json", "name,status,conclusion,detailsUrl,startedAt,completedAt,summary,group,link"],
|
|
7662
7699
|
repoPath,
|
|
7663
7700
|
{ reject: false, timeoutMs: 2e4 }
|
|
7664
7701
|
);
|
|
7665
7702
|
const err = stderr.trim();
|
|
7666
|
-
let ci;
|
|
7667
7703
|
if (!stdout.trim()) {
|
|
7668
7704
|
if (/no pull request|not found|no change/i.test(err)) return null;
|
|
7669
7705
|
if (exitCode !== 0 && err) throw new Error(err);
|
|
7670
|
-
|
|
7671
|
-
} else {
|
|
7672
|
-
ci = originChecksToRuns(stdout);
|
|
7706
|
+
return [];
|
|
7673
7707
|
}
|
|
7708
|
+
return originChecksToRuns(stdout);
|
|
7709
|
+
}
|
|
7710
|
+
async function cursorPrChecks(repoPath, slug, selector) {
|
|
7711
|
+
const ci = await cursorPrCiChecks(repoPath, slug, selector);
|
|
7712
|
+
if (!ci) return null;
|
|
7674
7713
|
const view = await viewCursorPr(
|
|
7675
7714
|
repoPath,
|
|
7676
7715
|
slug,
|
|
@@ -8232,6 +8271,35 @@ function normalizeAttachments(raw) {
|
|
|
8232
8271
|
}
|
|
8233
8272
|
return out;
|
|
8234
8273
|
}
|
|
8274
|
+
function normalizeRunList(raw) {
|
|
8275
|
+
if (!Array.isArray(raw)) return [];
|
|
8276
|
+
const out = [];
|
|
8277
|
+
for (const item of raw) {
|
|
8278
|
+
if (!item || typeof item !== "object") continue;
|
|
8279
|
+
const row = item;
|
|
8280
|
+
if (typeof row.at !== "string" || !row.at.trim()) continue;
|
|
8281
|
+
const next = {
|
|
8282
|
+
at: row.at,
|
|
8283
|
+
threadId: typeof row.threadId === "string" && row.threadId.trim() ? row.threadId.trim() : null
|
|
8284
|
+
};
|
|
8285
|
+
if (typeof row.error === "string" && row.error.trim()) next.error = row.error;
|
|
8286
|
+
out.push(next);
|
|
8287
|
+
if (out.length >= SCHEDULE_RUN_HISTORY_LIMIT) break;
|
|
8288
|
+
}
|
|
8289
|
+
return out;
|
|
8290
|
+
}
|
|
8291
|
+
function runsFromStored(raw) {
|
|
8292
|
+
if (Array.isArray(raw.runs)) return normalizeRunList(raw.runs);
|
|
8293
|
+
if (typeof raw.lastRunAt === "string" && raw.lastRunAt.trim()) {
|
|
8294
|
+
const one = {
|
|
8295
|
+
at: raw.lastRunAt,
|
|
8296
|
+
threadId: raw.lastThreadId?.trim() || null
|
|
8297
|
+
};
|
|
8298
|
+
if (typeof raw.lastError === "string" && raw.lastError.trim()) one.error = raw.lastError;
|
|
8299
|
+
return [one];
|
|
8300
|
+
}
|
|
8301
|
+
return [];
|
|
8302
|
+
}
|
|
8235
8303
|
function normalizeTask(raw) {
|
|
8236
8304
|
const when = normalizeWhen(raw.when);
|
|
8237
8305
|
const agent = raw.agent && isOrchestratorCapableAgent(raw.agent) ? raw.agent : null;
|
|
@@ -8254,6 +8322,7 @@ function normalizeTask(raw) {
|
|
|
8254
8322
|
lastRunAt: raw.lastRunAt ?? null,
|
|
8255
8323
|
lastThreadId: raw.lastThreadId ?? null,
|
|
8256
8324
|
lastError: raw.lastError ?? null,
|
|
8325
|
+
runs: runsFromStored(raw),
|
|
8257
8326
|
createdBy: raw.createdBy === "mcp" || raw.createdBy === "cli" || raw.createdBy === "ui" ? raw.createdBy : "ui",
|
|
8258
8327
|
createdAt: raw.createdAt,
|
|
8259
8328
|
updatedAt: raw.updatedAt
|
|
@@ -8306,6 +8375,7 @@ function buildTask(input, now) {
|
|
|
8306
8375
|
lastRunAt: null,
|
|
8307
8376
|
lastThreadId: null,
|
|
8308
8377
|
lastError: null,
|
|
8378
|
+
runs: [],
|
|
8309
8379
|
createdBy: input.createdBy,
|
|
8310
8380
|
createdAt: ts,
|
|
8311
8381
|
updatedAt: ts
|
|
@@ -8395,20 +8465,25 @@ function recordScheduleRun(id, result) {
|
|
|
8395
8465
|
if (idx < 0) throw new Error(`Automation not found: ${id}`);
|
|
8396
8466
|
const prev = rows[idx];
|
|
8397
8467
|
const firedAt = result.firedAt ?? /* @__PURE__ */ new Date();
|
|
8468
|
+
const at = nowIso(firedAt);
|
|
8469
|
+
const threadId = result.lastThreadId !== void 0 ? result.lastThreadId?.trim() || null : null;
|
|
8470
|
+
const entry = { at, threadId };
|
|
8471
|
+
if (result.lastError?.trim()) entry.error = result.lastError;
|
|
8398
8472
|
const next = {
|
|
8399
8473
|
...prev,
|
|
8400
8474
|
enabled: prev.when.kind === "once" ? false : prev.enabled,
|
|
8401
8475
|
nextRunAt: prev.when.kind === "once" ? prev.nextRunAt : computeNextRunAt(prev.when, firedAt).toISOString(),
|
|
8402
|
-
lastRunAt:
|
|
8476
|
+
lastRunAt: at,
|
|
8403
8477
|
lastThreadId: result.lastThreadId !== void 0 ? result.lastThreadId : prev.lastThreadId,
|
|
8404
8478
|
lastError: result.lastError ?? null,
|
|
8405
|
-
|
|
8479
|
+
runs: [entry, ...prev.runs].slice(0, SCHEDULE_RUN_HISTORY_LIMIT),
|
|
8480
|
+
updatedAt: at
|
|
8406
8481
|
};
|
|
8407
8482
|
rows[idx] = next;
|
|
8408
8483
|
writeAll(rows);
|
|
8409
8484
|
return next;
|
|
8410
8485
|
}
|
|
8411
|
-
var import_node_crypto3, import_node_fs16, import_node_path19, ATTACHMENT_KINDS;
|
|
8486
|
+
var import_node_crypto3, import_node_fs16, import_node_path19, SCHEDULE_RUN_HISTORY_LIMIT, ATTACHMENT_KINDS;
|
|
8412
8487
|
var init_schedules = __esm({
|
|
8413
8488
|
"src/store/schedules.ts"() {
|
|
8414
8489
|
"use strict";
|
|
@@ -8422,6 +8497,7 @@ var init_schedules = __esm({
|
|
|
8422
8497
|
init_private_file();
|
|
8423
8498
|
init_app_settings();
|
|
8424
8499
|
init_schedule_when();
|
|
8500
|
+
SCHEDULE_RUN_HISTORY_LIMIT = 10;
|
|
8425
8501
|
ATTACHMENT_KINDS = /* @__PURE__ */ new Set([
|
|
8426
8502
|
"transcript",
|
|
8427
8503
|
"file",
|
|
@@ -8525,6 +8601,7 @@ function normalizeThread(raw) {
|
|
|
8525
8601
|
prIsInMergeQueue: Boolean(raw.prIsInMergeQueue),
|
|
8526
8602
|
prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
|
|
8527
8603
|
prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
|
|
8604
|
+
wakeOnGithubEdges: raw.wakeOnGithubEdges === true ? true : void 0,
|
|
8528
8605
|
issueBlockedBy: sanitizeIssueBlockedBy(raw.issueBlockedBy),
|
|
8529
8606
|
skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
|
|
8530
8607
|
cowboy: Boolean(raw.cowboy),
|
|
@@ -8569,6 +8646,7 @@ function createEmptyThread(partial) {
|
|
|
8569
8646
|
prIsInMergeQueue: Boolean(partial.prIsInMergeQueue),
|
|
8570
8647
|
prLabels: partial.prLabels ?? [],
|
|
8571
8648
|
prChecksFailed: partial.prChecksFailed,
|
|
8649
|
+
...partial.wakeOnGithubEdges === true ? { wakeOnGithubEdges: true } : {},
|
|
8572
8650
|
skipAutoArchiveOnMerge: partial.skipAutoArchiveOnMerge ?? false,
|
|
8573
8651
|
cowboy: Boolean(partial.cowboy),
|
|
8574
8652
|
stackId: partial.stackId ?? null,
|
|
@@ -8859,6 +8937,7 @@ __export(worktree_exports, {
|
|
|
8859
8937
|
fetchPrHead: () => fetchPrHead,
|
|
8860
8938
|
getPr: () => getPr,
|
|
8861
8939
|
getPrChecks: () => getPrChecks,
|
|
8940
|
+
getPrCiChecks: () => getPrCiChecks,
|
|
8862
8941
|
getPrDetails: () => getPrDetails,
|
|
8863
8942
|
getPrForHeadBranch: () => getPrForHeadBranch,
|
|
8864
8943
|
getPrMeta: () => getPrMeta,
|
|
@@ -9146,7 +9225,11 @@ async function listPrs(repoPath, opts) {
|
|
|
9146
9225
|
limit: fetchLimit
|
|
9147
9226
|
});
|
|
9148
9227
|
const { stdout, exitCode } = await gh(args, repoPath, { reject: false });
|
|
9149
|
-
if (exitCode !== 0
|
|
9228
|
+
if (exitCode !== 0) {
|
|
9229
|
+
if (opts?.strict) throw new Error(`gh pr list failed (${exitCode})`);
|
|
9230
|
+
return [];
|
|
9231
|
+
}
|
|
9232
|
+
if (!stdout.trim()) return [];
|
|
9150
9233
|
return applyPrListResponse(stdout, { ...resolved, limit, viewerTeams });
|
|
9151
9234
|
}
|
|
9152
9235
|
function prInfoFromGhView(view) {
|
|
@@ -9408,12 +9491,7 @@ async function probeLocalMergeGate(cwd, gate) {
|
|
|
9408
9491
|
}
|
|
9409
9492
|
return { gate, files: [] };
|
|
9410
9493
|
}
|
|
9411
|
-
async function
|
|
9412
|
-
const origin = await resolveOriginRemote(cwd);
|
|
9413
|
-
if (origin?.forge === "entire") return null;
|
|
9414
|
-
const cursorSlug = origin?.forge === "cursor" ? origin.slug : null;
|
|
9415
|
-
if (cursorSlug) return cursorPrChecks(cwd, cursorSlug, selector);
|
|
9416
|
-
const slug = await resolveGithubRepoSlug(cwd);
|
|
9494
|
+
async function readGhPrChecks(cwd, selector, slug) {
|
|
9417
9495
|
const args = [
|
|
9418
9496
|
"pr",
|
|
9419
9497
|
"checks",
|
|
@@ -9424,7 +9502,6 @@ async function getPrChecks(cwd, selector) {
|
|
|
9424
9502
|
if (slug) args.push("--repo", slug);
|
|
9425
9503
|
const { stdout, exitCode, stderr } = await gh(args, cwd, { reject: false });
|
|
9426
9504
|
const errText2 = stderr.trim();
|
|
9427
|
-
let ciChecks;
|
|
9428
9505
|
if (!stdout.trim()) {
|
|
9429
9506
|
if (/no pull requests found/i.test(errText2)) return null;
|
|
9430
9507
|
if (/auth|login|HTTP\s*401|credentials|token/i.test(errText2)) {
|
|
@@ -9434,18 +9511,34 @@ async function getPrChecks(cwd, selector) {
|
|
|
9434
9511
|
if (exitCode === 1 && errText2 && !/fail|check/i.test(errText2)) {
|
|
9435
9512
|
throw new Error(errText2);
|
|
9436
9513
|
}
|
|
9437
|
-
|
|
9438
|
-
} else {
|
|
9439
|
-
throw new Error(errText2 || `gh pr checks failed (${exitCode})`);
|
|
9440
|
-
}
|
|
9441
|
-
} else {
|
|
9442
|
-
try {
|
|
9443
|
-
const parsed = JSON.parse(stdout);
|
|
9444
|
-
ciChecks = parsed.map(normalizeCheck);
|
|
9445
|
-
} catch {
|
|
9446
|
-
throw new Error(errText2 || "gh pr checks returned invalid JSON");
|
|
9514
|
+
return [];
|
|
9447
9515
|
}
|
|
9516
|
+
throw new Error(errText2 || `gh pr checks failed (${exitCode})`);
|
|
9517
|
+
}
|
|
9518
|
+
try {
|
|
9519
|
+
const parsed = JSON.parse(stdout);
|
|
9520
|
+
return parsed.map(normalizeCheck);
|
|
9521
|
+
} catch {
|
|
9522
|
+
throw new Error(errText2 || "gh pr checks returned invalid JSON");
|
|
9523
|
+
}
|
|
9524
|
+
}
|
|
9525
|
+
async function getPrCiChecks(cwd, selector) {
|
|
9526
|
+
const origin = await resolveOriginRemote(cwd);
|
|
9527
|
+
if (origin?.forge === "entire") return null;
|
|
9528
|
+
if (origin?.forge === "cursor" && origin.slug) {
|
|
9529
|
+
return cursorPrCiChecks(cwd, origin.slug, selector);
|
|
9448
9530
|
}
|
|
9531
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
9532
|
+
return readGhPrChecks(cwd, selector, slug);
|
|
9533
|
+
}
|
|
9534
|
+
async function getPrChecks(cwd, selector) {
|
|
9535
|
+
const origin = await resolveOriginRemote(cwd);
|
|
9536
|
+
if (origin?.forge === "entire") return null;
|
|
9537
|
+
const cursorSlug = origin?.forge === "cursor" ? origin.slug : null;
|
|
9538
|
+
if (cursorSlug) return cursorPrChecks(cwd, cursorSlug, selector);
|
|
9539
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
9540
|
+
const ciChecks = await readGhPrChecks(cwd, selector, slug);
|
|
9541
|
+
if (!ciChecks) return null;
|
|
9449
9542
|
let gate = await fetchPrMergeGate(cwd, selector, slug);
|
|
9450
9543
|
const probed = await probeLocalMergeGate(cwd, gate);
|
|
9451
9544
|
gate = probed.gate;
|
|
@@ -11136,12 +11229,13 @@ var init_coordinator_prompt = __esm({
|
|
|
11136
11229
|
"- get_viewer_context / update_viewer_context \u2014 read or replace Settings \u2192 Agents (account) and Settings \u2192 Projects (per-repo) context. You can update a project: pass scope=project and repoPath from list_projects (this cwd is not a project). update_viewer_context requires confirmed=true after ask_user. Never write context unprompted.",
|
|
11137
11230
|
"- list_env / set_env / delete_env \u2014 Settings \u2192 Environment. scope=project requires repoPath from list_projects and stores the key under that project prefix (the project name, uppercased, plus _). APPLE_ID for sideboard is SIDEBOARD_APPLE_ID. scope=account is shared by every project and is not prefixed. list_env returns names only.",
|
|
11138
11231
|
"- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn on for overnight work, or when the user will be away and no phone is connected. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
|
|
11139
|
-
"- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived
|
|
11232
|
+
"- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived chats for that automation. list_schedules includes runs, the last 10 fires (at, threadId, error). To schedule a prompt from this chat, call create_schedule (omit chatId for a new Global chat, or chatId=self). Worktree agents have the same tools (`chatId=self` continues that coding chat and is removed when that chat is archived). Jobs fire only while Sideboard.app is running; sleep skips until wake. Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled (or call set_caffeinate). The desktop lists them in the sidebar after Board.",
|
|
11140
11233
|
"Projects:",
|
|
11141
11234
|
"- add_project / remove_project \u2014 register or unregister a git repo",
|
|
11142
11235
|
"Workspaces and chats:",
|
|
11143
11236
|
'- create_workspace \u2014 create a workspace (isolated checkout + first chat) from branch | pr | ticket (appears on Home). A ticket, PR, or named branch has one checkout: a second call returns that workspace (alreadyStarted=true) and chats for every agent already on it. That is not one agent. To put another agent on that checkout, fork_chat. send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated workspace. Pass repoPath + parentChatId; omit agent and model so Sideboard applies Settings \u2192 Default agent, model & effort (never pass your own agent or agent=cursor). Pass the same tags (short labels, e.g. "phone-sync") on every workspace you open for one task so they group in the sidebar; reusing a checkout adds those tags. If the repo has a setup script, Sideboard runs it in the background (does not block send_to_chat). Nested Codex (you are Codex and the child would be Codex) can deadlock on ~/.codex locks \u2014 omit agent; Sideboard switches the child to Cursor when a CURSOR_API_KEY is set, otherwise keeps the Account default',
|
|
11144
|
-
"-
|
|
11237
|
+
"- One orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.",
|
|
11238
|
+
"- set_workspace_tags \u2014 set, add, or remove labels on a workspace after create. Pass any chat id on that checkout. Same tags on every workspace from one task. Worktree agents can update tags on their own checkout (they omit ref). set_wake_on_github_edges opts a workspace into CI and review-request wakes once Settings \u2192 Advanced is on. Pass a child chat id. Do not flip the Advanced switch.",
|
|
11145
11239
|
"- set_plan / show_plan / list_order / set_dependency / clear_dependency / satisfy_dependency / execute_plan \u2014 This chat owns one plan. show_plan opens it in the side column, the same way a worktree agent does. The Orchestration row in the sidebar opens that chat. Draft with set_plan (title, summary, and goal) and set_dependency. A step may loop back to an earlier step. This is a plan, not a one-way waterfall. Call show_plan after you draft or change the plan. Do not paste the diagram in chat. Do not create workspaces or send_to_chat for that work while the plan is draft. execute_plan with agreed: true only after they tell you to run it. It marks the plan active and returns ready vs waiting. Start ready steps with create_workspace or send_to_chat. Leave waiting steps alone. Merge only if they asked. Worktree agents show_plan to open the diagram and this checkout's implementation plan when plan.md exists. set_dependency / clear_dependency only for a step they are part of. A dependency says one PR, issue, or workspace must reach a gate before another can start or merge. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency (Sideboard cannot see production). hold=start blocks starting the subject; hold=merge blocks merging it. Example: PR 1 in prod before PR 2 can merge; PR 3 in main before issue 4 can start. Pass waitsOnKind (pr|issue|workspace), waitsOnRef, gate, subjectKind, subjectRef, hold. Pass repoPath when the same number exists in more than one project. A step can name another orchestration chat (kind orchestration, ref that chat id). That chat drafts its own plan. Each orchestration chat opens its own plan with show_plan. Worktree agents set their own checkout and omit subject. Plan mode on a workspace agent stays a separate plan for that checkout. Do not tell a child to merge or start while list_order still marks that step waiting.",
|
|
11146
11240
|
"- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
|
|
11147
11241
|
"- fork_workspace \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
|
|
@@ -11516,19 +11610,19 @@ function traceTurn(phase, extra) {
|
|
|
11516
11610
|
}
|
|
11517
11611
|
}
|
|
11518
11612
|
async function withTimeout(promise, ms, label) {
|
|
11519
|
-
let
|
|
11613
|
+
let timer2;
|
|
11520
11614
|
try {
|
|
11521
11615
|
return await Promise.race([
|
|
11522
11616
|
promise,
|
|
11523
11617
|
new Promise((_, reject) => {
|
|
11524
|
-
|
|
11618
|
+
timer2 = setTimeout(
|
|
11525
11619
|
() => reject(new Error(`${label} timed out after ${ms}ms`)),
|
|
11526
11620
|
ms
|
|
11527
11621
|
);
|
|
11528
11622
|
})
|
|
11529
11623
|
]);
|
|
11530
11624
|
} finally {
|
|
11531
|
-
if (
|
|
11625
|
+
if (timer2) clearTimeout(timer2);
|
|
11532
11626
|
}
|
|
11533
11627
|
}
|
|
11534
11628
|
var import_node_fs23, import_node_path26;
|
|
@@ -12964,6 +13058,7 @@ var init_profile = __esm({
|
|
|
12964
13058
|
"get_orchestrator",
|
|
12965
13059
|
"notify_orchestrator",
|
|
12966
13060
|
"set_workspace_tags",
|
|
13061
|
+
"set_wake_on_github_edges",
|
|
12967
13062
|
"get_viewer_context",
|
|
12968
13063
|
"update_viewer_context",
|
|
12969
13064
|
"list_env",
|
|
@@ -13617,6 +13712,7 @@ var init_injected_mcp = __esm({
|
|
|
13617
13712
|
"mcp__sideboard__get_orchestrator",
|
|
13618
13713
|
"mcp__sideboard__notify_orchestrator",
|
|
13619
13714
|
"mcp__sideboard__set_workspace_tags",
|
|
13715
|
+
"mcp__sideboard__set_wake_on_github_edges",
|
|
13620
13716
|
"mcp__sideboard__get_viewer_context",
|
|
13621
13717
|
"mcp__sideboard__update_viewer_context",
|
|
13622
13718
|
"mcp__sideboard__list_env",
|
|
@@ -16112,16 +16208,16 @@ async function listAssignedLinearIssues(opts) {
|
|
|
16112
16208
|
try {
|
|
16113
16209
|
const { listLinearIssuesDirect: listLinearIssuesDirect2 } = await Promise.resolve().then(() => (init_linear(), linear_exports));
|
|
16114
16210
|
const listed = listLinearIssuesDirect2({ limit: 50 }).catch(() => []);
|
|
16115
|
-
let
|
|
16211
|
+
let timer2;
|
|
16116
16212
|
try {
|
|
16117
16213
|
return await Promise.race([
|
|
16118
16214
|
listed,
|
|
16119
16215
|
new Promise((resolve3) => {
|
|
16120
|
-
|
|
16216
|
+
timer2 = setTimeout(() => resolve3([]), opts?.timeoutMs ?? LIST_TIMEOUT_MS);
|
|
16121
16217
|
})
|
|
16122
16218
|
]);
|
|
16123
16219
|
} finally {
|
|
16124
|
-
if (
|
|
16220
|
+
if (timer2) clearTimeout(timer2);
|
|
16125
16221
|
}
|
|
16126
16222
|
} catch {
|
|
16127
16223
|
return [];
|
|
@@ -18719,11 +18815,11 @@ function parentKey(event) {
|
|
|
18719
18815
|
function createAgentStreamCoalescer(emit, opts) {
|
|
18720
18816
|
const intervalMs = opts?.intervalMs ?? 32;
|
|
18721
18817
|
let pending = null;
|
|
18722
|
-
let
|
|
18818
|
+
let timer2 = null;
|
|
18723
18819
|
const flush2 = () => {
|
|
18724
|
-
if (
|
|
18725
|
-
clearTimeout(
|
|
18726
|
-
|
|
18820
|
+
if (timer2) {
|
|
18821
|
+
clearTimeout(timer2);
|
|
18822
|
+
timer2 = null;
|
|
18727
18823
|
}
|
|
18728
18824
|
if (!pending) return;
|
|
18729
18825
|
const event = pending;
|
|
@@ -18735,9 +18831,9 @@ function createAgentStreamCoalescer(emit, opts) {
|
|
|
18735
18831
|
});
|
|
18736
18832
|
};
|
|
18737
18833
|
const schedule = () => {
|
|
18738
|
-
if (
|
|
18739
|
-
|
|
18740
|
-
|
|
18834
|
+
if (timer2) return;
|
|
18835
|
+
timer2 = setTimeout(flush2, intervalMs);
|
|
18836
|
+
timer2.unref?.();
|
|
18741
18837
|
};
|
|
18742
18838
|
return {
|
|
18743
18839
|
push(event) {
|
|
@@ -18991,9 +19087,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
18991
19087
|
}
|
|
18992
19088
|
};
|
|
18993
19089
|
signal("SIGTERM");
|
|
18994
|
-
const
|
|
18995
|
-
|
|
18996
|
-
child.once("exit", () => clearTimeout(
|
|
19090
|
+
const timer2 = setTimeout(() => signal("SIGKILL"), 5e3);
|
|
19091
|
+
timer2.unref?.();
|
|
19092
|
+
child.once("exit", () => clearTimeout(timer2));
|
|
18997
19093
|
},
|
|
18998
19094
|
done
|
|
18999
19095
|
};
|
|
@@ -19892,6 +19988,7 @@ function worktreeBindingFrom(from) {
|
|
|
19892
19988
|
prIsInMergeQueue: from.prIsInMergeQueue,
|
|
19893
19989
|
prLabels: from.prLabels,
|
|
19894
19990
|
prChecksFailed: from.prChecksFailed,
|
|
19991
|
+
wakeOnGithubEdges: from.wakeOnGithubEdges,
|
|
19895
19992
|
issueBlockedBy: from.issueBlockedBy,
|
|
19896
19993
|
skipAutoArchiveOnMerge: from.skipAutoArchiveOnMerge,
|
|
19897
19994
|
stackId: from.stackId,
|
|
@@ -21603,9 +21700,9 @@ function emptySetupLog() {
|
|
|
21603
21700
|
return { ...EMPTY };
|
|
21604
21701
|
}
|
|
21605
21702
|
function persistNow(threadId) {
|
|
21606
|
-
const
|
|
21607
|
-
if (
|
|
21608
|
-
clearTimeout(
|
|
21703
|
+
const timer2 = persistTimers.get(threadId);
|
|
21704
|
+
if (timer2) {
|
|
21705
|
+
clearTimeout(timer2);
|
|
21609
21706
|
persistTimers.delete(threadId);
|
|
21610
21707
|
}
|
|
21611
21708
|
const mem = memory.get(threadId);
|
|
@@ -21761,9 +21858,9 @@ function sliceRunLogOutput(output, tailChars = DEFAULT_RUN_LOG_TAIL_CHARS) {
|
|
|
21761
21858
|
return { output: text7, truncated: true, outputChars };
|
|
21762
21859
|
}
|
|
21763
21860
|
function persistNow2(key) {
|
|
21764
|
-
const
|
|
21765
|
-
if (
|
|
21766
|
-
clearTimeout(
|
|
21861
|
+
const timer2 = persistTimers2.get(key);
|
|
21862
|
+
if (timer2) {
|
|
21863
|
+
clearTimeout(timer2);
|
|
21767
21864
|
persistTimers2.delete(key);
|
|
21768
21865
|
}
|
|
21769
21866
|
const mem = memory2.get(key);
|
|
@@ -23982,12 +24079,12 @@ async function startAbleTimeOAuth(opts) {
|
|
|
23982
24079
|
finish(e instanceof Error ? e : new Error(String(e)));
|
|
23983
24080
|
}
|
|
23984
24081
|
});
|
|
23985
|
-
const
|
|
24082
|
+
const timer2 = setTimeout(() => {
|
|
23986
24083
|
finish(new Error("AbleTime sign-in timed out \u2014 try again"));
|
|
23987
24084
|
}, timeoutMs);
|
|
23988
24085
|
const onAbort = () => finish(new AbleTimeOAuthCancelledError());
|
|
23989
24086
|
const cleanup = () => {
|
|
23990
|
-
clearTimeout(
|
|
24087
|
+
clearTimeout(timer2);
|
|
23991
24088
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
23992
24089
|
server.close();
|
|
23993
24090
|
};
|
|
@@ -25966,11 +26063,11 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
25966
26063
|
const delayMs = opts?.delayMs ?? 50;
|
|
25967
26064
|
const maxLines = opts?.maxLines ?? 200;
|
|
25968
26065
|
let buffer = [];
|
|
25969
|
-
let
|
|
26066
|
+
let timer2 = null;
|
|
25970
26067
|
const flush2 = () => {
|
|
25971
|
-
if (
|
|
25972
|
-
clearTimeout(
|
|
25973
|
-
|
|
26068
|
+
if (timer2) {
|
|
26069
|
+
clearTimeout(timer2);
|
|
26070
|
+
timer2 = null;
|
|
25974
26071
|
}
|
|
25975
26072
|
if (buffer.length === 0) return;
|
|
25976
26073
|
const chunk = buffer.join("\n");
|
|
@@ -25983,7 +26080,7 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
25983
26080
|
flush2();
|
|
25984
26081
|
return;
|
|
25985
26082
|
}
|
|
25986
|
-
if (!
|
|
26083
|
+
if (!timer2) timer2 = setTimeout(flush2, delayMs);
|
|
25987
26084
|
};
|
|
25988
26085
|
return { push: push2, flush: flush2 };
|
|
25989
26086
|
}
|
|
@@ -28989,7 +29086,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
28989
29086
|
);
|
|
28990
29087
|
}
|
|
28991
29088
|
lines.push(
|
|
28992
|
-
'- Sideboard git buttons send short phrases ("Commit and push.", "Ready for review.", "Merge PR.", \u2026) with their meaning attached \u2014 act on them without asking
|
|
29089
|
+
'- Sideboard git buttons send short phrases ("Commit and push.", "Ready for review.", "Merge PR.", \u2026) with their meaning attached \u2014 act on them without asking. A named goal includes the watch-fix-push playbook.'
|
|
28993
29090
|
);
|
|
28994
29091
|
lines.push("");
|
|
28995
29092
|
lines.push(formatDevAccessHint(opts?.activeRuns));
|
|
@@ -28998,7 +29095,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
28998
29095
|
"Automations (sidebar, after Board): `create_schedule` / `list_schedules` (`at` / `every` / `cron` / `time`+`days`). `archiveChat=false` keeps the new chat. `chatId=self` is removed when this chat is archived. Fires only while Sideboard.app is running. Future jobs turn on Caffeinate."
|
|
28999
29096
|
);
|
|
29000
29097
|
lines.push(
|
|
29001
|
-
"`set_workspace_tags` labels this checkout (omit ref
|
|
29098
|
+
"`set_workspace_tags` labels this checkout (omit ref). `set_wake_on_github_edges` opts this checkout in when Advanced is already on (omit ref)."
|
|
29002
29099
|
);
|
|
29003
29100
|
lines.push(
|
|
29004
29101
|
"Orchestration: `show_plan` opens the diagram and plan.md. `list_order` / `set_dependency`"
|
|
@@ -30053,6 +30150,622 @@ var init_caffeinate_hold = __esm({
|
|
|
30053
30150
|
}
|
|
30054
30151
|
});
|
|
30055
30152
|
|
|
30153
|
+
// src/orchestrator/github-edge.ts
|
|
30154
|
+
function emptyGithubEdgeSnapshot() {
|
|
30155
|
+
return { primed: false, ciFailed: [], reviewRequested: [], lastFiredAt: {} };
|
|
30156
|
+
}
|
|
30157
|
+
function normalizePrUrl(raw) {
|
|
30158
|
+
const trimmed = (raw ?? "").trim();
|
|
30159
|
+
if (!trimmed) return "";
|
|
30160
|
+
try {
|
|
30161
|
+
const url = new URL(trimmed);
|
|
30162
|
+
url.hash = "";
|
|
30163
|
+
url.search = "";
|
|
30164
|
+
const path = url.pathname.replace(/\/+$/, "");
|
|
30165
|
+
return `${url.protocol}//${url.host.toLowerCase()}${path}`;
|
|
30166
|
+
} catch {
|
|
30167
|
+
return trimmed.replace(/\/+$/, "");
|
|
30168
|
+
}
|
|
30169
|
+
}
|
|
30170
|
+
function githubEdgeKey(kind, prUrl) {
|
|
30171
|
+
return `${kind}:${normalizePrUrl(prUrl)}`;
|
|
30172
|
+
}
|
|
30173
|
+
function acceptOpenReadyPr(row) {
|
|
30174
|
+
if (!normalizePrUrl(row.prUrl)) return false;
|
|
30175
|
+
if (row.draft === true) return false;
|
|
30176
|
+
const state = (row.state ?? "").trim().toUpperCase();
|
|
30177
|
+
return state !== "MERGED" && state !== "CLOSED";
|
|
30178
|
+
}
|
|
30179
|
+
function mergeCiLatch(prev, failing, unknown) {
|
|
30180
|
+
const out = /* @__PURE__ */ new Set();
|
|
30181
|
+
for (const url of failing) {
|
|
30182
|
+
const normalized = normalizePrUrl(url);
|
|
30183
|
+
if (normalized) out.add(normalized);
|
|
30184
|
+
}
|
|
30185
|
+
const unknownSet = new Set(unknown.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
30186
|
+
for (const url of prev) {
|
|
30187
|
+
const normalized = normalizePrUrl(url);
|
|
30188
|
+
if (normalized && unknownSet.has(normalized)) out.add(normalized);
|
|
30189
|
+
}
|
|
30190
|
+
return [...out];
|
|
30191
|
+
}
|
|
30192
|
+
function mergeReviewLatch(prev, fetched, successfulRepos) {
|
|
30193
|
+
const ok = new Set(successfulRepos);
|
|
30194
|
+
const map = /* @__PURE__ */ new Map();
|
|
30195
|
+
for (const row of prev) {
|
|
30196
|
+
const prUrl = normalizePrUrl(row.prUrl);
|
|
30197
|
+
if (!prUrl) continue;
|
|
30198
|
+
if (row.repoPath && ok.has(row.repoPath)) continue;
|
|
30199
|
+
if (!row.repoPath) continue;
|
|
30200
|
+
map.set(prUrl, { prUrl, repoPath: row.repoPath });
|
|
30201
|
+
}
|
|
30202
|
+
for (const row of fetched) {
|
|
30203
|
+
const prUrl = normalizePrUrl(row.prUrl);
|
|
30204
|
+
if (!prUrl) continue;
|
|
30205
|
+
map.set(prUrl, { prUrl, repoPath: row.repoPath });
|
|
30206
|
+
}
|
|
30207
|
+
return [...map.values()];
|
|
30208
|
+
}
|
|
30209
|
+
function coerceGithubEdgeSnapshot(raw) {
|
|
30210
|
+
if (!raw || typeof raw !== "object") return emptyGithubEdgeSnapshot();
|
|
30211
|
+
const row = raw;
|
|
30212
|
+
const ciFailed = [];
|
|
30213
|
+
const seenCi = /* @__PURE__ */ new Set();
|
|
30214
|
+
if (Array.isArray(row.ciFailed)) {
|
|
30215
|
+
for (const item of row.ciFailed) {
|
|
30216
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
30217
|
+
if (!prUrl || seenCi.has(prUrl)) continue;
|
|
30218
|
+
seenCi.add(prUrl);
|
|
30219
|
+
ciFailed.push(prUrl);
|
|
30220
|
+
}
|
|
30221
|
+
}
|
|
30222
|
+
const reviewRequested = [];
|
|
30223
|
+
const seenReview = /* @__PURE__ */ new Set();
|
|
30224
|
+
if (Array.isArray(row.reviewRequested)) {
|
|
30225
|
+
for (const item of row.reviewRequested) {
|
|
30226
|
+
if (!item || typeof item !== "object") continue;
|
|
30227
|
+
const record = item;
|
|
30228
|
+
const prUrl = normalizePrUrl(typeof record.prUrl === "string" ? record.prUrl : "");
|
|
30229
|
+
const repoPath = typeof record.repoPath === "string" ? record.repoPath.trim() : "";
|
|
30230
|
+
if (!prUrl || !repoPath || seenReview.has(prUrl)) continue;
|
|
30231
|
+
seenReview.add(prUrl);
|
|
30232
|
+
reviewRequested.push({ prUrl, repoPath });
|
|
30233
|
+
}
|
|
30234
|
+
}
|
|
30235
|
+
const ciSeen = [];
|
|
30236
|
+
const seenCiUrls = /* @__PURE__ */ new Set();
|
|
30237
|
+
if (Array.isArray(row.ciSeen)) {
|
|
30238
|
+
for (const item of row.ciSeen) {
|
|
30239
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
30240
|
+
if (!prUrl || seenCiUrls.has(prUrl)) continue;
|
|
30241
|
+
seenCiUrls.add(prUrl);
|
|
30242
|
+
ciSeen.push(prUrl);
|
|
30243
|
+
}
|
|
30244
|
+
}
|
|
30245
|
+
const reviewReposSeen = [];
|
|
30246
|
+
const seenRepos = /* @__PURE__ */ new Set();
|
|
30247
|
+
if (Array.isArray(row.reviewReposSeen)) {
|
|
30248
|
+
for (const item of row.reviewReposSeen) {
|
|
30249
|
+
const repo = typeof item === "string" ? item.trim() : "";
|
|
30250
|
+
if (!repo || seenRepos.has(repo)) continue;
|
|
30251
|
+
seenRepos.add(repo);
|
|
30252
|
+
reviewReposSeen.push(repo);
|
|
30253
|
+
}
|
|
30254
|
+
}
|
|
30255
|
+
const lastFiredAt = {};
|
|
30256
|
+
if (row.lastFiredAt && typeof row.lastFiredAt === "object") {
|
|
30257
|
+
for (const [key, value] of Object.entries(row.lastFiredAt)) {
|
|
30258
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
30259
|
+
lastFiredAt[key] = value;
|
|
30260
|
+
}
|
|
30261
|
+
}
|
|
30262
|
+
}
|
|
30263
|
+
return {
|
|
30264
|
+
primed: row.primed === true,
|
|
30265
|
+
ciFailed,
|
|
30266
|
+
reviewRequested,
|
|
30267
|
+
lastFiredAt,
|
|
30268
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
30269
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
30270
|
+
};
|
|
30271
|
+
}
|
|
30272
|
+
function dedupeSubjects(items) {
|
|
30273
|
+
const map = /* @__PURE__ */ new Map();
|
|
30274
|
+
for (const item of items) {
|
|
30275
|
+
if (!acceptOpenReadyPr(item)) continue;
|
|
30276
|
+
const prUrl = normalizePrUrl(item.prUrl);
|
|
30277
|
+
if (!prUrl) continue;
|
|
30278
|
+
const next = { ...item, prUrl };
|
|
30279
|
+
const prev = map.get(prUrl);
|
|
30280
|
+
if (!prev) {
|
|
30281
|
+
map.set(prUrl, next);
|
|
30282
|
+
continue;
|
|
30283
|
+
}
|
|
30284
|
+
if (!prev.threadId && next.threadId) {
|
|
30285
|
+
map.set(prUrl, {
|
|
30286
|
+
...prev,
|
|
30287
|
+
...next,
|
|
30288
|
+
prUrl,
|
|
30289
|
+
title: next.title.trim() || prev.title
|
|
30290
|
+
});
|
|
30291
|
+
}
|
|
30292
|
+
}
|
|
30293
|
+
return [...map.values()];
|
|
30294
|
+
}
|
|
30295
|
+
function diffGithubEdges(input) {
|
|
30296
|
+
if (!input.prev.primed) return [];
|
|
30297
|
+
const cooldown = input.cooldownMs ?? GITHUB_EDGE_COOLDOWN_MS;
|
|
30298
|
+
const edges = [];
|
|
30299
|
+
const consider = (kind, items, latched) => {
|
|
30300
|
+
for (const item of dedupeSubjects(items)) {
|
|
30301
|
+
if (latched.has(item.prUrl)) continue;
|
|
30302
|
+
const firedAt = input.prev.lastFiredAt[githubEdgeKey(kind, item.prUrl)] ?? 0;
|
|
30303
|
+
if (firedAt && input.now - firedAt < cooldown) continue;
|
|
30304
|
+
edges.push({ ...item, kind });
|
|
30305
|
+
}
|
|
30306
|
+
};
|
|
30307
|
+
consider("ci-failed", input.ciFailed, new Set(input.prev.ciFailed.map((url) => normalizePrUrl(url))));
|
|
30308
|
+
consider(
|
|
30309
|
+
"review-requested",
|
|
30310
|
+
input.reviewRequested,
|
|
30311
|
+
new Set(input.prev.reviewRequested.map((row) => normalizePrUrl(row.prUrl)))
|
|
30312
|
+
);
|
|
30313
|
+
return edges;
|
|
30314
|
+
}
|
|
30315
|
+
function commitGithubEdgeSnapshot(input) {
|
|
30316
|
+
const deliveredCi = new Set(
|
|
30317
|
+
input.delivered.filter((edge) => edge.kind === "ci-failed").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
30318
|
+
);
|
|
30319
|
+
const deliveredReview = new Set(
|
|
30320
|
+
input.delivered.filter((edge) => edge.kind === "review-requested").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
30321
|
+
);
|
|
30322
|
+
const ciObserved = dedupeSubjects(input.ciFailed).map((item) => item.prUrl);
|
|
30323
|
+
const ciFailed = nextUrls(input.prev.primed, input.prev.ciFailed, ciObserved, deliveredCi);
|
|
30324
|
+
const reviewRequested = nextReviewLatch(
|
|
30325
|
+
input.prev.primed,
|
|
30326
|
+
input.reviewRequested,
|
|
30327
|
+
input.prev.reviewRequested,
|
|
30328
|
+
deliveredReview
|
|
30329
|
+
);
|
|
30330
|
+
const lastFiredAt = {};
|
|
30331
|
+
for (const [key, at] of Object.entries(input.prev.lastFiredAt)) {
|
|
30332
|
+
if (input.now - at <= LAST_FIRED_KEEP_MS) lastFiredAt[key] = at;
|
|
30333
|
+
}
|
|
30334
|
+
for (const edge of input.delivered) {
|
|
30335
|
+
const prUrl = normalizePrUrl(edge.prUrl);
|
|
30336
|
+
if (!prUrl) continue;
|
|
30337
|
+
lastFiredAt[githubEdgeKey(edge.kind, prUrl)] = input.now;
|
|
30338
|
+
}
|
|
30339
|
+
return { primed: true, ciFailed, reviewRequested, lastFiredAt };
|
|
30340
|
+
}
|
|
30341
|
+
function nextUrls(primed, prev, observed, delivered) {
|
|
30342
|
+
const prevSet = new Set(prev.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
30343
|
+
const out = [];
|
|
30344
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30345
|
+
for (const url of observed) {
|
|
30346
|
+
if (!url || seen.has(url)) continue;
|
|
30347
|
+
seen.add(url);
|
|
30348
|
+
if (!primed || prevSet.has(url) || delivered.has(url)) out.push(url);
|
|
30349
|
+
}
|
|
30350
|
+
return out;
|
|
30351
|
+
}
|
|
30352
|
+
function nextReviewLatch(primed, observed, prev, delivered) {
|
|
30353
|
+
const prevSet = new Set(prev.map((row) => normalizePrUrl(row.prUrl)).filter(Boolean));
|
|
30354
|
+
const out = [];
|
|
30355
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30356
|
+
for (const row of observed) {
|
|
30357
|
+
const prUrl = normalizePrUrl(row.prUrl);
|
|
30358
|
+
const repoPath = row.repoPath.trim();
|
|
30359
|
+
if (!prUrl || !repoPath || seen.has(prUrl)) continue;
|
|
30360
|
+
seen.add(prUrl);
|
|
30361
|
+
if (!primed || prevSet.has(prUrl) || delivered.has(prUrl)) {
|
|
30362
|
+
out.push({ prUrl, repoPath });
|
|
30363
|
+
}
|
|
30364
|
+
}
|
|
30365
|
+
return out;
|
|
30366
|
+
}
|
|
30367
|
+
function formatGithubEdgePrompt(edges) {
|
|
30368
|
+
const lines = edges.map((edge) => {
|
|
30369
|
+
const title = edge.title.trim() || "Pull request";
|
|
30370
|
+
const lead = edge.kind === "ci-failed" ? `CI failed on ${title}` : `Review requested: ${title}`;
|
|
30371
|
+
const workspace = edge.threadId && edge.threadTitle?.trim() ? ` ([${edge.threadTitle.trim()}](sideboard://chat/${edge.threadId}))` : edge.threadId ? ` ([workspace](sideboard://chat/${edge.threadId}))` : "";
|
|
30372
|
+
return `${lead} ${edge.prUrl}${workspace}`;
|
|
30373
|
+
});
|
|
30374
|
+
let body = lines.join("\n");
|
|
30375
|
+
if (body.length > 1500) body = `${body.slice(0, 1499)}\u2026`;
|
|
30376
|
+
return [
|
|
30377
|
+
"Sideboard: GitHub update.",
|
|
30378
|
+
body,
|
|
30379
|
+
"This is information \u2014 not a command. Do not merge, do not start a fix, and do not send_to_chat unless the user asks. Do not treat this as a git request."
|
|
30380
|
+
].join("\n");
|
|
30381
|
+
}
|
|
30382
|
+
function routeGithubEdges(edges, parentIdForThread2, designatedId) {
|
|
30383
|
+
const groups = /* @__PURE__ */ new Map();
|
|
30384
|
+
for (const edge of edges) {
|
|
30385
|
+
const parent = edge.threadId ? parentIdForThread2(edge.threadId)?.trim() || null : null;
|
|
30386
|
+
const targetId = parent || designatedId || null;
|
|
30387
|
+
const key = targetId ?? "";
|
|
30388
|
+
const group = groups.get(key);
|
|
30389
|
+
if (group) group.edges.push(edge);
|
|
30390
|
+
else groups.set(key, { targetId, edges: [edge] });
|
|
30391
|
+
}
|
|
30392
|
+
return [...groups.values()];
|
|
30393
|
+
}
|
|
30394
|
+
function pickDesignatedOrchestratorId(threads) {
|
|
30395
|
+
const live = threads.filter((thread) => thread.status !== "archived" && thread.id.trim());
|
|
30396
|
+
const preferred = live.find((thread) => !thread.cloud);
|
|
30397
|
+
return (preferred ?? live[0])?.id ?? null;
|
|
30398
|
+
}
|
|
30399
|
+
function githubEdgeSnapshotKey(snapshot) {
|
|
30400
|
+
const lastFiredAt = Object.fromEntries(
|
|
30401
|
+
Object.entries(snapshot.lastFiredAt).sort(([a], [b]) => a.localeCompare(b))
|
|
30402
|
+
);
|
|
30403
|
+
return JSON.stringify({
|
|
30404
|
+
primed: snapshot.primed === true,
|
|
30405
|
+
ciFailed: [...snapshot.ciFailed].sort(),
|
|
30406
|
+
reviewRequested: [...snapshot.reviewRequested].map((row) => ({ prUrl: row.prUrl, repoPath: row.repoPath })).sort((a, b) => a.prUrl.localeCompare(b.prUrl) || a.repoPath.localeCompare(b.repoPath)),
|
|
30407
|
+
lastFiredAt,
|
|
30408
|
+
reviewReposSeen: [...snapshot.reviewReposSeen ?? []].sort(),
|
|
30409
|
+
ciSeen: [...snapshot.ciSeen ?? []].sort()
|
|
30410
|
+
});
|
|
30411
|
+
}
|
|
30412
|
+
var GITHUB_EDGE_COOLDOWN_MS, GITHUB_EDGE_POLL_MS, LAST_FIRED_KEEP_MS;
|
|
30413
|
+
var init_github_edge = __esm({
|
|
30414
|
+
"src/orchestrator/github-edge.ts"() {
|
|
30415
|
+
"use strict";
|
|
30416
|
+
GITHUB_EDGE_COOLDOWN_MS = 30 * 6e4;
|
|
30417
|
+
GITHUB_EDGE_POLL_MS = 6e4;
|
|
30418
|
+
LAST_FIRED_KEEP_MS = 7 * 24 * 60 * 6e4;
|
|
30419
|
+
}
|
|
30420
|
+
});
|
|
30421
|
+
|
|
30422
|
+
// src/orchestrator/github-edge-watch.ts
|
|
30423
|
+
function githubEdgeSnapshotPath() {
|
|
30424
|
+
return (0, import_node_path69.join)(appDataDir(), "github-edge-watch.json");
|
|
30425
|
+
}
|
|
30426
|
+
function loadGithubEdgeSnapshot() {
|
|
30427
|
+
try {
|
|
30428
|
+
const path = githubEdgeSnapshotPath();
|
|
30429
|
+
if (!(0, import_node_fs69.existsSync)(path)) return emptyGithubEdgeSnapshot();
|
|
30430
|
+
return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs69.readFileSync)(path, "utf8")));
|
|
30431
|
+
} catch {
|
|
30432
|
+
return emptyGithubEdgeSnapshot();
|
|
30433
|
+
}
|
|
30434
|
+
}
|
|
30435
|
+
function saveGithubEdgeSnapshot(snapshot) {
|
|
30436
|
+
writePrivateFile2(githubEdgeSnapshotPath(), `${JSON.stringify(snapshot, null, 2)}
|
|
30437
|
+
`);
|
|
30438
|
+
}
|
|
30439
|
+
function stopGithubEdgeWatch() {
|
|
30440
|
+
if (timer) clearInterval(timer);
|
|
30441
|
+
timer = null;
|
|
30442
|
+
}
|
|
30443
|
+
function armGithubEdgeWatch() {
|
|
30444
|
+
if (!isThisProcessDesktopHost()) return;
|
|
30445
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
30446
|
+
stopGithubEdgeWatch();
|
|
30447
|
+
needsBaseline = true;
|
|
30448
|
+
return;
|
|
30449
|
+
}
|
|
30450
|
+
if (timer) return;
|
|
30451
|
+
const tick = () => {
|
|
30452
|
+
if (polling) return;
|
|
30453
|
+
polling = true;
|
|
30454
|
+
const baseline = needsBaseline;
|
|
30455
|
+
needsBaseline = false;
|
|
30456
|
+
void pollGithubEdges(realDeps(), { baseline }).catch(() => {
|
|
30457
|
+
if (baseline) needsBaseline = true;
|
|
30458
|
+
}).finally(() => {
|
|
30459
|
+
polling = false;
|
|
30460
|
+
});
|
|
30461
|
+
};
|
|
30462
|
+
timer = setInterval(tick, GITHUB_EDGE_POLL_MS);
|
|
30463
|
+
timer.unref?.();
|
|
30464
|
+
tick();
|
|
30465
|
+
}
|
|
30466
|
+
async function pollGithubEdges(deps = realDeps(), opts) {
|
|
30467
|
+
if (!deps.enabled()) return { fired: 0, primed: false, skipped: "disabled" };
|
|
30468
|
+
const loaded = deps.load();
|
|
30469
|
+
const prev = opts?.baseline ? { ...loaded, primed: false } : loaded;
|
|
30470
|
+
const now = deps.now();
|
|
30471
|
+
const cards = indexCiCards(deps.listCiCards(), (threadId) => deps.parentIdForThread(threadId));
|
|
30472
|
+
const failing = [];
|
|
30473
|
+
const unknown = [];
|
|
30474
|
+
const observed = [];
|
|
30475
|
+
const failingSubjects = /* @__PURE__ */ new Map();
|
|
30476
|
+
for (const card of cards.values()) {
|
|
30477
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
30478
|
+
let failed;
|
|
30479
|
+
try {
|
|
30480
|
+
failed = await deps.fetchCiFailed(card);
|
|
30481
|
+
} catch {
|
|
30482
|
+
failed = null;
|
|
30483
|
+
}
|
|
30484
|
+
if (failed == null) {
|
|
30485
|
+
unknown.push(prUrl);
|
|
30486
|
+
continue;
|
|
30487
|
+
}
|
|
30488
|
+
observed.push(prUrl);
|
|
30489
|
+
if (!failed) continue;
|
|
30490
|
+
failing.push(prUrl);
|
|
30491
|
+
failingSubjects.set(prUrl, subjectFromCard(card, prUrl));
|
|
30492
|
+
}
|
|
30493
|
+
const ciUrls = mergeCiLatch(
|
|
30494
|
+
prev.ciFailed,
|
|
30495
|
+
prev.primed ? failing : [...failing, ...unknown],
|
|
30496
|
+
unknown
|
|
30497
|
+
);
|
|
30498
|
+
const ciFailed = ciUrls.map(
|
|
30499
|
+
(prUrl) => failingSubjects.get(prUrl) ?? { prUrl, title: prUrl }
|
|
30500
|
+
);
|
|
30501
|
+
const repos = [...new Set(deps.listRepoPaths().map((path) => path.trim()).filter(Boolean))].sort();
|
|
30502
|
+
const fetchedReviews = [];
|
|
30503
|
+
const reviewSubjects = /* @__PURE__ */ new Map();
|
|
30504
|
+
const successfulRepos = [];
|
|
30505
|
+
for (const repoPath of repos) {
|
|
30506
|
+
let rows;
|
|
30507
|
+
try {
|
|
30508
|
+
rows = await deps.listReviewRequested(repoPath);
|
|
30509
|
+
} catch {
|
|
30510
|
+
rows = null;
|
|
30511
|
+
}
|
|
30512
|
+
if (!rows) continue;
|
|
30513
|
+
successfulRepos.push(repoPath);
|
|
30514
|
+
for (const row of rows) {
|
|
30515
|
+
if (!acceptOpenReadyPr(row)) continue;
|
|
30516
|
+
const prUrl = normalizePrUrl(row.prUrl);
|
|
30517
|
+
if (!prUrl) continue;
|
|
30518
|
+
const card = cards.get(prUrl);
|
|
30519
|
+
fetchedReviews.push({ prUrl, repoPath });
|
|
30520
|
+
reviewSubjects.set(prUrl, {
|
|
30521
|
+
prUrl,
|
|
30522
|
+
title: row.title.trim() || card?.prTitle || prUrl,
|
|
30523
|
+
threadId: card?.threadId,
|
|
30524
|
+
threadTitle: card?.threadTitle,
|
|
30525
|
+
repoPath
|
|
30526
|
+
});
|
|
30527
|
+
}
|
|
30528
|
+
}
|
|
30529
|
+
const seenRepos = new Set(prev.reviewReposSeen ?? []);
|
|
30530
|
+
const freshRepos = new Set(
|
|
30531
|
+
prev.primed ? successfulRepos.filter((repo) => !seenRepos.has(repo)) : []
|
|
30532
|
+
);
|
|
30533
|
+
const reviewLatch = repos.length ? mergeReviewLatch(prev.reviewRequested, fetchedReviews, successfulRepos) : prev.reviewRequested;
|
|
30534
|
+
const reviewRequested = reviewLatch.filter((row) => !freshRepos.has(row.repoPath)).map(
|
|
30535
|
+
(row) => reviewSubjects.get(row.prUrl) ?? {
|
|
30536
|
+
prUrl: row.prUrl,
|
|
30537
|
+
title: row.prUrl,
|
|
30538
|
+
repoPath: row.repoPath
|
|
30539
|
+
}
|
|
30540
|
+
);
|
|
30541
|
+
const baseline = reviewLatch.filter((row) => freshRepos.has(row.repoPath));
|
|
30542
|
+
const seenCi = new Set((prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
30543
|
+
const freshCi = new Set(prev.primed ? observed.filter((url) => !seenCi.has(url)) : []);
|
|
30544
|
+
const ciForDiff = ciFailed.filter((subject) => !freshCi.has(subject.prUrl));
|
|
30545
|
+
const edges = diffGithubEdges({ prev, ciFailed: ciForDiff, reviewRequested, now });
|
|
30546
|
+
const delivered = prev.primed && edges.length ? await deliverGithubEdges(edges, deps) : [];
|
|
30547
|
+
const freshFailing = [...freshCi].filter((url) => failing.includes(url));
|
|
30548
|
+
const prevForCommit = freshFailing.length || baseline.length ? {
|
|
30549
|
+
...prev,
|
|
30550
|
+
...freshFailing.length ? {
|
|
30551
|
+
ciFailed: [
|
|
30552
|
+
.../* @__PURE__ */ new Set([
|
|
30553
|
+
...prev.ciFailed.map((url) => normalizePrUrl(url)).filter(Boolean),
|
|
30554
|
+
...freshFailing
|
|
30555
|
+
])
|
|
30556
|
+
]
|
|
30557
|
+
} : {},
|
|
30558
|
+
...baseline.length ? { reviewRequested: mergeReviewLatch(prev.reviewRequested, baseline, [...freshRepos]) } : {}
|
|
30559
|
+
} : prev;
|
|
30560
|
+
const committed = commitGithubEdgeSnapshot({
|
|
30561
|
+
prev: prevForCommit,
|
|
30562
|
+
ciFailed,
|
|
30563
|
+
reviewRequested: reviewLatch,
|
|
30564
|
+
delivered,
|
|
30565
|
+
now
|
|
30566
|
+
});
|
|
30567
|
+
const watched = new Set(repos);
|
|
30568
|
+
const reviewReposSeen = [
|
|
30569
|
+
.../* @__PURE__ */ new Set([
|
|
30570
|
+
...(prev.reviewReposSeen ?? []).filter((repo) => watched.has(repo)),
|
|
30571
|
+
...successfulRepos
|
|
30572
|
+
])
|
|
30573
|
+
].sort();
|
|
30574
|
+
const cardUrls = new Set(cards.keys());
|
|
30575
|
+
const ciSeen = [
|
|
30576
|
+
.../* @__PURE__ */ new Set([
|
|
30577
|
+
...(prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter((url) => url && cardUrls.has(url)),
|
|
30578
|
+
...observed
|
|
30579
|
+
])
|
|
30580
|
+
].sort();
|
|
30581
|
+
const next = {
|
|
30582
|
+
...committed,
|
|
30583
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
30584
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
30585
|
+
};
|
|
30586
|
+
if (githubEdgeSnapshotKey(prev) !== githubEdgeSnapshotKey(next)) deps.save(next);
|
|
30587
|
+
return { fired: delivered.length, primed: next.primed };
|
|
30588
|
+
}
|
|
30589
|
+
async function deliverGithubEdges(edges, deps) {
|
|
30590
|
+
const delivered = [];
|
|
30591
|
+
for (const group of routeGithubEdges(edges, (threadId) => deps.parentIdForThread(threadId), deps.designatedId())) {
|
|
30592
|
+
const prompt = formatGithubEdgePrompt(group.edges);
|
|
30593
|
+
try {
|
|
30594
|
+
if (group.targetId) await deps.send(group.targetId, prompt);
|
|
30595
|
+
else await deps.startOrchestration(prompt);
|
|
30596
|
+
delivered.push(...group.edges);
|
|
30597
|
+
} catch {
|
|
30598
|
+
}
|
|
30599
|
+
}
|
|
30600
|
+
return delivered;
|
|
30601
|
+
}
|
|
30602
|
+
function indexCiCards(cards, parentIdForThread2) {
|
|
30603
|
+
const byUrl = /* @__PURE__ */ new Map();
|
|
30604
|
+
for (const card of cards) {
|
|
30605
|
+
if (!acceptOpenReadyPr(card)) continue;
|
|
30606
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
30607
|
+
if (!prUrl) continue;
|
|
30608
|
+
const existing = byUrl.get(prUrl);
|
|
30609
|
+
if (!existing) {
|
|
30610
|
+
byUrl.set(prUrl, card);
|
|
30611
|
+
continue;
|
|
30612
|
+
}
|
|
30613
|
+
const existingParent = parentIdForThread2(existing.threadId);
|
|
30614
|
+
const nextParent = parentIdForThread2(card.threadId);
|
|
30615
|
+
if (!existingParent && nextParent) byUrl.set(prUrl, card);
|
|
30616
|
+
}
|
|
30617
|
+
return byUrl;
|
|
30618
|
+
}
|
|
30619
|
+
function subjectFromCard(card, prUrl) {
|
|
30620
|
+
return {
|
|
30621
|
+
prUrl,
|
|
30622
|
+
title: card.prTitle.trim() || card.threadTitle.trim() || prUrl,
|
|
30623
|
+
threadId: card.threadId,
|
|
30624
|
+
threadTitle: card.threadTitle,
|
|
30625
|
+
repoPath: card.repoPath,
|
|
30626
|
+
draft: card.draft,
|
|
30627
|
+
state: card.state
|
|
30628
|
+
};
|
|
30629
|
+
}
|
|
30630
|
+
function liveWorktreeThreads() {
|
|
30631
|
+
return listThreads().filter(
|
|
30632
|
+
(thread) => !isGlobalThread(thread) && !isOrchestratorThread(thread) && thread.wakeOnGithubEdges === true && Boolean(thread.worktreePath?.trim()) && Boolean(thread.repoPath?.trim())
|
|
30633
|
+
);
|
|
30634
|
+
}
|
|
30635
|
+
function listCiCardsFromStore() {
|
|
30636
|
+
const cards = [];
|
|
30637
|
+
for (const thread of liveWorktreeThreads()) {
|
|
30638
|
+
const prUrl = thread.prUrl?.trim() ?? "";
|
|
30639
|
+
if (!prUrl) continue;
|
|
30640
|
+
cards.push({
|
|
30641
|
+
threadId: thread.id,
|
|
30642
|
+
threadTitle: thread.title?.trim() || "Workspace",
|
|
30643
|
+
worktreePath: thread.worktreePath,
|
|
30644
|
+
repoPath: thread.repoPath,
|
|
30645
|
+
prUrl,
|
|
30646
|
+
prTitle: thread.prTitle?.trim() || thread.title?.trim() || prUrl,
|
|
30647
|
+
draft: thread.prIsDraft,
|
|
30648
|
+
state: thread.prState
|
|
30649
|
+
});
|
|
30650
|
+
}
|
|
30651
|
+
return cards;
|
|
30652
|
+
}
|
|
30653
|
+
function listLiveRepoPaths() {
|
|
30654
|
+
return [...new Set(liveWorktreeThreads().map((thread) => thread.repoPath.trim()).filter(Boolean))];
|
|
30655
|
+
}
|
|
30656
|
+
async function fetchCiFailedFromGh(card) {
|
|
30657
|
+
try {
|
|
30658
|
+
const checks = await getPrCiChecks(card.worktreePath, card.prUrl);
|
|
30659
|
+
if (!checks) return null;
|
|
30660
|
+
const failed = ciChecksFailed(checks);
|
|
30661
|
+
persistChecksFailed(card, failed);
|
|
30662
|
+
return failed;
|
|
30663
|
+
} catch {
|
|
30664
|
+
return null;
|
|
30665
|
+
}
|
|
30666
|
+
}
|
|
30667
|
+
function persistChecksFailed(card, failed) {
|
|
30668
|
+
const siblings = threadsSharingWorktree(card.worktreePath);
|
|
30669
|
+
const self = readThread(card.threadId);
|
|
30670
|
+
const targets = siblings.length > 0 ? siblings : self ? [self] : [];
|
|
30671
|
+
for (const thread of targets) {
|
|
30672
|
+
const patch = threadPrChecksFailedPatch(thread, failed);
|
|
30673
|
+
if (Object.keys(patch).length === 0) continue;
|
|
30674
|
+
try {
|
|
30675
|
+
updateThread(thread.id, patch);
|
|
30676
|
+
} catch {
|
|
30677
|
+
}
|
|
30678
|
+
}
|
|
30679
|
+
}
|
|
30680
|
+
async function listMineFromGh(repoPath) {
|
|
30681
|
+
try {
|
|
30682
|
+
const reviewLabel = resolveProjectReviewLabel(loadAppSettings(), repoPath);
|
|
30683
|
+
const rows = await listPrs(repoPath, {
|
|
30684
|
+
queue: "mine",
|
|
30685
|
+
limit: 30,
|
|
30686
|
+
strict: true,
|
|
30687
|
+
...reviewLabel ? { reviewLabel } : {}
|
|
30688
|
+
});
|
|
30689
|
+
return rows.map((row) => ({
|
|
30690
|
+
prUrl: row.url,
|
|
30691
|
+
title: row.title,
|
|
30692
|
+
draft: row.isDraft,
|
|
30693
|
+
state: row.state
|
|
30694
|
+
}));
|
|
30695
|
+
} catch {
|
|
30696
|
+
return null;
|
|
30697
|
+
}
|
|
30698
|
+
}
|
|
30699
|
+
function parentIdForThread(threadId) {
|
|
30700
|
+
const thread = readThread(threadId);
|
|
30701
|
+
if (!thread || thread.status === "archived") return null;
|
|
30702
|
+
const parent = connectedOrchestrator(thread, (id) => readThread(id));
|
|
30703
|
+
if (!parent || parent.status === "archived") return null;
|
|
30704
|
+
return parent.id;
|
|
30705
|
+
}
|
|
30706
|
+
function designatedOrchestratorId() {
|
|
30707
|
+
return pickDesignatedOrchestratorId(
|
|
30708
|
+
listGlobalThreads().map((thread) => ({
|
|
30709
|
+
id: thread.id,
|
|
30710
|
+
status: thread.status,
|
|
30711
|
+
cloud: isCloudCoordinatorThread(thread)
|
|
30712
|
+
}))
|
|
30713
|
+
);
|
|
30714
|
+
}
|
|
30715
|
+
function realDeps() {
|
|
30716
|
+
return {
|
|
30717
|
+
enabled: () => wakeOrchestratorOnGithubEdgesEnabled(),
|
|
30718
|
+
listCiCards: listCiCardsFromStore,
|
|
30719
|
+
fetchCiFailed: fetchCiFailedFromGh,
|
|
30720
|
+
listRepoPaths: listLiveRepoPaths,
|
|
30721
|
+
listReviewRequested: listMineFromGh,
|
|
30722
|
+
parentIdForThread,
|
|
30723
|
+
designatedId: designatedOrchestratorId,
|
|
30724
|
+
send: async (threadId, prompt) => {
|
|
30725
|
+
const { getOrchestrator: getOrchestrator2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
30726
|
+
await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
|
|
30727
|
+
},
|
|
30728
|
+
startOrchestration: async (prompt) => {
|
|
30729
|
+
const { startOrchestration: startOrchestration2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
30730
|
+
const defaults = resolveOrchestratorDefaults();
|
|
30731
|
+
await startOrchestration2({
|
|
30732
|
+
goal: prompt,
|
|
30733
|
+
agent: defaults.agent,
|
|
30734
|
+
model: defaults.model,
|
|
30735
|
+
effort: defaults.effort,
|
|
30736
|
+
fast: defaults.fast,
|
|
30737
|
+
autonomy: defaults.autonomy
|
|
30738
|
+
});
|
|
30739
|
+
},
|
|
30740
|
+
load: loadGithubEdgeSnapshot,
|
|
30741
|
+
save: saveGithubEdgeSnapshot,
|
|
30742
|
+
now: () => Date.now()
|
|
30743
|
+
};
|
|
30744
|
+
}
|
|
30745
|
+
var import_node_fs69, import_node_path69, timer, polling, needsBaseline;
|
|
30746
|
+
var init_github_edge_watch = __esm({
|
|
30747
|
+
"src/orchestrator/github-edge-watch.ts"() {
|
|
30748
|
+
"use strict";
|
|
30749
|
+
import_node_fs69 = require("fs");
|
|
30750
|
+
import_node_path69 = require("path");
|
|
30751
|
+
init_pr_gates();
|
|
30752
|
+
init_pr_merge_archive();
|
|
30753
|
+
init_worktree();
|
|
30754
|
+
init_desktop_host();
|
|
30755
|
+
init_app_settings();
|
|
30756
|
+
init_global_workspace();
|
|
30757
|
+
init_paths();
|
|
30758
|
+
init_private_file();
|
|
30759
|
+
init_thread_store();
|
|
30760
|
+
init_chat_tabs();
|
|
30761
|
+
init_connected_orchestrator();
|
|
30762
|
+
init_github_edge();
|
|
30763
|
+
timer = null;
|
|
30764
|
+
polling = false;
|
|
30765
|
+
needsBaseline = true;
|
|
30766
|
+
}
|
|
30767
|
+
});
|
|
30768
|
+
|
|
30056
30769
|
// src/orchestrator/schedule-runner.ts
|
|
30057
30770
|
function formatScheduledPrompt(name, prompt) {
|
|
30058
30771
|
return `[Scheduled: ${name}]
|
|
@@ -30159,8 +30872,8 @@ async function fireSchedule(id) {
|
|
|
30159
30872
|
}
|
|
30160
30873
|
}
|
|
30161
30874
|
function clearTimer(id) {
|
|
30162
|
-
const
|
|
30163
|
-
if (
|
|
30875
|
+
const timer2 = timers.get(id);
|
|
30876
|
+
if (timer2) clearTimeout(timer2);
|
|
30164
30877
|
timers.delete(id);
|
|
30165
30878
|
}
|
|
30166
30879
|
function armOne(schedule) {
|
|
@@ -30176,7 +30889,7 @@ function armOne(schedule) {
|
|
|
30176
30889
|
return;
|
|
30177
30890
|
}
|
|
30178
30891
|
const capped = Math.min(delay2, SET_TIMEOUT_MAX);
|
|
30179
|
-
const
|
|
30892
|
+
const timer2 = setTimeout(() => {
|
|
30180
30893
|
timers.delete(schedule.id);
|
|
30181
30894
|
const live = getSchedule(schedule.id);
|
|
30182
30895
|
if (!live?.enabled) return;
|
|
@@ -30189,7 +30902,7 @@ function armOne(schedule) {
|
|
|
30189
30902
|
if (isThisProcessDesktopHost()) armSchedules();
|
|
30190
30903
|
});
|
|
30191
30904
|
}, capped);
|
|
30192
|
-
timers.set(schedule.id,
|
|
30905
|
+
timers.set(schedule.id, timer2);
|
|
30193
30906
|
}
|
|
30194
30907
|
function armSchedules() {
|
|
30195
30908
|
if (!isThisProcessDesktopHost()) return;
|
|
@@ -30238,9 +30951,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
30238
30951
|
return best;
|
|
30239
30952
|
}
|
|
30240
30953
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
30241
|
-
if (!(0,
|
|
30954
|
+
if (!(0, import_node_fs70.existsSync)(runsPath)) return null;
|
|
30242
30955
|
try {
|
|
30243
|
-
const lines = (0,
|
|
30956
|
+
const lines = (0, import_node_fs70.readFileSync)(runsPath, "utf8").split("\n");
|
|
30244
30957
|
let best = null;
|
|
30245
30958
|
for (const line of lines) {
|
|
30246
30959
|
const trimmed = line.trim();
|
|
@@ -30266,11 +30979,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
30266
30979
|
return null;
|
|
30267
30980
|
}
|
|
30268
30981
|
}
|
|
30269
|
-
var
|
|
30982
|
+
var import_node_fs70;
|
|
30270
30983
|
var init_cursor_recover = __esm({
|
|
30271
30984
|
"src/agents/cursor-recover.ts"() {
|
|
30272
30985
|
"use strict";
|
|
30273
|
-
|
|
30986
|
+
import_node_fs70 = require("fs");
|
|
30274
30987
|
init_cursor_store();
|
|
30275
30988
|
}
|
|
30276
30989
|
});
|
|
@@ -30374,7 +31087,7 @@ async function startOrchestration(opts) {
|
|
|
30374
31087
|
}
|
|
30375
31088
|
return ready;
|
|
30376
31089
|
}
|
|
30377
|
-
var import_node_events, import_node_crypto20,
|
|
31090
|
+
var import_node_events, import_node_crypto20, import_node_fs71, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
|
|
30378
31091
|
var init_orchestrator = __esm({
|
|
30379
31092
|
"src/orchestrator/orchestrator.ts"() {
|
|
30380
31093
|
"use strict";
|
|
@@ -30383,7 +31096,7 @@ var init_orchestrator = __esm({
|
|
|
30383
31096
|
init_task_state();
|
|
30384
31097
|
init_wait_for_turn();
|
|
30385
31098
|
import_node_crypto20 = require("crypto");
|
|
30386
|
-
|
|
31099
|
+
import_node_fs71 = require("fs");
|
|
30387
31100
|
init_error_detail();
|
|
30388
31101
|
init_run();
|
|
30389
31102
|
init_stale_lock();
|
|
@@ -30459,6 +31172,7 @@ var init_orchestrator = __esm({
|
|
|
30459
31172
|
init_workspaces();
|
|
30460
31173
|
init_global_workspace();
|
|
30461
31174
|
init_caffeinate_hold();
|
|
31175
|
+
init_github_edge_watch();
|
|
30462
31176
|
init_schedule_runner();
|
|
30463
31177
|
init_coordinator_prompt();
|
|
30464
31178
|
init_enqueue_thread_send();
|
|
@@ -30584,7 +31298,7 @@ var init_orchestrator = __esm({
|
|
|
30584
31298
|
this.lightReconcileAt.set(repoPath, Date.now());
|
|
30585
31299
|
for (const thread of listThreads()) {
|
|
30586
31300
|
if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
|
|
30587
|
-
if (!(0,
|
|
31301
|
+
if (!(0, import_node_fs71.existsSync)(thread.worktreePath)) {
|
|
30588
31302
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
30589
31303
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
30590
31304
|
}
|
|
@@ -30613,7 +31327,7 @@ var init_orchestrator = __esm({
|
|
|
30613
31327
|
}
|
|
30614
31328
|
continue;
|
|
30615
31329
|
}
|
|
30616
|
-
if (!(0,
|
|
31330
|
+
if (!(0, import_node_fs71.existsSync)(thread.worktreePath)) {
|
|
30617
31331
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
30618
31332
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
30619
31333
|
continue;
|
|
@@ -30639,6 +31353,7 @@ var init_orchestrator = __esm({
|
|
|
30639
31353
|
}
|
|
30640
31354
|
this.schedulePendingQuotaResumes();
|
|
30641
31355
|
armSchedules();
|
|
31356
|
+
armGithubEdgeWatch();
|
|
30642
31357
|
}
|
|
30643
31358
|
/** Surface (and, when enabled, clean up) worktrees git knows about but no thread owns. */
|
|
30644
31359
|
async reconcileOrphans(repoPaths) {
|
|
@@ -30777,8 +31492,8 @@ var init_orchestrator = __esm({
|
|
|
30777
31492
|
}
|
|
30778
31493
|
}
|
|
30779
31494
|
clearQuotaResumeTimer(threadId) {
|
|
30780
|
-
const
|
|
30781
|
-
if (
|
|
31495
|
+
const timer2 = this.quotaResumeTimers.get(threadId);
|
|
31496
|
+
if (timer2) clearTimeout(timer2);
|
|
30782
31497
|
this.quotaResumeTimers.delete(threadId);
|
|
30783
31498
|
}
|
|
30784
31499
|
/** Schedule (or fire) auto-retry after a provider session/usage limit reset. */
|
|
@@ -30787,11 +31502,11 @@ var init_orchestrator = __esm({
|
|
|
30787
31502
|
updateThread(threadId, { quotaResumeAt: resumeAt.toISOString() });
|
|
30788
31503
|
const delay2 = Math.max(5e3, resumeAt.getTime() - Date.now());
|
|
30789
31504
|
const capped = Math.min(delay2, 2147483647);
|
|
30790
|
-
const
|
|
31505
|
+
const timer2 = setTimeout(() => {
|
|
30791
31506
|
this.quotaResumeTimers.delete(threadId);
|
|
30792
31507
|
void this.resumeAfterQuotaWait(threadId);
|
|
30793
31508
|
}, capped);
|
|
30794
|
-
this.quotaResumeTimers.set(threadId,
|
|
31509
|
+
this.quotaResumeTimers.set(threadId, timer2);
|
|
30795
31510
|
}
|
|
30796
31511
|
schedulePendingQuotaResumes() {
|
|
30797
31512
|
for (const thread of listThreads({ includeArchived: false })) {
|
|
@@ -32439,11 +33154,11 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
32439
33154
|
const start = Date.now();
|
|
32440
33155
|
return new Promise((resolve3, reject) => {
|
|
32441
33156
|
let settled = false;
|
|
32442
|
-
let
|
|
33157
|
+
let timer2;
|
|
32443
33158
|
const finish = (fn) => {
|
|
32444
33159
|
if (settled) return;
|
|
32445
33160
|
settled = true;
|
|
32446
|
-
if (
|
|
33161
|
+
if (timer2) clearInterval(timer2);
|
|
32447
33162
|
off();
|
|
32448
33163
|
fn();
|
|
32449
33164
|
};
|
|
@@ -32469,7 +33184,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
32469
33184
|
}
|
|
32470
33185
|
}
|
|
32471
33186
|
});
|
|
32472
|
-
|
|
33187
|
+
timer2 = setInterval(() => {
|
|
32473
33188
|
const raw = readThread(thread.id);
|
|
32474
33189
|
if (!raw) {
|
|
32475
33190
|
finish(() => reject(new Error(`Thread not found: ${thread.id}`)));
|
|
@@ -33114,7 +33829,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
33114
33829
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
33115
33830
|
return restored2;
|
|
33116
33831
|
}
|
|
33117
|
-
if (!(0,
|
|
33832
|
+
if (!(0, import_node_fs71.existsSync)(thread.worktreePath)) {
|
|
33118
33833
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
33119
33834
|
throw new Error(
|
|
33120
33835
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -33305,7 +34020,7 @@ function createClippedMcpServer() {
|
|
|
33305
34020
|
// src/mcp/server.ts
|
|
33306
34021
|
var import_zod12 = require("zod");
|
|
33307
34022
|
var import_node_crypto24 = require("crypto");
|
|
33308
|
-
var
|
|
34023
|
+
var import_node_path74 = require("path");
|
|
33309
34024
|
init_orchestrator();
|
|
33310
34025
|
init_task_state();
|
|
33311
34026
|
init_worktree();
|
|
@@ -34059,9 +34774,57 @@ init_chat_tabs();
|
|
|
34059
34774
|
init_connected_orchestrator();
|
|
34060
34775
|
init_workspace_tags();
|
|
34061
34776
|
|
|
34777
|
+
// src/threads/wake-on-github-edges.ts
|
|
34778
|
+
init_global_workspace();
|
|
34779
|
+
init_app_settings();
|
|
34780
|
+
init_thread_store();
|
|
34781
|
+
init_worktree_labels();
|
|
34782
|
+
init_chat_tabs();
|
|
34783
|
+
function wakeOnGithubEdgesTargetRef(opts) {
|
|
34784
|
+
const requested = opts.requestedRef?.trim() || "";
|
|
34785
|
+
if (!opts.ownWorktreeOnly) {
|
|
34786
|
+
if (!requested) throw new Error("Pass a chat id on the workspace.");
|
|
34787
|
+
return requested;
|
|
34788
|
+
}
|
|
34789
|
+
const caller = opts.caller;
|
|
34790
|
+
if (!caller || isGlobalThread(caller) || caller.sourceType === "orchestration") {
|
|
34791
|
+
throw new Error("CI and review wakes belong on a project workspace. This chat is not one.");
|
|
34792
|
+
}
|
|
34793
|
+
if (!requested || requested === caller.id) return caller.id;
|
|
34794
|
+
const other = opts.find(requested);
|
|
34795
|
+
if (!other || normalizeWorktreePath(other.worktreePath) !== normalizeWorktreePath(caller.worktreePath)) {
|
|
34796
|
+
throw new Error("You can only change this switch on this workspace.");
|
|
34797
|
+
}
|
|
34798
|
+
return other.id;
|
|
34799
|
+
}
|
|
34800
|
+
function applyWakeOnGithubEdges(threadRef, enabled) {
|
|
34801
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
34802
|
+
throw new Error(
|
|
34803
|
+
"Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is off. Turn that on in Settings. Do not change it from this chat."
|
|
34804
|
+
);
|
|
34805
|
+
}
|
|
34806
|
+
const thread = findThreadByRef(threadRef);
|
|
34807
|
+
if (!thread) throw new Error(`Thread not found: ${threadRef}`);
|
|
34808
|
+
if (isGlobalThread(thread) || thread.sourceType === "orchestration") {
|
|
34809
|
+
throw new Error("CI and review wakes belong on a project workspace. Pass a worktree chat id.");
|
|
34810
|
+
}
|
|
34811
|
+
const on = enabled === true;
|
|
34812
|
+
const siblings = threadsSharingWorktree(thread.worktreePath);
|
|
34813
|
+
const targets = siblings.length > 0 ? siblings : [thread];
|
|
34814
|
+
let updated = thread;
|
|
34815
|
+
for (const row of targets) {
|
|
34816
|
+
const written = updateThread(row.id, { wakeOnGithubEdges: on ? true : void 0 });
|
|
34817
|
+
if (!on) delete written.wakeOnGithubEdges;
|
|
34818
|
+
if (written.id === thread.id) updated = written;
|
|
34819
|
+
}
|
|
34820
|
+
return updated;
|
|
34821
|
+
}
|
|
34822
|
+
|
|
34062
34823
|
// src/mcp/create-orch-child.ts
|
|
34063
34824
|
init_chat_tabs();
|
|
34064
34825
|
init_worktree_labels();
|
|
34826
|
+
init_app_settings();
|
|
34827
|
+
init_global_workspace();
|
|
34065
34828
|
|
|
34066
34829
|
// src/mcp/create-thread-agent.ts
|
|
34067
34830
|
init_cursor();
|
|
@@ -34110,20 +34873,34 @@ function orchCreateThreadAgentNote(input) {
|
|
|
34110
34873
|
}
|
|
34111
34874
|
|
|
34112
34875
|
// src/mcp/create-orch-child.ts
|
|
34113
|
-
var MAX_ORCH_THREADS = 5;
|
|
34114
34876
|
var CREATE_THREAD_TIMEOUT_MS = 9e4;
|
|
34877
|
+
function orchChildWorkspaceCount(threads, parentId) {
|
|
34878
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34879
|
+
let unpathed = 0;
|
|
34880
|
+
for (const thread of threads) {
|
|
34881
|
+
if (thread.parentThreadId !== parentId) continue;
|
|
34882
|
+
if (isOrchestratorThread(thread)) continue;
|
|
34883
|
+
const raw = thread.worktreePath?.trim();
|
|
34884
|
+
if (!raw) {
|
|
34885
|
+
unpathed += 1;
|
|
34886
|
+
continue;
|
|
34887
|
+
}
|
|
34888
|
+
seen.add(normalizeWorktreePath(raw));
|
|
34889
|
+
}
|
|
34890
|
+
return seen.size + unpathed;
|
|
34891
|
+
}
|
|
34115
34892
|
function withTimeout2(promise, ms, label) {
|
|
34116
34893
|
return new Promise((resolve3, reject) => {
|
|
34117
|
-
const
|
|
34894
|
+
const timer2 = setTimeout(() => {
|
|
34118
34895
|
reject(new Error(`${label} timed out after ${Math.round(ms / 1e3)}s`));
|
|
34119
34896
|
}, ms);
|
|
34120
34897
|
promise.then(
|
|
34121
34898
|
(value) => {
|
|
34122
|
-
clearTimeout(
|
|
34899
|
+
clearTimeout(timer2);
|
|
34123
34900
|
resolve3(value);
|
|
34124
34901
|
},
|
|
34125
34902
|
(err) => {
|
|
34126
|
-
clearTimeout(
|
|
34903
|
+
clearTimeout(timer2);
|
|
34127
34904
|
reject(err);
|
|
34128
34905
|
}
|
|
34129
34906
|
);
|
|
@@ -34149,11 +34926,12 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
34149
34926
|
parent = null;
|
|
34150
34927
|
}
|
|
34151
34928
|
if (parentId) {
|
|
34152
|
-
const
|
|
34153
|
-
|
|
34929
|
+
const cap = maxOrchThreads();
|
|
34930
|
+
const used = orchChildWorkspaceCount(orch.getThreads(false), parentId);
|
|
34931
|
+
if (used >= cap) {
|
|
34154
34932
|
return {
|
|
34155
34933
|
ok: false,
|
|
34156
|
-
text: `
|
|
34934
|
+
text: `Workspace cap (${cap}) reached for this orchestration session. Raise it in Settings \u2192 Advanced \u2192 Max orchestration threads.`
|
|
34157
34935
|
};
|
|
34158
34936
|
}
|
|
34159
34937
|
}
|
|
@@ -35557,13 +36335,13 @@ function whenFromUpdate(id, args) {
|
|
|
35557
36335
|
}
|
|
35558
36336
|
function createdHint(schedule) {
|
|
35559
36337
|
const awake = scheduleNeedsCaffeinate(schedule) ? " Caffeinate while automations are enabled is now on so the Mac can stay awake until this job is due." : "";
|
|
35560
|
-
const fresh = schedule.threadId ? " This job is removed when that chat is archived." : schedule.archiveChat === false ? " This job leaves the new chat open so you can keep talking." : " A new Global chat is archived when the run finishes (History keeps the last 5 runs). Pass archiveChat=false to leave it open.";
|
|
36338
|
+
const fresh = schedule.threadId ? " This job is removed when that chat is archived." : schedule.archiveChat === false ? " This job leaves the new chat open so you can keep talking." : " A new Global chat is archived when the run finishes (History keeps the last 5 archived chats; the schedule keeps the last 10 runs). Pass archiveChat=false to leave it open.";
|
|
35561
36339
|
return `Fires while Sideboard.app is running.${fresh}${awake}`;
|
|
35562
36340
|
}
|
|
35563
36341
|
function registerScheduleTools(server) {
|
|
35564
36342
|
server.tool(
|
|
35565
36343
|
"list_schedules",
|
|
35566
|
-
"List local Sideboard automations that trigger a chat when due. Jobs fire only while Sideboard.app is running on this Mac (sleep skips until wake). Shown in the sidebar after Board.",
|
|
36344
|
+
"List local Sideboard automations that trigger a chat when due. Each row includes runs, the last 10 fires ({at, threadId, error}), newest first. Jobs fire only while Sideboard.app is running on this Mac (sleep skips until wake; a skip is not a failed run). Shown in the sidebar after Board.",
|
|
35567
36345
|
{},
|
|
35568
36346
|
async () => {
|
|
35569
36347
|
try {
|
|
@@ -35575,7 +36353,7 @@ function registerScheduleTools(server) {
|
|
|
35575
36353
|
);
|
|
35576
36354
|
server.tool(
|
|
35577
36355
|
"create_schedule",
|
|
35578
|
-
"Create a local automation that, when due, sends a prompt to an existing chat (chatId) or starts a new Global orchestration chat (omit chatId). Pass chatId=self to continue this chat. A job bound to a chat is removed when that chat is archived or gone; it does not start a new Global chat. Omit chatId only for a Global automation that should outlive this chat. Exactly one of at (ISO datetime), every (15m/1h/6h/1d), time (HH:mm, with days such as weekdays or mon,wed), or cron (5-field). Recurring jobs without chatId open a new Global chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking, for example a morning start-my-day run). History keeps the last 5 archived
|
|
36356
|
+
"Create a local automation that, when due, sends a prompt to an existing chat (chatId) or starts a new Global orchestration chat (omit chatId). Pass chatId=self to continue this chat. A job bound to a chat is removed when that chat is archived or gone; it does not start a new Global chat. Omit chatId only for a Global automation that should outlive this chat. Exactly one of at (ISO datetime), every (15m/1h/6h/1d), time (HH:mm, with days such as weekdays or mon,wed), or cron (5-field). Recurring jobs without chatId open a new Global chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking, for example a morning start-my-day run). History keeps the last 5 archived chats for that automation, and the schedule keeps the last 10 runs. To schedule a prompt from this chat, call this tool with that prompt (omit chatId for a new Global chat, or chatId=self). Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled so the Mac stays awake until due. Sideboard.app must be running for the job to fire.",
|
|
35579
36357
|
{
|
|
35580
36358
|
prompt: import_zod10.z.string().describe("User message / goal queued when the automation fires"),
|
|
35581
36359
|
name: import_zod10.z.string().optional(),
|
|
@@ -35715,8 +36493,8 @@ var import_zod11 = require("zod");
|
|
|
35715
36493
|
|
|
35716
36494
|
// src/order/order.ts
|
|
35717
36495
|
var import_node_crypto21 = require("crypto");
|
|
35718
|
-
var
|
|
35719
|
-
var
|
|
36496
|
+
var import_node_fs72 = require("fs");
|
|
36497
|
+
var import_node_path70 = require("path");
|
|
35720
36498
|
init_paths();
|
|
35721
36499
|
init_private_file();
|
|
35722
36500
|
init_thread_store();
|
|
@@ -36295,7 +37073,7 @@ function showPlanMessage(docs, worktree) {
|
|
|
36295
37073
|
|
|
36296
37074
|
// src/order/order.ts
|
|
36297
37075
|
function orderPath() {
|
|
36298
|
-
return (0,
|
|
37076
|
+
return (0, import_node_path70.join)(appDataDir(), "order.json");
|
|
36299
37077
|
}
|
|
36300
37078
|
function emptyFile() {
|
|
36301
37079
|
return { plans: [], edges: [], marks: [] };
|
|
@@ -36358,9 +37136,9 @@ function asMark(value) {
|
|
|
36358
37136
|
}
|
|
36359
37137
|
function readFile() {
|
|
36360
37138
|
const path = orderPath();
|
|
36361
|
-
if (!(0,
|
|
37139
|
+
if (!(0, import_node_fs72.existsSync)(path)) return emptyFile();
|
|
36362
37140
|
try {
|
|
36363
|
-
const parsed = JSON.parse((0,
|
|
37141
|
+
const parsed = JSON.parse((0, import_node_fs72.readFileSync)(path, "utf8"));
|
|
36364
37142
|
if (!parsed || typeof parsed !== "object") return emptyFile();
|
|
36365
37143
|
const raw = parsed;
|
|
36366
37144
|
const edges = Array.isArray(raw.edges) ? raw.edges.map(asEdge).filter((row) => Boolean(row)) : [];
|
|
@@ -36857,7 +37635,7 @@ function registerOrderTools(server) {
|
|
|
36857
37635
|
|
|
36858
37636
|
// src/agent-rpc/handlers.ts
|
|
36859
37637
|
var import_node_crypto22 = require("crypto");
|
|
36860
|
-
var
|
|
37638
|
+
var import_node_path71 = require("path");
|
|
36861
37639
|
init_wait_for_job();
|
|
36862
37640
|
init_wait_for_turn();
|
|
36863
37641
|
|
|
@@ -36922,27 +37700,27 @@ init_gh_errors();
|
|
|
36922
37700
|
init_git_auth_mode();
|
|
36923
37701
|
|
|
36924
37702
|
// src/board/load-home-board.ts
|
|
36925
|
-
var
|
|
36926
|
-
var
|
|
37703
|
+
var import_node_fs74 = require("fs");
|
|
37704
|
+
var import_node_path73 = require("path");
|
|
36927
37705
|
init_worktree();
|
|
36928
37706
|
init_paths();
|
|
36929
37707
|
|
|
36930
37708
|
// src/board/board-pins.ts
|
|
36931
37709
|
var import_node_crypto23 = require("crypto");
|
|
36932
|
-
var
|
|
36933
|
-
var
|
|
37710
|
+
var import_node_fs73 = require("fs");
|
|
37711
|
+
var import_node_path72 = require("path");
|
|
36934
37712
|
init_paths();
|
|
36935
37713
|
init_home_board();
|
|
36936
37714
|
var FILE = "home-board-pins.json";
|
|
36937
37715
|
var VERSION = 1;
|
|
36938
37716
|
function pinsFile() {
|
|
36939
|
-
return (0,
|
|
37717
|
+
return (0, import_node_path72.join)(appDataDir(), FILE);
|
|
36940
37718
|
}
|
|
36941
37719
|
function readDisk() {
|
|
36942
37720
|
const path = pinsFile();
|
|
36943
|
-
if (!(0,
|
|
37721
|
+
if (!(0, import_node_fs73.existsSync)(path)) return [];
|
|
36944
37722
|
try {
|
|
36945
|
-
const raw = JSON.parse((0,
|
|
37723
|
+
const raw = JSON.parse((0, import_node_fs73.readFileSync)(path, "utf8"));
|
|
36946
37724
|
if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
|
|
36947
37725
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
36948
37726
|
} catch {
|
|
@@ -36950,8 +37728,8 @@ function readDisk() {
|
|
|
36950
37728
|
}
|
|
36951
37729
|
}
|
|
36952
37730
|
function writeDisk(items) {
|
|
36953
|
-
(0,
|
|
36954
|
-
(0,
|
|
37731
|
+
(0, import_node_fs73.mkdirSync)(appDataDir(), { recursive: true });
|
|
37732
|
+
(0, import_node_fs73.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
|
|
36955
37733
|
}
|
|
36956
37734
|
function listBoardPins() {
|
|
36957
37735
|
return readDisk();
|
|
@@ -36972,7 +37750,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
36972
37750
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
36973
37751
|
}
|
|
36974
37752
|
function cacheFile() {
|
|
36975
|
-
return (0,
|
|
37753
|
+
return (0, import_node_path73.join)(appDataDir(), "home-board-cache.json");
|
|
36976
37754
|
}
|
|
36977
37755
|
function emptyInputs() {
|
|
36978
37756
|
return {
|
|
@@ -36998,9 +37776,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
36998
37776
|
}
|
|
36999
37777
|
function readDiskCache() {
|
|
37000
37778
|
const path = cacheFile();
|
|
37001
|
-
if (!(0,
|
|
37779
|
+
if (!(0, import_node_fs74.existsSync)(path)) return null;
|
|
37002
37780
|
try {
|
|
37003
|
-
const raw = JSON.parse((0,
|
|
37781
|
+
const raw = JSON.parse((0, import_node_fs74.readFileSync)(path, "utf8"));
|
|
37004
37782
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
37005
37783
|
return null;
|
|
37006
37784
|
}
|
|
@@ -37014,8 +37792,8 @@ function readDiskCache() {
|
|
|
37014
37792
|
}
|
|
37015
37793
|
function writeDiskCache(entry) {
|
|
37016
37794
|
try {
|
|
37017
|
-
(0,
|
|
37018
|
-
(0,
|
|
37795
|
+
(0, import_node_fs74.mkdirSync)(appDataDir(), { recursive: true });
|
|
37796
|
+
(0, import_node_fs74.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
37019
37797
|
} catch {
|
|
37020
37798
|
}
|
|
37021
37799
|
}
|
|
@@ -37270,7 +38048,7 @@ async function startMcpServer() {
|
|
|
37270
38048
|
async () => {
|
|
37271
38049
|
const threads = orch.getThreads();
|
|
37272
38050
|
const lines = threads.map((t) => {
|
|
37273
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
38051
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path74.basename)(t.repoPath) || t.repoPath;
|
|
37274
38052
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
37275
38053
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
37276
38054
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -37750,6 +38528,36 @@ async function startMcpServer() {
|
|
|
37750
38528
|
}
|
|
37751
38529
|
}
|
|
37752
38530
|
);
|
|
38531
|
+
server.tool(
|
|
38532
|
+
"set_wake_on_github_edges",
|
|
38533
|
+
worktreeProfile ? "Opt this checkout into orchestrator wakes when CI starts failing or GitHub requests a review. Omit ref. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is on. Do not change that Advanced switch." : "Opt a project workspace into CI and review-request wakes. Pass any chat id on that checkout. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is already on. Do not change that Advanced switch. Not for orchestration chats.",
|
|
38534
|
+
{
|
|
38535
|
+
ref: import_zod12.z.string().optional().describe(
|
|
38536
|
+
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
38537
|
+
),
|
|
38538
|
+
enabled: import_zod12.z.boolean().describe("True opts the checkout in. False turns it off.")
|
|
38539
|
+
},
|
|
38540
|
+
async ({ ref, enabled }) => {
|
|
38541
|
+
try {
|
|
38542
|
+
const callerId = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
|
|
38543
|
+
const target = wakeOnGithubEdgesTargetRef({
|
|
38544
|
+
ownWorktreeOnly: worktreeProfile,
|
|
38545
|
+
caller: callerId ? orch.getThread(callerId) : null,
|
|
38546
|
+
requestedRef: ref,
|
|
38547
|
+
find: (id) => orch.getThread(id)
|
|
38548
|
+
});
|
|
38549
|
+
const thread = applyWakeOnGithubEdges(target, enabled);
|
|
38550
|
+
return mcpJson({
|
|
38551
|
+
id: thread.id,
|
|
38552
|
+
worktreePath: thread.worktreePath,
|
|
38553
|
+
wakeOnGithubEdges: thread.wakeOnGithubEdges === true
|
|
38554
|
+
});
|
|
38555
|
+
} catch (err) {
|
|
38556
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
38557
|
+
return mcpJson({ ok: false, message }, true);
|
|
38558
|
+
}
|
|
38559
|
+
}
|
|
38560
|
+
);
|
|
37753
38561
|
if (!worktreeProfile) {
|
|
37754
38562
|
registerConnectedIssueVendorTools(server);
|
|
37755
38563
|
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await Promise.resolve().then(() => (init_caffeinate_hold(), caffeinate_hold_exports));
|
|
@@ -37784,7 +38592,7 @@ async function startMcpServer() {
|
|
|
37784
38592
|
);
|
|
37785
38593
|
server.tool(
|
|
37786
38594
|
"create_workspace",
|
|
37787
|
-
`Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags.`,
|
|
38595
|
+
`Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags. Each orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.`,
|
|
37788
38596
|
{
|
|
37789
38597
|
sourceType: import_zod12.z.enum(["branch", "pr", "ticket"]),
|
|
37790
38598
|
sourceRef: import_zod12.z.string(),
|