github-router 0.3.312 → 0.3.314

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 (36) hide show
  1. package/dist/aic-ledger-Cx_Ubon3.js +238 -0
  2. package/dist/aic-ledger-Cx_Ubon3.js.map +1 -0
  3. package/dist/{attribution-settings-os6aa-ck.js → attribution-settings-Btc5EZTj.js} +20 -20
  4. package/dist/attribution-settings-Btc5EZTj.js.map +1 -0
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/{claude-CHObdsb5.js → claude-D0vuAqTV.js} +122 -8
  7. package/dist/claude-D0vuAqTV.js.map +1 -0
  8. package/dist/{codex-CUQklRRv.js → codex-BNm9D0iJ.js} +4 -4
  9. package/dist/{codex-CUQklRRv.js.map → codex-BNm9D0iJ.js.map} +1 -1
  10. package/dist/engine-DsVZuCrD.js +2 -0
  11. package/dist/{gate-discovery-_flEdhYo.js → gate-discovery-CO2njGBB.js} +2 -2
  12. package/dist/{gate-discovery-_flEdhYo.js.map → gate-discovery-CO2njGBB.js.map} +1 -1
  13. package/dist/hooks.mjs +142 -3
  14. package/dist/hooks.sha256 +1 -1
  15. package/dist/internal-aic-status-C_swX3_7.js +95 -0
  16. package/dist/internal-aic-status-C_swX3_7.js.map +1 -0
  17. package/dist/{internal-stop-hook-BJ3o61-L.js → internal-stop-hook-D56b6iVj.js} +2 -2
  18. package/dist/{internal-stop-hook-BJ3o61-L.js.map → internal-stop-hook-D56b6iVj.js.map} +1 -1
  19. package/dist/main.js +8 -7
  20. package/dist/main.js.map +1 -1
  21. package/dist/{peer-mcp-personas-DklYru_1.js → peer-mcp-personas-0_XU6nm9.js} +31 -4
  22. package/dist/{peer-mcp-personas-DklYru_1.js.map → peer-mcp-personas-0_XU6nm9.js.map} +1 -1
  23. package/dist/{provision-BYdIsKcp.js → provision-DuCnZJj_.js} +6 -2
  24. package/dist/provision-DuCnZJj_.js.map +1 -0
  25. package/dist/{serve-B70Kczq6.js → serve-DXFVR6A0.js} +5 -5
  26. package/dist/{serve-B70Kczq6.js.map → serve-DXFVR6A0.js.map} +1 -1
  27. package/dist/{server-setup-DX27fdcf.js → server-setup-CP8nGop3.js} +105 -6
  28. package/dist/server-setup-CP8nGop3.js.map +1 -0
  29. package/dist/{start-JbcSzClY.js → start-BHEjESCB.js} +3 -3
  30. package/dist/{start-JbcSzClY.js.map → start-BHEjESCB.js.map} +1 -1
  31. package/package.json +1 -1
  32. package/dist/attribution-settings-os6aa-ck.js.map +0 -1
  33. package/dist/claude-CHObdsb5.js.map +0 -1
  34. package/dist/engine-DyzGsCUb.js +0 -2
  35. package/dist/provision-BYdIsKcp.js.map +0 -1
  36. package/dist/server-setup-DX27fdcf.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { $ as UNKNOWN_EFFORT_ANCHOR, An as CHEAP_PROFILE_MODELS, B as resolveAdvisorEffort, Cn as upstreamMaxConnections, D as toolbeltEnabled, Dn as withOneMSuffix, En as oneMContextDisabled, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as withInstallLock, Ft as createMessages, G as repairRejectedThinkingHistory, Gt as createResponses, H as formatThinkingRepairDecline, Ht as assembleResponsesPayload, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, It as getTextTokenCount, J as isControllerClosedError, Jt as readResponseBodyCapped, K as buildAnthropicErrorEvent, Kt as createChatCompletions, L as buildAdvisorStream, Lt as getTokenCount, N as searchWeb, Nt as shimDefaultsToXhigh, On as withOneMSuffixForLead, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, Pt as countTokens, Q as EFFORT_ORDER, R as injectAdvisorTool, Rt as getTokenizerFromModel, Sn as upstreamAllowH2, Tn as catalogAdvertises1M, U as rememberThinkingHistoryRepair, Ut as warnOnTokenPriceDrift, V as resolveAdvisorModel, W as repairKnownThinkingHistory, Wt as resolveMcpToolTimeoutMs, X as readIteratorWithTimeout, Xt as normalizeOpenAIUsage, Y as logStreamError, Yt as parseJsonOrDiagnose, Z as relayAnthropicStream, _n as UPSTREAM_INACTIVITY_TIMEOUT_MS, dn as BUDGET_SMALL_FAST_SLUG, et as bucketEffort, gn as UPSTREAM_FETCH_TIMEOUT_MS, i as assertMcpToolSurfaceConsistent, in as provisionTreeSitterAssets, it as agentToolsEnabled, jn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, kn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, ln as toolbeltPathOverride, nt as handleMcpDelete, q as buildOpenAIErrorEvent, qt as MAX_RESPONSE_BODY_BYTES, rt as handleMcpPost, tt as clampEffort, vn as generateRandomPort, wn as classifyMessagesRoute, yn as isBudgetClaudeLead, z as isAdvisorRequested, zt as findLaunchBySecret } from "./peer-mcp-personas-DklYru_1.js";
