github-router 0.3.309 → 0.3.311

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 (43) hide show
  1. package/dist/{attribution-settings-Ce6s_01h.js → attribution-settings-jLxSnmZT.js} +21 -20
  2. package/dist/attribution-settings-jLxSnmZT.js.map +1 -0
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/{claude-i4L8GZbI.js → claude-DhvQETaa.js} +21 -11
  5. package/dist/claude-DhvQETaa.js.map +1 -0
  6. package/dist/{codex-GZGqYj0M.js → codex-RJQPJ--K.js} +4 -4
  7. package/dist/{codex-GZGqYj0M.js.map → codex-RJQPJ--K.js.map} +1 -1
  8. package/dist/engine-DuiPBB4G.js +2 -0
  9. package/dist/{fast-profile-contract-BWCJy6iL.js → fast-profile-contract-_DhIWank.js} +7 -3
  10. package/dist/fast-profile-contract-_DhIWank.js.map +1 -0
  11. package/dist/{gate-discovery-DkJf7d-y.js → gate-discovery-DDkRvyYL.js} +2 -2
  12. package/dist/{gate-discovery-DkJf7d-y.js.map → gate-discovery-DDkRvyYL.js.map} +1 -1
  13. package/dist/hooks.mjs +3 -1
  14. package/dist/hooks.sha256 +1 -1
  15. package/dist/{internal-fast-dispatch-guard-kzSKB0yV.js → internal-fast-dispatch-guard-19xQEouu.js} +2 -2
  16. package/dist/{internal-fast-dispatch-guard-kzSKB0yV.js.map → internal-fast-dispatch-guard-19xQEouu.js.map} +1 -1
  17. package/dist/{internal-fast-dispatch-guard-CrsZI0pO.js → internal-fast-dispatch-guard-D8YNlnuQ.js} +1 -1
  18. package/dist/{internal-max-dispatch-guard-lS4usOV5.js → internal-max-dispatch-guard-DZ7KLWxP.js} +2 -2
  19. package/dist/{internal-max-dispatch-guard-lS4usOV5.js.map → internal-max-dispatch-guard-DZ7KLWxP.js.map} +1 -1
  20. package/dist/{internal-max-dispatch-guard-DF-f8VwE.js → internal-max-dispatch-guard-_Pp4LltM.js} +1 -1
  21. package/dist/{internal-stop-hook-XRtB33hW.js → internal-stop-hook-YyYVQbbN.js} +2 -2
  22. package/dist/{internal-stop-hook-XRtB33hW.js.map → internal-stop-hook-YyYVQbbN.js.map} +1 -1
  23. package/dist/main.js +7 -7
  24. package/dist/{max-profile-contract-v2Q6eN5w.js → max-profile-contract-BcrMlrmo.js} +2 -2
  25. package/dist/max-profile-contract-BcrMlrmo.js.map +1 -0
  26. package/dist/{peer-mcp-personas-C_38ckts.js → peer-mcp-personas-O35uSWsX.js} +183 -31
  27. package/dist/{peer-mcp-personas-C_38ckts.js.map → peer-mcp-personas-O35uSWsX.js.map} +1 -1
  28. package/dist/{provision-BoOza223.js → provision-Ho5v-tt-.js} +2 -2
  29. package/dist/{provision-BoOza223.js.map → provision-Ho5v-tt-.js.map} +1 -1
  30. package/dist/{serve-DpS_lCbm.js → serve-Cb-sUTL8.js} +5 -5
  31. package/dist/{serve-DpS_lCbm.js.map → serve-Cb-sUTL8.js.map} +1 -1
  32. package/dist/{server-setup-3nCFVn79.js → server-setup-OTy-qHfv.js} +37 -17
  33. package/dist/server-setup-OTy-qHfv.js.map +1 -0
  34. package/dist/{start-CX92d6cy.js → start-Ch_iOkQE.js} +3 -3
  35. package/dist/{start-CX92d6cy.js.map → start-Ch_iOkQE.js.map} +1 -1
  36. package/dist/state-B8adscCv.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/attribution-settings-Ce6s_01h.js.map +0 -1
  39. package/dist/claude-i4L8GZbI.js.map +0 -1
  40. package/dist/engine-DMnMGgeZ.js +0 -2
  41. package/dist/fast-profile-contract-BWCJy6iL.js.map +0 -1
  42. package/dist/max-profile-contract-v2Q6eN5w.js.map +0 -1
  43. package/dist/server-setup-3nCFVn79.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { $ as UNKNOWN_EFFORT_ANCHOR, At as countTokens, B as resolveAdvisorEffort, Bt as resolveMcpToolTimeoutMs, Cn as withOneMSuffix, D as toolbeltEnabled, F as ADVISOR_TOOL_INSTRUCTIONS, Ft as findLaunchBySecret, G as repairRejectedThinkingHistory, Gt as parseJsonOrDiagnose, H as formatThinkingRepairDecline, Ht as createChatCompletions, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as isControllerClosedError, K as buildAnthropicErrorEvent, Kt as normalizeOpenAIUsage, L as buildAdvisorStream, Mt as getTextTokenCount, N as searchWeb, Nt as getTokenCount, P as ADVISOR_INTERNAL_TOOL_NAME, Pt as getTokenizerFromModel, Q as EFFORT_ORDER, R as injectAdvisorTool, Rt as assembleResponsesPayload, Sn as oneMContextDisabled, Tn as withInstallLock, U as rememberThinkingHistoryRepair, Ut as MAX_RESPONSE_BODY_BYTES, V as resolveAdvisorModel, Vt as createResponses, W as repairKnownThinkingHistory, Wt as readResponseBodyCapped, X as readIteratorWithTimeout, Y as logStreamError, Z as relayAnthropicStream, an as toolbeltPathOverride, bn as classifyMessagesRoute, en as provisionTreeSitterAssets, et as bucketEffort, fn as UPSTREAM_FETCH_TIMEOUT_MS, hn as isBudgetClaudeLead, i as assertMcpToolSurfaceConsistent, it as agentToolsEnabled, jt as createMessages, kt as shimDefaultsToXhigh, mn as generateRandomPort, nt as handleMcpDelete, pn as UPSTREAM_INACTIVITY_TIMEOUT_MS, q as buildOpenAIErrorEvent, rt as handleMcpPost, sn as BUDGET_SMALL_FAST_SLUG, tt as clampEffort, vn as upstreamAllowH2, wn as withOneMSuffixForLead, xn as catalogAdvertises1M, yn as upstreamMaxConnections, z as isAdvisorRequested, zt as warnOnTokenPriceDrift } from "./peer-mcp-personas-C_38ckts.js";
