@sideboard-ai/core 0.1.348 → 0.1.349
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/cursor-runner.js +3 -3
- package/dist/{agents-5MFGVK7C.js → agents-AZ2PV6XP.js} +7 -7
- package/dist/{agents-T4XBZZDA.js → agents-DMPBFF3F.js} +5 -5
- package/dist/{chunk-UGUWFONI.js → chunk-2E2HMJDU.js} +1 -1
- package/dist/{chunk-NTY5WGRD.js → chunk-3DBL2C45.js} +1 -1
- package/dist/{chunk-MOUAM6ZC.js → chunk-6RIPZ73M.js} +132 -2
- package/dist/{chunk-6TV6L2DD.js → chunk-CATTIFSP.js} +6 -5
- package/dist/{chunk-WMD77UCY.js → chunk-IRFBD6GU.js} +223 -55
- package/dist/{chunk-ORO4ENZR.js → chunk-LESWJ7L4.js} +1 -0
- package/dist/{chunk-XNGW4OYD.js → chunk-MHSBF3SO.js} +6 -5
- package/dist/{chunk-ZJMYCDYQ.js → chunk-MVFFLU5V.js} +47 -9
- package/dist/{chunk-OPXEJJBM.js → chunk-PWOFUPYM.js} +1 -0
- package/dist/{chunk-OH3BAUMC.js → chunk-Q4I6KDOL.js} +227 -59
- package/dist/{chunk-2HPVGTHF.js → chunk-QHXZKHUL.js} +1 -1
- package/dist/{chunk-GAGTEI6B.js → chunk-ROXM6QZV.js} +48 -10
- package/dist/{chunk-ATS7SYHG.js → chunk-RPHH4FNK.js} +132 -2
- package/dist/{chunk-Y6VQX2LY.js → chunk-WHMLMCPU.js} +11 -5
- package/dist/{chunk-BIM24I3O.js → chunk-WWBPK7GB.js} +1 -1
- package/dist/{chunk-5YCKATG6.js → chunk-YVN7L4KG.js} +1 -1
- package/dist/{chunk-Q4TZA4MN.js → chunk-ZXI5DR5S.js} +12 -6
- package/dist/{conductor-EMGMDNHL.js → conductor-65VPUPOW.js} +6 -6
- package/dist/{conductor-LYQKONSA.js → conductor-NHC6X74J.js} +5 -5
- package/dist/{coordinator-prompt-DLY3FS2L.js → coordinator-prompt-5GZWIVSY.js} +3 -3
- package/dist/{coordinator-prompt-WALVMGKI.js → coordinator-prompt-R2PURZL3.js} +3 -3
- package/dist/{global-workspace-UG2A3CEM.js → global-workspace-64KC7PST.js} +3 -3
- package/dist/{global-workspace-7OQ5O6JT.js → global-workspace-UEECLWSX.js} +3 -3
- package/dist/index.cjs +1298 -849
- package/dist/index.d.cts +30 -8
- package/dist/index.d.ts +30 -8
- package/dist/index.js +445 -365
- package/dist/mcp/run-stdio.cjs +1033 -585
- package/dist/mcp/run-stdio.js +296 -216
- package/dist/{orchestrator-4SXTORD2.js → orchestrator-I5G5A5BV.js} +7 -7
- package/dist/{orchestrator-KNOMW5CZ.js → orchestrator-Y5PYSMR6.js} +9 -9
- package/dist/{thread-store-R3G5VBII.js → thread-store-HZ4U4OXB.js} +1 -1
- package/dist/{thread-store-MEUWZDVV.js → thread-store-QKNU5CHM.js} +1 -1
- package/dist/{workspaces-KWGTP7DI.js → workspaces-6TIM2TM2.js} +3 -3
- package/dist/{workspaces-35T6FW57.js → workspaces-I2EHNTFE.js} +3 -3
- package/dist/{worktree-ROJXGBWS.js → worktree-7JFYDNUX.js} +2 -2
- package/dist/{worktree-5P7SCST3.js → worktree-M2GJGK2P.js} +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
worktreeCleanupSettings,
|
|
223
223
|
writeAgentBlock,
|
|
224
224
|
writeWorktreeFile
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-IRFBD6GU.js";
|
|
226
226
|
import {
|
|
227
227
|
OPTIONAL_SERVICES,
|
|
228
228
|
OPTIONAL_SERVICE_IDS,
|
|
@@ -383,7 +383,7 @@ import {
|
|
|
383
383
|
userMcpNamesToDisable,
|
|
384
384
|
worktreeMcpToolNames,
|
|
385
385
|
writeInjectedMcpConfig
|
|
386
|
-
} from "./chunk-
|
|
386
|
+
} from "./chunk-ZXI5DR5S.js";
|
|
387
387
|
import {
|
|
388
388
|
getAgentSetupInfo,
|
|
389
389
|
installAgent,
|
|
@@ -442,6 +442,7 @@ import {
|
|
|
442
442
|
buildWorkspaceScriptEnv,
|
|
443
443
|
canReuseIdleWorktreeAgentForReview,
|
|
444
444
|
captureLoginEnv,
|
|
445
|
+
classifyTurnFailure,
|
|
445
446
|
compactArchiveProse,
|
|
446
447
|
copyConfiguredFiles,
|
|
447
448
|
createChatTab,
|
|
@@ -517,7 +518,7 @@ import {
|
|
|
517
518
|
workspaceAgentChatSummaries,
|
|
518
519
|
worktreeRunPortsPath,
|
|
519
520
|
wrapReviewSkillMarkdown
|
|
520
|
-
} from "./chunk-
|
|
521
|
+
} from "./chunk-ROXM6QZV.js";
|
|
521
522
|
import {
|
|
522
523
|
STDERR_EVENT_MAX_CHARS,
|
|
523
524
|
STDOUT_EVENT_MAX_CHARS,
|
|
@@ -559,7 +560,7 @@ import {
|
|
|
559
560
|
visibleToolRowDetail,
|
|
560
561
|
withEventParentId,
|
|
561
562
|
withEventsParentId
|
|
562
|
-
} from "./chunk-
|
|
563
|
+
} from "./chunk-WWBPK7GB.js";
|
|
563
564
|
import "./chunk-7H655NEW.js";
|
|
564
565
|
import {
|
|
565
566
|
ABLETIME_OAUTH_CALLBACK_PATH,
|
|
@@ -660,7 +661,7 @@ import {
|
|
|
660
661
|
stageBuffersAsAttachments,
|
|
661
662
|
syncWorkspacesFromThreads,
|
|
662
663
|
takenTeamSlugsForOrchestration
|
|
663
|
-
} from "./chunk-
|
|
664
|
+
} from "./chunk-MHSBF3SO.js";
|
|
664
665
|
import {
|
|
665
666
|
GITHUB_PR_BODY_MAX_CHARS,
|
|
666
667
|
GITHUB_PR_BODY_SAFE_CHARS,
|
|
@@ -750,14 +751,16 @@ import {
|
|
|
750
751
|
suggestSlug,
|
|
751
752
|
switchWorktreeBranch,
|
|
752
753
|
warmGithubAgentAuth
|
|
753
|
-
} from "./chunk-
|
|
754
|
+
} from "./chunk-3DBL2C45.js";
|
|
754
755
|
import {
|
|
755
756
|
FAMOUS_SOCCER_TEAMS,
|
|
756
757
|
SCHEDULE_RUN_HISTORY_LIMIT,
|
|
757
758
|
WEEKDAY_LABELS,
|
|
759
|
+
addChatFollowUp,
|
|
758
760
|
allocateTeamName,
|
|
759
761
|
appendMessage,
|
|
760
762
|
branchDisplayLabel,
|
|
763
|
+
ciChecksSettled,
|
|
761
764
|
computeNextRunAt,
|
|
762
765
|
createEmptyThread,
|
|
763
766
|
createSchedule,
|
|
@@ -778,6 +781,7 @@ import {
|
|
|
778
781
|
listSchedules,
|
|
779
782
|
listThreads,
|
|
780
783
|
lookupSoccerTeam,
|
|
784
|
+
normalizeChatFollowUps,
|
|
781
785
|
normalizeThread,
|
|
782
786
|
normalizeWeekdays,
|
|
783
787
|
normalizeWeeklyTime,
|
|
@@ -807,7 +811,7 @@ import {
|
|
|
807
811
|
worktreeNameFromPath,
|
|
808
812
|
worktreeSlugForTicket,
|
|
809
813
|
writeThread
|
|
810
|
-
} from "./chunk-
|
|
814
|
+
} from "./chunk-RPHH4FNK.js";
|
|
811
815
|
import "./chunk-BMRJNRQK.js";
|
|
812
816
|
import {
|
|
813
817
|
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
@@ -858,7 +862,7 @@ import {
|
|
|
858
862
|
import {
|
|
859
863
|
clipMcpToolResult,
|
|
860
864
|
cursorToolErrorText
|
|
861
|
-
} from "./chunk-
|
|
865
|
+
} from "./chunk-YVN7L4KG.js";
|
|
862
866
|
import "./chunk-AXQ4ZWHK.js";
|
|
863
867
|
import {
|
|
864
868
|
AGENT_RUNNER_MAX_OLD_SPACE_MB,
|
|
@@ -876,8 +880,8 @@ import {
|
|
|
876
880
|
trustSystemCertificates,
|
|
877
881
|
turnCostUsdFromCursorUsage,
|
|
878
882
|
withMaxOldSpaceSize
|
|
879
|
-
} from "./chunk-
|
|
880
|
-
import "./chunk-
|
|
883
|
+
} from "./chunk-2E2HMJDU.js";
|
|
884
|
+
import "./chunk-PWOFUPYM.js";
|
|
881
885
|
import {
|
|
882
886
|
ATTACHMENTS_DIR,
|
|
883
887
|
CLI_DIR,
|
|
@@ -1397,16 +1401,16 @@ function concat(parts) {
|
|
|
1397
1401
|
}
|
|
1398
1402
|
return out;
|
|
1399
1403
|
}
|
|
1400
|
-
function utf8(
|
|
1401
|
-
return new TextEncoder().encode(
|
|
1404
|
+
function utf8(text6) {
|
|
1405
|
+
return new TextEncoder().encode(text6);
|
|
1402
1406
|
}
|
|
1403
1407
|
function bytesToB64url(bytes) {
|
|
1404
1408
|
let binary = "";
|
|
1405
1409
|
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
1406
1410
|
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
1407
1411
|
}
|
|
1408
|
-
function b64urlToBytes(
|
|
1409
|
-
const padded =
|
|
1412
|
+
function b64urlToBytes(text6) {
|
|
1413
|
+
const padded = text6.replaceAll("-", "+").replaceAll("_", "/") + "=".repeat((4 - text6.length % 4) % 4);
|
|
1410
1414
|
const binary = atob(padded);
|
|
1411
1415
|
const out = new Uint8Array(binary.length);
|
|
1412
1416
|
for (let i = 0; i < binary.length; i++) out[i] = binary.charCodeAt(i);
|
|
@@ -1597,18 +1601,18 @@ function lastVisibleMessage(messages) {
|
|
|
1597
1601
|
const m = messages[i];
|
|
1598
1602
|
if (!m) continue;
|
|
1599
1603
|
if (m.role === "agent") {
|
|
1600
|
-
const
|
|
1601
|
-
if (
|
|
1604
|
+
const text6 = (lastAssistantMessageText(m.parts) || m.text || "").trim();
|
|
1605
|
+
if (text6 && !isInternalAgentStatusText(text6)) return m;
|
|
1602
1606
|
continue;
|
|
1603
1607
|
}
|
|
1604
1608
|
if (m.role === "user" && m.text?.trim()) return m;
|
|
1605
1609
|
}
|
|
1606
1610
|
return void 0;
|
|
1607
1611
|
}
|
|
1608
|
-
function agentStub(source,
|
|
1612
|
+
function agentStub(source, text6, usage) {
|
|
1609
1613
|
return {
|
|
1610
1614
|
role: "agent",
|
|
1611
|
-
text:
|
|
1615
|
+
text: text6,
|
|
1612
1616
|
ts: source.ts,
|
|
1613
1617
|
...usage ? { usage } : {}
|
|
1614
1618
|
};
|
|
@@ -2668,11 +2672,11 @@ function fenceLanguage(path2, language) {
|
|
|
2668
2672
|
}
|
|
2669
2673
|
function buildCodeRefAttachment(input) {
|
|
2670
2674
|
const path2 = input.path.trim();
|
|
2671
|
-
const
|
|
2675
|
+
const text6 = input.text.replace(/\n$/, "");
|
|
2672
2676
|
if (!path2) {
|
|
2673
2677
|
throw new Error("code reference requires a file path");
|
|
2674
2678
|
}
|
|
2675
|
-
if (!
|
|
2679
|
+
if (!text6.trim()) {
|
|
2676
2680
|
throw new Error("code reference requires selected text");
|
|
2677
2681
|
}
|
|
2678
2682
|
if (input.startLine < 1 || input.endLine < 1 || input.endLine < input.startLine) {
|
|
@@ -2685,7 +2689,7 @@ function buildCodeRefAttachment(input) {
|
|
|
2685
2689
|
`Referenced code from \`${path2}\` (${range}).`,
|
|
2686
2690
|
"",
|
|
2687
2691
|
fence,
|
|
2688
|
-
|
|
2692
|
+
text6,
|
|
2689
2693
|
"```"
|
|
2690
2694
|
].join("\n");
|
|
2691
2695
|
return {
|
|
@@ -2833,9 +2837,9 @@ function isArtifactTool(name) {
|
|
|
2833
2837
|
const short = name.split("__").pop() ?? name;
|
|
2834
2838
|
return /^(present_artifact|create_artifact|update_artifact)$/i.test(short);
|
|
2835
2839
|
}
|
|
2836
|
-
function phoneArtifactText(
|
|
2840
|
+
function phoneArtifactText(text6, parts, limit = Number.POSITIVE_INFINITY) {
|
|
2837
2841
|
const hints = /* @__PURE__ */ new Set();
|
|
2838
|
-
const body =
|
|
2842
|
+
const body = text6.replace(new RegExp(FENCE_RE.source, "g"), (full, language, content) => {
|
|
2839
2843
|
const kind = kindFor(language, content);
|
|
2840
2844
|
if (!kind) return full;
|
|
2841
2845
|
const hint = artifactHint(content);
|
|
@@ -3089,11 +3093,11 @@ function parsePhoneCodeRefs(value) {
|
|
|
3089
3093
|
const startLine = lineNumber(item, "startLine");
|
|
3090
3094
|
const endLine = lineNumber(item, "endLine");
|
|
3091
3095
|
const textRaw = item.text;
|
|
3092
|
-
const
|
|
3093
|
-
if (!path2 || !startLine || !endLine || endLine < startLine || !
|
|
3094
|
-
total +=
|
|
3096
|
+
const text6 = typeof textRaw === "string" ? textRaw.replace(/\n$/, "").slice(0, MAX_TEXT) : "";
|
|
3097
|
+
if (!path2 || !startLine || !endLine || endLine < startLine || !text6.trim()) return "invalid";
|
|
3098
|
+
total += text6.length;
|
|
3095
3099
|
if (total > MAX_TOTAL) return "invalid";
|
|
3096
|
-
refs.push({ path: path2, startLine, endLine, text:
|
|
3100
|
+
refs.push({ path: path2, startLine, endLine, text: text6 });
|
|
3097
3101
|
}
|
|
3098
3102
|
return refs;
|
|
3099
3103
|
}
|
|
@@ -3253,9 +3257,9 @@ async function getGitHubStatus() {
|
|
|
3253
3257
|
};
|
|
3254
3258
|
}
|
|
3255
3259
|
const status = await run("gh", ["auth", "status"], { reject: false });
|
|
3256
|
-
const
|
|
3260
|
+
const text6 = `${status.stdout}
|
|
3257
3261
|
${status.stderr}`;
|
|
3258
|
-
const loginMatch =
|
|
3262
|
+
const loginMatch = text6.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text6.match(/Logged in to ([^\s]+) as (\S+)/i);
|
|
3259
3263
|
if (loginMatch) {
|
|
3260
3264
|
return {
|
|
3261
3265
|
connected: true,
|
|
@@ -3327,9 +3331,9 @@ function parsePhoneMcpUi(value, op, chatId) {
|
|
|
3327
3331
|
}
|
|
3328
3332
|
if (op === "mcp-ui-context") {
|
|
3329
3333
|
const reqId2 = controlText(value, "reqId");
|
|
3330
|
-
const
|
|
3331
|
-
if (!reqId2 || reqId2.length > 40 || !
|
|
3332
|
-
return { op, chatId, reqId: reqId2, text:
|
|
3334
|
+
const text6 = controlText(value, "text");
|
|
3335
|
+
if (!reqId2 || reqId2.length > 40 || !text6 || text6.length > 8e3) return "invalid";
|
|
3336
|
+
return { op, chatId, reqId: reqId2, text: text6 };
|
|
3333
3337
|
}
|
|
3334
3338
|
if (op !== "mcp-ui-call" && op !== "mcp-ui-read") return "invalid";
|
|
3335
3339
|
const reqId = controlText(value, "reqId");
|
|
@@ -3393,30 +3397,30 @@ var PHONE_USER_PREFIX = "Phone\n\n";
|
|
|
3393
3397
|
var TRANSCRIPT_LIMIT = 40;
|
|
3394
3398
|
var MESSAGE_LIMIT = 4e3;
|
|
3395
3399
|
var CRASH_CONTINUE_PREFIX = "The previous agent process ended before it finished.";
|
|
3396
|
-
function isHostContinuePrompt(
|
|
3397
|
-
const trimmed =
|
|
3400
|
+
function isHostContinuePrompt(text6) {
|
|
3401
|
+
const trimmed = text6.trim();
|
|
3398
3402
|
return isJobContinuePrompt(trimmed) || trimmed.startsWith(CRASH_CONTINUE_PREFIX);
|
|
3399
3403
|
}
|
|
3400
|
-
function phoneVisibleText(role,
|
|
3401
|
-
const trimmed =
|
|
3404
|
+
function phoneVisibleText(role, text6) {
|
|
3405
|
+
const trimmed = text6.trim();
|
|
3402
3406
|
if (role === "user" && trimmed.startsWith(PHONE_USER_PREFIX)) {
|
|
3403
3407
|
return trimmed.slice(PHONE_USER_PREFIX.length).trim();
|
|
3404
3408
|
}
|
|
3405
3409
|
return trimmed;
|
|
3406
3410
|
}
|
|
3407
|
-
function clip(
|
|
3408
|
-
if (
|
|
3409
|
-
return `${
|
|
3411
|
+
function clip(text6, limit) {
|
|
3412
|
+
if (text6.length <= limit) return text6;
|
|
3413
|
+
return `${text6.slice(0, limit - 1)}\u2026`;
|
|
3410
3414
|
}
|
|
3411
3415
|
function withLiveTail(thread, messages) {
|
|
3412
3416
|
if (thread.status !== "running" && thread.status !== "queued") return messages;
|
|
3413
|
-
const
|
|
3414
|
-
if (!
|
|
3417
|
+
const text6 = clip(phoneStreamFrame(readTurnLiveParts(thread.id)).text.trim(), MESSAGE_LIMIT);
|
|
3418
|
+
if (!text6) return messages;
|
|
3415
3419
|
const last = messages[messages.length - 1];
|
|
3416
|
-
if (last?.role === "agent" && last.text ===
|
|
3420
|
+
if (last?.role === "agent" && last.text === text6) {
|
|
3417
3421
|
return last.streaming ? messages : [...messages.slice(0, -1), { ...last, streaming: true }];
|
|
3418
3422
|
}
|
|
3419
|
-
return [...messages, { role: "agent", text:
|
|
3423
|
+
return [...messages, { role: "agent", text: text6, streaming: true }];
|
|
3420
3424
|
}
|
|
3421
3425
|
function listPhoneMessages(thread) {
|
|
3422
3426
|
const out = [];
|
|
@@ -3427,16 +3431,16 @@ function listPhoneMessages(thread) {
|
|
|
3427
3431
|
}
|
|
3428
3432
|
const names = (message.attachments ?? []).map((item) => item.name.trim()).filter(Boolean);
|
|
3429
3433
|
const visible = [phoneVisibleText(message.role, message.text), names.length ? names.join(", ") : ""].filter(Boolean).join("\n");
|
|
3430
|
-
const
|
|
3434
|
+
const text6 = message.role === "agent" ? phoneArtifactText(visible, message.parts, MESSAGE_LIMIT) : clip(visible, MESSAGE_LIMIT);
|
|
3431
3435
|
const apps = message.role === "agent" ? phoneMcpApps(thread.agent, message.parts) : [];
|
|
3432
|
-
if (!
|
|
3433
|
-
out.push({ role: message.role, text:
|
|
3436
|
+
if (!text6 && apps.length === 0) continue;
|
|
3437
|
+
out.push({ role: message.role, text: text6, ...apps.length ? { apps } : {} });
|
|
3434
3438
|
}
|
|
3435
3439
|
const live = withLiveTail(thread, out);
|
|
3436
3440
|
for (const prompt of thread.queue) {
|
|
3437
3441
|
if (isHostContinuePrompt(prompt)) continue;
|
|
3438
|
-
const
|
|
3439
|
-
if (
|
|
3442
|
+
const text6 = clip(phoneVisibleText("user", prompt), MESSAGE_LIMIT);
|
|
3443
|
+
if (text6) live.push({ role: "user", text: text6 });
|
|
3440
3444
|
}
|
|
3441
3445
|
return live.slice(-TRANSCRIPT_LIMIT);
|
|
3442
3446
|
}
|
|
@@ -3508,11 +3512,11 @@ var MAX_DICTATION_CHARS = Math.ceil(12 * 1024 * 1024 * 4 / 3);
|
|
|
3508
3512
|
function encodePhoneControl(payload) {
|
|
3509
3513
|
return PHONE_CONTROL_PREFIX + JSON.stringify(payload);
|
|
3510
3514
|
}
|
|
3511
|
-
function takePhoneControl(
|
|
3512
|
-
if (!
|
|
3515
|
+
function takePhoneControl(text6) {
|
|
3516
|
+
if (!text6.startsWith(PHONE_CONTROL_PREFIX)) return null;
|
|
3513
3517
|
let parsed;
|
|
3514
3518
|
try {
|
|
3515
|
-
parsed = JSON.parse(
|
|
3519
|
+
parsed = JSON.parse(text6.slice(PHONE_CONTROL_PREFIX.length));
|
|
3516
3520
|
} catch {
|
|
3517
3521
|
return "invalid";
|
|
3518
3522
|
}
|
|
@@ -3582,10 +3586,10 @@ function parsePhoneControl(value) {
|
|
|
3582
3586
|
if (draft === "invalid") return "invalid";
|
|
3583
3587
|
if (op === "options") return { op: "options", chatId, ...draft };
|
|
3584
3588
|
if (op === "prompt") {
|
|
3585
|
-
const
|
|
3586
|
-
const hasPayload = Boolean(
|
|
3589
|
+
const text6 = typeof value.text === "string" ? value.text.trim() : "";
|
|
3590
|
+
const hasPayload = Boolean(text6 || draft.files?.length || draft.links?.length || draft.refs?.length);
|
|
3587
3591
|
if (!hasPayload) return "invalid";
|
|
3588
|
-
return { op: "prompt", chatId, text:
|
|
3592
|
+
return { op: "prompt", chatId, text: text6, ...draft };
|
|
3589
3593
|
}
|
|
3590
3594
|
return "invalid";
|
|
3591
3595
|
}
|
|
@@ -3982,8 +3986,8 @@ function outboundReplyFromTurn(result, copy) {
|
|
|
3982
3986
|
case "working":
|
|
3983
3987
|
return copy.failed(`turn still ${result.taskState}`);
|
|
3984
3988
|
default: {
|
|
3985
|
-
const
|
|
3986
|
-
return
|
|
3989
|
+
const text6 = result.text.trim();
|
|
3990
|
+
return text6 || copy.completedEmpty(result.status);
|
|
3987
3991
|
}
|
|
3988
3992
|
}
|
|
3989
3993
|
}
|
|
@@ -4227,26 +4231,26 @@ var IMAGE_MIME = {
|
|
|
4227
4231
|
bmp: "image/bmp"
|
|
4228
4232
|
};
|
|
4229
4233
|
function phoneWorktreeRelative(worktreePath, raw) {
|
|
4230
|
-
let
|
|
4231
|
-
if (!
|
|
4232
|
-
if (/^file:\/\//i.test(
|
|
4234
|
+
let text6 = raw.trim();
|
|
4235
|
+
if (!text6) return null;
|
|
4236
|
+
if (/^file:\/\//i.test(text6)) {
|
|
4233
4237
|
try {
|
|
4234
|
-
|
|
4238
|
+
text6 = decodeURIComponent(new URL(text6).pathname);
|
|
4235
4239
|
} catch {
|
|
4236
4240
|
return null;
|
|
4237
4241
|
}
|
|
4238
4242
|
}
|
|
4239
|
-
|
|
4240
|
-
if (!
|
|
4243
|
+
text6 = (text6.split("#")[0] ?? text6).replace(/\\/g, "/");
|
|
4244
|
+
if (!text6 || text6.includes("\0") || text6.split("/").includes("..")) return null;
|
|
4241
4245
|
const root = worktreePath.replace(/\/+$/, "");
|
|
4242
4246
|
if (!root || root === "/") return null;
|
|
4243
|
-
if (
|
|
4244
|
-
if (
|
|
4245
|
-
|
|
4247
|
+
if (text6.startsWith("/")) {
|
|
4248
|
+
if (text6 !== root && !text6.startsWith(`${root}/`)) return null;
|
|
4249
|
+
text6 = text6 === root ? "" : text6.slice(root.length + 1);
|
|
4246
4250
|
}
|
|
4247
|
-
|
|
4248
|
-
if (!
|
|
4249
|
-
return
|
|
4251
|
+
text6 = text6.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
4252
|
+
if (!text6 || text6 === "." || text6.startsWith("/")) return null;
|
|
4253
|
+
return text6;
|
|
4250
4254
|
}
|
|
4251
4255
|
function phoneImageMime(relativePath) {
|
|
4252
4256
|
const ext = relativePath.split(".").pop()?.toLowerCase() ?? "";
|
|
@@ -4424,11 +4428,11 @@ function textField2(value, key) {
|
|
|
4424
4428
|
const raw = value[key];
|
|
4425
4429
|
return typeof raw === "string" ? raw.trim() : "";
|
|
4426
4430
|
}
|
|
4427
|
-
function takePhonePermission(
|
|
4428
|
-
if (!
|
|
4431
|
+
function takePhonePermission(text6) {
|
|
4432
|
+
if (!text6.startsWith(PHONE_CONTROL_PREFIX2)) return null;
|
|
4429
4433
|
let parsed;
|
|
4430
4434
|
try {
|
|
4431
|
-
parsed = JSON.parse(
|
|
4435
|
+
parsed = JSON.parse(text6.slice(PHONE_CONTROL_PREFIX2.length));
|
|
4432
4436
|
} catch {
|
|
4433
4437
|
return null;
|
|
4434
4438
|
}
|
|
@@ -4440,8 +4444,8 @@ function takePhonePermission(text5) {
|
|
|
4440
4444
|
if (!chatId || !id || !DECISIONS.has(decision)) return "invalid";
|
|
4441
4445
|
return { op: "permission", chatId, id, decision };
|
|
4442
4446
|
}
|
|
4443
|
-
function dispatchPhonePermission(
|
|
4444
|
-
const cmd = takePhonePermission(
|
|
4447
|
+
function dispatchPhonePermission(text6, emit) {
|
|
4448
|
+
const cmd = takePhonePermission(text6);
|
|
4445
4449
|
if (cmd == null) return false;
|
|
4446
4450
|
if (cmd === "invalid") {
|
|
4447
4451
|
emit({ op: "error", message: "invalid phone command" });
|
|
@@ -4498,7 +4502,7 @@ function extractGitHubIssueAttachments(issue) {
|
|
|
4498
4502
|
const texts = [issue.body ?? "", ...issue.comments.map((comment) => comment.body)];
|
|
4499
4503
|
return mergeIssueAttachments(
|
|
4500
4504
|
texts.flatMap(
|
|
4501
|
-
(
|
|
4505
|
+
(text6) => extractHttpUrls(text6).filter(isGitHubIssueAttachmentUrl).map((url) => ({
|
|
4502
4506
|
id: url,
|
|
4503
4507
|
name: url.split("/").pop() || "attachment",
|
|
4504
4508
|
url
|
|
@@ -4529,11 +4533,11 @@ async function downloadGitHubIssueAttachment(input, opts) {
|
|
|
4529
4533
|
|
|
4530
4534
|
// src/integrations/github-projects.ts
|
|
4531
4535
|
function rewriteGitHubProjectReadError(detail) {
|
|
4532
|
-
const
|
|
4533
|
-
if (/read:project|project scope|missing required scopes/i.test(
|
|
4534
|
-
return `${
|
|
4536
|
+
const text6 = detail.trim() || "gh could not read GitHub Projects";
|
|
4537
|
+
if (/read:project|project scope|missing required scopes/i.test(text6)) {
|
|
4538
|
+
return `${text6} \u2014 run \`gh auth refresh -s read:project\` so Sideboard can read GitHub Projects.`;
|
|
4535
4539
|
}
|
|
4536
|
-
return
|
|
4540
|
+
return text6;
|
|
4537
4541
|
}
|
|
4538
4542
|
function githubProjectsUnreadable(result) {
|
|
4539
4543
|
return /project|scope|unknown json field/i.test(`${result.stderr}
|
|
@@ -5281,13 +5285,13 @@ async function listPhoneSources(repoPath, query) {
|
|
|
5281
5285
|
}
|
|
5282
5286
|
|
|
5283
5287
|
// src/remote/phone-turn.ts
|
|
5284
|
-
function formatRemotePrompt(
|
|
5288
|
+
function formatRemotePrompt(text6) {
|
|
5285
5289
|
return `Phone
|
|
5286
5290
|
|
|
5287
|
-
${
|
|
5291
|
+
${text6.trim()}`;
|
|
5288
5292
|
}
|
|
5289
|
-
function isRemoteStopCommand(
|
|
5290
|
-
return
|
|
5293
|
+
function isRemoteStopCommand(text6) {
|
|
5294
|
+
return text6.trim().toLowerCase() === "stop";
|
|
5291
5295
|
}
|
|
5292
5296
|
function phoneFollowUpQueues(status) {
|
|
5293
5297
|
return followUpBehavior() === "queue" && (status === "running" || status === "queued");
|
|
@@ -5494,7 +5498,7 @@ function handlePhoneControl(cmd, opts) {
|
|
|
5494
5498
|
emitControl(opts, { op: "error", message: "Speech is not available on this Mac." });
|
|
5495
5499
|
return;
|
|
5496
5500
|
}
|
|
5497
|
-
void transcribe(cmd.audioBase64).then((
|
|
5501
|
+
void transcribe(cmd.audioBase64).then((text6) => emitControl(opts, { op: "dictated", id, text: text6.trim() })).catch((err) => {
|
|
5498
5502
|
emitControl(opts, { op: "error", message: phoneError(err) });
|
|
5499
5503
|
});
|
|
5500
5504
|
return;
|
|
@@ -5774,8 +5778,8 @@ function runPhonePrompt(opts, cmd, chatId, generation) {
|
|
|
5774
5778
|
const live = readPhoneThread(thread.id) ?? thread;
|
|
5775
5779
|
const followUp = followUpBehavior();
|
|
5776
5780
|
const staged = stagePhoneTurnFiles(live.worktreePath, cmd);
|
|
5777
|
-
const
|
|
5778
|
-
await getOrchestrator().send(thread.id, formatRemotePrompt(
|
|
5781
|
+
const text6 = cmd.text.trim() || (staged.length ? "See the attached files." : "");
|
|
5782
|
+
await getOrchestrator().send(thread.id, formatRemotePrompt(text6), {
|
|
5779
5783
|
attachments: staged,
|
|
5780
5784
|
followUp
|
|
5781
5785
|
});
|
|
@@ -5794,8 +5798,8 @@ function runPhonePrompt(opts, cmd, chatId, generation) {
|
|
|
5794
5798
|
emitChatTurn(opts, chatId, thread.id);
|
|
5795
5799
|
})();
|
|
5796
5800
|
}
|
|
5797
|
-
function handleRemoteInbound(
|
|
5798
|
-
const body =
|
|
5801
|
+
function handleRemoteInbound(text6, opts) {
|
|
5802
|
+
const body = text6.trim();
|
|
5799
5803
|
if (dispatchPhonePermission(body, (reply) => emitControl(opts, reply))) return;
|
|
5800
5804
|
const control = takePhoneControl(body);
|
|
5801
5805
|
if (control) {
|
|
@@ -6583,11 +6587,11 @@ async function slackApi(token, method, params, fetchImpl) {
|
|
|
6583
6587
|
// src/slack/socket-mode.ts
|
|
6584
6588
|
var BACKOFF_START_MS2 = 1e3;
|
|
6585
6589
|
var BACKOFF_MAX_MS2 = 3e4;
|
|
6586
|
-
function stripSlackMentions(
|
|
6587
|
-
return
|
|
6590
|
+
function stripSlackMentions(text6) {
|
|
6591
|
+
return text6.replace(/<@[^>]+>/g, "").replace(/\s+/g, " ").trim();
|
|
6588
6592
|
}
|
|
6589
|
-
function isSlackStopCommand(
|
|
6590
|
-
const t = stripSlackMentions(
|
|
6593
|
+
function isSlackStopCommand(text6) {
|
|
6594
|
+
const t = stripSlackMentions(text6).toLowerCase();
|
|
6591
6595
|
return t === "stop" || t === "sideboard_force_stop";
|
|
6592
6596
|
}
|
|
6593
6597
|
function parseSlackSocketFrame(raw) {
|
|
@@ -6609,8 +6613,8 @@ function inboundFromSocketFrame(frame) {
|
|
|
6609
6613
|
const ts = event.ts?.trim();
|
|
6610
6614
|
if (!channelId || !ts) return null;
|
|
6611
6615
|
const rawText = event.text?.trim() ?? "";
|
|
6612
|
-
const
|
|
6613
|
-
if (!
|
|
6616
|
+
const text6 = stripSlackMentions(rawText);
|
|
6617
|
+
if (!text6) return null;
|
|
6614
6618
|
const teamId = (frame.payload?.team_id || event.team || "").trim();
|
|
6615
6619
|
if (!teamId) return null;
|
|
6616
6620
|
const isDm = event.type === "message" && (event.channel_type === "im" || event.channel_type === "mpim" || !event.channel_type && channelId.startsWith("D"));
|
|
@@ -6622,7 +6626,7 @@ function inboundFromSocketFrame(frame) {
|
|
|
6622
6626
|
ts,
|
|
6623
6627
|
threadTs: event.thread_ts?.trim() || void 0,
|
|
6624
6628
|
userId: event.user?.trim(),
|
|
6625
|
-
text:
|
|
6629
|
+
text: text6,
|
|
6626
6630
|
kind: isMention ? "mention" : "dm"
|
|
6627
6631
|
};
|
|
6628
6632
|
}
|
|
@@ -6881,9 +6885,9 @@ var SlackEventDeduper = class {
|
|
|
6881
6885
|
import { createCipheriv, createDecipheriv, randomBytes as randomBytes2 } from "crypto";
|
|
6882
6886
|
var VERSION = "v1";
|
|
6883
6887
|
function parseSlackTokenKey(raw) {
|
|
6884
|
-
const
|
|
6885
|
-
if (!
|
|
6886
|
-
const buf = /^[0-9a-fA-F]{64}$/.test(
|
|
6888
|
+
const text6 = raw.trim();
|
|
6889
|
+
if (!text6) throw new Error("SIDEBOARD_SLACK_TOKEN_KEY is empty");
|
|
6890
|
+
const buf = /^[0-9a-fA-F]{64}$/.test(text6) ? Buffer.from(text6, "hex") : Buffer.from(text6, "base64");
|
|
6887
6891
|
if (buf.length !== 32) {
|
|
6888
6892
|
throw new Error("SIDEBOARD_SLACK_TOKEN_KEY must be 32 bytes (base64 or 64 hex characters)");
|
|
6889
6893
|
}
|
|
@@ -7930,10 +7934,10 @@ async function publishSlackAppHome(opts) {
|
|
|
7930
7934
|
}
|
|
7931
7935
|
|
|
7932
7936
|
// src/slack/relay-hub.ts
|
|
7933
|
-
function parseSlackDeviceDestination(
|
|
7934
|
-
const m =
|
|
7935
|
-
if (!m) return { label: null, rest:
|
|
7936
|
-
return { label: m[1], rest:
|
|
7937
|
+
function parseSlackDeviceDestination(text6) {
|
|
7938
|
+
const m = text6.match(/^\s*(?:to\s+)?(?:@|#)?([A-Za-z][\w-]{0,63})\s*[::]\s*/);
|
|
7939
|
+
if (!m) return { label: null, rest: text6 };
|
|
7940
|
+
return { label: m[1], rest: text6.slice(m[0].length) };
|
|
7937
7941
|
}
|
|
7938
7942
|
var SlackRelayHub = class {
|
|
7939
7943
|
sessions = /* @__PURE__ */ new Map();
|
|
@@ -9204,10 +9208,10 @@ function entireAuthorizeUrl(clientId, redirectUri, state, codeChallenge) {
|
|
|
9204
9208
|
return url.toString();
|
|
9205
9209
|
}
|
|
9206
9210
|
async function readJson2(res) {
|
|
9207
|
-
const
|
|
9208
|
-
if (!
|
|
9211
|
+
const text6 = await res.text();
|
|
9212
|
+
if (!text6) return {};
|
|
9209
9213
|
try {
|
|
9210
|
-
return JSON.parse(
|
|
9214
|
+
return JSON.parse(text6);
|
|
9211
9215
|
} catch {
|
|
9212
9216
|
throw new Error("Entire returned a non-JSON response.");
|
|
9213
9217
|
}
|
|
@@ -9357,10 +9361,10 @@ function relayAuthorizeUrl(provider, client, redirectUri, state, ctx = EMPTY_AUT
|
|
|
9357
9361
|
return GIT_HOST_AUTH[provider].authorizeUrl(client, redirectUri, state, ctx);
|
|
9358
9362
|
}
|
|
9359
9363
|
async function readJson3(res) {
|
|
9360
|
-
const
|
|
9361
|
-
if (!
|
|
9364
|
+
const text6 = await res.text();
|
|
9365
|
+
if (!text6) return {};
|
|
9362
9366
|
try {
|
|
9363
|
-
return JSON.parse(
|
|
9367
|
+
return JSON.parse(text6);
|
|
9364
9368
|
} catch {
|
|
9365
9369
|
throw new Error("Sign-in provider returned a non-JSON response.");
|
|
9366
9370
|
}
|
|
@@ -9417,9 +9421,9 @@ async function readBody2(req) {
|
|
|
9417
9421
|
if (size > 8192) throw new Error("body too large");
|
|
9418
9422
|
chunks.push(buf);
|
|
9419
9423
|
}
|
|
9420
|
-
const
|
|
9421
|
-
if (!
|
|
9422
|
-
return JSON.parse(
|
|
9424
|
+
const text6 = Buffer.concat(chunks).toString("utf8").trim();
|
|
9425
|
+
if (!text6) return {};
|
|
9426
|
+
return JSON.parse(text6);
|
|
9423
9427
|
}
|
|
9424
9428
|
function sendJson2(res, status, body) {
|
|
9425
9429
|
res.writeHead(status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
|
@@ -9957,7 +9961,7 @@ async function startHeadlessHost(opts) {
|
|
|
9957
9961
|
};
|
|
9958
9962
|
const refreshRunning = async () => {
|
|
9959
9963
|
try {
|
|
9960
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
9964
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
|
|
9961
9965
|
agentsRunning = getOrchestrator2().getRuntime().running;
|
|
9962
9966
|
} catch {
|
|
9963
9967
|
agentsRunning = 0;
|
|
@@ -10045,9 +10049,9 @@ function flatInterfaces() {
|
|
|
10045
10049
|
}
|
|
10046
10050
|
|
|
10047
10051
|
// src/integrations/cursor-git.ts
|
|
10048
|
-
function parseOriginAuthStatus(
|
|
10049
|
-
const account =
|
|
10050
|
-
const authMethod =
|
|
10052
|
+
function parseOriginAuthStatus(text6) {
|
|
10053
|
+
const account = text6.match(/^Account:\s+(.+)$/m)?.[1]?.trim() || null;
|
|
10054
|
+
const authMethod = text6.match(/^Auth method:\s+(.+)$/m)?.[1]?.trim() || null;
|
|
10051
10055
|
return { account, authMethod };
|
|
10052
10056
|
}
|
|
10053
10057
|
async function getCursorGitStatus() {
|
|
@@ -10062,9 +10066,9 @@ async function getCursorGitStatus() {
|
|
|
10062
10066
|
};
|
|
10063
10067
|
}
|
|
10064
10068
|
const status = await run("origin", ["auth", "status"], { reject: false, timeoutMs: 15e3 });
|
|
10065
|
-
const
|
|
10069
|
+
const text6 = `${status.stdout}
|
|
10066
10070
|
${status.stderr}`;
|
|
10067
|
-
const parsed = parseOriginAuthStatus(
|
|
10071
|
+
const parsed = parseOriginAuthStatus(text6);
|
|
10068
10072
|
if (status.exitCode === 0 && parsed.account) {
|
|
10069
10073
|
return {
|
|
10070
10074
|
installed: true,
|
|
@@ -10116,8 +10120,8 @@ async function setupCursorGit() {
|
|
|
10116
10120
|
}
|
|
10117
10121
|
|
|
10118
10122
|
// src/integrations/entire-git.ts
|
|
10119
|
-
function parseEntireAuthContexts(
|
|
10120
|
-
for (const line of
|
|
10123
|
+
function parseEntireAuthContexts(text6) {
|
|
10124
|
+
for (const line of text6.split("\n")) {
|
|
10121
10125
|
if (!/\(active\)/i.test(line)) continue;
|
|
10122
10126
|
const cols = line.replace(/\(active\)/gi, "").trim().split(/\s{2,}/).map((part) => part.trim()).filter(Boolean);
|
|
10123
10127
|
const handle = cols[1] || cols[0] || null;
|
|
@@ -10491,16 +10495,16 @@ var PASTE_ATTACH_MIN_CHARS = 1200;
|
|
|
10491
10495
|
var PASTE_ATTACH_MIN_LINES = 15;
|
|
10492
10496
|
var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
|
|
10493
10497
|
var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
|
|
10494
|
-
function pastedTextStats(
|
|
10495
|
-
const chars =
|
|
10498
|
+
function pastedTextStats(text6) {
|
|
10499
|
+
const chars = text6.length;
|
|
10496
10500
|
if (chars === 0) return { chars: 0, lines: 0 };
|
|
10497
|
-
const lines =
|
|
10501
|
+
const lines = text6.split(/\r\n|\r|\n/).length;
|
|
10498
10502
|
return { chars, lines };
|
|
10499
10503
|
}
|
|
10500
|
-
function shouldAttachPastedText(
|
|
10501
|
-
const trimmed =
|
|
10504
|
+
function shouldAttachPastedText(text6) {
|
|
10505
|
+
const trimmed = text6.trim();
|
|
10502
10506
|
if (!trimmed) return false;
|
|
10503
|
-
const { chars, lines } = pastedTextStats(
|
|
10507
|
+
const { chars, lines } = pastedTextStats(text6);
|
|
10504
10508
|
return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
|
|
10505
10509
|
}
|
|
10506
10510
|
function nextPastedTextName(existing) {
|
|
@@ -10511,13 +10515,13 @@ function nextPastedTextName(existing) {
|
|
|
10511
10515
|
}
|
|
10512
10516
|
return `Pasted text #${max + 1}.txt`;
|
|
10513
10517
|
}
|
|
10514
|
-
function buildPastedTextAttachment(
|
|
10518
|
+
function buildPastedTextAttachment(text6, opts) {
|
|
10515
10519
|
return {
|
|
10516
10520
|
id: opts?.id ?? randomUUID5(),
|
|
10517
10521
|
name: opts?.name ?? "Pasted text #1.txt",
|
|
10518
10522
|
kind: "file",
|
|
10519
10523
|
path: opts?.path,
|
|
10520
|
-
content:
|
|
10524
|
+
content: text6
|
|
10521
10525
|
};
|
|
10522
10526
|
}
|
|
10523
10527
|
|
|
@@ -10537,8 +10541,8 @@ function parseChatLink(href) {
|
|
|
10537
10541
|
const match = CHAT_LINK_RE.exec(href.trim());
|
|
10538
10542
|
return match?.[1] ?? null;
|
|
10539
10543
|
}
|
|
10540
|
-
function linkifyChatUrls(
|
|
10541
|
-
return
|
|
10544
|
+
function linkifyChatUrls(text6) {
|
|
10545
|
+
return text6.replace(BARE_CHAT_LINK_RE, (url) => {
|
|
10542
10546
|
const id = parseChatLink(url);
|
|
10543
10547
|
if (!id) return url;
|
|
10544
10548
|
const label = id.length > 8 ? id.slice(0, 8) : id;
|
|
@@ -10594,7 +10598,7 @@ function createClippedMcpServer() {
|
|
|
10594
10598
|
}
|
|
10595
10599
|
|
|
10596
10600
|
// src/mcp/server.ts
|
|
10597
|
-
import { z as
|
|
10601
|
+
import { z as z10 } from "zod";
|
|
10598
10602
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
10599
10603
|
import { basename as basename3 } from "path";
|
|
10600
10604
|
|
|
@@ -10783,9 +10787,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
10783
10787
|
function lastMessagePreview(messages, max = 160) {
|
|
10784
10788
|
if (!messages?.length) return null;
|
|
10785
10789
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
10786
|
-
const
|
|
10787
|
-
if (!
|
|
10788
|
-
const flat =
|
|
10790
|
+
const text6 = messages[i]?.text?.trim();
|
|
10791
|
+
if (!text6 || isInternalAgentStatusText(text6) || isInjectedNoticeText(text6)) continue;
|
|
10792
|
+
const flat = text6.replace(/\s+/g, " ");
|
|
10789
10793
|
return flat.length > max ? `${flat.slice(0, max)}\u2026` : flat;
|
|
10790
10794
|
}
|
|
10791
10795
|
return null;
|
|
@@ -10815,15 +10819,15 @@ var CRUSH_COMMENT_MAX_CHARS = 16e3;
|
|
|
10815
10819
|
var CRUSH_BODY_MIN_CHARS = 12e3;
|
|
10816
10820
|
var CRUSH_BODY_MAX_CHARS = 8e3;
|
|
10817
10821
|
var NEAR_DUP_JACCARD = 0.92;
|
|
10818
|
-
function looksLikeMustKeep(
|
|
10819
|
-
return MUST_KEEP_TEXT_RE.test(
|
|
10822
|
+
function looksLikeMustKeep(text6) {
|
|
10823
|
+
return MUST_KEEP_TEXT_RE.test(text6);
|
|
10820
10824
|
}
|
|
10821
|
-
function normalizeText(
|
|
10822
|
-
return
|
|
10825
|
+
function normalizeText(text6) {
|
|
10826
|
+
return text6.replace(/\s+/g, " ").trim().toLowerCase();
|
|
10823
10827
|
}
|
|
10824
|
-
function wordSet(
|
|
10828
|
+
function wordSet(text6) {
|
|
10825
10829
|
return new Set(
|
|
10826
|
-
|
|
10830
|
+
text6.toLowerCase().split(/\W+/).filter((w) => w.length > 2)
|
|
10827
10831
|
);
|
|
10828
10832
|
}
|
|
10829
10833
|
function jaccard(a, b) {
|
|
@@ -10835,11 +10839,11 @@ function jaccard(a, b) {
|
|
|
10835
10839
|
const union = a.size + b.size - inter;
|
|
10836
10840
|
return union === 0 ? 0 : inter / union;
|
|
10837
10841
|
}
|
|
10838
|
-
function importance(
|
|
10839
|
-
let score =
|
|
10840
|
-
if (/```/.test(
|
|
10841
|
-
if (/https?:\/\//.test(
|
|
10842
|
-
if (looksLikeMustKeep(
|
|
10842
|
+
function importance(text6) {
|
|
10843
|
+
let score = text6.length;
|
|
10844
|
+
if (/```/.test(text6)) score += 400;
|
|
10845
|
+
if (/https?:\/\//.test(text6)) score += 50;
|
|
10846
|
+
if (looksLikeMustKeep(text6)) score += 1e4;
|
|
10843
10847
|
return score;
|
|
10844
10848
|
}
|
|
10845
10849
|
function meanStd(values) {
|
|
@@ -10853,15 +10857,15 @@ function dedupTextItems(items, getText) {
|
|
|
10853
10857
|
const keptNorm = [];
|
|
10854
10858
|
const keptWords = [];
|
|
10855
10859
|
for (const item of items) {
|
|
10856
|
-
const
|
|
10857
|
-
const norm = normalizeText(
|
|
10860
|
+
const text6 = getText(item);
|
|
10861
|
+
const norm = normalizeText(text6);
|
|
10858
10862
|
if (!norm) {
|
|
10859
10863
|
kept.push(item);
|
|
10860
10864
|
keptNorm.push(norm);
|
|
10861
|
-
keptWords.push(wordSet(
|
|
10865
|
+
keptWords.push(wordSet(text6));
|
|
10862
10866
|
continue;
|
|
10863
10867
|
}
|
|
10864
|
-
const words = wordSet(
|
|
10868
|
+
const words = wordSet(text6);
|
|
10865
10869
|
let dupAt = -1;
|
|
10866
10870
|
for (let i = 0; i < kept.length; i++) {
|
|
10867
10871
|
if (keptNorm[i] === norm) {
|
|
@@ -10879,7 +10883,7 @@ function dedupTextItems(items, getText) {
|
|
|
10879
10883
|
keptWords.push(words);
|
|
10880
10884
|
continue;
|
|
10881
10885
|
}
|
|
10882
|
-
if (
|
|
10886
|
+
if (text6.length > getText(kept[dupAt]).length) {
|
|
10883
10887
|
kept[dupAt] = item;
|
|
10884
10888
|
keptNorm[dupAt] = norm;
|
|
10885
10889
|
keptWords[dupAt] = words;
|
|
@@ -10920,8 +10924,8 @@ function crushTextItems(items, getText, opts = {}) {
|
|
|
10920
10924
|
const outlierFloor = mean + 2 * std;
|
|
10921
10925
|
const mustKeep = /* @__PURE__ */ new Set();
|
|
10922
10926
|
unique.forEach((item, i) => {
|
|
10923
|
-
const
|
|
10924
|
-
if (looksLikeMustKeep(
|
|
10927
|
+
const text6 = getText(item);
|
|
10928
|
+
if (looksLikeMustKeep(text6) || text6.length > outlierFloor) mustKeep.add(i);
|
|
10925
10929
|
});
|
|
10926
10930
|
const remainingIdx = unique.map((_, i) => i).filter((i) => !mustKeep.has(i));
|
|
10927
10931
|
let used = [...mustKeep].reduce((n, i) => n + lengths[i], 0);
|
|
@@ -10963,9 +10967,9 @@ function crushTextItems(items, getText, opts = {}) {
|
|
|
10963
10967
|
reason: "budget"
|
|
10964
10968
|
};
|
|
10965
10969
|
}
|
|
10966
|
-
function splitBlocks(
|
|
10967
|
-
if (/\n\n/.test(
|
|
10968
|
-
return
|
|
10970
|
+
function splitBlocks(text6) {
|
|
10971
|
+
if (/\n\n/.test(text6)) return text6.split(/\n\n+/);
|
|
10972
|
+
return text6.split("\n");
|
|
10969
10973
|
}
|
|
10970
10974
|
function capOversizedBlock(block, maxChars) {
|
|
10971
10975
|
if (block.length <= maxChars) return block;
|
|
@@ -10977,8 +10981,8 @@ function capOversizedBlock(block, maxChars) {
|
|
|
10977
10981
|
|
|
10978
10982
|
${block.slice(-tail)}`;
|
|
10979
10983
|
}
|
|
10980
|
-
function crushMarkdown(
|
|
10981
|
-
const original =
|
|
10984
|
+
function crushMarkdown(text6, opts) {
|
|
10985
|
+
const original = text6 ?? "";
|
|
10982
10986
|
const minChars = opts?.minChars ?? CRUSH_BODY_MIN_CHARS;
|
|
10983
10987
|
const maxChars = opts?.maxChars ?? CRUSH_BODY_MAX_CHARS;
|
|
10984
10988
|
if (original.length < minChars) {
|
|
@@ -11068,13 +11072,13 @@ function withComments(comments, meta) {
|
|
|
11068
11072
|
}
|
|
11069
11073
|
return { comments: crushed.items, meta };
|
|
11070
11074
|
}
|
|
11071
|
-
function withBody(
|
|
11072
|
-
const crushed = crushMarkdown(
|
|
11075
|
+
function withBody(text6, meta) {
|
|
11076
|
+
const crushed = crushMarkdown(text6);
|
|
11073
11077
|
if (crushed.truncated) {
|
|
11074
11078
|
meta.body = { originalChars: crushed.originalChars };
|
|
11075
11079
|
return { value: crushed.text, meta };
|
|
11076
11080
|
}
|
|
11077
|
-
return { value:
|
|
11081
|
+
return { value: text6, meta };
|
|
11078
11082
|
}
|
|
11079
11083
|
function attachCrush(payload, meta) {
|
|
11080
11084
|
if (!meta.comments && !meta.body) return payload;
|
|
@@ -11786,9 +11790,9 @@ async function runPosthogApi(input) {
|
|
|
11786
11790
|
body,
|
|
11787
11791
|
signal: AbortSignal.timeout(POSTHOG_TIMEOUT_MS)
|
|
11788
11792
|
});
|
|
11789
|
-
const
|
|
11790
|
-
const truncated =
|
|
11791
|
-
const slice = truncated ?
|
|
11793
|
+
const text6 = await res.text();
|
|
11794
|
+
const truncated = text6.length > POSTHOG_RESPONSE_MAX_CHARS;
|
|
11795
|
+
const slice = truncated ? text6.slice(0, POSTHOG_RESPONSE_MAX_CHARS) : text6;
|
|
11792
11796
|
let parsed = slice;
|
|
11793
11797
|
if (slice.trim()) {
|
|
11794
11798
|
try {
|
|
@@ -11931,7 +11935,7 @@ function registerArchiveTools(server, orch) {
|
|
|
11931
11935
|
);
|
|
11932
11936
|
server.tool(
|
|
11933
11937
|
"archive_chat",
|
|
11934
|
-
"Archive one agent chat: stop the turn and move that chat to Settings \u2192 History. Other agents on the workspace stay, and the worktree is removed only when this is the last agent. Orchestration chats archive without removing a project checkout. Refuses the cloud coordinator. To archive every agent on a checkout, use archive_workspace. Commit, push, and open PRs via ask_git before archiving when the work should be kept. Merge only when the user explicitly asked.",
|
|
11938
|
+
"Archive one agent chat: stop the turn and move that chat to Settings \u2192 History. Other agents on the workspace stay, and the worktree is removed only when this is the last agent. Uncommitted and untracked files are saved on a hidden git ref and put back uncommitted if that checkout is restored. If that snapshot fails, the checkout stays. History Delete does not keep the snapshot. Orchestration chats archive without removing a project checkout. Refuses the cloud coordinator. To archive every agent on a checkout, use archive_workspace. Commit, push, and open PRs via ask_git before archiving when the work should be kept. Merge only when the user explicitly asked.",
|
|
11935
11939
|
{ ref: z6.string().describe("Chat id to archive") },
|
|
11936
11940
|
async ({ ref }) => {
|
|
11937
11941
|
const t = orch.getThread(ref);
|
|
@@ -12234,10 +12238,82 @@ function registerScheduleTools(server) {
|
|
|
12234
12238
|
);
|
|
12235
12239
|
}
|
|
12236
12240
|
|
|
12237
|
-
// src/mcp/
|
|
12241
|
+
// src/mcp/follow-up-tools.ts
|
|
12238
12242
|
import { z as z8 } from "zod";
|
|
12239
|
-
|
|
12243
|
+
function text5(payload, isError = false) {
|
|
12244
|
+
return mcpJson(payload, isError);
|
|
12245
|
+
}
|
|
12240
12246
|
function callerThread() {
|
|
12247
|
+
const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim() || "";
|
|
12248
|
+
if (!id) return null;
|
|
12249
|
+
return findThreadByRef(id);
|
|
12250
|
+
}
|
|
12251
|
+
async function baselineCi(thread) {
|
|
12252
|
+
const selector = resolvePrSelector(thread);
|
|
12253
|
+
if (!selector) return "none";
|
|
12254
|
+
try {
|
|
12255
|
+
const checks = await getPrCiChecks(thread.worktreePath, selector);
|
|
12256
|
+
return ciChecksSettled(checks);
|
|
12257
|
+
} catch {
|
|
12258
|
+
return "unknown";
|
|
12259
|
+
}
|
|
12260
|
+
}
|
|
12261
|
+
function registerFollowUpTools(server) {
|
|
12262
|
+
server.tool(
|
|
12263
|
+
"list_follow_ups",
|
|
12264
|
+
"List follow-ups on this chat. kind=ci wakes when GitHub checks finish. kind=at wakes at a time. A running turn is not interrupted.",
|
|
12265
|
+
{},
|
|
12266
|
+
async () => {
|
|
12267
|
+
const thread = callerThread();
|
|
12268
|
+
if (!thread) return text5({ error: "This chat id is missing" }, true);
|
|
12269
|
+
return text5({ followUps: normalizeChatFollowUps(thread.followUps) });
|
|
12270
|
+
}
|
|
12271
|
+
);
|
|
12272
|
+
server.tool(
|
|
12273
|
+
"create_follow_up",
|
|
12274
|
+
"Register a follow-up on THIS chat. kind=ci sends the prompt when GitHub checks on this chat\u2019s PR finish (pass or fail). Checks that are already finished do not send until a later run finishes. A failed checks read does not count as finished or in progress. A CI follow-up that is still pending at deadline (default 7 days) ends silently. kind=at sends at `30m`, `2h`, `1d`, or an ISO time and waits behind a turn that is already running. Cap 10.",
|
|
12275
|
+
{
|
|
12276
|
+
kind: z8.enum(["ci", "at"]),
|
|
12277
|
+
prompt: z8.string(),
|
|
12278
|
+
at: z8.string().optional(),
|
|
12279
|
+
deadline: z8.string().optional()
|
|
12280
|
+
},
|
|
12281
|
+
async ({ kind, prompt, at, deadline }) => {
|
|
12282
|
+
const thread = callerThread();
|
|
12283
|
+
if (!thread) return text5({ error: "This chat id is missing" }, true);
|
|
12284
|
+
if (thread.status === "archived") return text5({ error: "This chat is archived" }, true);
|
|
12285
|
+
const existing = normalizeChatFollowUps(thread.followUps);
|
|
12286
|
+
const ciBaseline = kind === "ci" ? await baselineCi(thread) : void 0;
|
|
12287
|
+
const added = addChatFollowUp(
|
|
12288
|
+
existing,
|
|
12289
|
+
{ kind, prompt, at, deadline, ciBaseline },
|
|
12290
|
+
/* @__PURE__ */ new Date()
|
|
12291
|
+
);
|
|
12292
|
+
if (!added.ok) return text5({ error: added.error }, true);
|
|
12293
|
+
updateThread(thread.id, { followUps: added.followUps });
|
|
12294
|
+
return text5({ followUps: added.followUps });
|
|
12295
|
+
}
|
|
12296
|
+
);
|
|
12297
|
+
server.tool(
|
|
12298
|
+
"delete_follow_up",
|
|
12299
|
+
"Remove one follow-up from this chat by id.",
|
|
12300
|
+
{ id: z8.string() },
|
|
12301
|
+
async ({ id }) => {
|
|
12302
|
+
const thread = callerThread();
|
|
12303
|
+
if (!thread) return text5({ error: "This chat id is missing" }, true);
|
|
12304
|
+
const existing = normalizeChatFollowUps(thread.followUps);
|
|
12305
|
+
const followUps = existing.filter((item) => item.id !== id.trim());
|
|
12306
|
+
if (followUps.length === existing.length) return text5({ error: "Follow-up not found" }, true);
|
|
12307
|
+
updateThread(thread.id, { followUps });
|
|
12308
|
+
return text5({ followUps });
|
|
12309
|
+
}
|
|
12310
|
+
);
|
|
12311
|
+
}
|
|
12312
|
+
|
|
12313
|
+
// src/mcp/order-tools.ts
|
|
12314
|
+
import { z as z9 } from "zod";
|
|
12315
|
+
var kindSchema = z9.enum(["pr", "issue", "workspace", "orchestration"]);
|
|
12316
|
+
function callerThread2() {
|
|
12241
12317
|
const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim();
|
|
12242
12318
|
if (!id) return null;
|
|
12243
12319
|
return readThread(id);
|
|
@@ -12250,7 +12326,7 @@ function readCheckoutPlan(caller) {
|
|
|
12250
12326
|
return readPlanFile(root);
|
|
12251
12327
|
}
|
|
12252
12328
|
function orchestrationOwnerId(worktree) {
|
|
12253
|
-
const caller =
|
|
12329
|
+
const caller = callerThread2();
|
|
12254
12330
|
if (!caller) {
|
|
12255
12331
|
throw new Error(
|
|
12256
12332
|
worktree ? "No worktree chat is bound to this tool." : "No orchestration chat is bound to this tool."
|
|
@@ -12286,10 +12362,10 @@ function registerOrderTools(server) {
|
|
|
12286
12362
|
try {
|
|
12287
12363
|
const owner = orchestrationOwnerId(worktree);
|
|
12288
12364
|
const plan = getOrderPlan(owner);
|
|
12289
|
-
const caller =
|
|
12365
|
+
const caller = callerThread2();
|
|
12290
12366
|
if (!plan) {
|
|
12291
|
-
const
|
|
12292
|
-
return { content: [{ type: "text", text:
|
|
12367
|
+
const text6 = worktree ? "This checkout's orchestrator has no plan yet." : "This chat has no plan. set_plan drafts one. Then show_plan so the user sees it.";
|
|
12368
|
+
return { content: [{ type: "text", text: text6 }] };
|
|
12293
12369
|
}
|
|
12294
12370
|
const rows = listOrderRows(plan.id);
|
|
12295
12371
|
const place = worktree && caller ? `${formatOrderPlace(rows, orderSnapshotFromThread(caller))}
|
|
@@ -12308,16 +12384,16 @@ function registerOrderTools(server) {
|
|
|
12308
12384
|
worktree ? "Change what this checkout waits on. Omit subject to mean this workspace (hold=merge uses this PR; hold=start on a ticket uses this issue). gate=in-main (met when that PR is merged) or in-prod (stays waiting until satisfy_dependency). hold=start means do not begin; hold=merge means do not merge. You cannot set a dependency for a different checkout. show_plan so the user sees the change." : "Record a step on this orchestration plan. waitsOn must reach gate before subject can hold. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency. 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 repoPath when the same PR number exists in more than one project. Worktree agents set their own checkout and can omit subject. Then show_plan so the user sees it.",
|
|
12309
12385
|
{
|
|
12310
12386
|
waitsOnKind: kindSchema.describe("What must happen first: pr, issue, workspace, or orchestration"),
|
|
12311
|
-
waitsOnRef:
|
|
12312
|
-
waitsOnRepoPath:
|
|
12313
|
-
waitsOnLabel:
|
|
12314
|
-
gate:
|
|
12315
|
-
hold:
|
|
12387
|
+
waitsOnRef: z9.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
|
|
12388
|
+
waitsOnRepoPath: z9.string().optional().describe("Project path when a PR or issue number is not unique"),
|
|
12389
|
+
waitsOnLabel: z9.string().optional().describe("Short label on the planner"),
|
|
12390
|
+
gate: z9.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
|
|
12391
|
+
hold: z9.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
|
|
12316
12392
|
subjectKind: kindSchema.optional().describe("What is held. Required from orchestration. Omit on a worktree to mean this checkout."),
|
|
12317
|
-
subjectRef:
|
|
12318
|
-
subjectRepoPath:
|
|
12319
|
-
subjectLabel:
|
|
12320
|
-
note:
|
|
12393
|
+
subjectRef: z9.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
|
|
12394
|
+
subjectRepoPath: z9.string().optional(),
|
|
12395
|
+
subjectLabel: z9.string().optional(),
|
|
12396
|
+
note: z9.string().optional().describe("Why this order matters")
|
|
12321
12397
|
},
|
|
12322
12398
|
async (args) => {
|
|
12323
12399
|
try {
|
|
@@ -12326,7 +12402,7 @@ function registerOrderTools(server) {
|
|
|
12326
12402
|
if (hasKind !== hasRef) {
|
|
12327
12403
|
throw new Error("Pass subjectKind and subjectRef together, or omit both on a worktree.");
|
|
12328
12404
|
}
|
|
12329
|
-
const caller =
|
|
12405
|
+
const caller = callerThread2();
|
|
12330
12406
|
let subject;
|
|
12331
12407
|
const hold = parseOrderHold(args.hold);
|
|
12332
12408
|
if (!hasKind) {
|
|
@@ -12381,9 +12457,9 @@ function registerOrderTools(server) {
|
|
|
12381
12457
|
"set_plan",
|
|
12382
12458
|
"Draft or retitle this chat's plan. It stays draft until execute_plan. Pass goal for the outcome the steps are trying to reach. Then set_dependency for each gate. A step may loop back to an earlier one. Call show_plan so the user sees it. Do not paste the diagram in chat. Do not start workspaces while it is draft.",
|
|
12383
12459
|
{
|
|
12384
|
-
title:
|
|
12385
|
-
summary:
|
|
12386
|
-
goal:
|
|
12460
|
+
title: z9.string().describe("Short name for the plan"),
|
|
12461
|
+
summary: z9.string().optional().describe("What this order is for, in a sentence or two"),
|
|
12462
|
+
goal: z9.string().optional().describe("Outcome the steps are trying to reach")
|
|
12387
12463
|
},
|
|
12388
12464
|
async ({ title, summary, goal }) => {
|
|
12389
12465
|
try {
|
|
@@ -12403,7 +12479,7 @@ function registerOrderTools(server) {
|
|
|
12403
12479
|
"execute_plan",
|
|
12404
12480
|
"Mark the plan active after the user has seen it and told you to run it. Returns ready steps (start those with create_workspace or send_to_chat) and waiting steps (leave them alone). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
|
|
12405
12481
|
{
|
|
12406
|
-
agreed:
|
|
12482
|
+
agreed: z9.literal(true).describe("True only after the user has seen the plan and told you to run it")
|
|
12407
12483
|
},
|
|
12408
12484
|
async () => {
|
|
12409
12485
|
try {
|
|
@@ -12436,7 +12512,7 @@ function registerOrderTools(server) {
|
|
|
12436
12512
|
worktree ? "Open the plans for this checkout in the side column. That is the orchestration diagram, with this checkout marked, and this checkout's implementation plan (plan.md) when the file exists. Does not write either plan. Change a step with set_dependency or clear_dependency, then show it again. Do not paste the diagram in chat." : "Open this chat's plan in the side column. Call it after set_plan or set_dependency so the user sees the plan. A worktree show_plan also opens that checkout's implementation plan (plan.md) when the file exists. Does not write either plan. Do not paste the diagram in chat.",
|
|
12437
12513
|
{},
|
|
12438
12514
|
async () => {
|
|
12439
|
-
const caller =
|
|
12515
|
+
const caller = callerThread2();
|
|
12440
12516
|
let diagramHtml = null;
|
|
12441
12517
|
let diagramTitle = "Planner";
|
|
12442
12518
|
let diagramError = null;
|
|
@@ -12474,10 +12550,10 @@ function registerOrderTools(server) {
|
|
|
12474
12550
|
server.tool(
|
|
12475
12551
|
"clear_dependency",
|
|
12476
12552
|
worktree ? "Remove a planner step this checkout is part of. Pass id from list_order. Then show_plan so the user sees it." : "Remove one planner step. Pass id from list_order. Then show_plan so the user sees it.",
|
|
12477
|
-
{ id:
|
|
12553
|
+
{ id: z9.string().describe("Step id from list_order") },
|
|
12478
12554
|
async ({ id }) => {
|
|
12479
12555
|
try {
|
|
12480
|
-
const caller =
|
|
12556
|
+
const caller = callerThread2();
|
|
12481
12557
|
clearOrderDependency(
|
|
12482
12558
|
id,
|
|
12483
12559
|
worktree && caller ? orderSnapshotFromThread(caller) : null,
|
|
@@ -12493,8 +12569,8 @@ function registerOrderTools(server) {
|
|
|
12493
12569
|
"satisfy_dependency",
|
|
12494
12570
|
"Mark a planner gate met. Use this when a PR is in production \u2014 Sideboard cannot see deploys. in-main also clears on its own once that PR is merged. Pass satisfied=false to undo a manual mark. One mark covers every step waiting on that same gate.",
|
|
12495
12571
|
{
|
|
12496
|
-
id:
|
|
12497
|
-
satisfied:
|
|
12572
|
+
id: z9.string().describe("Step id from list_order"),
|
|
12573
|
+
satisfied: z9.boolean().optional().describe("false clears the manual mark. Default true.")
|
|
12498
12574
|
},
|
|
12499
12575
|
async ({ id, satisfied }) => {
|
|
12500
12576
|
try {
|
|
@@ -12504,7 +12580,7 @@ function registerOrderTools(server) {
|
|
|
12504
12580
|
const rows = listOrderRows(plan.id);
|
|
12505
12581
|
const hit = rows.find((row2) => row2.id === id || id.length >= 8 && row2.id.startsWith(id));
|
|
12506
12582
|
if (!hit) throw new Error("That step is on another orchestration chat's plan.");
|
|
12507
|
-
const caller =
|
|
12583
|
+
const caller = callerThread2();
|
|
12508
12584
|
if (worktree && caller && !orderEdgeTouches(hit, orderSnapshotFromThread(caller))) {
|
|
12509
12585
|
throw new Error("This checkout can only change a step it is part of.");
|
|
12510
12586
|
}
|
|
@@ -12691,7 +12767,7 @@ async function handleJobStop(params, _ctx) {
|
|
|
12691
12767
|
return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
|
|
12692
12768
|
}
|
|
12693
12769
|
async function defaultTurnWait(ref, timeoutMs) {
|
|
12694
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
12770
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
|
|
12695
12771
|
const orch = getOrchestrator2();
|
|
12696
12772
|
const thread = await orch.waitForTurn(ref, timeoutMs, {
|
|
12697
12773
|
resolveIfStillRunning: true
|
|
@@ -12738,7 +12814,8 @@ async function handleTurnWait(params, ctx, waitFn = defaultTurnWait) {
|
|
|
12738
12814
|
hint: "Child is still working after max hold. Call wait_for_turn again. Do not send_to_chat a check-in (that steers / interrupts).",
|
|
12739
12815
|
incomplete: false,
|
|
12740
12816
|
blockedReason: null,
|
|
12741
|
-
blockedSource: null
|
|
12817
|
+
blockedSource: null,
|
|
12818
|
+
failureClass: null
|
|
12742
12819
|
};
|
|
12743
12820
|
}
|
|
12744
12821
|
function createAgentRpcDispatcher() {
|
|
@@ -13128,16 +13205,16 @@ async function startMcpServer() {
|
|
|
13128
13205
|
"list_board",
|
|
13129
13206
|
"Home Kanban of workspaces (New, Draft, Review, Approved, Merged) \u2014 one card per checkout; sibling chats on that card are separate agents. Same cards as desktop Home. Path to merge: no PR \u2192 draft PR \u2192 open PR \u2192 approved \u2192 merged. Archive removes the card to Settings \u2192 History (list_archive to browse, restore_workspace to bring it back). Queued/running are activity on the card, not stages. Orchestration chats are not on the board. Filters: query, repoPath, kind (ticket/PR/branch source), ownership (mine = your PRs / WIP; reviewing = someone else's PR), column, limit (default 40). create_workspace adds a workspace (and a Home card), or returns the live checkout if that ticket/PR/named branch is already checked out. That reuse is one checkout, not one agent \u2014 fork_chat to add another.",
|
|
13130
13207
|
{
|
|
13131
|
-
query:
|
|
13132
|
-
repoPath:
|
|
13133
|
-
kind:
|
|
13134
|
-
ownership:
|
|
13208
|
+
query: z10.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
|
|
13209
|
+
repoPath: z10.string().optional().describe("Limit to one project path from list_projects"),
|
|
13210
|
+
kind: z10.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
|
|
13211
|
+
ownership: z10.enum(["all", "mine", "reviewing"]).optional().describe(
|
|
13135
13212
|
"Mine = PRs you authored or local WIP; reviewing = someone else's PR. Uses the gh login."
|
|
13136
13213
|
),
|
|
13137
|
-
column:
|
|
13214
|
+
column: z10.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
|
|
13138
13215
|
"Return cards for this column only (totals still include the rest). approved is an open PR GitHub has approved. needs_you is a legacy alias for new."
|
|
13139
13216
|
),
|
|
13140
|
-
limit:
|
|
13217
|
+
limit: z10.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
|
|
13141
13218
|
},
|
|
13142
13219
|
async ({ query, repoPath, kind, ownership, column, limit }) => {
|
|
13143
13220
|
const workspaces = orch.listWorkspaces();
|
|
@@ -13167,7 +13244,7 @@ async function startMcpServer() {
|
|
|
13167
13244
|
server.tool(
|
|
13168
13245
|
"get_chat",
|
|
13169
13246
|
"Get a compact chat summary by id/ref. Includes last message preview, parentChatId, and child workspace chats (status + lastText). While running, includes progress (last tool/thinking) and lastActivityAt. Includes usage (billed token + costUsd totals when providers reported cost) and lastTurnUsage. blockedReason is why that agent is waiting on a person (question, plan approval, or a reported block).",
|
|
13170
|
-
{ ref:
|
|
13247
|
+
{ ref: z10.string() },
|
|
13171
13248
|
async ({ ref }) => {
|
|
13172
13249
|
const t = orch.getThread(ref);
|
|
13173
13250
|
if (!t) {
|
|
@@ -13214,17 +13291,17 @@ async function startMcpServer() {
|
|
|
13214
13291
|
"present_artifact",
|
|
13215
13292
|
"Show a document or live log in Sideboard\u2019s side column. For html/svg/markdown/react, pass the FULL document and do not also fence that same body in chat. For type=log, pass only NEW lines (same artifact_id appends). Prefer type=log for long-running job output \u2014 do not resend HTML. type=react is a single default-export component (JSX/TSX); only react/react-dom imports.",
|
|
13216
13293
|
{
|
|
13217
|
-
title:
|
|
13218
|
-
type:
|
|
13294
|
+
title: z10.string().describe("Short title shown in the artifact pane header"),
|
|
13295
|
+
type: z10.enum(["html", "svg", "markdown", "react", "log"]).describe(
|
|
13219
13296
|
"html/svg/markdown/react replace the pane. log appends content to the same artifact_id (new lines only)."
|
|
13220
13297
|
),
|
|
13221
|
-
content:
|
|
13298
|
+
content: z10.string().describe(
|
|
13222
13299
|
"html/svg/markdown/react: full document. log: only the new lines since the last call (empty is ok for a status-only update)."
|
|
13223
13300
|
),
|
|
13224
|
-
artifact_id:
|
|
13225
|
-
status:
|
|
13226
|
-
phase:
|
|
13227
|
-
mode:
|
|
13301
|
+
artifact_id: z10.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
|
|
13302
|
+
status: z10.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
|
|
13303
|
+
phase: z10.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
|
|
13304
|
+
mode: z10.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
|
|
13228
13305
|
},
|
|
13229
13306
|
async ({ title, type, artifact_id, status, phase, mode }) => {
|
|
13230
13307
|
return mcpJson(
|
|
@@ -13237,15 +13314,15 @@ async function startMcpServer() {
|
|
|
13237
13314
|
"ask_user",
|
|
13238
13315
|
"Ask the user a clarifying multiple-choice question in Sideboard\u2019s composer. Call only when work is blocked on choosing among a few concrete options (approach fork, which API, auth vs cookies). Do not call for greetings, check-ins, \u201Chello\u201D, open-ended how-can-I-help, or to invent a menu of possible next tasks \u2014 reply in chat instead. If one option is the obvious default, proceed without asking. Before calling, write a short chat message explaining the decision and what each option means. Include a description on every option. After calling, stop and wait for answers. Not for \u201Cis the plan ready?\u201D.",
|
|
13239
13316
|
{
|
|
13240
|
-
questions:
|
|
13241
|
-
|
|
13242
|
-
question:
|
|
13243
|
-
header:
|
|
13244
|
-
multiSelect:
|
|
13245
|
-
options:
|
|
13246
|
-
|
|
13247
|
-
label:
|
|
13248
|
-
description:
|
|
13317
|
+
questions: z10.array(
|
|
13318
|
+
z10.object({
|
|
13319
|
+
question: z10.string().describe("Full question text ending with ?"),
|
|
13320
|
+
header: z10.string().max(24).optional().describe("Short label shown above the question"),
|
|
13321
|
+
multiSelect: z10.boolean().optional().describe("Allow selecting multiple options"),
|
|
13322
|
+
options: z10.array(
|
|
13323
|
+
z10.object({
|
|
13324
|
+
label: z10.string(),
|
|
13325
|
+
description: z10.string().optional().describe("What this option means / when to choose it (strongly preferred)")
|
|
13249
13326
|
})
|
|
13250
13327
|
).min(2).max(6).describe("2\u20136 choices (Sideboard also offers Other)")
|
|
13251
13328
|
})
|
|
@@ -13271,9 +13348,9 @@ async function startMcpServer() {
|
|
|
13271
13348
|
"present_plan",
|
|
13272
13349
|
PRESENT_PLAN_TOOL_DESCRIPTION,
|
|
13273
13350
|
{
|
|
13274
|
-
title:
|
|
13275
|
-
content:
|
|
13276
|
-
thread_id:
|
|
13351
|
+
title: z10.string().optional().describe("Short plan title (defaults to Plan)"),
|
|
13352
|
+
content: z10.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
|
|
13353
|
+
thread_id: z10.string().optional().describe("Sideboard thread id when cwd is not the worktree")
|
|
13277
13354
|
},
|
|
13278
13355
|
async ({ title, content, thread_id }) => {
|
|
13279
13356
|
const { writePlanFile: writePlanFile2 } = await import("./plan-file-7MMIPV7Y.js");
|
|
@@ -13302,15 +13379,15 @@ async function startMcpServer() {
|
|
|
13302
13379
|
"present_schema",
|
|
13303
13380
|
"Open Sideboard\u2019s schema-driven side column (filterable table and/or form) when the user needs to filter, edit, publish, or persist records. Do not call this just to re-display rows you already wrote as a markdown table. If the user asks for an editable / interactive table, call this even if chat already showed those rows. Pass JSON Schema + optional schemaUi. Prefer datasource=inline with embedded resource/records. Use datasource=brightsy with resource_id only when the user is logged into Brightsy.",
|
|
13304
13381
|
{
|
|
13305
|
-
title:
|
|
13306
|
-
mode:
|
|
13307
|
-
datasource:
|
|
13308
|
-
resource_id:
|
|
13309
|
-
record_id:
|
|
13310
|
-
resource:
|
|
13311
|
-
record:
|
|
13312
|
-
records:
|
|
13313
|
-
pane_id:
|
|
13382
|
+
title: z10.string().describe("Pane title"),
|
|
13383
|
+
mode: z10.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
|
|
13384
|
+
datasource: z10.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
|
|
13385
|
+
resource_id: z10.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
|
|
13386
|
+
record_id: z10.string().optional().describe("Record id when opening form mode"),
|
|
13387
|
+
resource: z10.record(z10.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
|
|
13388
|
+
record: z10.record(z10.unknown()).optional().describe("Inline record { id, data, published_at? }"),
|
|
13389
|
+
records: z10.array(z10.record(z10.unknown())).optional().describe("Inline records for table mode"),
|
|
13390
|
+
pane_id: z10.string().optional().describe("Stable pane id across updates")
|
|
13314
13391
|
},
|
|
13315
13392
|
async (args) => {
|
|
13316
13393
|
const id = args.pane_id?.trim() || `schema_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -13331,10 +13408,10 @@ async function startMcpServer() {
|
|
|
13331
13408
|
"present_files",
|
|
13332
13409
|
"Open Sideboard\u2019s Files column (CMS-style file manager: browse, upload, pick). Use datasource=brightsy when the user is logged into Brightsy account storage; datasource=memory for a session-local demo store. Prefer this over claiming a file manager UI is unavailable. Pair with present_schema when editing records that need media.",
|
|
13333
13410
|
{
|
|
13334
|
-
title:
|
|
13335
|
-
datasource:
|
|
13336
|
-
path:
|
|
13337
|
-
pane_id:
|
|
13411
|
+
title: z10.string().optional().describe("Pane title (default: Files)"),
|
|
13412
|
+
datasource: z10.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
|
|
13413
|
+
path: z10.string().optional().describe("Initial folder path (e.g. public)"),
|
|
13414
|
+
pane_id: z10.string().optional().describe("Stable pane id across updates")
|
|
13338
13415
|
},
|
|
13339
13416
|
async (args) => {
|
|
13340
13417
|
const id = args.pane_id?.trim() || `files_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -13354,8 +13431,8 @@ async function startMcpServer() {
|
|
|
13354
13431
|
"wait_for_job",
|
|
13355
13432
|
"Wait on a detached long job (tests, pack, deploy, connector CLI) started with detached-job.cjs. MCP clients kill tools around 60s, so this returns within 45s. Sideboard opens a type=log pane from this result (artifact_id = job id, content = delta). stillRunning is the source of truth \u2014 if true, call wait_for_job again. If the job is hanging, producing no useful output, or doing the wrong thing, call stop_job instead of looping forever. Do not end the turn or tell the user you will let them know later. If false, ok/failed is the result.",
|
|
13356
13433
|
{
|
|
13357
|
-
id:
|
|
13358
|
-
timeoutMs:
|
|
13434
|
+
id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
13435
|
+
timeoutMs: z10.number().optional()
|
|
13359
13436
|
},
|
|
13360
13437
|
async ({ id, timeoutMs }) => {
|
|
13361
13438
|
const result = await waitForDetachedJob(process.cwd(), id, {
|
|
@@ -13368,8 +13445,8 @@ async function startMcpServer() {
|
|
|
13368
13445
|
"stop_job",
|
|
13369
13446
|
"Stop a detached job you started with detached-job.cjs when it is hanging, producing no useful output, buffering forever, or doing the wrong thing (wrong project, infinite watch, huge dump). Do not stop a pack/test/deploy that is clearly making progress. The type=log pane updates to status=failed with the last delta. Then decide the next step.",
|
|
13370
13447
|
{
|
|
13371
|
-
id:
|
|
13372
|
-
reason:
|
|
13448
|
+
id: z10.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
13449
|
+
reason: z10.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
|
|
13373
13450
|
},
|
|
13374
13451
|
async ({ id, reason }) => {
|
|
13375
13452
|
const result = await stopDetachedJob(process.cwd(), id, { reason });
|
|
@@ -13381,7 +13458,7 @@ async function startMcpServer() {
|
|
|
13381
13458
|
"list_run_scripts",
|
|
13382
13459
|
"List .sideboard/.conductor run scripts for this thread (same menu as the desktop Dev button) and which are active. Each script and active run includes preview: url (open http://localhost:<SIDEBOARD_PORT>) or window (Electron: native window is the app; url is renderer/HMR only). Never guess :3000. Worktree turns may omit ref (uses cwd).",
|
|
13383
13460
|
{
|
|
13384
|
-
ref:
|
|
13461
|
+
ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
|
|
13385
13462
|
},
|
|
13386
13463
|
async ({ ref }) => {
|
|
13387
13464
|
try {
|
|
@@ -13411,8 +13488,8 @@ async function startMcpServer() {
|
|
|
13411
13488
|
"run_dev_script",
|
|
13412
13489
|
"Start a .sideboard/.conductor run script (same as the desktop Dev / play button). Several named scripts can run at once; each gets its own port, and starting one does not stop the others. Logs and Stop appear in the thread UI \u2014 do not detached-job or shell-spawn the same command. Returns {port, ports, url, preview}. preview=url \u2192 open url (browser, curl, Playwright). preview=window \u2192 Electron: the native window is the app; url is renderer/HMR only (no preload/IPC in a browser). The port is allocated SIDEBOARD_PORT, not 3000. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
|
|
13413
13490
|
{
|
|
13414
|
-
ref:
|
|
13415
|
-
name:
|
|
13491
|
+
ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
13492
|
+
name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
|
|
13416
13493
|
},
|
|
13417
13494
|
async ({ ref, name }) => {
|
|
13418
13495
|
try {
|
|
@@ -13440,8 +13517,8 @@ async function startMcpServer() {
|
|
|
13440
13517
|
"stop_dev_script",
|
|
13441
13518
|
"Stop a run script started with run_dev_script or the desktop Dev button (same as UI Stop). Omit name to stop all scripts on this worktree. Worktree turns may omit ref (uses cwd).",
|
|
13442
13519
|
{
|
|
13443
|
-
ref:
|
|
13444
|
-
name:
|
|
13520
|
+
ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
13521
|
+
name: z10.string().optional().describe("Script name to stop; omit to stop all active scripts.")
|
|
13445
13522
|
},
|
|
13446
13523
|
async ({ ref, name }) => {
|
|
13447
13524
|
try {
|
|
@@ -13458,9 +13535,9 @@ async function startMcpServer() {
|
|
|
13458
13535
|
"get_run_log",
|
|
13459
13536
|
"Read the Run-tab terminal for a worktree script (same stdout/stderr as the desktop Dev pane). Default is a tail \u2014 raise `tail` only if the error is missing. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
|
|
13460
13537
|
{
|
|
13461
|
-
ref:
|
|
13462
|
-
name:
|
|
13463
|
-
tail:
|
|
13538
|
+
ref: z10.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
13539
|
+
name: z10.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
|
|
13540
|
+
tail: z10.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
|
|
13464
13541
|
`Max characters to return from the end (default ${DEFAULT_RUN_LOG_TAIL_CHARS}). Do not request the full buffer unless the tail is truncated and you still need more.`
|
|
13465
13542
|
)
|
|
13466
13543
|
},
|
|
@@ -13514,8 +13591,8 @@ async function startMcpServer() {
|
|
|
13514
13591
|
}
|
|
13515
13592
|
});
|
|
13516
13593
|
} catch (err) {
|
|
13517
|
-
const
|
|
13518
|
-
return { content: [{ type: "text", text:
|
|
13594
|
+
const text6 = err instanceof Error ? err.message : String(err);
|
|
13595
|
+
return { content: [{ type: "text", text: text6 }], isError: true };
|
|
13519
13596
|
}
|
|
13520
13597
|
}
|
|
13521
13598
|
);
|
|
@@ -13523,8 +13600,8 @@ async function startMcpServer() {
|
|
|
13523
13600
|
"notify_orchestrator",
|
|
13524
13601
|
"Wake the parent Global orchestrator with a short status so it does not have to poll wait_for_turn. Use when you are blocked and the parent may have moved on (missing access, waiting on something the coordinator must handle). The message is shown on the sidebar and board until the next user message in this chat. ask_user already notifies for input-required \u2014 do not call this for the same question. Information only: never a git command. Do not use this to steer other worktrees.",
|
|
13525
13602
|
{
|
|
13526
|
-
message:
|
|
13527
|
-
reason:
|
|
13603
|
+
message: z10.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
|
|
13604
|
+
reason: z10.enum(["input-required", "blocked"]).optional().describe(
|
|
13528
13605
|
"input-required = waiting on the user in this chat; blocked = need the coordinator (default)."
|
|
13529
13606
|
)
|
|
13530
13607
|
},
|
|
@@ -13550,23 +13627,24 @@ async function startMcpServer() {
|
|
|
13550
13627
|
...result.deduped ? { deduped: true } : {}
|
|
13551
13628
|
});
|
|
13552
13629
|
} catch (err) {
|
|
13553
|
-
const
|
|
13554
|
-
return { content: [{ type: "text", text:
|
|
13630
|
+
const text6 = err instanceof Error ? err.message : String(err);
|
|
13631
|
+
return { content: [{ type: "text", text: text6 }], isError: true };
|
|
13555
13632
|
}
|
|
13556
13633
|
}
|
|
13557
13634
|
);
|
|
13558
13635
|
}
|
|
13559
13636
|
registerScheduleTools(server);
|
|
13637
|
+
registerFollowUpTools(server);
|
|
13560
13638
|
registerOrderTools(server);
|
|
13561
13639
|
server.tool(
|
|
13562
13640
|
"set_workspace_tags",
|
|
13563
13641
|
worktreeProfile ? "Update tags on this workspace (the checkout you are in). Omit ref to use this chat. mode=replace (default), add, or remove. Short labels \u2014 the same ones the orchestrator used for this task. You cannot retag a different checkout." : "Label a project workspace so related checkouts stay recognizable in the sidebar and on the phone. Pass any chat id on that workspace. Use the same tags on every workspace from one task. mode=replace is the default; add and remove change the set. create_workspace tags= sets them at create time. Not for orchestration chats.",
|
|
13564
13642
|
{
|
|
13565
|
-
ref:
|
|
13643
|
+
ref: z10.string().optional().describe(
|
|
13566
13644
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace to label."
|
|
13567
13645
|
),
|
|
13568
|
-
tags:
|
|
13569
|
-
mode:
|
|
13646
|
+
tags: z10.union([z10.string(), z10.array(z10.string())]).describe("Labels to set. A string may be comma-separated."),
|
|
13647
|
+
mode: z10.enum(["replace", "add", "remove"]).optional()
|
|
13570
13648
|
},
|
|
13571
13649
|
async ({ ref, tags, mode }) => {
|
|
13572
13650
|
try {
|
|
@@ -13594,10 +13672,10 @@ async function startMcpServer() {
|
|
|
13594
13672
|
"set_wake_on_github_edges",
|
|
13595
13673
|
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.",
|
|
13596
13674
|
{
|
|
13597
|
-
ref:
|
|
13675
|
+
ref: z10.string().optional().describe(
|
|
13598
13676
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
13599
13677
|
),
|
|
13600
|
-
enabled:
|
|
13678
|
+
enabled: z10.boolean().describe("True opts the checkout in. False turns it off.")
|
|
13601
13679
|
},
|
|
13602
13680
|
async ({ ref, enabled }) => {
|
|
13603
13681
|
try {
|
|
@@ -13630,7 +13708,7 @@ async function startMcpServer() {
|
|
|
13630
13708
|
"set_caffeinate",
|
|
13631
13709
|
"Keep this Mac awake with caffeinate across turns \u2014 independent of Settings toggles. 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 when the user will be away and no phone is connected, or they ask you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
|
|
13632
13710
|
{
|
|
13633
|
-
enabled:
|
|
13711
|
+
enabled: z10.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
|
|
13634
13712
|
},
|
|
13635
13713
|
async ({ enabled }) => {
|
|
13636
13714
|
const threadId = process.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
|
|
@@ -13656,24 +13734,24 @@ async function startMcpServer() {
|
|
|
13656
13734
|
"create_workspace",
|
|
13657
13735
|
`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.`,
|
|
13658
13736
|
{
|
|
13659
|
-
sourceType:
|
|
13660
|
-
sourceRef:
|
|
13661
|
-
agent:
|
|
13737
|
+
sourceType: z10.enum(["branch", "pr", "ticket"]),
|
|
13738
|
+
sourceRef: z10.string(),
|
|
13739
|
+
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
|
|
13662
13740
|
`Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
|
|
13663
13741
|
),
|
|
13664
|
-
model:
|
|
13742
|
+
model: z10.string().nullable().optional().describe(
|
|
13665
13743
|
`Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
|
|
13666
13744
|
),
|
|
13667
|
-
repoPath:
|
|
13668
|
-
title:
|
|
13669
|
-
cowboy:
|
|
13745
|
+
repoPath: z10.string(),
|
|
13746
|
+
title: z10.string().optional(),
|
|
13747
|
+
cowboy: z10.boolean().optional().describe(
|
|
13670
13748
|
"If true, work in the project folder on the default branch (no thread/* worktree). Requires Settings \u2192 Advanced \u2192 Cowboy mode. Land is commit+push to that branch. Archive does not delete the folder."
|
|
13671
13749
|
),
|
|
13672
|
-
parentChatId:
|
|
13750
|
+
parentChatId: z10.string().optional().describe(
|
|
13673
13751
|
"Orchestration: omit (preferred) or pass YOUR chat id from the turn reminder / AGENTS.md. Do not invent uuids."
|
|
13674
13752
|
),
|
|
13675
|
-
parentThreadId:
|
|
13676
|
-
tags:
|
|
13753
|
+
parentThreadId: z10.string().optional().describe("Legacy alias for parentChatId."),
|
|
13754
|
+
tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
|
|
13677
13755
|
"Short labels for this workspace (or a comma-separated string). Use the same tags on every checkout for one task. Added when the checkout already exists."
|
|
13678
13756
|
)
|
|
13679
13757
|
},
|
|
@@ -13689,11 +13767,11 @@ async function startMcpServer() {
|
|
|
13689
13767
|
"start_board_card",
|
|
13690
13768
|
"Same as create_workspace for a ticket, PR, or named branch (attaches issue text when Sideboard can resolve it). Does not create a second checkout when one already matches \u2014 returns that workspace (alreadyStarted) and its chats. A workspace can have many agents. fork_chat to add one; send_to_chat only the chat that should do this job.",
|
|
13691
13769
|
{
|
|
13692
|
-
kind:
|
|
13693
|
-
ref:
|
|
13694
|
-
repoPath:
|
|
13695
|
-
title:
|
|
13696
|
-
tags:
|
|
13770
|
+
kind: z10.enum(["ticket", "pr", "branch"]),
|
|
13771
|
+
ref: z10.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
|
|
13772
|
+
repoPath: z10.string().describe("Project path from list_projects / list_board"),
|
|
13773
|
+
title: z10.string().optional(),
|
|
13774
|
+
tags: z10.union([z10.string(), z10.array(z10.string())]).optional().describe(
|
|
13697
13775
|
"Short labels for this workspace. Same tags on every checkout for one task. Added when the checkout already exists."
|
|
13698
13776
|
)
|
|
13699
13777
|
},
|
|
@@ -13796,11 +13874,11 @@ async function startMcpServer() {
|
|
|
13796
13874
|
);
|
|
13797
13875
|
server.tool(
|
|
13798
13876
|
"send_to_chat",
|
|
13799
|
-
'
|
|
13877
|
+
'Send a prompt to a workspace chat. A second send joins that prompt only while it is still queued or not yet handed to the process. Once the process has started, the send waits behind the turn and does not stop it or change the prompt already running. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. The workspace composer still follows Settings \u2192 Follow-up. Use after create_workspace to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. Do not send_to_chat to check in, resume after a halt notice, or because wait_for_turn returned stillRunning. Call wait_for_turn again instead.',
|
|
13800
13878
|
{
|
|
13801
|
-
ref:
|
|
13802
|
-
prompt:
|
|
13803
|
-
force_stop:
|
|
13879
|
+
ref: z10.string(),
|
|
13880
|
+
prompt: z10.string(),
|
|
13881
|
+
force_stop: z10.boolean().optional()
|
|
13804
13882
|
},
|
|
13805
13883
|
async ({ ref, prompt, force_stop }) => {
|
|
13806
13884
|
if (force_stop) {
|
|
@@ -13810,7 +13888,7 @@ async function startMcpServer() {
|
|
|
13810
13888
|
}
|
|
13811
13889
|
}
|
|
13812
13890
|
const thread = await orch.send(ref, prompt, {
|
|
13813
|
-
followUp:
|
|
13891
|
+
followUp: force_stop ? "steer" : "join"
|
|
13814
13892
|
});
|
|
13815
13893
|
return mcpJson({
|
|
13816
13894
|
id: thread.id,
|
|
@@ -13823,10 +13901,10 @@ async function startMcpServer() {
|
|
|
13823
13901
|
if (shouldRegisterMcpWaitForTurn()) {
|
|
13824
13902
|
server.tool(
|
|
13825
13903
|
"wait_for_turn",
|
|
13826
|
-
"Wait until the chat finishes its current/queued turn, or return early with a live progress snapshot. MCP clients often kill tools around 60s, so this returns within 45s even while the child is still working. taskState is the A2A-style lifecycle: submitted (queued, not started), working, input-required (ask_user), completed, failed, canceled. stillRunning is true only for submitted/working. blockedReason is why the child is waiting on a person (the question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress and call wait_for_turn again. Do not send_to_chat a check-in
|
|
13904
|
+
"Wait until the chat finishes its current/queued turn, or return early with a live progress snapshot. MCP clients often kill tools around 60s, so this returns within 45s even while the child is still working. taskState is the A2A-style lifecycle: submitted (queued, not started), working, input-required (ask_user), completed, failed, canceled. stillRunning is true only for submitted/working. blockedReason is why the child is waiting on a person (the question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress and call wait_for_turn again. Do not send_to_chat a check-in. On failed, read failureClass: auth, quota, and refused are not a retry; timeout or runner can be one. lastError/text is the failure. On canceled, the child did not finish \u2014 resume with send_to_chat or tell the user. On input-required, wait for the user in that chat. When finished, text is this turn\u2019s assistant reply and usage is that turn\u2019s tokens + costUsd (this turn, not the Claude session total; sessionCostUsd is the provider session total when present).",
|
|
13827
13905
|
{
|
|
13828
|
-
ref:
|
|
13829
|
-
timeoutMs:
|
|
13906
|
+
ref: z10.string(),
|
|
13907
|
+
timeoutMs: z10.number().optional()
|
|
13830
13908
|
},
|
|
13831
13909
|
async ({ ref, timeoutMs }) => {
|
|
13832
13910
|
const thread = await orch.waitForTurn(ref, mcpWaitForTurnTimeoutMs(timeoutMs), {
|
|
@@ -13853,14 +13931,16 @@ async function startMcpServer() {
|
|
|
13853
13931
|
}
|
|
13854
13932
|
server.tool(
|
|
13855
13933
|
"get_turn_result",
|
|
13856
|
-
"Assistant message and last-turn usage when the turn finished. While stillRunning (submitted/working), text and usage are empty so a previous reply cannot be mistaken for this turn \u2014 use progress for tools/thinking. Not the full transcript. Includes taskState (A2A lifecycle) and blockedReason (why the agent is waiting on a person).",
|
|
13857
|
-
{ ref:
|
|
13934
|
+
"Assistant message and last-turn usage when the turn finished. While stillRunning (submitted/working), text and usage are empty so a previous reply cannot be mistaken for this turn \u2014 use progress for tools/thinking. Not the full transcript. Includes taskState (A2A lifecycle), failureClass when the turn failed (auth, quota, refused, timeout, runner, other), and blockedReason (why the agent is waiting on a person).",
|
|
13935
|
+
{ ref: z10.string() },
|
|
13858
13936
|
async ({ ref }) => {
|
|
13859
13937
|
const result = orch.getTurnResult(ref);
|
|
13860
|
-
const
|
|
13938
|
+
const failureClass = result.taskState === "failed" && result.status !== "broken" ? classifyTurnFailure(result.lastError || result.text) : null;
|
|
13939
|
+
const hint = mcpWaitTaskHint(result.taskState, result.status, result.blockedReason, failureClass);
|
|
13861
13940
|
const waiting = Boolean(result.blockedReason) && !result.stillRunning && result.taskState !== "failed" && result.taskState !== "canceled";
|
|
13862
13941
|
return mcpJson({
|
|
13863
13942
|
...result,
|
|
13943
|
+
failureClass,
|
|
13864
13944
|
hint,
|
|
13865
13945
|
incomplete: needsCoordinatorAction(result.taskState) || waiting
|
|
13866
13946
|
});
|
|
@@ -13870,9 +13950,9 @@ async function startMcpServer() {
|
|
|
13870
13950
|
"stop_chat",
|
|
13871
13951
|
"Force-stop a thread: kill any in-flight agent turn AND clear queued prompts so drainQueue cannot continue. Does not archive the worktree. Optional force defaults to true. Pass reason \u2014 a short note on why this chat is stopping. It is stored on the thread and kept when the turn unwinds. If you omit it, Sideboard still records that the queue was cleared.",
|
|
13872
13952
|
{
|
|
13873
|
-
ref:
|
|
13874
|
-
force:
|
|
13875
|
-
reason:
|
|
13953
|
+
ref: z10.string(),
|
|
13954
|
+
force: z10.boolean().optional(),
|
|
13955
|
+
reason: z10.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
|
|
13876
13956
|
},
|
|
13877
13957
|
async ({ ref, force, reason }) => {
|
|
13878
13958
|
const t = orch.getThread(ref);
|
|
@@ -13898,8 +13978,8 @@ async function startMcpServer() {
|
|
|
13898
13978
|
"get_diff",
|
|
13899
13979
|
"Compact diff summary (capped hunks, paginated)",
|
|
13900
13980
|
{
|
|
13901
|
-
ref:
|
|
13902
|
-
maxFiles:
|
|
13981
|
+
ref: z10.string(),
|
|
13982
|
+
maxFiles: z10.number().optional()
|
|
13903
13983
|
},
|
|
13904
13984
|
async ({ ref, maxFiles }) => {
|
|
13905
13985
|
const summary = await orch.diffSummary(ref);
|
|
@@ -13912,7 +13992,7 @@ async function startMcpServer() {
|
|
|
13912
13992
|
server.tool(
|
|
13913
13993
|
"get_pr_checks",
|
|
13914
13994
|
"Snapshot of GitHub PR checks for a worktree thread (`gh pr checks` plus merge/review gates). null = no PR. If the user gave a goal (Greptile 5/5, CI green), the worktree agent watches with `gh pr checks --watch` via /long-running \u2014 this tool is a snapshot, not a waiter. Coordinators: do not run gh from the orchestration cwd.",
|
|
13915
|
-
{ ref:
|
|
13995
|
+
{ ref: z10.string().describe("Worktree thread id/ref") },
|
|
13916
13996
|
async ({ ref }) => {
|
|
13917
13997
|
try {
|
|
13918
13998
|
const checks = await orch.getPrChecks(ref);
|
|
@@ -13926,7 +14006,7 @@ async function startMcpServer() {
|
|
|
13926
14006
|
server.tool(
|
|
13927
14007
|
"request_review",
|
|
13928
14008
|
'Start a merge-readiness Review on a worktree agent thread (same as the desktop Review button). If that worktree has a single unused idle agent (no messages), runs the review there; otherwise opens a new Review chat tab. Attaches .claude/skills/review/SKILL.md when present (else copies .sideboard/review.md into .context/review.md, or seeds that file from the stock template), and sends "Review changes in this workspace." Expect Approve / Approve with nits / Request changes / Needs more information in that chat. The review stays there so the user can read it and type next steps \u2014 do not comment on or update the PR or ticket, and do not ask_user after the review, until they ask. Pass a worktree thread ref \u2014 not the orchestrator. Then wait_for_turn (loop while stillRunning) / get_turn_result on the returned review thread id.',
|
|
13929
|
-
{ ref:
|
|
14009
|
+
{ ref: z10.string().describe("Worktree thread id/ref to review") },
|
|
13930
14010
|
async ({ ref }) => {
|
|
13931
14011
|
try {
|
|
13932
14012
|
const tab = await orch.requestReview(ref);
|
|
@@ -13948,8 +14028,8 @@ async function startMcpServer() {
|
|
|
13948
14028
|
"ask_git",
|
|
13949
14029
|
"Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (CI green, a review score, until checks pass). A push can wake a third-party PR review; the worktree agent acknowledges it only inside that goal. Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
|
|
13950
14030
|
{
|
|
13951
|
-
ref:
|
|
13952
|
-
action:
|
|
14031
|
+
ref: z10.string().describe("Worktree thread id/ref"),
|
|
14032
|
+
action: z10.enum(AGENT_GIT_ACTIONS).describe(
|
|
13953
14033
|
"commit-push | create-draft | create-web | resolve-conflicts | ready-for-review | merge"
|
|
13954
14034
|
)
|
|
13955
14035
|
},
|
|
@@ -13978,7 +14058,7 @@ async function startMcpServer() {
|
|
|
13978
14058
|
}
|
|
13979
14059
|
}
|
|
13980
14060
|
);
|
|
13981
|
-
const agentEnum =
|
|
14061
|
+
const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
|
|
13982
14062
|
server.tool(
|
|
13983
14063
|
"list_models",
|
|
13984
14064
|
"List models for an agent. Prefer Auto: do not call this unless you have a reason to pin a specific model (user request, cost/latency, capability). Omit agent to list all.",
|
|
@@ -13999,11 +14079,11 @@ async function startMcpServer() {
|
|
|
13999
14079
|
"fork_workspace",
|
|
14000
14080
|
"Fork a worktree agent chat into a NEW git worktree + chat (desktop \u201CFork to new workspace\u201D). Seeds a transcript (through through_index, default all). Optional agent override. Leave model unset for Auto (default) \u2014 only pass model when you have a reason. Not for the orchestrator. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id.",
|
|
14001
14081
|
{
|
|
14002
|
-
ref:
|
|
14003
|
-
through_index:
|
|
14082
|
+
ref: z10.string().describe("Worktree thread id/ref to fork"),
|
|
14083
|
+
through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
14004
14084
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
14005
|
-
model:
|
|
14006
|
-
title:
|
|
14085
|
+
model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
14086
|
+
title: z10.string().optional()
|
|
14007
14087
|
},
|
|
14008
14088
|
async ({ ref, through_index, agent, model, title }) => {
|
|
14009
14089
|
try {
|
|
@@ -14037,11 +14117,11 @@ async function startMcpServer() {
|
|
|
14037
14117
|
"fork_chat",
|
|
14038
14118
|
"Add another agent chat on the SAME workspace (same files, Run, and git). Also forks a Global orchestration chat into a new orchestration tab. Pass agent when the new chat should use a different harness. Leave model unset for Auto unless you have a reason. Orchestration forks require an MCP-capable agent (claude, cursor, codex, opencode \u2014 not brightsy). Use this for a second agent on a checkout (review, another harness, parallel work on the same branch). Do not create_workspace again for that \u2014 it returns the existing checkout. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id. Use fork_workspace only when the work needs its own git checkout.",
|
|
14039
14119
|
{
|
|
14040
|
-
ref:
|
|
14041
|
-
through_index:
|
|
14120
|
+
ref: z10.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
|
|
14121
|
+
through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
14042
14122
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
14043
|
-
model:
|
|
14044
|
-
title:
|
|
14123
|
+
model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
14124
|
+
title: z10.string().optional()
|
|
14045
14125
|
},
|
|
14046
14126
|
async ({ ref, through_index, agent, model, title }) => {
|
|
14047
14127
|
try {
|
|
@@ -14079,7 +14159,7 @@ async function startMcpServer() {
|
|
|
14079
14159
|
server.tool(
|
|
14080
14160
|
"run_setup",
|
|
14081
14161
|
"Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
|
|
14082
|
-
{ ref:
|
|
14162
|
+
{ ref: z10.string() },
|
|
14083
14163
|
async ({ ref }) => {
|
|
14084
14164
|
const result = await orch.runSetup(ref);
|
|
14085
14165
|
return mcpJson(result);
|
|
@@ -14088,7 +14168,7 @@ async function startMcpServer() {
|
|
|
14088
14168
|
server.tool(
|
|
14089
14169
|
"add_project",
|
|
14090
14170
|
"Register a git repo as a Sideboard workspace",
|
|
14091
|
-
{ repoPath:
|
|
14171
|
+
{ repoPath: z10.string() },
|
|
14092
14172
|
async ({ repoPath }) => {
|
|
14093
14173
|
const ws = await orch.addWorkspace(repoPath);
|
|
14094
14174
|
return mcpJson(ws);
|
|
@@ -14097,7 +14177,7 @@ async function startMcpServer() {
|
|
|
14097
14177
|
server.tool(
|
|
14098
14178
|
"remove_project",
|
|
14099
14179
|
"Unregister a Sideboard workspace and archive its chats",
|
|
14100
|
-
{ repoPath:
|
|
14180
|
+
{ repoPath: z10.string() },
|
|
14101
14181
|
async ({ repoPath }) => {
|
|
14102
14182
|
await orch.removeWorkspace(repoPath);
|
|
14103
14183
|
return { content: [{ type: "text", text: "ok" }] };
|
|
@@ -14107,12 +14187,12 @@ async function startMcpServer() {
|
|
|
14107
14187
|
"fanout",
|
|
14108
14188
|
"Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
|
|
14109
14189
|
{
|
|
14110
|
-
prompt:
|
|
14111
|
-
agents:
|
|
14112
|
-
repoPath:
|
|
14113
|
-
sourceType:
|
|
14114
|
-
sourceRef:
|
|
14115
|
-
title:
|
|
14190
|
+
prompt: z10.string(),
|
|
14191
|
+
agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"])),
|
|
14192
|
+
repoPath: z10.string(),
|
|
14193
|
+
sourceType: z10.enum(["branch", "pr", "ticket"]).optional(),
|
|
14194
|
+
sourceRef: z10.string().optional(),
|
|
14195
|
+
title: z10.string().optional()
|
|
14116
14196
|
},
|
|
14117
14197
|
async (args) => {
|
|
14118
14198
|
const threads = await orch.bestOfN(args);
|
|
@@ -14130,8 +14210,8 @@ async function startMcpServer() {
|
|
|
14130
14210
|
"list_branches",
|
|
14131
14211
|
"List git branches in a registered workspace. Pass repoPath from list_projects (unmerged into the default branch by default \u2014 for create_workspace sourceType=branch).",
|
|
14132
14212
|
{
|
|
14133
|
-
repoPath:
|
|
14134
|
-
unmergedOnly:
|
|
14213
|
+
repoPath: z10.string(),
|
|
14214
|
+
unmergedOnly: z10.boolean().optional()
|
|
14135
14215
|
},
|
|
14136
14216
|
async ({ repoPath, unmergedOnly }) => {
|
|
14137
14217
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -14152,19 +14232,19 @@ async function startMcpServer() {
|
|
|
14152
14232
|
"list_prs",
|
|
14153
14233
|
`List GitHub PRs for a registered workspace (the review surface for assigned ticket work \u2014 not the tickets). Pass repoPath from list_projects. "Get me N tickets to review" \u2192 queue=review and limit=N: open non-draft PRs labeled with this project's ready-for-review GitHub label (Settings \u2192 Projects; default eng-review) with no individual user reviewer. Prefer teams that match Settings \u2192 Agents / Projects roles for this repo. A team like engineering-team is not a claim (you are on that team). Also: state (open|closed|merged|all|review), label, reviewer (me|unassigned|login), query, limit (default 40, max 250). Then create_workspace with sourceType=pr.`,
|
|
14154
14234
|
{
|
|
14155
|
-
repoPath:
|
|
14156
|
-
query:
|
|
14157
|
-
queue:
|
|
14235
|
+
repoPath: z10.string(),
|
|
14236
|
+
query: z10.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
|
|
14237
|
+
queue: z10.enum(["review", "mine", "approved", "changes"]).optional().describe(
|
|
14158
14238
|
"review = unclaimed ready-for-review inbox (Settings \u2192 Projects label, default eng-review). mine = review-requested:@me. approved / changes = eng-approved / eng-requested-changes."
|
|
14159
14239
|
),
|
|
14160
|
-
state:
|
|
14161
|
-
label:
|
|
14240
|
+
state: z10.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
|
|
14241
|
+
label: z10.string().optional().describe(
|
|
14162
14242
|
"GitHub label / workflow tag. Comma-separated AND. Examples: eng-review, eng-approved, eng-requested-changes"
|
|
14163
14243
|
),
|
|
14164
|
-
reviewer:
|
|
14244
|
+
reviewer: z10.string().optional().describe(
|
|
14165
14245
|
"me (review requested of you), unassigned (no individual reviewer; team queues like engineering-team still count), all, or a GitHub login"
|
|
14166
14246
|
),
|
|
14167
|
-
limit:
|
|
14247
|
+
limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
|
|
14168
14248
|
},
|
|
14169
14249
|
async ({ repoPath, query, queue, state, label, reviewer, limit }) => {
|
|
14170
14250
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -14197,7 +14277,7 @@ async function startMcpServer() {
|
|
|
14197
14277
|
server.tool(
|
|
14198
14278
|
"get_pr_stack",
|
|
14199
14279
|
"Load the GitHub PR stack for a thread worktree (`gh stack view --json`). Returns null JSON when the branch is not stacked. Prefer this before ask_git merge on stacked PRs (and only merge when the user explicitly asked).",
|
|
14200
|
-
{ ref:
|
|
14280
|
+
{ ref: z10.string() },
|
|
14201
14281
|
async ({ ref }) => {
|
|
14202
14282
|
const stack = await orch.getPrStack(ref);
|
|
14203
14283
|
return mcpJson(stack);
|
|
@@ -14207,8 +14287,8 @@ async function startMcpServer() {
|
|
|
14207
14287
|
"open_pr_stack_layers",
|
|
14208
14288
|
"Materialize one worktree+thread per stack layer (or a single 1-based layer). Pass a thread ref already on the stack.",
|
|
14209
14289
|
{
|
|
14210
|
-
ref:
|
|
14211
|
-
layer:
|
|
14290
|
+
ref: z10.string(),
|
|
14291
|
+
layer: z10.number().int().positive().optional()
|
|
14212
14292
|
},
|
|
14213
14293
|
async ({ ref, layer }) => {
|
|
14214
14294
|
const result = await orch.openPrStackLayers(ref, { layer });
|
|
@@ -14231,9 +14311,9 @@ async function startMcpServer() {
|
|
|
14231
14311
|
"add_stack_layer",
|
|
14232
14312
|
"Add a branch on top of the current stack (`gh stack add`) and open a worktree+thread for it.",
|
|
14233
14313
|
{
|
|
14234
|
-
ref:
|
|
14235
|
-
branchName:
|
|
14236
|
-
title:
|
|
14314
|
+
ref: z10.string(),
|
|
14315
|
+
branchName: z10.string(),
|
|
14316
|
+
title: z10.string().optional()
|
|
14237
14317
|
},
|
|
14238
14318
|
async ({ ref, branchName, title }) => {
|
|
14239
14319
|
const result = await orch.addStackLayer(ref, branchName, { title });
|
|
@@ -14251,11 +14331,11 @@ async function startMcpServer() {
|
|
|
14251
14331
|
"create_pr_stack",
|
|
14252
14332
|
"Create a new GitHub PR stack with one Sideboard worktree per layer (bottom\u2192top branch names). Requires `gh extension install github/gh-stack`.",
|
|
14253
14333
|
{
|
|
14254
|
-
repoPath:
|
|
14255
|
-
branches:
|
|
14256
|
-
agent:
|
|
14257
|
-
base:
|
|
14258
|
-
title:
|
|
14334
|
+
repoPath: z10.string(),
|
|
14335
|
+
branches: z10.array(z10.string()).min(1),
|
|
14336
|
+
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]),
|
|
14337
|
+
base: z10.string().optional(),
|
|
14338
|
+
title: z10.string().optional()
|
|
14259
14339
|
},
|
|
14260
14340
|
async (args) => {
|
|
14261
14341
|
const result = await orch.createPrStack({
|
|
@@ -14283,10 +14363,10 @@ async function startMcpServer() {
|
|
|
14283
14363
|
"list_issues",
|
|
14284
14364
|
"List or search issues (Linear, AbleTime, or GitHub; falls back to GitHub). Cursor Origin has no issue tracker \u2014 a Cursor repo returns unavailableReason unless Linear or AbleTime is the source. Entire tickets are Trails (`entire trail`), not GitHub Issues, so an Entire repo does the same unless Linear or AbleTime is the source. Use Settings \u2192 Agents / Projects notes and roles to pick tickets relevant to the viewer (query + assignee=me or unassigned as the notes say). Default 40; pass query and/or limit (max 250) when truncated. assignee: me (Linear default), unassigned, all, or a user id. Pass updatedSince for new/updated tickets and new comments (\u201Cany updates since yesterday?\u201D). Then create_workspace with sourceType=ticket.",
|
|
14285
14365
|
{
|
|
14286
|
-
repoPath:
|
|
14287
|
-
query:
|
|
14288
|
-
assignee:
|
|
14289
|
-
limit:
|
|
14366
|
+
repoPath: z10.string(),
|
|
14367
|
+
query: z10.string().optional().describe("Search title, identifier, or description"),
|
|
14368
|
+
assignee: z10.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
|
|
14369
|
+
limit: z10.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
14290
14370
|
updatedSince: mcpIssueUpdatedSinceSchema
|
|
14291
14371
|
},
|
|
14292
14372
|
async ({ repoPath, query, assignee, limit, updatedSince }) => {
|
|
@@ -14898,8 +14978,8 @@ var BrightsySideboardApi = class {
|
|
|
14898
14978
|
};
|
|
14899
14979
|
function taskMessageText(task) {
|
|
14900
14980
|
const parts = task.message?.parts ?? [];
|
|
14901
|
-
const
|
|
14902
|
-
return
|
|
14981
|
+
const text6 = parts.find((p) => p.kind === "text")?.text ?? "";
|
|
14982
|
+
return text6.trim();
|
|
14903
14983
|
}
|
|
14904
14984
|
|
|
14905
14985
|
// src/brightsy/cloud-connect.ts
|
|
@@ -15525,12 +15605,12 @@ function formatSlackInboundPrompt(msg) {
|
|
|
15525
15605
|
|
|
15526
15606
|
${msg.text}`;
|
|
15527
15607
|
}
|
|
15528
|
-
function isSlackInboundUserPrompt(
|
|
15529
|
-
return
|
|
15608
|
+
function isSlackInboundUserPrompt(text6) {
|
|
15609
|
+
return text6.startsWith("Slack DM\n") || text6.startsWith("Slack @mention\n");
|
|
15530
15610
|
}
|
|
15531
|
-
function formatSlackSignedReply(deviceLabel,
|
|
15611
|
+
function formatSlackSignedReply(deviceLabel, text6) {
|
|
15532
15612
|
const label = deviceLabel.trim();
|
|
15533
|
-
const body =
|
|
15613
|
+
const body = text6.trim();
|
|
15534
15614
|
if (!body) return body;
|
|
15535
15615
|
if (!label) return body;
|
|
15536
15616
|
const head = `${label}:`;
|
|
@@ -15539,8 +15619,8 @@ function formatSlackSignedReply(deviceLabel, text5) {
|
|
|
15539
15619
|
}
|
|
15540
15620
|
return `${label}: ${body}`;
|
|
15541
15621
|
}
|
|
15542
|
-
function signForThisMac(
|
|
15543
|
-
return formatSlackSignedReply(ensureSlackDeviceIdentity().deviceLabel,
|
|
15622
|
+
function signForThisMac(text6) {
|
|
15623
|
+
return formatSlackSignedReply(ensureSlackDeviceIdentity().deviceLabel, text6);
|
|
15544
15624
|
}
|
|
15545
15625
|
function slackReplyThreadTs(msg) {
|
|
15546
15626
|
if (msg.threadTs && msg.threadTs !== msg.ts) return msg.threadTs;
|
|
@@ -15601,9 +15681,9 @@ function replyStub(target) {
|
|
|
15601
15681
|
kind: "dm"
|
|
15602
15682
|
};
|
|
15603
15683
|
}
|
|
15604
|
-
async function postSlackText(target,
|
|
15684
|
+
async function postSlackText(target, text6, opts) {
|
|
15605
15685
|
if (opts.postReply) {
|
|
15606
|
-
const result = await opts.postReply(replyStub(target),
|
|
15686
|
+
const result = await opts.postReply(replyStub(target), text6);
|
|
15607
15687
|
const ts2 = result && typeof result === "object" && typeof result.ts === "string" ? result.ts.trim() : "";
|
|
15608
15688
|
return ts2 ? { ts: ts2 } : null;
|
|
15609
15689
|
}
|
|
@@ -15613,7 +15693,7 @@ async function postSlackText(target, text5, opts) {
|
|
|
15613
15693
|
"chat.postMessage",
|
|
15614
15694
|
{
|
|
15615
15695
|
channel: target.channelId,
|
|
15616
|
-
text:
|
|
15696
|
+
text: text6,
|
|
15617
15697
|
thread_ts: target.threadTs
|
|
15618
15698
|
},
|
|
15619
15699
|
opts.fetchImpl
|
|
@@ -15621,9 +15701,9 @@ async function postSlackText(target, text5, opts) {
|
|
|
15621
15701
|
const ts = json.ts?.trim();
|
|
15622
15702
|
return ts ? { ts } : null;
|
|
15623
15703
|
}
|
|
15624
|
-
async function updateSlackText(target, ts,
|
|
15704
|
+
async function updateSlackText(target, ts, text6, opts) {
|
|
15625
15705
|
if (opts.updateReply) {
|
|
15626
|
-
await opts.updateReply(replyStub(target), ts,
|
|
15706
|
+
await opts.updateReply(replyStub(target), ts, text6);
|
|
15627
15707
|
return;
|
|
15628
15708
|
}
|
|
15629
15709
|
const token = writeTokenForTeam(target.teamId);
|
|
@@ -15633,7 +15713,7 @@ async function updateSlackText(target, ts, text5, opts) {
|
|
|
15633
15713
|
{
|
|
15634
15714
|
channel: target.channelId,
|
|
15635
15715
|
ts,
|
|
15636
|
-
text:
|
|
15716
|
+
text: text6
|
|
15637
15717
|
},
|
|
15638
15718
|
opts.fetchImpl
|
|
15639
15719
|
);
|
|
@@ -15661,8 +15741,8 @@ function replyTargetOf(msg) {
|
|
|
15661
15741
|
threadTs: slackReplyThreadTs(msg)
|
|
15662
15742
|
};
|
|
15663
15743
|
}
|
|
15664
|
-
async function postSlackReply(msg,
|
|
15665
|
-
await postSlackText(replyTargetOf(msg), signForThisMac(
|
|
15744
|
+
async function postSlackReply(msg, text6, opts) {
|
|
15745
|
+
await postSlackText(replyTargetOf(msg), signForThisMac(text6), opts);
|
|
15666
15746
|
}
|
|
15667
15747
|
function startSlackTurnProgress(msg, threadId, opts) {
|
|
15668
15748
|
const log = opts.onLog ?? (() => void 0);
|
|
@@ -15745,10 +15825,10 @@ function startSlackTurnProgress(msg, threadId, opts) {
|
|
|
15745
15825
|
}
|
|
15746
15826
|
});
|
|
15747
15827
|
},
|
|
15748
|
-
finishWith: (
|
|
15828
|
+
finishWith: (text6) => {
|
|
15749
15829
|
stop();
|
|
15750
15830
|
return run2(async () => {
|
|
15751
|
-
const signed2 = signForThisMac(
|
|
15831
|
+
const signed2 = signForThisMac(text6.trim());
|
|
15752
15832
|
if (!signed2) {
|
|
15753
15833
|
if (!postedTs) return;
|
|
15754
15834
|
const ts = postedTs;
|
|
@@ -15776,11 +15856,11 @@ function startSlackTurnProgress(msg, threadId, opts) {
|
|
|
15776
15856
|
};
|
|
15777
15857
|
}
|
|
15778
15858
|
var lastRelayed = /* @__PURE__ */ new Map();
|
|
15779
|
-
function markRelayed(threadId,
|
|
15780
|
-
lastRelayed.set(threadId, `${threadId}:${
|
|
15859
|
+
function markRelayed(threadId, text6) {
|
|
15860
|
+
lastRelayed.set(threadId, `${threadId}:${text6}`);
|
|
15781
15861
|
}
|
|
15782
|
-
function alreadyRelayed(threadId,
|
|
15783
|
-
return lastRelayed.get(threadId) === `${threadId}:${
|
|
15862
|
+
function alreadyRelayed(threadId, text6) {
|
|
15863
|
+
return lastRelayed.get(threadId) === `${threadId}:${text6}`;
|
|
15784
15864
|
}
|
|
15785
15865
|
async function relayCoordinatorReplyToSlack(threadId, opts) {
|
|
15786
15866
|
const target = getSlackReplyTarget(threadId);
|
|
@@ -15791,14 +15871,14 @@ async function relayCoordinatorReplyToSlack(threadId, opts) {
|
|
|
15791
15871
|
return;
|
|
15792
15872
|
}
|
|
15793
15873
|
const result = getOrchestrator().getTurnResult(threadId);
|
|
15794
|
-
const
|
|
15795
|
-
if (!
|
|
15796
|
-
if (alreadyRelayed(threadId,
|
|
15797
|
-
markRelayed(threadId,
|
|
15874
|
+
const text6 = formatSlackTurnReply(result);
|
|
15875
|
+
if (!text6) return;
|
|
15876
|
+
if (alreadyRelayed(threadId, text6)) return;
|
|
15877
|
+
markRelayed(threadId, text6);
|
|
15798
15878
|
const log = opts.onLog ?? (() => void 0);
|
|
15799
15879
|
try {
|
|
15800
|
-
await postSlackText(target, signForThisMac(
|
|
15801
|
-
log(`replied ${target.threadTs ?? target.channelId} (${
|
|
15880
|
+
await postSlackText(target, signForThisMac(text6), opts);
|
|
15881
|
+
log(`replied ${target.threadTs ?? target.channelId} (${text6.length} chars)`);
|
|
15802
15882
|
} catch (err) {
|
|
15803
15883
|
lastRelayed.delete(threadId);
|
|
15804
15884
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -16243,8 +16323,8 @@ ${input.permalink}` : "";
|
|
|
16243
16323
|
|
|
16244
16324
|
${body}${link}`;
|
|
16245
16325
|
}
|
|
16246
|
-
function isSlackExternalReplyPrompt(
|
|
16247
|
-
return isSlackExternalReplyText(
|
|
16326
|
+
function isSlackExternalReplyPrompt(text6) {
|
|
16327
|
+
return isSlackExternalReplyText(text6);
|
|
16248
16328
|
}
|
|
16249
16329
|
function pendingSlackExternalReplies(messages) {
|
|
16250
16330
|
return pendingInjectedNotices(messages, isSlackExternalReplyText);
|
|
@@ -16265,7 +16345,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
16265
16345
|
await continueOnReply(threadId, prompt);
|
|
16266
16346
|
return;
|
|
16267
16347
|
}
|
|
16268
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
16348
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-Y5PYSMR6.js");
|
|
16269
16349
|
await getOrchestrator2().send(threadId, prompt);
|
|
16270
16350
|
} catch {
|
|
16271
16351
|
}
|
|
@@ -16273,9 +16353,9 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
16273
16353
|
function listSlackOutboundWatches() {
|
|
16274
16354
|
return pruneWatches(readStore3());
|
|
16275
16355
|
}
|
|
16276
|
-
function formatOwnerSlackFyi(userName,
|
|
16356
|
+
function formatOwnerSlackFyi(userName, text6) {
|
|
16277
16357
|
const who = userName.trim() || "Someone";
|
|
16278
|
-
const body =
|
|
16358
|
+
const body = text6.trim() || "(no text)";
|
|
16279
16359
|
return `${who} replied in Slack:
|
|
16280
16360
|
${body}`;
|
|
16281
16361
|
}
|
|
@@ -16290,7 +16370,7 @@ async function relayExternalReply(opts) {
|
|
|
16290
16370
|
const thread = readThread(threadId);
|
|
16291
16371
|
if (!thread || thread.status === "archived") return "ignored";
|
|
16292
16372
|
try {
|
|
16293
|
-
const
|
|
16373
|
+
const text6 = formatSlackExternalReplyPrompt({
|
|
16294
16374
|
userName: opts.reply.userName,
|
|
16295
16375
|
kind: opts.watch.kind,
|
|
16296
16376
|
toLabel: opts.watch.toLabel,
|
|
@@ -16299,7 +16379,7 @@ async function relayExternalReply(opts) {
|
|
|
16299
16379
|
});
|
|
16300
16380
|
appendMessage(threadId, {
|
|
16301
16381
|
role: "agent",
|
|
16302
|
-
text:
|
|
16382
|
+
text: text6,
|
|
16303
16383
|
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
16304
16384
|
});
|
|
16305
16385
|
} catch {
|