1
+ import { $ as UNKNOWN_EFFORT_ANCHOR, An as CHEAP_PROFILE_MODELS, B as resolveAdvisorEffort, Cn as upstreamMaxConnections, D as toolbeltEnabled, Dn as withOneMSuffix, En as oneMContextDisabled, F as ADVISOR_TOOL_INSTRUCTIONS, Fn as withInstallLock, Ft as createMessages, G as repairRejectedThinkingHistory, Gt as createResponses, H as formatThinkingRepairDecline, Ht as assembleResponsesPayload, I as FAST_ADVISOR_TOOL_INSTRUCTIONS, It as getTextTokenCount, J as isControllerClosedError, Jt as readResponseBodyCapped, K as buildAnthropicErrorEvent, Kt as createChatCompletions, L as buildAdvisorStream, Lt as getTokenCount, N as searchWeb, Nt as shimDefaultsToXhigh, On as withOneMSuffixForLead, P as ADVISOR_INTERNAL_TOOL_NAME, Pn as CHEAP_PROFILE_SUBAGENT_CONTEXT_TOKENS, Pt as countTokens, Q as EFFORT_ORDER, R as injectAdvisorTool, Rt as getTokenizerFromModel, Sn as upstreamAllowH2, Tn as catalogAdvertises1M, U as rememberThinkingHistoryRepair, Ut as warnOnTokenPriceDrift, V as resolveAdvisorModel, W as repairKnownThinkingHistory, Wt as resolveMcpToolTimeoutMs, X as readIteratorWithTimeout, Xt as normalizeOpenAIUsage, Y as logStreamError, Yt as parseJsonOrDiagnose, Z as relayAnthropicStream, _n as UPSTREAM_INACTIVITY_TIMEOUT_MS, dn as BUDGET_SMALL_FAST_SLUG, et as bucketEffort, gn as UPSTREAM_FETCH_TIMEOUT_MS, i as assertMcpToolSurfaceConsistent, in as provisionTreeSitterAssets, it as agentToolsEnabled, jn as CHEAP_PROFILE_NATIVE_AGENT_NAMES, kn as CHEAP_PROFILE_ADVISOR_CLIENT_MODEL, ln as toolbeltPathOverride, nt as handleMcpDelete, q as buildOpenAIErrorEvent, qt as MAX_RESPONSE_BODY_BYTES, rt as handleMcpPost, tt as clampEffort, vn as generateRandomPort, wn as classifyMessagesRoute, yn as isBudgetClaudeLead, z as isAdvisorRequested, zt as findLaunchBySecret } from "./peer-mcp-personas-0_XU6nm9.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";
@@ -7,6 +7,7 @@ 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
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-BcrMlrmo.js";
10
+ import { d as formatAic, f as nanoAiuToCredits, r as extractAndRecordAic, s as recordAic, u as extractCopilotUsage } from "./aic-ledger-Cx_Ubon3.js";
10
11
  import consola from "consola";
11
12
  import fs, { existsSync } from "node:fs";
12
13
  import path from "node:path";
