github-router 0.3.320 → 0.3.321
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/{aic-ledger-DY03LbBM.js → aic-ledger-BrDqsuge.js} +22 -2
- package/dist/aic-ledger-BrDqsuge.js.map +1 -0
- package/dist/{attribution-settings-BelfdD6d.js → attribution-settings-DHWo0lyG.js} +4 -4
- package/dist/{attribution-settings-BelfdD6d.js.map → attribution-settings-DHWo0lyG.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-DFYqAA-N.js → claude-uAFPKvuS.js} +8 -8
- package/dist/{claude-DFYqAA-N.js.map → claude-uAFPKvuS.js.map} +1 -1
- package/dist/{codex-sh1xVngr.js → codex-CVHdye0h.js} +4 -4
- package/dist/{codex-sh1xVngr.js.map → codex-CVHdye0h.js.map} +1 -1
- package/dist/{copilot-discount-C3jx9Q-o.js → copilot-discount-BnJkEojk.js} +2 -2
- package/dist/{copilot-discount-C3jx9Q-o.js.map → copilot-discount-BnJkEojk.js.map} +1 -1
- package/dist/engine-57iIqICe.js +2 -0
- package/dist/{gate-discovery-B17pvgE0.js → gate-discovery-DUBuxiLb.js} +2 -2
- package/dist/{gate-discovery-B17pvgE0.js.map → gate-discovery-DUBuxiLb.js.map} +1 -1
- package/dist/{internal-aic-status-BiblmImt.js → internal-aic-status-Dc2JQDsX.js} +3 -3
- package/dist/{internal-aic-status-BiblmImt.js.map → internal-aic-status-Dc2JQDsX.js.map} +1 -1
- package/dist/{internal-stop-hook-DZ6CCP4C.js → internal-stop-hook-DCjYE2x0.js} +2 -2
- package/dist/{internal-stop-hook-DZ6CCP4C.js.map → internal-stop-hook-DCjYE2x0.js.map} +1 -1
- package/dist/main.js +6 -6
- package/dist/{peer-mcp-personas-CRMVuMVF.js → peer-mcp-personas-BerVEkZ9.js} +4 -4
- package/dist/{peer-mcp-personas-CRMVuMVF.js.map → peer-mcp-personas-BerVEkZ9.js.map} +1 -1
- package/dist/{provision-Bn8-NDp7.js → provision-o4bXbsvB.js} +2 -2
- package/dist/{provision-Bn8-NDp7.js.map → provision-o4bXbsvB.js.map} +1 -1
- package/dist/{serve-BGopbB07.js → serve-DSL2Fcnc.js} +5 -5
- package/dist/{serve-BGopbB07.js.map → serve-DSL2Fcnc.js.map} +1 -1
- package/dist/{server-setup-ByyVi5SS.js → server-setup-CXXKmPIE.js} +62 -13
- package/dist/server-setup-CXXKmPIE.js.map +1 -0
- package/dist/{start-BQejjfMD.js → start-Cl_1UMg_.js} +3 -3
- package/dist/{start-BQejjfMD.js.map → start-Cl_1UMg_.js.map} +1 -1
- package/package.json +1 -1
- package/dist/aic-ledger-DY03LbBM.js.map +0 -1
- package/dist/engine-D5GNXylB.js +0 -2
- package/dist/server-setup-ByyVi5SS.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as EFFORT_ORDER, $t as parseJsonOrDiagnose, An as oneMContextDisabled, B as resolveAdvisorEffort, Bn as CHEAP_PROFILE_MODELS, Bt as getTextTokenCount, Cn as isBudgetClaudeLead, D as toolbeltEnabled, Dn as upstreamMaxConnections, En as upstreamAllowH2, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, G as repairKnownThinkingHistory, Gn as withInstallLock, H as resolveCheapestAdvisorModel, Ht as getTokenizerFromModel, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as buildOpenAIErrorEvent, Jt as resolveMcpToolTimeoutMs, K as repairRejectedThinkingHistory, Kt as assembleResponsesPayload, L as buildAdvisorStream, Lt as shimDefaultsToXhigh, Mn as withOneMSuffixForLead, N as searchWeb, Nn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, On as classifyMessagesRoute, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAPEST_PROFILE_MODELS, Q as relayAnthropicStream, Qt as readResponseBodyCapped, R as injectAdvisorTool, Rn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Rt as countTokens, Sn as generateRandomPort, U as formatThinkingRepairDecline, Ut as findLaunchBySecret, V as resolveAdvisorModel, Vn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Vt as getTokenCount, W as rememberThinkingHistoryRepair, Wn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, X as logStreamError, Xt as createChatCompletions, Y as isControllerClosedError, Yt as createResponses, Z as readIteratorWithTimeout, Zt as MAX_RESPONSE_BODY_BYTES, at as agentToolsEnabled, bn as UPSTREAM_FETCH_TIMEOUT_MS, cn as provisionTreeSitterAssets, en as normalizeOpenAIUsage, et as UNKNOWN_EFFORT_ANCHOR, hn as BUDGET_SMALL_FAST_SLUG, i as assertMcpToolSurfaceConsistent, it as handleMcpPost, jn as withOneMSuffix, kn as catalogAdvertises1M, nt as clampEffort, pn as toolbeltPathOverride, q as buildAnthropicErrorEvent, qt as warnOnTokenPriceDrift, rt as handleMcpDelete, tt as bucketEffort, xn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as isAdvisorRequested, zn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, zt as createMessages } from "./peer-mcp-personas-
|
|
1
|
+
import { $ as EFFORT_ORDER, $t as parseJsonOrDiagnose, An as oneMContextDisabled, B as resolveAdvisorEffort, Bn as CHEAP_PROFILE_MODELS, Bt as getTextTokenCount, Cn as isBudgetClaudeLead, D as toolbeltEnabled, Dn as upstreamMaxConnections, En as upstreamAllowH2, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as CHEAPEST_PROFILE_NATIVE_AGENT_NAMES, G as repairKnownThinkingHistory, Gn as withInstallLock, H as resolveCheapestAdvisorModel, Ht as getTokenizerFromModel, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, J as buildOpenAIErrorEvent, Jt as resolveMcpToolTimeoutMs, K as repairRejectedThinkingHistory, Kt as assembleResponsesPayload, L as buildAdvisorStream, Lt as shimDefaultsToXhigh, Mn as withOneMSuffixForLead, N as searchWeb, Nn as CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL, On as classifyMessagesRoute, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAPEST_PROFILE_MODELS, Q as relayAnthropicStream, Qt as readResponseBodyCapped, R as injectAdvisorTool, Rn as CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS, Rt as countTokens, Sn as generateRandomPort, U as formatThinkingRepairDecline, Ut as findLaunchBySecret, V as resolveAdvisorModel, Vn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, Vt as getTokenCount, W as rememberThinkingHistoryRepair, Wn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, X as logStreamError, Xt as createChatCompletions, Y as isControllerClosedError, Yt as createResponses, Z as readIteratorWithTimeout, Zt as MAX_RESPONSE_BODY_BYTES, at as agentToolsEnabled, bn as UPSTREAM_FETCH_TIMEOUT_MS, cn as provisionTreeSitterAssets, en as normalizeOpenAIUsage, et as UNKNOWN_EFFORT_ANCHOR, hn as BUDGET_SMALL_FAST_SLUG, i as assertMcpToolSurfaceConsistent, it as handleMcpPost, jn as withOneMSuffix, kn as catalogAdvertises1M, nt as clampEffort, pn as toolbeltPathOverride, q as buildAnthropicErrorEvent, qt as warnOnTokenPriceDrift, rt as handleMcpDelete, tt as bucketEffort, xn as UPSTREAM_INACTIVITY_TIMEOUT_MS, z as isAdvisorRequested, zn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, zt as createMessages } from "./peer-mcp-personas-BerVEkZ9.js";
|
|
2
2
|
import { t as getPackageVersion } from "./version-C8x2hQrZ.js";
|
|
3
3
|
import { i as ensurePaths, t as PATHS } from "./paths-CHBAj_t9.js";
|
|
4
4
|
import { t as state } from "./state-BlMpEFAt.js";
|
|
@@ -7,7 +7,7 @@ import { t as getCopilotUsage } from "./get-copilot-usage-BWCAzmSc.js";
|
|
|
7
7
|
import { c as runCommandVoid, i as parseBoolEnv, o as resolveExecutable, r as killManagedTree, s as runCommandCapture } from "./exec-COUT4QsS.js";
|
|
8
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
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-Bl7I_EOC.js";
|
|
10
|
-
import {
|
|
10
|
+
import { a as extractAndRecordPricedAic, f as extractCopilotUsage, i as extractAndRecordAic, l as recordAic, m as nanoAiuToCredits, p as formatAic } from "./aic-ledger-BrDqsuge.js";
|
|
11
11
|
import consola from "consola";
|
|
12
12
|
import fs, { existsSync } from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
@@ -2171,10 +2171,10 @@ function formatTokens(n) {
|
|
|
2171
2171
|
* Build a context window summary: "in:1.2K out:50 ctx:1.2K/1M (0.1%)"
|
|
2172
2172
|
*/
|
|
2173
2173
|
function formatTokenInfo(inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, model, aicNano) {
|
|
2174
|
-
if (inputTokens === void 0) return void 0;
|
|
2174
|
+
if (inputTokens === void 0 && (aicNano ?? 0) <= 0) return void 0;
|
|
2175
2175
|
const parts = [];
|
|
2176
2176
|
const maxPrompt = model?.capabilities?.limits?.max_prompt_tokens;
|
|
2177
|
-
if (maxPrompt) {
|
|
2177
|
+
if (inputTokens !== void 0) if (maxPrompt) {
|
|
2178
2178
|
const pct = (inputTokens / maxPrompt * 100).toFixed(1);
|
|
2179
2179
|
parts.push(`in:${formatTokens(inputTokens)}/${formatTokens(maxPrompt)} (${pct}%)`);
|
|
2180
2180
|
} else parts.push(`in:${formatTokens(inputTokens)}`);
|
|
@@ -2291,7 +2291,7 @@ function collectToolFieldKeys(body) {
|
|
|
2291
2291
|
//#endregion
|
|
2292
2292
|
//#region package.json
|
|
2293
2293
|
var name = "github-router";
|
|
2294
|
-
var version = "0.3.
|
|
2294
|
+
var version = "0.3.321";
|
|
2295
2295
|
//#endregion
|
|
2296
2296
|
//#region src/lib/approval.ts
|
|
2297
2297
|
const awaitApproval = async () => {
|
|
@@ -3011,13 +3011,33 @@ async function handleCompletion$1(c) {
|
|
|
3011
3011
|
let upstreamFinished = firstResult.done;
|
|
3012
3012
|
let consumerCancelled = false;
|
|
3013
3013
|
let aicRecorded = false;
|
|
3014
|
+
let streamAicNano;
|
|
3015
|
+
let completionLogged = false;
|
|
3014
3016
|
const tapAic = (chunk) => {
|
|
3015
3017
|
if (aicRecorded || !chunk.data || chunk.data === "[DONE]") return;
|
|
3016
3018
|
try {
|
|
3017
3019
|
const parsed = JSON.parse(chunk.data);
|
|
3018
|
-
|
|
3020
|
+
const nano = extractAndRecordPricedAic(resolvedModel, parsed);
|
|
3021
|
+
if (nano !== void 0) {
|
|
3022
|
+
aicRecorded = true;
|
|
3023
|
+
streamAicNano = nano;
|
|
3024
|
+
}
|
|
3019
3025
|
} catch {}
|
|
3020
3026
|
};
|
|
3027
|
+
const logStreamCompletion = () => {
|
|
3028
|
+
if (completionLogged || consumerCancelled || streamAicNano === void 0) return;
|
|
3029
|
+
completionLogged = true;
|
|
3030
|
+
logRequest({
|
|
3031
|
+
method: "POST",
|
|
3032
|
+
path: c.req.path,
|
|
3033
|
+
model: originalModel,
|
|
3034
|
+
resolvedModel,
|
|
3035
|
+
aicNano: streamAicNano,
|
|
3036
|
+
status: 200,
|
|
3037
|
+
streaming: true,
|
|
3038
|
+
streamMs: Date.now() - startTime
|
|
3039
|
+
}, selectedModel, startTime);
|
|
3040
|
+
};
|
|
3021
3041
|
const safeClose = (controller) => {
|
|
3022
3042
|
try {
|
|
3023
3043
|
controller.close();
|
|
@@ -3061,6 +3081,7 @@ async function handleCompletion$1(c) {
|
|
|
3061
3081
|
}
|
|
3062
3082
|
if (result.done) {
|
|
3063
3083
|
upstreamFinished = true;
|
|
3084
|
+
logStreamCompletion();
|
|
3064
3085
|
safeClose(controller);
|
|
3065
3086
|
return;
|
|
3066
3087
|
}
|
|
@@ -3490,7 +3511,10 @@ function sanitizeAnthropicBody(rawBody) {
|
|
|
3490
3511
|
* Verified live: `copilot_usage` rides inside the terminal `message_delta`
|
|
3491
3512
|
* event beside `usage`. Chunks are arbitrary byte splits, so the tap buffers
|
|
3492
3513
|
* text, splits on blank-line event boundaries, and keeps the tail. Recording
|
|
3493
|
-
* fires at most once per tap instance (one terminal event per stream)
|
|
3514
|
+
* fires at most once per tap instance (one terminal event per stream), and
|
|
3515
|
+
* only for a priced reading: a zero-nano frame is skipped so an interim
|
|
3516
|
+
* free frame can never latch ahead of the real terminal value (same
|
|
3517
|
+
* contract as `extractAndRecordPricedAic`).
|
|
3494
3518
|
*
|
|
3495
3519
|
* Total and never throws — a malformed frame is skipped silently. The relay
|
|
3496
3520
|
* path additionally wraps the call in try/catch, so a tap bug can never break
|
|
@@ -3513,7 +3537,7 @@ function createAnthropicAicTap(record) {
|
|
|
3513
3537
|
try {
|
|
3514
3538
|
const parsed = JSON.parse(dataLines.join("\n"));
|
|
3515
3539
|
const usage = extractCopilotUsage(parsed.copilot_usage);
|
|
3516
|
-
if (usage) {
|
|
3540
|
+
if (usage && usage.totalNanoAiu > 0) {
|
|
3517
3541
|
recorded = true;
|
|
3518
3542
|
try {
|
|
3519
3543
|
record(usage);
|
|
@@ -4616,7 +4640,7 @@ async function* synthAnthropicFromChat(upstream, opts) {
|
|
|
4616
4640
|
continue;
|
|
4617
4641
|
}
|
|
4618
4642
|
if (!aicRecorded) {
|
|
4619
|
-
if (
|
|
4643
|
+
if (extractAndRecordPricedAic(opts.modelId, chunk) !== void 0) aicRecorded = true;
|
|
4620
4644
|
}
|
|
4621
4645
|
if (chunk.usage) {
|
|
4622
4646
|
usageIn = Math.max(usageIn, chunk.usage.prompt_tokens ?? 0);
|
|
@@ -5029,7 +5053,7 @@ async function* synthAnthropicFromResponses(upstream, opts) {
|
|
|
5029
5053
|
case "response.incomplete": {
|
|
5030
5054
|
sawTerminal = true;
|
|
5031
5055
|
if (!aicRecorded) {
|
|
5032
|
-
if (
|
|
5056
|
+
if (extractAndRecordPricedAic(opts.modelId, ev) !== void 0) aicRecorded = true;
|
|
5033
5057
|
}
|
|
5034
5058
|
const u = ev.response?.usage;
|
|
5035
5059
|
if (u) {
|
|
@@ -6923,13 +6947,33 @@ async function handleResponses(c) {
|
|
|
6923
6947
|
let pendingFirstChunk = firstChunk;
|
|
6924
6948
|
let consumerCancelled = false;
|
|
6925
6949
|
let aicRecorded = false;
|
|
6950
|
+
let streamAicNano;
|
|
6951
|
+
let completionLogged = false;
|
|
6926
6952
|
const tapAic = (chunk) => {
|
|
6927
6953
|
if (aicRecorded || !chunk.data || chunk.data === "[DONE]") return;
|
|
6928
6954
|
try {
|
|
6929
6955
|
const parsed = JSON.parse(chunk.data);
|
|
6930
|
-
|
|
6956
|
+
const nano = extractAndRecordPricedAic(resolvedModel, parsed);
|
|
6957
|
+
if (nano !== void 0) {
|
|
6958
|
+
aicRecorded = true;
|
|
6959
|
+
streamAicNano = nano;
|
|
6960
|
+
}
|
|
6931
6961
|
} catch {}
|
|
6932
6962
|
};
|
|
6963
|
+
const logStreamCompletion = () => {
|
|
6964
|
+
if (completionLogged || consumerCancelled || streamAicNano === void 0) return;
|
|
6965
|
+
completionLogged = true;
|
|
6966
|
+
logRequest({
|
|
6967
|
+
method: "POST",
|
|
6968
|
+
path: c.req.path,
|
|
6969
|
+
model: originalModel,
|
|
6970
|
+
resolvedModel,
|
|
6971
|
+
aicNano: streamAicNano,
|
|
6972
|
+
status: 200,
|
|
6973
|
+
streaming: true,
|
|
6974
|
+
streamMs: Date.now() - startTime
|
|
6975
|
+
}, selectedModel, startTime);
|
|
6976
|
+
};
|
|
6933
6977
|
if (pendingFirstChunk !== void 0) tapAic(pendingFirstChunk);
|
|
6934
6978
|
const safeClose = (controller) => {
|
|
6935
6979
|
try {
|
|
@@ -6974,12 +7018,14 @@ async function handleResponses(c) {
|
|
|
6974
7018
|
}
|
|
6975
7019
|
if (result.done) {
|
|
6976
7020
|
upstreamFinished = true;
|
|
7021
|
+
logStreamCompletion();
|
|
6977
7022
|
safeClose(controller);
|
|
6978
7023
|
return;
|
|
6979
7024
|
}
|
|
6980
7025
|
if (result.value === void 0 || result.value === null) return;
|
|
6981
7026
|
if (result.value.data === "[DONE]") {
|
|
6982
7027
|
upstreamFinished = true;
|
|
7028
|
+
logStreamCompletion();
|
|
6983
7029
|
safeClose(controller);
|
|
6984
7030
|
return;
|
|
6985
7031
|
}
|
|
@@ -7078,12 +7124,14 @@ async function handleResponsesCompact(c) {
|
|
|
7078
7124
|
});
|
|
7079
7125
|
const response = await fetchWithTransientRetry(() => tryRefreshAndRetry(doFetch, "/responses/compact"), { label: "/responses/compact" });
|
|
7080
7126
|
if (response.ok) {
|
|
7127
|
+
const json = await response.json();
|
|
7128
|
+
extractAndRecordAic(resolveModel(body.model), json);
|
|
7081
7129
|
logRequest({
|
|
7082
7130
|
method: "POST",
|
|
7083
7131
|
path: c.req.path,
|
|
7084
7132
|
status: 200
|
|
7085
7133
|
}, void 0, startTime);
|
|
7086
|
-
return c.json(
|
|
7134
|
+
return c.json(json);
|
|
7087
7135
|
}
|
|
7088
7136
|
if (response.status === 404) {
|
|
7089
7137
|
consola.debug("Copilot API does not support /responses/compact, using synthetic compaction");
|
|
@@ -7130,6 +7178,7 @@ async function syntheticCompact(c, body, startTime) {
|
|
|
7130
7178
|
}, void 0, startTime);
|
|
7131
7179
|
throw error;
|
|
7132
7180
|
}
|
|
7181
|
+
extractAndRecordAic(resolveModel(body.model), result);
|
|
7133
7182
|
logRequest({
|
|
7134
7183
|
method: "POST",
|
|
7135
7184
|
path: c.req.path,
|
|
@@ -7852,4 +7901,4 @@ function getCodexEnvVars(serverUrl) {
|
|
|
7852
7901
|
//#endregion
|
|
7853
7902
|
export { validateCheapProfilePrerequisites as A, formatCheap1mPrerequisiteFailure as C, profileDescriptor as D, formatFastPrerequisiteFailure as E, checkClaudeVersion as F, updateClaude as I, validateFastProfilePrerequisites as M, validateMaxProfileLaunch as N, resolveLaunchProfile as O, runSelfUpdate as P, LUNA_SCOUT_ALIAS_ID as S, formatCheapestPrerequisiteFailure as T, CHEAP_EXPLORE_ALIAS_ID as _, sharedServerArgs as a, CHEAP_PLAN_ALIAS_ID as b, stopKeepAwake as c, enableFileLogging as d, CHEAPEST_EXPLORE_ALIAS_ID as f, CHEAPEST_REVIEWER_ALIAS_ID as g, CHEAPEST_PLAN_ALIAS_ID as h, setupAndServe as i, validateCheapestProfilePrerequisites as j, validateCheap1mProfilePrerequisites as k, injectModelPickerSettingsFile as l, CHEAPEST_IMPLEMENTER_ALIAS_ID as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, CHEAPEST_GENERAL_PURPOSE_ALIAS_ID as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, CHEAP_GENERAL_PURPOSE_ALIAS_ID as v, formatCheapPrerequisiteFailure as w, CHEAP_REVIEWER_ALIAS_ID as x, CHEAP_IMPLEMENTER_ALIAS_ID as y };
|
|
7854
7903
|
|
|
7855
|
-
//# sourceMappingURL=server-setup-
|
|
7904
|
+
//# sourceMappingURL=server-setup-CXXKmPIE.js.map
|