github-router 0.3.271 → 0.3.274
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-DLRQEKpU.js → attribution-settings-Cqh_A9yx.js} +3 -3
- package/dist/{attribution-settings-DLRQEKpU.js.map → attribution-settings-Cqh_A9yx.js.map} +1 -1
- package/dist/{auth-DIFbHOu0.js → auth-Q1tfmfCT.js} +2 -2
- package/dist/{auth-DIFbHOu0.js.map → auth-Q1tfmfCT.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-DfnrR-d_.js → check-usage-CHLz4tU_.js} +3 -3
- package/dist/{check-usage-DfnrR-d_.js.map → check-usage-CHLz4tU_.js.map} +1 -1
- package/dist/{claude-BpQVQE0T.js → claude-CqFkkQGo.js} +7 -7
- package/dist/{claude-BpQVQE0T.js.map → claude-CqFkkQGo.js.map} +1 -1
- package/dist/{codex-CGMiGJy1.js → codex-gGkDJHZJ.js} +5 -5
- package/dist/{codex-CGMiGJy1.js.map → codex-gGkDJHZJ.js.map} +1 -1
- package/dist/engine-BM2mIXsc.js +2 -0
- package/dist/{gate-discovery-BBA7cV1D.js → gate-discovery-e114xla0.js} +2 -2
- package/dist/{gate-discovery-BBA7cV1D.js.map → gate-discovery-e114xla0.js.map} +1 -1
- package/dist/{get-copilot-usage-Ds09xSmH.js → get-copilot-usage-BRN18uMJ.js} +2 -2
- package/dist/{get-copilot-usage-Ds09xSmH.js.map → get-copilot-usage-BRN18uMJ.js.map} +1 -1
- package/dist/{internal-stop-hook-CO2NDmGL.js → internal-stop-hook-BLPxEImO.js} +2 -2
- package/dist/{internal-stop-hook-CO2NDmGL.js.map → internal-stop-hook-BLPxEImO.js.map} +1 -1
- package/dist/main.js +8 -8
- package/dist/{models-BFQUp0ov.js → models-d0gkuYGy.js} +2 -2
- package/dist/{models-BFQUp0ov.js.map → models-d0gkuYGy.js.map} +1 -1
- package/dist/{peer-mcp-personas-CN8xaXcV.js → peer-mcp-personas-pzk1zcDa.js} +111 -8
- package/dist/peer-mcp-personas-pzk1zcDa.js.map +1 -0
- package/dist/{provision-CiPjSx7J.js → provision-BIUvGrMS.js} +2 -2
- package/dist/{provision-CiPjSx7J.js.map → provision-BIUvGrMS.js.map} +1 -1
- package/dist/{serve-CpTMr5D9.js → serve-BYbEyMoF.js} +6 -6
- package/dist/{serve-CpTMr5D9.js.map → serve-BYbEyMoF.js.map} +1 -1
- package/dist/{server-setup-B02Myghc.js → server-setup-CNKsKERG.js} +566 -8
- package/dist/server-setup-CNKsKERG.js.map +1 -0
- package/dist/{start-CIV9eXVb.js → start-Cy_fEtEw.js} +3 -3
- package/dist/{start-CIV9eXVb.js.map → start-Cy_fEtEw.js.map} +1 -1
- package/dist/{token-iaSGp76k.js → token-Bz6HoH2H.js} +438 -51
- package/dist/token-Bz6HoH2H.js.map +1 -0
- package/package.json +2 -1
- package/dist/engine-DUJyXWZn.js +0 -2
- package/dist/peer-mcp-personas-CN8xaXcV.js.map +0 -1
- package/dist/server-setup-B02Myghc.js.map +0 -1
- package/dist/token-iaSGp76k.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 { 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-
|
|
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-Bz6HoH2H.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";
|
|
@@ -272,6 +272,12 @@ function envInt$1(key, fallback) {
|
|
|
272
272
|
}
|
|
273
273
|
const UPSTREAM_FETCH_TIMEOUT_MS = envInt$1("UPSTREAM_FETCH_TIMEOUT_MS", 0);
|
|
274
274
|
const UPSTREAM_INACTIVITY_TIMEOUT_MS = envInt$1("UPSTREAM_INACTIVITY_TIMEOUT_MS", 3e5);
|
|
275
|
+
function upstreamAllowH2() {
|
|
276
|
+
return process.env.GH_ROUTER_UPSTREAM_ALLOW_H2 === "1";
|
|
277
|
+
}
|
|
278
|
+
function upstreamMaxConnections() {
|
|
279
|
+
return envInt$1("GH_ROUTER_UPSTREAM_MAX_CONNECTIONS", 256);
|
|
280
|
+
}
|
|
275
281
|
//#endregion
|
|
276
282
|
//#region src/lib/toolbelt/path-inject.ts
|
|
277
283
|
/**
|
|
@@ -27399,7 +27405,6 @@ function classifyNamedStreamError(errName, errMessage) {
|
|
|
27399
27405
|
}
|
|
27400
27406
|
function classifyStreamError(details) {
|
|
27401
27407
|
if (details.name === "AbortError" || details.name === "InactivityTimeout" || details.name === "TimeoutError" || details.name === "timeout_error") return "timeout_error";
|
|
27402
|
-
if (details.classification === "transient") return "overloaded_error";
|
|
27403
27408
|
return "api_error";
|
|
27404
27409
|
}
|
|
27405
27410
|
function formatStreamErrorMessage(details) {
|
|
@@ -27426,7 +27431,7 @@ function logStreamError(routePath, error, bytesRelayed) {
|
|
|
27426
27431
|
}
|
|
27427
27432
|
//#endregion
|
|
27428
27433
|
//#region src/lib/thinking-history-repair.ts
|
|
27429
|
-
const THINKING_INTEGRITY_ERROR_RES = [/messages\.(\d+)\.content
|
|
27434
|
+
const THINKING_INTEGRITY_ERROR_RES = [/messages\.(\d+)\.content\.(\d+):\s*`thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified/, /messages\.(\d+)\.content\.(\d+):\s*Invalid `signature` in `thinking` block/];
|
|
27430
27435
|
const MAX_REMEMBERED_REPAIRS = 1e3;
|
|
27431
27436
|
const OMITTED_THINKING_PLACEHOLDER = "[prior reasoning omitted]";
|
|
27432
27437
|
const repairSalt = randomBytes(32);
|
|
@@ -27467,7 +27472,7 @@ function signedBlockFingerprint(_messageIndex, content) {
|
|
|
27467
27472
|
}
|
|
27468
27473
|
return signedBlocks > 0 ? hash.digest("hex") : void 0;
|
|
27469
27474
|
}
|
|
27470
|
-
function
|
|
27475
|
+
function repairAtArrayIndex(parsed, messageIndex) {
|
|
27471
27476
|
if (!Array.isArray(parsed.messages)) return declined("no-messages-array", { messageIndex });
|
|
27472
27477
|
const messages = [...parsed.messages];
|
|
27473
27478
|
const detail = {
|
|
@@ -27514,6 +27519,102 @@ function repairMessageAt(parsed, messageIndex) {
|
|
|
27514
27519
|
}
|
|
27515
27520
|
};
|
|
27516
27521
|
}
|
|
27522
|
+
/** Roles in order, for a decline log. Roles only, so it carries no content. */
|
|
27523
|
+
function roleSequenceOf(messages) {
|
|
27524
|
+
return messages.map((message) => isRecord(message) && typeof message.role === "string" ? message.role : "unknown").join(",");
|
|
27525
|
+
}
|
|
27526
|
+
/** Elements upstream would not count as a conversation turn. */
|
|
27527
|
+
function isHoistedElement(message) {
|
|
27528
|
+
if (!isRecord(message)) return false;
|
|
27529
|
+
return message.role !== "user" && message.role !== "assistant";
|
|
27530
|
+
}
|
|
27531
|
+
/**
|
|
27532
|
+
* Translate an upstream-reported message index into an index in THIS array,
|
|
27533
|
+
* skipping elements upstream would not have counted.
|
|
27534
|
+
*
|
|
27535
|
+
* Anthropic's Messages schema has no in-array `system` role, yet clients do
|
|
27536
|
+
* send one, and upstream evidently accepts it and drops it before validating —
|
|
27537
|
+
* which shifts every index after it. Returns undefined when nothing is hoisted
|
|
27538
|
+
* (the mapping would be the identity) or when the target does not exist.
|
|
27539
|
+
*/
|
|
27540
|
+
function hoistAdjustedIndex(messages, reportedIndex) {
|
|
27541
|
+
let retained = 0;
|
|
27542
|
+
for (let index = 0; index < messages.length; index++) {
|
|
27543
|
+
if (isHoistedElement(messages[index])) continue;
|
|
27544
|
+
if (retained === reportedIndex) return index === reportedIndex ? void 0 : index;
|
|
27545
|
+
retained++;
|
|
27546
|
+
}
|
|
27547
|
+
}
|
|
27548
|
+
/** True when `content[contentIndex]` is a signed thinking block. */
|
|
27549
|
+
function hasSignedBlockAt(content, contentIndex) {
|
|
27550
|
+
if (!Array.isArray(content)) return false;
|
|
27551
|
+
const block = content[contentIndex];
|
|
27552
|
+
if (!isRecord(block)) return false;
|
|
27553
|
+
return block.type === "thinking" || block.type === "redacted_thinking";
|
|
27554
|
+
}
|
|
27555
|
+
/**
|
|
27556
|
+
* Resolve the message upstream named, then repair it.
|
|
27557
|
+
*
|
|
27558
|
+
* DIRECT INDEX FIRST, hoist-adjusted index only as a fallback. The ordering is
|
|
27559
|
+
* the whole safety argument: every request that repairs correctly today takes
|
|
27560
|
+
* the direct path untouched, and the adjusted path runs only where the code
|
|
27561
|
+
* would otherwise have declined outright. Mapping first would REGRESS a working
|
|
27562
|
+
* case — with `[user, system, assistant]` and upstream naming `messages.2`, the
|
|
27563
|
+
* direct lookup repairs the assistant turn correctly while a retained-role
|
|
27564
|
+
* mapping yields only `[user, assistant]` and runs off the end.
|
|
27565
|
+
*
|
|
27566
|
+
* The fallback is self-validating rather than trusted: it is accepted only if
|
|
27567
|
+
* the block upstream actually named is a signed thinking block at the adjusted
|
|
27568
|
+
* position. If the index shift has some other cause, that check fails and the
|
|
27569
|
+
* original decline stands, so a wrong hypothesis fails closed instead of
|
|
27570
|
+
* stripping blocks from an innocent turn.
|
|
27571
|
+
*/
|
|
27572
|
+
/** True when `index` names an assistant carrying the block upstream reported. */
|
|
27573
|
+
function namesReportedBlock(messages, index, contentIndex) {
|
|
27574
|
+
const message = messages[index];
|
|
27575
|
+
if (!isRecord(message) || message.role !== "assistant") return false;
|
|
27576
|
+
return hasSignedBlockAt(message.content, contentIndex);
|
|
27577
|
+
}
|
|
27578
|
+
/**
|
|
27579
|
+
* Resolve the message upstream named, then repair it.
|
|
27580
|
+
*
|
|
27581
|
+
* When nothing is hoisted, this array and upstream's are indexed alike, so the
|
|
27582
|
+
* reported index is used directly — the identity case, and the overwhelming
|
|
27583
|
+
* majority of traffic, whose behaviour is unchanged.
|
|
27584
|
+
*
|
|
27585
|
+
* When something IS hoisted, the two arrays provably disagree and the reported
|
|
27586
|
+
* index alone cannot say which turn was meant. Both the raw index and the
|
|
27587
|
+
* hoist-adjusted one can land on a signed assistant, and picking the raw one
|
|
27588
|
+
* blind would strip a healthy turn while leaving the corrupt one in place. So
|
|
27589
|
+
* the block index upstream reported is used as the tiebreak: whichever
|
|
27590
|
+
* candidate actually carries a signed block THERE is the one repaired. If both
|
|
27591
|
+
* do, the request is genuinely ambiguous and we decline — the client sees the
|
|
27592
|
+
* same 400 it would have seen anyway, with no innocent turn rewritten.
|
|
27593
|
+
*/
|
|
27594
|
+
function repairMessageAt(parsed, messageIndex, contentIndex) {
|
|
27595
|
+
if (!Array.isArray(parsed.messages)) return repairAtArrayIndex(parsed, messageIndex);
|
|
27596
|
+
const messages = parsed.messages;
|
|
27597
|
+
const hoistedCount = messages.filter((m) => isHoistedElement(m)).length;
|
|
27598
|
+
const mapped = hoistedCount === 0 ? void 0 : hoistAdjustedIndex(messages, messageIndex);
|
|
27599
|
+
const annotate = (outcome, extra = {}) => outcome.ok ? outcome : declined(outcome.decline.reason, {
|
|
27600
|
+
...outcome.decline,
|
|
27601
|
+
hoistedCount,
|
|
27602
|
+
roleSequence: roleSequenceOf(messages),
|
|
27603
|
+
...extra
|
|
27604
|
+
});
|
|
27605
|
+
if (hoistedCount === 0 || contentIndex === void 0 || mapped === void 0) return annotate(repairAtArrayIndex(parsed, messageIndex));
|
|
27606
|
+
const directNames = namesReportedBlock(messages, messageIndex, contentIndex);
|
|
27607
|
+
const mappedNames = namesReportedBlock(messages, mapped, contentIndex);
|
|
27608
|
+
if (directNames && mappedNames) return declined("ambiguous-index", {
|
|
27609
|
+
messageIndex,
|
|
27610
|
+
messageCount: messages.length,
|
|
27611
|
+
hoistedCount,
|
|
27612
|
+
roleSequence: roleSequenceOf(messages),
|
|
27613
|
+
mappedIndex: mapped
|
|
27614
|
+
});
|
|
27615
|
+
if (mappedNames) return annotate(repairAtArrayIndex(parsed, mapped), { mappedIndex: mapped });
|
|
27616
|
+
return annotate(repairAtArrayIndex(parsed, messageIndex), { mappedIndex: mapped });
|
|
27617
|
+
}
|
|
27517
27618
|
/**
|
|
27518
27619
|
* Build a one-shot repair only for Copilot's known signed-thinking integrity
|
|
27519
27620
|
* rejections. The upstream error is the oracle: valid omitted-display thinking
|
|
@@ -27528,13 +27629,15 @@ function repairRejectedThinkingHistory(rawBody, upstreamErrorText) {
|
|
|
27528
27629
|
if (!match) return declined("error-not-recognized");
|
|
27529
27630
|
const messageIndex = Number(match[1]);
|
|
27530
27631
|
if (!Number.isSafeInteger(messageIndex) || messageIndex < 0) return declined("message-index-invalid", { messageIndex });
|
|
27632
|
+
const parsedContentIndex = Number(match[2]);
|
|
27633
|
+
const contentIndex = Number.isSafeInteger(parsedContentIndex) && parsedContentIndex >= 0 ? parsedContentIndex : void 0;
|
|
27531
27634
|
let parsed;
|
|
27532
27635
|
try {
|
|
27533
27636
|
parsed = JSON.parse(rawBody);
|
|
27534
27637
|
} catch {
|
|
27535
27638
|
return declined("body-not-json", { messageIndex });
|
|
27536
27639
|
}
|
|
27537
|
-
return repairMessageAt(parsed, messageIndex);
|
|
27640
|
+
return repairMessageAt(parsed, messageIndex, contentIndex);
|
|
27538
27641
|
}
|
|
27539
27642
|
/**
|
|
27540
27643
|
* Reapply a repair already proven successful in this process. Only salted
|
|
@@ -27557,7 +27660,7 @@ function repairKnownThinkingHistory(rawBody) {
|
|
|
27557
27660
|
if (!isRecord(message) || !Array.isArray(message.content)) continue;
|
|
27558
27661
|
const fingerprint = signedBlockFingerprint(index, message.content);
|
|
27559
27662
|
if (!fingerprint || !rememberedRepairs.has(fingerprint)) continue;
|
|
27560
|
-
const attempt =
|
|
27663
|
+
const attempt = repairAtArrayIndex(parsed, index);
|
|
27561
27664
|
if (!attempt.ok) continue;
|
|
27562
27665
|
totalRemovedBlocks += attempt.repair.removedBlocks;
|
|
27563
27666
|
repaired = {
|
|
@@ -34493,6 +34596,6 @@ function enumerateInjectedMcpToolNames(groupKeys, opts = {}) {
|
|
|
34493
34596
|
return [...new Set(names)];
|
|
34494
34597
|
}
|
|
34495
34598
|
//#endregion
|
|
34496
|
-
export { browserToolsEnabled as $, searchWeb as A, collapsePathKeys as At, buildAnthropicErrorEvent as B,
|
|
34599
|
+
export { browserToolsEnabled as $, searchWeb as A, collapsePathKeys as At, buildAnthropicErrorEvent as B, upstreamAllowH2 as Bt, buildToolbeltAwareness as C, provisionAndIndexColbert as Ct, TOOLBELT_TOOLS$1 as D, CONDENSED_OPERATING_SEQUENCE as Dt, vscodeRipgrepPath as E, warmTreeSitterPool as Et, isAdvisorRequested as F, DEFAULT_PORT as Ft, relayAnthropicStream as G, isControllerClosedError as H, withOneMSuffix as Ht, formatThinkingRepairDecline as I, UPSTREAM_FETCH_TIMEOUT_MS as It, agentToolsEnabled as J, handleMcpDelete as K, rememberThinkingHistoryRepair as L, UPSTREAM_INACTIVITY_TIMEOUT_MS as Lt, ADVISOR_TOOL_INSTRUCTIONS as M, DEFAULT_CLAUDE_MODEL_FALLBACKS as Mt, buildAdvisorStream as N, DEFAULT_CODEX_MODEL as Nt, assetFor as O, DEFINITION_OF_GREATNESS as Ot, injectAdvisorTool as P, DEFAULT_CODEX_MODEL_FALLBACKS as Pt, browserCompoundToolsEnabled as Q, repairKnownThinkingHistory as R, generateRandomPort as Rt, availableToolCommands as S, colbertDegradedWarning as St, toolbeltSkipSet as T, extractZipMember as Tt, logStreamError as U, withInstallLock as Ut, buildOpenAIErrorEvent as V, upstreamMaxConnections as Vt, readIteratorWithTimeout as W, brainstormModel as X, artifactToolsEnabled as Y, browseAgentEnabled as Z, appendPlanReminder as _, MAX_RESPONSE_BODY_BYTES as _t, buildPeerAwarenessSnippet as a, scribeModel as at, runWorkerAgent as b, provisionBrowserAssets as bt, personasFor as c, shimDefaultsToXhigh as ct, EXPLORE_DEFAULT_MODEL as d, getTokenCount as dt, fleetToolsEnabled as et, EXPLORE_DEFAULT_THINKING as f, assembleResponsesPayload as ft, TEST_DEFAULT_MODEL as g, createChatCompletions as gt, REVIEW_DEFAULT_MODEL as h, createResponses as ht, buildAgentPrompt as i, scoutModel as it, ADVISOR_INTERNAL_TOOL_NAME as j, toolbeltPathOverride as jt, satisfiesMinVersion as k, shouldUseInsecureTls as kt, BROWSE_DEFAULT_MODEL as l, countTokens as lt, PLAN_DEFAULT_MODEL as m, pickEndpoint as mt, MCP_GROUPS as n, nativeSubagentModel as nt, buildPeerAwarenessSummary as o, standInToolEnabled as ot, IMPLEMENT_DEFAULT_MODEL as p, resolveMcpToolTimeoutMs as pt, handleMcpPost as q, assertMcpToolSurfaceConsistent as r, reviewerModel as rt, enumerateInjectedMcpToolNames as s, workerToolsEnabled as st, GROUP_META as t, geminiAvailable as tt, DEFAULT_MODEL as u, createMessages as ut, resolveModeDefaults as v, readResponseBodyCapped as vt, toolbeltEnabled as w, extractTarGzMember as wt, buildEnv as x, hasSupportedBrowserInstalled as xt, resolveWorkerRunOpts as y, parseJsonOrDiagnose as yt, repairRejectedThinkingHistory as z, pickClaudeDefault as zt };
|
|
34497
34600
|
|
|
34498
|
-
//# sourceMappingURL=peer-mcp-personas-
|
|
34601
|
+
//# sourceMappingURL=peer-mcp-personas-pzk1zcDa.js.map
|