github-router 0.3.370 → 0.3.372

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.
Files changed (49) hide show
  1. package/dist/ado-tools-CAtopk36.js +1 -0
  2. package/dist/{attribution-settings-Cppl9atx.js → attribution-settings-HI_5bN_-.js} +6 -6
  3. package/dist/{attribution-settings-Cppl9atx.js.map → attribution-settings-HI_5bN_-.js.map} +1 -1
  4. package/dist/browser-ext/manifest.json +1 -1
  5. package/dist/{claude-B3qNFwtc.js → claude-BBSsqwln.js} +10 -10
  6. package/dist/claude-BBSsqwln.js.map +1 -0
  7. package/dist/{claude-md-injection-K3DKhsfI.js → claude-md-injection-BMon6WUD.js} +19 -22
  8. package/dist/claude-md-injection-BMon6WUD.js.map +1 -0
  9. package/dist/{codex-3DEffjlm.js → codex-PRWoBiOH.js} +5 -5
  10. package/dist/{codex-3DEffjlm.js.map → codex-PRWoBiOH.js.map} +1 -1
  11. package/dist/engine-CDZdAx8N.js +1 -0
  12. package/dist/{gate-discovery-BV6UGGVd.js → gate-discovery-BNy8GKsC.js} +2 -2
  13. package/dist/{gate-discovery-BV6UGGVd.js.map → gate-discovery-BNy8GKsC.js.map} +1 -1
  14. package/dist/hooks.mjs +45 -10
  15. package/dist/hooks.sha256 +1 -1
  16. package/dist/{internal-prompt-submit-bi7F7pKk.js → internal-prompt-submit-BW5g3MjD.js} +2 -2
  17. package/dist/{internal-prompt-submit-bi7F7pKk.js.map → internal-prompt-submit-BW5g3MjD.js.map} +1 -1
  18. package/dist/{internal-prompt-submit-B-kKTl-8.js → internal-prompt-submit-C4uDwr7G.js} +2 -2
  19. package/dist/{internal-rebrief-B6ZJS6Mp.js → internal-rebrief-DvBS8myn.js} +3 -3
  20. package/dist/{internal-rebrief-B6ZJS6Mp.js.map → internal-rebrief-DvBS8myn.js.map} +1 -1
  21. package/dist/{internal-stop-hook-covotLvl.js → internal-stop-hook-CXlOsW63.js} +2 -2
  22. package/dist/{internal-stop-hook-covotLvl.js.map → internal-stop-hook-CXlOsW63.js.map} +1 -1
  23. package/dist/main.js +8 -8
  24. package/dist/{peer-mcp-personas-6zWkXHQW.js → peer-mcp-personas-Dxxw5X1g.js} +615 -274
  25. package/dist/peer-mcp-personas-Dxxw5X1g.js.map +1 -0
  26. package/dist/{pi-DJJlBHP9.js → pi-IYAvKF50.js} +805 -68
  27. package/dist/pi-IYAvKF50.js.map +1 -0
  28. package/dist/{provision-C_aTowyW.js → provision-CIn6I4w_.js} +33 -2
  29. package/dist/provision-CIn6I4w_.js.map +1 -0
  30. package/dist/{serve-CfizTkRS.js → serve-CttHP8dJ.js} +7 -7
  31. package/dist/{serve-CfizTkRS.js.map → serve-CttHP8dJ.js.map} +1 -1
  32. package/dist/{server-setup-rm8ELtYa.js → server-setup-D7XHUrhM.js} +37 -24
  33. package/dist/server-setup-D7XHUrhM.js.map +1 -0
  34. package/dist/{start-D7RcHG8T.js → start-XU5HwLd9.js} +3 -3
  35. package/dist/{start-D7RcHG8T.js.map → start-XU5HwLd9.js.map} +1 -1
  36. package/dist/{static-context-pack-DvwLWlbe.js → static-context-pack-CsOAC87F.js} +98 -18
  37. package/dist/static-context-pack-CsOAC87F.js.map +1 -0
  38. package/dist/workiq-tools-CMoDjrO0.js +1 -0
  39. package/package.json +1 -1
  40. package/dist/ado-tools-B5MNQMFs.js +0 -1
  41. package/dist/claude-B3qNFwtc.js.map +0 -1
  42. package/dist/claude-md-injection-K3DKhsfI.js.map +0 -1
  43. package/dist/engine-C2YCclx0.js +0 -1
  44. package/dist/peer-mcp-personas-6zWkXHQW.js.map +0 -1
  45. package/dist/pi-DJJlBHP9.js.map +0 -1
  46. package/dist/provision-C_aTowyW.js.map +0 -1
  47. package/dist/server-setup-rm8ELtYa.js.map +0 -1
  48. package/dist/static-context-pack-DvwLWlbe.js.map +0 -1
  49. package/dist/workiq-tools-BeTneKco.js +0 -1
