glimmervoid 0.46.2-next.156 → 0.46.2-next.158

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 (88) hide show
  1. package/dist/bin/glimmervoid.js +8 -8
  2. package/dist/chunks/{adapters-DsZUuh-H.js → adapters-COeELdKT.js} +341 -5
  3. package/dist/chunks/{adapters-DNc4Y-vV.js → adapters-CnInGTuC.js} +1 -1
  4. package/dist/chunks/{agent-api-cli-MZ90f4jg.js → agent-api-cli-DOzlY0Hz.js} +1 -1
  5. package/dist/chunks/{agent-api-cli-BSDYHgZR.js → agent-api-cli-bNlTz-7w.js} +1 -1
  6. package/dist/chunks/{agent-api-core-CKgp5EgK.js → agent-api-core-jge0D-nX.js} +1 -1
  7. package/dist/chunks/{build-channel-Cfr6JMdE.js → build-channel-DJ1dJt9u.js} +1 -1
  8. package/dist/chunks/{config-BOQu9rsc.js → config-CfYYorC4.js} +5 -1
  9. package/dist/chunks/{config-store-BhiA04q3.js → config-store-BDnviJpb.js} +15 -2
  10. package/dist/chunks/config-store-D2i_r1cn.js +1 -0
  11. package/dist/chunks/{main-DW32Zxu2.js → main-DVqugKl7.js} +89 -316
  12. package/dist/chunks/{pair-cli-B5oHJtT_.js → pair-cli-06TbsthF.js} +2 -2
  13. package/dist/chunks/{remote-config-B3EMYIN8.js → remote-config-DCeelB8P.js} +1 -1
  14. package/dist/chunks/{settings-cli-Df_djhIH.js → settings-cli-iqcvii_8.js} +4 -4
  15. package/dist/chunks/{settings-readout-core-Cg24xDa1.js → settings-readout-core-DQ07GLzg.js} +1 -1
  16. package/dist/chunks/{ssh-sign-cli-D1Inrd9W.js → ssh-sign-cli-C0Zm53au.js} +1 -1
  17. package/dist/client/assets/{alert-sound-BGkAz4t6.js → alert-sound-kQn89uDA.js} +1 -1
  18. package/dist/client/assets/alert-sound-kQn89uDA.js.br +0 -0
  19. package/dist/client/assets/{benchmark-panel-B0ozm-Uf.js → benchmark-panel-Bcfl-wED.js} +1 -1
  20. package/dist/client/assets/benchmark-panel-Bcfl-wED.js.br +0 -0
  21. package/dist/client/assets/{celebration-player-Cqnk9IBz.js → celebration-player-DS4zCylh.js} +1 -1
  22. package/dist/client/assets/celebration-player-DS4zCylh.js.br +0 -0
  23. package/dist/client/assets/{dialogs-CBGMH_ea.js → dialogs-D1jEbe5_.js} +1 -1
  24. package/dist/client/assets/dialogs-D1jEbe5_.js.br +0 -0
  25. package/dist/client/assets/{doc-editor-ui-DGk6jjFx.js → doc-editor-ui-DN4_Ck4e.js} +1 -1
  26. package/dist/client/assets/doc-editor-ui-DN4_Ck4e.js.br +0 -0
  27. package/dist/client/assets/{first-run-checklist-CbJqge87.js → first-run-checklist-DAF4_CNF.js} +1 -1
  28. package/dist/client/assets/first-run-checklist-DAF4_CNF.js.br +0 -0
  29. package/dist/client/assets/{hooks-panel-BFqxntjJ.js → hooks-panel-BO0SRLyV.js} +1 -1
  30. package/dist/client/assets/hooks-panel-BO0SRLyV.js.br +0 -0
  31. package/dist/client/assets/{index-Bp7_Pu27.js → index-C6tV2GUb.js} +5 -5
  32. package/dist/client/assets/index-C6tV2GUb.js.br +0 -0
  33. package/dist/client/assets/{issues-panel-DBsCdDin.js → issues-panel-DlVw1O2m.js} +1 -1
  34. package/dist/client/assets/issues-panel-DlVw1O2m.js.br +0 -0
  35. package/dist/client/assets/{nyan-cat-B2F_vZs8.js → nyan-cat-kPngS_rY.js} +1 -1
  36. package/dist/client/assets/nyan-cat-kPngS_rY.js.br +0 -0
  37. package/dist/client/assets/{phone-shell-5JYRbGML.js → phone-shell-C-_8HTyj.js} +1 -1
  38. package/dist/client/assets/phone-shell-C-_8HTyj.js.br +0 -0
  39. package/dist/client/assets/{plan-face-D_jH7k1g.js → plan-face-BxGvGv8B.js} +1 -1
  40. package/dist/client/assets/plan-face-BxGvGv8B.js.br +0 -0
  41. package/dist/client/assets/{plan-render-ZW003yyC.js → plan-render-DGtHH5Hc.js} +1 -1
  42. package/dist/client/assets/plan-render-DGtHH5Hc.js.br +0 -0
  43. package/dist/client/assets/{pr-scope-tabs-K46wSLhh.js → pr-scope-tabs-yFzI-kcR.js} +1 -1
  44. package/dist/client/assets/pr-scope-tabs-yFzI-kcR.js.br +0 -0
  45. package/dist/client/assets/{radar-panel-XXMoF1g_.js → radar-panel-WLZFruDo.js} +1 -1
  46. package/dist/client/assets/radar-panel-WLZFruDo.js.br +0 -0
  47. package/dist/client/assets/{resume-dialog-BQWMGoFW.js → resume-dialog-Bnu1qbub.js} +1 -1
  48. package/dist/client/assets/resume-dialog-Bnu1qbub.js.br +0 -0
  49. package/dist/client/assets/{review-queue-panel-BJy7arsj.js → review-queue-panel-DucWygCs.js} +1 -1
  50. package/dist/client/assets/review-queue-panel-DucWygCs.js.br +0 -0
  51. package/dist/client/assets/settings-panel-DfMtb0de.js +4 -0
  52. package/dist/client/assets/settings-panel-DfMtb0de.js.br +0 -0
  53. package/dist/client/assets/{shown-lightbox-BPwnZ6Zj.js → shown-lightbox-BMHRPF9l.js} +1 -1
  54. package/dist/client/assets/shown-lightbox-BMHRPF9l.js.br +0 -0
  55. package/dist/client/assets/{trace-panel-CJdgaYZP.js → trace-panel-BqYtLWF8.js} +1 -1
  56. package/dist/client/assets/trace-panel-BqYtLWF8.js.br +0 -0
  57. package/dist/client/assets/{usage-panel-BsdQgZEl.js → usage-panel-BebJiBqc.js} +1 -1
  58. package/dist/client/assets/usage-panel-BebJiBqc.js.br +0 -0
  59. package/dist/client/assets/{visions-panel-C0On5erO.js → visions-panel-dXg3UhT0.js} +1 -1
  60. package/dist/client/assets/visions-panel-dXg3UhT0.js.br +0 -0
  61. package/dist/client/index.html +1 -1
  62. package/dist/client/index.html.br +0 -0
  63. package/dist/server/index.js +1 -1
  64. package/package.json +1 -1
  65. package/dist/chunks/config-store-BtazOb6G.js +0 -1
  66. package/dist/client/assets/alert-sound-BGkAz4t6.js.br +0 -0
  67. package/dist/client/assets/benchmark-panel-B0ozm-Uf.js.br +0 -0
  68. package/dist/client/assets/celebration-player-Cqnk9IBz.js.br +0 -0
  69. package/dist/client/assets/dialogs-CBGMH_ea.js.br +0 -0
  70. package/dist/client/assets/doc-editor-ui-DGk6jjFx.js.br +0 -0
  71. package/dist/client/assets/first-run-checklist-CbJqge87.js.br +0 -0
  72. package/dist/client/assets/hooks-panel-BFqxntjJ.js.br +0 -0
  73. package/dist/client/assets/index-Bp7_Pu27.js.br +0 -0
  74. package/dist/client/assets/issues-panel-DBsCdDin.js.br +0 -0
  75. package/dist/client/assets/nyan-cat-B2F_vZs8.js.br +0 -0
  76. package/dist/client/assets/phone-shell-5JYRbGML.js.br +0 -0
  77. package/dist/client/assets/plan-face-D_jH7k1g.js.br +0 -0
  78. package/dist/client/assets/plan-render-ZW003yyC.js.br +0 -0
  79. package/dist/client/assets/pr-scope-tabs-K46wSLhh.js.br +0 -0
  80. package/dist/client/assets/radar-panel-XXMoF1g_.js.br +0 -0
  81. package/dist/client/assets/resume-dialog-BQWMGoFW.js.br +0 -0
  82. package/dist/client/assets/review-queue-panel-BJy7arsj.js.br +0 -0
  83. package/dist/client/assets/settings-panel-Blzu_YZ9.js +0 -4
  84. package/dist/client/assets/settings-panel-Blzu_YZ9.js.br +0 -0
  85. package/dist/client/assets/shown-lightbox-BPwnZ6Zj.js.br +0 -0
  86. package/dist/client/assets/trace-panel-CJdgaYZP.js.br +0 -0
  87. package/dist/client/assets/usage-panel-BsdQgZEl.js.br +0 -0
  88. package/dist/client/assets/visions-panel-C0On5erO.js.br +0 -0
