@sideboard-ai/core 0.1.203 → 0.1.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-JFGZBDHH.js → abletime-S3UHQZVW.js} +3 -3
- package/dist/{abletime-SISJEPJ3.js → abletime-TONBQP4O.js} +3 -3
- package/dist/{abletime-oauth-7TD5Z2QV.js → abletime-oauth-AVCEO2DY.js} +54 -5
- package/dist/{abletime-oauth-OSQYFB3E.js → abletime-oauth-SD4SZY5U.js} +14 -2
- package/dist/{abletime-rest-QPJTDLKX.js → abletime-rest-6ODSXV7G.js} +2 -2
- package/dist/{abletime-rest-ZJGWYALM.js → abletime-rest-J2OBB4VA.js} +2 -2
- package/dist/agents/cursor-runner.js +1 -1
- package/dist/{agents-ZMWL43SP.js → agents-67K4BQFJ.js} +3 -3
- package/dist/{agents-3755WYQM.js → agents-BVOJNHV6.js} +4 -4
- package/dist/{chunk-6VEIKW5C.js → chunk-3K257PCS.js} +6 -3
- package/dist/{chunk-LCU6GBZP.js → chunk-5SMS6QTO.js} +1 -1
- package/dist/{chunk-MHPINQKY.js → chunk-6Q7DFVDQ.js} +54 -5
- package/dist/{chunk-3PYH2RLA.js → chunk-CYLDJWRK.js} +6 -3
- package/dist/{chunk-FZ6IBUKY.js → chunk-FO2NTJ7L.js} +3 -3
- package/dist/{chunk-2DVCCLII.js → chunk-FO45DMJ5.js} +60 -60
- package/dist/{chunk-CQ5R3VPP.js → chunk-KZ7PI7FE.js} +18 -0
- package/dist/{chunk-FZYYEMET.js → chunk-QAVWH2RQ.js} +3 -3
- package/dist/{chunk-QSEF2YVQ.js → chunk-QUW5D62C.js} +33 -19
- package/dist/{chunk-PJHFNFXA.js → chunk-SGUVAK66.js} +27 -8
- package/dist/{chunk-TZNJKZ2A.js → chunk-ULZLWQBS.js} +58 -58
- package/dist/{chunk-TNDUTGDV.js → chunk-VIPA75ZA.js} +1 -1
- package/dist/{chunk-BFEBFGCS.js → chunk-W6VM36YO.js} +30 -8
- package/dist/{chunk-X2TFUFIS.js → chunk-WF33LOP4.js} +43 -5
- package/dist/{chunk-CMGRV36E.js → chunk-WVATAIF4.js} +33 -19
- package/dist/{chunk-5IXJTUST.js → chunk-YOSTWSNC.js} +26 -6
- package/dist/{coordinator-prompt-U4PEZDAW.js → coordinator-prompt-NPT555BO.js} +2 -2
- package/dist/{coordinator-prompt-2B2JA2IE.js → coordinator-prompt-WEPXXLLX.js} +2 -2
- package/dist/{global-workspace-JPJ3FKKY.js → global-workspace-2I2T7FL5.js} +2 -2
- package/dist/{global-workspace-PU7ZS3LS.js → global-workspace-NSILADOM.js} +2 -2
- package/dist/index.cjs +237 -83
- package/dist/index.d.cts +33 -11
- package/dist/index.d.ts +33 -11
- package/dist/index.js +39 -9
- package/dist/mcp/run-stdio.cjs +192 -78
- package/dist/mcp/run-stdio.js +7 -7
- package/dist/{orchestrator-3A6KUTNI.js → orchestrator-CMAVNELS.js} +5 -5
- package/dist/{orchestrator-Q33M24ZJ.js → orchestrator-I7GFXLHF.js} +4 -4
- package/dist/{workspaces-IMG7ZRUQ.js → workspaces-BOC6M7BW.js} +2 -2
- package/dist/{workspaces-U6P6DB44.js → workspaces-RFGZBUAR.js} +2 -2
- package/dist/{worktree-JSCDJPBU.js → worktree-G3ZLM4DC.js} +3 -1
- package/dist/{worktree-FL3UIUKQ.js → worktree-WSUQMMK4.js} +3 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
stripBrightsyNdjsonNoise,
|
|
27
27
|
sumUsageList,
|
|
28
28
|
toolDescription
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-YOSTWSNC.js";
|
|
30
30
|
import {
|
|
31
31
|
SLACK_REPLY_FORMATTING,
|
|
32
32
|
addWorkspace,
|
|
@@ -49,13 +49,14 @@ import {
|
|
|
49
49
|
stageAbsolutePathsAsAttachments,
|
|
50
50
|
stageBuffersAsAttachments,
|
|
51
51
|
syncWorkspacesFromThreads
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-VIPA75ZA.js";
|
|
53
53
|
import {
|
|
54
54
|
addPrStackLayer,
|
|
55
55
|
allocateTeamName,
|
|
56
56
|
allocateTeamSlug,
|
|
57
57
|
canonicalizeRepoPath,
|
|
58
58
|
commitAll,
|
|
59
|
+
connectedPrSelectors,
|
|
59
60
|
createExistingBranchWorktree,
|
|
60
61
|
createOrUpdatePr,
|
|
61
62
|
createThreadWorktree,
|
|
@@ -90,7 +91,6 @@ import {
|
|
|
90
91
|
resolveDiffBaseRef,
|
|
91
92
|
resolveGithubRepoSlug,
|
|
92
93
|
resolvePrSelector,
|
|
93
|
-
resolvePrSelectors,
|
|
94
94
|
resolveRepoRoot,
|
|
95
95
|
takenSlugsFromThread,
|
|
96
96
|
threadDisplayLabel,
|
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
worktreeDisplayLabelForGroup,
|
|
100
100
|
worktreeNameFromPath,
|
|
101
101
|
worktreeSlugForTicket
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-WVATAIF4.js";
|
|
103
103
|
import {
|
|
104
104
|
ATTACHMENTS_DIR,
|
|
105
105
|
DETACHED_JOBS_DIR,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
shouldRetryFailedAgentTurn,
|
|
131
131
|
summarizeTurnStderr,
|
|
132
132
|
turnFailChatText
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-KZ7PI7FE.js";
|
|
134
134
|
import {
|
|
135
135
|
assertOrchestratorCapableAgent,
|
|
136
136
|
childEnvWithAppSettings,
|
|
@@ -474,7 +474,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
474
474
|
await continueOnReply(threadId, prompt);
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
477
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-CMAVNELS.js");
|
|
478
478
|
await getOrchestrator2().send(threadId, prompt);
|
|
479
479
|
} catch {
|
|
480
480
|
}
|
|
@@ -808,9 +808,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
808
808
|
`Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
|
|
809
809
|
);
|
|
810
810
|
}
|
|
811
|
-
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-
|
|
811
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-NSILADOM.js");
|
|
812
812
|
if (isGlobalThread2(thread)) {
|
|
813
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
813
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-WEPXXLLX.js");
|
|
814
814
|
ensureGlobalCoordinatorCwd2(
|
|
815
815
|
isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
|
|
816
816
|
);
|
|
@@ -1018,6 +1018,33 @@ var FIX_CI_RE = /^Fix CI: .+\.$/;
|
|
|
1018
1018
|
function normalizePrState(state) {
|
|
1019
1019
|
return (state ?? "").trim().toUpperCase();
|
|
1020
1020
|
}
|
|
1021
|
+
function sameLoginList(a, b) {
|
|
1022
|
+
const left = [...a ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
|
|
1023
|
+
const right = [...b ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
|
|
1024
|
+
return left.length === right.length && left.every((login, i) => login === right[i]);
|
|
1025
|
+
}
|
|
1026
|
+
function threadPrMetaPatch(thread, meta) {
|
|
1027
|
+
const prevState = normalizePrState(thread.prState);
|
|
1028
|
+
const nextState = normalizePrState(meta.state);
|
|
1029
|
+
const patch = {};
|
|
1030
|
+
if (meta.url && meta.url !== thread.prUrl) patch.prUrl = meta.url;
|
|
1031
|
+
if (meta.title && meta.title !== thread.prTitle) patch.prTitle = meta.title;
|
|
1032
|
+
if (nextState && nextState !== prevState) patch.prState = nextState;
|
|
1033
|
+
const nextDraft = Boolean(meta.isDraft) && nextState !== "MERGED" && nextState !== "CLOSED";
|
|
1034
|
+
if (nextDraft !== Boolean(thread.prIsDraft)) patch.prIsDraft = nextDraft;
|
|
1035
|
+
const nextAuthor = meta.authorLogin?.trim() || "";
|
|
1036
|
+
if (nextAuthor && nextAuthor !== (thread.prAuthorLogin ?? "").trim()) {
|
|
1037
|
+
patch.prAuthorLogin = nextAuthor;
|
|
1038
|
+
}
|
|
1039
|
+
const nextReviewers = meta.reviewerLogins ?? [];
|
|
1040
|
+
if (!sameLoginList(nextReviewers, thread.prReviewerLogins)) {
|
|
1041
|
+
patch.prReviewerLogins = nextReviewers;
|
|
1042
|
+
}
|
|
1043
|
+
if (thread.skipAutoArchiveOnMerge && nextState && nextState !== "MERGED" && nextState !== "CLOSED") {
|
|
1044
|
+
patch.skipAutoArchiveOnMerge = false;
|
|
1045
|
+
}
|
|
1046
|
+
return patch;
|
|
1047
|
+
}
|
|
1021
1048
|
function shouldAutoArchiveOnPrMerge(opts) {
|
|
1022
1049
|
if (!opts.autoArchiveEnabled) return false;
|
|
1023
1050
|
if (opts.isGlobal) return false;
|
|
@@ -3819,7 +3846,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3819
3846
|
let sourceIsFork = false;
|
|
3820
3847
|
if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
|
|
3821
3848
|
if (isAbleTimeConnected() && getIssueSource() === "abletime") {
|
|
3822
|
-
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-
|
|
3849
|
+
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-TONBQP4O.js");
|
|
3823
3850
|
const task = await ensureAbleTimeTask({
|
|
3824
3851
|
title: title?.trim() || "Untitled work",
|
|
3825
3852
|
description: input.prompt?.trim() || void 0
|
|
@@ -3921,7 +3948,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3921
3948
|
return readThread(thread.id) ?? thread;
|
|
3922
3949
|
}
|
|
3923
3950
|
async function listLinearIssues(agent, repoPath) {
|
|
3924
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
3951
|
+
const { getAdapter: getAdapter2 } = await import("./agents-BVOJNHV6.js");
|
|
3925
3952
|
await requireAgent(agent, { requireLinear: true });
|
|
3926
3953
|
const adapter = getAdapter2(agent);
|
|
3927
3954
|
if (!adapter.listLinearIssues) {
|
|
@@ -4367,7 +4394,7 @@ async function adoptThread(input) {
|
|
|
4367
4394
|
messages: input.messages ?? []
|
|
4368
4395
|
});
|
|
4369
4396
|
writeThread(thread);
|
|
4370
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
4397
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-BOC6M7BW.js");
|
|
4371
4398
|
await ensureWorkspace2(repoPath);
|
|
4372
4399
|
const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
|
|
4373
4400
|
await ensureWorktreeSideboardIgnored2(input.worktreePath);
|
|
@@ -6951,7 +6978,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6951
6978
|
${prompt}`;
|
|
6952
6979
|
}
|
|
6953
6980
|
async function defaultDeps() {
|
|
6954
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6981
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-CMAVNELS.js");
|
|
6955
6982
|
const orch = getOrchestrator2();
|
|
6956
6983
|
return {
|
|
6957
6984
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -7065,11 +7092,6 @@ function isPidAlive(pid) {
|
|
|
7065
7092
|
return false;
|
|
7066
7093
|
}
|
|
7067
7094
|
}
|
|
7068
|
-
function sameLoginList(a, b) {
|
|
7069
|
-
const left = [...a ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
|
|
7070
|
-
const right = [...b ?? []].map((s) => s.trim().toLowerCase()).filter(Boolean).sort();
|
|
7071
|
-
return left.length === right.length && left.every((login, i) => login === right[i]);
|
|
7072
|
-
}
|
|
7073
7095
|
async function waitForPidExit(pid, timeoutMs) {
|
|
7074
7096
|
const start = Date.now();
|
|
7075
7097
|
while (isPidAlive(pid)) {
|
|
@@ -8780,12 +8802,18 @@ var Orchestrator = class {
|
|
|
8780
8802
|
/** Resolve PR selectors and optionally persist `prUrl` when found. */
|
|
8781
8803
|
async withPrSelector(threadRef) {
|
|
8782
8804
|
const thread = this.requireThread(threadRef);
|
|
8783
|
-
const selectors = resolvePrSelectors(thread);
|
|
8784
8805
|
const cwd = thread.worktreePath;
|
|
8785
8806
|
if (!cwd?.trim()) {
|
|
8786
8807
|
throw new Error(`Thread ${threadRef} has no worktreePath`);
|
|
8787
8808
|
}
|
|
8788
|
-
|
|
8809
|
+
let headUrl = null;
|
|
8810
|
+
try {
|
|
8811
|
+
const head = await getPrForHeadBranch(cwd, thread.branchName);
|
|
8812
|
+
headUrl = head?.url?.trim() || null;
|
|
8813
|
+
} catch {
|
|
8814
|
+
headUrl = null;
|
|
8815
|
+
}
|
|
8816
|
+
return { thread, selectors: connectedPrSelectors(thread, headUrl), cwd };
|
|
8789
8817
|
}
|
|
8790
8818
|
async getPrChecks(threadRef) {
|
|
8791
8819
|
const { selectors, cwd } = await this.withPrSelector(threadRef);
|
|
@@ -8813,29 +8841,16 @@ var Orchestrator = class {
|
|
|
8813
8841
|
async persistPrMetaAndMaybeArchive(thread, meta) {
|
|
8814
8842
|
const prevState = normalizePrState(thread.prState);
|
|
8815
8843
|
const nextState = normalizePrState(meta.state);
|
|
8816
|
-
const
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
const nextAuthor = meta.authorLogin?.trim() || "";
|
|
8823
|
-
if (nextAuthor && nextAuthor !== (thread.prAuthorLogin ?? "").trim()) {
|
|
8824
|
-
patch.prAuthorLogin = nextAuthor;
|
|
8825
|
-
}
|
|
8826
|
-
const nextReviewers = meta.reviewerLogins ?? [];
|
|
8827
|
-
if (!sameLoginList(nextReviewers, thread.prReviewerLogins)) {
|
|
8828
|
-
patch.prReviewerLogins = nextReviewers;
|
|
8829
|
-
}
|
|
8830
|
-
if (thread.skipAutoArchiveOnMerge && nextState && nextState !== "MERGED" && nextState !== "CLOSED") {
|
|
8831
|
-
patch.skipAutoArchiveOnMerge = false;
|
|
8844
|
+
const siblings = threadsSharingWorktree(thread.worktreePath);
|
|
8845
|
+
const targets = siblings.length > 0 ? siblings : [thread];
|
|
8846
|
+
for (const t of targets) {
|
|
8847
|
+
const patch = threadPrMetaPatch(t, meta);
|
|
8848
|
+
if (Object.keys(patch).length === 0) continue;
|
|
8849
|
+
updateThread(t.id, patch);
|
|
8832
8850
|
}
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
if (!latest2.userSetTitle && meta.title && latest2.title !== meta.title) {
|
|
8837
|
-
updateThread(thread.id, { title: meta.title });
|
|
8838
|
-
}
|
|
8851
|
+
const titled = this.requireThread(thread.id);
|
|
8852
|
+
if (!titled.userSetTitle && meta.title && titled.title !== meta.title) {
|
|
8853
|
+
updateThread(thread.id, { title: meta.title });
|
|
8839
8854
|
}
|
|
8840
8855
|
const { autoArchiveOnMergeEnabled } = await import("./app-settings-YEPF46IJ.js");
|
|
8841
8856
|
const latest = this.requireThread(thread.id);
|
|
@@ -8849,22 +8864,7 @@ var Orchestrator = class {
|
|
|
8849
8864
|
})) {
|
|
8850
8865
|
return;
|
|
8851
8866
|
}
|
|
8852
|
-
const
|
|
8853
|
-
for (const t of siblings) {
|
|
8854
|
-
const sibPatch = { prState: "MERGED", prIsDraft: false };
|
|
8855
|
-
if (meta.url && meta.url !== t.prUrl) sibPatch.prUrl = meta.url;
|
|
8856
|
-
if (meta.title && meta.title !== t.prTitle) sibPatch.prTitle = meta.title;
|
|
8857
|
-
const sibAuthor = meta.authorLogin?.trim() || "";
|
|
8858
|
-
if (sibAuthor && sibAuthor !== (t.prAuthorLogin ?? "").trim()) {
|
|
8859
|
-
sibPatch.prAuthorLogin = sibAuthor;
|
|
8860
|
-
}
|
|
8861
|
-
const sibReviewers = meta.reviewerLogins ?? [];
|
|
8862
|
-
if (!sameLoginList(sibReviewers, t.prReviewerLogins)) {
|
|
8863
|
-
sibPatch.prReviewerLogins = sibReviewers;
|
|
8864
|
-
}
|
|
8865
|
-
if (Object.keys(sibPatch).length > 0) updateThread(t.id, sibPatch);
|
|
8866
|
-
}
|
|
8867
|
-
for (const t of siblings) {
|
|
8867
|
+
for (const t of threadsSharingWorktree(latest.worktreePath)) {
|
|
8868
8868
|
if (this.requireThread(t.id).status === "archived") continue;
|
|
8869
8869
|
await this.archive(t.id);
|
|
8870
8870
|
}
|
|
@@ -9129,7 +9129,7 @@ var Orchestrator = class {
|
|
|
9129
9129
|
this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
|
|
9130
9130
|
if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
|
|
9131
9131
|
try {
|
|
9132
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
9132
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-BOC6M7BW.js");
|
|
9133
9133
|
await ensureWorkspace2(thread.repoPath);
|
|
9134
9134
|
} catch {
|
|
9135
9135
|
}
|
|
@@ -9183,7 +9183,7 @@ var Orchestrator = class {
|
|
|
9183
9183
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
9184
9184
|
);
|
|
9185
9185
|
}
|
|
9186
|
-
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-
|
|
9186
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-G3ZLM4DC.js");
|
|
9187
9187
|
const slug = thread.worktreePath.split("/").pop();
|
|
9188
9188
|
const dest = thread.worktreePath;
|
|
9189
9189
|
await withRepoGitLock(thread.repoPath, async () => {
|
|
@@ -9293,7 +9293,7 @@ async function startOrchestration(opts) {
|
|
|
9293
9293
|
sourceRef: "default",
|
|
9294
9294
|
...createOpts
|
|
9295
9295
|
}).catch(async () => {
|
|
9296
|
-
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-
|
|
9296
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-G3ZLM4DC.js");
|
|
9297
9297
|
const repo = await resolveRepoRoot2(repoPath);
|
|
9298
9298
|
const def = await resolveDefaultBranch2(repo);
|
|
9299
9299
|
return orch.createThread({
|
|
@@ -264,6 +264,9 @@ function humanizeAgentFailDetail(detail) {
|
|
|
264
264
|
if (/\[resource_exhausted\]|resource_exhausted|findfileswithripgrep/.test(lower)) {
|
|
265
265
|
return "Cursor local file search failed (ripgrep / resource_exhausted). Wait a minute and retry; if it keeps happening, check Cursor usage.";
|
|
266
266
|
}
|
|
267
|
+
if (looksLikeCodexMcpError(raw)) {
|
|
268
|
+
return `${raw} \u2014 skip that vendor MCP and continue (PostHog: Settings \u2192 Connectors + HTTP API).`;
|
|
269
|
+
}
|
|
267
270
|
if (/invalid user api key|invalid api key|not logged in|not authenticated|unauthorized|authentication|please run.*login|codex login|claude auth|cursor api/.test(
|
|
268
271
|
lower
|
|
269
272
|
)) {
|
|
@@ -321,9 +324,24 @@ function turnFailChatText(opts) {
|
|
|
321
324
|
|
|
322
325
|
${fail}`;
|
|
323
326
|
}
|
|
327
|
+
function looksLikeCodexMcpError(text) {
|
|
328
|
+
const t = text.trim().toLowerCase();
|
|
329
|
+
if (!t) return false;
|
|
330
|
+
if (/authrequired|authorization required/.test(t) && /mcp|posthog|rmcp|connector|plugin/.test(t)) {
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
if (/\bposthog\b/.test(t) && /mcp|oauth|auth|unauthorized|401|plugin|app/.test(t)) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
if (/\brmcp\b/.test(t) && /fatal|quit|transport|error|died|kill|auth/.test(t)) {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
return /mcp[_ -]?(server|tool|error|transport|client)/.test(t) && /fail|error|timeout|disconnect|auth|unauthorized/.test(t);
|
|
340
|
+
}
|
|
324
341
|
function shouldFeedErrorBackToAgent(opts) {
|
|
325
342
|
const detail = opts.detail.trim();
|
|
326
343
|
const chat = (opts.assistantText ?? "").trim();
|
|
344
|
+
if (looksLikeCodexMcpError(detail)) return true;
|
|
327
345
|
if (looksLikeAgentFailureMessage(detail) || looksLikeAgentFailureMessage(chat)) {
|
|
328
346
|
return false;
|
|
329
347
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
textFromAbleTimeDoc
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CYLDJWRK.js";
|
|
4
4
|
import {
|
|
5
5
|
assertAbleTimeCredential,
|
|
6
6
|
callAbleTimeTool,
|
|
7
7
|
normalizeAbleTimeHost,
|
|
8
8
|
rewriteAbleTimeError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-W6VM36YO.js";
|
|
10
10
|
import {
|
|
11
11
|
isAbleTimeConnected,
|
|
12
12
|
saveAbleTimeConnection
|
|
@@ -178,7 +178,7 @@ function isOpenTask(task) {
|
|
|
178
178
|
async function getAbleTimeOrientation(opts) {
|
|
179
179
|
const raw = await callAbleTimeTool("orientation", {}, opts);
|
|
180
180
|
const record = asRecord(raw);
|
|
181
|
-
const viewerRec = firstRecord(record, ["viewer", "user", "actor", "me", "person"]) ?? record;
|
|
181
|
+
const viewerRec = firstRecord(record, ["viewer", "principal", "user", "actor", "me", "person"]) ?? record;
|
|
182
182
|
const viewer = {
|
|
183
183
|
id: firstString(viewerRec, ["id", "user_id"]) || void 0,
|
|
184
184
|
name: firstString(viewerRec, ["name", "display_name", "full_name"]) || firstString(record, ["name"]) || void 0
|
|
@@ -2117,26 +2117,21 @@ function resolvePrSelectors(thread) {
|
|
|
2117
2117
|
function resolvePrSelector(thread) {
|
|
2118
2118
|
return resolvePrSelectors(thread)[0] ?? null;
|
|
2119
2119
|
}
|
|
2120
|
+
function connectedPrSelectors(thread, currentHeadPrUrl) {
|
|
2121
|
+
const out = [];
|
|
2122
|
+
const push = (value) => {
|
|
2123
|
+
const v = value?.trim();
|
|
2124
|
+
if (!v || out.includes(v)) return;
|
|
2125
|
+
out.push(v);
|
|
2126
|
+
};
|
|
2127
|
+
push(currentHeadPrUrl);
|
|
2128
|
+
for (const selector of resolvePrSelectors(thread)) push(selector);
|
|
2129
|
+
return out;
|
|
2130
|
+
}
|
|
2120
2131
|
async function getPrForHeadBranch(repoPath, branch) {
|
|
2121
2132
|
const head = normalizeGitBranchName(branch);
|
|
2122
2133
|
if (!head || isDefaultishSourceRef(head)) return null;
|
|
2123
2134
|
const slug = await resolveGithubRepoSlug(repoPath);
|
|
2124
|
-
const viewArgs = [
|
|
2125
|
-
"pr",
|
|
2126
|
-
"view",
|
|
2127
|
-
head,
|
|
2128
|
-
"--json",
|
|
2129
|
-
"number,title,headRefName,url,isCrossRepository,author"
|
|
2130
|
-
];
|
|
2131
|
-
if (slug) viewArgs.push("--repo", slug);
|
|
2132
|
-
const viewed = await gh(viewArgs, repoPath, { reject: false });
|
|
2133
|
-
if (viewed.exitCode === 0 && viewed.stdout.trim()) {
|
|
2134
|
-
try {
|
|
2135
|
-
return JSON.parse(viewed.stdout);
|
|
2136
|
-
} catch {
|
|
2137
|
-
return null;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
2135
|
const listHead = slug ? ghHeadRef(slug, head) : head;
|
|
2141
2136
|
const listArgs = [
|
|
2142
2137
|
"pr",
|
|
@@ -2152,10 +2147,28 @@ async function getPrForHeadBranch(repoPath, branch) {
|
|
|
2152
2147
|
];
|
|
2153
2148
|
if (slug) listArgs.push("--repo", slug);
|
|
2154
2149
|
const listed = await gh(listArgs, repoPath, { reject: false });
|
|
2155
|
-
if (listed.exitCode
|
|
2150
|
+
if (listed.exitCode === 0 && listed.stdout.trim()) {
|
|
2151
|
+
try {
|
|
2152
|
+
const rows = JSON.parse(listed.stdout);
|
|
2153
|
+
if (rows[0]) return rows[0];
|
|
2154
|
+
} catch {
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
const viewArgs = [
|
|
2158
|
+
"pr",
|
|
2159
|
+
"view",
|
|
2160
|
+
head,
|
|
2161
|
+
"--json",
|
|
2162
|
+
"number,title,headRefName,url,isCrossRepository,author,state"
|
|
2163
|
+
];
|
|
2164
|
+
if (slug) viewArgs.push("--repo", slug);
|
|
2165
|
+
const viewed = await gh(viewArgs, repoPath, { reject: false });
|
|
2166
|
+
if (viewed.exitCode !== 0 || !viewed.stdout.trim()) return null;
|
|
2156
2167
|
try {
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2168
|
+
const info = JSON.parse(viewed.stdout);
|
|
2169
|
+
const state = (info.state ?? "OPEN").trim().toUpperCase();
|
|
2170
|
+
if (state !== "OPEN") return null;
|
|
2171
|
+
return info;
|
|
2159
2172
|
} catch {
|
|
2160
2173
|
return null;
|
|
2161
2174
|
}
|
|
@@ -3251,6 +3264,7 @@ export {
|
|
|
3251
3264
|
isDefaultishSourceRef,
|
|
3252
3265
|
resolvePrSelectors,
|
|
3253
3266
|
resolvePrSelector,
|
|
3267
|
+
connectedPrSelectors,
|
|
3254
3268
|
getPrForHeadBranch,
|
|
3255
3269
|
detectLocalMergeConflicts,
|
|
3256
3270
|
getPrChecks,
|
|
@@ -39,18 +39,33 @@ function abletimeMcpUrl(host, opts) {
|
|
|
39
39
|
}
|
|
40
40
|
var ABLETIME_PAT_PREFIX = "apt_";
|
|
41
41
|
var ABLETIME_ORG_KEY_PREFIX = "atk_";
|
|
42
|
+
var ABLETIME_OAUTH_TOKEN_PREFIX = "acn_";
|
|
42
43
|
var ORG_KEY_HINT = "AbleTime MCP needs a personal access token (apt_\u2026) from Edit Profile \u2192 API Access, not an organization API key (atk_\u2026) from Settings \u2192 Integrations \u2192 API Keys.";
|
|
43
|
-
var REJECTED_CREDENTIAL_HINT = "AbleTime rejected this credential (unknown, revoked, or expired).
|
|
44
|
+
var REJECTED_CREDENTIAL_HINT = "AbleTime rejected this credential (unknown, revoked, or expired). Reconnect via browser, or paste a personal access token (apt_\u2026) from Edit Profile \u2192 API Access. Organization API keys (atk_\u2026) use REST, not MCP.";
|
|
44
45
|
var REWRITE_APPLIED = /— Enable Agent access \(MCP\)|— AbleTime MCP needs a personal access token|— AbleTime plan does not include API access|— AbleTime rejected this credential/;
|
|
45
46
|
function normalizeAbleTimeCredential(raw) {
|
|
46
47
|
return raw.trim().replace(/^bearer\s+/i, "").trim();
|
|
47
48
|
}
|
|
48
49
|
function ableTimeCredentialKind(raw) {
|
|
49
|
-
const token = normalizeAbleTimeCredential(raw)
|
|
50
|
-
|
|
51
|
-
if (
|
|
50
|
+
const token = normalizeAbleTimeCredential(raw);
|
|
51
|
+
const lower = token.toLowerCase();
|
|
52
|
+
if (lower.startsWith(ABLETIME_PAT_PREFIX)) return "pat";
|
|
53
|
+
if (lower.startsWith(ABLETIME_ORG_KEY_PREFIX)) return "org";
|
|
54
|
+
if (lower.startsWith(ABLETIME_OAUTH_TOKEN_PREFIX) || token.startsWith("eyJ")) return "oauth";
|
|
52
55
|
return "unknown";
|
|
53
56
|
}
|
|
57
|
+
function ableTimeUsesRest(raw) {
|
|
58
|
+
const token = normalizeAbleTimeCredential(raw);
|
|
59
|
+
const kind = ableTimeCredentialKind(token);
|
|
60
|
+
if (kind === "org") return true;
|
|
61
|
+
if (kind === "oauth") return token.startsWith("eyJ");
|
|
62
|
+
return kind === "unknown";
|
|
63
|
+
}
|
|
64
|
+
function isAbleTimeRejectedCredential(message) {
|
|
65
|
+
return /INTEGRATION_KEY_INVALID|INTEGRATION_KEY_MISSING|INTEGRATION_PAT_REQUIRED|\b401\b/i.test(
|
|
66
|
+
message
|
|
67
|
+
);
|
|
68
|
+
}
|
|
54
69
|
function assertAbleTimeMcpCredential(raw) {
|
|
55
70
|
const token = normalizeAbleTimeCredential(raw);
|
|
56
71
|
if (!token) {
|
|
@@ -140,7 +155,7 @@ function textsFromUnknown(value) {
|
|
|
140
155
|
return "";
|
|
141
156
|
}
|
|
142
157
|
async function abletimeMcpRequest(method, params, opts) {
|
|
143
|
-
const rawToken = opts?.token ?? await import("./abletime-oauth-
|
|
158
|
+
const rawToken = opts?.token ?? await import("./abletime-oauth-AVCEO2DY.js").then((m) => m.ensureAbleTimeAccessToken());
|
|
144
159
|
if (!rawToken?.trim()) {
|
|
145
160
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
146
161
|
}
|
|
@@ -211,9 +226,9 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
211
226
|
if (!opts?.token && !isAbleTimeConnected()) {
|
|
212
227
|
throw new Error("AbleTime is not connected \u2014 paste a personal access token in Account settings");
|
|
213
228
|
}
|
|
214
|
-
const rawToken = opts?.token ?? await import("./abletime-oauth-
|
|
215
|
-
if (rawToken &&
|
|
216
|
-
const { callAbleTimeRestTool } = await import("./abletime-rest-
|
|
229
|
+
const rawToken = opts?.token ?? await import("./abletime-oauth-AVCEO2DY.js").then((m) => m.ensureAbleTimeAccessToken());
|
|
230
|
+
if (rawToken && ableTimeUsesRest(rawToken)) {
|
|
231
|
+
const { callAbleTimeRestTool } = await import("./abletime-rest-6ODSXV7G.js");
|
|
217
232
|
return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
|
|
218
233
|
}
|
|
219
234
|
const requestOpts = { ...opts, pm: opts?.pm ?? abletimeToolUsesPm(name) };
|
|
@@ -228,6 +243,10 @@ async function callAbleTimeTool(name, args = {}, opts) {
|
|
|
228
243
|
await initializeIfNeeded(requestOpts);
|
|
229
244
|
return await call();
|
|
230
245
|
}
|
|
246
|
+
if (rawToken && ableTimeUsesRest(rawToken) && isAbleTimeRejectedCredential(message)) {
|
|
247
|
+
const { callAbleTimeRestTool } = await import("./abletime-rest-6ODSXV7G.js");
|
|
248
|
+
return callAbleTimeRestTool(name, args, { ...opts, token: rawToken });
|
|
249
|
+
}
|
|
231
250
|
throw err instanceof Error ? new Error(rewriteAbleTimeError(err.message)) : err;
|
|
232
251
|
}
|
|
233
252
|
}
|