@@ -7,8 +7,8 @@ import { r as fetchWithTransientRetry } from "./upstream-retry-i1k1Xai2.js";
7
7
  import { t as getCopilotUsage } from "./get-copilot-usage-BSXeQEx8.js";
8
8
  import { a as parseBoolEnv, c as runCommandCapture, i as killManagedTree, s as resolveExecutable, u as runCommandVoid } from "./exec-Bf8g_bIR.js";
9
9
  import { c as FAST_PROFILE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-JOnZBgFB.js";
10
- import { $ as buildAnthropicErrorEvent, $n as isBudgetClaudeLead, An as normalizeOpenAIUsage, B as FAST_ADVISOR_TOOL_INSTRUCTIONS, Cn as createResponses, Ct as agentToolsEnabled, D as toolbeltEnabled, Dn as parseJsonOrDiagnose, En as readResponseBodyCapped, F as ADVISOR_TOOL_INSTRUCTIONS, G as isAdvisorRequested, Gn as BUDGET_SMALL_FAST_SLUG, H as LOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, I as CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS, J as resolveCuratedAdvisorModel, K as resolveAdvisorEffort, L as CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, N as searchWeb, Nn as normalizeCloudAgentEnvironment, On as assertCopilotModelAllowed, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as normalizeKustoClusterUri, Q as repairRejectedThinkingHistory, Qn as generateRandomPort, R as CHEAPLOCAL_ADVISOR_TOOL_INSTRUCTIONS, Sn as resolveMcpToolTimeoutMs, Tn as MAX_RESPONSE_BODY_BYTES, U as buildAdvisorStream, Un as toolbeltPathOverride, V as LOCAL_ADVISOR_TOOL_INSTRUCTIONS, W as injectAdvisorTool, X as rememberThinkingHistoryRepair, Xn as UPSTREAM_FETCH_TIMEOUT_MS, Y as formatThinkingRepairDecline, Z as repairKnownThinkingHistory, Zn as UPSTREAM_INACTIVITY_TIMEOUT_MS, an as shimDefaultsToXhigh, ar as catalogAdvertises1M, at as EFFORT_ORDER, bn as assembleResponsesPayload, bt as ADO_DEFAULT_TOOLSETS, cn as getTokenizerFromModel, cr as withOneMSuffixForLead, ct as clampEffort, dn as localSessionId, dr as CHEAP_PROFILE_NATIVE_AGENT_NAMES, et as buildOpenAIErrorEvent, fn as countTokens, hn as findLaunchBySecret, i as assertMcpToolSurfaceConsistent, ir as classifyMessagesRoute, it as relayAnthropicStream, kn as effectiveLocalProfile, lr as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, lt as handleMcpDelete, mn as LAUNCH_BOUND_TOKEN_PREFIX, mr as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, mt as provisionWorkiqTools, nr as upstreamAllowH2, nt as logStreamError, on as getTextTokenCount, or as oneMContextDisabled, ot as UNKNOWN_EFFORT_ANCHOR, pn as createMessages, q as resolveAdvisorModel, rr as upstreamMaxConnections, rt as readIteratorWithTimeout, sn as getTokenCount, sr as withOneMSuffix, st as bucketEffort, tt as isControllerClosedError, un as localBaseUrl, ur as CHEAP_PROFILE_MODELS, ut as handleMcpPost, vn as rememberLaunchSessionId, wn as createChatCompletions, xn as warnOnTokenPriceDrift, xt as normalizeAdoToolsets, yt as provisionAdoTools, z as CHEAPLOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS } from "./peer-mcp-personas-6zWkXHQW.js";
11
- import { D as LOCAL_PROFILE_TIER_MODELS, F as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, P as CHEAPEST_PROFILE_MODELS, S as localContractFor, _ as isCheapestFamily, b as isPinnedLaunchProfile, f as balancedContractFor, g as isBalancedFamily, h as displayModelName, k as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, p as cheapestContractFor, x as local2AdvisorContract, y as isLocalFamily } from "./static-context-pack-DvwLWlbe.js";
10
+ import { $ as buildAnthropicErrorEvent, An as parseJsonOrDiagnose, B as FAST_ADVISOR_TOOL_INSTRUCTIONS, Cn as assembleResponsesPayload, Ct as ADO_DEFAULT_TOOLSETS, D as toolbeltEnabled, Dn as createChatCompletions, En as createResponses, Et as agentToolsEnabled, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as normalizeKustoClusterUri, G as isAdvisorRequested, H as LOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, I as CHEAPEST_ADVISOR_TOOL_INSTRUCTIONS, J as resolveCuratedAdvisorModel, K as resolveAdvisorEffort, L as CHEAPEST_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, N as searchWeb, On as MAX_RESPONSE_BODY_BYTES, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as normalizeCloudAgentEnvironment, Q as repairRejectedThinkingHistory, R as CHEAPLOCAL_ADVISOR_TOOL_INSTRUCTIONS, Rn as assertCopilotModelAllowed, St as provisionAdoTools, Tn as resolveMcpToolTimeoutMs, U as buildAdvisorStream, V as LOCAL_ADVISOR_TOOL_INSTRUCTIONS, W as injectAdvisorTool, X as rememberThinkingHistoryRepair, Y as formatThinkingRepairDecline, Yn as BUDGET_SMALL_FAST_SLUG, Z as repairKnownThinkingHistory, _n as LAUNCH_BOUND_TOKEN_PREFIX, _t as provisionWorkiqTools, at as EFFORT_ORDER, cn as shimDefaultsToXhigh, cr as classifyMessagesRoute, ct as clampEffort, dn as getTokenizerFromModel, dr as withOneMSuffix, dt as normalizeAnthropicUsageInPlace, er as UPSTREAM_FETCH_TIMEOUT_MS, et as buildOpenAIErrorEvent, fr as withOneMSuffixForLead, ft as handleMcpDelete, gn as createMessages, hn as countTokens, hr as CHEAP_PROFILE_NATIVE_AGENT_NAMES, i as assertMcpToolSurfaceConsistent, it as relayAnthropicStream, jn as normalizeOpenAIUsage, kn as readResponseBodyCapped, ln as getTextTokenCount, lr as catalogAdvertises1M, lt as anthropicUsageNormalizeDisabled, mn as localSessionId, mr as CHEAP_PROFILE_MODELS, nr as generateRandomPort, nt as logStreamError, or as upstreamAllowH2, ot as UNKNOWN_EFFORT_ANCHOR, pn as localBaseUrl, pr as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, pt as handleMcpPost, q as resolveAdvisorModel, qn as toolbeltPathOverride, rr as isBudgetClaudeLead, rt as readIteratorWithTimeout, sr as upstreamMaxConnections, st as bucketEffort, tr as UPSTREAM_INACTIVITY_TIMEOUT_MS, tt as isControllerClosedError, un as getTokenCount, ur as oneMContextDisabled, ut as createAnthropicUsageRewriteTransform, vn as findLaunchBySecret, vr as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, wn as warnOnTokenPriceDrift, wt as normalizeAdoToolsets, xn as rememberLaunchSessionId, z as CHEAPLOCAL_REVIEWER_ADVISOR_TOOL_INSTRUCTIONS, zn as effectiveLocalProfile } from "./peer-mcp-personas-Dxxw5X1g.js";
11
+ import { C as localContractFor, I as CHEAPEST_PROFILE_MODELS, L as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, O as LOCAL_PROFILE_TIER_MODELS, S as local2AdvisorContract, _ as isBalancedFamily, b as isLocalFamily, f as balancedContractFor, g as displayModelName, j as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, p as cheapestContractFor, v as isCheapestFamily, x as isPinnedLaunchProfile } from "./static-context-pack-CsOAC87F.js";
12
12
  import { i as BALANCED_PROFILE_NATIVE_AGENT_NAMES, r as BALANCED_PROFILE_MODELS } from "./balanced-profile-contract-Dm_usmw7.js";
13
13
  import { A as normalizeTrailingOneMSuffix, a as MAX_PROFILE_NATIVE_AGENT_NAMES, d as maxAdvisorPinIsValid, h as maxOpusModel, i as MAX_PROFILE_MODELS, j as stripTrailingOneMSuffix, k as fastEndpointForModel, l as maxAdvisorEffortForModel, n as MAX_PROFILE_ALLOWED_LEAD_MODEL_IDS, t as MAX_PROFILE_ADVISOR_INSTRUCTIONS, u as maxAdvisorModelFromPin, y as validateMaxProfilePrerequisites } from "./max-profile-contract-CRj7N211.js";
14
14
  import { f as getAzureRepoFromGit } from "./bluebird-client-ByCRusGQ.js";
@@ -569,23 +569,26 @@ const BALANCED2_PROFILE = Object.freeze({
569
569
  * coordinator), with every role's model swapped for the local endpoint's tier
570
570
  * id.
571
571
  *
572
- * No agent turn on a local launch reaches a Copilot model, so every group
573
- * whose tools spawn one is absent: `workers` (the Pi workers resolve Copilot
574
- * models) and every group built for model ties. `peers` is permitted only
575
- * because the artifact tools live there and human review is not model
576
- * inference, and the empty allow-list means no persona is listed or callable:
577
- * with the artifact panel off the group holds nothing and neither launcher
578
- * publishes it. What remains is the surface that is not an agent model call —
579
- * `search` (in-process lexical/ColBERT plus the PAT-backed web search),
580
- * `browser` (a local extension, whose page compressor is the one model-backed
581
- * exception and carries its own fixed chain), and the three Azure data groups.
582
- * The egress guard in `copilot-model-policy.ts` enforces the same rule from
583
- * the other side, so a path that somehow reaches Copilot still refuses.
572
+ * No agent turn on a local launch reaches a Copilot model, so every group whose
573
+ * tools spawn one is absent: `workers` (the Pi workers resolve Copilot models)
574
+ * and every group built for model ties. `peers` is permitted for two reasons and
575
+ * only those: the artifact tools (human review, not model inference) and the
576
+ * `oracle` persona, whose consultant is the local endpoint itself
577
+ * (`consultTransport: "local"` on the contract). The allow-list is what keeps it
578
+ * to that one persona — every other peer stays unlisted and therefore
579
+ * uncallable. With the artifact panel off the group holds just the Oracle and
580
+ * both launchers still publish it. What remains is the surface that is not an
581
+ * agent model call — `search` (in-process lexical/ColBERT plus the PAT-backed
582
+ * web search), `browser` (a local extension, whose page compressor is the one
583
+ * model-backed exception and carries its own fixed chain), and the three Azure
584
+ * data groups. The egress guard in `copilot-model-policy.ts` enforces the same
585
+ * rule from the other side, so a path that somehow reaches Copilot still
586
+ * refuses.
584
587
  */
585
588
  const LOCAL_PROFILE = Object.freeze({
586
589
  id: "local",
587
590
  nativeRoster: new Set(localContractFor("local").nativeAgentNames),
588
- personaAllowlist: /* @__PURE__ */ new Set(),
591
+ personaAllowlist: /* @__PURE__ */ new Set(["oracle"]),
589
592
  allowedGroups: /* @__PURE__ */ new Set([
590
593
  "peers",
591
594
  "search",
@@ -3549,7 +3552,7 @@ function collectToolFieldKeys(body) {
3549
3552
  //#endregion
3550
3553
  //#region package.json
3551
3554
  var name = "github-router";
3552
- var version = "0.3.370";
3555
+ var version = "0.3.372";
3553
3556
  //#endregion
3554
3557
  //#region src/lib/approval.ts
3555
3558
  const awaitApproval = async () => {
@@ -7737,7 +7740,8 @@ async function handleCompletion(c) {
7737
7740
  const aicTap = localProfileRequest ? void 0 : createAnthropicAicTap((usage) => recordAic(resolvedModel, usage));
7738
7741
  return new Response(response.body ? relayAnthropicStream(response.body, {
7739
7742
  routePath: c.req.path,
7740
- ...aicTap ? { onBytes: aicTap.onBytes } : {}
7743
+ ...aicTap ? { onBytes: aicTap.onBytes } : {},
7744
+ ...anthropicUsageNormalizeDisabled() ? {} : { transform: createAnthropicUsageRewriteTransform() }
7741
7745
  }) : null, {
7742
7746
  status: response.status,
7743
7747
  headers: streamHeaders
@@ -7746,6 +7750,7 @@ async function handleCompletion(c) {
7746
7750
  const cappedResult = await readResponseBodyCapped(response, c.req.path, MAX_RESPONSE_BODY_BYTES);
7747
7751
  if (!cappedResult.ok) return c.json(cappedResult.errorResponse, cappedResult.status);
7748
7752
  const responseBody = cappedResult.value;
7753
+ if (!anthropicUsageNormalizeDisabled()) normalizeAnthropicUsageInPlace(responseBody.usage);
7749
7754
  const usage = responseBody.usage;
7750
7755
  const aicNano = localProfileRequest ? void 0 : extractAndRecordAic(resolvedModel, responseBody);
7751
7756
  logRequest({
@@ -7886,12 +7891,20 @@ function clampOutputConfigEffortInPlace(body, model) {
7886
7891
  * Sum native Claude `/v1/messages` usage into the TOTAL input-token figure
7887
7892
  * `logRequest`'s context-window-fill display expects.
7888
7893
  *
7889
- * Anthropic's `input_tokens` is the NEW (uncached) portion ONLY — unlike
7890
- * OpenAI's inclusive total, it excludes both `cache_read_input_tokens` and
7891
- * `cache_creation_input_tokens`. Forwarding it alone understates the real
7892
- * prompt size on any cache hit, sometimes drastically: a live warm-cache turn
7893
- * measured `input_tokens: 26` alongside `cache_read_input_tokens: 97304` — the
7894
- * actual prompt was ~97k tokens, not 26. Returns `undefined` only when
7894
+ * In the ANTHROPIC contract `input_tokens` is the NEW (uncached) portion ONLY —
7895
+ * unlike OpenAI's inclusive total, it excludes both `cache_read_input_tokens`
7896
+ * and `cache_creation_input_tokens` — so summing the three is what yields the
7897
+ * real prompt size on a cache hit. A conformant warm turn reports something
7898
+ * like `input_tokens: 26` with `cache_read_input_tokens: 97304`; the actual
7899
+ * prompt was ~97k tokens, not 26.
7900
+ *
7901
+ * Upstream does not always honour that contract: the local endpoint of session
7902
+ * `a1ab11a5` and the native Copilot path in session `ec65e3f9` reported
7903
+ * `input_tokens` INCLUSIVE of the cached prefix, so summing raw buckets there
7904
+ * double-counts it. Every call
7905
+ * site normalizes first (`normalizeAnthropicUsageInPlace` /
7906
+ * `createAnthropicUsageRewriteTransform`), which makes the three buckets
7907
+ * disjoint again and this sum correct on both paths. Returns `undefined` only when
7895
7908
  * `usage` itself is absent, so the log line omits the field entirely rather
7896
7909
  * than reporting a fabricated total (matching how `formatTokenInfo` treats an
7897
7910
  * undefined `inputTokens`).
@@ -9572,4 +9585,4 @@ function getPiLaunchEnvVars(mirrorDir) {
9572
9585
  //#endregion
9573
9586
  export { updateClaude as $, CHEAP_EXPLORE_ALIAS_ID as A, formatFastPrerequisiteFailure as B, BALANCED_EXPLORE_ALIAS_ID as C, CHEAPEST_EXPLORE_ALIAS_ID as D, BROWSE_LOW_ALIAS_ID as E, MAX_BROWSE_LOW_ALIAS_ID as F, validateCheap1mProfilePrerequisites as G, profileDescriptor as H, formatBalancedPrerequisiteFailure as I, validateFastProfilePrerequisites as J, validateCheapProfilePrerequisites as K, formatCheap1mPrerequisiteFailure as L, CHEAP_PLAN_ALIAS_ID as M, CHEAP_REVIEWER_ALIAS_ID as N, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as O, LUNA_SCOUT_ALIAS_ID as P, checkClaudeVersion as Q, formatCheapPrerequisiteFailure as R, enableFileLogging as S, BALANCED_REVIEWER_ALIAS_ID as T, resolveLaunchProfile as U, formatLocalPrerequisiteFailure as V, validateBalancedProfilePrerequisites as W, validateMaxProfileLaunch as X, validateLocalProfilePrerequisites as Y, runSelfUpdate as Z, sweepStalePiAgentMirrors as _, setupAndServe as a, injectModelPickerSettingsFile as b, PI_MIN_VERSION as c, meetsPiMinVersion as d, refreshPiInBackground as f, removeOwnPiAgentMirror as g, ensurePiAgentMirror as h, parseSharedArgs as i, CHEAP_GENERAL_PURPOSE_ALIAS_ID as j, CHEAPEST_REVIEWER_ALIAS_ID as k, ensurePiInstalled as l, updatePi as m, getCodexEnvVars as n, sharedServerArgs as o, resolvePiRegistry as p, validateCheapestProfilePrerequisites as q, getPiLaunchEnvVars as r, LAUNCH_SECRET_HEADER as s, getClaudeCodeEnvVars as t, getInstalledPiVersion as u, startKeepAwake as v, BALANCED_GENERAL_PURPOSE_ALIAS_ID as w, listModelsForEndpoint as x, stopKeepAwake as y, formatCheapestPrerequisiteFailure as z };
9574
9587
 
9575
- //# sourceMappingURL=server-setup-rm8ELtYa.js.map
9588
+ //# sourceMappingURL=server-setup-D7XHUrhM.js.map