1
+ import { $ as UNKNOWN_EFFORT_ANCHOR, At as shimDefaultsToXhigh, B as resolveAdvisorEffort, Bt as warnOnTokenPriceDrift, Cn as oneMContextDisabled, D as toolbeltEnabled, En as withInstallLock, F as ADVISOR_TOOL_INSTRUCTIONS, Ft as getTokenizerFromModel, G as repairRejectedThinkingHistory, Gt as readResponseBodyCapped, H as formatThinkingRepairDecline, Ht as createResponses, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, It as findLaunchBySecret, J as isControllerClosedError, K as buildAnthropicErrorEvent, Kt as parseJsonOrDiagnose, L as buildAdvisorStream, Mt as createMessages, N as searchWeb, Nt as getTextTokenCount, P as ADVISOR_INTERNAL_TOOL_NAME, Pt as getTokenCount, Q as EFFORT_ORDER, R as injectAdvisorTool, Sn as catalogAdvertises1M, Tn as withOneMSuffixForLead, U as rememberThinkingHistoryRepair, Ut as createChatCompletions, V as resolveAdvisorModel, Vt as resolveMcpToolTimeoutMs, W as repairKnownThinkingHistory, Wt as MAX_RESPONSE_BODY_BYTES, X as readIteratorWithTimeout, Y as logStreamError, Z as relayAnthropicStream, bn as upstreamMaxConnections, cn as BUDGET_SMALL_FAST_SLUG, et as bucketEffort, gn as isBudgetClaudeLead, hn as generateRandomPort, i as assertMcpToolSurfaceConsistent, it as agentToolsEnabled, jt as countTokens, mn as UPSTREAM_INACTIVITY_TIMEOUT_MS, nt as handleMcpDelete, on as toolbeltPathOverride, pn as UPSTREAM_FETCH_TIMEOUT_MS, q as buildOpenAIErrorEvent, qt as normalizeOpenAIUsage, rt as handleMcpPost, tn as provisionTreeSitterAssets, tt as clampEffort, wn as withOneMSuffix, xn as classifyMessagesRoute, yn as upstreamAllowH2, z as isAdvisorRequested, zt as assembleResponsesPayload } from "./peer-mcp-personas-O35uSWsX.js";
2
2
  import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