@@ -5,7 +5,7 @@ import { o as packageRoot } from "../chunks/runtime-paths-ghcH9CeW.js";
5
5
  import { n as glimmervoidHomeDir, t as decideConfigPath } from "../chunks/config-path-core-DUWk0Lui.js";
6
6
  import { t as AGENT_API_VERBS } from "../chunks/session-B2Wieg0a.js";
7
7
  import { i as execSync } from "../chunks/child-process-safe-D4hyVIXj.js";
8
- import { r as agentCommandHelpLines } from "../chunks/agent-api-core-CKgp5EgK.js";
8
+ import { r as agentCommandHelpLines } from "../chunks/agent-api-core-jge0D-nX.js";
9
9
  import { t as renderTable } from "../chunks/ascii-figure-core-pDAwtlKO.js";
10
10
  import { i as parseCommandLine, r as gitDoctorRows, t as probeGitVersion } from "../chunks/git-version-WyrLHANY.js";
11
11
  import { i as guardrailsDoctorRows, r as probeGuardrailsDependencies } from "../chunks/guardrails-deps-BjPzk1rE.js";
@@ -66,7 +66,7 @@ var OWN_SUBCOMMAND_RUNNERS = [
66
66
  return 0;
67
67
  }],
68
68
  ["pair", async (subcommandArgs) => {
69
- const { runPairCli } = await import("../chunks/pair-cli-B5oHJtT_.js");
69
+ const { runPairCli } = await import("../chunks/pair-cli-06TbsthF.js");
70
70
  return runPairCli(subcommandArgs);
71
71
  }],
