@sideboard-ai/core 0.1.340 → 0.1.341
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-TNONAVJG.js → abletime-AYYRRDT2.js} +4 -4
- package/dist/{abletime-OGOHNRVB.js → abletime-MK4T5FZY.js} +4 -4
- package/dist/{abletime-oauth-TYDQ73GK.js → abletime-oauth-7TOEFRWH.js} +3 -3
- package/dist/{abletime-oauth-DAZEUQJI.js → abletime-oauth-NB34M4X4.js} +3 -3
- package/dist/{abletime-rest-3FWZGTX6.js → abletime-rest-7M3QXAXY.js} +3 -3
- package/dist/{abletime-rest-B4VI46MI.js → abletime-rest-IF7IMJGU.js} +3 -3
- package/dist/{agents-QFXIBIKJ.js → agents-4WL4U5WD.js} +8 -8
- package/dist/{agents-6MSZHZOM.js → agents-FH5NVVCJ.js} +8 -8
- package/dist/{app-settings-KOSVLMO5.js → app-settings-377375BJ.js} +3 -1
- package/dist/{app-settings-YS5AUJTF.js → app-settings-YTOPIRDH.js} +3 -1
- package/dist/{chunk-W6J3ZWLJ.js → chunk-2IA556KV.js} +2 -2
- package/dist/{chunk-SYTTUNX6.js → chunk-3HJ2USRA.js} +1 -1
- package/dist/{chunk-5FGQTB2Z.js → chunk-43BOPWFV.js} +2 -2
- package/dist/{chunk-4BRO5LNX.js → chunk-47UDPUVZ.js} +3 -3
- package/dist/{chunk-FCBUDWP6.js → chunk-4BUTF5LN.js} +2 -2
- package/dist/{chunk-NHLTTT5G.js → chunk-4RIKHUKB.js} +7 -6
- package/dist/{chunk-HNW5KMGK.js → chunk-5MHENWO5.js} +2 -2
- package/dist/{chunk-6ABL7HZN.js → chunk-5VXE4ZI4.js} +10 -8
- package/dist/{chunk-DYUAVL5S.js → chunk-BIM24I3O.js} +1 -0
- package/dist/{chunk-VHHEQP5V.js → chunk-CMYGUGGZ.js} +11 -9
- package/dist/{chunk-5TVRPOVS.js → chunk-CN7GSNEL.js} +1 -1
- package/dist/{chunk-EZZY3EAZ.js → chunk-COFHTNQU.js} +666 -62
- package/dist/{chunk-N6TGSJVC.js → chunk-DF34F3QR.js} +10 -0
- package/dist/{chunk-PEJ3N5VE.js → chunk-DF3S5X3H.js} +7 -6
- package/dist/{chunk-LYJ5AVK4.js → chunk-FVX7JWFW.js} +2 -2
- package/dist/{chunk-4SP26Z6H.js → chunk-HNIEEKKR.js} +5 -5
- package/dist/{chunk-4OVQGZEI.js → chunk-HZRYQ27Z.js} +48 -26
- package/dist/{chunk-OMKTX7ZW.js → chunk-I5C42O2M.js} +3 -3
- package/dist/{chunk-Q73I6I2K.js → chunk-IY4YNHYD.js} +1 -1
- package/dist/{chunk-EVYOONTE.js → chunk-K355SYYX.js} +5 -5
- package/dist/{chunk-BD7QARIJ.js → chunk-MGV6JFDY.js} +5 -5
- package/dist/{chunk-KAIOL2M5.js → chunk-NF3KRZXV.js} +1 -1
- package/dist/{chunk-AFSLMWQK.js → chunk-O6UAW76V.js} +42 -3
- package/dist/{chunk-5KH3EQ2C.js → chunk-ORO4ENZR.js} +1 -0
- package/dist/{chunk-ELDHERAD.js → chunk-PHLFFV2M.js} +661 -56
- package/dist/{chunk-ERCYQTJU.js → chunk-QBUX2EDG.js} +48 -26
- package/dist/{chunk-FEGRY7NL.js → chunk-QULOUTDQ.js} +3 -3
- package/dist/{chunk-23KYDM2U.js → chunk-RZUZU5KD.js} +10 -0
- package/dist/{chunk-BDQFZAE6.js → chunk-SLTWZRBN.js} +43 -3
- package/dist/{chunk-QWFNKOGA.js → chunk-TZFYBQAD.js} +2 -2
- package/dist/{chunk-I2C5ZRVO.js → chunk-WSW27W5R.js} +1 -1
- package/dist/{chunk-WSZIJNAR.js → chunk-ZS7AY6DS.js} +5 -5
- package/dist/{conductor-AUUXCJZT.js → conductor-QZKG7YPO.js} +6 -6
- package/dist/{conductor-LEPTWN2U.js → conductor-RGVRIOTZ.js} +6 -6
- package/dist/{coordinator-prompt-CIWWP2P6.js → coordinator-prompt-66UHVADL.js} +4 -4
- package/dist/{coordinator-prompt-VO42IZWS.js → coordinator-prompt-CDVIFBYS.js} +4 -4
- package/dist/{global-workspace-MCAREQI7.js → global-workspace-FNDRAJLF.js} +4 -4
- package/dist/{global-workspace-FKXLFKYX.js → global-workspace-KMQSUF2G.js} +4 -4
- package/dist/index.cjs +965 -182
- package/dist/index.d.cts +45 -7
- package/dist/index.d.ts +45 -7
- package/dist/index.js +107 -25
- package/dist/{linear-5E2WI4QQ.js → linear-6DM4FJWT.js} +2 -2
- package/dist/{linear-P3LP455O.js → linear-ZJQM5IGJ.js} +2 -2
- package/dist/{linear-list-AXK62DPW.js → linear-list-4EPKZTYE.js} +1 -1
- package/dist/{linear-list-Y3INIBYH.js → linear-list-POPBU2VC.js} +1 -1
- package/dist/mcp/run-stdio.cjs +877 -108
- package/dist/mcp/run-stdio.js +97 -22
- package/dist/{optional-cli-6J6C4I3X.js → optional-cli-3G2274LT.js} +3 -3
- package/dist/{optional-cli-X6I35UNI.js → optional-cli-CZF2ZFU5.js} +4 -4
- package/dist/{orchestrator-JTFCNXVR.js → orchestrator-BKCQUMLB.js} +11 -11
- package/dist/{orchestrator-NOQDMYLB.js → orchestrator-SCFWTIE7.js} +11 -11
- package/dist/{thread-store-DCO5MZWJ.js → thread-store-OARQT6DL.js} +2 -2
- package/dist/{thread-store-QGBPSZU2.js → thread-store-W2SSO6IQ.js} +2 -2
- package/dist/{workspaces-D6FQCZRK.js → workspaces-6GB56LMJ.js} +4 -4
- package/dist/{workspaces-Y25L2EPV.js → workspaces-EWWLVSZ5.js} +4 -4
- package/dist/{worktree-S4YOAYRA.js → worktree-BRKMPZMJ.js} +5 -3
- package/dist/{worktree-GWS77LWX.js → worktree-OB5ABI22.js} +5 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2366,6 +2366,7 @@ __export(app_settings_exports, {
|
|
|
2366
2366
|
updateOpencodeSettings: () => updateOpencodeSettings,
|
|
2367
2367
|
updateProjectProfileSettings: () => updateProjectProfileSettings,
|
|
2368
2368
|
usageOnLimit: () => usageOnLimit,
|
|
2369
|
+
wakeOrchestratorOnGithubEdgesEnabled: () => wakeOrchestratorOnGithubEdgesEnabled,
|
|
2369
2370
|
writeViewerContext: () => writeViewerContext
|
|
2370
2371
|
});
|
|
2371
2372
|
function isAgentDoneSound(value) {
|
|
@@ -2768,6 +2769,9 @@ function normalizeAdvanced(raw) {
|
|
|
2768
2769
|
if (typeof source.cowboyMode === "boolean") {
|
|
2769
2770
|
out.cowboyMode = source.cowboyMode;
|
|
2770
2771
|
}
|
|
2772
|
+
if (typeof source.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
2773
|
+
out.wakeOrchestratorOnGithubEdges = source.wakeOrchestratorOnGithubEdges;
|
|
2774
|
+
}
|
|
2771
2775
|
if (typeof source.showCost === "boolean") {
|
|
2772
2776
|
out.showCost = source.showCost;
|
|
2773
2777
|
}
|
|
@@ -3656,6 +3660,9 @@ function updateAdvancedSettings(patch) {
|
|
|
3656
3660
|
if (typeof patch.cowboyMode === "boolean") {
|
|
3657
3661
|
advanced.cowboyMode = patch.cowboyMode;
|
|
3658
3662
|
}
|
|
3663
|
+
if (typeof patch.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
3664
|
+
advanced.wakeOrchestratorOnGithubEdges = patch.wakeOrchestratorOnGithubEdges;
|
|
3665
|
+
}
|
|
3659
3666
|
if (typeof patch.showCost === "boolean") {
|
|
3660
3667
|
advanced.showCost = patch.showCost;
|
|
3661
3668
|
}
|
|
@@ -3761,6 +3768,9 @@ function deleteBranchOnPurgeEnabled(settings = loadAppSettings()) {
|
|
|
3761
3768
|
function cowboyModeEnabled(settings = loadAppSettings()) {
|
|
3762
3769
|
return Boolean(settings.advanced.cowboyMode);
|
|
3763
3770
|
}
|
|
3771
|
+
function wakeOrchestratorOnGithubEdgesEnabled(settings = loadAppSettings()) {
|
|
3772
|
+
return Boolean(settings.advanced.wakeOrchestratorOnGithubEdges);
|
|
3773
|
+
}
|
|
3764
3774
|
function showCostEnabled(settings = loadAppSettings()) {
|
|
3765
3775
|
return Boolean(settings.advanced.showCost);
|
|
3766
3776
|
}
|
|
@@ -5454,6 +5464,35 @@ function normalizeAttachments(raw) {
|
|
|
5454
5464
|
}
|
|
5455
5465
|
return out;
|
|
5456
5466
|
}
|
|
5467
|
+
function normalizeRunList(raw) {
|
|
5468
|
+
if (!Array.isArray(raw)) return [];
|
|
5469
|
+
const out = [];
|
|
5470
|
+
for (const item of raw) {
|
|
5471
|
+
if (!item || typeof item !== "object") continue;
|
|
5472
|
+
const row2 = item;
|
|
5473
|
+
if (typeof row2.at !== "string" || !row2.at.trim()) continue;
|
|
5474
|
+
const next = {
|
|
5475
|
+
at: row2.at,
|
|
5476
|
+
threadId: typeof row2.threadId === "string" && row2.threadId.trim() ? row2.threadId.trim() : null
|
|
5477
|
+
};
|
|
5478
|
+
if (typeof row2.error === "string" && row2.error.trim()) next.error = row2.error;
|
|
5479
|
+
out.push(next);
|
|
5480
|
+
if (out.length >= SCHEDULE_RUN_HISTORY_LIMIT) break;
|
|
5481
|
+
}
|
|
5482
|
+
return out;
|
|
5483
|
+
}
|
|
5484
|
+
function runsFromStored(raw) {
|
|
5485
|
+
if (Array.isArray(raw.runs)) return normalizeRunList(raw.runs);
|
|
5486
|
+
if (typeof raw.lastRunAt === "string" && raw.lastRunAt.trim()) {
|
|
5487
|
+
const one = {
|
|
5488
|
+
at: raw.lastRunAt,
|
|
5489
|
+
threadId: raw.lastThreadId?.trim() || null
|
|
5490
|
+
};
|
|
5491
|
+
if (typeof raw.lastError === "string" && raw.lastError.trim()) one.error = raw.lastError;
|
|
5492
|
+
return [one];
|
|
5493
|
+
}
|
|
5494
|
+
return [];
|
|
5495
|
+
}
|
|
5457
5496
|
function normalizeTask(raw) {
|
|
5458
5497
|
const when = normalizeWhen(raw.when);
|
|
5459
5498
|
const agent = raw.agent && isOrchestratorCapableAgent(raw.agent) ? raw.agent : null;
|
|
@@ -5476,6 +5515,7 @@ function normalizeTask(raw) {
|
|
|
5476
5515
|
lastRunAt: raw.lastRunAt ?? null,
|
|
5477
5516
|
lastThreadId: raw.lastThreadId ?? null,
|
|
5478
5517
|
lastError: raw.lastError ?? null,
|
|
5518
|
+
runs: runsFromStored(raw),
|
|
5479
5519
|
createdBy: raw.createdBy === "mcp" || raw.createdBy === "cli" || raw.createdBy === "ui" ? raw.createdBy : "ui",
|
|
5480
5520
|
createdAt: raw.createdAt,
|
|
5481
5521
|
updatedAt: raw.updatedAt
|
|
@@ -5528,6 +5568,7 @@ function buildTask(input, now) {
|
|
|
5528
5568
|
lastRunAt: null,
|
|
5529
5569
|
lastThreadId: null,
|
|
5530
5570
|
lastError: null,
|
|
5571
|
+
runs: [],
|
|
5531
5572
|
createdBy: input.createdBy,
|
|
5532
5573
|
createdAt: ts,
|
|
5533
5574
|
updatedAt: ts
|
|
@@ -5620,20 +5661,25 @@ function recordScheduleRun(id, result) {
|
|
|
5620
5661
|
if (idx < 0) throw new Error(`Automation not found: ${id}`);
|
|
5621
5662
|
const prev = rows[idx];
|
|
5622
5663
|
const firedAt = result.firedAt ?? /* @__PURE__ */ new Date();
|
|
5664
|
+
const at = nowIso(firedAt);
|
|
5665
|
+
const threadId = result.lastThreadId !== void 0 ? result.lastThreadId?.trim() || null : null;
|
|
5666
|
+
const entry = { at, threadId };
|
|
5667
|
+
if (result.lastError?.trim()) entry.error = result.lastError;
|
|
5623
5668
|
const next = {
|
|
5624
5669
|
...prev,
|
|
5625
5670
|
enabled: prev.when.kind === "once" ? false : prev.enabled,
|
|
5626
5671
|
nextRunAt: prev.when.kind === "once" ? prev.nextRunAt : computeNextRunAt(prev.when, firedAt).toISOString(),
|
|
5627
|
-
lastRunAt:
|
|
5672
|
+
lastRunAt: at,
|
|
5628
5673
|
lastThreadId: result.lastThreadId !== void 0 ? result.lastThreadId : prev.lastThreadId,
|
|
5629
5674
|
lastError: result.lastError ?? null,
|
|
5630
|
-
|
|
5675
|
+
runs: [entry, ...prev.runs].slice(0, SCHEDULE_RUN_HISTORY_LIMIT),
|
|
5676
|
+
updatedAt: at
|
|
5631
5677
|
};
|
|
5632
5678
|
rows[idx] = next;
|
|
5633
5679
|
writeAll(rows);
|
|
5634
5680
|
return next;
|
|
5635
5681
|
}
|
|
5636
|
-
var import_node_crypto5, import_node_fs12, import_node_path15, ATTACHMENT_KINDS;
|
|
5682
|
+
var import_node_crypto5, import_node_fs12, import_node_path15, SCHEDULE_RUN_HISTORY_LIMIT, ATTACHMENT_KINDS;
|
|
5637
5683
|
var init_schedules = __esm({
|
|
5638
5684
|
"src/store/schedules.ts"() {
|
|
5639
5685
|
"use strict";
|
|
@@ -5647,6 +5693,7 @@ var init_schedules = __esm({
|
|
|
5647
5693
|
init_private_file();
|
|
5648
5694
|
init_app_settings();
|
|
5649
5695
|
init_schedule_when();
|
|
5696
|
+
SCHEDULE_RUN_HISTORY_LIMIT = 10;
|
|
5650
5697
|
ATTACHMENT_KINDS = /* @__PURE__ */ new Set([
|
|
5651
5698
|
"transcript",
|
|
5652
5699
|
"file",
|
|
@@ -5750,6 +5797,7 @@ function normalizeThread(raw) {
|
|
|
5750
5797
|
prIsInMergeQueue: Boolean(raw.prIsInMergeQueue),
|
|
5751
5798
|
prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
|
|
5752
5799
|
prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
|
|
5800
|
+
wakeOnGithubEdges: raw.wakeOnGithubEdges === true ? true : void 0,
|
|
5753
5801
|
issueBlockedBy: sanitizeIssueBlockedBy(raw.issueBlockedBy),
|
|
5754
5802
|
skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
|
|
5755
5803
|
cowboy: Boolean(raw.cowboy),
|
|
@@ -5794,6 +5842,7 @@ function createEmptyThread(partial) {
|
|
|
5794
5842
|
prIsInMergeQueue: Boolean(partial.prIsInMergeQueue),
|
|
5795
5843
|
prLabels: partial.prLabels ?? [],
|
|
5796
5844
|
prChecksFailed: partial.prChecksFailed,
|
|
5845
|
+
...partial.wakeOnGithubEdges === true ? { wakeOnGithubEdges: true } : {},
|
|
5797
5846
|
skipAutoArchiveOnMerge: partial.skipAutoArchiveOnMerge ?? false,
|
|
5798
5847
|
cowboy: Boolean(partial.cowboy),
|
|
5799
5848
|
stackId: partial.stackId ?? null,
|
|
@@ -6600,6 +6649,7 @@ function toolDescription(name, input) {
|
|
|
6600
6649
|
if (/get_orchestrator$/i.test(name)) return "Get orchestrator";
|
|
6601
6650
|
else if (/notify_orchestrator$/i.test(name)) return "Notify orchestrator";
|
|
6602
6651
|
else if (/set_workspace_tags$/i.test(name)) return "Set workspace tags";
|
|
6652
|
+
else if (/set_wake_on_github_edges$/i.test(name)) return "Wake on CI / review";
|
|
6603
6653
|
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";
|
|
6604
6654
|
if (/list_schedules$/i.test(name)) return "List automations";
|
|
6605
6655
|
if (/create_schedule$/i.test(name)) {
|
|
@@ -8538,9 +8588,9 @@ function mergeSetupOutput(prev, incoming) {
|
|
|
8538
8588
|
return incoming.length >= prev.length ? incoming : prev;
|
|
8539
8589
|
}
|
|
8540
8590
|
function persistNow(threadId) {
|
|
8541
|
-
const
|
|
8542
|
-
if (
|
|
8543
|
-
clearTimeout(
|
|
8591
|
+
const timer2 = persistTimers.get(threadId);
|
|
8592
|
+
if (timer2) {
|
|
8593
|
+
clearTimeout(timer2);
|
|
8544
8594
|
persistTimers.delete(threadId);
|
|
8545
8595
|
}
|
|
8546
8596
|
const mem = memory.get(threadId);
|
|
@@ -8696,9 +8746,9 @@ function sliceRunLogOutput(output, tailChars = DEFAULT_RUN_LOG_TAIL_CHARS) {
|
|
|
8696
8746
|
return { output: text7, truncated: true, outputChars };
|
|
8697
8747
|
}
|
|
8698
8748
|
function persistNow2(key) {
|
|
8699
|
-
const
|
|
8700
|
-
if (
|
|
8701
|
-
clearTimeout(
|
|
8749
|
+
const timer2 = persistTimers2.get(key);
|
|
8750
|
+
if (timer2) {
|
|
8751
|
+
clearTimeout(timer2);
|
|
8702
8752
|
persistTimers2.delete(key);
|
|
8703
8753
|
}
|
|
8704
8754
|
const mem = memory2.get(key);
|
|
@@ -10677,11 +10727,16 @@ async function listCursorPrs(repoPath, slug, opts, head) {
|
|
|
10677
10727
|
}
|
|
10678
10728
|
}
|
|
10679
10729
|
const { stdout, exitCode } = await originCli(args, repoPath, { reject: false, timeoutMs: 2e4 });
|
|
10680
|
-
if (exitCode !== 0
|
|
10730
|
+
if (exitCode !== 0) {
|
|
10731
|
+
if (opts?.strict) throw new Error(`origin pr list failed (${exitCode})`);
|
|
10732
|
+
return [];
|
|
10733
|
+
}
|
|
10734
|
+
if (!stdout.trim()) return [];
|
|
10681
10735
|
let parsed;
|
|
10682
10736
|
try {
|
|
10683
10737
|
parsed = JSON.parse(stdout);
|
|
10684
10738
|
} catch {
|
|
10739
|
+
if (opts?.strict) throw new Error("origin pr list returned invalid JSON");
|
|
10685
10740
|
return [];
|
|
10686
10741
|
}
|
|
10687
10742
|
if (!Array.isArray(parsed)) return [];
|
|
@@ -10783,21 +10838,23 @@ async function fetchCursorPrHead(repoPath, slug, number, localBranch) {
|
|
|
10783
10838
|
throw new Error((result.stderr || result.stdout).trim() || `git fetch origin ${head} failed`);
|
|
10784
10839
|
}
|
|
10785
10840
|
}
|
|
10786
|
-
async function
|
|
10841
|
+
async function cursorPrCiChecks(repoPath, slug, selector) {
|
|
10787
10842
|
const { stdout, exitCode, stderr } = await originCli(
|
|
10788
10843
|
["pr", "checks", selector, ...repoArgs(slug), "--json", "name,status,conclusion,detailsUrl,startedAt,completedAt,summary,group,link"],
|
|
10789
10844
|
repoPath,
|
|
10790
10845
|
{ reject: false, timeoutMs: 2e4 }
|
|
10791
10846
|
);
|
|
10792
10847
|
const err = stderr.trim();
|
|
10793
|
-
let ci;
|
|
10794
10848
|
if (!stdout.trim()) {
|
|
10795
10849
|
if (/no pull request|not found|no change/i.test(err)) return null;
|
|
10796
10850
|
if (exitCode !== 0 && err) throw new Error(err);
|
|
10797
|
-
|
|
10798
|
-
} else {
|
|
10799
|
-
ci = originChecksToRuns(stdout);
|
|
10851
|
+
return [];
|
|
10800
10852
|
}
|
|
10853
|
+
return originChecksToRuns(stdout);
|
|
10854
|
+
}
|
|
10855
|
+
async function cursorPrChecks(repoPath, slug, selector) {
|
|
10856
|
+
const ci = await cursorPrCiChecks(repoPath, slug, selector);
|
|
10857
|
+
if (!ci) return null;
|
|
10801
10858
|
const view = await viewCursorPr(
|
|
10802
10859
|
repoPath,
|
|
10803
10860
|
slug,
|
|
@@ -11179,6 +11236,7 @@ __export(worktree_exports, {
|
|
|
11179
11236
|
fetchPrHead: () => fetchPrHead,
|
|
11180
11237
|
getPr: () => getPr,
|
|
11181
11238
|
getPrChecks: () => getPrChecks,
|
|
11239
|
+
getPrCiChecks: () => getPrCiChecks,
|
|
11182
11240
|
getPrDetails: () => getPrDetails,
|
|
11183
11241
|
getPrForHeadBranch: () => getPrForHeadBranch,
|
|
11184
11242
|
getPrMeta: () => getPrMeta,
|
|
@@ -11466,7 +11524,11 @@ async function listPrs(repoPath, opts) {
|
|
|
11466
11524
|
limit: fetchLimit
|
|
11467
11525
|
});
|
|
11468
11526
|
const { stdout, exitCode } = await gh(args, repoPath, { reject: false });
|
|
11469
|
-
if (exitCode !== 0
|
|
11527
|
+
if (exitCode !== 0) {
|
|
11528
|
+
if (opts?.strict) throw new Error(`gh pr list failed (${exitCode})`);
|
|
11529
|
+
return [];
|
|
11530
|
+
}
|
|
11531
|
+
if (!stdout.trim()) return [];
|
|
11470
11532
|
return applyPrListResponse(stdout, { ...resolved, limit, viewerTeams });
|
|
11471
11533
|
}
|
|
11472
11534
|
function prInfoFromGhView(view) {
|
|
@@ -11728,12 +11790,7 @@ async function probeLocalMergeGate(cwd, gate) {
|
|
|
11728
11790
|
}
|
|
11729
11791
|
return { gate, files: [] };
|
|
11730
11792
|
}
|
|
11731
|
-
async function
|
|
11732
|
-
const origin = await resolveOriginRemote(cwd);
|
|
11733
|
-
if (origin?.forge === "entire") return null;
|
|
11734
|
-
const cursorSlug = origin?.forge === "cursor" ? origin.slug : null;
|
|
11735
|
-
if (cursorSlug) return cursorPrChecks(cwd, cursorSlug, selector);
|
|
11736
|
-
const slug = await resolveGithubRepoSlug(cwd);
|
|
11793
|
+
async function readGhPrChecks(cwd, selector, slug) {
|
|
11737
11794
|
const args = [
|
|
11738
11795
|
"pr",
|
|
11739
11796
|
"checks",
|
|
@@ -11744,7 +11801,6 @@ async function getPrChecks(cwd, selector) {
|
|
|
11744
11801
|
if (slug) args.push("--repo", slug);
|
|
11745
11802
|
const { stdout, exitCode, stderr } = await gh(args, cwd, { reject: false });
|
|
11746
11803
|
const errText2 = stderr.trim();
|
|
11747
|
-
let ciChecks;
|
|
11748
11804
|
if (!stdout.trim()) {
|
|
11749
11805
|
if (/no pull requests found/i.test(errText2)) return null;
|
|
11750
11806
|
if (/auth|login|HTTP\s*401|credentials|token/i.test(errText2)) {
|
|
@@ -11754,18 +11810,34 @@ async function getPrChecks(cwd, selector) {
|
|
|
11754
11810
|
if (exitCode === 1 && errText2 && !/fail|check/i.test(errText2)) {
|
|
11755
11811
|
throw new Error(errText2);
|
|
11756
11812
|
}
|
|
11757
|
-
|
|
11758
|
-
} else {
|
|
11759
|
-
throw new Error(errText2 || `gh pr checks failed (${exitCode})`);
|
|
11760
|
-
}
|
|
11761
|
-
} else {
|
|
11762
|
-
try {
|
|
11763
|
-
const parsed = JSON.parse(stdout);
|
|
11764
|
-
ciChecks = parsed.map(normalizeCheck);
|
|
11765
|
-
} catch {
|
|
11766
|
-
throw new Error(errText2 || "gh pr checks returned invalid JSON");
|
|
11813
|
+
return [];
|
|
11767
11814
|
}
|
|
11815
|
+
throw new Error(errText2 || `gh pr checks failed (${exitCode})`);
|
|
11768
11816
|
}
|
|
11817
|
+
try {
|
|
11818
|
+
const parsed = JSON.parse(stdout);
|
|
11819
|
+
return parsed.map(normalizeCheck);
|
|
11820
|
+
} catch {
|
|
11821
|
+
throw new Error(errText2 || "gh pr checks returned invalid JSON");
|
|
11822
|
+
}
|
|
11823
|
+
}
|
|
11824
|
+
async function getPrCiChecks(cwd, selector) {
|
|
11825
|
+
const origin = await resolveOriginRemote(cwd);
|
|
11826
|
+
if (origin?.forge === "entire") return null;
|
|
11827
|
+
if (origin?.forge === "cursor" && origin.slug) {
|
|
11828
|
+
return cursorPrCiChecks(cwd, origin.slug, selector);
|
|
11829
|
+
}
|
|
11830
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
11831
|
+
return readGhPrChecks(cwd, selector, slug);
|
|
11832
|
+
}
|
|
11833
|
+
async function getPrChecks(cwd, selector) {
|
|
11834
|
+
const origin = await resolveOriginRemote(cwd);
|
|
11835
|
+
if (origin?.forge === "entire") return null;
|
|
11836
|
+
const cursorSlug = origin?.forge === "cursor" ? origin.slug : null;
|
|
11837
|
+
if (cursorSlug) return cursorPrChecks(cwd, cursorSlug, selector);
|
|
11838
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
11839
|
+
const ciChecks = await readGhPrChecks(cwd, selector, slug);
|
|
11840
|
+
if (!ciChecks) return null;
|
|
11769
11841
|
let gate = await fetchPrMergeGate(cwd, selector, slug);
|
|
11770
11842
|
const probed = await probeLocalMergeGate(cwd, gate);
|
|
11771
11843
|
gate = probed.gate;
|
|
@@ -13230,12 +13302,12 @@ var init_coordinator_prompt = __esm({
|
|
|
13230
13302
|
"- 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.",
|
|
13231
13303
|
"- 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.",
|
|
13232
13304
|
"- 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.",
|
|
13233
|
-
"- 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
|
|
13305
|
+
"- 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.",
|
|
13234
13306
|
"Projects:",
|
|
13235
13307
|
"- add_project / remove_project \u2014 register or unregister a git repo",
|
|
13236
13308
|
"Workspaces and chats:",
|
|
13237
13309
|
'- 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',
|
|
13238
|
-
"- 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).",
|
|
13310
|
+
"- 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.",
|
|
13239
13311
|
"- 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.",
|
|
13240
13312
|
"- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
|
|
13241
13313
|
"- 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.",
|
|
@@ -13610,19 +13682,19 @@ function traceTurn(phase, extra) {
|
|
|
13610
13682
|
}
|
|
13611
13683
|
}
|
|
13612
13684
|
async function withTimeout(promise, ms, label) {
|
|
13613
|
-
let
|
|
13685
|
+
let timer2;
|
|
13614
13686
|
try {
|
|
13615
13687
|
return await Promise.race([
|
|
13616
13688
|
promise,
|
|
13617
13689
|
new Promise((_, reject) => {
|
|
13618
|
-
|
|
13690
|
+
timer2 = setTimeout(
|
|
13619
13691
|
() => reject(new Error(`${label} timed out after ${ms}ms`)),
|
|
13620
13692
|
ms
|
|
13621
13693
|
);
|
|
13622
13694
|
})
|
|
13623
13695
|
]);
|
|
13624
13696
|
} finally {
|
|
13625
|
-
if (
|
|
13697
|
+
if (timer2) clearTimeout(timer2);
|
|
13626
13698
|
}
|
|
13627
13699
|
}
|
|
13628
13700
|
var import_node_fs27, import_node_path31;
|
|
@@ -15297,6 +15369,7 @@ var init_profile = __esm({
|
|
|
15297
15369
|
"get_orchestrator",
|
|
15298
15370
|
"notify_orchestrator",
|
|
15299
15371
|
"set_workspace_tags",
|
|
15372
|
+
"set_wake_on_github_edges",
|
|
15300
15373
|
"get_viewer_context",
|
|
15301
15374
|
"update_viewer_context",
|
|
15302
15375
|
"list_env",
|
|
@@ -16145,6 +16218,7 @@ var init_injected_mcp = __esm({
|
|
|
16145
16218
|
"mcp__sideboard__get_orchestrator",
|
|
16146
16219
|
"mcp__sideboard__notify_orchestrator",
|
|
16147
16220
|
"mcp__sideboard__set_workspace_tags",
|
|
16221
|
+
"mcp__sideboard__set_wake_on_github_edges",
|
|
16148
16222
|
"mcp__sideboard__get_viewer_context",
|
|
16149
16223
|
"mcp__sideboard__update_viewer_context",
|
|
16150
16224
|
"mcp__sideboard__list_env",
|
|
@@ -17642,12 +17716,12 @@ async function startLinearOAuth(opts) {
|
|
|
17642
17716
|
finish2(e instanceof Error ? e : new Error(String(e)));
|
|
17643
17717
|
}
|
|
17644
17718
|
});
|
|
17645
|
-
const
|
|
17719
|
+
const timer2 = setTimeout(() => {
|
|
17646
17720
|
finish2(new Error("Linear sign-in timed out \u2014 try again"));
|
|
17647
17721
|
}, timeoutMs);
|
|
17648
17722
|
const onAbort = () => finish2(new LinearOAuthCancelledError());
|
|
17649
17723
|
const cleanup = () => {
|
|
17650
|
-
clearTimeout(
|
|
17724
|
+
clearTimeout(timer2);
|
|
17651
17725
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
17652
17726
|
server.close();
|
|
17653
17727
|
};
|
|
@@ -18899,16 +18973,16 @@ async function listAssignedLinearIssues(opts) {
|
|
|
18899
18973
|
try {
|
|
18900
18974
|
const { listLinearIssuesDirect: listLinearIssuesDirect2 } = await Promise.resolve().then(() => (init_linear(), linear_exports));
|
|
18901
18975
|
const listed = listLinearIssuesDirect2({ limit: 50 }).catch(() => []);
|
|
18902
|
-
let
|
|
18976
|
+
let timer2;
|
|
18903
18977
|
try {
|
|
18904
18978
|
return await Promise.race([
|
|
18905
18979
|
listed,
|
|
18906
18980
|
new Promise((resolve3) => {
|
|
18907
|
-
|
|
18981
|
+
timer2 = setTimeout(() => resolve3([]), opts?.timeoutMs ?? LIST_TIMEOUT_MS);
|
|
18908
18982
|
})
|
|
18909
18983
|
]);
|
|
18910
18984
|
} finally {
|
|
18911
|
-
if (
|
|
18985
|
+
if (timer2) clearTimeout(timer2);
|
|
18912
18986
|
}
|
|
18913
18987
|
} catch {
|
|
18914
18988
|
return [];
|
|
@@ -21642,7 +21716,7 @@ async function getClaudePlanUsage(opts = {}) {
|
|
|
21642
21716
|
const fetchFn = opts.fetch ?? httpFetch;
|
|
21643
21717
|
const userAgent = opts.userAgent ?? await resolveClaudeUserAgent();
|
|
21644
21718
|
const ac = new AbortController();
|
|
21645
|
-
const
|
|
21719
|
+
const timer2 = setTimeout(() => ac.abort(), 8e3);
|
|
21646
21720
|
let res;
|
|
21647
21721
|
try {
|
|
21648
21722
|
res = await fetchFn(CLAUDE_OAUTH_USAGE_URL, {
|
|
@@ -21654,7 +21728,7 @@ async function getClaudePlanUsage(opts = {}) {
|
|
|
21654
21728
|
signal: ac.signal
|
|
21655
21729
|
});
|
|
21656
21730
|
} finally {
|
|
21657
|
-
clearTimeout(
|
|
21731
|
+
clearTimeout(timer2);
|
|
21658
21732
|
}
|
|
21659
21733
|
if (res.status === 401 || res.status === 403) {
|
|
21660
21734
|
cache = { at: now, dir: cacheDirKey, value: null };
|
|
@@ -22392,11 +22466,11 @@ function parentKey(event) {
|
|
|
22392
22466
|
function createAgentStreamCoalescer(emit, opts) {
|
|
22393
22467
|
const intervalMs = opts?.intervalMs ?? 32;
|
|
22394
22468
|
let pending = null;
|
|
22395
|
-
let
|
|
22469
|
+
let timer2 = null;
|
|
22396
22470
|
const flush2 = () => {
|
|
22397
|
-
if (
|
|
22398
|
-
clearTimeout(
|
|
22399
|
-
|
|
22471
|
+
if (timer2) {
|
|
22472
|
+
clearTimeout(timer2);
|
|
22473
|
+
timer2 = null;
|
|
22400
22474
|
}
|
|
22401
22475
|
if (!pending) return;
|
|
22402
22476
|
const event = pending;
|
|
@@ -22408,9 +22482,9 @@ function createAgentStreamCoalescer(emit, opts) {
|
|
|
22408
22482
|
});
|
|
22409
22483
|
};
|
|
22410
22484
|
const schedule = () => {
|
|
22411
|
-
if (
|
|
22412
|
-
|
|
22413
|
-
|
|
22485
|
+
if (timer2) return;
|
|
22486
|
+
timer2 = setTimeout(flush2, intervalMs);
|
|
22487
|
+
timer2.unref?.();
|
|
22414
22488
|
};
|
|
22415
22489
|
return {
|
|
22416
22490
|
push(event) {
|
|
@@ -22664,9 +22738,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
22664
22738
|
}
|
|
22665
22739
|
};
|
|
22666
22740
|
signal("SIGTERM");
|
|
22667
|
-
const
|
|
22668
|
-
|
|
22669
|
-
child.once("exit", () => clearTimeout(
|
|
22741
|
+
const timer2 = setTimeout(() => signal("SIGKILL"), 5e3);
|
|
22742
|
+
timer2.unref?.();
|
|
22743
|
+
child.once("exit", () => clearTimeout(timer2));
|
|
22670
22744
|
},
|
|
22671
22745
|
done
|
|
22672
22746
|
};
|
|
@@ -23589,6 +23663,7 @@ function worktreeBindingFrom(from) {
|
|
|
23589
23663
|
prIsInMergeQueue: from.prIsInMergeQueue,
|
|
23590
23664
|
prLabels: from.prLabels,
|
|
23591
23665
|
prChecksFailed: from.prChecksFailed,
|
|
23666
|
+
wakeOnGithubEdges: from.wakeOnGithubEdges,
|
|
23592
23667
|
issueBlockedBy: from.issueBlockedBy,
|
|
23593
23668
|
skipAutoArchiveOnMerge: from.skipAutoArchiveOnMerge,
|
|
23594
23669
|
stackId: from.stackId,
|
|
@@ -26726,12 +26801,12 @@ async function startAbleTimeOAuth(opts) {
|
|
|
26726
26801
|
finish2(e instanceof Error ? e : new Error(String(e)));
|
|
26727
26802
|
}
|
|
26728
26803
|
});
|
|
26729
|
-
const
|
|
26804
|
+
const timer2 = setTimeout(() => {
|
|
26730
26805
|
finish2(new Error("AbleTime sign-in timed out \u2014 try again"));
|
|
26731
26806
|
}, timeoutMs);
|
|
26732
26807
|
const onAbort = () => finish2(new AbleTimeOAuthCancelledError());
|
|
26733
26808
|
const cleanup = () => {
|
|
26734
|
-
clearTimeout(
|
|
26809
|
+
clearTimeout(timer2);
|
|
26735
26810
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
26736
26811
|
server.close();
|
|
26737
26812
|
};
|
|
@@ -28719,11 +28794,11 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
28719
28794
|
const delayMs = opts?.delayMs ?? 50;
|
|
28720
28795
|
const maxLines = opts?.maxLines ?? 200;
|
|
28721
28796
|
let buffer = [];
|
|
28722
|
-
let
|
|
28797
|
+
let timer2 = null;
|
|
28723
28798
|
const flush2 = () => {
|
|
28724
|
-
if (
|
|
28725
|
-
clearTimeout(
|
|
28726
|
-
|
|
28799
|
+
if (timer2) {
|
|
28800
|
+
clearTimeout(timer2);
|
|
28801
|
+
timer2 = null;
|
|
28727
28802
|
}
|
|
28728
28803
|
if (buffer.length === 0) return;
|
|
28729
28804
|
const chunk = buffer.join("\n");
|
|
@@ -28736,7 +28811,7 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
28736
28811
|
flush2();
|
|
28737
28812
|
return;
|
|
28738
28813
|
}
|
|
28739
|
-
if (!
|
|
28814
|
+
if (!timer2) timer2 = setTimeout(flush2, delayMs);
|
|
28740
28815
|
};
|
|
28741
28816
|
return { push: push2, flush: flush2 };
|
|
28742
28817
|
}
|
|
@@ -31758,7 +31833,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
31758
31833
|
);
|
|
31759
31834
|
}
|
|
31760
31835
|
lines.push(
|
|
31761
|
-
'- 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
|
|
31836
|
+
'- 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.'
|
|
31762
31837
|
);
|
|
31763
31838
|
lines.push("");
|
|
31764
31839
|
lines.push(formatDevAccessHint(opts?.activeRuns));
|
|
@@ -31767,7 +31842,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
31767
31842
|
"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."
|
|
31768
31843
|
);
|
|
31769
31844
|
lines.push(
|
|
31770
|
-
"`set_workspace_tags` labels this checkout (omit ref
|
|
31845
|
+
"`set_workspace_tags` labels this checkout (omit ref). `set_wake_on_github_edges` opts this checkout in when Advanced is already on (omit ref)."
|
|
31771
31846
|
);
|
|
31772
31847
|
lines.push(
|
|
31773
31848
|
"Orchestration: `show_plan` opens the diagram and plan.md. `list_order` / `set_dependency`"
|
|
@@ -32817,6 +32892,622 @@ var init_sync_branch = __esm({
|
|
|
32817
32892
|
}
|
|
32818
32893
|
});
|
|
32819
32894
|
|
|
32895
|
+
// src/orchestrator/github-edge.ts
|
|
32896
|
+
function emptyGithubEdgeSnapshot() {
|
|
32897
|
+
return { primed: false, ciFailed: [], reviewRequested: [], lastFiredAt: {} };
|
|
32898
|
+
}
|
|
32899
|
+
function normalizePrUrl(raw) {
|
|
32900
|
+
const trimmed = (raw ?? "").trim();
|
|
32901
|
+
if (!trimmed) return "";
|
|
32902
|
+
try {
|
|
32903
|
+
const url = new URL(trimmed);
|
|
32904
|
+
url.hash = "";
|
|
32905
|
+
url.search = "";
|
|
32906
|
+
const path2 = url.pathname.replace(/\/+$/, "");
|
|
32907
|
+
return `${url.protocol}//${url.host.toLowerCase()}${path2}`;
|
|
32908
|
+
} catch {
|
|
32909
|
+
return trimmed.replace(/\/+$/, "");
|
|
32910
|
+
}
|
|
32911
|
+
}
|
|
32912
|
+
function githubEdgeKey(kind, prUrl) {
|
|
32913
|
+
return `${kind}:${normalizePrUrl(prUrl)}`;
|
|
32914
|
+
}
|
|
32915
|
+
function acceptOpenReadyPr(row2) {
|
|
32916
|
+
if (!normalizePrUrl(row2.prUrl)) return false;
|
|
32917
|
+
if (row2.draft === true) return false;
|
|
32918
|
+
const state = (row2.state ?? "").trim().toUpperCase();
|
|
32919
|
+
return state !== "MERGED" && state !== "CLOSED";
|
|
32920
|
+
}
|
|
32921
|
+
function mergeCiLatch(prev, failing, unknown) {
|
|
32922
|
+
const out = /* @__PURE__ */ new Set();
|
|
32923
|
+
for (const url of failing) {
|
|
32924
|
+
const normalized = normalizePrUrl(url);
|
|
32925
|
+
if (normalized) out.add(normalized);
|
|
32926
|
+
}
|
|
32927
|
+
const unknownSet = new Set(unknown.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
32928
|
+
for (const url of prev) {
|
|
32929
|
+
const normalized = normalizePrUrl(url);
|
|
32930
|
+
if (normalized && unknownSet.has(normalized)) out.add(normalized);
|
|
32931
|
+
}
|
|
32932
|
+
return [...out];
|
|
32933
|
+
}
|
|
32934
|
+
function mergeReviewLatch(prev, fetched, successfulRepos) {
|
|
32935
|
+
const ok = new Set(successfulRepos);
|
|
32936
|
+
const map = /* @__PURE__ */ new Map();
|
|
32937
|
+
for (const row2 of prev) {
|
|
32938
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
32939
|
+
if (!prUrl) continue;
|
|
32940
|
+
if (row2.repoPath && ok.has(row2.repoPath)) continue;
|
|
32941
|
+
if (!row2.repoPath) continue;
|
|
32942
|
+
map.set(prUrl, { prUrl, repoPath: row2.repoPath });
|
|
32943
|
+
}
|
|
32944
|
+
for (const row2 of fetched) {
|
|
32945
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
32946
|
+
if (!prUrl) continue;
|
|
32947
|
+
map.set(prUrl, { prUrl, repoPath: row2.repoPath });
|
|
32948
|
+
}
|
|
32949
|
+
return [...map.values()];
|
|
32950
|
+
}
|
|
32951
|
+
function coerceGithubEdgeSnapshot(raw) {
|
|
32952
|
+
if (!raw || typeof raw !== "object") return emptyGithubEdgeSnapshot();
|
|
32953
|
+
const row2 = raw;
|
|
32954
|
+
const ciFailed = [];
|
|
32955
|
+
const seenCi = /* @__PURE__ */ new Set();
|
|
32956
|
+
if (Array.isArray(row2.ciFailed)) {
|
|
32957
|
+
for (const item of row2.ciFailed) {
|
|
32958
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
32959
|
+
if (!prUrl || seenCi.has(prUrl)) continue;
|
|
32960
|
+
seenCi.add(prUrl);
|
|
32961
|
+
ciFailed.push(prUrl);
|
|
32962
|
+
}
|
|
32963
|
+
}
|
|
32964
|
+
const reviewRequested = [];
|
|
32965
|
+
const seenReview = /* @__PURE__ */ new Set();
|
|
32966
|
+
if (Array.isArray(row2.reviewRequested)) {
|
|
32967
|
+
for (const item of row2.reviewRequested) {
|
|
32968
|
+
if (!item || typeof item !== "object") continue;
|
|
32969
|
+
const record = item;
|
|
32970
|
+
const prUrl = normalizePrUrl(typeof record.prUrl === "string" ? record.prUrl : "");
|
|
32971
|
+
const repoPath = typeof record.repoPath === "string" ? record.repoPath.trim() : "";
|
|
32972
|
+
if (!prUrl || !repoPath || seenReview.has(prUrl)) continue;
|
|
32973
|
+
seenReview.add(prUrl);
|
|
32974
|
+
reviewRequested.push({ prUrl, repoPath });
|
|
32975
|
+
}
|
|
32976
|
+
}
|
|
32977
|
+
const ciSeen = [];
|
|
32978
|
+
const seenCiUrls = /* @__PURE__ */ new Set();
|
|
32979
|
+
if (Array.isArray(row2.ciSeen)) {
|
|
32980
|
+
for (const item of row2.ciSeen) {
|
|
32981
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
32982
|
+
if (!prUrl || seenCiUrls.has(prUrl)) continue;
|
|
32983
|
+
seenCiUrls.add(prUrl);
|
|
32984
|
+
ciSeen.push(prUrl);
|
|
32985
|
+
}
|
|
32986
|
+
}
|
|
32987
|
+
const reviewReposSeen = [];
|
|
32988
|
+
const seenRepos = /* @__PURE__ */ new Set();
|
|
32989
|
+
if (Array.isArray(row2.reviewReposSeen)) {
|
|
32990
|
+
for (const item of row2.reviewReposSeen) {
|
|
32991
|
+
const repo = typeof item === "string" ? item.trim() : "";
|
|
32992
|
+
if (!repo || seenRepos.has(repo)) continue;
|
|
32993
|
+
seenRepos.add(repo);
|
|
32994
|
+
reviewReposSeen.push(repo);
|
|
32995
|
+
}
|
|
32996
|
+
}
|
|
32997
|
+
const lastFiredAt = {};
|
|
32998
|
+
if (row2.lastFiredAt && typeof row2.lastFiredAt === "object") {
|
|
32999
|
+
for (const [key, value] of Object.entries(row2.lastFiredAt)) {
|
|
33000
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
33001
|
+
lastFiredAt[key] = value;
|
|
33002
|
+
}
|
|
33003
|
+
}
|
|
33004
|
+
}
|
|
33005
|
+
return {
|
|
33006
|
+
primed: row2.primed === true,
|
|
33007
|
+
ciFailed,
|
|
33008
|
+
reviewRequested,
|
|
33009
|
+
lastFiredAt,
|
|
33010
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
33011
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
33012
|
+
};
|
|
33013
|
+
}
|
|
33014
|
+
function dedupeSubjects(items) {
|
|
33015
|
+
const map = /* @__PURE__ */ new Map();
|
|
33016
|
+
for (const item of items) {
|
|
33017
|
+
if (!acceptOpenReadyPr(item)) continue;
|
|
33018
|
+
const prUrl = normalizePrUrl(item.prUrl);
|
|
33019
|
+
if (!prUrl) continue;
|
|
33020
|
+
const next = { ...item, prUrl };
|
|
33021
|
+
const prev = map.get(prUrl);
|
|
33022
|
+
if (!prev) {
|
|
33023
|
+
map.set(prUrl, next);
|
|
33024
|
+
continue;
|
|
33025
|
+
}
|
|
33026
|
+
if (!prev.threadId && next.threadId) {
|
|
33027
|
+
map.set(prUrl, {
|
|
33028
|
+
...prev,
|
|
33029
|
+
...next,
|
|
33030
|
+
prUrl,
|
|
33031
|
+
title: next.title.trim() || prev.title
|
|
33032
|
+
});
|
|
33033
|
+
}
|
|
33034
|
+
}
|
|
33035
|
+
return [...map.values()];
|
|
33036
|
+
}
|
|
33037
|
+
function diffGithubEdges(input) {
|
|
33038
|
+
if (!input.prev.primed) return [];
|
|
33039
|
+
const cooldown = input.cooldownMs ?? GITHUB_EDGE_COOLDOWN_MS;
|
|
33040
|
+
const edges = [];
|
|
33041
|
+
const consider = (kind, items, latched) => {
|
|
33042
|
+
for (const item of dedupeSubjects(items)) {
|
|
33043
|
+
if (latched.has(item.prUrl)) continue;
|
|
33044
|
+
const firedAt = input.prev.lastFiredAt[githubEdgeKey(kind, item.prUrl)] ?? 0;
|
|
33045
|
+
if (firedAt && input.now - firedAt < cooldown) continue;
|
|
33046
|
+
edges.push({ ...item, kind });
|
|
33047
|
+
}
|
|
33048
|
+
};
|
|
33049
|
+
consider("ci-failed", input.ciFailed, new Set(input.prev.ciFailed.map((url) => normalizePrUrl(url))));
|
|
33050
|
+
consider(
|
|
33051
|
+
"review-requested",
|
|
33052
|
+
input.reviewRequested,
|
|
33053
|
+
new Set(input.prev.reviewRequested.map((row2) => normalizePrUrl(row2.prUrl)))
|
|
33054
|
+
);
|
|
33055
|
+
return edges;
|
|
33056
|
+
}
|
|
33057
|
+
function commitGithubEdgeSnapshot(input) {
|
|
33058
|
+
const deliveredCi = new Set(
|
|
33059
|
+
input.delivered.filter((edge) => edge.kind === "ci-failed").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
33060
|
+
);
|
|
33061
|
+
const deliveredReview = new Set(
|
|
33062
|
+
input.delivered.filter((edge) => edge.kind === "review-requested").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
33063
|
+
);
|
|
33064
|
+
const ciObserved = dedupeSubjects(input.ciFailed).map((item) => item.prUrl);
|
|
33065
|
+
const ciFailed = nextUrls(input.prev.primed, input.prev.ciFailed, ciObserved, deliveredCi);
|
|
33066
|
+
const reviewRequested = nextReviewLatch(
|
|
33067
|
+
input.prev.primed,
|
|
33068
|
+
input.reviewRequested,
|
|
33069
|
+
input.prev.reviewRequested,
|
|
33070
|
+
deliveredReview
|
|
33071
|
+
);
|
|
33072
|
+
const lastFiredAt = {};
|
|
33073
|
+
for (const [key, at] of Object.entries(input.prev.lastFiredAt)) {
|
|
33074
|
+
if (input.now - at <= LAST_FIRED_KEEP_MS) lastFiredAt[key] = at;
|
|
33075
|
+
}
|
|
33076
|
+
for (const edge of input.delivered) {
|
|
33077
|
+
const prUrl = normalizePrUrl(edge.prUrl);
|
|
33078
|
+
if (!prUrl) continue;
|
|
33079
|
+
lastFiredAt[githubEdgeKey(edge.kind, prUrl)] = input.now;
|
|
33080
|
+
}
|
|
33081
|
+
return { primed: true, ciFailed, reviewRequested, lastFiredAt };
|
|
33082
|
+
}
|
|
33083
|
+
function nextUrls(primed, prev, observed, delivered) {
|
|
33084
|
+
const prevSet = new Set(prev.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
33085
|
+
const out = [];
|
|
33086
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33087
|
+
for (const url of observed) {
|
|
33088
|
+
if (!url || seen.has(url)) continue;
|
|
33089
|
+
seen.add(url);
|
|
33090
|
+
if (!primed || prevSet.has(url) || delivered.has(url)) out.push(url);
|
|
33091
|
+
}
|
|
33092
|
+
return out;
|
|
33093
|
+
}
|
|
33094
|
+
function nextReviewLatch(primed, observed, prev, delivered) {
|
|
33095
|
+
const prevSet = new Set(prev.map((row2) => normalizePrUrl(row2.prUrl)).filter(Boolean));
|
|
33096
|
+
const out = [];
|
|
33097
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33098
|
+
for (const row2 of observed) {
|
|
33099
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
33100
|
+
const repoPath = row2.repoPath.trim();
|
|
33101
|
+
if (!prUrl || !repoPath || seen.has(prUrl)) continue;
|
|
33102
|
+
seen.add(prUrl);
|
|
33103
|
+
if (!primed || prevSet.has(prUrl) || delivered.has(prUrl)) {
|
|
33104
|
+
out.push({ prUrl, repoPath });
|
|
33105
|
+
}
|
|
33106
|
+
}
|
|
33107
|
+
return out;
|
|
33108
|
+
}
|
|
33109
|
+
function formatGithubEdgePrompt(edges) {
|
|
33110
|
+
const lines = edges.map((edge) => {
|
|
33111
|
+
const title = edge.title.trim() || "Pull request";
|
|
33112
|
+
const lead = edge.kind === "ci-failed" ? `CI failed on ${title}` : `Review requested: ${title}`;
|
|
33113
|
+
const workspace = edge.threadId && edge.threadTitle?.trim() ? ` ([${edge.threadTitle.trim()}](sideboard://chat/${edge.threadId}))` : edge.threadId ? ` ([workspace](sideboard://chat/${edge.threadId}))` : "";
|
|
33114
|
+
return `${lead} ${edge.prUrl}${workspace}`;
|
|
33115
|
+
});
|
|
33116
|
+
let body = lines.join("\n");
|
|
33117
|
+
if (body.length > 1500) body = `${body.slice(0, 1499)}\u2026`;
|
|
33118
|
+
return [
|
|
33119
|
+
"Sideboard: GitHub update.",
|
|
33120
|
+
body,
|
|
33121
|
+
"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."
|
|
33122
|
+
].join("\n");
|
|
33123
|
+
}
|
|
33124
|
+
function routeGithubEdges(edges, parentIdForThread2, designatedId) {
|
|
33125
|
+
const groups = /* @__PURE__ */ new Map();
|
|
33126
|
+
for (const edge of edges) {
|
|
33127
|
+
const parent = edge.threadId ? parentIdForThread2(edge.threadId)?.trim() || null : null;
|
|
33128
|
+
const targetId = parent || designatedId || null;
|
|
33129
|
+
const key = targetId ?? "";
|
|
33130
|
+
const group = groups.get(key);
|
|
33131
|
+
if (group) group.edges.push(edge);
|
|
33132
|
+
else groups.set(key, { targetId, edges: [edge] });
|
|
33133
|
+
}
|
|
33134
|
+
return [...groups.values()];
|
|
33135
|
+
}
|
|
33136
|
+
function pickDesignatedOrchestratorId(threads) {
|
|
33137
|
+
const live = threads.filter((thread) => thread.status !== "archived" && thread.id.trim());
|
|
33138
|
+
const preferred = live.find((thread) => !thread.cloud);
|
|
33139
|
+
return (preferred ?? live[0])?.id ?? null;
|
|
33140
|
+
}
|
|
33141
|
+
function githubEdgeSnapshotKey(snapshot) {
|
|
33142
|
+
const lastFiredAt = Object.fromEntries(
|
|
33143
|
+
Object.entries(snapshot.lastFiredAt).sort(([a], [b]) => a.localeCompare(b))
|
|
33144
|
+
);
|
|
33145
|
+
return JSON.stringify({
|
|
33146
|
+
primed: snapshot.primed === true,
|
|
33147
|
+
ciFailed: [...snapshot.ciFailed].sort(),
|
|
33148
|
+
reviewRequested: [...snapshot.reviewRequested].map((row2) => ({ prUrl: row2.prUrl, repoPath: row2.repoPath })).sort((a, b) => a.prUrl.localeCompare(b.prUrl) || a.repoPath.localeCompare(b.repoPath)),
|
|
33149
|
+
lastFiredAt,
|
|
33150
|
+
reviewReposSeen: [...snapshot.reviewReposSeen ?? []].sort(),
|
|
33151
|
+
ciSeen: [...snapshot.ciSeen ?? []].sort()
|
|
33152
|
+
});
|
|
33153
|
+
}
|
|
33154
|
+
var GITHUB_EDGE_COOLDOWN_MS, GITHUB_EDGE_POLL_MS, LAST_FIRED_KEEP_MS;
|
|
33155
|
+
var init_github_edge = __esm({
|
|
33156
|
+
"src/orchestrator/github-edge.ts"() {
|
|
33157
|
+
"use strict";
|
|
33158
|
+
GITHUB_EDGE_COOLDOWN_MS = 30 * 6e4;
|
|
33159
|
+
GITHUB_EDGE_POLL_MS = 6e4;
|
|
33160
|
+
LAST_FIRED_KEEP_MS = 7 * 24 * 60 * 6e4;
|
|
33161
|
+
}
|
|
33162
|
+
});
|
|
33163
|
+
|
|
33164
|
+
// src/orchestrator/github-edge-watch.ts
|
|
33165
|
+
function githubEdgeSnapshotPath() {
|
|
33166
|
+
return (0, import_node_path70.join)(appDataDir(), "github-edge-watch.json");
|
|
33167
|
+
}
|
|
33168
|
+
function loadGithubEdgeSnapshot() {
|
|
33169
|
+
try {
|
|
33170
|
+
const path2 = githubEdgeSnapshotPath();
|
|
33171
|
+
if (!(0, import_node_fs70.existsSync)(path2)) return emptyGithubEdgeSnapshot();
|
|
33172
|
+
return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs70.readFileSync)(path2, "utf8")));
|
|
33173
|
+
} catch {
|
|
33174
|
+
return emptyGithubEdgeSnapshot();
|
|
33175
|
+
}
|
|
33176
|
+
}
|
|
33177
|
+
function saveGithubEdgeSnapshot(snapshot) {
|
|
33178
|
+
writePrivateFile(githubEdgeSnapshotPath(), `${JSON.stringify(snapshot, null, 2)}
|
|
33179
|
+
`);
|
|
33180
|
+
}
|
|
33181
|
+
function stopGithubEdgeWatch() {
|
|
33182
|
+
if (timer) clearInterval(timer);
|
|
33183
|
+
timer = null;
|
|
33184
|
+
}
|
|
33185
|
+
function armGithubEdgeWatch() {
|
|
33186
|
+
if (!isThisProcessDesktopHost()) return;
|
|
33187
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
33188
|
+
stopGithubEdgeWatch();
|
|
33189
|
+
needsBaseline = true;
|
|
33190
|
+
return;
|
|
33191
|
+
}
|
|
33192
|
+
if (timer) return;
|
|
33193
|
+
const tick = () => {
|
|
33194
|
+
if (polling) return;
|
|
33195
|
+
polling = true;
|
|
33196
|
+
const baseline = needsBaseline;
|
|
33197
|
+
needsBaseline = false;
|
|
33198
|
+
void pollGithubEdges(realDeps(), { baseline }).catch(() => {
|
|
33199
|
+
if (baseline) needsBaseline = true;
|
|
33200
|
+
}).finally(() => {
|
|
33201
|
+
polling = false;
|
|
33202
|
+
});
|
|
33203
|
+
};
|
|
33204
|
+
timer = setInterval(tick, GITHUB_EDGE_POLL_MS);
|
|
33205
|
+
timer.unref?.();
|
|
33206
|
+
tick();
|
|
33207
|
+
}
|
|
33208
|
+
async function pollGithubEdges(deps = realDeps(), opts) {
|
|
33209
|
+
if (!deps.enabled()) return { fired: 0, primed: false, skipped: "disabled" };
|
|
33210
|
+
const loaded = deps.load();
|
|
33211
|
+
const prev = opts?.baseline ? { ...loaded, primed: false } : loaded;
|
|
33212
|
+
const now = deps.now();
|
|
33213
|
+
const cards = indexCiCards(deps.listCiCards(), (threadId) => deps.parentIdForThread(threadId));
|
|
33214
|
+
const failing = [];
|
|
33215
|
+
const unknown = [];
|
|
33216
|
+
const observed = [];
|
|
33217
|
+
const failingSubjects = /* @__PURE__ */ new Map();
|
|
33218
|
+
for (const card of cards.values()) {
|
|
33219
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
33220
|
+
let failed;
|
|
33221
|
+
try {
|
|
33222
|
+
failed = await deps.fetchCiFailed(card);
|
|
33223
|
+
} catch {
|
|
33224
|
+
failed = null;
|
|
33225
|
+
}
|
|
33226
|
+
if (failed == null) {
|
|
33227
|
+
unknown.push(prUrl);
|
|
33228
|
+
continue;
|
|
33229
|
+
}
|
|
33230
|
+
observed.push(prUrl);
|
|
33231
|
+
if (!failed) continue;
|
|
33232
|
+
failing.push(prUrl);
|
|
33233
|
+
failingSubjects.set(prUrl, subjectFromCard(card, prUrl));
|
|
33234
|
+
}
|
|
33235
|
+
const ciUrls = mergeCiLatch(
|
|
33236
|
+
prev.ciFailed,
|
|
33237
|
+
prev.primed ? failing : [...failing, ...unknown],
|
|
33238
|
+
unknown
|
|
33239
|
+
);
|
|
33240
|
+
const ciFailed = ciUrls.map(
|
|
33241
|
+
(prUrl) => failingSubjects.get(prUrl) ?? { prUrl, title: prUrl }
|
|
33242
|
+
);
|
|
33243
|
+
const repos = [...new Set(deps.listRepoPaths().map((path2) => path2.trim()).filter(Boolean))].sort();
|
|
33244
|
+
const fetchedReviews = [];
|
|
33245
|
+
const reviewSubjects = /* @__PURE__ */ new Map();
|
|
33246
|
+
const successfulRepos = [];
|
|
33247
|
+
for (const repoPath of repos) {
|
|
33248
|
+
let rows;
|
|
33249
|
+
try {
|
|
33250
|
+
rows = await deps.listReviewRequested(repoPath);
|
|
33251
|
+
} catch {
|
|
33252
|
+
rows = null;
|
|
33253
|
+
}
|
|
33254
|
+
if (!rows) continue;
|
|
33255
|
+
successfulRepos.push(repoPath);
|
|
33256
|
+
for (const row2 of rows) {
|
|
33257
|
+
if (!acceptOpenReadyPr(row2)) continue;
|
|
33258
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
33259
|
+
if (!prUrl) continue;
|
|
33260
|
+
const card = cards.get(prUrl);
|
|
33261
|
+
fetchedReviews.push({ prUrl, repoPath });
|
|
33262
|
+
reviewSubjects.set(prUrl, {
|
|
33263
|
+
prUrl,
|
|
33264
|
+
title: row2.title.trim() || card?.prTitle || prUrl,
|
|
33265
|
+
threadId: card?.threadId,
|
|
33266
|
+
threadTitle: card?.threadTitle,
|
|
33267
|
+
repoPath
|
|
33268
|
+
});
|
|
33269
|
+
}
|
|
33270
|
+
}
|
|
33271
|
+
const seenRepos = new Set(prev.reviewReposSeen ?? []);
|
|
33272
|
+
const freshRepos = new Set(
|
|
33273
|
+
prev.primed ? successfulRepos.filter((repo) => !seenRepos.has(repo)) : []
|
|
33274
|
+
);
|
|
33275
|
+
const reviewLatch = repos.length ? mergeReviewLatch(prev.reviewRequested, fetchedReviews, successfulRepos) : prev.reviewRequested;
|
|
33276
|
+
const reviewRequested = reviewLatch.filter((row2) => !freshRepos.has(row2.repoPath)).map(
|
|
33277
|
+
(row2) => reviewSubjects.get(row2.prUrl) ?? {
|
|
33278
|
+
prUrl: row2.prUrl,
|
|
33279
|
+
title: row2.prUrl,
|
|
33280
|
+
repoPath: row2.repoPath
|
|
33281
|
+
}
|
|
33282
|
+
);
|
|
33283
|
+
const baseline = reviewLatch.filter((row2) => freshRepos.has(row2.repoPath));
|
|
33284
|
+
const seenCi = new Set((prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
33285
|
+
const freshCi = new Set(prev.primed ? observed.filter((url) => !seenCi.has(url)) : []);
|
|
33286
|
+
const ciForDiff = ciFailed.filter((subject) => !freshCi.has(subject.prUrl));
|
|
33287
|
+
const edges = diffGithubEdges({ prev, ciFailed: ciForDiff, reviewRequested, now });
|
|
33288
|
+
const delivered = prev.primed && edges.length ? await deliverGithubEdges(edges, deps) : [];
|
|
33289
|
+
const freshFailing = [...freshCi].filter((url) => failing.includes(url));
|
|
33290
|
+
const prevForCommit = freshFailing.length || baseline.length ? {
|
|
33291
|
+
...prev,
|
|
33292
|
+
...freshFailing.length ? {
|
|
33293
|
+
ciFailed: [
|
|
33294
|
+
.../* @__PURE__ */ new Set([
|
|
33295
|
+
...prev.ciFailed.map((url) => normalizePrUrl(url)).filter(Boolean),
|
|
33296
|
+
...freshFailing
|
|
33297
|
+
])
|
|
33298
|
+
]
|
|
33299
|
+
} : {},
|
|
33300
|
+
...baseline.length ? { reviewRequested: mergeReviewLatch(prev.reviewRequested, baseline, [...freshRepos]) } : {}
|
|
33301
|
+
} : prev;
|
|
33302
|
+
const committed = commitGithubEdgeSnapshot({
|
|
33303
|
+
prev: prevForCommit,
|
|
33304
|
+
ciFailed,
|
|
33305
|
+
reviewRequested: reviewLatch,
|
|
33306
|
+
delivered,
|
|
33307
|
+
now
|
|
33308
|
+
});
|
|
33309
|
+
const watched = new Set(repos);
|
|
33310
|
+
const reviewReposSeen = [
|
|
33311
|
+
.../* @__PURE__ */ new Set([
|
|
33312
|
+
...(prev.reviewReposSeen ?? []).filter((repo) => watched.has(repo)),
|
|
33313
|
+
...successfulRepos
|
|
33314
|
+
])
|
|
33315
|
+
].sort();
|
|
33316
|
+
const cardUrls = new Set(cards.keys());
|
|
33317
|
+
const ciSeen = [
|
|
33318
|
+
.../* @__PURE__ */ new Set([
|
|
33319
|
+
...(prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter((url) => url && cardUrls.has(url)),
|
|
33320
|
+
...observed
|
|
33321
|
+
])
|
|
33322
|
+
].sort();
|
|
33323
|
+
const next = {
|
|
33324
|
+
...committed,
|
|
33325
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
33326
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
33327
|
+
};
|
|
33328
|
+
if (githubEdgeSnapshotKey(prev) !== githubEdgeSnapshotKey(next)) deps.save(next);
|
|
33329
|
+
return { fired: delivered.length, primed: next.primed };
|
|
33330
|
+
}
|
|
33331
|
+
async function deliverGithubEdges(edges, deps) {
|
|
33332
|
+
const delivered = [];
|
|
33333
|
+
for (const group of routeGithubEdges(edges, (threadId) => deps.parentIdForThread(threadId), deps.designatedId())) {
|
|
33334
|
+
const prompt = formatGithubEdgePrompt(group.edges);
|
|
33335
|
+
try {
|
|
33336
|
+
if (group.targetId) await deps.send(group.targetId, prompt);
|
|
33337
|
+
else await deps.startOrchestration(prompt);
|
|
33338
|
+
delivered.push(...group.edges);
|
|
33339
|
+
} catch {
|
|
33340
|
+
}
|
|
33341
|
+
}
|
|
33342
|
+
return delivered;
|
|
33343
|
+
}
|
|
33344
|
+
function indexCiCards(cards, parentIdForThread2) {
|
|
33345
|
+
const byUrl = /* @__PURE__ */ new Map();
|
|
33346
|
+
for (const card of cards) {
|
|
33347
|
+
if (!acceptOpenReadyPr(card)) continue;
|
|
33348
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
33349
|
+
if (!prUrl) continue;
|
|
33350
|
+
const existing = byUrl.get(prUrl);
|
|
33351
|
+
if (!existing) {
|
|
33352
|
+
byUrl.set(prUrl, card);
|
|
33353
|
+
continue;
|
|
33354
|
+
}
|
|
33355
|
+
const existingParent = parentIdForThread2(existing.threadId);
|
|
33356
|
+
const nextParent = parentIdForThread2(card.threadId);
|
|
33357
|
+
if (!existingParent && nextParent) byUrl.set(prUrl, card);
|
|
33358
|
+
}
|
|
33359
|
+
return byUrl;
|
|
33360
|
+
}
|
|
33361
|
+
function subjectFromCard(card, prUrl) {
|
|
33362
|
+
return {
|
|
33363
|
+
prUrl,
|
|
33364
|
+
title: card.prTitle.trim() || card.threadTitle.trim() || prUrl,
|
|
33365
|
+
threadId: card.threadId,
|
|
33366
|
+
threadTitle: card.threadTitle,
|
|
33367
|
+
repoPath: card.repoPath,
|
|
33368
|
+
draft: card.draft,
|
|
33369
|
+
state: card.state
|
|
33370
|
+
};
|
|
33371
|
+
}
|
|
33372
|
+
function liveWorktreeThreads() {
|
|
33373
|
+
return listThreads().filter(
|
|
33374
|
+
(thread) => !isGlobalThread(thread) && !isOrchestratorThread(thread) && thread.wakeOnGithubEdges === true && Boolean(thread.worktreePath?.trim()) && Boolean(thread.repoPath?.trim())
|
|
33375
|
+
);
|
|
33376
|
+
}
|
|
33377
|
+
function listCiCardsFromStore() {
|
|
33378
|
+
const cards = [];
|
|
33379
|
+
for (const thread of liveWorktreeThreads()) {
|
|
33380
|
+
const prUrl = thread.prUrl?.trim() ?? "";
|
|
33381
|
+
if (!prUrl) continue;
|
|
33382
|
+
cards.push({
|
|
33383
|
+
threadId: thread.id,
|
|
33384
|
+
threadTitle: thread.title?.trim() || "Workspace",
|
|
33385
|
+
worktreePath: thread.worktreePath,
|
|
33386
|
+
repoPath: thread.repoPath,
|
|
33387
|
+
prUrl,
|
|
33388
|
+
prTitle: thread.prTitle?.trim() || thread.title?.trim() || prUrl,
|
|
33389
|
+
draft: thread.prIsDraft,
|
|
33390
|
+
state: thread.prState
|
|
33391
|
+
});
|
|
33392
|
+
}
|
|
33393
|
+
return cards;
|
|
33394
|
+
}
|
|
33395
|
+
function listLiveRepoPaths() {
|
|
33396
|
+
return [...new Set(liveWorktreeThreads().map((thread) => thread.repoPath.trim()).filter(Boolean))];
|
|
33397
|
+
}
|
|
33398
|
+
async function fetchCiFailedFromGh(card) {
|
|
33399
|
+
try {
|
|
33400
|
+
const checks = await getPrCiChecks(card.worktreePath, card.prUrl);
|
|
33401
|
+
if (!checks) return null;
|
|
33402
|
+
const failed = ciChecksFailed(checks);
|
|
33403
|
+
persistChecksFailed(card, failed);
|
|
33404
|
+
return failed;
|
|
33405
|
+
} catch {
|
|
33406
|
+
return null;
|
|
33407
|
+
}
|
|
33408
|
+
}
|
|
33409
|
+
function persistChecksFailed(card, failed) {
|
|
33410
|
+
const siblings = threadsSharingWorktree(card.worktreePath);
|
|
33411
|
+
const self = readThread(card.threadId);
|
|
33412
|
+
const targets = siblings.length > 0 ? siblings : self ? [self] : [];
|
|
33413
|
+
for (const thread of targets) {
|
|
33414
|
+
const patch = threadPrChecksFailedPatch(thread, failed);
|
|
33415
|
+
if (Object.keys(patch).length === 0) continue;
|
|
33416
|
+
try {
|
|
33417
|
+
updateThread(thread.id, patch);
|
|
33418
|
+
} catch {
|
|
33419
|
+
}
|
|
33420
|
+
}
|
|
33421
|
+
}
|
|
33422
|
+
async function listMineFromGh(repoPath) {
|
|
33423
|
+
try {
|
|
33424
|
+
const reviewLabel = resolveProjectReviewLabel(loadAppSettings(), repoPath);
|
|
33425
|
+
const rows = await listPrs(repoPath, {
|
|
33426
|
+
queue: "mine",
|
|
33427
|
+
limit: 30,
|
|
33428
|
+
strict: true,
|
|
33429
|
+
...reviewLabel ? { reviewLabel } : {}
|
|
33430
|
+
});
|
|
33431
|
+
return rows.map((row2) => ({
|
|
33432
|
+
prUrl: row2.url,
|
|
33433
|
+
title: row2.title,
|
|
33434
|
+
draft: row2.isDraft,
|
|
33435
|
+
state: row2.state
|
|
33436
|
+
}));
|
|
33437
|
+
} catch {
|
|
33438
|
+
return null;
|
|
33439
|
+
}
|
|
33440
|
+
}
|
|
33441
|
+
function parentIdForThread(threadId) {
|
|
33442
|
+
const thread = readThread(threadId);
|
|
33443
|
+
if (!thread || thread.status === "archived") return null;
|
|
33444
|
+
const parent = connectedOrchestrator(thread, (id) => readThread(id));
|
|
33445
|
+
if (!parent || parent.status === "archived") return null;
|
|
33446
|
+
return parent.id;
|
|
33447
|
+
}
|
|
33448
|
+
function designatedOrchestratorId() {
|
|
33449
|
+
return pickDesignatedOrchestratorId(
|
|
33450
|
+
listGlobalThreads().map((thread) => ({
|
|
33451
|
+
id: thread.id,
|
|
33452
|
+
status: thread.status,
|
|
33453
|
+
cloud: isCloudCoordinatorThread(thread)
|
|
33454
|
+
}))
|
|
33455
|
+
);
|
|
33456
|
+
}
|
|
33457
|
+
function realDeps() {
|
|
33458
|
+
return {
|
|
33459
|
+
enabled: () => wakeOrchestratorOnGithubEdgesEnabled(),
|
|
33460
|
+
listCiCards: listCiCardsFromStore,
|
|
33461
|
+
fetchCiFailed: fetchCiFailedFromGh,
|
|
33462
|
+
listRepoPaths: listLiveRepoPaths,
|
|
33463
|
+
listReviewRequested: listMineFromGh,
|
|
33464
|
+
parentIdForThread,
|
|
33465
|
+
designatedId: designatedOrchestratorId,
|
|
33466
|
+
send: async (threadId, prompt) => {
|
|
33467
|
+
const { getOrchestrator: getOrchestrator2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
33468
|
+
await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
|
|
33469
|
+
},
|
|
33470
|
+
startOrchestration: async (prompt) => {
|
|
33471
|
+
const { startOrchestration: startOrchestration2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
33472
|
+
const defaults = resolveOrchestratorDefaults();
|
|
33473
|
+
await startOrchestration2({
|
|
33474
|
+
goal: prompt,
|
|
33475
|
+
agent: defaults.agent,
|
|
33476
|
+
model: defaults.model,
|
|
33477
|
+
effort: defaults.effort,
|
|
33478
|
+
fast: defaults.fast,
|
|
33479
|
+
autonomy: defaults.autonomy
|
|
33480
|
+
});
|
|
33481
|
+
},
|
|
33482
|
+
load: loadGithubEdgeSnapshot,
|
|
33483
|
+
save: saveGithubEdgeSnapshot,
|
|
33484
|
+
now: () => Date.now()
|
|
33485
|
+
};
|
|
33486
|
+
}
|
|
33487
|
+
var import_node_fs70, import_node_path70, timer, polling, needsBaseline;
|
|
33488
|
+
var init_github_edge_watch = __esm({
|
|
33489
|
+
"src/orchestrator/github-edge-watch.ts"() {
|
|
33490
|
+
"use strict";
|
|
33491
|
+
import_node_fs70 = require("fs");
|
|
33492
|
+
import_node_path70 = require("path");
|
|
33493
|
+
init_pr_gates();
|
|
33494
|
+
init_pr_merge_archive();
|
|
33495
|
+
init_worktree();
|
|
33496
|
+
init_desktop_host();
|
|
33497
|
+
init_app_settings();
|
|
33498
|
+
init_global_workspace();
|
|
33499
|
+
init_paths();
|
|
33500
|
+
init_private_file();
|
|
33501
|
+
init_thread_store();
|
|
33502
|
+
init_chat_tabs();
|
|
33503
|
+
init_connected_orchestrator();
|
|
33504
|
+
init_github_edge();
|
|
33505
|
+
timer = null;
|
|
33506
|
+
polling = false;
|
|
33507
|
+
needsBaseline = true;
|
|
33508
|
+
}
|
|
33509
|
+
});
|
|
33510
|
+
|
|
32820
33511
|
// src/agents/cursor-recover.ts
|
|
32821
33512
|
var cursor_recover_exports = {};
|
|
32822
33513
|
__export(cursor_recover_exports, {
|
|
@@ -32833,9 +33524,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
32833
33524
|
return best;
|
|
32834
33525
|
}
|
|
32835
33526
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
32836
|
-
if (!(0,
|
|
33527
|
+
if (!(0, import_node_fs71.existsSync)(runsPath)) return null;
|
|
32837
33528
|
try {
|
|
32838
|
-
const lines = (0,
|
|
33529
|
+
const lines = (0, import_node_fs71.readFileSync)(runsPath, "utf8").split("\n");
|
|
32839
33530
|
let best = null;
|
|
32840
33531
|
for (const line of lines) {
|
|
32841
33532
|
const trimmed = line.trim();
|
|
@@ -32861,11 +33552,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
32861
33552
|
return null;
|
|
32862
33553
|
}
|
|
32863
33554
|
}
|
|
32864
|
-
var
|
|
33555
|
+
var import_node_fs71;
|
|
32865
33556
|
var init_cursor_recover = __esm({
|
|
32866
33557
|
"src/agents/cursor-recover.ts"() {
|
|
32867
33558
|
"use strict";
|
|
32868
|
-
|
|
33559
|
+
import_node_fs71 = require("fs");
|
|
32869
33560
|
init_cursor_store();
|
|
32870
33561
|
}
|
|
32871
33562
|
});
|
|
@@ -32969,7 +33660,7 @@ async function startOrchestration(opts) {
|
|
|
32969
33660
|
}
|
|
32970
33661
|
return ready;
|
|
32971
33662
|
}
|
|
32972
|
-
var import_node_events, import_node_crypto22,
|
|
33663
|
+
var import_node_events, import_node_crypto22, import_node_fs72, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
|
|
32973
33664
|
var init_orchestrator = __esm({
|
|
32974
33665
|
"src/orchestrator/orchestrator.ts"() {
|
|
32975
33666
|
"use strict";
|
|
@@ -32978,7 +33669,7 @@ var init_orchestrator = __esm({
|
|
|
32978
33669
|
init_task_state();
|
|
32979
33670
|
init_wait_for_turn();
|
|
32980
33671
|
import_node_crypto22 = require("crypto");
|
|
32981
|
-
|
|
33672
|
+
import_node_fs72 = require("fs");
|
|
32982
33673
|
init_error_detail();
|
|
32983
33674
|
init_run();
|
|
32984
33675
|
init_stale_lock();
|
|
@@ -33054,6 +33745,7 @@ var init_orchestrator = __esm({
|
|
|
33054
33745
|
init_workspaces();
|
|
33055
33746
|
init_global_workspace();
|
|
33056
33747
|
init_caffeinate_hold();
|
|
33748
|
+
init_github_edge_watch();
|
|
33057
33749
|
init_schedule_runner();
|
|
33058
33750
|
init_coordinator_prompt();
|
|
33059
33751
|
init_enqueue_thread_send();
|
|
@@ -33179,7 +33871,7 @@ var init_orchestrator = __esm({
|
|
|
33179
33871
|
this.lightReconcileAt.set(repoPath, Date.now());
|
|
33180
33872
|
for (const thread of listThreads()) {
|
|
33181
33873
|
if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
|
|
33182
|
-
if (!(0,
|
|
33874
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
33183
33875
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
33184
33876
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
33185
33877
|
}
|
|
@@ -33208,7 +33900,7 @@ var init_orchestrator = __esm({
|
|
|
33208
33900
|
}
|
|
33209
33901
|
continue;
|
|
33210
33902
|
}
|
|
33211
|
-
if (!(0,
|
|
33903
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
33212
33904
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
33213
33905
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
33214
33906
|
continue;
|
|
@@ -33234,6 +33926,7 @@ var init_orchestrator = __esm({
|
|
|
33234
33926
|
}
|
|
33235
33927
|
this.schedulePendingQuotaResumes();
|
|
33236
33928
|
armSchedules();
|
|
33929
|
+
armGithubEdgeWatch();
|
|
33237
33930
|
}
|
|
33238
33931
|
/** Surface (and, when enabled, clean up) worktrees git knows about but no thread owns. */
|
|
33239
33932
|
async reconcileOrphans(repoPaths) {
|
|
@@ -33372,8 +34065,8 @@ var init_orchestrator = __esm({
|
|
|
33372
34065
|
}
|
|
33373
34066
|
}
|
|
33374
34067
|
clearQuotaResumeTimer(threadId) {
|
|
33375
|
-
const
|
|
33376
|
-
if (
|
|
34068
|
+
const timer2 = this.quotaResumeTimers.get(threadId);
|
|
34069
|
+
if (timer2) clearTimeout(timer2);
|
|
33377
34070
|
this.quotaResumeTimers.delete(threadId);
|
|
33378
34071
|
}
|
|
33379
34072
|
/** Schedule (or fire) auto-retry after a provider session/usage limit reset. */
|
|
@@ -33382,11 +34075,11 @@ var init_orchestrator = __esm({
|
|
|
33382
34075
|
updateThread(threadId, { quotaResumeAt: resumeAt.toISOString() });
|
|
33383
34076
|
const delay3 = Math.max(5e3, resumeAt.getTime() - Date.now());
|
|
33384
34077
|
const capped = Math.min(delay3, 2147483647);
|
|
33385
|
-
const
|
|
34078
|
+
const timer2 = setTimeout(() => {
|
|
33386
34079
|
this.quotaResumeTimers.delete(threadId);
|
|
33387
34080
|
void this.resumeAfterQuotaWait(threadId);
|
|
33388
34081
|
}, capped);
|
|
33389
|
-
this.quotaResumeTimers.set(threadId,
|
|
34082
|
+
this.quotaResumeTimers.set(threadId, timer2);
|
|
33390
34083
|
}
|
|
33391
34084
|
schedulePendingQuotaResumes() {
|
|
33392
34085
|
for (const thread of listThreads({ includeArchived: false })) {
|
|
@@ -35034,11 +35727,11 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35034
35727
|
const start = Date.now();
|
|
35035
35728
|
return new Promise((resolve3, reject) => {
|
|
35036
35729
|
let settled = false;
|
|
35037
|
-
let
|
|
35730
|
+
let timer2;
|
|
35038
35731
|
const finish2 = (fn) => {
|
|
35039
35732
|
if (settled) return;
|
|
35040
35733
|
settled = true;
|
|
35041
|
-
if (
|
|
35734
|
+
if (timer2) clearInterval(timer2);
|
|
35042
35735
|
off();
|
|
35043
35736
|
fn();
|
|
35044
35737
|
};
|
|
@@ -35064,7 +35757,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35064
35757
|
}
|
|
35065
35758
|
}
|
|
35066
35759
|
});
|
|
35067
|
-
|
|
35760
|
+
timer2 = setInterval(() => {
|
|
35068
35761
|
const raw = readThread(thread.id);
|
|
35069
35762
|
if (!raw) {
|
|
35070
35763
|
finish2(() => reject(new Error(`Thread not found: ${thread.id}`)));
|
|
@@ -35709,7 +36402,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35709
36402
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
35710
36403
|
return restored2;
|
|
35711
36404
|
}
|
|
35712
|
-
if (!(0,
|
|
36405
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
35713
36406
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
35714
36407
|
throw new Error(
|
|
35715
36408
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -35889,8 +36582,8 @@ async function fireSchedule(id) {
|
|
|
35889
36582
|
}
|
|
35890
36583
|
}
|
|
35891
36584
|
function clearTimer(id) {
|
|
35892
|
-
const
|
|
35893
|
-
if (
|
|
36585
|
+
const timer2 = timers.get(id);
|
|
36586
|
+
if (timer2) clearTimeout(timer2);
|
|
35894
36587
|
timers.delete(id);
|
|
35895
36588
|
}
|
|
35896
36589
|
function armOne(schedule) {
|
|
@@ -35906,7 +36599,7 @@ function armOne(schedule) {
|
|
|
35906
36599
|
return;
|
|
35907
36600
|
}
|
|
35908
36601
|
const capped = Math.min(delay3, SET_TIMEOUT_MAX);
|
|
35909
|
-
const
|
|
36602
|
+
const timer2 = setTimeout(() => {
|
|
35910
36603
|
timers.delete(schedule.id);
|
|
35911
36604
|
const live = getSchedule(schedule.id);
|
|
35912
36605
|
if (!live?.enabled) return;
|
|
@@ -35919,7 +36612,7 @@ function armOne(schedule) {
|
|
|
35919
36612
|
if (isThisProcessDesktopHost()) armSchedules();
|
|
35920
36613
|
});
|
|
35921
36614
|
}, capped);
|
|
35922
|
-
timers.set(schedule.id,
|
|
36615
|
+
timers.set(schedule.id, timer2);
|
|
35923
36616
|
}
|
|
35924
36617
|
function armSchedules() {
|
|
35925
36618
|
if (!isThisProcessDesktopHost()) return;
|
|
@@ -36081,6 +36774,7 @@ __export(index_exports, {
|
|
|
36081
36774
|
RUN_PORTS_REL: () => RUN_PORTS_REL,
|
|
36082
36775
|
RUN_SCRIPT_DESKTOP_ADOPT_MS: () => RUN_SCRIPT_DESKTOP_ADOPT_MS,
|
|
36083
36776
|
RemoteHub: () => RemoteHub,
|
|
36777
|
+
SCHEDULE_RUN_HISTORY_LIMIT: () => SCHEDULE_RUN_HISTORY_LIMIT,
|
|
36084
36778
|
SEED_FULL_TOOL_MESSAGES: () => SEED_FULL_TOOL_MESSAGES,
|
|
36085
36779
|
SEED_MAX_CHARS: () => SEED_MAX_CHARS,
|
|
36086
36780
|
SESSION_RESET_OCCUPANCY_TOKENS: () => SESSION_RESET_OCCUPANCY_TOKENS,
|
|
@@ -36161,9 +36855,11 @@ __export(index_exports, {
|
|
|
36161
36855
|
applySystemCaEnv: () => applySystemCaEnv,
|
|
36162
36856
|
applyThreadIntoMain: () => applyThreadIntoMain,
|
|
36163
36857
|
applyTurnUsage: () => applyTurnUsage,
|
|
36858
|
+
applyWakeOnGithubEdges: () => applyWakeOnGithubEdges,
|
|
36164
36859
|
applyWorkspaceTags: () => applyWorkspaceTags,
|
|
36165
36860
|
archiveRemovedWorkspaceChats: () => archiveRemovedWorkspaceChats,
|
|
36166
36861
|
archivesWithRemovedWorkspace: () => archivesWithRemovedWorkspace,
|
|
36862
|
+
armGithubEdgeWatch: () => armGithubEdgeWatch,
|
|
36167
36863
|
armSchedules: () => armSchedules,
|
|
36168
36864
|
askBlockStillWaiting: () => askBlockStillWaiting,
|
|
36169
36865
|
assertAbleTimeCredential: () => assertAbleTimeCredential,
|
|
@@ -36485,6 +37181,7 @@ __export(index_exports, {
|
|
|
36485
37181
|
getOrderPlan: () => getOrderPlan,
|
|
36486
37182
|
getPr: () => getPr,
|
|
36487
37183
|
getPrChecks: () => getPrChecks,
|
|
37184
|
+
getPrCiChecks: () => getPrCiChecks,
|
|
36488
37185
|
getPrDetails: () => getPrDetails,
|
|
36489
37186
|
getPrForHeadBranch: () => getPrForHeadBranch,
|
|
36490
37187
|
getPrMeta: () => getPrMeta,
|
|
@@ -37085,6 +37782,7 @@ __export(index_exports, {
|
|
|
37085
37782
|
visibleAssistantText: () => visibleAssistantText,
|
|
37086
37783
|
visibleToolRowDetail: () => visibleToolRowDetail,
|
|
37087
37784
|
waitForPidExit: () => waitForPidExit,
|
|
37785
|
+
wakeOrchestratorOnGithubEdgesEnabled: () => wakeOrchestratorOnGithubEdgesEnabled,
|
|
37088
37786
|
warmGithubAgentAuth: () => warmGithubAgentAuth,
|
|
37089
37787
|
weeklyCronExpr: () => weeklyCronExpr,
|
|
37090
37788
|
whichOnPath: () => whichOnPath,
|
|
@@ -38525,6 +39223,53 @@ function satisfyOrderDependency(id, satisfied = true) {
|
|
|
38525
39223
|
|
|
38526
39224
|
// src/index.ts
|
|
38527
39225
|
init_schedule_runner();
|
|
39226
|
+
init_github_edge_watch();
|
|
39227
|
+
|
|
39228
|
+
// src/threads/wake-on-github-edges.ts
|
|
39229
|
+
init_global_workspace();
|
|
39230
|
+
init_app_settings();
|
|
39231
|
+
init_thread_store();
|
|
39232
|
+
init_worktree_labels();
|
|
39233
|
+
init_chat_tabs();
|
|
39234
|
+
function wakeOnGithubEdgesTargetRef(opts) {
|
|
39235
|
+
const requested = opts.requestedRef?.trim() || "";
|
|
39236
|
+
if (!opts.ownWorktreeOnly) {
|
|
39237
|
+
if (!requested) throw new Error("Pass a chat id on the workspace.");
|
|
39238
|
+
return requested;
|
|
39239
|
+
}
|
|
39240
|
+
const caller = opts.caller;
|
|
39241
|
+
if (!caller || isGlobalThread(caller) || caller.sourceType === "orchestration") {
|
|
39242
|
+
throw new Error("CI and review wakes belong on a project workspace. This chat is not one.");
|
|
39243
|
+
}
|
|
39244
|
+
if (!requested || requested === caller.id) return caller.id;
|
|
39245
|
+
const other = opts.find(requested);
|
|
39246
|
+
if (!other || normalizeWorktreePath(other.worktreePath) !== normalizeWorktreePath(caller.worktreePath)) {
|
|
39247
|
+
throw new Error("You can only change this switch on this workspace.");
|
|
39248
|
+
}
|
|
39249
|
+
return other.id;
|
|
39250
|
+
}
|
|
39251
|
+
function applyWakeOnGithubEdges(threadRef, enabled) {
|
|
39252
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
39253
|
+
throw new Error(
|
|
39254
|
+
"Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is off. Turn that on in Settings. Do not change it from this chat."
|
|
39255
|
+
);
|
|
39256
|
+
}
|
|
39257
|
+
const thread = findThreadByRef(threadRef);
|
|
39258
|
+
if (!thread) throw new Error(`Thread not found: ${threadRef}`);
|
|
39259
|
+
if (isGlobalThread(thread) || thread.sourceType === "orchestration") {
|
|
39260
|
+
throw new Error("CI and review wakes belong on a project workspace. Pass a worktree chat id.");
|
|
39261
|
+
}
|
|
39262
|
+
const on = enabled === true;
|
|
39263
|
+
const siblings = threadsSharingWorktree(thread.worktreePath);
|
|
39264
|
+
const targets = siblings.length > 0 ? siblings : [thread];
|
|
39265
|
+
let updated = thread;
|
|
39266
|
+
for (const row2 of targets) {
|
|
39267
|
+
const written = updateThread(row2.id, { wakeOnGithubEdges: on ? true : void 0 });
|
|
39268
|
+
if (!on) delete written.wakeOnGithubEdges;
|
|
39269
|
+
if (written.id === thread.id) updated = written;
|
|
39270
|
+
}
|
|
39271
|
+
return updated;
|
|
39272
|
+
}
|
|
38528
39273
|
|
|
38529
39274
|
// src/host/awake.ts
|
|
38530
39275
|
function hostKeepsMacAwake(input) {
|
|
@@ -38542,6 +39287,7 @@ init_system_ca();
|
|
|
38542
39287
|
init_app_settings();
|
|
38543
39288
|
init_desktop_host();
|
|
38544
39289
|
init_schedules();
|
|
39290
|
+
init_github_edge_watch();
|
|
38545
39291
|
init_schedule_runner();
|
|
38546
39292
|
|
|
38547
39293
|
// src/remote/client.ts
|
|
@@ -40006,12 +40752,12 @@ function emitControl(opts, reply) {
|
|
|
40006
40752
|
}
|
|
40007
40753
|
function watchPhoneStream(opts, chatId, threadId, generation, seed = []) {
|
|
40008
40754
|
let parts = seed.slice();
|
|
40009
|
-
let
|
|
40755
|
+
let timer2 = null;
|
|
40010
40756
|
let lastKey = "";
|
|
40011
40757
|
let closed = false;
|
|
40012
40758
|
const alive = () => !closed && chatGeneration.get(chatId) === generation;
|
|
40013
40759
|
const flush2 = () => {
|
|
40014
|
-
|
|
40760
|
+
timer2 = null;
|
|
40015
40761
|
if (!alive()) return;
|
|
40016
40762
|
const frame = phoneStreamFrame(parts);
|
|
40017
40763
|
const key = `${frame.activity}
|
|
@@ -40023,15 +40769,15 @@ ${frame.text}`;
|
|
|
40023
40769
|
};
|
|
40024
40770
|
const schedule = (event) => {
|
|
40025
40771
|
if (phoneStreamFlushNow(event) || lastKey === "") {
|
|
40026
|
-
if (
|
|
40027
|
-
clearTimeout(
|
|
40028
|
-
|
|
40772
|
+
if (timer2) {
|
|
40773
|
+
clearTimeout(timer2);
|
|
40774
|
+
timer2 = null;
|
|
40029
40775
|
}
|
|
40030
40776
|
flush2();
|
|
40031
40777
|
return;
|
|
40032
40778
|
}
|
|
40033
|
-
if (
|
|
40034
|
-
|
|
40779
|
+
if (timer2) return;
|
|
40780
|
+
timer2 = setTimeout(flush2, PHONE_STREAM_FLUSH_MS);
|
|
40035
40781
|
};
|
|
40036
40782
|
const off = getOrchestrator().on((event) => {
|
|
40037
40783
|
if (!alive()) return;
|
|
@@ -40044,7 +40790,7 @@ ${frame.text}`;
|
|
|
40044
40790
|
if (parts.length) flush2();
|
|
40045
40791
|
return () => {
|
|
40046
40792
|
closed = true;
|
|
40047
|
-
if (
|
|
40793
|
+
if (timer2) clearTimeout(timer2);
|
|
40048
40794
|
off();
|
|
40049
40795
|
};
|
|
40050
40796
|
}
|
|
@@ -40201,8 +40947,8 @@ init_message_parts();
|
|
|
40201
40947
|
init_turn_live();
|
|
40202
40948
|
|
|
40203
40949
|
// src/remote/phone-media.ts
|
|
40204
|
-
var
|
|
40205
|
-
var
|
|
40950
|
+
var import_node_fs73 = require("fs");
|
|
40951
|
+
var import_node_path71 = require("path");
|
|
40206
40952
|
init_diff();
|
|
40207
40953
|
var PHONE_IMAGE_MAX_BYTES = 15e5;
|
|
40208
40954
|
var PHONE_TEXT_MAX_BYTES = 18e4;
|
|
@@ -40255,7 +41001,7 @@ function phoneImageDataUrl(worktreePath, raw) {
|
|
|
40255
41001
|
}
|
|
40256
41002
|
function phoneDirectoryListing(worktreePath, relative2) {
|
|
40257
41003
|
try {
|
|
40258
|
-
const entries = (0,
|
|
41004
|
+
const entries = (0, import_node_fs73.readdirSync)((0, import_node_path71.join)(worktreePath, relative2), { withFileTypes: true });
|
|
40259
41005
|
const dirs = new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
|
|
40260
41006
|
const names = entries.map((entry) => entry.name).filter((name) => name && !name.includes("/") && !name.includes("\0")).sort((a, b) => a.localeCompare(b));
|
|
40261
41007
|
const shown = names.slice(0, PHONE_DIR_MAX);
|
|
@@ -40281,7 +41027,7 @@ function phoneFilePreview(worktreePath, relative2, kind) {
|
|
|
40281
41027
|
}
|
|
40282
41028
|
if (relative2.toLowerCase().endsWith(".svg")) {
|
|
40283
41029
|
try {
|
|
40284
|
-
const buf = (0,
|
|
41030
|
+
const buf = (0, import_node_fs73.readFileSync)((0, import_node_path71.join)(worktreePath, relative2));
|
|
40285
41031
|
const truncated = buf.length > PHONE_TEXT_MAX_BYTES;
|
|
40286
41032
|
return {
|
|
40287
41033
|
content: buf.subarray(0, PHONE_TEXT_MAX_BYTES).toString("utf8"),
|
|
@@ -41830,7 +42576,7 @@ function handleRemoteInbound(text7, opts) {
|
|
|
41830
42576
|
}
|
|
41831
42577
|
|
|
41832
42578
|
// src/remote/phone-board-sync.ts
|
|
41833
|
-
var
|
|
42579
|
+
var import_node_path72 = require("path");
|
|
41834
42580
|
var import_chokidar = require("chokidar");
|
|
41835
42581
|
init_orchestrator();
|
|
41836
42582
|
init_paths();
|
|
@@ -41886,7 +42632,7 @@ function subscribePhoneBoard(notify) {
|
|
|
41886
42632
|
threads.on("error", () => void 0);
|
|
41887
42633
|
const data = (0, import_chokidar.watch)(appDataDir(), { ignoreInitial: true, depth: 0 });
|
|
41888
42634
|
const onData = (changed) => {
|
|
41889
|
-
const name = (0,
|
|
42635
|
+
const name = (0, import_node_path72.basename)(changed);
|
|
41890
42636
|
if (name !== "workspaces.json" && name !== "removed-workspaces.json" && name !== "settings.json") return;
|
|
41891
42637
|
notify();
|
|
41892
42638
|
};
|
|
@@ -41902,11 +42648,11 @@ function subscribePhoneBoard(notify) {
|
|
|
41902
42648
|
function startPhoneBoardSync(opts) {
|
|
41903
42649
|
const list = opts.list ?? listPhoneSidebar;
|
|
41904
42650
|
const debounceMs = opts.debounceMs ?? PHONE_BOARD_SYNC_MS;
|
|
41905
|
-
let
|
|
42651
|
+
let timer2 = null;
|
|
41906
42652
|
let lastKey = "";
|
|
41907
42653
|
let stopped = false;
|
|
41908
42654
|
const push2 = () => {
|
|
41909
|
-
|
|
42655
|
+
timer2 = null;
|
|
41910
42656
|
if (stopped) return;
|
|
41911
42657
|
let sidebar;
|
|
41912
42658
|
try {
|
|
@@ -41921,8 +42667,8 @@ function startPhoneBoardSync(opts) {
|
|
|
41921
42667
|
};
|
|
41922
42668
|
const schedule = () => {
|
|
41923
42669
|
if (stopped) return;
|
|
41924
|
-
if (
|
|
41925
|
-
|
|
42670
|
+
if (timer2) clearTimeout(timer2);
|
|
42671
|
+
timer2 = setTimeout(push2, debounceMs);
|
|
41926
42672
|
};
|
|
41927
42673
|
const handle = (event) => {
|
|
41928
42674
|
if (isPhoneBoardEvent(event)) schedule();
|
|
@@ -41946,8 +42692,8 @@ function startPhoneBoardSync(opts) {
|
|
|
41946
42692
|
}
|
|
41947
42693
|
return () => {
|
|
41948
42694
|
stopped = true;
|
|
41949
|
-
if (
|
|
41950
|
-
|
|
42695
|
+
if (timer2) clearTimeout(timer2);
|
|
42696
|
+
timer2 = null;
|
|
41951
42697
|
if (loginTimer) clearInterval(loginTimer);
|
|
41952
42698
|
loginTimer = null;
|
|
41953
42699
|
unsubscribe();
|
|
@@ -41996,9 +42742,9 @@ function createRemoteKeepalive(opts) {
|
|
|
41996
42742
|
}
|
|
41997
42743
|
function wait(ms, signal) {
|
|
41998
42744
|
return new Promise((resolve3, reject) => {
|
|
41999
|
-
const
|
|
42745
|
+
const timer2 = setTimeout(resolve3, ms);
|
|
42000
42746
|
const onAbort = () => {
|
|
42001
|
-
clearTimeout(
|
|
42747
|
+
clearTimeout(timer2);
|
|
42002
42748
|
reject(new Error("aborted"));
|
|
42003
42749
|
};
|
|
42004
42750
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -42838,11 +43584,11 @@ function clientIdFromOAuthState(state) {
|
|
|
42838
43584
|
init_app_settings();
|
|
42839
43585
|
|
|
42840
43586
|
// src/slack/workspaces.ts
|
|
42841
|
-
var
|
|
43587
|
+
var import_node_path73 = require("path");
|
|
42842
43588
|
init_paths();
|
|
42843
43589
|
init_secure_file();
|
|
42844
43590
|
function storePath2() {
|
|
42845
|
-
return (0,
|
|
43591
|
+
return (0, import_node_path73.join)(appDataDir(), "slack-workspaces.json");
|
|
42846
43592
|
}
|
|
42847
43593
|
function readStore2() {
|
|
42848
43594
|
try {
|
|
@@ -42966,12 +43712,12 @@ function sleep(ms, signal) {
|
|
|
42966
43712
|
reject(new SlackOAuthCancelledError());
|
|
42967
43713
|
return;
|
|
42968
43714
|
}
|
|
42969
|
-
const
|
|
43715
|
+
const timer2 = setTimeout(() => {
|
|
42970
43716
|
signal?.removeEventListener("abort", onAbort);
|
|
42971
43717
|
resolve3();
|
|
42972
43718
|
}, ms);
|
|
42973
43719
|
const onAbort = () => {
|
|
42974
|
-
clearTimeout(
|
|
43720
|
+
clearTimeout(timer2);
|
|
42975
43721
|
reject(new SlackOAuthCancelledError());
|
|
42976
43722
|
};
|
|
42977
43723
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -43388,15 +44134,15 @@ function sendJson(res, status, body) {
|
|
|
43388
44134
|
|
|
43389
44135
|
// src/relay/slack-apps.ts
|
|
43390
44136
|
var import_node_crypto27 = require("crypto");
|
|
43391
|
-
var
|
|
44137
|
+
var import_node_fs74 = require("fs");
|
|
43392
44138
|
var import_node_module7 = require("module");
|
|
43393
|
-
var
|
|
44139
|
+
var import_node_path74 = require("path");
|
|
43394
44140
|
var SlackAppStore = class {
|
|
43395
44141
|
db;
|
|
43396
44142
|
key;
|
|
43397
44143
|
constructor(filePath, key) {
|
|
43398
44144
|
if (key.length !== 32) throw new Error("Slack token key must be 32 bytes");
|
|
43399
|
-
(0,
|
|
44145
|
+
(0, import_node_fs74.mkdirSync)((0, import_node_path74.dirname)(filePath), { recursive: true });
|
|
43400
44146
|
this.key = key;
|
|
43401
44147
|
this.db = openDatabase(filePath);
|
|
43402
44148
|
this.db.exec(`
|
|
@@ -43557,7 +44303,7 @@ function sameHash(stored, presented) {
|
|
|
43557
44303
|
}
|
|
43558
44304
|
function thisModuleFile3() {
|
|
43559
44305
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
43560
|
-
return cjsFile || process.argv[1] || (0,
|
|
44306
|
+
return cjsFile || process.argv[1] || (0, import_node_path74.join)(process.cwd(), "package.json");
|
|
43561
44307
|
}
|
|
43562
44308
|
function openDatabase(filePath) {
|
|
43563
44309
|
const req = (0, import_node_module7.createRequire)(thisModuleFile3());
|
|
@@ -43569,9 +44315,9 @@ function openDatabase(filePath) {
|
|
|
43569
44315
|
|
|
43570
44316
|
// src/relay/slack-grants.ts
|
|
43571
44317
|
var import_node_crypto29 = require("crypto");
|
|
43572
|
-
var
|
|
44318
|
+
var import_node_fs75 = require("fs");
|
|
43573
44319
|
var import_node_module8 = require("module");
|
|
43574
|
-
var
|
|
44320
|
+
var import_node_path75 = require("path");
|
|
43575
44321
|
|
|
43576
44322
|
// src/slack/listen-grant.ts
|
|
43577
44323
|
var import_node_crypto28 = require("crypto");
|
|
@@ -43611,7 +44357,7 @@ function hashListenGrant(grant) {
|
|
|
43611
44357
|
var SlackListenGrantStore = class {
|
|
43612
44358
|
db;
|
|
43613
44359
|
constructor(filePath) {
|
|
43614
|
-
(0,
|
|
44360
|
+
(0, import_node_fs75.mkdirSync)((0, import_node_path75.dirname)(filePath), { recursive: true });
|
|
43615
44361
|
this.db = openDatabase2(filePath);
|
|
43616
44362
|
this.db.exec(`
|
|
43617
44363
|
CREATE TABLE IF NOT EXISTS slack_listen_grants (
|
|
@@ -43654,7 +44400,7 @@ var SlackListenGrantStore = class {
|
|
|
43654
44400
|
};
|
|
43655
44401
|
function thisModuleFile4() {
|
|
43656
44402
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
43657
|
-
return cjsFile || process.argv[1] || (0,
|
|
44403
|
+
return cjsFile || process.argv[1] || (0, import_node_path75.join)(process.cwd(), "package.json");
|
|
43658
44404
|
}
|
|
43659
44405
|
function openDatabase2(filePath) {
|
|
43660
44406
|
const req = (0, import_node_module8.createRequire)(thisModuleFile4());
|
|
@@ -44180,9 +44926,9 @@ var SlackRelayHub = class {
|
|
|
44180
44926
|
};
|
|
44181
44927
|
|
|
44182
44928
|
// src/relay/static.ts
|
|
44183
|
-
var
|
|
44929
|
+
var import_node_fs76 = require("fs");
|
|
44184
44930
|
var import_promises = require("fs/promises");
|
|
44185
|
-
var
|
|
44931
|
+
var import_node_path76 = __toESM(require("path"), 1);
|
|
44186
44932
|
var TYPES = {
|
|
44187
44933
|
".css": "text/css; charset=utf-8",
|
|
44188
44934
|
".html": "text/html; charset=utf-8",
|
|
@@ -44242,7 +44988,7 @@ async function directorySlashLocation(root, requestUrl) {
|
|
|
44242
44988
|
const candidate = resolveStaticPath(root, requestUrl);
|
|
44243
44989
|
if (!candidate) return null;
|
|
44244
44990
|
if (await fileSize(candidate) != null) return null;
|
|
44245
|
-
if (await fileSize(
|
|
44991
|
+
if (await fileSize(import_node_path76.default.join(candidate, "index.html")) == null) return null;
|
|
44246
44992
|
return `${url.pathname}/${url.search}`;
|
|
44247
44993
|
}
|
|
44248
44994
|
function resolveStaticPath(root, requestUrl) {
|
|
@@ -44253,9 +44999,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
44253
44999
|
return null;
|
|
44254
45000
|
}
|
|
44255
45001
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
44256
|
-
const rootResolved =
|
|
44257
|
-
const candidate =
|
|
44258
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
45002
|
+
const rootResolved = import_node_path76.default.resolve(root);
|
|
45003
|
+
const candidate = import_node_path76.default.resolve(rootResolved, `.${pathname}`);
|
|
45004
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path76.default.sep)) {
|
|
44259
45005
|
return null;
|
|
44260
45006
|
}
|
|
44261
45007
|
return candidate;
|
|
@@ -44269,7 +45015,7 @@ async function fileSize(file) {
|
|
|
44269
45015
|
}
|
|
44270
45016
|
}
|
|
44271
45017
|
function sendFile(req, res, file, size) {
|
|
44272
|
-
const ext =
|
|
45018
|
+
const ext = import_node_path76.default.extname(file).toLowerCase();
|
|
44273
45019
|
res.writeHead(200, {
|
|
44274
45020
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
44275
45021
|
"Content-Length": size,
|
|
@@ -44279,7 +45025,7 @@ function sendFile(req, res, file, size) {
|
|
|
44279
45025
|
res.end();
|
|
44280
45026
|
return true;
|
|
44281
45027
|
}
|
|
44282
|
-
(0,
|
|
45028
|
+
(0, import_node_fs76.createReadStream)(file).pipe(res);
|
|
44283
45029
|
return true;
|
|
44284
45030
|
}
|
|
44285
45031
|
async function serveMarketingSite(req, res, opts) {
|
|
@@ -44317,7 +45063,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
44317
45063
|
if (!candidate) return false;
|
|
44318
45064
|
const direct = await fileSize(candidate);
|
|
44319
45065
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
44320
|
-
const asIndex =
|
|
45066
|
+
const asIndex = import_node_path76.default.join(candidate, "index.html");
|
|
44321
45067
|
const indexSize = await fileSize(asIndex);
|
|
44322
45068
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
44323
45069
|
return false;
|
|
@@ -44660,15 +45406,15 @@ init_protocol();
|
|
|
44660
45406
|
|
|
44661
45407
|
// src/relay/accounts.ts
|
|
44662
45408
|
var import_node_crypto32 = require("crypto");
|
|
44663
|
-
var
|
|
45409
|
+
var import_node_fs77 = require("fs");
|
|
44664
45410
|
var import_node_module9 = require("module");
|
|
44665
|
-
var
|
|
45411
|
+
var import_node_path77 = require("path");
|
|
44666
45412
|
var GITHUB_ACCOUNT_ISSUER = "https://github.com";
|
|
44667
45413
|
var CURSOR_ACCOUNT_ISSUER = "https://api.cursor.com/v1/origin";
|
|
44668
45414
|
var RELAY_DEVICE_CAP = 3;
|
|
44669
45415
|
function thisModuleFile5() {
|
|
44670
45416
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
44671
|
-
return cjsFile || process.argv[1] || (0,
|
|
45417
|
+
return cjsFile || process.argv[1] || (0, import_node_path77.join)(process.cwd(), "package.json");
|
|
44672
45418
|
}
|
|
44673
45419
|
function openDatabase3(filePath) {
|
|
44674
45420
|
const req = (0, import_node_module9.createRequire)(thisModuleFile5());
|
|
@@ -44705,8 +45451,8 @@ function assertRelayAccountsDurable(filePath) {
|
|
|
44705
45451
|
if (process.env.SIDEBOARD_RELAY_ACCOUNTS_EPHEMERAL === "1") return;
|
|
44706
45452
|
if (process.env.NODE_ENV !== "production") return;
|
|
44707
45453
|
if (process.platform !== "linux") return;
|
|
44708
|
-
const dir = (0,
|
|
44709
|
-
const mounts = (0,
|
|
45454
|
+
const dir = (0, import_node_fs77.realpathSync)((0, import_node_path77.dirname)(filePath));
|
|
45455
|
+
const mounts = (0, import_node_fs77.readFileSync)("/proc/mounts", "utf8");
|
|
44710
45456
|
const point = longestMountPoint(dir, mounts);
|
|
44711
45457
|
if (point === "/") {
|
|
44712
45458
|
throw new Error(
|
|
@@ -44717,7 +45463,7 @@ function assertRelayAccountsDurable(filePath) {
|
|
|
44717
45463
|
var RelayAccountStore = class {
|
|
44718
45464
|
db;
|
|
44719
45465
|
constructor(filePath) {
|
|
44720
|
-
(0,
|
|
45466
|
+
(0, import_node_fs77.mkdirSync)((0, import_node_path77.dirname)(filePath), { recursive: true });
|
|
44721
45467
|
this.db = openDatabase3(filePath);
|
|
44722
45468
|
this.db.exec(`
|
|
44723
45469
|
CREATE TABLE IF NOT EXISTS accounts (
|
|
@@ -45757,6 +46503,7 @@ async function startHeadlessHost(opts) {
|
|
|
45757
46503
|
claimDesktopHost();
|
|
45758
46504
|
bootstrapSystemCa();
|
|
45759
46505
|
armSchedules();
|
|
46506
|
+
armGithubEdgeWatch();
|
|
45760
46507
|
const ac = new AbortController();
|
|
45761
46508
|
let stopped = false;
|
|
45762
46509
|
let phoneConnected = false;
|
|
@@ -45828,19 +46575,20 @@ async function startHeadlessHost(opts) {
|
|
|
45828
46575
|
}
|
|
45829
46576
|
});
|
|
45830
46577
|
refreshAwake();
|
|
45831
|
-
const
|
|
46578
|
+
const timer2 = setInterval(() => {
|
|
45832
46579
|
if (!isThisProcessDesktopHost()) {
|
|
45833
46580
|
void stop();
|
|
45834
46581
|
return;
|
|
45835
46582
|
}
|
|
45836
46583
|
armSchedules();
|
|
46584
|
+
armGithubEdgeWatch();
|
|
45837
46585
|
void refreshRunning().then(() => refreshAwake());
|
|
45838
46586
|
}, REARM_MS);
|
|
45839
|
-
|
|
46587
|
+
timer2.unref?.();
|
|
45840
46588
|
const stop = async () => {
|
|
45841
46589
|
if (stopped) return;
|
|
45842
46590
|
stopped = true;
|
|
45843
|
-
clearInterval(
|
|
46591
|
+
clearInterval(timer2);
|
|
45844
46592
|
stopCaffeinate();
|
|
45845
46593
|
ac.abort();
|
|
45846
46594
|
if (relay) await relay.close();
|
|
@@ -46193,22 +46941,22 @@ init_error_detail();
|
|
|
46193
46941
|
init_cursor_stream_cutoff();
|
|
46194
46942
|
|
|
46195
46943
|
// src/agents/tool-result-clip.ts
|
|
46196
|
-
var
|
|
46197
|
-
var
|
|
46944
|
+
var import_node_fs78 = require("fs");
|
|
46945
|
+
var import_node_path78 = require("path");
|
|
46198
46946
|
init_workspace_scratch();
|
|
46199
46947
|
init_error_detail();
|
|
46200
46948
|
function spillPath(cwd, prefix) {
|
|
46201
46949
|
const stamp = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
46202
46950
|
const safe = prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 40) || "tool";
|
|
46203
|
-
return (0,
|
|
46951
|
+
return (0, import_node_path78.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
|
|
46204
46952
|
}
|
|
46205
46953
|
function spillToolResultToCli(content, opts) {
|
|
46206
46954
|
const cwd = opts?.cwd?.trim();
|
|
46207
46955
|
if (!cwd || !content) return null;
|
|
46208
46956
|
const file = spillPath(cwd, opts?.prefix ?? "tool-result");
|
|
46209
46957
|
try {
|
|
46210
|
-
(0,
|
|
46211
|
-
(0,
|
|
46958
|
+
(0, import_node_fs78.mkdirSync)((0, import_node_path78.join)(cwd, CLI_DIR), { recursive: true });
|
|
46959
|
+
(0, import_node_fs78.writeFileSync)(file, content, "utf8");
|
|
46212
46960
|
return file;
|
|
46213
46961
|
} catch {
|
|
46214
46962
|
return null;
|
|
@@ -46295,7 +47043,7 @@ function createClippedMcpServer() {
|
|
|
46295
47043
|
// src/mcp/server.ts
|
|
46296
47044
|
var import_zod12 = require("zod");
|
|
46297
47045
|
var import_node_crypto38 = require("crypto");
|
|
46298
|
-
var
|
|
47046
|
+
var import_node_path82 = require("path");
|
|
46299
47047
|
init_orchestrator();
|
|
46300
47048
|
init_task_state();
|
|
46301
47049
|
init_worktree();
|
|
@@ -46379,16 +47127,16 @@ var MAX_ORCH_THREADS = 5;
|
|
|
46379
47127
|
var CREATE_THREAD_TIMEOUT_MS = 9e4;
|
|
46380
47128
|
function withTimeout2(promise, ms, label) {
|
|
46381
47129
|
return new Promise((resolve3, reject) => {
|
|
46382
|
-
const
|
|
47130
|
+
const timer2 = setTimeout(() => {
|
|
46383
47131
|
reject(new Error(`${label} timed out after ${Math.round(ms / 1e3)}s`));
|
|
46384
47132
|
}, ms);
|
|
46385
47133
|
promise.then(
|
|
46386
47134
|
(value) => {
|
|
46387
|
-
clearTimeout(
|
|
47135
|
+
clearTimeout(timer2);
|
|
46388
47136
|
resolve3(value);
|
|
46389
47137
|
},
|
|
46390
47138
|
(err) => {
|
|
46391
|
-
clearTimeout(
|
|
47139
|
+
clearTimeout(timer2);
|
|
46392
47140
|
reject(err);
|
|
46393
47141
|
}
|
|
46394
47142
|
);
|
|
@@ -47822,13 +48570,13 @@ function whenFromUpdate(id, args) {
|
|
|
47822
48570
|
}
|
|
47823
48571
|
function createdHint(schedule) {
|
|
47824
48572
|
const awake = scheduleNeedsCaffeinate(schedule) ? " Caffeinate while automations are enabled is now on so the Mac can stay awake until this job is due." : "";
|
|
47825
|
-
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.";
|
|
48573
|
+
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.";
|
|
47826
48574
|
return `Fires while Sideboard.app is running.${fresh}${awake}`;
|
|
47827
48575
|
}
|
|
47828
48576
|
function registerScheduleTools(server) {
|
|
47829
48577
|
server.tool(
|
|
47830
48578
|
"list_schedules",
|
|
47831
|
-
"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.",
|
|
48579
|
+
"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.",
|
|
47832
48580
|
{},
|
|
47833
48581
|
async () => {
|
|
47834
48582
|
try {
|
|
@@ -47840,7 +48588,7 @@ function registerScheduleTools(server) {
|
|
|
47840
48588
|
);
|
|
47841
48589
|
server.tool(
|
|
47842
48590
|
"create_schedule",
|
|
47843
|
-
"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
|
|
48591
|
+
"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.",
|
|
47844
48592
|
{
|
|
47845
48593
|
prompt: import_zod10.z.string().describe("User message / goal queued when the automation fires"),
|
|
47846
48594
|
name: import_zod10.z.string().optional(),
|
|
@@ -48271,7 +49019,7 @@ function registerOrderTools(server) {
|
|
|
48271
49019
|
|
|
48272
49020
|
// src/agent-rpc/handlers.ts
|
|
48273
49021
|
var import_node_crypto36 = require("crypto");
|
|
48274
|
-
var
|
|
49022
|
+
var import_node_path79 = require("path");
|
|
48275
49023
|
init_wait_for_job();
|
|
48276
49024
|
init_wait_for_turn();
|
|
48277
49025
|
|
|
@@ -48378,7 +49126,7 @@ function invalidParams2(message) {
|
|
|
48378
49126
|
function jobCwd(rec) {
|
|
48379
49127
|
const raw = str7(rec.cwd).trim();
|
|
48380
49128
|
if (!raw) throw invalidParams2("cwd is required");
|
|
48381
|
-
if (!(0,
|
|
49129
|
+
if (!(0, import_node_path79.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
|
|
48382
49130
|
return raw;
|
|
48383
49131
|
}
|
|
48384
49132
|
async function handleRuntimePing(_params, _ctx) {
|
|
@@ -48511,27 +49259,27 @@ init_gh_errors();
|
|
|
48511
49259
|
init_git_auth_mode();
|
|
48512
49260
|
|
|
48513
49261
|
// src/board/load-home-board.ts
|
|
48514
|
-
var
|
|
48515
|
-
var
|
|
49262
|
+
var import_node_fs80 = require("fs");
|
|
49263
|
+
var import_node_path81 = require("path");
|
|
48516
49264
|
init_worktree();
|
|
48517
49265
|
init_paths();
|
|
48518
49266
|
|
|
48519
49267
|
// src/board/board-pins.ts
|
|
48520
49268
|
var import_node_crypto37 = require("crypto");
|
|
48521
|
-
var
|
|
48522
|
-
var
|
|
49269
|
+
var import_node_fs79 = require("fs");
|
|
49270
|
+
var import_node_path80 = require("path");
|
|
48523
49271
|
init_paths();
|
|
48524
49272
|
init_home_board();
|
|
48525
49273
|
var FILE = "home-board-pins.json";
|
|
48526
49274
|
var VERSION2 = 1;
|
|
48527
49275
|
function pinsFile() {
|
|
48528
|
-
return (0,
|
|
49276
|
+
return (0, import_node_path80.join)(appDataDir(), FILE);
|
|
48529
49277
|
}
|
|
48530
49278
|
function readDisk() {
|
|
48531
49279
|
const path2 = pinsFile();
|
|
48532
|
-
if (!(0,
|
|
49280
|
+
if (!(0, import_node_fs79.existsSync)(path2)) return [];
|
|
48533
49281
|
try {
|
|
48534
|
-
const raw = JSON.parse((0,
|
|
49282
|
+
const raw = JSON.parse((0, import_node_fs79.readFileSync)(path2, "utf8"));
|
|
48535
49283
|
if (raw?.version !== VERSION2 || !Array.isArray(raw.items)) return [];
|
|
48536
49284
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
48537
49285
|
} catch {
|
|
@@ -48539,8 +49287,8 @@ function readDisk() {
|
|
|
48539
49287
|
}
|
|
48540
49288
|
}
|
|
48541
49289
|
function writeDisk(items) {
|
|
48542
|
-
(0,
|
|
48543
|
-
(0,
|
|
49290
|
+
(0, import_node_fs79.mkdirSync)(appDataDir(), { recursive: true });
|
|
49291
|
+
(0, import_node_fs79.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION2, items }, null, 2), "utf8");
|
|
48544
49292
|
}
|
|
48545
49293
|
function listBoardPins() {
|
|
48546
49294
|
return readDisk();
|
|
@@ -48592,7 +49340,7 @@ function replaceBoardPins(items) {
|
|
|
48592
49340
|
}
|
|
48593
49341
|
function clearBoardPins() {
|
|
48594
49342
|
try {
|
|
48595
|
-
(0,
|
|
49343
|
+
(0, import_node_fs79.unlinkSync)(pinsFile());
|
|
48596
49344
|
} catch {
|
|
48597
49345
|
}
|
|
48598
49346
|
}
|
|
@@ -48609,7 +49357,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
48609
49357
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
48610
49358
|
}
|
|
48611
49359
|
function cacheFile() {
|
|
48612
|
-
return (0,
|
|
49360
|
+
return (0, import_node_path81.join)(appDataDir(), "home-board-cache.json");
|
|
48613
49361
|
}
|
|
48614
49362
|
function emptyInputs() {
|
|
48615
49363
|
return {
|
|
@@ -48635,9 +49383,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
48635
49383
|
}
|
|
48636
49384
|
function readDiskCache() {
|
|
48637
49385
|
const path2 = cacheFile();
|
|
48638
|
-
if (!(0,
|
|
49386
|
+
if (!(0, import_node_fs80.existsSync)(path2)) return null;
|
|
48639
49387
|
try {
|
|
48640
|
-
const raw = JSON.parse((0,
|
|
49388
|
+
const raw = JSON.parse((0, import_node_fs80.readFileSync)(path2, "utf8"));
|
|
48641
49389
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
48642
49390
|
return null;
|
|
48643
49391
|
}
|
|
@@ -48651,14 +49399,14 @@ function readDiskCache() {
|
|
|
48651
49399
|
}
|
|
48652
49400
|
function writeDiskCache(entry) {
|
|
48653
49401
|
try {
|
|
48654
|
-
(0,
|
|
48655
|
-
(0,
|
|
49402
|
+
(0, import_node_fs80.mkdirSync)(appDataDir(), { recursive: true });
|
|
49403
|
+
(0, import_node_fs80.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
48656
49404
|
} catch {
|
|
48657
49405
|
}
|
|
48658
49406
|
}
|
|
48659
49407
|
function deleteDiskCache() {
|
|
48660
49408
|
try {
|
|
48661
|
-
(0,
|
|
49409
|
+
(0, import_node_fs80.unlinkSync)(cacheFile());
|
|
48662
49410
|
} catch {
|
|
48663
49411
|
}
|
|
48664
49412
|
}
|
|
@@ -48874,7 +49622,7 @@ async function startMcpServer() {
|
|
|
48874
49622
|
async () => {
|
|
48875
49623
|
const threads = orch.getThreads();
|
|
48876
49624
|
const lines = threads.map((t) => {
|
|
48877
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0,
|
|
49625
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path82.basename)(t.repoPath) || t.repoPath;
|
|
48878
49626
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
48879
49627
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
48880
49628
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -49354,6 +50102,36 @@ async function startMcpServer() {
|
|
|
49354
50102
|
}
|
|
49355
50103
|
}
|
|
49356
50104
|
);
|
|
50105
|
+
server.tool(
|
|
50106
|
+
"set_wake_on_github_edges",
|
|
50107
|
+
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.",
|
|
50108
|
+
{
|
|
50109
|
+
ref: import_zod12.z.string().optional().describe(
|
|
50110
|
+
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
50111
|
+
),
|
|
50112
|
+
enabled: import_zod12.z.boolean().describe("True opts the checkout in. False turns it off.")
|
|
50113
|
+
},
|
|
50114
|
+
async ({ ref, enabled }) => {
|
|
50115
|
+
try {
|
|
50116
|
+
const callerId = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
|
|
50117
|
+
const target = wakeOnGithubEdgesTargetRef({
|
|
50118
|
+
ownWorktreeOnly: worktreeProfile,
|
|
50119
|
+
caller: callerId ? orch.getThread(callerId) : null,
|
|
50120
|
+
requestedRef: ref,
|
|
50121
|
+
find: (id) => orch.getThread(id)
|
|
50122
|
+
});
|
|
50123
|
+
const thread = applyWakeOnGithubEdges(target, enabled);
|
|
50124
|
+
return mcpJson({
|
|
50125
|
+
id: thread.id,
|
|
50126
|
+
worktreePath: thread.worktreePath,
|
|
50127
|
+
wakeOnGithubEdges: thread.wakeOnGithubEdges === true
|
|
50128
|
+
});
|
|
50129
|
+
} catch (err) {
|
|
50130
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
50131
|
+
return mcpJson({ ok: false, message }, true);
|
|
50132
|
+
}
|
|
50133
|
+
}
|
|
50134
|
+
);
|
|
49357
50135
|
if (!worktreeProfile) {
|
|
49358
50136
|
registerConnectedIssueVendorTools(server);
|
|
49359
50137
|
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await Promise.resolve().then(() => (init_caffeinate_hold(), caffeinate_hold_exports));
|
|
@@ -51021,19 +51799,19 @@ init_turn_live();
|
|
|
51021
51799
|
init_thread_store();
|
|
51022
51800
|
|
|
51023
51801
|
// src/slack/reply-target.ts
|
|
51024
|
-
var
|
|
51025
|
-
var
|
|
51802
|
+
var import_node_fs81 = require("fs");
|
|
51803
|
+
var import_node_path83 = require("path");
|
|
51026
51804
|
init_paths();
|
|
51027
51805
|
init_private_file();
|
|
51028
51806
|
init_secure_file();
|
|
51029
51807
|
function storePath3() {
|
|
51030
|
-
return (0,
|
|
51808
|
+
return (0, import_node_path83.join)(appDataDir(), "slack-reply-to.json");
|
|
51031
51809
|
}
|
|
51032
51810
|
function readStore3() {
|
|
51033
51811
|
const path2 = storePath3();
|
|
51034
|
-
if (!(0,
|
|
51812
|
+
if (!(0, import_node_fs81.existsSync)(path2)) return {};
|
|
51035
51813
|
try {
|
|
51036
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0,
|
|
51814
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs81.readFileSync)(path2, "utf8"));
|
|
51037
51815
|
return parsed?.targets && typeof parsed.targets === "object" ? parsed.targets : {};
|
|
51038
51816
|
} catch {
|
|
51039
51817
|
return {};
|
|
@@ -51131,7 +51909,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51131
51909
|
let relayAnswersClaims = false;
|
|
51132
51910
|
const fallbackTimers = /* @__PURE__ */ new Map();
|
|
51133
51911
|
const clearFallbackTimers = () => {
|
|
51134
|
-
for (const
|
|
51912
|
+
for (const timer2 of fallbackTimers.values()) clearTimeout(timer2);
|
|
51135
51913
|
fallbackTimers.clear();
|
|
51136
51914
|
};
|
|
51137
51915
|
const markClaimsAnswered = () => {
|
|
@@ -51248,7 +52026,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51248
52026
|
send2(ws, { type: "claim", eventId: msg.eventId });
|
|
51249
52027
|
if (!relayAnswersClaims) {
|
|
51250
52028
|
const eventId = msg.eventId;
|
|
51251
|
-
const
|
|
52029
|
+
const timer2 = setTimeout(() => {
|
|
51252
52030
|
fallbackTimers.delete(eventId);
|
|
51253
52031
|
const inbound = pending.get(eventId);
|
|
51254
52032
|
if (!inbound) return;
|
|
@@ -51258,7 +52036,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51258
52036
|
log(`event error: ${errMsg}`);
|
|
51259
52037
|
});
|
|
51260
52038
|
}, opts.claimFallbackMs ?? CLAIM_FALLBACK_MS);
|
|
51261
|
-
fallbackTimers.set(eventId,
|
|
52039
|
+
fallbackTimers.set(eventId, timer2);
|
|
51262
52040
|
}
|
|
51263
52041
|
return;
|
|
51264
52042
|
}
|
|
@@ -51894,12 +52672,12 @@ function sleep2(ms, signal) {
|
|
|
51894
52672
|
reject(new RemoteAccountLoginCancelled());
|
|
51895
52673
|
return;
|
|
51896
52674
|
}
|
|
51897
|
-
const
|
|
52675
|
+
const timer2 = setTimeout(() => {
|
|
51898
52676
|
signal?.removeEventListener("abort", onAbort);
|
|
51899
52677
|
resolve3();
|
|
51900
52678
|
}, ms);
|
|
51901
52679
|
const onAbort = () => {
|
|
51902
|
-
clearTimeout(
|
|
52680
|
+
clearTimeout(timer2);
|
|
51903
52681
|
reject(new RemoteAccountLoginCancelled());
|
|
51904
52682
|
};
|
|
51905
52683
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -51998,8 +52776,8 @@ async function disconnectRemoteAccount(opts) {
|
|
|
51998
52776
|
}
|
|
51999
52777
|
|
|
52000
52778
|
// src/slack/outbound-watch.ts
|
|
52001
|
-
var
|
|
52002
|
-
var
|
|
52779
|
+
var import_node_fs82 = require("fs");
|
|
52780
|
+
var import_node_path84 = require("path");
|
|
52003
52781
|
init_paths();
|
|
52004
52782
|
init_private_file();
|
|
52005
52783
|
init_secure_file();
|
|
@@ -52012,7 +52790,7 @@ var POLL_INTERVAL_MS = 12e3;
|
|
|
52012
52790
|
var lastPollMs = 0;
|
|
52013
52791
|
var nameCache = /* @__PURE__ */ new Map();
|
|
52014
52792
|
function storePath4() {
|
|
52015
|
-
return (0,
|
|
52793
|
+
return (0, import_node_path84.join)(appDataDir(), "slack-outbound-watch.json");
|
|
52016
52794
|
}
|
|
52017
52795
|
function watchId(teamId, channelId, ts) {
|
|
52018
52796
|
return `${teamId}:${channelId}:${ts}`;
|
|
@@ -52025,9 +52803,9 @@ function tsNewer(a, b) {
|
|
|
52025
52803
|
}
|
|
52026
52804
|
function readStore4() {
|
|
52027
52805
|
const path2 = storePath4();
|
|
52028
|
-
if (!(0,
|
|
52806
|
+
if (!(0, import_node_fs82.existsSync)(path2)) return [];
|
|
52029
52807
|
try {
|
|
52030
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0,
|
|
52808
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs82.readFileSync)(path2, "utf8"));
|
|
52031
52809
|
return Array.isArray(parsed?.watches) ? parsed.watches : [];
|
|
52032
52810
|
} catch {
|
|
52033
52811
|
return [];
|
|
@@ -52465,6 +53243,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52465
53243
|
RUN_PORTS_REL,
|
|
52466
53244
|
RUN_SCRIPT_DESKTOP_ADOPT_MS,
|
|
52467
53245
|
RemoteHub,
|
|
53246
|
+
SCHEDULE_RUN_HISTORY_LIMIT,
|
|
52468
53247
|
SEED_FULL_TOOL_MESSAGES,
|
|
52469
53248
|
SEED_MAX_CHARS,
|
|
52470
53249
|
SESSION_RESET_OCCUPANCY_TOKENS,
|
|
@@ -52545,9 +53324,11 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52545
53324
|
applySystemCaEnv,
|
|
52546
53325
|
applyThreadIntoMain,
|
|
52547
53326
|
applyTurnUsage,
|
|
53327
|
+
applyWakeOnGithubEdges,
|
|
52548
53328
|
applyWorkspaceTags,
|
|
52549
53329
|
archiveRemovedWorkspaceChats,
|
|
52550
53330
|
archivesWithRemovedWorkspace,
|
|
53331
|
+
armGithubEdgeWatch,
|
|
52551
53332
|
armSchedules,
|
|
52552
53333
|
askBlockStillWaiting,
|
|
52553
53334
|
assertAbleTimeCredential,
|
|
@@ -52869,6 +53650,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52869
53650
|
getOrderPlan,
|
|
52870
53651
|
getPr,
|
|
52871
53652
|
getPrChecks,
|
|
53653
|
+
getPrCiChecks,
|
|
52872
53654
|
getPrDetails,
|
|
52873
53655
|
getPrForHeadBranch,
|
|
52874
53656
|
getPrMeta,
|
|
@@ -53469,6 +54251,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
53469
54251
|
visibleAssistantText,
|
|
53470
54252
|
visibleToolRowDetail,
|
|
53471
54253
|
waitForPidExit,
|
|
54254
|
+
wakeOrchestratorOnGithubEdgesEnabled,
|
|
53472
54255
|
warmGithubAgentAuth,
|
|
53473
54256
|
weeklyCronExpr,
|
|
53474
54257
|
whichOnPath,
|