3
3
  import { i as ensurePaths, t as PATHS } from "./paths-De1Qh9Q9.js";
4
4
  import { t as state } from "./state-B8adscCv.js";
5
5
  import { T as copilotHeaders, _ as forwardError, a as cacheCopilotVersion, c as filterBetaHeader, d as resolveModel, f as sleep, g as HTTPError, i as tryRefreshAndRetry, l as isNullish, n as setupGitHubAgentToken, o as cacheModels, r as setupGitHubToken, s as cacheVSCodeVersion, t as setupCopilotToken, w as copilotBaseUrl, y as fetchWithTransientRetry } from "./token-CCg-Ov5q.js";
6
6
  import { t as getCopilotUsage } from "./get-copilot-usage-Cjy8TiFf.js";
7
7
  import { a as resolveExecutable, n as killManagedTree, o as runCommandCapture, r as parseBoolEnv, s as runCommandVoid } from "./exec-y8C_MU8A.js";
8
- import { a as FAST_PROFILE_MODELS, o as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-BWCJy6iL.js";
9
- 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-v2Q6eN5w.js";
8
+ import { c as FAST_PROFILE_MODELS, l as FAST_PROFILE_NATIVE_AGENT_NAMES, r as FAST_PROFILE_ADVISOR_MODEL } from "./fast-profile-contract-_DhIWank.js";
9
+ 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-BcrMlrmo.js";
10
10
  import consola from "consola";
11
11
  import fs, { existsSync } from "node:fs";
12
12
  import path from "node:path";
@@ -370,7 +370,7 @@ const STANDARD_PROFILE = Object.freeze({
370
370
  const FAST_PROFILE = Object.freeze({
371
371
  id: "fast",
372
372
  nativeRoster: new Set(FAST_PROFILE_NATIVE_AGENT_NAMES),
373
- personaAllowlist: /* @__PURE__ */ new Set(["oracle"]),
373
+ personaAllowlist: /* @__PURE__ */ new Set(["oracle", "astra"]),
374
374
  allowedGroups: /* @__PURE__ */ new Set([
375
375
  "peers",
376
376
  "search",
@@ -1938,7 +1938,7 @@ function collectToolFieldKeys(body) {
1938
1938
  //#endregion
1939
1939
  //#region package.json
1940
1940
  var name = "github-router";
1941
- var version = "0.3.309";
1941
+ var version = "0.3.311";
1942
1942
  //#endregion
1943
1943
  //#region src/lib/approval.ts
1944
1944
  const awaitApproval = async () => {
@@ -2004,8 +2004,9 @@ async function doCheck(state, ticket) {
2004
2004
  * of silently switching Tier A off.
2005
2005
  */
2006
2006
  const CLIENT_REDUNDANCY_MARKERS = /* @__PURE__ */ new Set(["Wasted call — file unchanged since your last Read. Refer to that earlier tool_result instead."]);
2007
- const DEFAULT_NUDGE_AT = 4;
2008
- const DEFAULT_ABORT_AT = 7;
2007
+ const DEFAULT_NUDGE_AT = 3;
2008
+ const DEFAULT_WARN_AT = 7;
2009
+ const DEFAULT_ABORT_AT = 17;
2009
2010
  /**
2010
2011
  * Results are compared by equality, and a single `read` can return megabytes.
2011
2012
  * Anything longer than this is compared by digest instead so a comparison stays
@@ -2032,6 +2033,9 @@ function envThreshold(key, fallback) {
2032
2033
  function loopNudgeAt() {
2033
2034
  return envThreshold("GH_ROUTER_LOOP_NUDGE_AT", DEFAULT_NUDGE_AT);
2034
2035
  }
2036
+ function loopWarnAt() {
2037
+ return envThreshold("GH_ROUTER_LOOP_WARN_AT", DEFAULT_WARN_AT);
2038
+ }
2035
2039
  function loopAbortAt() {
2036
2040
  return envThreshold("GH_ROUTER_LOOP_ABORT_AT", DEFAULT_ABORT_AT);
2037
2041
  }
@@ -2120,8 +2124,13 @@ function turnSignature(turn) {
2120
2124
  */
2121
2125
  function detectToolLoop(turns, options = {}) {
2122
2126
  const nudgeAt = options.nudgeAt ?? loopNudgeAt();
2127
+ const warnAt = options.warnAt ?? loopWarnAt();
2123
2128
  const abortAt = options.abortAt ?? loopAbortAt();
2124
- const active = [nudgeAt, abortAt].filter((n) => n > 0);
2129
+ const active = [
2130
+ nudgeAt,
2131
+ warnAt,
2132
+ abortAt
2133
+ ].filter((n) => n > 0);
2125
2134
  if (active.length === 0 || turns.length === 0) return NO_LOOP;
2126
2135
  const limit = Math.max(...active);
2127
2136
  const last = turns[turns.length - 1];
@@ -2151,6 +2160,12 @@ function detectToolLoop(turns, options = {}) {
2151
2160
  toolName
2152
2161
  };
2153
2162
  }
2163
+ if (warnAt > 0 && repeats >= warnAt) return {
2164
+ action: "warn",
2165
+ tier: markerRun ? "A" : "B",
2166
+ repeats,
2167
+ toolName
2168
+ };
2154
2169
  if (nudgeAt > 0 && repeats >= nudgeAt) return {
2155
2170
  action: "nudge",
2156
2171
  tier: markerRun ? "A" : "B",
@@ -2165,11 +2180,15 @@ function uniqueToolName(turn) {
2165
2180
  }
2166
2181
  /** Text injected as a sibling block when a loop is suspected but not certain. */
2167
2182
  function nudgeText(verdict) {
2168
- return `[github-router] The same ${verdict.toolName ? `\`${verdict.toolName}\` call` : "tool call"} has now been repeated ${verdict.repeats}× in a row with an identical result. Nothing has changed and nothing will change by repeating it. Use the result you already have, try a materially different approach, or stop and report what you found.`;
2183
+ return `[github-router loop-guard] You have repeated the same ${verdict.toolName ? `\`${verdict.toolName}\` call` : "tool call"} ${verdict.repeats}× in a row with an identical result. Pause and ask yourself: Are you doing the right thing? What is your hypothesis? If the current approach is not producing new information, vary your parameters, use a different tool, or inspect surrounding context.`;
2184
+ }
2185
+ /** Text injected as a stronger warning sibling block before halting. */
2186
+ function warnText(verdict) {
2187
+ return `[github-router loop-guard WARNING] You have now repeated the exact same ${verdict.toolName ? `\`${verdict.toolName}\` call` : "tool call"} ${verdict.repeats}× with zero change in outcome. Continuing to repeat this call is actively failing. Stop repeating this action immediately. Step back, re-evaluate your assumptions, switch to an alternative tool or approach, or state what is blocking you.`;
2169
2188
  }
2170
2189
  /** Message returned to the client when the loop is aborted. */
2171
2190
  function abortMessage(verdict) {
2172
- return `Request blocked by github-router: the same ${verdict.toolName ? `\`${verdict.toolName}\` call` : "tool call"} has been repeated ${verdict.repeats}× consecutively with an identical result and no intervening progress. Continuing would burn inference with no possible change in outcome. Vary the call or end the turn. Tune or disable this with GH_ROUTER_LOOP_ABORT_AT.`;
2191
+ return `Request halted by github-router loop-guard: the same ${verdict.toolName ? `\`${verdict.toolName}\` call` : "tool call"} has been repeated ${verdict.repeats}× consecutively with no progress. github-router has halted this turn to prevent runaway token burn and preserve your session. Continuing would burn inference with no possible change in outcome. Resume immediately by typing a new direction in the prompt. Tune or disable with GH_ROUTER_LOOP_ABORT_AT.`;
2173
2192
  }
2174
2193
  /**
2175
2194
  * Cheap pre-check so a request with no tool traffic never pays for a parse.
@@ -2415,9 +2434,10 @@ function guardAnthropicBody(rawBody) {
2415
2434
  message: abortMessage(verdict),
2416
2435
  verdict
2417
2436
  };
2418
- if (!injectAnthropicNudge(parsed, nudgeText(verdict))) return NO_ACTION;
2437
+ const text = verdict.action === "warn" ? warnText(verdict) : nudgeText(verdict);
2438
+ if (!injectAnthropicNudge(parsed, text)) return NO_ACTION;
2419
2439
  return {
2420
- action: "nudge",
2440
+ action: verdict.action,
2421
2441
  body: JSON.stringify(parsed),
2422
2442
  verdict
2423
2443
  };
@@ -2432,9 +2452,9 @@ function guardChatPayload(payload) {
2432
2452
  message: abortMessage(verdict),
2433
2453
  verdict
2434
2454
  };
2435
- if (!injectChatNudge(payload, nudgeText(verdict))) return NO_ACTION;
2455
+ if (!injectChatNudge(payload, verdict.action === "warn" ? warnText(verdict) : nudgeText(verdict))) return NO_ACTION;
2436
2456
  return {
2437
- action: "nudge",
2457
+ action: verdict.action,
2438
2458
  verdict
2439
2459
  };
2440
2460
  }
@@ -2448,9 +2468,9 @@ function guardResponsesPayload(payload) {
2448
2468
  message: abortMessage(verdict),
2449
2469
  verdict
2450
2470
  };
2451
- if (!injectResponsesNudge(payload, nudgeText(verdict))) return NO_ACTION;
2471
+ if (!injectResponsesNudge(payload, verdict.action === "warn" ? warnText(verdict) : nudgeText(verdict))) return NO_ACTION;
2452
2472
  return {
2453
- action: "nudge",
2473
+ action: verdict.action,
2454
2474
  verdict
2455
2475
  };
2456
2476
  }
@@ -7179,4 +7199,4 @@ function getCodexEnvVars(serverUrl) {
7179
7199
  //#endregion
7180
7200
  export { validateMaxProfileLaunch as _, sharedServerArgs as a, updateClaude as b, stopKeepAwake as c, enableFileLogging as d, LUNA_SCOUT_ALIAS_ID as f, validateFastProfilePrerequisites as g, resolveLaunchProfile as h, setupAndServe as i, injectModelPickerSettingsFile as l, profileDescriptor as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, formatFastPrerequisiteFailure as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, runSelfUpdate as v, checkClaudeVersion as y };
7181
7201
 
7182
- //# sourceMappingURL=server-setup-3nCFVn79.js.map
7202
+ //# sourceMappingURL=server-setup-OTy-qHfv.js.map