github-router 0.3.319 → 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-Dy2jBDWv.js → attribution-settings-DHWo0lyG.js} +4 -4
- package/dist/{attribution-settings-Dy2jBDWv.js.map → attribution-settings-DHWo0lyG.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-DvieMg1u.js → claude-uAFPKvuS.js} +8 -8
- package/dist/{claude-DvieMg1u.js.map → claude-uAFPKvuS.js.map} +1 -1
- package/dist/{codex-CCB0jBCV.js → codex-CVHdye0h.js} +4 -4
- package/dist/{codex-CCB0jBCV.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-D1_pjfrK.js → serve-DSL2Fcnc.js} +5 -5
- package/dist/{serve-D1_pjfrK.js.map → serve-DSL2Fcnc.js.map} +1 -1
- package/dist/{server-setup-DPay_uYp.js → server-setup-CXXKmPIE.js} +129 -14
- package/dist/server-setup-CXXKmPIE.js.map +1 -0
- package/dist/{start-Dq6h9JuN.js → start-Cl_1UMg_.js} +3 -3
- package/dist/{start-Dq6h9JuN.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-DPay_uYp.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);
|
|
@@ -4200,6 +4224,72 @@ function parseOutputConfigEffort(body, model) {
|
|
|
4200
4224
|
return clampEffort(known ? effort : UNKNOWN_EFFORT_ANCHOR, supported);
|
|
4201
4225
|
}
|
|
4202
4226
|
/**
|
|
4227
|
+
* True for a `user` message carrying ONLY image parts.
|
|
4228
|
+
*
|
|
4229
|
+
* These are the synthetic follow-ups `anthropicMessageToNeutral` emits for
|
|
4230
|
+
* images found inside `tool_result` blocks (a `function_call_output` / chat
|
|
4231
|
+
* `tool` item cannot carry pixels). A genuine image-only user turn also
|
|
4232
|
+
* matches, but such a turn never appears mid-tool-run from Claude Code — and
|
|
4233
|
+
* even if it did, deferring it past the tool block is still the valid shape.
|
|
4234
|
+
*/
|
|
4235
|
+
function isImageOnlyUserMessage(m) {
|
|
4236
|
+
return m.role === "user" && Array.isArray(m.content) && m.content.length > 0 && m.content.every((c) => c.type === "image");
|
|
4237
|
+
}
|
|
4238
|
+
/**
|
|
4239
|
+
* Hoist `tool_result`-extracted images to the END of each contiguous run of
|
|
4240
|
+
* tool results.
|
|
4241
|
+
*
|
|
4242
|
+
* A tool-output wire item cannot carry an image on any endpoint, so images
|
|
4243
|
+
* have to ride in a separate user message. Fanning each `toolResult` out to
|
|
4244
|
+
* `[tool, user]` independently is WRONG for parallel tool calls: it yields
|
|
4245
|
+
* `tool A, user A, tool B, user B`, and providers require the tool messages
|
|
4246
|
+
* answering one assistant turn to be CONTIGUOUS — the interjected user message
|
|
4247
|
+
* orphans the following tool message and the request is rejected outright
|
|
4248
|
+
* (verified live on `gemini-3.8-flash` `/chat/completions`: interleaved →
|
|
4249
|
+
* `400 invalid_request_body`, batched → `200`; see also
|
|
4250
|
+
* `github/copilot-sdk#1922`). Mirrors `translateMessages` in
|
|
4251
|
+
* `src/lib/worker-agent/stream-fn.ts`, which implements the same invariant
|
|
4252
|
+
* for the worker path.
|
|
4253
|
+
*
|
|
4254
|
+
* So images accumulate across the run and flush once, after the last tool
|
|
4255
|
+
* message of that run: `tool A, tool B, user(imgA, imgB)`. Any other message
|
|
4256
|
+
* ends the run and the pending images flush before it. Runs at parse time
|
|
4257
|
+
* over the FULL neutral sequence (a run routinely spans several Anthropic
|
|
4258
|
+
* messages — one `tool_result` per message), never written back to state.
|
|
4259
|
+
* Single-image and image-free inputs are returned unchanged in shape.
|
|
4260
|
+
*/
|
|
4261
|
+
function groupToolResultImages(messages) {
|
|
4262
|
+
const out = [];
|
|
4263
|
+
let pending = [];
|
|
4264
|
+
let inToolRun = false;
|
|
4265
|
+
const flushImages = () => {
|
|
4266
|
+
if (pending.length === 0) return;
|
|
4267
|
+
out.push({
|
|
4268
|
+
role: "user",
|
|
4269
|
+
content: pending
|
|
4270
|
+
});
|
|
4271
|
+
pending = [];
|
|
4272
|
+
};
|
|
4273
|
+
for (const m of messages) {
|
|
4274
|
+
if (m.role === "toolResult") {
|
|
4275
|
+
out.push(m);
|
|
4276
|
+
inToolRun = true;
|
|
4277
|
+
continue;
|
|
4278
|
+
}
|
|
4279
|
+
if (inToolRun && isImageOnlyUserMessage(m)) {
|
|
4280
|
+
pending.push(...m.content);
|
|
4281
|
+
continue;
|
|
4282
|
+
}
|
|
4283
|
+
if (inToolRun) {
|
|
4284
|
+
flushImages();
|
|
4285
|
+
inToolRun = false;
|
|
4286
|
+
}
|
|
4287
|
+
out.push(m);
|
|
4288
|
+
}
|
|
4289
|
+
flushImages();
|
|
4290
|
+
return out;
|
|
4291
|
+
}
|
|
4292
|
+
/**
|
|
4203
4293
|
* Parse an already-JSON-parsed Anthropic Messages body into the neutral shape.
|
|
4204
4294
|
* `resolvedModel` is the catalog id the request will run on; `model` its
|
|
4205
4295
|
* catalog entry (for the reasoning-effort allowlist).
|
|
@@ -4218,7 +4308,7 @@ function parseAnthropicRequest(body, resolvedModel, model) {
|
|
|
4218
4308
|
model: resolvedModel,
|
|
4219
4309
|
instructions: system.stable,
|
|
4220
4310
|
dynamicInstructions: system.dynamic,
|
|
4221
|
-
messages,
|
|
4311
|
+
messages: groupToolResultImages(messages),
|
|
4222
4312
|
tools,
|
|
4223
4313
|
toolChoice: parseToolChoice(body.tool_choice),
|
|
4224
4314
|
parallelToolCalls: parseDisableParallelToolUse(body.tool_choice),
|
|
@@ -4550,7 +4640,7 @@ async function* synthAnthropicFromChat(upstream, opts) {
|
|
|
4550
4640
|
continue;
|
|
4551
4641
|
}
|
|
4552
4642
|
if (!aicRecorded) {
|
|
4553
|
-
if (
|
|
4643
|
+
if (extractAndRecordPricedAic(opts.modelId, chunk) !== void 0) aicRecorded = true;
|
|
4554
4644
|
}
|
|
4555
4645
|
if (chunk.usage) {
|
|
4556
4646
|
usageIn = Math.max(usageIn, chunk.usage.prompt_tokens ?? 0);
|
|
@@ -4963,7 +5053,7 @@ async function* synthAnthropicFromResponses(upstream, opts) {
|
|
|
4963
5053
|
case "response.incomplete": {
|
|
4964
5054
|
sawTerminal = true;
|
|
4965
5055
|
if (!aicRecorded) {
|
|
4966
|
-
if (
|
|
5056
|
+
if (extractAndRecordPricedAic(opts.modelId, ev) !== void 0) aicRecorded = true;
|
|
4967
5057
|
}
|
|
4968
5058
|
const u = ev.response?.usage;
|
|
4969
5059
|
if (u) {
|
|
@@ -6857,13 +6947,33 @@ async function handleResponses(c) {
|
|
|
6857
6947
|
let pendingFirstChunk = firstChunk;
|
|
6858
6948
|
let consumerCancelled = false;
|
|
6859
6949
|
let aicRecorded = false;
|
|
6950
|
+
let streamAicNano;
|
|
6951
|
+
let completionLogged = false;
|
|
6860
6952
|
const tapAic = (chunk) => {
|
|
6861
6953
|
if (aicRecorded || !chunk.data || chunk.data === "[DONE]") return;
|
|
6862
6954
|
try {
|
|
6863
6955
|
const parsed = JSON.parse(chunk.data);
|
|
6864
|
-
|
|
6956
|
+
const nano = extractAndRecordPricedAic(resolvedModel, parsed);
|
|
6957
|
+
if (nano !== void 0) {
|
|
6958
|
+
aicRecorded = true;
|
|
6959
|
+
streamAicNano = nano;
|
|
6960
|
+
}
|
|
6865
6961
|
} catch {}
|
|
6866
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
|
+
};
|
|
6867
6977
|
if (pendingFirstChunk !== void 0) tapAic(pendingFirstChunk);
|
|
6868
6978
|
const safeClose = (controller) => {
|
|
6869
6979
|
try {
|
|
@@ -6908,12 +7018,14 @@ async function handleResponses(c) {
|
|
|
6908
7018
|
}
|
|
6909
7019
|
if (result.done) {
|
|
6910
7020
|
upstreamFinished = true;
|
|
7021
|
+
logStreamCompletion();
|
|
6911
7022
|
safeClose(controller);
|
|
6912
7023
|
return;
|
|
6913
7024
|
}
|
|
6914
7025
|
if (result.value === void 0 || result.value === null) return;
|
|
6915
7026
|
if (result.value.data === "[DONE]") {
|
|
6916
7027
|
upstreamFinished = true;
|
|
7028
|
+
logStreamCompletion();
|
|
6917
7029
|
safeClose(controller);
|
|
6918
7030
|
return;
|
|
6919
7031
|
}
|
|
@@ -7012,12 +7124,14 @@ async function handleResponsesCompact(c) {
|
|
|
7012
7124
|
});
|
|
7013
7125
|
const response = await fetchWithTransientRetry(() => tryRefreshAndRetry(doFetch, "/responses/compact"), { label: "/responses/compact" });
|
|
7014
7126
|
if (response.ok) {
|
|
7127
|
+
const json = await response.json();
|
|
7128
|
+
extractAndRecordAic(resolveModel(body.model), json);
|
|
7015
7129
|
logRequest({
|
|
7016
7130
|
method: "POST",
|
|
7017
7131
|
path: c.req.path,
|
|
7018
7132
|
status: 200
|
|
7019
7133
|
}, void 0, startTime);
|
|
7020
|
-
return c.json(
|
|
7134
|
+
return c.json(json);
|
|
7021
7135
|
}
|
|
7022
7136
|
if (response.status === 404) {
|
|
7023
7137
|
consola.debug("Copilot API does not support /responses/compact, using synthetic compaction");
|
|
@@ -7064,6 +7178,7 @@ async function syntheticCompact(c, body, startTime) {
|
|
|
7064
7178
|
}, void 0, startTime);
|
|
7065
7179
|
throw error;
|
|
7066
7180
|
}
|
|
7181
|
+
extractAndRecordAic(resolveModel(body.model), result);
|
|
7067
7182
|
logRequest({
|
|
7068
7183
|
method: "POST",
|
|
7069
7184
|
path: c.req.path,
|
|
@@ -7786,4 +7901,4 @@ function getCodexEnvVars(serverUrl) {
|
|
|
7786
7901
|
//#endregion
|
|
7787
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 };
|
|
7788
7903
|
|
|
7789
|
-
//# sourceMappingURL=server-setup-
|
|
7904
|
+
//# sourceMappingURL=server-setup-CXXKmPIE.js.map
|