72
72
  ["agent", async (subcommandArgs) => {
@@ -74,7 +74,7 @@ var OWN_SUBCOMMAND_RUNNERS = [
74
74
  return runAgentSetupCli(subcommandArgs);
75
75
  }],
76
76
  ["settings", async (subcommandArgs) => {
77
- const { runSettingsCli } = await import("../chunks/settings-cli-Df_djhIH.js");
77
+ const { runSettingsCli } = await import("../chunks/settings-cli-iqcvii_8.js");
78
78
  return runSettingsCli(subcommandArgs);
79
79
  }],
80
80
  ["visions", async (subcommandArgs) => {
@@ -82,13 +82,13 @@ var OWN_SUBCOMMAND_RUNNERS = [
82
82
  return runVisionsCli(subcommandArgs);
83
83
  }],
84
84
  ["ssh-sign", async (subcommandArgs) => {
85
- const { runSshSignCli } = await import("../chunks/ssh-sign-cli-D1Inrd9W.js");
85
+ const { runSshSignCli } = await import("../chunks/ssh-sign-cli-C0Zm53au.js");
86
86
  return runSshSignCli(subcommandArgs);
87
87
  }]
88
88
  ];
89
89
  var ownSubcommandNames = new Set(OWN_SUBCOMMAND_RUNNERS.map(([name]) => name));
90
90
  var SUBCOMMAND_RUNNERS = new Map([...OWN_SUBCOMMAND_RUNNERS, ...AGENT_API_VERBS.filter((verb) => !ownSubcommandNames.has(verb)).map((verb) => [verb, async (subcommandArgs, subcommandName) => {
91
- const { runAgentApiCli } = await import("../chunks/agent-api-cli-BSDYHgZR.js");
91
+ const { runAgentApiCli } = await import("../chunks/agent-api-cli-bNlTz-7w.js");
92
92
  return runAgentApiCli([subcommandName, ...subcommandArgs]);
93
93
  }])]);
94
94
  var AGENT_INSTALL_COMMAND_BY_ID = {
@@ -102,7 +102,7 @@ function missingAgentText(agentId) {
102
102
  }
103
103
  async function printSessionLimits() {
104
104
  if (!process.env["GLIMMERVOID_AGENT_URL"]) return;
105
- const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-BSDYHgZR.js");
105
+ const { sessionLimitsHelpLines } = await import("../chunks/agent-api-cli-bNlTz-7w.js");
106
106
  const limitsLines = await sessionLimitsHelpLines();
107
107
  console.log(`\n${limitsLines.join("\n")}`);
108
108
  }
@@ -159,7 +159,7 @@ async function readDeclaredCustomAgents() {
159
159
  declared: [],
160
160
  error: null
161
161
  };
162
- const { loadConfigFile } = await import("../chunks/config-store-BtazOb6G.js");
162
+ const { loadConfigFile } = await import("../chunks/config-store-D2i_r1cn.js");
163
163
  try {
164
164
  const loaded = loadConfigFile(decided.path, { exitOnError: false });
165
165
  if (!loaded.config) return {
@@ -235,7 +235,7 @@ async function runDoctor() {
235
235
  }
236
236
  switchSection("Agents");
237
237
  try {
238
- const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-DNc4Y-vV.js");
238
+ const { listAgentIds, describeAgentResolvability, setCustomAgents } = await import("../chunks/adapters-CnInGTuC.js");
239
239
  const declaredCustomAgents = await readDeclaredCustomAgents();
240
240
  if (declaredCustomAgents.error) line("config", declaredCustomAgents.error);
241
241
  setCustomAgents(declaredCustomAgents.declared);
@@ -1,14 +1,15 @@
1
1
  import { s as relayPath } from "./runtime-paths-ghcH9CeW.js";
2
2
  import { Lt as FULL_SHA_RE, zt as shortSha$1 } from "./session-B2Wieg0a.js";
3
3
  import { n as execFileAsync, r as execFileSync } from "./child-process-safe-D4hyVIXj.js";
4
- import { b as InstallFlavor, mt as UpdateChannel } from "./config-BOQu9rsc.js";
4
+ import { b as InstallFlavor, mt as UpdateChannel } from "./config-CfYYorC4.js";
5
5
  import { o as supervisionLine } from "./session-routes-Cr9S--Nf.js";
6
- import { c as textOr, s as rawTextOr } from "./coerce-NSst8oRP.js";
6
+ import { c as textOr, i as numberOr, s as rawTextOr } from "./coerce-NSst8oRP.js";
7
7
  import { n as resolveAgentCommand, t as buildAgentSpawnCommand } from "./spawn-command-Cc40FiZI.js";
8
+ import { n as parseJsonRecord } from "./json-core-dfa_7Fak.js";
8
9
  import { r as nextBackoffMs } from "./backoff-DjVpfHk7.js";
9
10
  import { a as classifyAgentTitle, i as grok, o as isBrailleChar, s as isSpinnerChar, t as kimi, u as buildAgentEnv } from "./kimi-VBamp5vp.js";
10
11
  import { t as buildHookCommand } from "./hook-command-core-qTNK-xMF.js";
11
- import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-Cfr6JMdE.js";
12
+ import { n as isExperimentalBuild, t as compareReleaseVersions } from "./build-channel-DJ1dJt9u.js";
12
13
  import { n as mergeCodexPreToolUse, t as HOOK_TOOLS } from "./hook-tools-Cr97Vdap.js";
13
14
  import fs from "node:fs";
14
15
  import path from "node:path";
@@ -210,6 +211,337 @@ var claudeCode = {
210
211
  mapHookPromptToolName
211
212
  };
212
213
  //#endregion
214
+ //#region server/usage/core/usage-entry-core.ts
215
+ var NULL_REJECT_FIELDS = Object.freeze([
216
+ ["id"],
217
+ ["cwd"],
218
+ ["version"],
219
+ ["costUSD"],
220
+ ["sessionId"],
221
+ ["requestId"],
222
+ ["isApiErrorMessage"],
223
+ ["message", "id"],
224
+ ["message", "model"],
225
+ [
226
+ "message",
227
+ "usage",
228
+ "speed"
229
+ ],
230
+ [
231
+ "message",
232
+ "usage",
233
+ "costUSD"
234
+ ],
235
+ [
236
+ "message",
237
+ "usage",
238
+ "cache_read_input_tokens"
239
+ ],
240
+ [
241
+ "message",
242
+ "usage",
243
+ "cache_creation_input_tokens"
244
+ ]
245
+ ]);
246
+ function parseJsonLine(line, requiredSubstring) {
247
+ if (typeof line !== "string") return null;
248
+ if (requiredSubstring && !line.includes(requiredSubstring)) return null;
249
+ return parseJsonRecord(line, { admitArrays: true });
250
+ }
251
+ function parseUsageLine(line, { versionPrefix } = {}) {
252
+ const raw = parseJsonLine(line, "\"usage\":{");
253
+ if (!raw) return null;
254
+ const parsed = raw;
255
+ if (hasExplicitNull(parsed)) return null;
256
+ if (!versionIsAccepted(parsed.version, versionPrefix)) return null;
257
+ if (hasPresentEmptyIdentity(parsed)) return null;
258
+ const message = parsed.message;
259
+ if (!message || typeof message !== "object") return null;
260
+ if (typeof message.model === "string" && message.model.trim() === "") return null;
261
+ const rawUsage = message.usage;
262
+ if (!rawUsage || typeof rawUsage !== "object") return null;
263
+ const usage = rawUsage;
264
+ const timestampMs = Date.parse(String(parsed.timestamp));
265
+ if (!Number.isFinite(timestampMs)) return null;
266
+ const rawModel = message.model === "<synthetic>" ? null : rawTextOr(message.model, null);
267
+ const speed = rawTextOr(usage.speed, null);
268
+ return {
269
+ timestamp: new Date(timestampMs).toISOString(),
270
+ timestampMs,
271
+ cwd: rawTextOr(parsed.cwd, null),
272
+ version: rawTextOr(parsed.version, null),
273
+ sessionId: rawTextOr(parsed.sessionId, null),
274
+ requestId: rawTextOr(parsed.requestId, null),
275
+ messageId: rawTextOr(message.id, null),
276
+ model: modelWithSpeed(rawModel, speed),
277
+ rawModel,
278
+ speed,
279
+ isSidechain: parsed.isSidechain === true,
280
+ costUSD: numberOr(parsed.costUSD, null) ?? numberOr(usage.costUSD, null),
281
+ ...tokenCountsFromUsage(usage),
282
+ iterations: Array.isArray(usage.iterations) ? usage.iterations : []
283
+ };
284
+ }
285
+ function expandAdvisorIterations(entry) {
286
+ if (!entry || !Array.isArray(entry.iterations)) return [];
287
+ const advisorEntries = [];
288
+ for (let iterationIndex = 0; iterationIndex < entry.iterations.length; iterationIndex += 1) {
289
+ const iteration = entry.iterations[iterationIndex];
290
+ if (!iteration || iteration.type !== "advisor_message") continue;
291
+ const rawIterationUsage = iteration.usage || iteration.message?.usage || iteration;
292
+ if (!rawIterationUsage || typeof rawIterationUsage !== "object") continue;
293
+ const usage = rawIterationUsage;
294
+ const rawModel = iteration.message?.model === "<synthetic>" ? null : rawTextOr(iteration.message?.model, null) || entry.rawModel || null;
295
+ const speed = rawTextOr(usage.speed, null) || entry.speed || null;
296
+ advisorEntries.push({
297
+ ...entry,
298
+ messageId: entry.messageId ? `${entry.messageId}:advisor:${iterationIndex}` : null,
299
+ model: modelWithSpeed(rawModel, speed),
300
+ rawModel,
301
+ speed,
302
+ costUSD: null,
303
+ ...tokenCountsFromUsage(usage),
304
+ iterations: [],
305
+ isAdvisor: true
306
+ });
307
+ }
308
+ return advisorEntries;
309
+ }
310
+ function identityFromRelPath(relPath) {
311
+ const parts = String(relPath || "").replace(/\\/g, "/").split("/").filter(Boolean);
312
+ const jsonlIndex = parts.findIndex((part) => part.endsWith(".jsonl"));
313
+ const projectPartsEnd = parts[0] === "projects" ? 2 : 1;
314
+ const project = parts.slice(parts[0] === "projects" ? 1 : 0, projectPartsEnd).join("/") || null;
315
+ if (jsonlIndex === -1) return {
316
+ project,
317
+ sessionId: null
318
+ };
319
+ const subagentsIndex = parts.indexOf("subagents");
320
+ if (subagentsIndex > 0) return {
321
+ project,
322
+ sessionId: parts[subagentsIndex - 1] || null
323
+ };
324
+ return {
325
+ project,
326
+ sessionId: path.basename(parts[jsonlIndex], ".jsonl") || null
327
+ };
328
+ }
329
+ function dedupKeys(entry) {
330
+ if (!entry || !entry.messageId) return {
331
+ primary: null,
332
+ collision: null
333
+ };
334
+ return {
335
+ primary: entry.requestId ? `${entry.messageId}:${entry.requestId}` : entry.messageId,
336
+ collision: entry.messageId
337
+ };
338
+ }
339
+ function shouldReplace(existing, candidate) {
340
+ if (!existing) return true;
341
+ if (!candidate) return false;
342
+ if (existing.isSidechain && !candidate.isSidechain) return true;
343
+ if (!existing.isSidechain && candidate.isSidechain) return false;
344
+ const existingTokens = totalTokensOf(existing);
345
+ const candidateTokens = totalTokensOf(candidate);
346
+ if (candidateTokens > existingTokens) return true;
347
+ if (candidateTokens < existingTokens) return false;
348
+ return !existing.speed && Boolean(candidate.speed);
349
+ }
350
+ function totalTokensOf(entry) {
351
+ if (!entry) return 0;
352
+ return numberOr(entry.input, 0) + numberOr(entry.output, 0) + numberOr(entry.cacheCreate, 0) + numberOr(entry.cacheRead, 0);
353
+ }
354
+ var UNKNOWN_GENERATION_MODEL = "unknown";
355
+ var GENERATION_RECENCY_WINDOW_MS = 864e5;
356
+ function isWithinGenerationRecencyWindow(entry, nowMs) {
357
+ const { timestampMs } = entry;
358
+ if (typeof timestampMs !== "number" || !Number.isFinite(timestampMs)) return false;
359
+ return nowMs - timestampMs <= GENERATION_RECENCY_WINDOW_MS;
360
+ }
361
+ function addCountsToGenerationRollup(rowsByKey, entry, pricedModelKey, counts) {
362
+ const sessionId = entry.sessionId ?? "";
363
+ const model = pricedModelKey ?? UNKNOWN_GENERATION_MODEL;
364
+ const key = JSON.stringify([sessionId, model]);
365
+ const row = rowsByKey.get(key) ?? {
366
+ sessionId,
367
+ model,
368
+ vendor: entry.vendor?.trim() || "claude",
369
+ input: 0,
370
+ output: 0,
371
+ cacheRead: 0,
372
+ cacheCreate: 0,
373
+ costUSD: 0,
374
+ hasKnownCost: false,
375
+ isModelKnown: pricedModelKey !== null
376
+ };
377
+ row.input += counts.input;
378
+ row.output += counts.output;
379
+ row.cacheRead += counts.cacheRead;
380
+ row.cacheCreate += counts.cacheCreate;
381
+ row.costUSD += counts.costUSD;
382
+ row.hasKnownCost = row.hasKnownCost || counts.costUSD > 0;
383
+ rowsByKey.set(key, row);
384
+ }
385
+ function foldEntryIntoGenerationRollup(rowsByKey, entry, pricedModelKey) {
386
+ addCountsToGenerationRollup(rowsByKey, entry, pricedModelKey, {
387
+ input: numberOr(entry.input, 0),
388
+ output: numberOr(entry.output, 0),
389
+ cacheRead: numberOr(entry.cacheRead, 0),
390
+ cacheCreate: numberOr(entry.cacheCreate, 0),
391
+ costUSD: numberOr(entry.costUSD, 0)
392
+ });
393
+ }
394
+ function foldReplacementIntoGenerationRollup(rowsByKey, replacedEntry, replacementEntry, pricedModelKey) {
395
+ const growthOf = (field) => Math.max(0, numberOr(replacementEntry[field], 0) - numberOr(replacedEntry[field], 0));
396
+ addCountsToGenerationRollup(rowsByKey, replacementEntry, pricedModelKey, {
397
+ input: growthOf("input"),
398
+ output: growthOf("output"),
399
+ cacheRead: growthOf("cacheRead"),
400
+ cacheCreate: growthOf("cacheCreate"),
401
+ costUSD: growthOf("costUSD")
402
+ });
403
+ }
404
+ function mergeGenerationRollups(targetRowsByKey, sourceRowsByKey) {
405
+ for (const [key, sourceRow] of sourceRowsByKey) {
406
+ const targetRow = targetRowsByKey.get(key);
407
+ if (!targetRow) {
408
+ targetRowsByKey.set(key, { ...sourceRow });
409
+ continue;
410
+ }
411
+ targetRow.input += sourceRow.input;
412
+ targetRow.output += sourceRow.output;
413
+ targetRow.cacheRead += sourceRow.cacheRead;
414
+ targetRow.cacheCreate += sourceRow.cacheCreate;
415
+ targetRow.costUSD += sourceRow.costUSD;
416
+ targetRow.hasKnownCost = targetRow.hasKnownCost || sourceRow.hasKnownCost;
417
+ }
418
+ }
419
+ function emptyTotals() {
420
+ return {
421
+ tokens: 0,
422
+ costUSD: 0,
423
+ input: 0,
424
+ output: 0,
425
+ cacheCreate: 0,
426
+ cacheRead: 0
427
+ };
428
+ }
429
+ function addEntryToTotals(totals, entry, tokens = totalTokensOf(entry)) {
430
+ totals.input += numberOr(entry.input, 0);
431
+ totals.output += numberOr(entry.output, 0);
432
+ totals.cacheCreate += numberOr(entry.cacheCreate, 0);
433
+ totals.cacheRead += numberOr(entry.cacheRead, 0);
434
+ totals.tokens += tokens;
435
+ totals.costUSD += numberOr(entry.costUSD, 0);
436
+ }
437
+ function vendorUsageEntry({ timestampMs, sessionId, model, input, output, cacheCreate, cacheRead, costUSD, vendor, messageId = null }) {
438
+ return {
439
+ timestamp: new Date(timestampMs).toISOString(),
440
+ timestampMs,
441
+ sessionId,
442
+ model,
443
+ input,
444
+ output,
445
+ cacheCreate,
446
+ cacheCreation5m: 0,
447
+ cacheCreation1h: 0,
448
+ cacheRead,
449
+ costUSD,
450
+ vendor,
451
+ messageId,
452
+ requestId: null,
453
+ isSidechain: false
454
+ };
455
+ }
456
+ function modelWithSpeed(rawModel, speed) {
457
+ if (!rawModel || speed !== "fast" || rawModel.endsWith("-fast")) return rawModel;
458
+ return `${rawModel}-fast`;
459
+ }
460
+ function tokenCountsFromUsage(usage) {
461
+ const input = numberOr(usage.input_tokens, 0);
462
+ const output = numberOr(usage.output_tokens, 0);
463
+ const cacheCreation = usage.cache_creation && typeof usage.cache_creation === "object" ? usage.cache_creation : null;
464
+ const cacheCreation5m = cacheCreation ? numberOr(cacheCreation.ephemeral_5m_input_tokens, 0) : numberOr(usage.cache_creation_input_tokens, 0);
465
+ const cacheCreation1h = cacheCreation ? numberOr(cacheCreation.ephemeral_1h_input_tokens, 0) : 0;
466
+ return {
467
+ input,
468
+ output,
469
+ cacheCreate: cacheCreation5m + cacheCreation1h,
470
+ cacheCreation5m,
471
+ cacheCreation1h,
472
+ cacheRead: numberOr(usage.cache_read_input_tokens, 0)
473
+ };
474
+ }
475
+ function hasExplicitNull(parsed) {
476
+ return NULL_REJECT_FIELDS.some((fieldPath) => hasNullAtPath(parsed, fieldPath));
477
+ }
478
+ function hasNullAtPath(value, fieldPath) {
479
+ let current = value;
480
+ for (const part of fieldPath) {
481
+ if (!current || typeof current !== "object") return false;
482
+ if (!Object.hasOwn(current, part)) return false;
483
+ current = current[part];
484
+ }
485
+ return current === null;
486
+ }
487
+ function versionIsAccepted(version, versionPrefix) {
488
+ if (typeof version !== "string" || version.length === 0) return true;
489
+ if (!/^\d+\.\d+\.\d+/.test(version)) return false;
490
+ if (!versionPrefix) return true;
491
+ return version.startsWith(versionPrefix);
492
+ }
493
+ function hasPresentEmptyIdentity(parsed) {
494
+ if (presentEmpty(parsed.sessionId)) return true;
495
+ if (presentEmpty(parsed.requestId)) return true;
496
+ if (presentEmpty(parsed.id)) return true;
497
+ if (presentEmpty(parsed.message?.id)) return true;
498
+ return presentEmpty(parsed.message?.model);
499
+ }
500
+ function presentEmpty(value) {
501
+ return typeof value === "string" && value.trim() === "";
502
+ }
503
+ //#endregion
504
+ //#region server/usage/core/usage-kimi-core.ts
505
+ var KIMI_USAGE_FILENAME = "wire.jsonl";
506
+ var KIMI_SESSION_FOLDER_PATTERN = /^session_[0-9A-Za-z_-]+$/;
507
+ function kimiSessionIdFromPath(filePath) {
508
+ const agentsFolder = path.dirname(path.dirname(filePath));
509
+ if (path.basename(agentsFolder) !== "agents") return null;
510
+ const sessionFolder = path.basename(path.dirname(agentsFolder));
511
+ return KIMI_SESSION_FOLDER_PATTERN.test(sessionFolder) ? sessionFolder : null;
512
+ }
513
+ function parseKimiUsageLine(line, filePath) {
514
+ const raw = parseJsonLine(line, "\"usage.record\"");
515
+ if (!raw) return null;
516
+ const parsed = raw;
517
+ if (parsed.type !== "usage.record") return null;
518
+ if (parsed.usageScope === "session") return null;
519
+ const usage = parsed.usage;
520
+ if (!usage || typeof usage !== "object") return null;
521
+ const model = rawTextOr(parsed.model, null);
522
+ const timestampMs = numberOr(parsed.time, null);
523
+ if (model === null || timestampMs === null) return null;
524
+ const agentId = rawTextOr(parsed.agentId, null) ?? "main";
525
+ return {
526
+ ...vendorUsageEntry({
527
+ timestampMs,
528
+ sessionId: kimiSessionIdFromPath(filePath),
529
+ model,
530
+ input: numberOr(usage.inputOther, 0),
531
+ output: numberOr(usage.output, 0),
532
+ cacheCreate: numberOr(usage.inputCacheCreation, 0),
533
+ cacheRead: numberOr(usage.inputCacheRead, 0),
534
+ costUSD: null,
535
+ vendor: "kimi"
536
+ }),
537
+ messageId: `${agentId}:${timestampMs}`
538
+ };
539
+ }
540
+ function kimiDedupIdentity(entry) {
541
+ if (!entry) return null;
542
+ return `${entry.vendor}:${entry.sessionId}:${entry.messageId}:${entry.model}`;
543
+ }
544
+ //#endregion
213
545
  //#region server/usage/core/usage-scan-core.ts
214
546
  function scopedClaudeRoots(scopeDirs, claudeDirs) {
215
547
  if (!scopeDirs || scopeDirs.length === 0) return null;
@@ -345,6 +677,9 @@ function codexHomes(env = process.env, homeDir = null) {
345
677
  function grokHomes(env = process.env, homeDir = null) {
346
678
  return vendorHomes(env, "GROK_HOME", ".grok", homeDir);
347
679
  }
680
+ function kimiHomes(env = process.env, homeDir = null) {
681
+ return vendorHomes(env, "KIMI_CODE_HOME", ".kimi-code", homeDir);
682
+ }
348
683
  function codexRootCandidates(homes) {
349
684
  const candidates = [];
350
685
  for (const home of homes) {
@@ -369,7 +704,7 @@ function codexFallbackRoots(homes, survivingRoots) {
369
704
  home
370
705
  }));
371
706
  }
372
- function grokRootCandidates(homes) {
707
+ function sessionsRootCandidates(homes) {
373
708
  return homes.map((home) => ({
374
709
  dir: path.join(home, "sessions"),
375
710
  kind: "active",
@@ -380,6 +715,7 @@ var GROK_USAGE_FILENAME = "updates.jsonl";
380
715
  function isUsageFile(vendor, fileName) {
381
716
  if (typeof fileName !== "string") return false;
382
717
  if (vendor === "grok") return fileName === GROK_USAGE_FILENAME;
718
+ if (vendor === "kimi") return fileName === KIMI_USAGE_FILENAME;
383
719
  return fileName.endsWith(".jsonl");
384
720
  }
385
721
  function dedupeCodexFiles(files) {
@@ -1112,4 +1448,4 @@ function resetCommandCache() {
1112
1448
  resolvedCommands.clear();
1113
1449
  }
1114
1450
  //#endregion
1115
- export { decideFileRead as A, shouldEvaluateDespiteIoFailures as B, pickNewestPublished as C, codexRootCandidates as D, codexHomes as E, isUsageFile as F, splitLines as H, passOutcome as I, projectDirCandidates as L, expandTilde as M, grokHomes as N, codexSessionIdFromPath as O, grokRootCandidates as P, resolveProjectsDirs as R, parseResolvedSha as S, codexFallbackRoots as T, claudeCode as U, shouldPersistWarehouse as V, isCheckFresh as _, describeAgentResolvability as a, parseRegistryDeprecation as b, isKnownAgentId as c, resolveAdapter as d, setCustomAgents as f, decideUpdateStatus as g, decideInstallFlavor as h, customAgentFingerprint as i, dedupeCodexFiles as j, continuationDelayMs as k, listAgentIds as l, readHostCodexVersion as m, cachedAgentResolvability as n, getAdapter as o, codex as p, commandFor as r, hookProfileOf as s, DEFAULT_AGENT_ID as t, resetCommandCache as u, normalizeSha as v, shortSha as w, parseRegistryLatest as x, normalizeUpdateChannel as y, scopedClaudeRoots as z };
1451
+ export { identityFromRelPath as $, decideFileRead as A, sessionsRootCandidates as B, pickNewestPublished as C, codexRootCandidates as D, codexHomes as E, kimiHomes as F, kimiSessionIdFromPath as G, shouldPersistWarehouse as H, passOutcome as I, dedupKeys as J, parseKimiUsageLine as K, projectDirCandidates as L, expandTilde as M, grokHomes as N, codexSessionIdFromPath as O, isUsageFile as P, foldReplacementIntoGenerationRollup as Q, resolveProjectsDirs as R, parseResolvedSha as S, codexFallbackRoots as T, splitLines as U, shouldEvaluateDespiteIoFailures as V, kimiDedupIdentity as W, expandAdvisorIterations as X, emptyTotals as Y, foldEntryIntoGenerationRollup as Z, isCheckFresh as _, describeAgentResolvability as a, totalTokensOf as at, parseRegistryDeprecation as b, isKnownAgentId as c, resolveAdapter as d, isWithinGenerationRecencyWindow as et, setCustomAgents as f, decideUpdateStatus as g, decideInstallFlavor as h, customAgentFingerprint as i, shouldReplace as it, dedupeCodexFiles as j, continuationDelayMs as k, listAgentIds as l, readHostCodexVersion as m, cachedAgentResolvability as n, parseJsonLine as nt, getAdapter as o, vendorUsageEntry as ot, codex as p, addEntryToTotals as q, commandFor as r, parseUsageLine as rt, hookProfileOf as s, claudeCode as st, DEFAULT_AGENT_ID as t, mergeGenerationRollups as tt, resetCommandCache as u, normalizeSha as v, shortSha as w, parseRegistryLatest as x, normalizeUpdateChannel as y, scopedClaudeRoots as z };
@@ -1 +1 @@
1
- export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-DsZUuh-H.js";
1
+ export { a as describeAgentResolvability, l as listAgentIds, f as setCustomAgents } from "./adapters-COeELdKT.js";
@@ -1,7 +1,7 @@
1
1
  import { t as errorCode } from "./text-DoirglWV.js";
2
2
  import { c as AgentLimitsReply, n as AGENT_URL_ENV } from "./session-B2Wieg0a.js";
3
3
  import { i as formatSessionLimits } from "./session-routes-Cr9S--Nf.js";
4
- import { f as isAgentApiVerb, t as AGENT_COMMAND_HELP } from "./agent-api-core-CKgp5EgK.js";
4
+ import { f as isAgentApiVerb, t as AGENT_COMMAND_HELP } from "./agent-api-core-jge0D-nX.js";
5
5
  import { i as resolveHookTarget } from "./hook-relay-core-DA_bz2KA.js";
6
6
  import { n as decideGuardrailsProxy } from "./guardrails-proxy-core-BI3rdY-m.js";
7
7
  import { t as parseJsonOrNull } from "./json-core-dfa_7Fak.js";
@@ -1 +1 @@
1
- export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-MZ90f4jg.js";
1
+ export { t as askAgentApi, r as runAgentApiCli, i as sessionLimitsHelpLines } from "./agent-api-cli-DOzlY0Hz.js";
@@ -1,5 +1,5 @@
1
1
  import { I as TASK_TITLE_CONTROL_CHARACTERS, a as AgentAttentionRequest, d as AgentSendRequest, i as AgentAnswerRequest, l as AgentPullRequestRequest, m as AgentSpawnRequest, o as AgentCloseRequest, p as AgentSettingsRequest, s as AgentEditRequest, t as AGENT_API_VERBS, u as AgentReadRequest, x as RefinedTaskTitle } from "./session-B2Wieg0a.js";
2
- import { T as pullRequestKeyFromReference, c as TASK_TITLE_SOURCE_PRIORITY, o as PersistedTaskTitle } from "./config-BOQu9rsc.js";
2
+ import { T as pullRequestKeyFromReference, c as TASK_TITLE_SOURCE_PRIORITY, o as PersistedTaskTitle } from "./config-CfYYorC4.js";
3
3
  import { n as NO_OWN_WORKTREE_REASON, t as COMMAND_ROUTES } from "./session-routes-Cr9S--Nf.js";
4
4
  import path from "node:path";
5
5
  import crypto from "node:crypto";
@@ -1,5 +1,5 @@
1
1
  import "./session-B2Wieg0a.js";
2
- import { C as OPERATOR_ACTIONS_BY_SURFACE, S as ONBOARDING_STEP_STATES, n as BUILTIN_AGENT_IDS, w as OPERATOR_SURFACES, x as ONBOARDING_STEPS, y as DASHBOARD_VIEWS } from "./config-BOQu9rsc.js";
2
+ import { C as OPERATOR_ACTIONS_BY_SURFACE, S as ONBOARDING_STEP_STATES, n as BUILTIN_AGENT_IDS, w as OPERATOR_SURFACES, x as ONBOARDING_STEPS, y as DASHBOARD_VIEWS } from "./config-CfYYorC4.js";
3
3
  import { z } from "zod";
4
4
  //#region shared/contracts/telemetry.ts
5
5
  var TELEMETRY_ADAPTERS = Object.freeze([...BUILTIN_AGENT_IDS, "custom"]);
@@ -2387,7 +2387,11 @@ var USAGE_COST_MODES = Object.freeze([
2387
2387
  "calculate",
2388
2388
  "display"
2389
2389
  ]);
2390
- var USAGE_VENDOR_KEYS = Object.freeze(["codex", "grok"]);
2390
+ var USAGE_VENDOR_KEYS = Object.freeze([
2391
+ "codex",
2392
+ "grok",
2393
+ "kimi"
2394
+ ]);
2391
2395
  var USAGE_BUDGET_KEYS = Object.freeze(["dailyUsd", "monthlyUsd"]);
2392
2396
  //#endregion
2393
2397
  //#region shared/contracts/browser-config.ts
@@ -2,11 +2,11 @@ import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
2
2
  import { n as equalsIgnoringCaseOnWindows } from "./paths-Bu4eH1Yd.js";
3
3
  import { o as packageRoot } from "./runtime-paths-ghcH9CeW.js";
4
4
  import { n as glimmervoidHomeDir$1, t as decideConfigPath } from "./config-path-core-DUWk0Lui.js";
5
- import { $ as PORT_RANGE, J as FLYING_ANIMALS_GAP_RANGE, K as FLYING_ANIMALS_DEFAULTS, Q as NON_NEGATIVE_NUMBER_RANGE, X as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, Y as FLYING_ANIMALS_SCALE_RANGE, Z as MEMORY_RESERVE_MB_RANGE, at as REPLAY_BUFFER_KB_RANGE, ct as USAGE_INTEGER_RANGES, d as USAGE_COST_MODES, dt as WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE, et as POSITIVE_NUMBER_RANGE, ft as WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE, i as Config, it as POSTHOG_TRAFFIC_MULTIPLIER_RANGE, l as configIssueMessage, lt as USAGE_RETAIN_DAYS_RANGE, n as BUILTIN_AGENT_IDS, nt as POSTHOG_TRAFFIC_BASELINE_RANGE, ot as TASK_TITLE_TIMEOUT_RANGE, p as normalizeLegacyConfigNumbers, pt as UPDATE_CHANNELS, q as FLYING_ANIMALS_DURATION_RANGE, rt as POSTHOG_TRAFFIC_MIN_USERS_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, st as USAGE_BUDGET_RANGE, t as AGENT_ID_SHAPE_MESSAGE, tt as POSTHOG_FIX_TIMEOUT_RANGE, u as BranchGcFileSettings, ut as USAGE_SCAN_INTERVAL_RANGE } from "./config-BOQu9rsc.js";
5
+ import { $ as PORT_RANGE, J as FLYING_ANIMALS_GAP_RANGE, K as FLYING_ANIMALS_DEFAULTS, Q as NON_NEGATIVE_NUMBER_RANGE, X as KEEP_MERGEABLE_TIMEOUT_MINUTES_RANGE, Y as FLYING_ANIMALS_SCALE_RANGE, Z as MEMORY_RESERVE_MB_RANGE, at as REPLAY_BUFFER_KB_RANGE, ct as USAGE_INTEGER_RANGES, d as USAGE_COST_MODES, dt as WORKFLOWS_MAX_ACTIONS_PER_POLL_RANGE, et as POSITIVE_NUMBER_RANGE, ft as WORKFLOWS_MAX_CONCURRENT_SESSIONS_RANGE, i as Config, it as POSTHOG_TRAFFIC_MULTIPLIER_RANGE, l as configIssueMessage, lt as USAGE_RETAIN_DAYS_RANGE, n as BUILTIN_AGENT_IDS, nt as POSTHOG_TRAFFIC_BASELINE_RANGE, ot as TASK_TITLE_TIMEOUT_RANGE, p as normalizeLegacyConfigNumbers, pt as UPDATE_CHANNELS, q as FLYING_ANIMALS_DURATION_RANGE, rt as POSTHOG_TRAFFIC_MIN_USERS_RANGE, s as RUNTIME_CONFIG_SCALAR_KEYS, st as USAGE_BUDGET_RANGE, t as AGENT_ID_SHAPE_MESSAGE, tt as POSTHOG_FIX_TIMEOUT_RANGE, u as BranchGcFileSettings, ut as USAGE_SCAN_INTERVAL_RANGE } from "./config-CfYYorC4.js";
6
6
  import { n as isRecord } from "./coerce-NSst8oRP.js";
7
7
  import { t as DEFAULT_TIMER_FNS } from "./timer-deps-u2DAQLok.js";
8
8
  import { d as writeJsonAtomicSync, f as writeTextAtomic, p as writeTextAtomicSync } from "./json-file-BjFK_eSH.js";
9
- import { f as FeatureFlagsResponse, g as TELEMETRY_KILL_SWITCH_FLAG, n as isExperimentalBuild, p as MAX_TEXT_LENGTH } from "./build-channel-Cfr6JMdE.js";
9
+ import { f as FeatureFlagsResponse, g as TELEMETRY_KILL_SWITCH_FLAG, n as isExperimentalBuild, p as MAX_TEXT_LENGTH } from "./build-channel-DJ1dJt9u.js";
10
10
  import fs from "node:fs";
11
11
  import path from "node:path";
12
12
  import os from "node:os";
@@ -2360,6 +2360,19 @@ var FILE_ONLY_SETTINGS = Object.freeze([
2360
2360
  fileOnlyReason: TUNING_KNOB,
2361
2361
  ...FILE_ONLY
2362
2362
  },
2363
+ {
2364
+ id: "file-usage-kimi",
2365
+ path: "usage.vendors.kimi",
2366
+ title: "Track Kimi Code usage",
2367
+ group: "machine-usage",
2368
+ description: "Include local Kimi Code transcripts in usage reports.",
2369
+ control: "toggle",
2370
+ keywords: ["moonshot", "vendor"],
2371
+ defaultValue: true,
2372
+ takesEffect: "now",
2373
+ fileOnlyReason: TUNING_KNOB,
2374
+ ...FILE_ONLY
2375
+ },
2363
2376
  {
2364
2377
  id: "file-usage-fetch-pricing",
2365
2378
  path: "usage.fetchPricing",
@@ -0,0 +1 @@
1
+ export { c as loadConfigFile } from "./config-store-BDnviJpb.js";