github-router 0.3.269 → 0.3.270
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/{attribution-settings-B1txv_Lk.js → attribution-settings-of5gJM5a.js} +3 -3
- package/dist/{attribution-settings-B1txv_Lk.js.map → attribution-settings-of5gJM5a.js.map} +1 -1
- package/dist/{auth-r-my7efo.js → auth-DIFbHOu0.js} +2 -2
- package/dist/{auth-r-my7efo.js.map → auth-DIFbHOu0.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-CZr2ZkG0.js → check-usage-DfnrR-d_.js} +3 -3
- package/dist/{check-usage-CZr2ZkG0.js.map → check-usage-DfnrR-d_.js.map} +1 -1
- package/dist/{claude-BjNY0J6e.js → claude-BlzCUbVq.js} +7 -7
- package/dist/{claude-BjNY0J6e.js.map → claude-BlzCUbVq.js.map} +1 -1
- package/dist/{codex-CoRWpkHL.js → codex-BaFcXOyg.js} +5 -5
- package/dist/{codex-CoRWpkHL.js.map → codex-BaFcXOyg.js.map} +1 -1
- package/dist/engine-mwIgHJoi.js +2 -0
- package/dist/{gate-discovery-D-7oua8b.js → gate-discovery-AUAjqSpV.js} +2 -2
- package/dist/{gate-discovery-D-7oua8b.js.map → gate-discovery-AUAjqSpV.js.map} +1 -1
- package/dist/{get-copilot-usage-CFEpeA7E.js → get-copilot-usage-Ds09xSmH.js} +2 -2
- package/dist/{get-copilot-usage-CFEpeA7E.js.map → get-copilot-usage-Ds09xSmH.js.map} +1 -1
- package/dist/{internal-stop-hook-Db5o9RcZ.js → internal-stop-hook-B1MIwmTR.js} +2 -2
- package/dist/{internal-stop-hook-Db5o9RcZ.js.map → internal-stop-hook-B1MIwmTR.js.map} +1 -1
- package/dist/main.js +8 -8
- package/dist/{models-CJLt4XjP.js → models-BFQUp0ov.js} +2 -2
- package/dist/{models-CJLt4XjP.js.map → models-BFQUp0ov.js.map} +1 -1
- package/dist/{peer-mcp-personas-DSbBlgFt.js → peer-mcp-personas-pWP3Eyt7.js} +152 -84
- package/dist/{peer-mcp-personas-DSbBlgFt.js.map → peer-mcp-personas-pWP3Eyt7.js.map} +1 -1
- package/dist/{provision-CA-xwnFu.js → provision-CsYUVdMT.js} +2 -2
- package/dist/{provision-CA-xwnFu.js.map → provision-CsYUVdMT.js.map} +1 -1
- package/dist/{serve-DHny4ewF.js → serve--c9n9hk4.js} +6 -6
- package/dist/{serve-DHny4ewF.js.map → serve--c9n9hk4.js.map} +1 -1
- package/dist/{server-setup-Dd293T1O.js → server-setup-BmyWS4WU.js} +393 -99
- package/dist/server-setup-BmyWS4WU.js.map +1 -0
- package/dist/{start-P2rmHBkL.js → start-CXnLBouJ.js} +3 -3
- package/dist/{start-P2rmHBkL.js.map → start-CXnLBouJ.js.map} +1 -1
- package/dist/{token-C_q95GF7.js → token-iaSGp76k.js} +303 -143
- package/dist/token-iaSGp76k.js.map +1 -0
- package/package.json +1 -1
- package/dist/engine-DpVC7HRL.js +0 -2
- package/dist/server-setup-Dd293T1O.js.map +0 -1
- package/dist/token-C_q95GF7.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as getPackageVersion } from "./version-_Q1WpsQp.js";
|
|
2
2
|
import { t as PATHS } from "./paths-Bg1_DWhi.js";
|
|
3
|
-
import { C as
|
|
3
|
+
import { A as state, C as GITHUB_GRAPHQL_URL, D as githubAgentGraphQLHeaders, E as copilotVersion, O as githubAgentHeaders, S as GITHUB_API_BASE_URL, T as copilotHeaders, b as sanitizeTransportText, d as resolveModel, f as sleep$2, g as HTTPError, h as isAllowedCopilotHost, i as tryRefreshAndRetry, v as classifyTransportError, w as copilotBaseUrl, x as withTransientRetry, y as fetchWithTransientRetry } from "./token-iaSGp76k.js";
|
|
4
4
|
import { a as resolveExecutable, c as runManagedExeCapture, i as parseIntEnv, l as spawnTaskkillBestEffort, r as parseBoolEnv } from "./exec-y8C_MU8A.js";
|
|
5
5
|
import { i as registerExitHandlers$1, n as getInstanceUuid, r as recordWorkerRepo, t as WorktreeRegistry } from "./lifecycle-0XrazT05.js";
|
|
6
6
|
import { t as MCP_WORKSPACE_HEADER } from "./mcp-workspace-header-CGJbNeHb.js";
|
|
@@ -27263,10 +27263,8 @@ function relayAnthropicStream(body, opts) {
|
|
|
27263
27263
|
safeClose(controller);
|
|
27264
27264
|
return;
|
|
27265
27265
|
}
|
|
27266
|
-
const errName
|
|
27267
|
-
const
|
|
27268
|
-
consola.error(`Upstream stream interrupted at ${opts.routePath}: bytes=${bytesRelayed} errType=${errName} message=${JSON.stringify(errMessage)}`);
|
|
27269
|
-
const event = buildAnthropicErrorEvent(errName, errMessage);
|
|
27266
|
+
const { errName, errMessage, transport } = logStreamError(opts.routePath, error, bytesRelayed);
|
|
27267
|
+
const event = buildAnthropicErrorEvent(errName, errMessage, transport);
|
|
27270
27268
|
try {
|
|
27271
27269
|
controller.enqueue(ENCODER$1.encode(event));
|
|
27272
27270
|
} catch (enqueueError) {
|
|
@@ -27331,12 +27329,13 @@ async function readIteratorWithTimeout(iterator, timeoutMs) {
|
|
|
27331
27329
|
* event: error
|
|
27332
27330
|
* data: {"type":"error","error":{"type":"...","message":"..."}}
|
|
27333
27331
|
*/
|
|
27334
|
-
function buildAnthropicErrorEvent(errName, errMessage) {
|
|
27332
|
+
function buildAnthropicErrorEvent(errName, errMessage, transportDetails) {
|
|
27333
|
+
const details = transportDetails ?? classifyNamedStreamError(errName, errMessage);
|
|
27335
27334
|
const payload = {
|
|
27336
27335
|
type: "error",
|
|
27337
27336
|
error: {
|
|
27338
|
-
type: classifyStreamError(
|
|
27339
|
-
message:
|
|
27337
|
+
type: classifyStreamError(details),
|
|
27338
|
+
message: formatStreamErrorMessage(details)
|
|
27340
27339
|
}
|
|
27341
27340
|
};
|
|
27342
27341
|
return `event: error\ndata: ${JSON.stringify(payload)}\n\n`;
|
|
@@ -27346,24 +27345,42 @@ function buildAnthropicErrorEvent(errName, errMessage) {
|
|
|
27346
27345
|
* followed by the `data: [DONE]` terminator that OpenAI clients expect.
|
|
27347
27346
|
*/
|
|
27348
27347
|
function buildOpenAIErrorEvent(errName, errMessage) {
|
|
27348
|
+
const details = classifyNamedStreamError(errName, errMessage);
|
|
27349
27349
|
const payload = { error: {
|
|
27350
|
-
type: classifyStreamError(
|
|
27351
|
-
message:
|
|
27350
|
+
type: classifyStreamError(details),
|
|
27351
|
+
message: formatStreamErrorMessage(details)
|
|
27352
27352
|
} };
|
|
27353
27353
|
return `data: ${JSON.stringify(payload)}\n\ndata: [DONE]\n\n`;
|
|
27354
27354
|
}
|
|
27355
|
-
function
|
|
27356
|
-
|
|
27357
|
-
|
|
27355
|
+
function classifyNamedStreamError(errName, errMessage) {
|
|
27356
|
+
const error = Object.assign(new Error(errMessage), { name: errName });
|
|
27357
|
+
return classifyTransportError(error);
|
|
27358
|
+
}
|
|
27359
|
+
function classifyStreamError(details) {
|
|
27360
|
+
if (details.name === "AbortError" || details.name === "InactivityTimeout" || details.name === "TimeoutError" || details.name === "timeout_error") return "timeout_error";
|
|
27361
|
+
if (details.classification === "transient") return "overloaded_error";
|
|
27358
27362
|
return "api_error";
|
|
27359
27363
|
}
|
|
27360
|
-
function
|
|
27361
|
-
const
|
|
27362
|
-
const
|
|
27363
|
-
|
|
27364
|
+
function formatStreamErrorMessage(details) {
|
|
27365
|
+
const code = details.causeCode ?? details.code;
|
|
27366
|
+
const suffix = code ? ` (${sanitizeTransportText(code)})` : "";
|
|
27367
|
+
const diagnostic = `${sanitizeTransportText(details.name)}: ${sanitizeTransportText(details.message)}${suffix}`;
|
|
27368
|
+
if (details.classification === "transient") return `Upstream stream interrupted by a transient transport failure; retry the request. ${diagnostic}`;
|
|
27369
|
+
if (details.classification === "deterministic") return `Upstream stream interrupted by a connectivity or TLS configuration failure. ${diagnostic}`;
|
|
27370
|
+
return `Upstream stream interrupted: ${diagnostic}`;
|
|
27371
|
+
}
|
|
27372
|
+
function logStreamError(routePath, error, bytesRelayed) {
|
|
27373
|
+
const transport = classifyTransportError(error);
|
|
27374
|
+
const errName = transport.name;
|
|
27375
|
+
const errMessage = transport.message;
|
|
27376
|
+
const byteField = bytesRelayed === void 0 ? "" : ` bytes=${Math.max(0, bytesRelayed)}`;
|
|
27377
|
+
const codeField = transport.code ? ` code=${JSON.stringify(transport.code)}` : "";
|
|
27378
|
+
const causeCodeField = transport.causeCode ? ` causeCode=${JSON.stringify(transport.causeCode)}` : "";
|
|
27379
|
+
consola.error("Upstream stream interrupted", `routePath=${JSON.stringify(routePath)}${byteField} classification=${transport.classification} errType=${errName}${codeField}${causeCodeField} message=${JSON.stringify(errMessage)}`);
|
|
27364
27380
|
return {
|
|
27365
27381
|
errName,
|
|
27366
|
-
errMessage
|
|
27382
|
+
errMessage,
|
|
27383
|
+
transport
|
|
27367
27384
|
};
|
|
27368
27385
|
}
|
|
27369
27386
|
//#endregion
|
|
@@ -27715,10 +27732,11 @@ async function runAdvisor(conversation, advisorModel, advisorEffort, signal) {
|
|
|
27715
27732
|
* against edge cases that would otherwise emit a malformed block —
|
|
27716
27733
|
* spec violation in either direction is a 400.
|
|
27717
27734
|
*/
|
|
27718
|
-
function toClientServerToolUseId(id,
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
|
|
27735
|
+
function toClientServerToolUseId(id, _fallbackIndex) {
|
|
27736
|
+
if (!id.startsWith("toolu_")) throw new Error("advisor tool_use id is not round-trippable");
|
|
27737
|
+
const suffix = id.slice(6);
|
|
27738
|
+
if (!/^[a-zA-Z0-9_]+$/.test(suffix)) throw new Error("advisor tool_use id is not round-trippable");
|
|
27739
|
+
return `srvtoolu_${suffix}`;
|
|
27722
27740
|
}
|
|
27723
27741
|
/**
|
|
27724
27742
|
* Build an SSE event line in the canonical Anthropic shape:
|
|
@@ -27754,6 +27772,7 @@ function buildAdvisorStream(opts) {
|
|
|
27754
27772
|
let messageStartForwarded = false;
|
|
27755
27773
|
let nextSyntheticIndex = 0;
|
|
27756
27774
|
let turnsRun;
|
|
27775
|
+
let pendingMessageDelta = null;
|
|
27757
27776
|
const safeEnqueue = (bytes) => {
|
|
27758
27777
|
try {
|
|
27759
27778
|
controller.enqueue(bytes);
|
|
@@ -27767,9 +27786,42 @@ function buildAdvisorStream(opts) {
|
|
|
27767
27786
|
}
|
|
27768
27787
|
};
|
|
27769
27788
|
const safeEnqueueEvent = (type, data) => safeEnqueue(ENCODER.encode(sseEvent(type, data)));
|
|
27789
|
+
const captureMessageDelta = (payload) => {
|
|
27790
|
+
const delta = payload.delta && typeof payload.delta === "object" ? payload.delta : {};
|
|
27791
|
+
const usage = payload.usage && typeof payload.usage === "object" ? payload.usage : {};
|
|
27792
|
+
if (!pendingMessageDelta) pendingMessageDelta = {
|
|
27793
|
+
stopReason: delta.stop_reason ?? null,
|
|
27794
|
+
stopSequence: delta.stop_sequence ?? null,
|
|
27795
|
+
usage: {}
|
|
27796
|
+
};
|
|
27797
|
+
else {
|
|
27798
|
+
if (delta.stop_reason !== void 0) pendingMessageDelta.stopReason = delta.stop_reason;
|
|
27799
|
+
if (delta.stop_sequence !== void 0) pendingMessageDelta.stopSequence = delta.stop_sequence;
|
|
27800
|
+
}
|
|
27801
|
+
for (const [key, value] of Object.entries(usage)) if (typeof value === "number" && Number.isFinite(value)) pendingMessageDelta.usage[key] = (pendingMessageDelta.usage[key] ?? 0) + value;
|
|
27802
|
+
};
|
|
27803
|
+
const emitTerminal = (forcedStopReason) => {
|
|
27804
|
+
if (pendingMessageDelta || forcedStopReason) {
|
|
27805
|
+
const terminal = pendingMessageDelta ?? {
|
|
27806
|
+
stopReason: null,
|
|
27807
|
+
stopSequence: null,
|
|
27808
|
+
usage: {}
|
|
27809
|
+
};
|
|
27810
|
+
if (!safeEnqueueEvent("message_delta", {
|
|
27811
|
+
type: "message_delta",
|
|
27812
|
+
delta: {
|
|
27813
|
+
stop_reason: forcedStopReason ?? terminal.stopReason,
|
|
27814
|
+
stop_sequence: terminal.stopSequence
|
|
27815
|
+
},
|
|
27816
|
+
usage: terminal.usage
|
|
27817
|
+
})) return false;
|
|
27818
|
+
}
|
|
27819
|
+
return safeEnqueueEvent("message_stop", { type: "message_stop" });
|
|
27820
|
+
};
|
|
27770
27821
|
async function processOneTurn(response) {
|
|
27771
27822
|
const capturedBlocks = [];
|
|
27772
|
-
|
|
27823
|
+
const advisorToolUses = [];
|
|
27824
|
+
let clientToolUseCount = 0;
|
|
27773
27825
|
const indexToBlock = /* @__PURE__ */ new Map();
|
|
27774
27826
|
for await (const ev of events(response)) {
|
|
27775
27827
|
if (!ev.event || !ev.data) continue;
|
|
@@ -27779,7 +27831,8 @@ function buildAdvisorStream(opts) {
|
|
|
27779
27831
|
} catch {
|
|
27780
27832
|
if (!safeEnqueue(ENCODER.encode(`event: ${ev.event}\ndata: ${ev.data}\n\n`))) return {
|
|
27781
27833
|
capturedBlocks,
|
|
27782
|
-
|
|
27834
|
+
advisorToolUses,
|
|
27835
|
+
clientToolUseCount
|
|
27783
27836
|
};
|
|
27784
27837
|
continue;
|
|
27785
27838
|
}
|
|
@@ -27788,7 +27841,8 @@ function buildAdvisorStream(opts) {
|
|
|
27788
27841
|
if (!messageStartForwarded) {
|
|
27789
27842
|
if (!safeEnqueueEvent(ev.event, payload)) return {
|
|
27790
27843
|
capturedBlocks,
|
|
27791
|
-
|
|
27844
|
+
advisorToolUses,
|
|
27845
|
+
clientToolUseCount
|
|
27792
27846
|
};
|
|
27793
27847
|
messageStartForwarded = true;
|
|
27794
27848
|
}
|
|
@@ -27800,12 +27854,13 @@ function buildAdvisorStream(opts) {
|
|
|
27800
27854
|
const myIndex = nextSyntheticIndex++;
|
|
27801
27855
|
if (block.type === "tool_use" && block.name === "__anthropic_advisor") {
|
|
27802
27856
|
const id = typeof block.id === "string" ? block.id : `toolu_advisor_${myIndex}`;
|
|
27803
|
-
advisorToolUse = {
|
|
27857
|
+
const advisorToolUse = {
|
|
27804
27858
|
index: myIndex,
|
|
27805
27859
|
id,
|
|
27806
27860
|
clientId: toClientServerToolUseId(id, myIndex),
|
|
27807
27861
|
inputJson: ""
|
|
27808
27862
|
};
|
|
27863
|
+
advisorToolUses.push(advisorToolUse);
|
|
27809
27864
|
const translated = {
|
|
27810
27865
|
...payload,
|
|
27811
27866
|
index: myIndex,
|
|
@@ -27818,7 +27873,8 @@ function buildAdvisorStream(opts) {
|
|
|
27818
27873
|
};
|
|
27819
27874
|
if (!safeEnqueueEvent(ev.event, translated)) return {
|
|
27820
27875
|
capturedBlocks,
|
|
27821
|
-
|
|
27876
|
+
advisorToolUses,
|
|
27877
|
+
clientToolUseCount
|
|
27822
27878
|
};
|
|
27823
27879
|
const captured = {
|
|
27824
27880
|
block: {
|
|
@@ -27833,13 +27889,15 @@ function buildAdvisorStream(opts) {
|
|
|
27833
27889
|
capturedBlocks.push(captured);
|
|
27834
27890
|
indexToBlock.set(upstreamIndex, captured);
|
|
27835
27891
|
} else {
|
|
27892
|
+
if (block.type === "tool_use") clientToolUseCount++;
|
|
27836
27893
|
const reindexed = {
|
|
27837
27894
|
...payload,
|
|
27838
27895
|
index: myIndex
|
|
27839
27896
|
};
|
|
27840
27897
|
if (!safeEnqueueEvent(ev.event, reindexed)) return {
|
|
27841
27898
|
capturedBlocks,
|
|
27842
|
-
|
|
27899
|
+
advisorToolUses,
|
|
27900
|
+
clientToolUseCount
|
|
27843
27901
|
};
|
|
27844
27902
|
const captured = {
|
|
27845
27903
|
block: { ...block },
|
|
@@ -27862,7 +27920,8 @@ function buildAdvisorStream(opts) {
|
|
|
27862
27920
|
};
|
|
27863
27921
|
if (!safeEnqueueEvent(ev.event, reindexed)) return {
|
|
27864
27922
|
capturedBlocks,
|
|
27865
|
-
|
|
27923
|
+
advisorToolUses,
|
|
27924
|
+
clientToolUseCount
|
|
27866
27925
|
};
|
|
27867
27926
|
if (captured && delta) {
|
|
27868
27927
|
if (delta.type === "text_delta" && typeof delta.text === "string") captured.block.text = (captured.block.text ?? "") + delta.text;
|
|
@@ -27876,7 +27935,8 @@ function buildAdvisorStream(opts) {
|
|
|
27876
27935
|
}
|
|
27877
27936
|
} else if (!safeEnqueueEvent(ev.event, payload)) return {
|
|
27878
27937
|
capturedBlocks,
|
|
27879
|
-
|
|
27938
|
+
advisorToolUses,
|
|
27939
|
+
clientToolUseCount
|
|
27880
27940
|
};
|
|
27881
27941
|
continue;
|
|
27882
27942
|
}
|
|
@@ -27889,7 +27949,8 @@ function buildAdvisorStream(opts) {
|
|
|
27889
27949
|
};
|
|
27890
27950
|
if (!safeEnqueueEvent(ev.event, reindexed)) return {
|
|
27891
27951
|
capturedBlocks,
|
|
27892
|
-
|
|
27952
|
+
advisorToolUses,
|
|
27953
|
+
clientToolUseCount
|
|
27893
27954
|
};
|
|
27894
27955
|
if (captured) {
|
|
27895
27956
|
if (captured.block.type === "tool_use" && captured.partialJson.length > 0) try {
|
|
@@ -27898,38 +27959,28 @@ function buildAdvisorStream(opts) {
|
|
|
27898
27959
|
consola.warn(`advisor: malformed input_json_delta for tool_use id=${captured.block.id ?? "?"} name=${captured.block.name ?? "?"} partialJson.length=${captured.partialJson.length} parseError=${err instanceof Error ? err.message : String(err)}`);
|
|
27899
27960
|
captured.block.input = {};
|
|
27900
27961
|
}
|
|
27901
|
-
if (captured.block.type === "text" && (typeof captured.block.text !== "string" || captured.block.text.length === 0)) captured.dropFromReplay = true;
|
|
27902
27962
|
}
|
|
27903
27963
|
continue;
|
|
27904
27964
|
}
|
|
27905
27965
|
case "message_delta":
|
|
27906
|
-
|
|
27907
|
-
capturedBlocks,
|
|
27908
|
-
advisorToolUse
|
|
27909
|
-
};
|
|
27966
|
+
captureMessageDelta(payload);
|
|
27910
27967
|
continue;
|
|
27911
|
-
case "message_stop":
|
|
27912
|
-
|
|
27913
|
-
|
|
27914
|
-
|
|
27915
|
-
|
|
27916
|
-
if (!safeEnqueueEvent(ev.event, payload)) return {
|
|
27917
|
-
capturedBlocks,
|
|
27918
|
-
advisorToolUse
|
|
27919
|
-
};
|
|
27920
|
-
return {
|
|
27921
|
-
capturedBlocks,
|
|
27922
|
-
advisorToolUse
|
|
27923
|
-
};
|
|
27968
|
+
case "message_stop": return {
|
|
27969
|
+
capturedBlocks,
|
|
27970
|
+
advisorToolUses,
|
|
27971
|
+
clientToolUseCount
|
|
27972
|
+
};
|
|
27924
27973
|
default: if (!safeEnqueueEvent(ev.event, payload)) return {
|
|
27925
27974
|
capturedBlocks,
|
|
27926
|
-
|
|
27975
|
+
advisorToolUses,
|
|
27976
|
+
clientToolUseCount
|
|
27927
27977
|
};
|
|
27928
27978
|
}
|
|
27929
27979
|
}
|
|
27930
27980
|
return {
|
|
27931
27981
|
capturedBlocks,
|
|
27932
|
-
|
|
27982
|
+
advisorToolUses,
|
|
27983
|
+
clientToolUseCount
|
|
27933
27984
|
};
|
|
27934
27985
|
}
|
|
27935
27986
|
try {
|
|
@@ -27937,13 +27988,16 @@ function buildAdvisorStream(opts) {
|
|
|
27937
27988
|
for (turnsRun = 0; turnsRun < 16; turnsRun++) {
|
|
27938
27989
|
if (aborter.signal.aborted) return;
|
|
27939
27990
|
if (conversation === null) return;
|
|
27940
|
-
const { capturedBlocks,
|
|
27941
|
-
if (
|
|
27991
|
+
const { capturedBlocks, advisorToolUses, clientToolUseCount } = await processOneTurn(response);
|
|
27992
|
+
if (advisorToolUses.length === 0) {
|
|
27993
|
+
emitTerminal();
|
|
27994
|
+
return;
|
|
27995
|
+
}
|
|
27942
27996
|
if (aborter.signal.aborted) return;
|
|
27943
27997
|
if (conversation === null) return;
|
|
27944
27998
|
const assistantTurn = {
|
|
27945
27999
|
role: "assistant",
|
|
27946
|
-
content: capturedBlocks.
|
|
28000
|
+
content: capturedBlocks.map((c) => {
|
|
27947
28001
|
if (c.advisorReplay) {
|
|
27948
28002
|
const input = typeof c.block.input === "object" && c.block.input !== null ? c.block.input : {};
|
|
27949
28003
|
return {
|
|
@@ -27957,41 +28011,55 @@ function buildAdvisorStream(opts) {
|
|
|
27957
28011
|
})
|
|
27958
28012
|
};
|
|
27959
28013
|
conversation.push(assistantTurn);
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
|
|
27967
|
-
|
|
27968
|
-
|
|
28014
|
+
const advisorConversation = conversation;
|
|
28015
|
+
const advisorTexts = await Promise.all(advisorToolUses.map(async () => {
|
|
28016
|
+
try {
|
|
28017
|
+
return await runAdvisor(advisorConversation, advisorModel, advisorEffort, aborter.signal);
|
|
28018
|
+
} catch (err) {
|
|
28019
|
+
if (aborter.signal.aborted) throw err;
|
|
28020
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
28021
|
+
consola.warn(`Advisor model call failed: ${msg}`);
|
|
28022
|
+
return `[Advisor unavailable: ${msg}. Continuing without external review — proceed with caution and consider self-checking against your primary-source evidence.]`;
|
|
28023
|
+
}
|
|
28024
|
+
})).catch((err) => {
|
|
28025
|
+
if (aborter.signal.aborted) return null;
|
|
28026
|
+
throw err;
|
|
28027
|
+
});
|
|
28028
|
+
if (!advisorTexts) return;
|
|
27969
28029
|
if (aborter.signal.aborted) return;
|
|
27970
28030
|
if (conversation === null) return;
|
|
27971
|
-
|
|
27972
|
-
|
|
27973
|
-
|
|
27974
|
-
|
|
27975
|
-
|
|
27976
|
-
type: "
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
type: "
|
|
27980
|
-
|
|
28031
|
+
for (let index = 0; index < advisorToolUses.length; index++) {
|
|
28032
|
+
const advisorToolUse = advisorToolUses[index];
|
|
28033
|
+
const advisorText = advisorTexts[index];
|
|
28034
|
+
const resultIndex = nextSyntheticIndex++;
|
|
28035
|
+
if (!safeEnqueueEvent("content_block_start", {
|
|
28036
|
+
type: "content_block_start",
|
|
28037
|
+
index: resultIndex,
|
|
28038
|
+
content_block: {
|
|
28039
|
+
type: "advisor_tool_result",
|
|
28040
|
+
tool_use_id: advisorToolUse.clientId,
|
|
28041
|
+
content: {
|
|
28042
|
+
type: "advisor_result",
|
|
28043
|
+
text: advisorText
|
|
28044
|
+
}
|
|
27981
28045
|
}
|
|
27982
|
-
}
|
|
27983
|
-
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
27987
|
-
}
|
|
28046
|
+
})) return;
|
|
28047
|
+
if (!safeEnqueueEvent("content_block_stop", {
|
|
28048
|
+
type: "content_block_stop",
|
|
28049
|
+
index: resultIndex
|
|
28050
|
+
})) return;
|
|
28051
|
+
}
|
|
28052
|
+
if (clientToolUseCount > 0) {
|
|
28053
|
+
emitTerminal("tool_use");
|
|
28054
|
+
return;
|
|
28055
|
+
}
|
|
27988
28056
|
conversation.push({
|
|
27989
28057
|
role: "user",
|
|
27990
|
-
content:
|
|
28058
|
+
content: advisorToolUses.map((advisorToolUse, index) => ({
|
|
27991
28059
|
type: "tool_result",
|
|
27992
28060
|
tool_use_id: advisorToolUse.id,
|
|
27993
|
-
content:
|
|
27994
|
-
}
|
|
28061
|
+
content: advisorTexts[index]
|
|
28062
|
+
}))
|
|
27995
28063
|
});
|
|
27996
28064
|
if (aborter.signal.aborted) return;
|
|
27997
28065
|
response = await createMessages(JSON.stringify({
|
|
@@ -28022,7 +28090,7 @@ function buildAdvisorStream(opts) {
|
|
|
28022
28090
|
type: "content_block_stop",
|
|
28023
28091
|
index: finalIndex
|
|
28024
28092
|
});
|
|
28025
|
-
|
|
28093
|
+
emitTerminal("end_turn");
|
|
28026
28094
|
} catch (err) {
|
|
28027
28095
|
if (aborter.signal.aborted) return;
|
|
28028
28096
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -34219,4 +34287,4 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
|
|
|
34219
34287
|
//#endregion
|
|
34220
34288
|
export { reviewerModel as $, searchWeb as A, DEFAULT_CODEX_MODEL_FALLBACKS as At, readIteratorWithTimeout as B, buildToolbeltAwareness as C, CONDENSED_OPERATING_SEQUENCE as Ct, TOOLBELT_TOOLS$1 as D, toolbeltPathOverride as Dt, vscodeRipgrepPath as E, collapsePathKeys as Et, isAdvisorRequested as F, pickClaudeDefault as Ft, artifactToolsEnabled as G, handleMcpDelete as H, buildAnthropicErrorEvent as I, withOneMSuffix as It, browserCompoundToolsEnabled as J, brainstormModel as K, buildOpenAIErrorEvent as L, withInstallLock as Lt, ADVISOR_TOOL_INSTRUCTIONS as M, UPSTREAM_FETCH_TIMEOUT_MS as Mt, buildAdvisorStream as N, UPSTREAM_INACTIVITY_TIMEOUT_MS as Nt, assetFor as O, DEFAULT_CLAUDE_MODEL_FALLBACKS as Ot, injectAdvisorTool as P, generateRandomPort as Pt, nativeSubagentModel as Q, isControllerClosedError as R, availableToolCommands as S, warmTreeSitterPool as St, toolbeltSkipSet as T, shouldUseInsecureTls as Tt, handleMcpPost as U, relayAnthropicStream as V, agentToolsEnabled as W, fleetToolsEnabled as X, browserToolsEnabled as Y, geminiAvailable as Z, appendPlanReminder as _, hasSupportedBrowserInstalled as _t, buildPeerAwarenessSnippet as a, countTokens as at, runWorkerAgent as b, extractTarGzMember as bt, personasFor as c, assembleResponsesPayload as ct, EXPLORE_DEFAULT_MODEL as d, createResponses as dt, scoutModel as et, EXPLORE_DEFAULT_THINKING as f, createChatCompletions as ft, TEST_DEFAULT_MODEL as g, provisionBrowserAssets as gt, REVIEW_DEFAULT_MODEL as h, parseJsonOrDiagnose as ht, buildAgentPrompt as i, shimDefaultsToXhigh as it, ADVISOR_INTERNAL_TOOL_NAME as j, DEFAULT_PORT as jt, satisfiesMinVersion as k, DEFAULT_CODEX_MODEL as kt, BROWSE_DEFAULT_MODEL as l, resolveMcpToolTimeoutMs as lt, PLAN_DEFAULT_MODEL as m, readResponseBodyCapped as mt, MCP_GROUPS as n, standInToolEnabled as nt, buildPeerAwarenessSummary as o, createMessages as ot, IMPLEMENT_DEFAULT_MODEL as p, MAX_RESPONSE_BODY_BYTES as pt, browseAgentEnabled as q, assertMcpToolSurfaceConsistent as r, workerToolsEnabled as rt, enumerateInjectedMcpToolNames as s, getTokenCount as st, GROUP_META as t, scribeModel as tt, DEFAULT_MODEL as u, pickEndpoint as ut, resolveModeDefaults as v, colbertDegradedWarning as vt, toolbeltEnabled as w, DEFINITION_OF_GREATNESS as wt, buildEnv as x, extractZipMember as xt, resolveWorkerRunOpts as y, provisionAndIndexColbert as yt, logStreamError as z };
|
|
34221
34289
|
|
|
34222
|
-
//# sourceMappingURL=peer-mcp-personas-
|
|
34290
|
+
//# sourceMappingURL=peer-mcp-personas-pWP3Eyt7.js.map
|