mu-agent 0.1.6 → 0.1.8

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 (145) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +5 -4
  3. package/dist/bundle/chunks/anthropic-messages-MI4QHRXW.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +2 -2
  5. package/dist/bundle/chunks/azure-openai-responses-E3QGN4VN.js +2 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
  7. package/dist/bundle/chunks/chunk-33KL6IIQ.js +20 -0
  8. package/dist/bundle/chunks/chunk-4OBXYPH4.js +4 -0
  9. package/dist/bundle/chunks/chunk-C47CLQZK.js +2 -0
  10. package/dist/bundle/chunks/chunk-F5ZABL6Z.js +20 -0
  11. package/dist/bundle/chunks/chunk-H3QXYIF7.js +31 -0
  12. package/dist/bundle/chunks/chunk-HQHD6PZI.js +2 -0
  13. package/dist/bundle/chunks/chunk-KJUDFE6Y.js +11 -0
  14. package/dist/bundle/chunks/chunk-LD2P6SFZ.js +2 -0
  15. package/dist/bundle/chunks/chunk-NG4PO5FP.js +1204 -0
  16. package/dist/bundle/chunks/chunk-NTSWBG4X.js +2 -0
  17. package/dist/bundle/chunks/chunk-RLZVFGW4.js +127 -0
  18. package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-S3GGRYIO.js} +2 -2
  19. package/dist/bundle/chunks/{chunk-4O2SCVYF.js → chunk-TAOL3JFA.js} +1 -1
  20. package/dist/bundle/chunks/chunk-TE3GUV6H.js +9 -0
  21. package/dist/bundle/chunks/chunk-VIV3CWXG.js +2 -0
  22. package/dist/bundle/chunks/{chunk-V7IXECST.js → chunk-WE4MXUQS.js} +3 -3
  23. package/dist/bundle/chunks/chunk-Y2PP32XV.js +2 -0
  24. package/dist/bundle/chunks/chunk-YLY6CKPK.js +132 -0
  25. package/dist/bundle/chunks/chunk-ZE5FMF3V.js +99 -0
  26. package/dist/bundle/chunks/cli-AOVD3SSZ.js +51 -0
  27. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NM3JRRWQ.js +2 -0
  28. package/dist/bundle/chunks/codemode-worker.js +374 -0
  29. package/dist/bundle/chunks/easter-egg-3d-G2LUBEMZ.js +2 -0
  30. package/dist/bundle/chunks/execute-MZVUC6BB.js +388 -0
  31. package/dist/bundle/chunks/github-copilot.js +1 -1
  32. package/dist/bundle/chunks/{google-generative-ai-C44KRRZ4.js → google-generative-ai-XMFHGQC5.js} +1 -1
  33. package/dist/bundle/chunks/{google-vertex-25DUXPTJ.js → google-vertex-4XRRNP74.js} +1 -1
  34. package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-TEDK3E5I.js} +2 -2
  35. package/dist/bundle/chunks/llama-cpp-classify-XT44PI3C.js +22 -0
  36. package/dist/bundle/chunks/mistral-conversations-Q22M3IBG.js +5 -0
  37. package/dist/bundle/chunks/node-N5BSDOA5.js +16 -0
  38. package/dist/bundle/chunks/openai-chatgpt.js +86 -0
  39. package/dist/bundle/chunks/{openai-codex-responses-3UAYOSSR.js → openai-codex-responses-4MYQSO5E.js} +1 -1
  40. package/dist/bundle/chunks/openai-codex.js +2 -2
  41. package/dist/bundle/chunks/openai-completions-OSRCWAAA.js +7 -0
  42. package/dist/bundle/chunks/openai-responses-UHF3DHNG.js +3 -0
  43. package/dist/bundle/chunks/{openrouter-images-JVEJN44Q.js → openrouter-images-ZVXWCSIM.js} +1 -1
  44. package/dist/bundle/chunks/openrouter.js +2 -2
  45. package/dist/bundle/chunks/radius.js +2 -2
  46. package/dist/bundle/chunks/runtime-VJMMDLVH.js +2 -0
  47. package/dist/bundle/chunks/typesafe-system-one-PRR5K6CI.js +2 -0
  48. package/dist/bundle/chunks/virtual-modules-RJXJGCPI.js +2 -0
  49. package/dist/bundle/cli-runtime.js +1 -1
  50. package/dist/bundle/index.js +1 -1
  51. package/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  52. package/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  53. package/dist/bundle/rpc-entry.js +1 -1
  54. package/dist/core/export-html/template.js +16 -0
  55. package/dist/modes/interactive/theme/dark.json +59 -72
  56. package/dist/modes/interactive/theme/light.json +57 -69
  57. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  58. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  59. package/dist/modes/interactive/theme/system-theme.js +546 -0
  60. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  61. package/dist/modes/interactive/theme/theme-controller.d.ts +43 -9
  62. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  63. package/dist/modes/interactive/theme/theme-controller.js +121 -79
  64. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  65. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -1
  66. package/dist/modes/interactive/theme/theme-json.js +1 -1
  67. package/dist/modes/interactive/theme/theme-json.js.map +1 -1
  68. package/dist/modes/interactive/theme/theme-schema.json +2 -2
  69. package/dist/modes/interactive/theme/theme.d.ts +34 -40
  70. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  71. package/dist/modes/interactive/theme/theme.js +139 -126
  72. package/dist/modes/interactive/theme/theme.js.map +1 -1
  73. package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  74. package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  75. package/docs/cli.md +60 -7
  76. package/docs/codemode.md +207 -0
  77. package/docs/configuration.md +2 -0
  78. package/docs/docs.json +13 -1
  79. package/docs/environment-variables.md +2 -2
  80. package/docs/extensions.md +53 -0
  81. package/docs/index.md +1 -1
  82. package/docs/json.md +1 -1
  83. package/docs/keybindings.md +2 -2
  84. package/docs/llama-cpp.md +13 -0
  85. package/docs/mcp.md +270 -0
  86. package/docs/models.md +83 -1
  87. package/docs/packages.md +1 -1
  88. package/docs/providers.md +19 -6
  89. package/docs/quickstart.md +16 -2
  90. package/docs/rpc-commands.md +9 -3
  91. package/docs/rpc.md +3 -1
  92. package/docs/sdk.md +8 -3
  93. package/docs/security.md +2 -0
  94. package/docs/session-format.md +5 -1
  95. package/docs/settings.md +24 -5
  96. package/docs/themes.md +28 -6
  97. package/docs/usage.md +1 -1
  98. package/docs/virtual-models.md +114 -0
  99. package/docs/windows.md +2 -0
  100. package/examples/README.md +1 -1
  101. package/examples/extensions/README.md +1 -0
  102. package/examples/extensions/built-in-tool-renderer.ts +16 -40
  103. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  104. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  105. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  106. package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
  107. package/examples/extensions/gondolin/package-lock.json +2 -2
  108. package/examples/extensions/gondolin/package.json +1 -1
  109. package/examples/extensions/jev-router.ts +113 -0
  110. package/examples/extensions/minimal-mode.ts +24 -96
  111. package/examples/extensions/sandbox/package-lock.json +2 -2
  112. package/examples/extensions/sandbox/package.json +1 -1
  113. package/examples/extensions/with-deps/package-lock.json +2 -2
  114. package/examples/extensions/with-deps/package.json +1 -1
  115. package/examples/rpc-client.ts +1 -1
  116. package/examples/rpc-extension-ui.ts +1 -1
  117. package/examples/sdk/14-codemode-mcp.ts +61 -0
  118. package/examples/sdk/README.md +2 -1
  119. package/judge/THIRD_PARTY_NOTICES.md +63 -0
  120. package/judge/dist/auth.js +128 -113
  121. package/judge/dist/import.js +10 -9
  122. package/judge/dist/kyrn-judge.js +5444 -5354
  123. package/judge/dist/setup.js +138 -12
  124. package/judge/manifest.json +414 -102
  125. package/kyrn/bin/kyrn-doctor +61 -11
  126. package/kyrn/bin/mu.mjs +169 -70
  127. package/package.json +4 -4
  128. package/dist/bundle/chunks/anthropic-messages-VMESUHQ7.js +0 -6
  129. package/dist/bundle/chunks/azure-openai-responses-K232MQFF.js +0 -2
  130. package/dist/bundle/chunks/chunk-2X3AO33C.js +0 -2
  131. package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +0 -42
  132. package/dist/bundle/chunks/chunk-E3TC4YNV.js +0 -2
  133. package/dist/bundle/chunks/chunk-FU4XQUSL.js +0 -11
  134. package/dist/bundle/chunks/chunk-GNYZK6XN.js +0 -2
  135. package/dist/bundle/chunks/chunk-MVPXOVOJ.js +0 -2
  136. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
  137. package/dist/bundle/chunks/chunk-TUBB3BLE.js +0 -1652
  138. package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
  139. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NR2TDCXU.js +0 -2
  140. package/dist/bundle/chunks/mistral-conversations-6IHQOR4R.js +0 -5
  141. package/dist/bundle/chunks/node-O3RIBJRH.js +0 -16
  142. package/dist/bundle/chunks/openai-completions-FIEQGWAH.js +0 -7
  143. package/dist/bundle/chunks/openai-responses-OZJXLHFC.js +0 -2
  144. package/dist/bundle/chunks/typesafe-system-one-VKYX4OGY.js +0 -2
  145. package/dist/bundle/chunks/virtual-modules-IOLJJ5KK.js +0 -2