@@ -1986,7 +1987,7 @@ function formatTokens(n) {
1986
1987
  /**
1987
1988
  * Build a context window summary: "in:1.2K out:50 ctx:1.2K/1M (0.1%)"
1988
1989
  */
1989
- function formatTokenInfo(inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, model) {
1990
+ function formatTokenInfo(inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, model, aicNano) {
1990
1991
  if (inputTokens === void 0) return void 0;
1991
1992
  const parts = [];
1992
1993
  const maxPrompt = model?.capabilities?.limits?.max_prompt_tokens;
@@ -1996,6 +1997,7 @@ function formatTokenInfo(inputTokens, outputTokens, cacheReadTokens, cacheWriteT
1996
1997
  } else parts.push(`in:${formatTokens(inputTokens)}`);
1997
1998
  if (outputTokens !== void 0) parts.push(`out:${formatTokens(outputTokens)}`);
1998
1999
  if ((cacheReadTokens ?? 0) > 0 || (cacheWriteTokens ?? 0) > 0) parts.push(`cache:r${formatTokens(cacheReadTokens ?? 0)}/w${formatTokens(cacheWriteTokens ?? 0)}`);
2000
+ if ((aicNano ?? 0) > 0) parts.push(`aic:${formatAic(nanoAiuToCredits(aicNano))}`);
1999
2001
  return parts.join(" ");
2000
2002
  }
2001
2003
  /**
@@ -2031,7 +2033,7 @@ function logRequest(info, model, startTime) {
2031
2033
  parts.push(`${info.method} ${info.path}`);
2032
2034
  if (info.resolvedModel && info.resolvedModel !== info.model) parts.push(`${info.model}→${info.resolvedModel}`);
2033
2035
  else if (info.resolvedModel ?? info.model) parts.push(info.resolvedModel ?? info.model);
2034
- const tokenInfo = formatTokenInfo(info.inputTokens, info.outputTokens, info.cacheReadTokens, info.cacheWriteTokens, model);
2036
+ const tokenInfo = formatTokenInfo(info.inputTokens, info.outputTokens, info.cacheReadTokens, info.cacheWriteTokens, model, info.aicNano);
2035
2037
  if (tokenInfo) parts.push(tokenInfo);
2036
2038
  if (info.bodyBytes !== void 0) parts.push(`body:${formatBytes(info.bodyBytes)}`);
2037
2039
  if (info.status !== void 0) parts.push(String(info.status));
@@ -2106,7 +2108,7 @@ function collectToolFieldKeys(body) {
2106
2108
  //#endregion
2107
2109
  //#region package.json
2108
2110
  var name = "github-router";
2109
- var version = "0.3.312";
2111
+ var version = "0.3.314";
2110
2112
  //#endregion
2111
2113
  //#region src/lib/approval.ts
2112
2114
  const awaitApproval = async () => {
@@ -2801,6 +2803,7 @@ async function handleCompletion$1(c) {
2801
2803
  const outputTokens = !isStreaming ? response.usage?.completion_tokens : void 0;
2802
2804
  const rawUsage = !isStreaming ? response.usage : void 0;
2803
2805
  const responseUsage = rawUsage ? normalizeOpenAIUsage(rawUsage) : void 0;
2806
+ const aicNano = !isStreaming ? extractAndRecordAic(resolvedModel, response) : void 0;
2804
2807
  logRequest({
2805
2808
  method: "POST",
2806
2809
  path: c.req.path,
@@ -2810,6 +2813,7 @@ async function handleCompletion$1(c) {
2810
2813
  outputTokens,
2811
2814
  cacheReadTokens: responseUsage?.cacheRead,
2812
2815
  cacheWriteTokens: responseUsage?.cacheWrite,
2816
+ aicNano,
2813
2817
  status: 200,
2814
2818
  streaming: isStreaming
2815
2819
  }, selectedModel, startTime);
@@ -2823,6 +2827,14 @@ async function handleCompletion$1(c) {
2823
2827
  let pendingFirstChunk = firstResult.done ? void 0 : firstResult.value;
2824
2828
  let upstreamFinished = firstResult.done;
2825
2829
  let consumerCancelled = false;
2830
+ let aicRecorded = false;
2831
+ const tapAic = (chunk) => {
2832
+ if (aicRecorded || !chunk.data || chunk.data === "[DONE]") return;
2833
+ try {
2834
+ const parsed = JSON.parse(chunk.data);
2835
+ if (extractAndRecordAic(resolvedModel, parsed) !== void 0) aicRecorded = true;
2836
+ } catch {}
2837
+ };
2826
2838
  const safeClose = (controller) => {
2827
2839
  try {
2828
2840
  controller.close();
@@ -2854,6 +2866,7 @@ async function handleCompletion$1(c) {
2854
2866
  const chunk = pendingFirstChunk;
2855
2867
  pendingFirstChunk = void 0;
2856
2868
  if (debugEnabled) consola.debug("Streaming chunk:", JSON.stringify(chunk));
2869
+ tapAic(chunk);
2857
2870
  safeEnqueue(controller, ENCODER$1.encode(formatSSE$1(chunk)));
2858
2871
  return;
2859
2872
  }
@@ -2870,6 +2883,7 @@ async function handleCompletion$1(c) {
2870
2883
  }
2871
2884
  if (result.value === void 0 || result.value === null) return;
2872
2885
  if (debugEnabled) consola.debug("Streaming chunk:", JSON.stringify(result.value));
2886
+ tapAic(result.value);
2873
2887
  safeEnqueue(controller, ENCODER$1.encode(formatSSE$1(result.value)));
2874
2888
  } catch (error) {
2875
2889
  upstreamFinished = true;
@@ -3285,6 +3299,63 @@ function sanitizeAnthropicBody(rawBody) {
3285
3299
  return JSON.stringify(parsed);
3286
3300
  }
3287
3301
  //#endregion
3302
+ //#region src/lib/aic-sse-tap.ts
3303
+ /**
3304
+ * Incremental SSE tap that extracts upstream `copilot_usage` (AIC) from a
3305
+ * `/v1/messages` byte stream without modifying it.
3306
+ *
3307
+ * Verified live: `copilot_usage` rides inside the terminal `message_delta`
3308
+ * event beside `usage`. Chunks are arbitrary byte splits, so the tap buffers
3309
+ * text, splits on blank-line event boundaries, and keeps the tail. Recording
3310
+ * fires at most once per tap instance (one terminal event per stream).
3311
+ *
3312
+ * Total and never throws — a malformed frame is skipped silently. The relay
3313
+ * path additionally wraps the call in try/catch, so a tap bug can never break
3314
+ * byte delivery.
3315
+ */
3316
+ function createAnthropicAicTap(record) {
3317
+ const decoder = new TextDecoder();
3318
+ let buffer = "";
3319
+ let recorded = false;
3320
+ const handleEvent = (rawEvent) => {
3321
+ if (recorded) return;
3322
+ const lines = rawEvent.split("\n");
3323
+ let eventName = "";
3324
+ const dataLines = [];
3325
+ for (const line of lines) if (line.startsWith("event:")) eventName = line.slice(6).trim();
3326
+ else if (line.startsWith("data:")) dataLines.push(line.slice(5).trimStart());
3327
+ if (eventName !== "" && eventName !== "message_delta") return;
3328
+ if (dataLines.length === 0) return;
3329
+ if (!(dataLines[0] ?? "").startsWith("{")) return;
3330
+ try {
3331
+ const parsed = JSON.parse(dataLines.join("\n"));
3332
+ const usage = extractCopilotUsage(parsed.copilot_usage);
3333
+ if (usage) {
3334
+ recorded = true;
3335
+ try {
3336
+ record(usage);
3337
+ } catch {}
3338
+ }
3339
+ } catch {}
3340
+ };
3341
+ return { onBytes(bytes) {
3342
+ if (recorded || bytes.length === 0) return;
3343
+ buffer += decoder.decode(bytes, { stream: true });
3344
+ let boundary = buffer.indexOf("\n\n");
3345
+ while (boundary >= 0) {
3346
+ const rawEvent = buffer.slice(0, boundary);
3347
+ buffer = buffer.slice(boundary + 2);
3348
+ handleEvent(rawEvent);
3349
+ if (recorded) {
3350
+ buffer = "";
3351
+ return;
3352
+ }
3353
+ boundary = buffer.indexOf("\n\n");
3354
+ }
3355
+ if (buffer.length > 1048576) buffer = "";
3356
+ } };
3357
+ }
3358
+ //#endregion
3288
3359
  //#region src/lib/anthropic-translate/anthropic-sse.ts
3289
3360
  /**
3290
3361
  * Anthropic Messages SSE egress: frame builders + a Bun-safe ReadableStream
@@ -4215,6 +4286,7 @@ function chatStopReason(finishReason, sawTool) {
4215
4286
  * and each `message.tool_calls[]` becomes a tool_use block.
4216
4287
  */
4217
4288
  function chatResponseToAnthropicMessage(resp, modelId) {
4289
+ extractAndRecordAic(modelId, resp);
4218
4290
  const choice = resp.choices?.[0];
4219
4291
  const content = [];
4220
4292
  let sawTool = false;
@@ -4277,6 +4349,7 @@ async function* synthAnthropicFromChat(upstream, opts) {
4277
4349
  let usageOut = 0;
4278
4350
  let usageCacheRead = 0;
4279
4351
  let usageCacheWrite = 0;
4352
+ let aicRecorded = false;
4280
4353
  let finishReason = null;
4281
4354
  let sawDone = false;
4282
4355
  yield makeMessageStart(messageId, opts.modelId);
@@ -4293,6 +4366,9 @@ async function* synthAnthropicFromChat(upstream, opts) {
4293
4366
  } catch {
4294
4367
  continue;
4295
4368
  }
4369
+ if (!aicRecorded) {
4370
+ if (extractAndRecordAic(opts.modelId, chunk) !== void 0) aicRecorded = true;
4371
+ }
4296
4372
  if (chunk.usage) {
4297
4373
  usageIn = Math.max(usageIn, chunk.usage.prompt_tokens ?? 0);
4298
4374
  usageOut = Math.max(usageOut, chunk.usage.completion_tokens ?? 0);
@@ -4455,6 +4531,7 @@ function parseToolArgs(raw) {
4455
4531
  * else `end_turn`.
4456
4532
  */
4457
4533
  function responsesResponseToAnthropicMessage(resp, modelId) {
4534
+ extractAndRecordAic(modelId, resp);
4458
4535
  const output = Array.isArray(resp.output) ? resp.output : [];
4459
4536
  const content = [];
4460
4537
  let sawToolUse = false;
@@ -4532,6 +4609,7 @@ async function* synthAnthropicFromResponses(upstream, opts) {
4532
4609
  let sawTool = false;
4533
4610
  let hitMaxTokens = false;
4534
4611
  let sawTerminal = false;
4612
+ let aicRecorded = false;
4535
4613
  const closeCurrent = () => {
4536
4614
  if (!current) return;
4537
4615
  q.push(makeContentBlockStop(current.index));
@@ -4701,6 +4779,9 @@ async function* synthAnthropicFromResponses(upstream, opts) {
4701
4779
  case "response.completed":
4702
4780
  case "response.incomplete": {
4703
4781
  sawTerminal = true;
4782
+ if (!aicRecorded) {
4783
+ if (extractAndRecordAic(opts.modelId, ev) !== void 0) aicRecorded = true;
4784
+ }
4704
4785
  const u = ev.response?.usage;
4705
4786
  if (u) {
4706
4787
  usageIn = Math.max(usageIn, u.input_tokens ?? 0);
@@ -5891,7 +5972,10 @@ async function handleCompletion(c) {
5891
5972
  headers: streamHeaders
5892
5973
  });
5893
5974
  }
5894
- return new Response(response.body ? relayAnthropicStream(response.body, { routePath: c.req.path }) : null, {
5975
+ return new Response(response.body ? relayAnthropicStream(response.body, {
5976
+ routePath: c.req.path,
5977
+ onBytes: createAnthropicAicTap((usage) => recordAic(resolvedModel, usage)).onBytes
5978
+ }) : null, {
5895
5979
  status: response.status,
5896
5980
  headers: streamHeaders
5897
5981
  });
@@ -5900,6 +5984,7 @@ async function handleCompletion(c) {
5900
5984
  if (!cappedResult.ok) return c.json(cappedResult.errorResponse, cappedResult.status);
5901
5985
  const responseBody = cappedResult.value;
5902
5986
  const usage = responseBody.usage;
5987
+ const aicNano = extractAndRecordAic(resolvedModel, responseBody);
5903
5988
  logRequest({
5904
5989
  method: "POST",
5905
5990
  path: c.req.path,
@@ -5909,6 +5994,7 @@ async function handleCompletion(c) {
5909
5994
  outputTokens: usage?.output_tokens,
5910
5995
  cacheReadTokens: usage?.cache_read_input_tokens,
5911
5996
  cacheWriteTokens: usage?.cache_creation_input_tokens,
5997
+ aicNano,
5912
5998
  status: response.status
5913
5999
  }, selectedModel, startTime);
5914
6000
  if (debugEnabled) consola.debug("Non-streaming response from Copilot /v1/messages:", JSON.stringify(responseBody).slice(0, 2e3));
@@ -6470,6 +6556,7 @@ async function handleResponses(c) {
6470
6556
  const isStreaming = !isNonStreaming(response);
6471
6557
  const rawUsage = !isStreaming ? response.usage : void 0;
6472
6558
  const responseUsage = rawUsage && typeof rawUsage === "object" && !Array.isArray(rawUsage) ? normalizeOpenAIUsage(rawUsage) : void 0;
6559
+ const aicNano = !isStreaming ? extractAndRecordAic(resolvedModel, response) : void 0;
6473
6560
  logRequest({
6474
6561
  method: "POST",
6475
6562
  path: c.req.path,
@@ -6479,6 +6566,7 @@ async function handleResponses(c) {
6479
6566
  outputTokens: responseUsage?.output,
6480
6567
  cacheReadTokens: responseUsage?.cacheRead,
6481
6568
  cacheWriteTokens: responseUsage?.cacheWrite,
6569
+ aicNano,
6482
6570
  status: 200,
6483
6571
  streaming: isStreaming
6484
6572
  }, selectedModel, startTime);
@@ -6514,6 +6602,15 @@ async function handleResponses(c) {
6514
6602
  if (firstChunk === void 0) consola.warn(`Upstream /responses returned no payload events at ${c.req.path}`);
6515
6603
  let pendingFirstChunk = firstChunk;
6516
6604
  let consumerCancelled = false;
6605
+ let aicRecorded = false;
6606
+ const tapAic = (chunk) => {
6607
+ if (aicRecorded || !chunk.data || chunk.data === "[DONE]") return;
6608
+ try {
6609
+ const parsed = JSON.parse(chunk.data);
6610
+ if (extractAndRecordAic(resolvedModel, parsed) !== void 0) aicRecorded = true;
6611
+ } catch {}
6612
+ };
6613
+ if (pendingFirstChunk !== void 0) tapAic(pendingFirstChunk);
6517
6614
  const safeClose = (controller) => {
6518
6615
  try {
6519
6616
  controller.close();
@@ -6545,6 +6642,7 @@ async function handleResponses(c) {
6545
6642
  const chunk = pendingFirstChunk;
6546
6643
  pendingFirstChunk = void 0;
6547
6644
  if (debugEnabled) consola.debug("Streaming chunk:", JSON.stringify(chunk));
6645
+ tapAic(chunk);
6548
6646
  safeEnqueue(controller, ENCODER.encode(formatSSE(chunk)));
6549
6647
  return;
6550
6648
  }
@@ -6567,6 +6665,7 @@ async function handleResponses(c) {
6567
6665
  }
6568
6666
  if (!result.value.data) return;
6569
6667
  if (debugEnabled) consola.debug("Streaming chunk:", JSON.stringify(result.value));
6668
+ tapAic(result.value);
6570
6669
  safeEnqueue(controller, ENCODER.encode(formatSSE(result.value)));
6571
6670
  } catch (error) {
6572
6671
  upstreamFinished = true;
@@ -7425,4 +7524,4 @@ function getCodexEnvVars(serverUrl) {
7425
7524
  //#endregion
7426
7525
  export { checkClaudeVersion as C, runSelfUpdate as S, resolveLaunchProfile as _, sharedServerArgs as a, validateFastProfilePrerequisites as b, stopKeepAwake as c, enableFileLogging as d, LUNA_SCOUT_ALIAS_ID as f, profileDescriptor as g, formatFastPrerequisiteFailure as h, setupAndServe as i, injectModelPickerSettingsFile as l, formatCheapPrerequisiteFailure as m, getCodexEnvVars as n, LAUNCH_SECRET_HEADER as o, formatCheap1mPrerequisiteFailure as p, parseSharedArgs as r, startKeepAwake as s, getClaudeCodeEnvVars as t, listModelsForEndpoint as u, validateCheap1mProfilePrerequisites as v, updateClaude as w, validateMaxProfileLaunch as x, validateCheapProfilePrerequisites as y };
7427
7526
 
7428
- //# sourceMappingURL=server-setup-DX27fdcf.js.map
7527
+ //# sourceMappingURL=server-setup-CP8nGop3.js.map