@sideboard-ai/core 0.1.340 → 0.1.342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-OGOHNRVB.js → abletime-MSIMJKKQ.js} +4 -4
- package/dist/{abletime-TNONAVJG.js → abletime-ZIYFR4SI.js} +4 -4
- package/dist/{abletime-oauth-DAZEUQJI.js → abletime-oauth-2RUKRZYZ.js} +3 -3
- package/dist/{abletime-oauth-TYDQ73GK.js → abletime-oauth-IQZ3LOB2.js} +3 -3
- package/dist/{abletime-rest-B4VI46MI.js → abletime-rest-7YAO5B74.js} +3 -3
- package/dist/{abletime-rest-3FWZGTX6.js → abletime-rest-UBLSGMSA.js} +3 -3
- package/dist/{agents-QFXIBIKJ.js → agents-7DCNOMFP.js} +8 -8
- package/dist/{agents-6MSZHZOM.js → agents-LNZ465IM.js} +8 -8
- package/dist/{app-settings-KOSVLMO5.js → app-settings-FS7TM55D.js} +11 -1
- package/dist/{app-settings-YS5AUJTF.js → app-settings-Q2F57NVK.js} +11 -1
- package/dist/{chunk-BD7QARIJ.js → chunk-2BLJ726H.js} +6 -5
- package/dist/{chunk-SYTTUNX6.js → chunk-3DMRQB4Y.js} +1 -1
- package/dist/{chunk-OMKTX7ZW.js → chunk-3J3XOIHF.js} +3 -3
- package/dist/{chunk-W6J3ZWLJ.js → chunk-4HELMBYR.js} +2 -2
- package/dist/{chunk-HNW5KMGK.js → chunk-4PXHJA5K.js} +2 -2
- package/dist/{chunk-QWFNKOGA.js → chunk-4TTTEKNV.js} +2 -2
- package/dist/{chunk-EVYOONTE.js → chunk-5BFEHSHO.js} +6 -5
- package/dist/{chunk-EZZY3EAZ.js → chunk-5HUR77ZH.js} +666 -62
- package/dist/{chunk-5TVRPOVS.js → chunk-5SJGR3VS.js} +1 -1
- package/dist/{chunk-I2C5ZRVO.js → chunk-5TS3KVGI.js} +1 -1
- package/dist/{chunk-5FGQTB2Z.js → chunk-6RO2AOE5.js} +2 -2
- package/dist/{chunk-FEGRY7NL.js → chunk-A4ZI7SA3.js} +3 -3
- package/dist/{chunk-DYUAVL5S.js → chunk-BIM24I3O.js} +1 -0
- package/dist/{chunk-KAIOL2M5.js → chunk-D7US5R4H.js} +1 -1
- package/dist/{chunk-NHLTTT5G.js → chunk-DEQLDEYR.js} +7 -6
- package/dist/{chunk-ELDHERAD.js → chunk-DZF25KTX.js} +661 -56
- package/dist/{chunk-4OVQGZEI.js → chunk-G3UV3GXJ.js} +48 -26
- package/dist/{chunk-Q73I6I2K.js → chunk-GUIJMZQG.js} +1 -1
- package/dist/{chunk-AFSLMWQK.js → chunk-JHT3CYLT.js} +42 -3
- package/dist/{chunk-BDQFZAE6.js → chunk-JX3OWNOT.js} +43 -3
- package/dist/{chunk-6ABL7HZN.js → chunk-LDJT3TLN.js} +10 -8
- package/dist/{chunk-LYJ5AVK4.js → chunk-LHU6ZBFB.js} +2 -2
- package/dist/{chunk-WSZIJNAR.js → chunk-NDBMDHQ5.js} +5 -5
- package/dist/{chunk-PEJ3N5VE.js → chunk-NGIGRAZB.js} +7 -6
- package/dist/{chunk-4BRO5LNX.js → chunk-O2IRQAFB.js} +3 -3
- package/dist/{chunk-5KH3EQ2C.js → chunk-ORO4ENZR.js} +1 -0
- package/dist/{chunk-ERCYQTJU.js → chunk-RTZO2YJC.js} +48 -26
- package/dist/{chunk-VHHEQP5V.js → chunk-S3DTEGMK.js} +11 -9
- package/dist/{chunk-N6TGSJVC.js → chunk-S3UGLMGE.js} +31 -0
- package/dist/{chunk-FCBUDWP6.js → chunk-SLLTEMIL.js} +2 -2
- package/dist/{chunk-23KYDM2U.js → chunk-TKEYXNXY.js} +31 -0
- package/dist/{chunk-4SP26Z6H.js → chunk-WO7VF4FG.js} +5 -5
- package/dist/{conductor-LEPTWN2U.js → conductor-4SWJM5FS.js} +6 -6
- package/dist/{conductor-AUUXCJZT.js → conductor-Q433HU77.js} +6 -6
- package/dist/{coordinator-prompt-VO42IZWS.js → coordinator-prompt-5QHWCO7V.js} +4 -4
- package/dist/{coordinator-prompt-CIWWP2P6.js → coordinator-prompt-Z7PPP45X.js} +4 -4
- package/dist/{global-workspace-FKXLFKYX.js → global-workspace-DL4K4K7O.js} +4 -4
- package/dist/{global-workspace-MCAREQI7.js → global-workspace-VDCZMFCZ.js} +4 -4
- package/dist/index.cjs +1018 -188
- package/dist/index.d.cts +57 -7
- package/dist/index.d.ts +57 -7
- package/dist/index.js +135 -30
- package/dist/{linear-P3LP455O.js → linear-JE4WAZ3W.js} +2 -2
- package/dist/{linear-5E2WI4QQ.js → linear-UXMDJAD4.js} +2 -2
- package/dist/{linear-list-Y3INIBYH.js → linear-list-I4NAOWPN.js} +1 -1
- package/dist/{linear-list-AXK62DPW.js → linear-list-KDLU7QWX.js} +1 -1
- package/dist/mcp/run-stdio.cjs +922 -114
- package/dist/mcp/run-stdio.js +119 -27
- package/dist/{optional-cli-6J6C4I3X.js → optional-cli-7QXXPEN6.js} +3 -3
- package/dist/{optional-cli-X6I35UNI.js → optional-cli-RUUCLNSM.js} +4 -4
- package/dist/{orchestrator-JTFCNXVR.js → orchestrator-BPCM4OP3.js} +11 -11
- package/dist/{orchestrator-NOQDMYLB.js → orchestrator-HIWWPWL5.js} +11 -11
- package/dist/{thread-store-DCO5MZWJ.js → thread-store-HETUMDVA.js} +2 -2
- package/dist/{thread-store-QGBPSZU2.js → thread-store-ILM2ZJCB.js} +2 -2
- package/dist/{workspaces-D6FQCZRK.js → workspaces-EIIHHH4S.js} +4 -4
- package/dist/{workspaces-Y25L2EPV.js → workspaces-MX4W4SSB.js} +4 -4
- package/dist/{worktree-S4YOAYRA.js → worktree-BD3EJE24.js} +5 -3
- package/dist/{worktree-GWS77LWX.js → worktree-QBVLKACU.js} +5 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2266,6 +2266,9 @@ __export(app_settings_exports, {
|
|
|
2266
2266
|
GITHUB_GIT_AUTH_MODES: () => GITHUB_GIT_AUTH_MODES,
|
|
2267
2267
|
HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
|
|
2268
2268
|
ISSUE_SOURCE_LABELS: () => ISSUE_SOURCE_LABELS,
|
|
2269
|
+
MAX_ORCH_THREADS_DEFAULT: () => MAX_ORCH_THREADS_DEFAULT,
|
|
2270
|
+
MAX_ORCH_THREADS_MAX: () => MAX_ORCH_THREADS_MAX,
|
|
2271
|
+
MAX_ORCH_THREADS_MIN: () => MAX_ORCH_THREADS_MIN,
|
|
2269
2272
|
PROFILE_NOTES_MAX: () => PROFILE_NOTES_MAX,
|
|
2270
2273
|
REVIEW_LABEL_MAX: () => REVIEW_LABEL_MAX,
|
|
2271
2274
|
USAGE_ON_LIMIT_VALUES: () => USAGE_ON_LIMIT_VALUES,
|
|
@@ -2328,6 +2331,7 @@ __export(app_settings_exports, {
|
|
|
2328
2331
|
issueSourceLabel: () => issueSourceLabel,
|
|
2329
2332
|
loadAppSettings: () => loadAppSettings,
|
|
2330
2333
|
maxConcurrentAgents: () => maxConcurrentAgents,
|
|
2334
|
+
maxOrchThreads: () => maxOrchThreads,
|
|
2331
2335
|
normalizeReviewLabel: () => normalizeReviewLabel,
|
|
2332
2336
|
orchestrationQuotaFallbackAgent: () => orchestrationQuotaFallbackAgent,
|
|
2333
2337
|
orchestrationQuotaOnLimit: () => orchestrationQuotaOnLimit,
|
|
@@ -2366,6 +2370,7 @@ __export(app_settings_exports, {
|
|
|
2366
2370
|
updateOpencodeSettings: () => updateOpencodeSettings,
|
|
2367
2371
|
updateProjectProfileSettings: () => updateProjectProfileSettings,
|
|
2368
2372
|
usageOnLimit: () => usageOnLimit,
|
|
2373
|
+
wakeOrchestratorOnGithubEdgesEnabled: () => wakeOrchestratorOnGithubEdgesEnabled,
|
|
2369
2374
|
writeViewerContext: () => writeViewerContext
|
|
2370
2375
|
});
|
|
2371
2376
|
function isAgentDoneSound(value) {
|
|
@@ -2768,6 +2773,9 @@ function normalizeAdvanced(raw) {
|
|
|
2768
2773
|
if (typeof source.cowboyMode === "boolean") {
|
|
2769
2774
|
out.cowboyMode = source.cowboyMode;
|
|
2770
2775
|
}
|
|
2776
|
+
if (typeof source.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
2777
|
+
out.wakeOrchestratorOnGithubEdges = source.wakeOrchestratorOnGithubEdges;
|
|
2778
|
+
}
|
|
2771
2779
|
if (typeof source.showCost === "boolean") {
|
|
2772
2780
|
out.showCost = source.showCost;
|
|
2773
2781
|
}
|
|
@@ -2786,6 +2794,9 @@ function normalizeAdvanced(raw) {
|
|
|
2786
2794
|
if (typeof source.maxConcurrent === "number" && Number.isFinite(source.maxConcurrent)) {
|
|
2787
2795
|
out.maxConcurrent = Math.max(1, Math.min(32, Math.floor(source.maxConcurrent)));
|
|
2788
2796
|
}
|
|
2797
|
+
if (typeof source.maxOrchThreads === "number" && Number.isFinite(source.maxOrchThreads)) {
|
|
2798
|
+
out.maxOrchThreads = clampMaxOrchThreads(source.maxOrchThreads);
|
|
2799
|
+
}
|
|
2789
2800
|
if (typeof source.worktreeMaxCount === "number" && Number.isFinite(source.worktreeMaxCount)) {
|
|
2790
2801
|
out.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(source.worktreeMaxCount)));
|
|
2791
2802
|
}
|
|
@@ -3656,6 +3667,9 @@ function updateAdvancedSettings(patch) {
|
|
|
3656
3667
|
if (typeof patch.cowboyMode === "boolean") {
|
|
3657
3668
|
advanced.cowboyMode = patch.cowboyMode;
|
|
3658
3669
|
}
|
|
3670
|
+
if (typeof patch.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
3671
|
+
advanced.wakeOrchestratorOnGithubEdges = patch.wakeOrchestratorOnGithubEdges;
|
|
3672
|
+
}
|
|
3659
3673
|
if (typeof patch.showCost === "boolean") {
|
|
3660
3674
|
advanced.showCost = patch.showCost;
|
|
3661
3675
|
}
|
|
@@ -3679,6 +3693,9 @@ function updateAdvancedSettings(patch) {
|
|
|
3679
3693
|
if (typeof patch.maxConcurrent === "number" && Number.isFinite(patch.maxConcurrent)) {
|
|
3680
3694
|
advanced.maxConcurrent = Math.max(1, Math.min(32, Math.floor(patch.maxConcurrent)));
|
|
3681
3695
|
}
|
|
3696
|
+
if (typeof patch.maxOrchThreads === "number" && Number.isFinite(patch.maxOrchThreads)) {
|
|
3697
|
+
advanced.maxOrchThreads = clampMaxOrchThreads(patch.maxOrchThreads);
|
|
3698
|
+
}
|
|
3682
3699
|
if (typeof patch.worktreeMaxCount === "number" && Number.isFinite(patch.worktreeMaxCount)) {
|
|
3683
3700
|
advanced.worktreeMaxCount = Math.max(1, Math.min(500, Math.floor(patch.worktreeMaxCount)));
|
|
3684
3701
|
}
|
|
@@ -3761,6 +3778,9 @@ function deleteBranchOnPurgeEnabled(settings = loadAppSettings()) {
|
|
|
3761
3778
|
function cowboyModeEnabled(settings = loadAppSettings()) {
|
|
3762
3779
|
return Boolean(settings.advanced.cowboyMode);
|
|
3763
3780
|
}
|
|
3781
|
+
function wakeOrchestratorOnGithubEdgesEnabled(settings = loadAppSettings()) {
|
|
3782
|
+
return Boolean(settings.advanced.wakeOrchestratorOnGithubEdges);
|
|
3783
|
+
}
|
|
3764
3784
|
function showCostEnabled(settings = loadAppSettings()) {
|
|
3765
3785
|
return Boolean(settings.advanced.showCost);
|
|
3766
3786
|
}
|
|
@@ -3812,6 +3832,14 @@ function maxConcurrentAgents(settings = loadAppSettings()) {
|
|
|
3812
3832
|
}
|
|
3813
3833
|
return 5;
|
|
3814
3834
|
}
|
|
3835
|
+
function clampMaxOrchThreads(n) {
|
|
3836
|
+
return Math.max(MAX_ORCH_THREADS_MIN, Math.min(MAX_ORCH_THREADS_MAX, Math.floor(n)));
|
|
3837
|
+
}
|
|
3838
|
+
function maxOrchThreads(settings = loadAppSettings()) {
|
|
3839
|
+
const n = settings.advanced.maxOrchThreads;
|
|
3840
|
+
if (typeof n === "number" && Number.isFinite(n)) return clampMaxOrchThreads(n);
|
|
3841
|
+
return MAX_ORCH_THREADS_DEFAULT;
|
|
3842
|
+
}
|
|
3815
3843
|
function resolveClaudeExecutable(settings = loadAppSettings()) {
|
|
3816
3844
|
return resolveAgentExecutable("claude", settings);
|
|
3817
3845
|
}
|
|
@@ -3892,7 +3920,7 @@ function childEnvWithAppSettings(extra) {
|
|
|
3892
3920
|
function harnessEnvKey(harness) {
|
|
3893
3921
|
return HARNESS_ENV_KEYS[harness];
|
|
3894
3922
|
}
|
|
3895
|
-
var import_node_crypto3, import_node_fs9, import_node_os4, import_node_path11, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, DEFAULT_CLI_BIN;
|
|
3923
|
+
var import_node_crypto3, import_node_fs9, import_node_os4, import_node_path11, HARNESS_ENV_KEYS, DEFAULT_AGENTS, GITHUB_GIT_AUTH_MODES, FOLLOW_UP_BEHAVIORS, AGENT_DONE_SOUNDS, CHAT_TEXT_SCALES, CHAT_TEXT_SCALE_DEFAULT, INTEGRATION_VAULT_KEYS, CLOUD_CONNECT_AGENTS, ISSUE_SOURCES, GIT_AUTH_MODES, REVIEW_LABEL_MAX, EMPTY_SETTINGS, CONFIRM_ACCOUNT, CONFIRM_PROJECT, MAX_ORCH_THREADS_DEFAULT, MAX_ORCH_THREADS_MIN, MAX_ORCH_THREADS_MAX, DEFAULT_CLI_BIN;
|
|
3896
3924
|
var init_app_settings = __esm({
|
|
3897
3925
|
"src/store/app-settings.ts"() {
|
|
3898
3926
|
"use strict";
|
|
@@ -3989,6 +4017,9 @@ var init_app_settings = __esm({
|
|
|
3989
4017
|
};
|
|
3990
4018
|
CONFIRM_ACCOUNT = "Show the user the proposed account context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
|
|
3991
4019
|
CONFIRM_PROJECT = "Show the user the proposed project context, call ask_user (Save this context / Do not save), wait for their answer, then retry with confirmed=true.";
|
|
4020
|
+
MAX_ORCH_THREADS_DEFAULT = 5;
|
|
4021
|
+
MAX_ORCH_THREADS_MIN = 1;
|
|
4022
|
+
MAX_ORCH_THREADS_MAX = 32;
|
|
3992
4023
|
DEFAULT_CLI_BIN = {
|
|
3993
4024
|
claude: "claude",
|
|
3994
4025
|
codex: "codex",
|
|
@@ -5454,6 +5485,35 @@ function normalizeAttachments(raw) {
|
|
|
5454
5485
|
}
|
|
5455
5486
|
return out;
|
|
5456
5487
|
}
|
|
5488
|
+
function normalizeRunList(raw) {
|
|
5489
|
+
if (!Array.isArray(raw)) return [];
|
|
5490
|
+
const out = [];
|
|
5491
|
+
for (const item of raw) {
|
|
5492
|
+
if (!item || typeof item !== "object") continue;
|
|
5493
|
+
const row2 = item;
|
|
5494
|
+
if (typeof row2.at !== "string" || !row2.at.trim()) continue;
|
|
5495
|
+
const next = {
|
|
5496
|
+
at: row2.at,
|
|
5497
|
+
threadId: typeof row2.threadId === "string" && row2.threadId.trim() ? row2.threadId.trim() : null
|
|
5498
|
+
};
|
|
5499
|
+
if (typeof row2.error === "string" && row2.error.trim()) next.error = row2.error;
|
|
5500
|
+
out.push(next);
|
|
5501
|
+
if (out.length >= SCHEDULE_RUN_HISTORY_LIMIT) break;
|
|
5502
|
+
}
|
|
5503
|
+
return out;
|
|
5504
|
+
}
|
|
5505
|
+
function runsFromStored(raw) {
|
|
5506
|
+
if (Array.isArray(raw.runs)) return normalizeRunList(raw.runs);
|
|
5507
|
+
if (typeof raw.lastRunAt === "string" && raw.lastRunAt.trim()) {
|
|
5508
|
+
const one = {
|
|
5509
|
+
at: raw.lastRunAt,
|
|
5510
|
+
threadId: raw.lastThreadId?.trim() || null
|
|
5511
|
+
};
|
|
5512
|
+
if (typeof raw.lastError === "string" && raw.lastError.trim()) one.error = raw.lastError;
|
|
5513
|
+
return [one];
|
|
5514
|
+
}
|
|
5515
|
+
return [];
|
|
5516
|
+
}
|
|
5457
5517
|
function normalizeTask(raw) {
|
|
5458
5518
|
const when = normalizeWhen(raw.when);
|
|
5459
5519
|
const agent = raw.agent && isOrchestratorCapableAgent(raw.agent) ? raw.agent : null;
|
|
@@ -5476,6 +5536,7 @@ function normalizeTask(raw) {
|
|
|
5476
5536
|
lastRunAt: raw.lastRunAt ?? null,
|
|
5477
5537
|
lastThreadId: raw.lastThreadId ?? null,
|
|
5478
5538
|
lastError: raw.lastError ?? null,
|
|
5539
|
+
runs: runsFromStored(raw),
|
|
5479
5540
|
createdBy: raw.createdBy === "mcp" || raw.createdBy === "cli" || raw.createdBy === "ui" ? raw.createdBy : "ui",
|
|
5480
5541
|
createdAt: raw.createdAt,
|
|
5481
5542
|
updatedAt: raw.updatedAt
|
|
@@ -5528,6 +5589,7 @@ function buildTask(input, now) {
|
|
|
5528
5589
|
lastRunAt: null,
|
|
5529
5590
|
lastThreadId: null,
|
|
5530
5591
|
lastError: null,
|
|
5592
|
+
runs: [],
|
|
5531
5593
|
createdBy: input.createdBy,
|
|
5532
5594
|
createdAt: ts,
|
|
5533
5595
|
updatedAt: ts
|
|
@@ -5620,20 +5682,25 @@ function recordScheduleRun(id, result) {
|
|
|
5620
5682
|
if (idx < 0) throw new Error(`Automation not found: ${id}`);
|
|
5621
5683
|
const prev = rows[idx];
|
|
5622
5684
|
const firedAt = result.firedAt ?? /* @__PURE__ */ new Date();
|
|
5685
|
+
const at = nowIso(firedAt);
|
|
5686
|
+
const threadId = result.lastThreadId !== void 0 ? result.lastThreadId?.trim() || null : null;
|
|
5687
|
+
const entry = { at, threadId };
|
|
5688
|
+
if (result.lastError?.trim()) entry.error = result.lastError;
|
|
5623
5689
|
const next = {
|
|
5624
5690
|
...prev,
|
|
5625
5691
|
enabled: prev.when.kind === "once" ? false : prev.enabled,
|
|
5626
5692
|
nextRunAt: prev.when.kind === "once" ? prev.nextRunAt : computeNextRunAt(prev.when, firedAt).toISOString(),
|
|
5627
|
-
lastRunAt:
|
|
5693
|
+
lastRunAt: at,
|
|
5628
5694
|
lastThreadId: result.lastThreadId !== void 0 ? result.lastThreadId : prev.lastThreadId,
|
|
5629
5695
|
lastError: result.lastError ?? null,
|
|
5630
|
-
|
|
5696
|
+
runs: [entry, ...prev.runs].slice(0, SCHEDULE_RUN_HISTORY_LIMIT),
|
|
5697
|
+
updatedAt: at
|
|
5631
5698
|
};
|
|
5632
5699
|
rows[idx] = next;
|
|
5633
5700
|
writeAll(rows);
|
|
5634
5701
|
return next;
|
|
5635
5702
|
}
|
|
5636
|
-
var import_node_crypto5, import_node_fs12, import_node_path15, ATTACHMENT_KINDS;
|
|
5703
|
+
var import_node_crypto5, import_node_fs12, import_node_path15, SCHEDULE_RUN_HISTORY_LIMIT, ATTACHMENT_KINDS;
|
|
5637
5704
|
var init_schedules = __esm({
|
|
5638
5705
|
"src/store/schedules.ts"() {
|
|
5639
5706
|
"use strict";
|
|
@@ -5647,6 +5714,7 @@ var init_schedules = __esm({
|
|
|
5647
5714
|
init_private_file();
|
|
5648
5715
|
init_app_settings();
|
|
5649
5716
|
init_schedule_when();
|
|
5717
|
+
SCHEDULE_RUN_HISTORY_LIMIT = 10;
|
|
5650
5718
|
ATTACHMENT_KINDS = /* @__PURE__ */ new Set([
|
|
5651
5719
|
"transcript",
|
|
5652
5720
|
"file",
|
|
@@ -5750,6 +5818,7 @@ function normalizeThread(raw) {
|
|
|
5750
5818
|
prIsInMergeQueue: Boolean(raw.prIsInMergeQueue),
|
|
5751
5819
|
prLabels: Array.isArray(raw.prLabels) ? raw.prLabels : [],
|
|
5752
5820
|
prChecksFailed: typeof raw.prChecksFailed === "boolean" ? raw.prChecksFailed : void 0,
|
|
5821
|
+
wakeOnGithubEdges: raw.wakeOnGithubEdges === true ? true : void 0,
|
|
5753
5822
|
issueBlockedBy: sanitizeIssueBlockedBy(raw.issueBlockedBy),
|
|
5754
5823
|
skipAutoArchiveOnMerge: Boolean(raw.skipAutoArchiveOnMerge),
|
|
5755
5824
|
cowboy: Boolean(raw.cowboy),
|
|
@@ -5794,6 +5863,7 @@ function createEmptyThread(partial) {
|
|
|
5794
5863
|
prIsInMergeQueue: Boolean(partial.prIsInMergeQueue),
|
|
5795
5864
|
prLabels: partial.prLabels ?? [],
|
|
5796
5865
|
prChecksFailed: partial.prChecksFailed,
|
|
5866
|
+
...partial.wakeOnGithubEdges === true ? { wakeOnGithubEdges: true } : {},
|
|
5797
5867
|
skipAutoArchiveOnMerge: partial.skipAutoArchiveOnMerge ?? false,
|
|
5798
5868
|
cowboy: Boolean(partial.cowboy),
|
|
5799
5869
|
stackId: partial.stackId ?? null,
|
|
@@ -6600,6 +6670,7 @@ function toolDescription(name, input) {
|
|
|
6600
6670
|
if (/get_orchestrator$/i.test(name)) return "Get orchestrator";
|
|
6601
6671
|
else if (/notify_orchestrator$/i.test(name)) return "Notify orchestrator";
|
|
6602
6672
|
else if (/set_workspace_tags$/i.test(name)) return "Set workspace tags";
|
|
6673
|
+
else if (/set_wake_on_github_edges$/i.test(name)) return "Wake on CI / review";
|
|
6603
6674
|
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
6675
|
if (/list_schedules$/i.test(name)) return "List automations";
|
|
6605
6676
|
if (/create_schedule$/i.test(name)) {
|
|
@@ -8538,9 +8609,9 @@ function mergeSetupOutput(prev, incoming) {
|
|
|
8538
8609
|
return incoming.length >= prev.length ? incoming : prev;
|
|
8539
8610
|
}
|
|
8540
8611
|
function persistNow(threadId) {
|
|
8541
|
-
const
|
|
8542
|
-
if (
|
|
8543
|
-
clearTimeout(
|
|
8612
|
+
const timer2 = persistTimers.get(threadId);
|
|
8613
|
+
if (timer2) {
|
|
8614
|
+
clearTimeout(timer2);
|
|
8544
8615
|
persistTimers.delete(threadId);
|
|
8545
8616
|
}
|
|
8546
8617
|
const mem = memory.get(threadId);
|
|
@@ -8696,9 +8767,9 @@ function sliceRunLogOutput(output, tailChars = DEFAULT_RUN_LOG_TAIL_CHARS) {
|
|
|
8696
8767
|
return { output: text7, truncated: true, outputChars };
|
|
8697
8768
|
}
|
|
8698
8769
|
function persistNow2(key) {
|
|
8699
|
-
const
|
|
8700
|
-
if (
|
|
8701
|
-
clearTimeout(
|
|
8770
|
+
const timer2 = persistTimers2.get(key);
|
|
8771
|
+
if (timer2) {
|
|
8772
|
+
clearTimeout(timer2);
|
|
8702
8773
|
persistTimers2.delete(key);
|
|
8703
8774
|
}
|
|
8704
8775
|
const mem = memory2.get(key);
|
|
@@ -10677,11 +10748,16 @@ async function listCursorPrs(repoPath, slug, opts, head) {
|
|
|
10677
10748
|
}
|
|
10678
10749
|
}
|
|
10679
10750
|
const { stdout, exitCode } = await originCli(args, repoPath, { reject: false, timeoutMs: 2e4 });
|
|
10680
|
-
if (exitCode !== 0
|
|
10751
|
+
if (exitCode !== 0) {
|
|
10752
|
+
if (opts?.strict) throw new Error(`origin pr list failed (${exitCode})`);
|
|
10753
|
+
return [];
|
|
10754
|
+
}
|
|
10755
|
+
if (!stdout.trim()) return [];
|
|
10681
10756
|
let parsed;
|
|
10682
10757
|
try {
|
|
10683
10758
|
parsed = JSON.parse(stdout);
|
|
10684
10759
|
} catch {
|
|
10760
|
+
if (opts?.strict) throw new Error("origin pr list returned invalid JSON");
|
|
10685
10761
|
return [];
|
|
10686
10762
|
}
|
|
10687
10763
|
if (!Array.isArray(parsed)) return [];
|
|
@@ -10783,21 +10859,23 @@ async function fetchCursorPrHead(repoPath, slug, number, localBranch) {
|
|
|
10783
10859
|
throw new Error((result.stderr || result.stdout).trim() || `git fetch origin ${head} failed`);
|
|
10784
10860
|
}
|
|
10785
10861
|
}
|
|
10786
|
-
async function
|
|
10862
|
+
async function cursorPrCiChecks(repoPath, slug, selector) {
|
|
10787
10863
|
const { stdout, exitCode, stderr } = await originCli(
|
|
10788
10864
|
["pr", "checks", selector, ...repoArgs(slug), "--json", "name,status,conclusion,detailsUrl,startedAt,completedAt,summary,group,link"],
|
|
10789
10865
|
repoPath,
|
|
10790
10866
|
{ reject: false, timeoutMs: 2e4 }
|
|
10791
10867
|
);
|
|
10792
10868
|
const err = stderr.trim();
|
|
10793
|
-
let ci;
|
|
10794
10869
|
if (!stdout.trim()) {
|
|
10795
10870
|
if (/no pull request|not found|no change/i.test(err)) return null;
|
|
10796
10871
|
if (exitCode !== 0 && err) throw new Error(err);
|
|
10797
|
-
|
|
10798
|
-
} else {
|
|
10799
|
-
ci = originChecksToRuns(stdout);
|
|
10872
|
+
return [];
|
|
10800
10873
|
}
|
|
10874
|
+
return originChecksToRuns(stdout);
|
|
10875
|
+
}
|
|
10876
|
+
async function cursorPrChecks(repoPath, slug, selector) {
|
|
10877
|
+
const ci = await cursorPrCiChecks(repoPath, slug, selector);
|
|
10878
|
+
if (!ci) return null;
|
|
10801
10879
|
const view = await viewCursorPr(
|
|
10802
10880
|
repoPath,
|
|
10803
10881
|
slug,
|
|
@@ -11179,6 +11257,7 @@ __export(worktree_exports, {
|
|
|
11179
11257
|
fetchPrHead: () => fetchPrHead,
|
|
11180
11258
|
getPr: () => getPr,
|
|
11181
11259
|
getPrChecks: () => getPrChecks,
|
|
11260
|
+
getPrCiChecks: () => getPrCiChecks,
|
|
11182
11261
|
getPrDetails: () => getPrDetails,
|
|
11183
11262
|
getPrForHeadBranch: () => getPrForHeadBranch,
|
|
11184
11263
|
getPrMeta: () => getPrMeta,
|
|
@@ -11466,7 +11545,11 @@ async function listPrs(repoPath, opts) {
|
|
|
11466
11545
|
limit: fetchLimit
|
|
11467
11546
|
});
|
|
11468
11547
|
const { stdout, exitCode } = await gh(args, repoPath, { reject: false });
|
|
11469
|
-
if (exitCode !== 0
|
|
11548
|
+
if (exitCode !== 0) {
|
|
11549
|
+
if (opts?.strict) throw new Error(`gh pr list failed (${exitCode})`);
|
|
11550
|
+
return [];
|
|
11551
|
+
}
|
|
11552
|
+
if (!stdout.trim()) return [];
|
|
11470
11553
|
return applyPrListResponse(stdout, { ...resolved, limit, viewerTeams });
|
|
11471
11554
|
}
|
|
11472
11555
|
function prInfoFromGhView(view) {
|
|
@@ -11728,12 +11811,7 @@ async function probeLocalMergeGate(cwd, gate) {
|
|
|
11728
11811
|
}
|
|
11729
11812
|
return { gate, files: [] };
|
|
11730
11813
|
}
|
|
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);
|
|
11814
|
+
async function readGhPrChecks(cwd, selector, slug) {
|
|
11737
11815
|
const args = [
|
|
11738
11816
|
"pr",
|
|
11739
11817
|
"checks",
|
|
@@ -11744,7 +11822,6 @@ async function getPrChecks(cwd, selector) {
|
|
|
11744
11822
|
if (slug) args.push("--repo", slug);
|
|
11745
11823
|
const { stdout, exitCode, stderr } = await gh(args, cwd, { reject: false });
|
|
11746
11824
|
const errText2 = stderr.trim();
|
|
11747
|
-
let ciChecks;
|
|
11748
11825
|
if (!stdout.trim()) {
|
|
11749
11826
|
if (/no pull requests found/i.test(errText2)) return null;
|
|
11750
11827
|
if (/auth|login|HTTP\s*401|credentials|token/i.test(errText2)) {
|
|
@@ -11754,18 +11831,34 @@ async function getPrChecks(cwd, selector) {
|
|
|
11754
11831
|
if (exitCode === 1 && errText2 && !/fail|check/i.test(errText2)) {
|
|
11755
11832
|
throw new Error(errText2);
|
|
11756
11833
|
}
|
|
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");
|
|
11834
|
+
return [];
|
|
11767
11835
|
}
|
|
11836
|
+
throw new Error(errText2 || `gh pr checks failed (${exitCode})`);
|
|
11837
|
+
}
|
|
11838
|
+
try {
|
|
11839
|
+
const parsed = JSON.parse(stdout);
|
|
11840
|
+
return parsed.map(normalizeCheck);
|
|
11841
|
+
} catch {
|
|
11842
|
+
throw new Error(errText2 || "gh pr checks returned invalid JSON");
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11845
|
+
async function getPrCiChecks(cwd, selector) {
|
|
11846
|
+
const origin = await resolveOriginRemote(cwd);
|
|
11847
|
+
if (origin?.forge === "entire") return null;
|
|
11848
|
+
if (origin?.forge === "cursor" && origin.slug) {
|
|
11849
|
+
return cursorPrCiChecks(cwd, origin.slug, selector);
|
|
11768
11850
|
}
|
|
11851
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
11852
|
+
return readGhPrChecks(cwd, selector, slug);
|
|
11853
|
+
}
|
|
11854
|
+
async function getPrChecks(cwd, selector) {
|
|
11855
|
+
const origin = await resolveOriginRemote(cwd);
|
|
11856
|
+
if (origin?.forge === "entire") return null;
|
|
11857
|
+
const cursorSlug = origin?.forge === "cursor" ? origin.slug : null;
|
|
11858
|
+
if (cursorSlug) return cursorPrChecks(cwd, cursorSlug, selector);
|
|
11859
|
+
const slug = await resolveGithubRepoSlug(cwd);
|
|
11860
|
+
const ciChecks = await readGhPrChecks(cwd, selector, slug);
|
|
11861
|
+
if (!ciChecks) return null;
|
|
11769
11862
|
let gate = await fetchPrMergeGate(cwd, selector, slug);
|
|
11770
11863
|
const probed = await probeLocalMergeGate(cwd, gate);
|
|
11771
11864
|
gate = probed.gate;
|
|
@@ -13230,12 +13323,13 @@ var init_coordinator_prompt = __esm({
|
|
|
13230
13323
|
"- 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
13324
|
"- 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
13325
|
"- 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
|
|
13326
|
+
"- 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
13327
|
"Projects:",
|
|
13235
13328
|
"- add_project / remove_project \u2014 register or unregister a git repo",
|
|
13236
13329
|
"Workspaces and chats:",
|
|
13237
13330
|
'- 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
|
-
"-
|
|
13331
|
+
"- One orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.",
|
|
13332
|
+
"- 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
13333
|
"- 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
13334
|
"- start_board_card \u2014 same as create_workspace for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_chat.",
|
|
13241
13335
|
"- 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 +13704,19 @@ function traceTurn(phase, extra) {
|
|
|
13610
13704
|
}
|
|
13611
13705
|
}
|
|
13612
13706
|
async function withTimeout(promise, ms, label) {
|
|
13613
|
-
let
|
|
13707
|
+
let timer2;
|
|
13614
13708
|
try {
|
|
13615
13709
|
return await Promise.race([
|
|
13616
13710
|
promise,
|
|
13617
13711
|
new Promise((_, reject) => {
|
|
13618
|
-
|
|
13712
|
+
timer2 = setTimeout(
|
|
13619
13713
|
() => reject(new Error(`${label} timed out after ${ms}ms`)),
|
|
13620
13714
|
ms
|
|
13621
13715
|
);
|
|
13622
13716
|
})
|
|
13623
13717
|
]);
|
|
13624
13718
|
} finally {
|
|
13625
|
-
if (
|
|
13719
|
+
if (timer2) clearTimeout(timer2);
|
|
13626
13720
|
}
|
|
13627
13721
|
}
|
|
13628
13722
|
var import_node_fs27, import_node_path31;
|
|
@@ -15297,6 +15391,7 @@ var init_profile = __esm({
|
|
|
15297
15391
|
"get_orchestrator",
|
|
15298
15392
|
"notify_orchestrator",
|
|
15299
15393
|
"set_workspace_tags",
|
|
15394
|
+
"set_wake_on_github_edges",
|
|
15300
15395
|
"get_viewer_context",
|
|
15301
15396
|
"update_viewer_context",
|
|
15302
15397
|
"list_env",
|
|
@@ -16145,6 +16240,7 @@ var init_injected_mcp = __esm({
|
|
|
16145
16240
|
"mcp__sideboard__get_orchestrator",
|
|
16146
16241
|
"mcp__sideboard__notify_orchestrator",
|
|
16147
16242
|
"mcp__sideboard__set_workspace_tags",
|
|
16243
|
+
"mcp__sideboard__set_wake_on_github_edges",
|
|
16148
16244
|
"mcp__sideboard__get_viewer_context",
|
|
16149
16245
|
"mcp__sideboard__update_viewer_context",
|
|
16150
16246
|
"mcp__sideboard__list_env",
|
|
@@ -17642,12 +17738,12 @@ async function startLinearOAuth(opts) {
|
|
|
17642
17738
|
finish2(e instanceof Error ? e : new Error(String(e)));
|
|
17643
17739
|
}
|
|
17644
17740
|
});
|
|
17645
|
-
const
|
|
17741
|
+
const timer2 = setTimeout(() => {
|
|
17646
17742
|
finish2(new Error("Linear sign-in timed out \u2014 try again"));
|
|
17647
17743
|
}, timeoutMs);
|
|
17648
17744
|
const onAbort = () => finish2(new LinearOAuthCancelledError());
|
|
17649
17745
|
const cleanup = () => {
|
|
17650
|
-
clearTimeout(
|
|
17746
|
+
clearTimeout(timer2);
|
|
17651
17747
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
17652
17748
|
server.close();
|
|
17653
17749
|
};
|
|
@@ -18899,16 +18995,16 @@ async function listAssignedLinearIssues(opts) {
|
|
|
18899
18995
|
try {
|
|
18900
18996
|
const { listLinearIssuesDirect: listLinearIssuesDirect2 } = await Promise.resolve().then(() => (init_linear(), linear_exports));
|
|
18901
18997
|
const listed = listLinearIssuesDirect2({ limit: 50 }).catch(() => []);
|
|
18902
|
-
let
|
|
18998
|
+
let timer2;
|
|
18903
18999
|
try {
|
|
18904
19000
|
return await Promise.race([
|
|
18905
19001
|
listed,
|
|
18906
19002
|
new Promise((resolve3) => {
|
|
18907
|
-
|
|
19003
|
+
timer2 = setTimeout(() => resolve3([]), opts?.timeoutMs ?? LIST_TIMEOUT_MS);
|
|
18908
19004
|
})
|
|
18909
19005
|
]);
|
|
18910
19006
|
} finally {
|
|
18911
|
-
if (
|
|
19007
|
+
if (timer2) clearTimeout(timer2);
|
|
18912
19008
|
}
|
|
18913
19009
|
} catch {
|
|
18914
19010
|
return [];
|
|
@@ -21642,7 +21738,7 @@ async function getClaudePlanUsage(opts = {}) {
|
|
|
21642
21738
|
const fetchFn = opts.fetch ?? httpFetch;
|
|
21643
21739
|
const userAgent = opts.userAgent ?? await resolveClaudeUserAgent();
|
|
21644
21740
|
const ac = new AbortController();
|
|
21645
|
-
const
|
|
21741
|
+
const timer2 = setTimeout(() => ac.abort(), 8e3);
|
|
21646
21742
|
let res;
|
|
21647
21743
|
try {
|
|
21648
21744
|
res = await fetchFn(CLAUDE_OAUTH_USAGE_URL, {
|
|
@@ -21654,7 +21750,7 @@ async function getClaudePlanUsage(opts = {}) {
|
|
|
21654
21750
|
signal: ac.signal
|
|
21655
21751
|
});
|
|
21656
21752
|
} finally {
|
|
21657
|
-
clearTimeout(
|
|
21753
|
+
clearTimeout(timer2);
|
|
21658
21754
|
}
|
|
21659
21755
|
if (res.status === 401 || res.status === 403) {
|
|
21660
21756
|
cache = { at: now, dir: cacheDirKey, value: null };
|
|
@@ -22392,11 +22488,11 @@ function parentKey(event) {
|
|
|
22392
22488
|
function createAgentStreamCoalescer(emit, opts) {
|
|
22393
22489
|
const intervalMs = opts?.intervalMs ?? 32;
|
|
22394
22490
|
let pending = null;
|
|
22395
|
-
let
|
|
22491
|
+
let timer2 = null;
|
|
22396
22492
|
const flush2 = () => {
|
|
22397
|
-
if (
|
|
22398
|
-
clearTimeout(
|
|
22399
|
-
|
|
22493
|
+
if (timer2) {
|
|
22494
|
+
clearTimeout(timer2);
|
|
22495
|
+
timer2 = null;
|
|
22400
22496
|
}
|
|
22401
22497
|
if (!pending) return;
|
|
22402
22498
|
const event = pending;
|
|
@@ -22408,9 +22504,9 @@ function createAgentStreamCoalescer(emit, opts) {
|
|
|
22408
22504
|
});
|
|
22409
22505
|
};
|
|
22410
22506
|
const schedule = () => {
|
|
22411
|
-
if (
|
|
22412
|
-
|
|
22413
|
-
|
|
22507
|
+
if (timer2) return;
|
|
22508
|
+
timer2 = setTimeout(flush2, intervalMs);
|
|
22509
|
+
timer2.unref?.();
|
|
22414
22510
|
};
|
|
22415
22511
|
return {
|
|
22416
22512
|
push(event) {
|
|
@@ -22664,9 +22760,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
22664
22760
|
}
|
|
22665
22761
|
};
|
|
22666
22762
|
signal("SIGTERM");
|
|
22667
|
-
const
|
|
22668
|
-
|
|
22669
|
-
child.once("exit", () => clearTimeout(
|
|
22763
|
+
const timer2 = setTimeout(() => signal("SIGKILL"), 5e3);
|
|
22764
|
+
timer2.unref?.();
|
|
22765
|
+
child.once("exit", () => clearTimeout(timer2));
|
|
22670
22766
|
},
|
|
22671
22767
|
done
|
|
22672
22768
|
};
|
|
@@ -23589,6 +23685,7 @@ function worktreeBindingFrom(from) {
|
|
|
23589
23685
|
prIsInMergeQueue: from.prIsInMergeQueue,
|
|
23590
23686
|
prLabels: from.prLabels,
|
|
23591
23687
|
prChecksFailed: from.prChecksFailed,
|
|
23688
|
+
wakeOnGithubEdges: from.wakeOnGithubEdges,
|
|
23592
23689
|
issueBlockedBy: from.issueBlockedBy,
|
|
23593
23690
|
skipAutoArchiveOnMerge: from.skipAutoArchiveOnMerge,
|
|
23594
23691
|
stackId: from.stackId,
|
|
@@ -26726,12 +26823,12 @@ async function startAbleTimeOAuth(opts) {
|
|
|
26726
26823
|
finish2(e instanceof Error ? e : new Error(String(e)));
|
|
26727
26824
|
}
|
|
26728
26825
|
});
|
|
26729
|
-
const
|
|
26826
|
+
const timer2 = setTimeout(() => {
|
|
26730
26827
|
finish2(new Error("AbleTime sign-in timed out \u2014 try again"));
|
|
26731
26828
|
}, timeoutMs);
|
|
26732
26829
|
const onAbort = () => finish2(new AbleTimeOAuthCancelledError());
|
|
26733
26830
|
const cleanup = () => {
|
|
26734
|
-
clearTimeout(
|
|
26831
|
+
clearTimeout(timer2);
|
|
26735
26832
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
26736
26833
|
server.close();
|
|
26737
26834
|
};
|
|
@@ -28719,11 +28816,11 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
28719
28816
|
const delayMs = opts?.delayMs ?? 50;
|
|
28720
28817
|
const maxLines = opts?.maxLines ?? 200;
|
|
28721
28818
|
let buffer = [];
|
|
28722
|
-
let
|
|
28819
|
+
let timer2 = null;
|
|
28723
28820
|
const flush2 = () => {
|
|
28724
|
-
if (
|
|
28725
|
-
clearTimeout(
|
|
28726
|
-
|
|
28821
|
+
if (timer2) {
|
|
28822
|
+
clearTimeout(timer2);
|
|
28823
|
+
timer2 = null;
|
|
28727
28824
|
}
|
|
28728
28825
|
if (buffer.length === 0) return;
|
|
28729
28826
|
const chunk = buffer.join("\n");
|
|
@@ -28736,7 +28833,7 @@ function createLineCoalescer(onChunk, opts) {
|
|
|
28736
28833
|
flush2();
|
|
28737
28834
|
return;
|
|
28738
28835
|
}
|
|
28739
|
-
if (!
|
|
28836
|
+
if (!timer2) timer2 = setTimeout(flush2, delayMs);
|
|
28740
28837
|
};
|
|
28741
28838
|
return { push: push2, flush: flush2 };
|
|
28742
28839
|
}
|
|
@@ -31758,7 +31855,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
31758
31855
|
);
|
|
31759
31856
|
}
|
|
31760
31857
|
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
|
|
31858
|
+
'- 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
31859
|
);
|
|
31763
31860
|
lines.push("");
|
|
31764
31861
|
lines.push(formatDevAccessHint(opts?.activeRuns));
|
|
@@ -31767,7 +31864,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
31767
31864
|
"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
31865
|
);
|
|
31769
31866
|
lines.push(
|
|
31770
|
-
"`set_workspace_tags` labels this checkout (omit ref
|
|
31867
|
+
"`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
31868
|
);
|
|
31772
31869
|
lines.push(
|
|
31773
31870
|
"Orchestration: `show_plan` opens the diagram and plan.md. `list_order` / `set_dependency`"
|
|
@@ -32817,6 +32914,622 @@ var init_sync_branch = __esm({
|
|
|
32817
32914
|
}
|
|
32818
32915
|
});
|
|
32819
32916
|
|
|
32917
|
+
// src/orchestrator/github-edge.ts
|
|
32918
|
+
function emptyGithubEdgeSnapshot() {
|
|
32919
|
+
return { primed: false, ciFailed: [], reviewRequested: [], lastFiredAt: {} };
|
|
32920
|
+
}
|
|
32921
|
+
function normalizePrUrl(raw) {
|
|
32922
|
+
const trimmed = (raw ?? "").trim();
|
|
32923
|
+
if (!trimmed) return "";
|
|
32924
|
+
try {
|
|
32925
|
+
const url = new URL(trimmed);
|
|
32926
|
+
url.hash = "";
|
|
32927
|
+
url.search = "";
|
|
32928
|
+
const path2 = url.pathname.replace(/\/+$/, "");
|
|
32929
|
+
return `${url.protocol}//${url.host.toLowerCase()}${path2}`;
|
|
32930
|
+
} catch {
|
|
32931
|
+
return trimmed.replace(/\/+$/, "");
|
|
32932
|
+
}
|
|
32933
|
+
}
|
|
32934
|
+
function githubEdgeKey(kind, prUrl) {
|
|
32935
|
+
return `${kind}:${normalizePrUrl(prUrl)}`;
|
|
32936
|
+
}
|
|
32937
|
+
function acceptOpenReadyPr(row2) {
|
|
32938
|
+
if (!normalizePrUrl(row2.prUrl)) return false;
|
|
32939
|
+
if (row2.draft === true) return false;
|
|
32940
|
+
const state = (row2.state ?? "").trim().toUpperCase();
|
|
32941
|
+
return state !== "MERGED" && state !== "CLOSED";
|
|
32942
|
+
}
|
|
32943
|
+
function mergeCiLatch(prev, failing, unknown) {
|
|
32944
|
+
const out = /* @__PURE__ */ new Set();
|
|
32945
|
+
for (const url of failing) {
|
|
32946
|
+
const normalized = normalizePrUrl(url);
|
|
32947
|
+
if (normalized) out.add(normalized);
|
|
32948
|
+
}
|
|
32949
|
+
const unknownSet = new Set(unknown.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
32950
|
+
for (const url of prev) {
|
|
32951
|
+
const normalized = normalizePrUrl(url);
|
|
32952
|
+
if (normalized && unknownSet.has(normalized)) out.add(normalized);
|
|
32953
|
+
}
|
|
32954
|
+
return [...out];
|
|
32955
|
+
}
|
|
32956
|
+
function mergeReviewLatch(prev, fetched, successfulRepos) {
|
|
32957
|
+
const ok = new Set(successfulRepos);
|
|
32958
|
+
const map = /* @__PURE__ */ new Map();
|
|
32959
|
+
for (const row2 of prev) {
|
|
32960
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
32961
|
+
if (!prUrl) continue;
|
|
32962
|
+
if (row2.repoPath && ok.has(row2.repoPath)) continue;
|
|
32963
|
+
if (!row2.repoPath) continue;
|
|
32964
|
+
map.set(prUrl, { prUrl, repoPath: row2.repoPath });
|
|
32965
|
+
}
|
|
32966
|
+
for (const row2 of fetched) {
|
|
32967
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
32968
|
+
if (!prUrl) continue;
|
|
32969
|
+
map.set(prUrl, { prUrl, repoPath: row2.repoPath });
|
|
32970
|
+
}
|
|
32971
|
+
return [...map.values()];
|
|
32972
|
+
}
|
|
32973
|
+
function coerceGithubEdgeSnapshot(raw) {
|
|
32974
|
+
if (!raw || typeof raw !== "object") return emptyGithubEdgeSnapshot();
|
|
32975
|
+
const row2 = raw;
|
|
32976
|
+
const ciFailed = [];
|
|
32977
|
+
const seenCi = /* @__PURE__ */ new Set();
|
|
32978
|
+
if (Array.isArray(row2.ciFailed)) {
|
|
32979
|
+
for (const item of row2.ciFailed) {
|
|
32980
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
32981
|
+
if (!prUrl || seenCi.has(prUrl)) continue;
|
|
32982
|
+
seenCi.add(prUrl);
|
|
32983
|
+
ciFailed.push(prUrl);
|
|
32984
|
+
}
|
|
32985
|
+
}
|
|
32986
|
+
const reviewRequested = [];
|
|
32987
|
+
const seenReview = /* @__PURE__ */ new Set();
|
|
32988
|
+
if (Array.isArray(row2.reviewRequested)) {
|
|
32989
|
+
for (const item of row2.reviewRequested) {
|
|
32990
|
+
if (!item || typeof item !== "object") continue;
|
|
32991
|
+
const record = item;
|
|
32992
|
+
const prUrl = normalizePrUrl(typeof record.prUrl === "string" ? record.prUrl : "");
|
|
32993
|
+
const repoPath = typeof record.repoPath === "string" ? record.repoPath.trim() : "";
|
|
32994
|
+
if (!prUrl || !repoPath || seenReview.has(prUrl)) continue;
|
|
32995
|
+
seenReview.add(prUrl);
|
|
32996
|
+
reviewRequested.push({ prUrl, repoPath });
|
|
32997
|
+
}
|
|
32998
|
+
}
|
|
32999
|
+
const ciSeen = [];
|
|
33000
|
+
const seenCiUrls = /* @__PURE__ */ new Set();
|
|
33001
|
+
if (Array.isArray(row2.ciSeen)) {
|
|
33002
|
+
for (const item of row2.ciSeen) {
|
|
33003
|
+
const prUrl = normalizePrUrl(typeof item === "string" ? item : "");
|
|
33004
|
+
if (!prUrl || seenCiUrls.has(prUrl)) continue;
|
|
33005
|
+
seenCiUrls.add(prUrl);
|
|
33006
|
+
ciSeen.push(prUrl);
|
|
33007
|
+
}
|
|
33008
|
+
}
|
|
33009
|
+
const reviewReposSeen = [];
|
|
33010
|
+
const seenRepos = /* @__PURE__ */ new Set();
|
|
33011
|
+
if (Array.isArray(row2.reviewReposSeen)) {
|
|
33012
|
+
for (const item of row2.reviewReposSeen) {
|
|
33013
|
+
const repo = typeof item === "string" ? item.trim() : "";
|
|
33014
|
+
if (!repo || seenRepos.has(repo)) continue;
|
|
33015
|
+
seenRepos.add(repo);
|
|
33016
|
+
reviewReposSeen.push(repo);
|
|
33017
|
+
}
|
|
33018
|
+
}
|
|
33019
|
+
const lastFiredAt = {};
|
|
33020
|
+
if (row2.lastFiredAt && typeof row2.lastFiredAt === "object") {
|
|
33021
|
+
for (const [key, value] of Object.entries(row2.lastFiredAt)) {
|
|
33022
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
33023
|
+
lastFiredAt[key] = value;
|
|
33024
|
+
}
|
|
33025
|
+
}
|
|
33026
|
+
}
|
|
33027
|
+
return {
|
|
33028
|
+
primed: row2.primed === true,
|
|
33029
|
+
ciFailed,
|
|
33030
|
+
reviewRequested,
|
|
33031
|
+
lastFiredAt,
|
|
33032
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
33033
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
33034
|
+
};
|
|
33035
|
+
}
|
|
33036
|
+
function dedupeSubjects(items) {
|
|
33037
|
+
const map = /* @__PURE__ */ new Map();
|
|
33038
|
+
for (const item of items) {
|
|
33039
|
+
if (!acceptOpenReadyPr(item)) continue;
|
|
33040
|
+
const prUrl = normalizePrUrl(item.prUrl);
|
|
33041
|
+
if (!prUrl) continue;
|
|
33042
|
+
const next = { ...item, prUrl };
|
|
33043
|
+
const prev = map.get(prUrl);
|
|
33044
|
+
if (!prev) {
|
|
33045
|
+
map.set(prUrl, next);
|
|
33046
|
+
continue;
|
|
33047
|
+
}
|
|
33048
|
+
if (!prev.threadId && next.threadId) {
|
|
33049
|
+
map.set(prUrl, {
|
|
33050
|
+
...prev,
|
|
33051
|
+
...next,
|
|
33052
|
+
prUrl,
|
|
33053
|
+
title: next.title.trim() || prev.title
|
|
33054
|
+
});
|
|
33055
|
+
}
|
|
33056
|
+
}
|
|
33057
|
+
return [...map.values()];
|
|
33058
|
+
}
|
|
33059
|
+
function diffGithubEdges(input) {
|
|
33060
|
+
if (!input.prev.primed) return [];
|
|
33061
|
+
const cooldown = input.cooldownMs ?? GITHUB_EDGE_COOLDOWN_MS;
|
|
33062
|
+
const edges = [];
|
|
33063
|
+
const consider = (kind, items, latched) => {
|
|
33064
|
+
for (const item of dedupeSubjects(items)) {
|
|
33065
|
+
if (latched.has(item.prUrl)) continue;
|
|
33066
|
+
const firedAt = input.prev.lastFiredAt[githubEdgeKey(kind, item.prUrl)] ?? 0;
|
|
33067
|
+
if (firedAt && input.now - firedAt < cooldown) continue;
|
|
33068
|
+
edges.push({ ...item, kind });
|
|
33069
|
+
}
|
|
33070
|
+
};
|
|
33071
|
+
consider("ci-failed", input.ciFailed, new Set(input.prev.ciFailed.map((url) => normalizePrUrl(url))));
|
|
33072
|
+
consider(
|
|
33073
|
+
"review-requested",
|
|
33074
|
+
input.reviewRequested,
|
|
33075
|
+
new Set(input.prev.reviewRequested.map((row2) => normalizePrUrl(row2.prUrl)))
|
|
33076
|
+
);
|
|
33077
|
+
return edges;
|
|
33078
|
+
}
|
|
33079
|
+
function commitGithubEdgeSnapshot(input) {
|
|
33080
|
+
const deliveredCi = new Set(
|
|
33081
|
+
input.delivered.filter((edge) => edge.kind === "ci-failed").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
33082
|
+
);
|
|
33083
|
+
const deliveredReview = new Set(
|
|
33084
|
+
input.delivered.filter((edge) => edge.kind === "review-requested").map((edge) => normalizePrUrl(edge.prUrl)).filter(Boolean)
|
|
33085
|
+
);
|
|
33086
|
+
const ciObserved = dedupeSubjects(input.ciFailed).map((item) => item.prUrl);
|
|
33087
|
+
const ciFailed = nextUrls(input.prev.primed, input.prev.ciFailed, ciObserved, deliveredCi);
|
|
33088
|
+
const reviewRequested = nextReviewLatch(
|
|
33089
|
+
input.prev.primed,
|
|
33090
|
+
input.reviewRequested,
|
|
33091
|
+
input.prev.reviewRequested,
|
|
33092
|
+
deliveredReview
|
|
33093
|
+
);
|
|
33094
|
+
const lastFiredAt = {};
|
|
33095
|
+
for (const [key, at] of Object.entries(input.prev.lastFiredAt)) {
|
|
33096
|
+
if (input.now - at <= LAST_FIRED_KEEP_MS) lastFiredAt[key] = at;
|
|
33097
|
+
}
|
|
33098
|
+
for (const edge of input.delivered) {
|
|
33099
|
+
const prUrl = normalizePrUrl(edge.prUrl);
|
|
33100
|
+
if (!prUrl) continue;
|
|
33101
|
+
lastFiredAt[githubEdgeKey(edge.kind, prUrl)] = input.now;
|
|
33102
|
+
}
|
|
33103
|
+
return { primed: true, ciFailed, reviewRequested, lastFiredAt };
|
|
33104
|
+
}
|
|
33105
|
+
function nextUrls(primed, prev, observed, delivered) {
|
|
33106
|
+
const prevSet = new Set(prev.map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
33107
|
+
const out = [];
|
|
33108
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33109
|
+
for (const url of observed) {
|
|
33110
|
+
if (!url || seen.has(url)) continue;
|
|
33111
|
+
seen.add(url);
|
|
33112
|
+
if (!primed || prevSet.has(url) || delivered.has(url)) out.push(url);
|
|
33113
|
+
}
|
|
33114
|
+
return out;
|
|
33115
|
+
}
|
|
33116
|
+
function nextReviewLatch(primed, observed, prev, delivered) {
|
|
33117
|
+
const prevSet = new Set(prev.map((row2) => normalizePrUrl(row2.prUrl)).filter(Boolean));
|
|
33118
|
+
const out = [];
|
|
33119
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33120
|
+
for (const row2 of observed) {
|
|
33121
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
33122
|
+
const repoPath = row2.repoPath.trim();
|
|
33123
|
+
if (!prUrl || !repoPath || seen.has(prUrl)) continue;
|
|
33124
|
+
seen.add(prUrl);
|
|
33125
|
+
if (!primed || prevSet.has(prUrl) || delivered.has(prUrl)) {
|
|
33126
|
+
out.push({ prUrl, repoPath });
|
|
33127
|
+
}
|
|
33128
|
+
}
|
|
33129
|
+
return out;
|
|
33130
|
+
}
|
|
33131
|
+
function formatGithubEdgePrompt(edges) {
|
|
33132
|
+
const lines = edges.map((edge) => {
|
|
33133
|
+
const title = edge.title.trim() || "Pull request";
|
|
33134
|
+
const lead = edge.kind === "ci-failed" ? `CI failed on ${title}` : `Review requested: ${title}`;
|
|
33135
|
+
const workspace = edge.threadId && edge.threadTitle?.trim() ? ` ([${edge.threadTitle.trim()}](sideboard://chat/${edge.threadId}))` : edge.threadId ? ` ([workspace](sideboard://chat/${edge.threadId}))` : "";
|
|
33136
|
+
return `${lead} ${edge.prUrl}${workspace}`;
|
|
33137
|
+
});
|
|
33138
|
+
let body = lines.join("\n");
|
|
33139
|
+
if (body.length > 1500) body = `${body.slice(0, 1499)}\u2026`;
|
|
33140
|
+
return [
|
|
33141
|
+
"Sideboard: GitHub update.",
|
|
33142
|
+
body,
|
|
33143
|
+
"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."
|
|
33144
|
+
].join("\n");
|
|
33145
|
+
}
|
|
33146
|
+
function routeGithubEdges(edges, parentIdForThread2, designatedId) {
|
|
33147
|
+
const groups = /* @__PURE__ */ new Map();
|
|
33148
|
+
for (const edge of edges) {
|
|
33149
|
+
const parent = edge.threadId ? parentIdForThread2(edge.threadId)?.trim() || null : null;
|
|
33150
|
+
const targetId = parent || designatedId || null;
|
|
33151
|
+
const key = targetId ?? "";
|
|
33152
|
+
const group = groups.get(key);
|
|
33153
|
+
if (group) group.edges.push(edge);
|
|
33154
|
+
else groups.set(key, { targetId, edges: [edge] });
|
|
33155
|
+
}
|
|
33156
|
+
return [...groups.values()];
|
|
33157
|
+
}
|
|
33158
|
+
function pickDesignatedOrchestratorId(threads) {
|
|
33159
|
+
const live = threads.filter((thread) => thread.status !== "archived" && thread.id.trim());
|
|
33160
|
+
const preferred = live.find((thread) => !thread.cloud);
|
|
33161
|
+
return (preferred ?? live[0])?.id ?? null;
|
|
33162
|
+
}
|
|
33163
|
+
function githubEdgeSnapshotKey(snapshot) {
|
|
33164
|
+
const lastFiredAt = Object.fromEntries(
|
|
33165
|
+
Object.entries(snapshot.lastFiredAt).sort(([a], [b]) => a.localeCompare(b))
|
|
33166
|
+
);
|
|
33167
|
+
return JSON.stringify({
|
|
33168
|
+
primed: snapshot.primed === true,
|
|
33169
|
+
ciFailed: [...snapshot.ciFailed].sort(),
|
|
33170
|
+
reviewRequested: [...snapshot.reviewRequested].map((row2) => ({ prUrl: row2.prUrl, repoPath: row2.repoPath })).sort((a, b) => a.prUrl.localeCompare(b.prUrl) || a.repoPath.localeCompare(b.repoPath)),
|
|
33171
|
+
lastFiredAt,
|
|
33172
|
+
reviewReposSeen: [...snapshot.reviewReposSeen ?? []].sort(),
|
|
33173
|
+
ciSeen: [...snapshot.ciSeen ?? []].sort()
|
|
33174
|
+
});
|
|
33175
|
+
}
|
|
33176
|
+
var GITHUB_EDGE_COOLDOWN_MS, GITHUB_EDGE_POLL_MS, LAST_FIRED_KEEP_MS;
|
|
33177
|
+
var init_github_edge = __esm({
|
|
33178
|
+
"src/orchestrator/github-edge.ts"() {
|
|
33179
|
+
"use strict";
|
|
33180
|
+
GITHUB_EDGE_COOLDOWN_MS = 30 * 6e4;
|
|
33181
|
+
GITHUB_EDGE_POLL_MS = 6e4;
|
|
33182
|
+
LAST_FIRED_KEEP_MS = 7 * 24 * 60 * 6e4;
|
|
33183
|
+
}
|
|
33184
|
+
});
|
|
33185
|
+
|
|
33186
|
+
// src/orchestrator/github-edge-watch.ts
|
|
33187
|
+
function githubEdgeSnapshotPath() {
|
|
33188
|
+
return (0, import_node_path70.join)(appDataDir(), "github-edge-watch.json");
|
|
33189
|
+
}
|
|
33190
|
+
function loadGithubEdgeSnapshot() {
|
|
33191
|
+
try {
|
|
33192
|
+
const path2 = githubEdgeSnapshotPath();
|
|
33193
|
+
if (!(0, import_node_fs70.existsSync)(path2)) return emptyGithubEdgeSnapshot();
|
|
33194
|
+
return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs70.readFileSync)(path2, "utf8")));
|
|
33195
|
+
} catch {
|
|
33196
|
+
return emptyGithubEdgeSnapshot();
|
|
33197
|
+
}
|
|
33198
|
+
}
|
|
33199
|
+
function saveGithubEdgeSnapshot(snapshot) {
|
|
33200
|
+
writePrivateFile(githubEdgeSnapshotPath(), `${JSON.stringify(snapshot, null, 2)}
|
|
33201
|
+
`);
|
|
33202
|
+
}
|
|
33203
|
+
function stopGithubEdgeWatch() {
|
|
33204
|
+
if (timer) clearInterval(timer);
|
|
33205
|
+
timer = null;
|
|
33206
|
+
}
|
|
33207
|
+
function armGithubEdgeWatch() {
|
|
33208
|
+
if (!isThisProcessDesktopHost()) return;
|
|
33209
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
33210
|
+
stopGithubEdgeWatch();
|
|
33211
|
+
needsBaseline = true;
|
|
33212
|
+
return;
|
|
33213
|
+
}
|
|
33214
|
+
if (timer) return;
|
|
33215
|
+
const tick = () => {
|
|
33216
|
+
if (polling) return;
|
|
33217
|
+
polling = true;
|
|
33218
|
+
const baseline = needsBaseline;
|
|
33219
|
+
needsBaseline = false;
|
|
33220
|
+
void pollGithubEdges(realDeps(), { baseline }).catch(() => {
|
|
33221
|
+
if (baseline) needsBaseline = true;
|
|
33222
|
+
}).finally(() => {
|
|
33223
|
+
polling = false;
|
|
33224
|
+
});
|
|
33225
|
+
};
|
|
33226
|
+
timer = setInterval(tick, GITHUB_EDGE_POLL_MS);
|
|
33227
|
+
timer.unref?.();
|
|
33228
|
+
tick();
|
|
33229
|
+
}
|
|
33230
|
+
async function pollGithubEdges(deps = realDeps(), opts) {
|
|
33231
|
+
if (!deps.enabled()) return { fired: 0, primed: false, skipped: "disabled" };
|
|
33232
|
+
const loaded = deps.load();
|
|
33233
|
+
const prev = opts?.baseline ? { ...loaded, primed: false } : loaded;
|
|
33234
|
+
const now = deps.now();
|
|
33235
|
+
const cards = indexCiCards(deps.listCiCards(), (threadId) => deps.parentIdForThread(threadId));
|
|
33236
|
+
const failing = [];
|
|
33237
|
+
const unknown = [];
|
|
33238
|
+
const observed = [];
|
|
33239
|
+
const failingSubjects = /* @__PURE__ */ new Map();
|
|
33240
|
+
for (const card of cards.values()) {
|
|
33241
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
33242
|
+
let failed;
|
|
33243
|
+
try {
|
|
33244
|
+
failed = await deps.fetchCiFailed(card);
|
|
33245
|
+
} catch {
|
|
33246
|
+
failed = null;
|
|
33247
|
+
}
|
|
33248
|
+
if (failed == null) {
|
|
33249
|
+
unknown.push(prUrl);
|
|
33250
|
+
continue;
|
|
33251
|
+
}
|
|
33252
|
+
observed.push(prUrl);
|
|
33253
|
+
if (!failed) continue;
|
|
33254
|
+
failing.push(prUrl);
|
|
33255
|
+
failingSubjects.set(prUrl, subjectFromCard(card, prUrl));
|
|
33256
|
+
}
|
|
33257
|
+
const ciUrls = mergeCiLatch(
|
|
33258
|
+
prev.ciFailed,
|
|
33259
|
+
prev.primed ? failing : [...failing, ...unknown],
|
|
33260
|
+
unknown
|
|
33261
|
+
);
|
|
33262
|
+
const ciFailed = ciUrls.map(
|
|
33263
|
+
(prUrl) => failingSubjects.get(prUrl) ?? { prUrl, title: prUrl }
|
|
33264
|
+
);
|
|
33265
|
+
const repos = [...new Set(deps.listRepoPaths().map((path2) => path2.trim()).filter(Boolean))].sort();
|
|
33266
|
+
const fetchedReviews = [];
|
|
33267
|
+
const reviewSubjects = /* @__PURE__ */ new Map();
|
|
33268
|
+
const successfulRepos = [];
|
|
33269
|
+
for (const repoPath of repos) {
|
|
33270
|
+
let rows;
|
|
33271
|
+
try {
|
|
33272
|
+
rows = await deps.listReviewRequested(repoPath);
|
|
33273
|
+
} catch {
|
|
33274
|
+
rows = null;
|
|
33275
|
+
}
|
|
33276
|
+
if (!rows) continue;
|
|
33277
|
+
successfulRepos.push(repoPath);
|
|
33278
|
+
for (const row2 of rows) {
|
|
33279
|
+
if (!acceptOpenReadyPr(row2)) continue;
|
|
33280
|
+
const prUrl = normalizePrUrl(row2.prUrl);
|
|
33281
|
+
if (!prUrl) continue;
|
|
33282
|
+
const card = cards.get(prUrl);
|
|
33283
|
+
fetchedReviews.push({ prUrl, repoPath });
|
|
33284
|
+
reviewSubjects.set(prUrl, {
|
|
33285
|
+
prUrl,
|
|
33286
|
+
title: row2.title.trim() || card?.prTitle || prUrl,
|
|
33287
|
+
threadId: card?.threadId,
|
|
33288
|
+
threadTitle: card?.threadTitle,
|
|
33289
|
+
repoPath
|
|
33290
|
+
});
|
|
33291
|
+
}
|
|
33292
|
+
}
|
|
33293
|
+
const seenRepos = new Set(prev.reviewReposSeen ?? []);
|
|
33294
|
+
const freshRepos = new Set(
|
|
33295
|
+
prev.primed ? successfulRepos.filter((repo) => !seenRepos.has(repo)) : []
|
|
33296
|
+
);
|
|
33297
|
+
const reviewLatch = repos.length ? mergeReviewLatch(prev.reviewRequested, fetchedReviews, successfulRepos) : prev.reviewRequested;
|
|
33298
|
+
const reviewRequested = reviewLatch.filter((row2) => !freshRepos.has(row2.repoPath)).map(
|
|
33299
|
+
(row2) => reviewSubjects.get(row2.prUrl) ?? {
|
|
33300
|
+
prUrl: row2.prUrl,
|
|
33301
|
+
title: row2.prUrl,
|
|
33302
|
+
repoPath: row2.repoPath
|
|
33303
|
+
}
|
|
33304
|
+
);
|
|
33305
|
+
const baseline = reviewLatch.filter((row2) => freshRepos.has(row2.repoPath));
|
|
33306
|
+
const seenCi = new Set((prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter(Boolean));
|
|
33307
|
+
const freshCi = new Set(prev.primed ? observed.filter((url) => !seenCi.has(url)) : []);
|
|
33308
|
+
const ciForDiff = ciFailed.filter((subject) => !freshCi.has(subject.prUrl));
|
|
33309
|
+
const edges = diffGithubEdges({ prev, ciFailed: ciForDiff, reviewRequested, now });
|
|
33310
|
+
const delivered = prev.primed && edges.length ? await deliverGithubEdges(edges, deps) : [];
|
|
33311
|
+
const freshFailing = [...freshCi].filter((url) => failing.includes(url));
|
|
33312
|
+
const prevForCommit = freshFailing.length || baseline.length ? {
|
|
33313
|
+
...prev,
|
|
33314
|
+
...freshFailing.length ? {
|
|
33315
|
+
ciFailed: [
|
|
33316
|
+
.../* @__PURE__ */ new Set([
|
|
33317
|
+
...prev.ciFailed.map((url) => normalizePrUrl(url)).filter(Boolean),
|
|
33318
|
+
...freshFailing
|
|
33319
|
+
])
|
|
33320
|
+
]
|
|
33321
|
+
} : {},
|
|
33322
|
+
...baseline.length ? { reviewRequested: mergeReviewLatch(prev.reviewRequested, baseline, [...freshRepos]) } : {}
|
|
33323
|
+
} : prev;
|
|
33324
|
+
const committed = commitGithubEdgeSnapshot({
|
|
33325
|
+
prev: prevForCommit,
|
|
33326
|
+
ciFailed,
|
|
33327
|
+
reviewRequested: reviewLatch,
|
|
33328
|
+
delivered,
|
|
33329
|
+
now
|
|
33330
|
+
});
|
|
33331
|
+
const watched = new Set(repos);
|
|
33332
|
+
const reviewReposSeen = [
|
|
33333
|
+
.../* @__PURE__ */ new Set([
|
|
33334
|
+
...(prev.reviewReposSeen ?? []).filter((repo) => watched.has(repo)),
|
|
33335
|
+
...successfulRepos
|
|
33336
|
+
])
|
|
33337
|
+
].sort();
|
|
33338
|
+
const cardUrls = new Set(cards.keys());
|
|
33339
|
+
const ciSeen = [
|
|
33340
|
+
.../* @__PURE__ */ new Set([
|
|
33341
|
+
...(prev.ciSeen ?? []).map((url) => normalizePrUrl(url)).filter((url) => url && cardUrls.has(url)),
|
|
33342
|
+
...observed
|
|
33343
|
+
])
|
|
33344
|
+
].sort();
|
|
33345
|
+
const next = {
|
|
33346
|
+
...committed,
|
|
33347
|
+
...reviewReposSeen.length ? { reviewReposSeen } : {},
|
|
33348
|
+
...ciSeen.length ? { ciSeen } : {}
|
|
33349
|
+
};
|
|
33350
|
+
if (githubEdgeSnapshotKey(prev) !== githubEdgeSnapshotKey(next)) deps.save(next);
|
|
33351
|
+
return { fired: delivered.length, primed: next.primed };
|
|
33352
|
+
}
|
|
33353
|
+
async function deliverGithubEdges(edges, deps) {
|
|
33354
|
+
const delivered = [];
|
|
33355
|
+
for (const group of routeGithubEdges(edges, (threadId) => deps.parentIdForThread(threadId), deps.designatedId())) {
|
|
33356
|
+
const prompt = formatGithubEdgePrompt(group.edges);
|
|
33357
|
+
try {
|
|
33358
|
+
if (group.targetId) await deps.send(group.targetId, prompt);
|
|
33359
|
+
else await deps.startOrchestration(prompt);
|
|
33360
|
+
delivered.push(...group.edges);
|
|
33361
|
+
} catch {
|
|
33362
|
+
}
|
|
33363
|
+
}
|
|
33364
|
+
return delivered;
|
|
33365
|
+
}
|
|
33366
|
+
function indexCiCards(cards, parentIdForThread2) {
|
|
33367
|
+
const byUrl = /* @__PURE__ */ new Map();
|
|
33368
|
+
for (const card of cards) {
|
|
33369
|
+
if (!acceptOpenReadyPr(card)) continue;
|
|
33370
|
+
const prUrl = normalizePrUrl(card.prUrl);
|
|
33371
|
+
if (!prUrl) continue;
|
|
33372
|
+
const existing = byUrl.get(prUrl);
|
|
33373
|
+
if (!existing) {
|
|
33374
|
+
byUrl.set(prUrl, card);
|
|
33375
|
+
continue;
|
|
33376
|
+
}
|
|
33377
|
+
const existingParent = parentIdForThread2(existing.threadId);
|
|
33378
|
+
const nextParent = parentIdForThread2(card.threadId);
|
|
33379
|
+
if (!existingParent && nextParent) byUrl.set(prUrl, card);
|
|
33380
|
+
}
|
|
33381
|
+
return byUrl;
|
|
33382
|
+
}
|
|
33383
|
+
function subjectFromCard(card, prUrl) {
|
|
33384
|
+
return {
|
|
33385
|
+
prUrl,
|
|
33386
|
+
title: card.prTitle.trim() || card.threadTitle.trim() || prUrl,
|
|
33387
|
+
threadId: card.threadId,
|
|
33388
|
+
threadTitle: card.threadTitle,
|
|
33389
|
+
repoPath: card.repoPath,
|
|
33390
|
+
draft: card.draft,
|
|
33391
|
+
state: card.state
|
|
33392
|
+
};
|
|
33393
|
+
}
|
|
33394
|
+
function liveWorktreeThreads() {
|
|
33395
|
+
return listThreads().filter(
|
|
33396
|
+
(thread) => !isGlobalThread(thread) && !isOrchestratorThread(thread) && thread.wakeOnGithubEdges === true && Boolean(thread.worktreePath?.trim()) && Boolean(thread.repoPath?.trim())
|
|
33397
|
+
);
|
|
33398
|
+
}
|
|
33399
|
+
function listCiCardsFromStore() {
|
|
33400
|
+
const cards = [];
|
|
33401
|
+
for (const thread of liveWorktreeThreads()) {
|
|
33402
|
+
const prUrl = thread.prUrl?.trim() ?? "";
|
|
33403
|
+
if (!prUrl) continue;
|
|
33404
|
+
cards.push({
|
|
33405
|
+
threadId: thread.id,
|
|
33406
|
+
threadTitle: thread.title?.trim() || "Workspace",
|
|
33407
|
+
worktreePath: thread.worktreePath,
|
|
33408
|
+
repoPath: thread.repoPath,
|
|
33409
|
+
prUrl,
|
|
33410
|
+
prTitle: thread.prTitle?.trim() || thread.title?.trim() || prUrl,
|
|
33411
|
+
draft: thread.prIsDraft,
|
|
33412
|
+
state: thread.prState
|
|
33413
|
+
});
|
|
33414
|
+
}
|
|
33415
|
+
return cards;
|
|
33416
|
+
}
|
|
33417
|
+
function listLiveRepoPaths() {
|
|
33418
|
+
return [...new Set(liveWorktreeThreads().map((thread) => thread.repoPath.trim()).filter(Boolean))];
|
|
33419
|
+
}
|
|
33420
|
+
async function fetchCiFailedFromGh(card) {
|
|
33421
|
+
try {
|
|
33422
|
+
const checks = await getPrCiChecks(card.worktreePath, card.prUrl);
|
|
33423
|
+
if (!checks) return null;
|
|
33424
|
+
const failed = ciChecksFailed(checks);
|
|
33425
|
+
persistChecksFailed(card, failed);
|
|
33426
|
+
return failed;
|
|
33427
|
+
} catch {
|
|
33428
|
+
return null;
|
|
33429
|
+
}
|
|
33430
|
+
}
|
|
33431
|
+
function persistChecksFailed(card, failed) {
|
|
33432
|
+
const siblings = threadsSharingWorktree(card.worktreePath);
|
|
33433
|
+
const self = readThread(card.threadId);
|
|
33434
|
+
const targets = siblings.length > 0 ? siblings : self ? [self] : [];
|
|
33435
|
+
for (const thread of targets) {
|
|
33436
|
+
const patch = threadPrChecksFailedPatch(thread, failed);
|
|
33437
|
+
if (Object.keys(patch).length === 0) continue;
|
|
33438
|
+
try {
|
|
33439
|
+
updateThread(thread.id, patch);
|
|
33440
|
+
} catch {
|
|
33441
|
+
}
|
|
33442
|
+
}
|
|
33443
|
+
}
|
|
33444
|
+
async function listMineFromGh(repoPath) {
|
|
33445
|
+
try {
|
|
33446
|
+
const reviewLabel = resolveProjectReviewLabel(loadAppSettings(), repoPath);
|
|
33447
|
+
const rows = await listPrs(repoPath, {
|
|
33448
|
+
queue: "mine",
|
|
33449
|
+
limit: 30,
|
|
33450
|
+
strict: true,
|
|
33451
|
+
...reviewLabel ? { reviewLabel } : {}
|
|
33452
|
+
});
|
|
33453
|
+
return rows.map((row2) => ({
|
|
33454
|
+
prUrl: row2.url,
|
|
33455
|
+
title: row2.title,
|
|
33456
|
+
draft: row2.isDraft,
|
|
33457
|
+
state: row2.state
|
|
33458
|
+
}));
|
|
33459
|
+
} catch {
|
|
33460
|
+
return null;
|
|
33461
|
+
}
|
|
33462
|
+
}
|
|
33463
|
+
function parentIdForThread(threadId) {
|
|
33464
|
+
const thread = readThread(threadId);
|
|
33465
|
+
if (!thread || thread.status === "archived") return null;
|
|
33466
|
+
const parent = connectedOrchestrator(thread, (id) => readThread(id));
|
|
33467
|
+
if (!parent || parent.status === "archived") return null;
|
|
33468
|
+
return parent.id;
|
|
33469
|
+
}
|
|
33470
|
+
function designatedOrchestratorId() {
|
|
33471
|
+
return pickDesignatedOrchestratorId(
|
|
33472
|
+
listGlobalThreads().map((thread) => ({
|
|
33473
|
+
id: thread.id,
|
|
33474
|
+
status: thread.status,
|
|
33475
|
+
cloud: isCloudCoordinatorThread(thread)
|
|
33476
|
+
}))
|
|
33477
|
+
);
|
|
33478
|
+
}
|
|
33479
|
+
function realDeps() {
|
|
33480
|
+
return {
|
|
33481
|
+
enabled: () => wakeOrchestratorOnGithubEdgesEnabled(),
|
|
33482
|
+
listCiCards: listCiCardsFromStore,
|
|
33483
|
+
fetchCiFailed: fetchCiFailedFromGh,
|
|
33484
|
+
listRepoPaths: listLiveRepoPaths,
|
|
33485
|
+
listReviewRequested: listMineFromGh,
|
|
33486
|
+
parentIdForThread,
|
|
33487
|
+
designatedId: designatedOrchestratorId,
|
|
33488
|
+
send: async (threadId, prompt) => {
|
|
33489
|
+
const { getOrchestrator: getOrchestrator2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
33490
|
+
await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
|
|
33491
|
+
},
|
|
33492
|
+
startOrchestration: async (prompt) => {
|
|
33493
|
+
const { startOrchestration: startOrchestration2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
33494
|
+
const defaults = resolveOrchestratorDefaults();
|
|
33495
|
+
await startOrchestration2({
|
|
33496
|
+
goal: prompt,
|
|
33497
|
+
agent: defaults.agent,
|
|
33498
|
+
model: defaults.model,
|
|
33499
|
+
effort: defaults.effort,
|
|
33500
|
+
fast: defaults.fast,
|
|
33501
|
+
autonomy: defaults.autonomy
|
|
33502
|
+
});
|
|
33503
|
+
},
|
|
33504
|
+
load: loadGithubEdgeSnapshot,
|
|
33505
|
+
save: saveGithubEdgeSnapshot,
|
|
33506
|
+
now: () => Date.now()
|
|
33507
|
+
};
|
|
33508
|
+
}
|
|
33509
|
+
var import_node_fs70, import_node_path70, timer, polling, needsBaseline;
|
|
33510
|
+
var init_github_edge_watch = __esm({
|
|
33511
|
+
"src/orchestrator/github-edge-watch.ts"() {
|
|
33512
|
+
"use strict";
|
|
33513
|
+
import_node_fs70 = require("fs");
|
|
33514
|
+
import_node_path70 = require("path");
|
|
33515
|
+
init_pr_gates();
|
|
33516
|
+
init_pr_merge_archive();
|
|
33517
|
+
init_worktree();
|
|
33518
|
+
init_desktop_host();
|
|
33519
|
+
init_app_settings();
|
|
33520
|
+
init_global_workspace();
|
|
33521
|
+
init_paths();
|
|
33522
|
+
init_private_file();
|
|
33523
|
+
init_thread_store();
|
|
33524
|
+
init_chat_tabs();
|
|
33525
|
+
init_connected_orchestrator();
|
|
33526
|
+
init_github_edge();
|
|
33527
|
+
timer = null;
|
|
33528
|
+
polling = false;
|
|
33529
|
+
needsBaseline = true;
|
|
33530
|
+
}
|
|
33531
|
+
});
|
|
33532
|
+
|
|
32820
33533
|
// src/agents/cursor-recover.ts
|
|
32821
33534
|
var cursor_recover_exports = {};
|
|
32822
33535
|
__export(cursor_recover_exports, {
|
|
@@ -32833,9 +33546,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
32833
33546
|
return best;
|
|
32834
33547
|
}
|
|
32835
33548
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
32836
|
-
if (!(0,
|
|
33549
|
+
if (!(0, import_node_fs71.existsSync)(runsPath)) return null;
|
|
32837
33550
|
try {
|
|
32838
|
-
const lines = (0,
|
|
33551
|
+
const lines = (0, import_node_fs71.readFileSync)(runsPath, "utf8").split("\n");
|
|
32839
33552
|
let best = null;
|
|
32840
33553
|
for (const line of lines) {
|
|
32841
33554
|
const trimmed = line.trim();
|
|
@@ -32861,11 +33574,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
32861
33574
|
return null;
|
|
32862
33575
|
}
|
|
32863
33576
|
}
|
|
32864
|
-
var
|
|
33577
|
+
var import_node_fs71;
|
|
32865
33578
|
var init_cursor_recover = __esm({
|
|
32866
33579
|
"src/agents/cursor-recover.ts"() {
|
|
32867
33580
|
"use strict";
|
|
32868
|
-
|
|
33581
|
+
import_node_fs71 = require("fs");
|
|
32869
33582
|
init_cursor_store();
|
|
32870
33583
|
}
|
|
32871
33584
|
});
|
|
@@ -32969,7 +33682,7 @@ async function startOrchestration(opts) {
|
|
|
32969
33682
|
}
|
|
32970
33683
|
return ready;
|
|
32971
33684
|
}
|
|
32972
|
-
var import_node_events, import_node_crypto22,
|
|
33685
|
+
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
33686
|
var init_orchestrator = __esm({
|
|
32974
33687
|
"src/orchestrator/orchestrator.ts"() {
|
|
32975
33688
|
"use strict";
|
|
@@ -32978,7 +33691,7 @@ var init_orchestrator = __esm({
|
|
|
32978
33691
|
init_task_state();
|
|
32979
33692
|
init_wait_for_turn();
|
|
32980
33693
|
import_node_crypto22 = require("crypto");
|
|
32981
|
-
|
|
33694
|
+
import_node_fs72 = require("fs");
|
|
32982
33695
|
init_error_detail();
|
|
32983
33696
|
init_run();
|
|
32984
33697
|
init_stale_lock();
|
|
@@ -33054,6 +33767,7 @@ var init_orchestrator = __esm({
|
|
|
33054
33767
|
init_workspaces();
|
|
33055
33768
|
init_global_workspace();
|
|
33056
33769
|
init_caffeinate_hold();
|
|
33770
|
+
init_github_edge_watch();
|
|
33057
33771
|
init_schedule_runner();
|
|
33058
33772
|
init_coordinator_prompt();
|
|
33059
33773
|
init_enqueue_thread_send();
|
|
@@ -33179,7 +33893,7 @@ var init_orchestrator = __esm({
|
|
|
33179
33893
|
this.lightReconcileAt.set(repoPath, Date.now());
|
|
33180
33894
|
for (const thread of listThreads()) {
|
|
33181
33895
|
if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
|
|
33182
|
-
if (!(0,
|
|
33896
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
33183
33897
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
33184
33898
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
33185
33899
|
}
|
|
@@ -33208,7 +33922,7 @@ var init_orchestrator = __esm({
|
|
|
33208
33922
|
}
|
|
33209
33923
|
continue;
|
|
33210
33924
|
}
|
|
33211
|
-
if (!(0,
|
|
33925
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
33212
33926
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
33213
33927
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
33214
33928
|
continue;
|
|
@@ -33234,6 +33948,7 @@ var init_orchestrator = __esm({
|
|
|
33234
33948
|
}
|
|
33235
33949
|
this.schedulePendingQuotaResumes();
|
|
33236
33950
|
armSchedules();
|
|
33951
|
+
armGithubEdgeWatch();
|
|
33237
33952
|
}
|
|
33238
33953
|
/** Surface (and, when enabled, clean up) worktrees git knows about but no thread owns. */
|
|
33239
33954
|
async reconcileOrphans(repoPaths) {
|
|
@@ -33372,8 +34087,8 @@ var init_orchestrator = __esm({
|
|
|
33372
34087
|
}
|
|
33373
34088
|
}
|
|
33374
34089
|
clearQuotaResumeTimer(threadId) {
|
|
33375
|
-
const
|
|
33376
|
-
if (
|
|
34090
|
+
const timer2 = this.quotaResumeTimers.get(threadId);
|
|
34091
|
+
if (timer2) clearTimeout(timer2);
|
|
33377
34092
|
this.quotaResumeTimers.delete(threadId);
|
|
33378
34093
|
}
|
|
33379
34094
|
/** Schedule (or fire) auto-retry after a provider session/usage limit reset. */
|
|
@@ -33382,11 +34097,11 @@ var init_orchestrator = __esm({
|
|
|
33382
34097
|
updateThread(threadId, { quotaResumeAt: resumeAt.toISOString() });
|
|
33383
34098
|
const delay3 = Math.max(5e3, resumeAt.getTime() - Date.now());
|
|
33384
34099
|
const capped = Math.min(delay3, 2147483647);
|
|
33385
|
-
const
|
|
34100
|
+
const timer2 = setTimeout(() => {
|
|
33386
34101
|
this.quotaResumeTimers.delete(threadId);
|
|
33387
34102
|
void this.resumeAfterQuotaWait(threadId);
|
|
33388
34103
|
}, capped);
|
|
33389
|
-
this.quotaResumeTimers.set(threadId,
|
|
34104
|
+
this.quotaResumeTimers.set(threadId, timer2);
|
|
33390
34105
|
}
|
|
33391
34106
|
schedulePendingQuotaResumes() {
|
|
33392
34107
|
for (const thread of listThreads({ includeArchived: false })) {
|
|
@@ -35034,11 +35749,11 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35034
35749
|
const start = Date.now();
|
|
35035
35750
|
return new Promise((resolve3, reject) => {
|
|
35036
35751
|
let settled = false;
|
|
35037
|
-
let
|
|
35752
|
+
let timer2;
|
|
35038
35753
|
const finish2 = (fn) => {
|
|
35039
35754
|
if (settled) return;
|
|
35040
35755
|
settled = true;
|
|
35041
|
-
if (
|
|
35756
|
+
if (timer2) clearInterval(timer2);
|
|
35042
35757
|
off();
|
|
35043
35758
|
fn();
|
|
35044
35759
|
};
|
|
@@ -35064,7 +35779,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35064
35779
|
}
|
|
35065
35780
|
}
|
|
35066
35781
|
});
|
|
35067
|
-
|
|
35782
|
+
timer2 = setInterval(() => {
|
|
35068
35783
|
const raw = readThread(thread.id);
|
|
35069
35784
|
if (!raw) {
|
|
35070
35785
|
finish2(() => reject(new Error(`Thread not found: ${thread.id}`)));
|
|
@@ -35709,7 +36424,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
35709
36424
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
35710
36425
|
return restored2;
|
|
35711
36426
|
}
|
|
35712
|
-
if (!(0,
|
|
36427
|
+
if (!(0, import_node_fs72.existsSync)(thread.worktreePath)) {
|
|
35713
36428
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
35714
36429
|
throw new Error(
|
|
35715
36430
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -35889,8 +36604,8 @@ async function fireSchedule(id) {
|
|
|
35889
36604
|
}
|
|
35890
36605
|
}
|
|
35891
36606
|
function clearTimer(id) {
|
|
35892
|
-
const
|
|
35893
|
-
if (
|
|
36607
|
+
const timer2 = timers.get(id);
|
|
36608
|
+
if (timer2) clearTimeout(timer2);
|
|
35894
36609
|
timers.delete(id);
|
|
35895
36610
|
}
|
|
35896
36611
|
function armOne(schedule) {
|
|
@@ -35906,7 +36621,7 @@ function armOne(schedule) {
|
|
|
35906
36621
|
return;
|
|
35907
36622
|
}
|
|
35908
36623
|
const capped = Math.min(delay3, SET_TIMEOUT_MAX);
|
|
35909
|
-
const
|
|
36624
|
+
const timer2 = setTimeout(() => {
|
|
35910
36625
|
timers.delete(schedule.id);
|
|
35911
36626
|
const live = getSchedule(schedule.id);
|
|
35912
36627
|
if (!live?.enabled) return;
|
|
@@ -35919,7 +36634,7 @@ function armOne(schedule) {
|
|
|
35919
36634
|
if (isThisProcessDesktopHost()) armSchedules();
|
|
35920
36635
|
});
|
|
35921
36636
|
}, capped);
|
|
35922
|
-
timers.set(schedule.id,
|
|
36637
|
+
timers.set(schedule.id, timer2);
|
|
35923
36638
|
}
|
|
35924
36639
|
function armSchedules() {
|
|
35925
36640
|
if (!isThisProcessDesktopHost()) return;
|
|
@@ -36049,6 +36764,9 @@ __export(index_exports, {
|
|
|
36049
36764
|
LONG_RUNNING_SKILL_COMMAND: () => LONG_RUNNING_SKILL_COMMAND,
|
|
36050
36765
|
LinearOAuthCancelledError: () => LinearOAuthCancelledError,
|
|
36051
36766
|
MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS: () => MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
|
|
36767
|
+
MAX_ORCH_THREADS_DEFAULT: () => MAX_ORCH_THREADS_DEFAULT,
|
|
36768
|
+
MAX_ORCH_THREADS_MAX: () => MAX_ORCH_THREADS_MAX,
|
|
36769
|
+
MAX_ORCH_THREADS_MIN: () => MAX_ORCH_THREADS_MIN,
|
|
36052
36770
|
OPTIONAL_SERVICES: () => OPTIONAL_SERVICES,
|
|
36053
36771
|
OPTIONAL_SERVICE_IDS: () => OPTIONAL_SERVICE_IDS,
|
|
36054
36772
|
ORCHESTRATOR_AGENT_KINDS: () => ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -36081,6 +36799,7 @@ __export(index_exports, {
|
|
|
36081
36799
|
RUN_PORTS_REL: () => RUN_PORTS_REL,
|
|
36082
36800
|
RUN_SCRIPT_DESKTOP_ADOPT_MS: () => RUN_SCRIPT_DESKTOP_ADOPT_MS,
|
|
36083
36801
|
RemoteHub: () => RemoteHub,
|
|
36802
|
+
SCHEDULE_RUN_HISTORY_LIMIT: () => SCHEDULE_RUN_HISTORY_LIMIT,
|
|
36084
36803
|
SEED_FULL_TOOL_MESSAGES: () => SEED_FULL_TOOL_MESSAGES,
|
|
36085
36804
|
SEED_MAX_CHARS: () => SEED_MAX_CHARS,
|
|
36086
36805
|
SESSION_RESET_OCCUPANCY_TOKENS: () => SESSION_RESET_OCCUPANCY_TOKENS,
|
|
@@ -36161,9 +36880,11 @@ __export(index_exports, {
|
|
|
36161
36880
|
applySystemCaEnv: () => applySystemCaEnv,
|
|
36162
36881
|
applyThreadIntoMain: () => applyThreadIntoMain,
|
|
36163
36882
|
applyTurnUsage: () => applyTurnUsage,
|
|
36883
|
+
applyWakeOnGithubEdges: () => applyWakeOnGithubEdges,
|
|
36164
36884
|
applyWorkspaceTags: () => applyWorkspaceTags,
|
|
36165
36885
|
archiveRemovedWorkspaceChats: () => archiveRemovedWorkspaceChats,
|
|
36166
36886
|
archivesWithRemovedWorkspace: () => archivesWithRemovedWorkspace,
|
|
36887
|
+
armGithubEdgeWatch: () => armGithubEdgeWatch,
|
|
36167
36888
|
armSchedules: () => armSchedules,
|
|
36168
36889
|
askBlockStillWaiting: () => askBlockStillWaiting,
|
|
36169
36890
|
assertAbleTimeCredential: () => assertAbleTimeCredential,
|
|
@@ -36485,6 +37206,7 @@ __export(index_exports, {
|
|
|
36485
37206
|
getOrderPlan: () => getOrderPlan,
|
|
36486
37207
|
getPr: () => getPr,
|
|
36487
37208
|
getPrChecks: () => getPrChecks,
|
|
37209
|
+
getPrCiChecks: () => getPrCiChecks,
|
|
36488
37210
|
getPrDetails: () => getPrDetails,
|
|
36489
37211
|
getPrForHeadBranch: () => getPrForHeadBranch,
|
|
36490
37212
|
getPrMeta: () => getPrMeta,
|
|
@@ -36711,6 +37433,7 @@ __export(index_exports, {
|
|
|
36711
37433
|
markPrReady: () => markPrReady,
|
|
36712
37434
|
materializeSystemCaBundle: () => materializeSystemCaBundle,
|
|
36713
37435
|
maxConcurrentAgents: () => maxConcurrentAgents,
|
|
37436
|
+
maxOrchThreads: () => maxOrchThreads,
|
|
36714
37437
|
maybeCompactContext: () => maybeCompactContext,
|
|
36715
37438
|
mcpAllowTools: () => mcpAllowTools,
|
|
36716
37439
|
mcpAllowToolsFromNames: () => mcpAllowToolsFromNames,
|
|
@@ -37085,6 +37808,7 @@ __export(index_exports, {
|
|
|
37085
37808
|
visibleAssistantText: () => visibleAssistantText,
|
|
37086
37809
|
visibleToolRowDetail: () => visibleToolRowDetail,
|
|
37087
37810
|
waitForPidExit: () => waitForPidExit,
|
|
37811
|
+
wakeOrchestratorOnGithubEdgesEnabled: () => wakeOrchestratorOnGithubEdgesEnabled,
|
|
37088
37812
|
warmGithubAgentAuth: () => warmGithubAgentAuth,
|
|
37089
37813
|
weeklyCronExpr: () => weeklyCronExpr,
|
|
37090
37814
|
whichOnPath: () => whichOnPath,
|
|
@@ -38525,6 +39249,53 @@ function satisfyOrderDependency(id, satisfied = true) {
|
|
|
38525
39249
|
|
|
38526
39250
|
// src/index.ts
|
|
38527
39251
|
init_schedule_runner();
|
|
39252
|
+
init_github_edge_watch();
|
|
39253
|
+
|
|
39254
|
+
// src/threads/wake-on-github-edges.ts
|
|
39255
|
+
init_global_workspace();
|
|
39256
|
+
init_app_settings();
|
|
39257
|
+
init_thread_store();
|
|
39258
|
+
init_worktree_labels();
|
|
39259
|
+
init_chat_tabs();
|
|
39260
|
+
function wakeOnGithubEdgesTargetRef(opts) {
|
|
39261
|
+
const requested = opts.requestedRef?.trim() || "";
|
|
39262
|
+
if (!opts.ownWorktreeOnly) {
|
|
39263
|
+
if (!requested) throw new Error("Pass a chat id on the workspace.");
|
|
39264
|
+
return requested;
|
|
39265
|
+
}
|
|
39266
|
+
const caller = opts.caller;
|
|
39267
|
+
if (!caller || isGlobalThread(caller) || caller.sourceType === "orchestration") {
|
|
39268
|
+
throw new Error("CI and review wakes belong on a project workspace. This chat is not one.");
|
|
39269
|
+
}
|
|
39270
|
+
if (!requested || requested === caller.id) return caller.id;
|
|
39271
|
+
const other = opts.find(requested);
|
|
39272
|
+
if (!other || normalizeWorktreePath(other.worktreePath) !== normalizeWorktreePath(caller.worktreePath)) {
|
|
39273
|
+
throw new Error("You can only change this switch on this workspace.");
|
|
39274
|
+
}
|
|
39275
|
+
return other.id;
|
|
39276
|
+
}
|
|
39277
|
+
function applyWakeOnGithubEdges(threadRef, enabled) {
|
|
39278
|
+
if (!wakeOrchestratorOnGithubEdgesEnabled()) {
|
|
39279
|
+
throw new Error(
|
|
39280
|
+
"Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is off. Turn that on in Settings. Do not change it from this chat."
|
|
39281
|
+
);
|
|
39282
|
+
}
|
|
39283
|
+
const thread = findThreadByRef(threadRef);
|
|
39284
|
+
if (!thread) throw new Error(`Thread not found: ${threadRef}`);
|
|
39285
|
+
if (isGlobalThread(thread) || thread.sourceType === "orchestration") {
|
|
39286
|
+
throw new Error("CI and review wakes belong on a project workspace. Pass a worktree chat id.");
|
|
39287
|
+
}
|
|
39288
|
+
const on = enabled === true;
|
|
39289
|
+
const siblings = threadsSharingWorktree(thread.worktreePath);
|
|
39290
|
+
const targets = siblings.length > 0 ? siblings : [thread];
|
|
39291
|
+
let updated = thread;
|
|
39292
|
+
for (const row2 of targets) {
|
|
39293
|
+
const written = updateThread(row2.id, { wakeOnGithubEdges: on ? true : void 0 });
|
|
39294
|
+
if (!on) delete written.wakeOnGithubEdges;
|
|
39295
|
+
if (written.id === thread.id) updated = written;
|
|
39296
|
+
}
|
|
39297
|
+
return updated;
|
|
39298
|
+
}
|
|
38528
39299
|
|
|
38529
39300
|
// src/host/awake.ts
|
|
38530
39301
|
function hostKeepsMacAwake(input) {
|
|
@@ -38542,6 +39313,7 @@ init_system_ca();
|
|
|
38542
39313
|
init_app_settings();
|
|
38543
39314
|
init_desktop_host();
|
|
38544
39315
|
init_schedules();
|
|
39316
|
+
init_github_edge_watch();
|
|
38545
39317
|
init_schedule_runner();
|
|
38546
39318
|
|
|
38547
39319
|
// src/remote/client.ts
|
|
@@ -40006,12 +40778,12 @@ function emitControl(opts, reply) {
|
|
|
40006
40778
|
}
|
|
40007
40779
|
function watchPhoneStream(opts, chatId, threadId, generation, seed = []) {
|
|
40008
40780
|
let parts = seed.slice();
|
|
40009
|
-
let
|
|
40781
|
+
let timer2 = null;
|
|
40010
40782
|
let lastKey = "";
|
|
40011
40783
|
let closed = false;
|
|
40012
40784
|
const alive = () => !closed && chatGeneration.get(chatId) === generation;
|
|
40013
40785
|
const flush2 = () => {
|
|
40014
|
-
|
|
40786
|
+
timer2 = null;
|
|
40015
40787
|
if (!alive()) return;
|
|
40016
40788
|
const frame = phoneStreamFrame(parts);
|
|
40017
40789
|
const key = `${frame.activity}
|
|
@@ -40023,15 +40795,15 @@ ${frame.text}`;
|
|
|
40023
40795
|
};
|
|
40024
40796
|
const schedule = (event) => {
|
|
40025
40797
|
if (phoneStreamFlushNow(event) || lastKey === "") {
|
|
40026
|
-
if (
|
|
40027
|
-
clearTimeout(
|
|
40028
|
-
|
|
40798
|
+
if (timer2) {
|
|
40799
|
+
clearTimeout(timer2);
|
|
40800
|
+
timer2 = null;
|
|
40029
40801
|
}
|
|
40030
40802
|
flush2();
|
|
40031
40803
|
return;
|
|
40032
40804
|
}
|
|
40033
|
-
if (
|
|
40034
|
-
|
|
40805
|
+
if (timer2) return;
|
|
40806
|
+
timer2 = setTimeout(flush2, PHONE_STREAM_FLUSH_MS);
|
|
40035
40807
|
};
|
|
40036
40808
|
const off = getOrchestrator().on((event) => {
|
|
40037
40809
|
if (!alive()) return;
|
|
@@ -40044,7 +40816,7 @@ ${frame.text}`;
|
|
|
40044
40816
|
if (parts.length) flush2();
|
|
40045
40817
|
return () => {
|
|
40046
40818
|
closed = true;
|
|
40047
|
-
if (
|
|
40819
|
+
if (timer2) clearTimeout(timer2);
|
|
40048
40820
|
off();
|
|
40049
40821
|
};
|
|
40050
40822
|
}
|
|
@@ -40201,8 +40973,8 @@ init_message_parts();
|
|
|
40201
40973
|
init_turn_live();
|
|
40202
40974
|
|
|
40203
40975
|
// src/remote/phone-media.ts
|
|
40204
|
-
var
|
|
40205
|
-
var
|
|
40976
|
+
var import_node_fs73 = require("fs");
|
|
40977
|
+
var import_node_path71 = require("path");
|
|
40206
40978
|
init_diff();
|
|
40207
40979
|
var PHONE_IMAGE_MAX_BYTES = 15e5;
|
|
40208
40980
|
var PHONE_TEXT_MAX_BYTES = 18e4;
|
|
@@ -40255,7 +41027,7 @@ function phoneImageDataUrl(worktreePath, raw) {
|
|
|
40255
41027
|
}
|
|
40256
41028
|
function phoneDirectoryListing(worktreePath, relative2) {
|
|
40257
41029
|
try {
|
|
40258
|
-
const entries = (0,
|
|
41030
|
+
const entries = (0, import_node_fs73.readdirSync)((0, import_node_path71.join)(worktreePath, relative2), { withFileTypes: true });
|
|
40259
41031
|
const dirs = new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
|
|
40260
41032
|
const names = entries.map((entry) => entry.name).filter((name) => name && !name.includes("/") && !name.includes("\0")).sort((a, b) => a.localeCompare(b));
|
|
40261
41033
|
const shown = names.slice(0, PHONE_DIR_MAX);
|
|
@@ -40281,7 +41053,7 @@ function phoneFilePreview(worktreePath, relative2, kind) {
|
|
|
40281
41053
|
}
|
|
40282
41054
|
if (relative2.toLowerCase().endsWith(".svg")) {
|
|
40283
41055
|
try {
|
|
40284
|
-
const buf = (0,
|
|
41056
|
+
const buf = (0, import_node_fs73.readFileSync)((0, import_node_path71.join)(worktreePath, relative2));
|
|
40285
41057
|
const truncated = buf.length > PHONE_TEXT_MAX_BYTES;
|
|
40286
41058
|
return {
|
|
40287
41059
|
content: buf.subarray(0, PHONE_TEXT_MAX_BYTES).toString("utf8"),
|
|
@@ -41830,7 +42602,7 @@ function handleRemoteInbound(text7, opts) {
|
|
|
41830
42602
|
}
|
|
41831
42603
|
|
|
41832
42604
|
// src/remote/phone-board-sync.ts
|
|
41833
|
-
var
|
|
42605
|
+
var import_node_path72 = require("path");
|
|
41834
42606
|
var import_chokidar = require("chokidar");
|
|
41835
42607
|
init_orchestrator();
|
|
41836
42608
|
init_paths();
|
|
@@ -41886,7 +42658,7 @@ function subscribePhoneBoard(notify) {
|
|
|
41886
42658
|
threads.on("error", () => void 0);
|
|
41887
42659
|
const data = (0, import_chokidar.watch)(appDataDir(), { ignoreInitial: true, depth: 0 });
|
|
41888
42660
|
const onData = (changed) => {
|
|
41889
|
-
const name = (0,
|
|
42661
|
+
const name = (0, import_node_path72.basename)(changed);
|
|
41890
42662
|
if (name !== "workspaces.json" && name !== "removed-workspaces.json" && name !== "settings.json") return;
|
|
41891
42663
|
notify();
|
|
41892
42664
|
};
|
|
@@ -41902,11 +42674,11 @@ function subscribePhoneBoard(notify) {
|
|
|
41902
42674
|
function startPhoneBoardSync(opts) {
|
|
41903
42675
|
const list = opts.list ?? listPhoneSidebar;
|
|
41904
42676
|
const debounceMs = opts.debounceMs ?? PHONE_BOARD_SYNC_MS;
|
|
41905
|
-
let
|
|
42677
|
+
let timer2 = null;
|
|
41906
42678
|
let lastKey = "";
|
|
41907
42679
|
let stopped = false;
|
|
41908
42680
|
const push2 = () => {
|
|
41909
|
-
|
|
42681
|
+
timer2 = null;
|
|
41910
42682
|
if (stopped) return;
|
|
41911
42683
|
let sidebar;
|
|
41912
42684
|
try {
|
|
@@ -41921,8 +42693,8 @@ function startPhoneBoardSync(opts) {
|
|
|
41921
42693
|
};
|
|
41922
42694
|
const schedule = () => {
|
|
41923
42695
|
if (stopped) return;
|
|
41924
|
-
if (
|
|
41925
|
-
|
|
42696
|
+
if (timer2) clearTimeout(timer2);
|
|
42697
|
+
timer2 = setTimeout(push2, debounceMs);
|
|
41926
42698
|
};
|
|
41927
42699
|
const handle = (event) => {
|
|
41928
42700
|
if (isPhoneBoardEvent(event)) schedule();
|
|
@@ -41946,8 +42718,8 @@ function startPhoneBoardSync(opts) {
|
|
|
41946
42718
|
}
|
|
41947
42719
|
return () => {
|
|
41948
42720
|
stopped = true;
|
|
41949
|
-
if (
|
|
41950
|
-
|
|
42721
|
+
if (timer2) clearTimeout(timer2);
|
|
42722
|
+
timer2 = null;
|
|
41951
42723
|
if (loginTimer) clearInterval(loginTimer);
|
|
41952
42724
|
loginTimer = null;
|
|
41953
42725
|
unsubscribe();
|
|
@@ -41996,9 +42768,9 @@ function createRemoteKeepalive(opts) {
|
|
|
41996
42768
|
}
|
|
41997
42769
|
function wait(ms, signal) {
|
|
41998
42770
|
return new Promise((resolve3, reject) => {
|
|
41999
|
-
const
|
|
42771
|
+
const timer2 = setTimeout(resolve3, ms);
|
|
42000
42772
|
const onAbort = () => {
|
|
42001
|
-
clearTimeout(
|
|
42773
|
+
clearTimeout(timer2);
|
|
42002
42774
|
reject(new Error("aborted"));
|
|
42003
42775
|
};
|
|
42004
42776
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -42838,11 +43610,11 @@ function clientIdFromOAuthState(state) {
|
|
|
42838
43610
|
init_app_settings();
|
|
42839
43611
|
|
|
42840
43612
|
// src/slack/workspaces.ts
|
|
42841
|
-
var
|
|
43613
|
+
var import_node_path73 = require("path");
|
|
42842
43614
|
init_paths();
|
|
42843
43615
|
init_secure_file();
|
|
42844
43616
|
function storePath2() {
|
|
42845
|
-
return (0,
|
|
43617
|
+
return (0, import_node_path73.join)(appDataDir(), "slack-workspaces.json");
|
|
42846
43618
|
}
|
|
42847
43619
|
function readStore2() {
|
|
42848
43620
|
try {
|
|
@@ -42966,12 +43738,12 @@ function sleep(ms, signal) {
|
|
|
42966
43738
|
reject(new SlackOAuthCancelledError());
|
|
42967
43739
|
return;
|
|
42968
43740
|
}
|
|
42969
|
-
const
|
|
43741
|
+
const timer2 = setTimeout(() => {
|
|
42970
43742
|
signal?.removeEventListener("abort", onAbort);
|
|
42971
43743
|
resolve3();
|
|
42972
43744
|
}, ms);
|
|
42973
43745
|
const onAbort = () => {
|
|
42974
|
-
clearTimeout(
|
|
43746
|
+
clearTimeout(timer2);
|
|
42975
43747
|
reject(new SlackOAuthCancelledError());
|
|
42976
43748
|
};
|
|
42977
43749
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -43388,15 +44160,15 @@ function sendJson(res, status, body) {
|
|
|
43388
44160
|
|
|
43389
44161
|
// src/relay/slack-apps.ts
|
|
43390
44162
|
var import_node_crypto27 = require("crypto");
|
|
43391
|
-
var
|
|
44163
|
+
var import_node_fs74 = require("fs");
|
|
43392
44164
|
var import_node_module7 = require("module");
|
|
43393
|
-
var
|
|
44165
|
+
var import_node_path74 = require("path");
|
|
43394
44166
|
var SlackAppStore = class {
|
|
43395
44167
|
db;
|
|
43396
44168
|
key;
|
|
43397
44169
|
constructor(filePath, key) {
|
|
43398
44170
|
if (key.length !== 32) throw new Error("Slack token key must be 32 bytes");
|
|
43399
|
-
(0,
|
|
44171
|
+
(0, import_node_fs74.mkdirSync)((0, import_node_path74.dirname)(filePath), { recursive: true });
|
|
43400
44172
|
this.key = key;
|
|
43401
44173
|
this.db = openDatabase(filePath);
|
|
43402
44174
|
this.db.exec(`
|
|
@@ -43557,7 +44329,7 @@ function sameHash(stored, presented) {
|
|
|
43557
44329
|
}
|
|
43558
44330
|
function thisModuleFile3() {
|
|
43559
44331
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
43560
|
-
return cjsFile || process.argv[1] || (0,
|
|
44332
|
+
return cjsFile || process.argv[1] || (0, import_node_path74.join)(process.cwd(), "package.json");
|
|
43561
44333
|
}
|
|
43562
44334
|
function openDatabase(filePath) {
|
|
43563
44335
|
const req = (0, import_node_module7.createRequire)(thisModuleFile3());
|
|
@@ -43569,9 +44341,9 @@ function openDatabase(filePath) {
|
|
|
43569
44341
|
|
|
43570
44342
|
// src/relay/slack-grants.ts
|
|
43571
44343
|
var import_node_crypto29 = require("crypto");
|
|
43572
|
-
var
|
|
44344
|
+
var import_node_fs75 = require("fs");
|
|
43573
44345
|
var import_node_module8 = require("module");
|
|
43574
|
-
var
|
|
44346
|
+
var import_node_path75 = require("path");
|
|
43575
44347
|
|
|
43576
44348
|
// src/slack/listen-grant.ts
|
|
43577
44349
|
var import_node_crypto28 = require("crypto");
|
|
@@ -43611,7 +44383,7 @@ function hashListenGrant(grant) {
|
|
|
43611
44383
|
var SlackListenGrantStore = class {
|
|
43612
44384
|
db;
|
|
43613
44385
|
constructor(filePath) {
|
|
43614
|
-
(0,
|
|
44386
|
+
(0, import_node_fs75.mkdirSync)((0, import_node_path75.dirname)(filePath), { recursive: true });
|
|
43615
44387
|
this.db = openDatabase2(filePath);
|
|
43616
44388
|
this.db.exec(`
|
|
43617
44389
|
CREATE TABLE IF NOT EXISTS slack_listen_grants (
|
|
@@ -43654,7 +44426,7 @@ var SlackListenGrantStore = class {
|
|
|
43654
44426
|
};
|
|
43655
44427
|
function thisModuleFile4() {
|
|
43656
44428
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
43657
|
-
return cjsFile || process.argv[1] || (0,
|
|
44429
|
+
return cjsFile || process.argv[1] || (0, import_node_path75.join)(process.cwd(), "package.json");
|
|
43658
44430
|
}
|
|
43659
44431
|
function openDatabase2(filePath) {
|
|
43660
44432
|
const req = (0, import_node_module8.createRequire)(thisModuleFile4());
|
|
@@ -44180,9 +44952,9 @@ var SlackRelayHub = class {
|
|
|
44180
44952
|
};
|
|
44181
44953
|
|
|
44182
44954
|
// src/relay/static.ts
|
|
44183
|
-
var
|
|
44955
|
+
var import_node_fs76 = require("fs");
|
|
44184
44956
|
var import_promises = require("fs/promises");
|
|
44185
|
-
var
|
|
44957
|
+
var import_node_path76 = __toESM(require("path"), 1);
|
|
44186
44958
|
var TYPES = {
|
|
44187
44959
|
".css": "text/css; charset=utf-8",
|
|
44188
44960
|
".html": "text/html; charset=utf-8",
|
|
@@ -44242,7 +45014,7 @@ async function directorySlashLocation(root, requestUrl) {
|
|
|
44242
45014
|
const candidate = resolveStaticPath(root, requestUrl);
|
|
44243
45015
|
if (!candidate) return null;
|
|
44244
45016
|
if (await fileSize(candidate) != null) return null;
|
|
44245
|
-
if (await fileSize(
|
|
45017
|
+
if (await fileSize(import_node_path76.default.join(candidate, "index.html")) == null) return null;
|
|
44246
45018
|
return `${url.pathname}/${url.search}`;
|
|
44247
45019
|
}
|
|
44248
45020
|
function resolveStaticPath(root, requestUrl) {
|
|
@@ -44253,9 +45025,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
44253
45025
|
return null;
|
|
44254
45026
|
}
|
|
44255
45027
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
44256
|
-
const rootResolved =
|
|
44257
|
-
const candidate =
|
|
44258
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
45028
|
+
const rootResolved = import_node_path76.default.resolve(root);
|
|
45029
|
+
const candidate = import_node_path76.default.resolve(rootResolved, `.${pathname}`);
|
|
45030
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path76.default.sep)) {
|
|
44259
45031
|
return null;
|
|
44260
45032
|
}
|
|
44261
45033
|
return candidate;
|
|
@@ -44269,7 +45041,7 @@ async function fileSize(file) {
|
|
|
44269
45041
|
}
|
|
44270
45042
|
}
|
|
44271
45043
|
function sendFile(req, res, file, size) {
|
|
44272
|
-
const ext =
|
|
45044
|
+
const ext = import_node_path76.default.extname(file).toLowerCase();
|
|
44273
45045
|
res.writeHead(200, {
|
|
44274
45046
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
44275
45047
|
"Content-Length": size,
|
|
@@ -44279,7 +45051,7 @@ function sendFile(req, res, file, size) {
|
|
|
44279
45051
|
res.end();
|
|
44280
45052
|
return true;
|
|
44281
45053
|
}
|
|
44282
|
-
(0,
|
|
45054
|
+
(0, import_node_fs76.createReadStream)(file).pipe(res);
|
|
44283
45055
|
return true;
|
|
44284
45056
|
}
|
|
44285
45057
|
async function serveMarketingSite(req, res, opts) {
|
|
@@ -44317,7 +45089,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
44317
45089
|
if (!candidate) return false;
|
|
44318
45090
|
const direct = await fileSize(candidate);
|
|
44319
45091
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
44320
|
-
const asIndex =
|
|
45092
|
+
const asIndex = import_node_path76.default.join(candidate, "index.html");
|
|
44321
45093
|
const indexSize = await fileSize(asIndex);
|
|
44322
45094
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
44323
45095
|
return false;
|
|
@@ -44660,15 +45432,15 @@ init_protocol();
|
|
|
44660
45432
|
|
|
44661
45433
|
// src/relay/accounts.ts
|
|
44662
45434
|
var import_node_crypto32 = require("crypto");
|
|
44663
|
-
var
|
|
45435
|
+
var import_node_fs77 = require("fs");
|
|
44664
45436
|
var import_node_module9 = require("module");
|
|
44665
|
-
var
|
|
45437
|
+
var import_node_path77 = require("path");
|
|
44666
45438
|
var GITHUB_ACCOUNT_ISSUER = "https://github.com";
|
|
44667
45439
|
var CURSOR_ACCOUNT_ISSUER = "https://api.cursor.com/v1/origin";
|
|
44668
45440
|
var RELAY_DEVICE_CAP = 3;
|
|
44669
45441
|
function thisModuleFile5() {
|
|
44670
45442
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
44671
|
-
return cjsFile || process.argv[1] || (0,
|
|
45443
|
+
return cjsFile || process.argv[1] || (0, import_node_path77.join)(process.cwd(), "package.json");
|
|
44672
45444
|
}
|
|
44673
45445
|
function openDatabase3(filePath) {
|
|
44674
45446
|
const req = (0, import_node_module9.createRequire)(thisModuleFile5());
|
|
@@ -44705,8 +45477,8 @@ function assertRelayAccountsDurable(filePath) {
|
|
|
44705
45477
|
if (process.env.SIDEBOARD_RELAY_ACCOUNTS_EPHEMERAL === "1") return;
|
|
44706
45478
|
if (process.env.NODE_ENV !== "production") return;
|
|
44707
45479
|
if (process.platform !== "linux") return;
|
|
44708
|
-
const dir = (0,
|
|
44709
|
-
const mounts = (0,
|
|
45480
|
+
const dir = (0, import_node_fs77.realpathSync)((0, import_node_path77.dirname)(filePath));
|
|
45481
|
+
const mounts = (0, import_node_fs77.readFileSync)("/proc/mounts", "utf8");
|
|
44710
45482
|
const point = longestMountPoint(dir, mounts);
|
|
44711
45483
|
if (point === "/") {
|
|
44712
45484
|
throw new Error(
|
|
@@ -44717,7 +45489,7 @@ function assertRelayAccountsDurable(filePath) {
|
|
|
44717
45489
|
var RelayAccountStore = class {
|
|
44718
45490
|
db;
|
|
44719
45491
|
constructor(filePath) {
|
|
44720
|
-
(0,
|
|
45492
|
+
(0, import_node_fs77.mkdirSync)((0, import_node_path77.dirname)(filePath), { recursive: true });
|
|
44721
45493
|
this.db = openDatabase3(filePath);
|
|
44722
45494
|
this.db.exec(`
|
|
44723
45495
|
CREATE TABLE IF NOT EXISTS accounts (
|
|
@@ -45757,6 +46529,7 @@ async function startHeadlessHost(opts) {
|
|
|
45757
46529
|
claimDesktopHost();
|
|
45758
46530
|
bootstrapSystemCa();
|
|
45759
46531
|
armSchedules();
|
|
46532
|
+
armGithubEdgeWatch();
|
|
45760
46533
|
const ac = new AbortController();
|
|
45761
46534
|
let stopped = false;
|
|
45762
46535
|
let phoneConnected = false;
|
|
@@ -45828,19 +46601,20 @@ async function startHeadlessHost(opts) {
|
|
|
45828
46601
|
}
|
|
45829
46602
|
});
|
|
45830
46603
|
refreshAwake();
|
|
45831
|
-
const
|
|
46604
|
+
const timer2 = setInterval(() => {
|
|
45832
46605
|
if (!isThisProcessDesktopHost()) {
|
|
45833
46606
|
void stop();
|
|
45834
46607
|
return;
|
|
45835
46608
|
}
|
|
45836
46609
|
armSchedules();
|
|
46610
|
+
armGithubEdgeWatch();
|
|
45837
46611
|
void refreshRunning().then(() => refreshAwake());
|
|
45838
46612
|
}, REARM_MS);
|
|
45839
|
-
|
|
46613
|
+
timer2.unref?.();
|
|
45840
46614
|
const stop = async () => {
|
|
45841
46615
|
if (stopped) return;
|
|
45842
46616
|
stopped = true;
|
|
45843
|
-
clearInterval(
|
|
46617
|
+
clearInterval(timer2);
|
|
45844
46618
|
stopCaffeinate();
|
|
45845
46619
|
ac.abort();
|
|
45846
46620
|
if (relay) await relay.close();
|
|
@@ -46193,22 +46967,22 @@ init_error_detail();
|
|
|
46193
46967
|
init_cursor_stream_cutoff();
|
|
46194
46968
|
|
|
46195
46969
|
// src/agents/tool-result-clip.ts
|
|
46196
|
-
var
|
|
46197
|
-
var
|
|
46970
|
+
var import_node_fs78 = require("fs");
|
|
46971
|
+
var import_node_path78 = require("path");
|
|
46198
46972
|
init_workspace_scratch();
|
|
46199
46973
|
init_error_detail();
|
|
46200
46974
|
function spillPath(cwd, prefix) {
|
|
46201
46975
|
const stamp = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
46202
46976
|
const safe = prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 40) || "tool";
|
|
46203
|
-
return (0,
|
|
46977
|
+
return (0, import_node_path78.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
|
|
46204
46978
|
}
|
|
46205
46979
|
function spillToolResultToCli(content, opts) {
|
|
46206
46980
|
const cwd = opts?.cwd?.trim();
|
|
46207
46981
|
if (!cwd || !content) return null;
|
|
46208
46982
|
const file = spillPath(cwd, opts?.prefix ?? "tool-result");
|
|
46209
46983
|
try {
|
|
46210
|
-
(0,
|
|
46211
|
-
(0,
|
|
46984
|
+
(0, import_node_fs78.mkdirSync)((0, import_node_path78.join)(cwd, CLI_DIR), { recursive: true });
|
|
46985
|
+
(0, import_node_fs78.writeFileSync)(file, content, "utf8");
|
|
46212
46986
|
return file;
|
|
46213
46987
|
} catch {
|
|
46214
46988
|
return null;
|
|
@@ -46295,7 +47069,7 @@ function createClippedMcpServer() {
|
|
|
46295
47069
|
// src/mcp/server.ts
|
|
46296
47070
|
var import_zod12 = require("zod");
|
|
46297
47071
|
var import_node_crypto38 = require("crypto");
|
|
46298
|
-
var
|
|
47072
|
+
var import_node_path82 = require("path");
|
|
46299
47073
|
init_orchestrator();
|
|
46300
47074
|
init_task_state();
|
|
46301
47075
|
init_worktree();
|
|
@@ -46327,6 +47101,8 @@ init_workspace_tags();
|
|
|
46327
47101
|
// src/mcp/create-orch-child.ts
|
|
46328
47102
|
init_chat_tabs();
|
|
46329
47103
|
init_worktree_labels();
|
|
47104
|
+
init_app_settings();
|
|
47105
|
+
init_global_workspace();
|
|
46330
47106
|
|
|
46331
47107
|
// src/mcp/create-thread-agent.ts
|
|
46332
47108
|
init_cursor();
|
|
@@ -46375,20 +47151,34 @@ function orchCreateThreadAgentNote(input) {
|
|
|
46375
47151
|
}
|
|
46376
47152
|
|
|
46377
47153
|
// src/mcp/create-orch-child.ts
|
|
46378
|
-
var MAX_ORCH_THREADS = 5;
|
|
46379
47154
|
var CREATE_THREAD_TIMEOUT_MS = 9e4;
|
|
47155
|
+
function orchChildWorkspaceCount(threads, parentId) {
|
|
47156
|
+
const seen = /* @__PURE__ */ new Set();
|
|
47157
|
+
let unpathed = 0;
|
|
47158
|
+
for (const thread of threads) {
|
|
47159
|
+
if (thread.parentThreadId !== parentId) continue;
|
|
47160
|
+
if (isOrchestratorThread(thread)) continue;
|
|
47161
|
+
const raw = thread.worktreePath?.trim();
|
|
47162
|
+
if (!raw) {
|
|
47163
|
+
unpathed += 1;
|
|
47164
|
+
continue;
|
|
47165
|
+
}
|
|
47166
|
+
seen.add(normalizeWorktreePath(raw));
|
|
47167
|
+
}
|
|
47168
|
+
return seen.size + unpathed;
|
|
47169
|
+
}
|
|
46380
47170
|
function withTimeout2(promise, ms, label) {
|
|
46381
47171
|
return new Promise((resolve3, reject) => {
|
|
46382
|
-
const
|
|
47172
|
+
const timer2 = setTimeout(() => {
|
|
46383
47173
|
reject(new Error(`${label} timed out after ${Math.round(ms / 1e3)}s`));
|
|
46384
47174
|
}, ms);
|
|
46385
47175
|
promise.then(
|
|
46386
47176
|
(value) => {
|
|
46387
|
-
clearTimeout(
|
|
47177
|
+
clearTimeout(timer2);
|
|
46388
47178
|
resolve3(value);
|
|
46389
47179
|
},
|
|
46390
47180
|
(err) => {
|
|
46391
|
-
clearTimeout(
|
|
47181
|
+
clearTimeout(timer2);
|
|
46392
47182
|
reject(err);
|
|
46393
47183
|
}
|
|
46394
47184
|
);
|
|
@@ -46414,11 +47204,12 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
46414
47204
|
parent = null;
|
|
46415
47205
|
}
|
|
46416
47206
|
if (parentId) {
|
|
46417
|
-
const
|
|
46418
|
-
|
|
47207
|
+
const cap = maxOrchThreads();
|
|
47208
|
+
const used = orchChildWorkspaceCount(orch.getThreads(false), parentId);
|
|
47209
|
+
if (used >= cap) {
|
|
46419
47210
|
return {
|
|
46420
47211
|
ok: false,
|
|
46421
|
-
text: `
|
|
47212
|
+
text: `Workspace cap (${cap}) reached for this orchestration session. Raise it in Settings \u2192 Advanced \u2192 Max orchestration threads.`
|
|
46422
47213
|
};
|
|
46423
47214
|
}
|
|
46424
47215
|
}
|
|
@@ -47822,13 +48613,13 @@ function whenFromUpdate(id, args) {
|
|
|
47822
48613
|
}
|
|
47823
48614
|
function createdHint(schedule) {
|
|
47824
48615
|
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.";
|
|
48616
|
+
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
48617
|
return `Fires while Sideboard.app is running.${fresh}${awake}`;
|
|
47827
48618
|
}
|
|
47828
48619
|
function registerScheduleTools(server) {
|
|
47829
48620
|
server.tool(
|
|
47830
48621
|
"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.",
|
|
48622
|
+
"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
48623
|
{},
|
|
47833
48624
|
async () => {
|
|
47834
48625
|
try {
|
|
@@ -47840,7 +48631,7 @@ function registerScheduleTools(server) {
|
|
|
47840
48631
|
);
|
|
47841
48632
|
server.tool(
|
|
47842
48633
|
"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
|
|
48634
|
+
"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
48635
|
{
|
|
47845
48636
|
prompt: import_zod10.z.string().describe("User message / goal queued when the automation fires"),
|
|
47846
48637
|
name: import_zod10.z.string().optional(),
|
|
@@ -48271,7 +49062,7 @@ function registerOrderTools(server) {
|
|
|
48271
49062
|
|
|
48272
49063
|
// src/agent-rpc/handlers.ts
|
|
48273
49064
|
var import_node_crypto36 = require("crypto");
|
|
48274
|
-
var
|
|
49065
|
+
var import_node_path79 = require("path");
|
|
48275
49066
|
init_wait_for_job();
|
|
48276
49067
|
init_wait_for_turn();
|
|
48277
49068
|
|
|
@@ -48378,7 +49169,7 @@ function invalidParams2(message) {
|
|
|
48378
49169
|
function jobCwd(rec) {
|
|
48379
49170
|
const raw = str7(rec.cwd).trim();
|
|
48380
49171
|
if (!raw) throw invalidParams2("cwd is required");
|
|
48381
|
-
if (!(0,
|
|
49172
|
+
if (!(0, import_node_path79.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
|
|
48382
49173
|
return raw;
|
|
48383
49174
|
}
|
|
48384
49175
|
async function handleRuntimePing(_params, _ctx) {
|
|
@@ -48511,27 +49302,27 @@ init_gh_errors();
|
|
|
48511
49302
|
init_git_auth_mode();
|
|
48512
49303
|
|
|
48513
49304
|
// src/board/load-home-board.ts
|
|
48514
|
-
var
|
|
48515
|
-
var
|
|
49305
|
+
var import_node_fs80 = require("fs");
|
|
49306
|
+
var import_node_path81 = require("path");
|
|
48516
49307
|
init_worktree();
|
|
48517
49308
|
init_paths();
|
|
48518
49309
|
|
|
48519
49310
|
// src/board/board-pins.ts
|
|
48520
49311
|
var import_node_crypto37 = require("crypto");
|
|
48521
|
-
var
|
|
48522
|
-
var
|
|
49312
|
+
var import_node_fs79 = require("fs");
|
|
49313
|
+
var import_node_path80 = require("path");
|
|
48523
49314
|
init_paths();
|
|
48524
49315
|
init_home_board();
|
|
48525
49316
|
var FILE = "home-board-pins.json";
|
|
48526
49317
|
var VERSION2 = 1;
|
|
48527
49318
|
function pinsFile() {
|
|
48528
|
-
return (0,
|
|
49319
|
+
return (0, import_node_path80.join)(appDataDir(), FILE);
|
|
48529
49320
|
}
|
|
48530
49321
|
function readDisk() {
|
|
48531
49322
|
const path2 = pinsFile();
|
|
48532
|
-
if (!(0,
|
|
49323
|
+
if (!(0, import_node_fs79.existsSync)(path2)) return [];
|
|
48533
49324
|
try {
|
|
48534
|
-
const raw = JSON.parse((0,
|
|
49325
|
+
const raw = JSON.parse((0, import_node_fs79.readFileSync)(path2, "utf8"));
|
|
48535
49326
|
if (raw?.version !== VERSION2 || !Array.isArray(raw.items)) return [];
|
|
48536
49327
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
48537
49328
|
} catch {
|
|
@@ -48539,8 +49330,8 @@ function readDisk() {
|
|
|
48539
49330
|
}
|
|
48540
49331
|
}
|
|
48541
49332
|
function writeDisk(items) {
|
|
48542
|
-
(0,
|
|
48543
|
-
(0,
|
|
49333
|
+
(0, import_node_fs79.mkdirSync)(appDataDir(), { recursive: true });
|
|
49334
|
+
(0, import_node_fs79.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION2, items }, null, 2), "utf8");
|
|
48544
49335
|
}
|
|
48545
49336
|
function listBoardPins() {
|
|
48546
49337
|
return readDisk();
|
|
@@ -48592,7 +49383,7 @@ function replaceBoardPins(items) {
|
|
|
48592
49383
|
}
|
|
48593
49384
|
function clearBoardPins() {
|
|
48594
49385
|
try {
|
|
48595
|
-
(0,
|
|
49386
|
+
(0, import_node_fs79.unlinkSync)(pinsFile());
|
|
48596
49387
|
} catch {
|
|
48597
49388
|
}
|
|
48598
49389
|
}
|
|
@@ -48609,7 +49400,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
48609
49400
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
48610
49401
|
}
|
|
48611
49402
|
function cacheFile() {
|
|
48612
|
-
return (0,
|
|
49403
|
+
return (0, import_node_path81.join)(appDataDir(), "home-board-cache.json");
|
|
48613
49404
|
}
|
|
48614
49405
|
function emptyInputs() {
|
|
48615
49406
|
return {
|
|
@@ -48635,9 +49426,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
48635
49426
|
}
|
|
48636
49427
|
function readDiskCache() {
|
|
48637
49428
|
const path2 = cacheFile();
|
|
48638
|
-
if (!(0,
|
|
49429
|
+
if (!(0, import_node_fs80.existsSync)(path2)) return null;
|
|
48639
49430
|
try {
|
|
48640
|
-
const raw = JSON.parse((0,
|
|
49431
|
+
const raw = JSON.parse((0, import_node_fs80.readFileSync)(path2, "utf8"));
|
|
48641
49432
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
48642
49433
|
return null;
|
|
48643
49434
|
}
|
|
@@ -48651,14 +49442,14 @@ function readDiskCache() {
|
|
|
48651
49442
|
}
|
|
48652
49443
|
function writeDiskCache(entry) {
|
|
48653
49444
|
try {
|
|
48654
|
-
(0,
|
|
48655
|
-
(0,
|
|
49445
|
+
(0, import_node_fs80.mkdirSync)(appDataDir(), { recursive: true });
|
|
49446
|
+
(0, import_node_fs80.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
48656
49447
|
} catch {
|
|
48657
49448
|
}
|
|
48658
49449
|
}
|
|
48659
49450
|
function deleteDiskCache() {
|
|
48660
49451
|
try {
|
|
48661
|
-
(0,
|
|
49452
|
+
(0, import_node_fs80.unlinkSync)(cacheFile());
|
|
48662
49453
|
} catch {
|
|
48663
49454
|
}
|
|
48664
49455
|
}
|
|
@@ -48874,7 +49665,7 @@ async function startMcpServer() {
|
|
|
48874
49665
|
async () => {
|
|
48875
49666
|
const threads = orch.getThreads();
|
|
48876
49667
|
const lines = threads.map((t) => {
|
|
48877
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0,
|
|
49668
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path82.basename)(t.repoPath) || t.repoPath;
|
|
48878
49669
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
48879
49670
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
48880
49671
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -49354,6 +50145,36 @@ async function startMcpServer() {
|
|
|
49354
50145
|
}
|
|
49355
50146
|
}
|
|
49356
50147
|
);
|
|
50148
|
+
server.tool(
|
|
50149
|
+
"set_wake_on_github_edges",
|
|
50150
|
+
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.",
|
|
50151
|
+
{
|
|
50152
|
+
ref: import_zod12.z.string().optional().describe(
|
|
50153
|
+
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
50154
|
+
),
|
|
50155
|
+
enabled: import_zod12.z.boolean().describe("True opts the checkout in. False turns it off.")
|
|
50156
|
+
},
|
|
50157
|
+
async ({ ref, enabled }) => {
|
|
50158
|
+
try {
|
|
50159
|
+
const callerId = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
|
|
50160
|
+
const target = wakeOnGithubEdgesTargetRef({
|
|
50161
|
+
ownWorktreeOnly: worktreeProfile,
|
|
50162
|
+
caller: callerId ? orch.getThread(callerId) : null,
|
|
50163
|
+
requestedRef: ref,
|
|
50164
|
+
find: (id) => orch.getThread(id)
|
|
50165
|
+
});
|
|
50166
|
+
const thread = applyWakeOnGithubEdges(target, enabled);
|
|
50167
|
+
return mcpJson({
|
|
50168
|
+
id: thread.id,
|
|
50169
|
+
worktreePath: thread.worktreePath,
|
|
50170
|
+
wakeOnGithubEdges: thread.wakeOnGithubEdges === true
|
|
50171
|
+
});
|
|
50172
|
+
} catch (err) {
|
|
50173
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
50174
|
+
return mcpJson({ ok: false, message }, true);
|
|
50175
|
+
}
|
|
50176
|
+
}
|
|
50177
|
+
);
|
|
49357
50178
|
if (!worktreeProfile) {
|
|
49358
50179
|
registerConnectedIssueVendorTools(server);
|
|
49359
50180
|
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await Promise.resolve().then(() => (init_caffeinate_hold(), caffeinate_hold_exports));
|
|
@@ -49388,7 +50209,7 @@ async function startMcpServer() {
|
|
|
49388
50209
|
);
|
|
49389
50210
|
server.tool(
|
|
49390
50211
|
"create_workspace",
|
|
49391
|
-
`Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags.`,
|
|
50212
|
+
`Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags. Each orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.`,
|
|
49392
50213
|
{
|
|
49393
50214
|
sourceType: import_zod12.z.enum(["branch", "pr", "ticket"]),
|
|
49394
50215
|
sourceRef: import_zod12.z.string(),
|
|
@@ -51021,19 +51842,19 @@ init_turn_live();
|
|
|
51021
51842
|
init_thread_store();
|
|
51022
51843
|
|
|
51023
51844
|
// src/slack/reply-target.ts
|
|
51024
|
-
var
|
|
51025
|
-
var
|
|
51845
|
+
var import_node_fs81 = require("fs");
|
|
51846
|
+
var import_node_path83 = require("path");
|
|
51026
51847
|
init_paths();
|
|
51027
51848
|
init_private_file();
|
|
51028
51849
|
init_secure_file();
|
|
51029
51850
|
function storePath3() {
|
|
51030
|
-
return (0,
|
|
51851
|
+
return (0, import_node_path83.join)(appDataDir(), "slack-reply-to.json");
|
|
51031
51852
|
}
|
|
51032
51853
|
function readStore3() {
|
|
51033
51854
|
const path2 = storePath3();
|
|
51034
|
-
if (!(0,
|
|
51855
|
+
if (!(0, import_node_fs81.existsSync)(path2)) return {};
|
|
51035
51856
|
try {
|
|
51036
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0,
|
|
51857
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs81.readFileSync)(path2, "utf8"));
|
|
51037
51858
|
return parsed?.targets && typeof parsed.targets === "object" ? parsed.targets : {};
|
|
51038
51859
|
} catch {
|
|
51039
51860
|
return {};
|
|
@@ -51131,7 +51952,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51131
51952
|
let relayAnswersClaims = false;
|
|
51132
51953
|
const fallbackTimers = /* @__PURE__ */ new Map();
|
|
51133
51954
|
const clearFallbackTimers = () => {
|
|
51134
|
-
for (const
|
|
51955
|
+
for (const timer2 of fallbackTimers.values()) clearTimeout(timer2);
|
|
51135
51956
|
fallbackTimers.clear();
|
|
51136
51957
|
};
|
|
51137
51958
|
const markClaimsAnswered = () => {
|
|
@@ -51248,7 +52069,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51248
52069
|
send2(ws, { type: "claim", eventId: msg.eventId });
|
|
51249
52070
|
if (!relayAnswersClaims) {
|
|
51250
52071
|
const eventId = msg.eventId;
|
|
51251
|
-
const
|
|
52072
|
+
const timer2 = setTimeout(() => {
|
|
51252
52073
|
fallbackTimers.delete(eventId);
|
|
51253
52074
|
const inbound = pending.get(eventId);
|
|
51254
52075
|
if (!inbound) return;
|
|
@@ -51258,7 +52079,7 @@ function connectSession2(ws, opts, log) {
|
|
|
51258
52079
|
log(`event error: ${errMsg}`);
|
|
51259
52080
|
});
|
|
51260
52081
|
}, opts.claimFallbackMs ?? CLAIM_FALLBACK_MS);
|
|
51261
|
-
fallbackTimers.set(eventId,
|
|
52082
|
+
fallbackTimers.set(eventId, timer2);
|
|
51262
52083
|
}
|
|
51263
52084
|
return;
|
|
51264
52085
|
}
|
|
@@ -51894,12 +52715,12 @@ function sleep2(ms, signal) {
|
|
|
51894
52715
|
reject(new RemoteAccountLoginCancelled());
|
|
51895
52716
|
return;
|
|
51896
52717
|
}
|
|
51897
|
-
const
|
|
52718
|
+
const timer2 = setTimeout(() => {
|
|
51898
52719
|
signal?.removeEventListener("abort", onAbort);
|
|
51899
52720
|
resolve3();
|
|
51900
52721
|
}, ms);
|
|
51901
52722
|
const onAbort = () => {
|
|
51902
|
-
clearTimeout(
|
|
52723
|
+
clearTimeout(timer2);
|
|
51903
52724
|
reject(new RemoteAccountLoginCancelled());
|
|
51904
52725
|
};
|
|
51905
52726
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
@@ -51998,8 +52819,8 @@ async function disconnectRemoteAccount(opts) {
|
|
|
51998
52819
|
}
|
|
51999
52820
|
|
|
52000
52821
|
// src/slack/outbound-watch.ts
|
|
52001
|
-
var
|
|
52002
|
-
var
|
|
52822
|
+
var import_node_fs82 = require("fs");
|
|
52823
|
+
var import_node_path84 = require("path");
|
|
52003
52824
|
init_paths();
|
|
52004
52825
|
init_private_file();
|
|
52005
52826
|
init_secure_file();
|
|
@@ -52012,7 +52833,7 @@ var POLL_INTERVAL_MS = 12e3;
|
|
|
52012
52833
|
var lastPollMs = 0;
|
|
52013
52834
|
var nameCache = /* @__PURE__ */ new Map();
|
|
52014
52835
|
function storePath4() {
|
|
52015
|
-
return (0,
|
|
52836
|
+
return (0, import_node_path84.join)(appDataDir(), "slack-outbound-watch.json");
|
|
52016
52837
|
}
|
|
52017
52838
|
function watchId(teamId, channelId, ts) {
|
|
52018
52839
|
return `${teamId}:${channelId}:${ts}`;
|
|
@@ -52025,9 +52846,9 @@ function tsNewer(a, b) {
|
|
|
52025
52846
|
}
|
|
52026
52847
|
function readStore4() {
|
|
52027
52848
|
const path2 = storePath4();
|
|
52028
|
-
if (!(0,
|
|
52849
|
+
if (!(0, import_node_fs82.existsSync)(path2)) return [];
|
|
52029
52850
|
try {
|
|
52030
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0,
|
|
52851
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs82.readFileSync)(path2, "utf8"));
|
|
52031
52852
|
return Array.isArray(parsed?.watches) ? parsed.watches : [];
|
|
52032
52853
|
} catch {
|
|
52033
52854
|
return [];
|
|
@@ -52433,6 +53254,9 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52433
53254
|
LONG_RUNNING_SKILL_COMMAND,
|
|
52434
53255
|
LinearOAuthCancelledError,
|
|
52435
53256
|
MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
|
|
53257
|
+
MAX_ORCH_THREADS_DEFAULT,
|
|
53258
|
+
MAX_ORCH_THREADS_MAX,
|
|
53259
|
+
MAX_ORCH_THREADS_MIN,
|
|
52436
53260
|
OPTIONAL_SERVICES,
|
|
52437
53261
|
OPTIONAL_SERVICE_IDS,
|
|
52438
53262
|
ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -52465,6 +53289,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52465
53289
|
RUN_PORTS_REL,
|
|
52466
53290
|
RUN_SCRIPT_DESKTOP_ADOPT_MS,
|
|
52467
53291
|
RemoteHub,
|
|
53292
|
+
SCHEDULE_RUN_HISTORY_LIMIT,
|
|
52468
53293
|
SEED_FULL_TOOL_MESSAGES,
|
|
52469
53294
|
SEED_MAX_CHARS,
|
|
52470
53295
|
SESSION_RESET_OCCUPANCY_TOKENS,
|
|
@@ -52545,9 +53370,11 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52545
53370
|
applySystemCaEnv,
|
|
52546
53371
|
applyThreadIntoMain,
|
|
52547
53372
|
applyTurnUsage,
|
|
53373
|
+
applyWakeOnGithubEdges,
|
|
52548
53374
|
applyWorkspaceTags,
|
|
52549
53375
|
archiveRemovedWorkspaceChats,
|
|
52550
53376
|
archivesWithRemovedWorkspace,
|
|
53377
|
+
armGithubEdgeWatch,
|
|
52551
53378
|
armSchedules,
|
|
52552
53379
|
askBlockStillWaiting,
|
|
52553
53380
|
assertAbleTimeCredential,
|
|
@@ -52869,6 +53696,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
52869
53696
|
getOrderPlan,
|
|
52870
53697
|
getPr,
|
|
52871
53698
|
getPrChecks,
|
|
53699
|
+
getPrCiChecks,
|
|
52872
53700
|
getPrDetails,
|
|
52873
53701
|
getPrForHeadBranch,
|
|
52874
53702
|
getPrMeta,
|
|
@@ -53095,6 +53923,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
53095
53923
|
markPrReady,
|
|
53096
53924
|
materializeSystemCaBundle,
|
|
53097
53925
|
maxConcurrentAgents,
|
|
53926
|
+
maxOrchThreads,
|
|
53098
53927
|
maybeCompactContext,
|
|
53099
53928
|
mcpAllowTools,
|
|
53100
53929
|
mcpAllowToolsFromNames,
|
|
@@ -53469,6 +54298,7 @@ async function pollSlackOutboundWatches(opts) {
|
|
|
53469
54298
|
visibleAssistantText,
|
|
53470
54299
|
visibleToolRowDetail,
|
|
53471
54300
|
waitForPidExit,
|
|
54301
|
+
wakeOrchestratorOnGithubEdgesEnabled,
|
|
53472
54302
|
warmGithubAgentAuth,
|
|
53473
54303
|
weeklyCronExpr,
|
|
53474
54304
|
whichOnPath,
|