@@ -46,12 +46,24 @@ function muHome(home = homedir()) {
46
46
  var DEFAULT_CONFIG = {
47
47
  tiers: ["jev"],
48
48
  judges: {},
49
- modes: { default: "shadow" },
49
+ // Verdicts take effect out of the box; a point that should only watch is set to "shadow" on its own.
50
+ modes: { default: "active" },
50
51
  routes: {},
51
52
  features: {},
52
53
  recordState: false
53
54
  };
54
55
  var MODES = ["off", "shadow", "active"];
56
+ var JUDGE_TYPES = [
57
+ "jev",
58
+ "typesafe",
59
+ "clm",
60
+ "gateway",
61
+ "local",
62
+ "http",
63
+ "llm",
64
+ "classifier",
65
+ "mock"
66
+ ];
55
67
  function isRecord(value) {
56
68
  return typeof value === "object" && value !== null && !Array.isArray(value);
57
69
  }
@@ -81,7 +93,7 @@ function readJudges(value) {
81
93
  if (!isRecord(value)) return judges;
82
94
  for (const [name, config] of Object.entries(value)) {
83
95
  if (!isRecord(config) || typeof config.type !== "string") continue;
84
- if (!["jev", "typesafe", "clm", "gateway", "local", "http", "llm", "mock"].includes(config.type)) continue;
96
+ if (!JUDGE_TYPES.includes(config.type)) continue;
85
97
  judges[name] = config;
86
98
  }
87
99
  return judges;
@@ -211,10 +223,8 @@ var NumericKeyPattern = new RegExp(IntegerKey);
211
223
 
212
224
  // packages/ai/src/utils/event-stream.ts
213
225
  var FifoQueue = class {
214
- constructor() {
215
- this.incoming = [];
216
- this.outgoing = [];
217
- }
226
+ incoming = [];
227
+ outgoing = [];
218
228
  get length() {
219
229
  return this.incoming.length + this.outgoing.length;
220
230
  }
@@ -231,10 +241,14 @@ var FifoQueue = class {
231
241
  }
232
242
  };
233
243
  var EventStream = class {
244
+ queue = new FifoQueue();
245
+ waiting = new FifoQueue();
246
+ done = false;
247
+ finalResultPromise;
248
+ resolveFinalResult;
249
+ isComplete;
250
+ extractResult;
234
251
  constructor(isComplete, extractResult) {
235
- this.queue = new FifoQueue();
236
- this.waiting = new FifoQueue();
237
- this.done = false;
238
252
  this.isComplete = isComplete;
239
253
  this.extractResult = extractResult;
240
254
  this.finalResultPromise = new Promise((resolve2) => {
@@ -358,110 +372,6 @@ function lazyApi(load, capabilities) {
358
372
  return api;
359
373
  }
360
374
 
361
- // packages/ai/src/auth/oauth/oauth-page.ts
362
- var MU_MARK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" aria-hidden="true"><defs><linearGradient id="mu-tile" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#F3C6FA"/><stop offset="0.5" stop-color="#B79CF7"/><stop offset="1" stop-color="#8680EB"/></linearGradient></defs><rect width="100" height="100" rx="27" fill="url(#mu-tile)"/><path d="M41 32 L35 74.4 M38.9 47 C37.77 55 41 59.4 47.6 59.4 C54.8 59.4 61.05 54.5 61.9 48.5 M64.25 32 L61.35 52.5 C60.6 58 62.3 61.2 66.4 60.4" stroke="#FFFFFF" stroke-width="9.8" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
363
- var MU_FAVICON = `data:image/svg+xml,${encodeURIComponent(MU_MARK_SVG)}`;
364
- function escapeHtml(value) {
365
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
366
- }
367
- function renderPage(options) {
368
- const title = escapeHtml(`${options.heading} \xB7 mu`);
369
- const heading = escapeHtml(options.heading);
370
- const message = escapeHtml(options.message);
371
- const details = options.details ? escapeHtml(options.details) : void 0;
372
- return `<!doctype html>
373
- <html lang="en">
374
- <head>
375
- <meta charset="utf-8" />
376
- <meta name="viewport" content="width=device-width, initial-scale=1" />
377
- <meta name="color-scheme" content="light dark" />
378
- <title>${title}</title>
379
- <link rel="icon" type="image/svg+xml" href="${MU_FAVICON}" />
380
- <style>
381
- :root {
382
- color-scheme: light dark;
383
- --text: #111111;
384
- --text-dim: #6b6b70;
385
- --page-bg: #ffffff;
386
- --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
387
- --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
388
- }
389
- @media (prefers-color-scheme: dark) {
390
- :root {
391
- --text: #f4f4f5;
392
- --text-dim: #9a9aa1;
393
- --page-bg: #000000;
394
- }
395
- }
396
- * { box-sizing: border-box; }
397
- body {
398
- margin: 0;
399
- min-height: 100vh;
400
- display: flex;
401
- align-items: center;
402
- justify-content: center;
403
- padding: 24px;
404
- background: var(--page-bg);
405
- color: var(--text);
406
- font-family: var(--font-sans);
407
- text-align: center;
408
- }
409
- main {
410
- width: 100%;
411
- max-width: 520px;
412
- display: flex;
413
- flex-direction: column;
414
- align-items: center;
415
- justify-content: center;
416
- }
417
- .mark {
418
- width: 72px;
419
- height: 72px;
420
- display: block;
421
- margin-bottom: 28px;
422
- }
423
- .mark svg { display: block; width: 100%; height: 100%; }
424
- h1 {
425
- margin: 0 0 10px;
426
- font-size: 26px;
427
- line-height: 1.2;
428
- font-weight: 600;
429
- letter-spacing: -0.01em;
430
- color: var(--text);
431
- }
432
- p {
433
- margin: 0;
434
- line-height: 1.7;
435
- color: var(--text-dim);
436
- font-size: 15px;
437
- }
438
- .details {
439
- margin-top: 16px;
440
- font-family: var(--font-mono);
441
- font-size: 13px;
442
- color: var(--text-dim);
443
- white-space: pre-wrap;
444
- word-break: break-word;
445
- }
446
- </style>
447
- </head>
448
- <body>
449
- <main>
450
- <div class="mark">${MU_MARK_SVG}</div>
451
- <h1>${heading}</h1>
452
- <p>${message}</p>
453
- ${details ? `<div class="details">${details}</div>` : ""}
454
- </main>
455
- </body>
456
- </html>`;
457
- }
458
- function oauthSuccessHtml(message) {
459
- return renderPage({ heading: "Signed in", message });
460
- }
461
- function oauthErrorHtml(message, details) {
462
- return renderPage({ heading: "Sign-in did not complete", message, details });
463
- }
464
-
465
375
  // packages/ai/src/utils/diagnostics.ts
466
376
  function formatThrownValue(value) {
467
377
  if (value instanceof Error) return value.message || value.name;
@@ -471,6 +381,7 @@ function formatThrownValue(value) {
471
381
 
472
382
  // packages/ai/src/utils/models-error.ts
473
383
  var ModelsError = class extends Error {
384
+ code;
474
385
  constructor(code, message, options) {
475
386
  super(withCauseDetail(message, options?.cause), options);
476
387
  this.name = "ModelsError";
@@ -646,6 +557,110 @@ function createProvider(input) {
646
557
  return provider;
647
558
  }
648
559
 
560
+ // packages/ai/src/utils/oauth-page.ts
561
+ var MU_MARK_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" aria-hidden="true"><defs><linearGradient id="mu-tile" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#F3C6FA"/><stop offset="0.5" stop-color="#B79CF7"/><stop offset="1" stop-color="#8680EB"/></linearGradient></defs><rect width="100" height="100" rx="27" fill="url(#mu-tile)"/><path d="M41 32 L35 74.4 M38.9 47 C37.77 55 41 59.4 47.6 59.4 C54.8 59.4 61.05 54.5 61.9 48.5 M64.25 32 L61.35 52.5 C60.6 58 62.3 61.2 66.4 60.4" stroke="#FFFFFF" stroke-width="9.8" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
562
+ var MU_FAVICON = `data:image/svg+xml,${encodeURIComponent(MU_MARK_SVG)}`;
563
+ function escapeHtml(value) {
564
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
565
+ }
566
+ function renderPage(options) {
567
+ const title = escapeHtml(`${options.heading} \xB7 mu`);
568
+ const heading = escapeHtml(options.heading);
569
+ const message = escapeHtml(options.message);
570
+ const details = options.details ? escapeHtml(options.details) : void 0;
571
+ return `<!doctype html>
572
+ <html lang="en">
573
+ <head>
574
+ <meta charset="utf-8" />
575
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
576
+ <meta name="color-scheme" content="light dark" />
577
+ <title>${title}</title>
578
+ <link rel="icon" type="image/svg+xml" href="${MU_FAVICON}" />
579
+ <style>
580
+ :root {
581
+ color-scheme: light dark;
582
+ --text: #111111;
583
+ --text-dim: #6b6b70;
584
+ --page-bg: #ffffff;
585
+ --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
586
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
587
+ }
588
+ @media (prefers-color-scheme: dark) {
589
+ :root {
590
+ --text: #f4f4f5;
591
+ --text-dim: #9a9aa1;
592
+ --page-bg: #000000;
593
+ }
594
+ }
595
+ * { box-sizing: border-box; }
596
+ body {
597
+ margin: 0;
598
+ min-height: 100vh;
599
+ display: flex;
600
+ align-items: center;
601
+ justify-content: center;
602
+ padding: 24px;
603
+ background: var(--page-bg);
604
+ color: var(--text);
605
+ font-family: var(--font-sans);
606
+ text-align: center;
607
+ }
608
+ main {
609
+ width: 100%;
610
+ max-width: 520px;
611
+ display: flex;
612
+ flex-direction: column;
613
+ align-items: center;
614
+ justify-content: center;
615
+ }
616
+ .mark {
617
+ width: 72px;
618
+ height: 72px;
619
+ display: block;
620
+ margin-bottom: 28px;
621
+ }
622
+ .mark svg { display: block; width: 100%; height: 100%; }
623
+ h1 {
624
+ margin: 0 0 10px;
625
+ font-size: 26px;
626
+ line-height: 1.2;
627
+ font-weight: 600;
628
+ letter-spacing: -0.01em;
629
+ color: var(--text);
630
+ }
631
+ p {
632
+ margin: 0;
633
+ line-height: 1.7;
634
+ color: var(--text-dim);
635
+ font-size: 15px;
636
+ }
637
+ .details {
638
+ margin-top: 16px;
639
+ font-family: var(--font-mono);
640
+ font-size: 13px;
641
+ color: var(--text-dim);
642
+ white-space: pre-wrap;
643
+ word-break: break-word;
644
+ }
645
+ </style>
646
+ </head>
647
+ <body>
648
+ <main>
649
+ <div class="mark">${MU_MARK_SVG}</div>
650
+ <h1>${heading}</h1>
651
+ <p>${message}</p>
652
+ ${details ? `<div class="details">${details}</div>` : ""}
653
+ </main>
654
+ </body>
655
+ </html>`;
656
+ }
657
+ function oauthSuccessHtml(message) {
658
+ return renderPage({ heading: "Signed in", message });
659
+ }
660
+ function oauthErrorHtml(message, details) {
661
+ return renderPage({ heading: "Sign-in did not complete", message, details });
662
+ }
663
+
649
664
  // packages/ai/src/providers/data/google.json
650
665
  var google_default = { "google-generative-ai": { "chat:deep-research-max-preview-04-2026": { id: "deep-research-max-preview-04-2026", name: "Deep Research Max Preview (Apr-21-2026)", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 }, contextWindow: 131072, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:deep-research-preview-04-2026": { id: "deep-research-preview-04-2026", name: "Deep Research Preview (Apr-21-2026)", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 }, contextWindow: 131072, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-2.5-computer-use-preview-10-2025": { id: "gemini-2.5-computer-use-preview-10-2025", name: "Gemini 2.5 Computer Use Preview 10-2025", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 1.25, output: 10, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128e3, maxTokens: 64e3, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-2.5-flash": { id: "gemini-2.5-flash", name: "Gemini 2.5 Flash", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-2.5-flash-lite": { id: "gemini-2.5-flash-lite", name: "Gemini 2.5 Flash-Lite", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 0.1, output: 0.4, cacheRead: 0.01, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-2.5-pro": { id: "gemini-2.5-pro", name: "Gemini 2.5 Pro", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, input: ["text", "image"], cost: { input: 1.25, output: 10, cacheRead: 0.125, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3-flash-preview": { id: "gemini-3-flash-preview", name: "Gemini 3 Flash Preview", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.5, output: 3, cacheRead: 0.05, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-flash-lite": { id: "gemini-3.1-flash-lite", name: "Gemini 3.1 Flash Lite", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.25, output: 1.5, cacheRead: 0.025, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-flash-lite-image": { id: "gemini-3.1-flash-lite-image", name: "Nano Banana 2 Lite", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: null, medium: null, high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.25, output: 30, cacheRead: 0, cacheWrite: 0 }, contextWindow: 65536, maxTokens: 4096, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-flash-lite-preview": { id: "gemini-3.1-flash-lite-preview", name: "Gemini 3.1 Flash Lite Preview", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.25, output: 1.5, cacheRead: 0.025, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-flash-live-preview": { id: "gemini-3.1-flash-live-preview", name: "Gemini 3.1 Flash Live Preview", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.75, output: 4.5, cacheRead: 0, cacheWrite: 0 }, contextWindow: 131072, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-pro-preview": { id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro Preview", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.1-pro-preview-customtools": { id: "gemini-3.1-pro-preview-customtools", name: "Gemini 3.1 Pro Preview Custom Tools", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.5-flash": { id: "gemini-3.5-flash", name: "Gemini 3.5 Flash", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.5-flash-lite": { id: "gemini-3.5-flash-lite", name: "Gemini 3.5 Flash Lite", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.3, output: 2.5, cacheRead: 0.03, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.6-flash": { id: "gemini-3.6-flash", name: "Gemini 3.6 Flash", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.7-flash": { id: "gemini-3.7-flash", name: "Gemini 3.7 Flash", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-3.8-flash": { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-flash-latest": { id: "gemini-flash-latest", name: "Gemini Flash Latest", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 1.5, output: 9, cacheRead: 0.15, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-flash-lite-latest": { id: "gemini-flash-lite-latest", name: "Gemini Flash-Lite Latest", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "minimal", low: "low", medium: "medium", high: "high", xhigh: null, max: null }, input: ["text", "image"], cost: { input: 0.25, output: 1.5, cacheRead: 0.025, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemma-4-26b-a4b-it": { id: "gemma-4-26b-a4b-it", name: "Gemma 4 26B A4B IT", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "MINIMAL", low: null, medium: null, high: "HIGH" }, input: ["text", "image"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 262144, maxTokens: 32768, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemma-4-31b-it": { id: "gemma-4-31b-it", name: "Gemma 4 31B IT", api: "google-generative-ai", provider: "google", baseUrl: "https://generativelanguage.googleapis.com/v1beta", reasoning: true, thinkingLevelMap: { off: null, minimal: "MINIMAL", low: null, medium: null, high: "HIGH" }, input: ["text", "image"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 262144, maxTokens: 32768, inputLimits: { maxRequestBytes: 20971520, images: { maxPerRequest: 3600, resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" } } };
651
666
 
@@ -330,16 +330,17 @@ var ZERO_USAGE = {
330
330
  };
331
331
  var IMAGE = { type: "image", data: "", mimeType: "image/png" };
332
332
  var SessionBuilder = class {
333
+ tool;
334
+ counts = emptyCounts();
335
+ items = [];
336
+ /** Messages that arrived while calls were still waiting for their results. */
337
+ held = [];
338
+ /** Calls of the last assistant message without a result yet, by id. */
339
+ pending = /* @__PURE__ */ new Map();
340
+ /** Every call seen, by id: a result may name its call only by the id. */
341
+ calls = /* @__PURE__ */ new Map();
342
+ answered = /* @__PURE__ */ new Set();
333
343
  constructor(tool) {
334
- this.counts = emptyCounts();
335
- this.items = [];
336
- /** Messages that arrived while calls were still waiting for their results. */
337
- this.held = [];
338
- /** Calls of the last assistant message without a result yet, by id. */
339
- this.pending = /* @__PURE__ */ new Map();
340
- /** Every call seen, by id: a result may name its call only by the id. */
341
- this.calls = /* @__PURE__ */ new Map();
342
- this.answered = /* @__PURE__ */ new Set();
343
344
  this.tool = tool;
344
345
  }
345
346
  drop(reason, count = 1) {