@theokit/sdk 4.52.0 → 4.53.0

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 (105) hide show
  1. package/CHANGELOG.md +75 -17
  2. package/dist/{agent-C66BEJGO.cjs → agent-JX5SBYDE.cjs} +14 -13
  3. package/dist/{agent-C66BEJGO.cjs.map → agent-JX5SBYDE.cjs.map} +1 -1
  4. package/dist/{agent-HYQGJTIN.js → agent-ZAGG6ZBS.js} +13 -12
  5. package/dist/{agent-HYQGJTIN.js.map → agent-ZAGG6ZBS.js.map} +1 -1
  6. package/dist/auth/index.cjs +28 -27
  7. package/dist/auth/index.cjs.map +1 -1
  8. package/dist/auth/index.d.cts +15 -0
  9. package/dist/auth/index.d.ts +15 -0
  10. package/dist/auth/index.js +4 -3
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/chunk-23VZBRDQ.js +147 -0
  13. package/dist/chunk-23VZBRDQ.js.map +1 -0
  14. package/dist/{chunk-YARJG3GV.cjs → chunk-2QMK627M.cjs} +3 -3
  15. package/dist/{chunk-YARJG3GV.cjs.map → chunk-2QMK627M.cjs.map} +1 -1
  16. package/dist/{chunk-LLK2RS6I.cjs → chunk-2VFZQEDW.cjs} +56 -56
  17. package/dist/{chunk-LLK2RS6I.cjs.map → chunk-2VFZQEDW.cjs.map} +1 -1
  18. package/dist/{chunk-YBB66SZZ.js → chunk-2Y5NO2SY.js} +5 -5
  19. package/dist/{chunk-YBB66SZZ.js.map → chunk-2Y5NO2SY.js.map} +1 -1
  20. package/dist/{chunk-V2EJLKGA.js → chunk-2YWWPCGX.js} +4 -3
  21. package/dist/chunk-2YWWPCGX.js.map +1 -0
  22. package/dist/chunk-33L2NVTJ.cjs +177 -0
  23. package/dist/chunk-33L2NVTJ.cjs.map +1 -0
  24. package/dist/{chunk-DU7PBCAM.js → chunk-3SHW7XKK.js} +3 -3
  25. package/dist/{chunk-DU7PBCAM.js.map → chunk-3SHW7XKK.js.map} +1 -1
  26. package/dist/{chunk-J4RY5DTI.js → chunk-634YVZLU.js} +3 -3
  27. package/dist/{chunk-J4RY5DTI.js.map → chunk-634YVZLU.js.map} +1 -1
  28. package/dist/{chunk-T6ZCG5AP.cjs → chunk-BC5EUG7R.cjs} +7 -6
  29. package/dist/chunk-BC5EUG7R.cjs.map +1 -0
  30. package/dist/{chunk-ZNEYQ56O.cjs → chunk-DM6Y5B2G.cjs} +23 -23
  31. package/dist/{chunk-ZNEYQ56O.cjs.map → chunk-DM6Y5B2G.cjs.map} +1 -1
  32. package/dist/{chunk-WVDH34LK.cjs → chunk-FRITRLZQ.cjs} +2 -2
  33. package/dist/chunk-FRITRLZQ.cjs.map +1 -0
  34. package/dist/{chunk-NACDF3PK.js → chunk-HTK54K2J.js} +3 -3
  35. package/dist/{chunk-SDJYLCJK.cjs.map → chunk-HTK54K2J.js.map} +1 -1
  36. package/dist/{chunk-SPZZSAHV.js → chunk-I5OTK2RP.js} +3 -3
  37. package/dist/{chunk-SPZZSAHV.js.map → chunk-I5OTK2RP.js.map} +1 -1
  38. package/dist/{chunk-U3PAW4PL.js → chunk-NAF4L3T6.js} +2 -2
  39. package/dist/chunk-NAF4L3T6.js.map +1 -0
  40. package/dist/chunk-NUEL6RCZ.cjs +155 -0
  41. package/dist/chunk-NUEL6RCZ.cjs.map +1 -0
  42. package/dist/{chunk-ZFARZBOX.js → chunk-NZOR3N4E.js} +11 -11
  43. package/dist/{chunk-ZFARZBOX.js.map → chunk-NZOR3N4E.js.map} +1 -1
  44. package/dist/{chunk-2CD5XUAG.cjs → chunk-QN5N3ZVT.cjs} +5 -5
  45. package/dist/{chunk-2CD5XUAG.cjs.map → chunk-QN5N3ZVT.cjs.map} +1 -1
  46. package/dist/{chunk-OI6RHLGC.cjs → chunk-T5ZWI3MC.cjs} +5 -5
  47. package/dist/{chunk-OI6RHLGC.cjs.map → chunk-T5ZWI3MC.cjs.map} +1 -1
  48. package/dist/{chunk-SDJYLCJK.cjs → chunk-TR4V2LHV.cjs} +3 -3
  49. package/dist/chunk-TR4V2LHV.cjs.map +1 -0
  50. package/dist/chunk-XRI6DXPZ.js +171 -0
  51. package/dist/chunk-XRI6DXPZ.js.map +1 -0
  52. package/dist/{compact-session-AXKDB6FC.cjs → compact-session-6GKIS4SD.cjs} +16 -15
  53. package/dist/{compact-session-AXKDB6FC.cjs.map → compact-session-6GKIS4SD.cjs.map} +1 -1
  54. package/dist/{compact-session-DUAUEFRR.js → compact-session-EJ36VH5I.js} +8 -7
  55. package/dist/{compact-session-DUAUEFRR.js.map → compact-session-EJ36VH5I.js.map} +1 -1
  56. package/dist/cron.cjs +13 -12
  57. package/dist/cron.js +12 -11
  58. package/dist/eval.cjs +16 -15
  59. package/dist/eval.cjs.map +1 -1
  60. package/dist/eval.js +12 -11
  61. package/dist/eval.js.map +1 -1
  62. package/dist/fs-session-store-LIKYT24K.js +10 -0
  63. package/dist/{fs-session-store-2TF3ZWMT.js.map → fs-session-store-LIKYT24K.js.map} +1 -1
  64. package/dist/{fs-session-store-TL4RJTXZ.cjs → fs-session-store-VXXDIBGM.cjs} +5 -5
  65. package/dist/{fs-session-store-TL4RJTXZ.cjs.map → fs-session-store-VXXDIBGM.cjs.map} +1 -1
  66. package/dist/index.cjs +43 -42
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.js +14 -13
  69. package/dist/index.js.map +1 -1
  70. package/dist/{inject-session-TASLP5FA.cjs → inject-session-67SF65FC.cjs} +4 -4
  71. package/dist/{inject-session-TASLP5FA.cjs.map → inject-session-67SF65FC.cjs.map} +1 -1
  72. package/dist/{inject-session-RBGOGACE.js → inject-session-HO7FYVCX.js} +3 -3
  73. package/dist/{inject-session-RBGOGACE.js.map → inject-session-HO7FYVCX.js.map} +1 -1
  74. package/dist/internal/auth/api-key-prefix.d.ts +7 -1
  75. package/dist/internal/mcp/oauth.d.ts +1 -0
  76. package/dist/internal/mcp/token-storage.d.ts +1 -0
  77. package/dist/internal/persistence/index.cjs +6 -6
  78. package/dist/internal/persistence/index.js +1 -1
  79. package/dist/internal/persistence/transcript-ops.d.cts +6 -7
  80. package/dist/internal/persistence/transcript-ops.d.ts +6 -7
  81. package/dist/mcp-auth.cjs +299 -0
  82. package/dist/mcp-auth.cjs.map +1 -0
  83. package/dist/mcp-auth.d.cts +17 -0
  84. package/dist/mcp-auth.d.ts +17 -0
  85. package/dist/mcp-auth.js +292 -0
  86. package/dist/mcp-auth.js.map +1 -0
  87. package/dist/models.cjs +11 -10
  88. package/dist/models.cjs.map +1 -1
  89. package/dist/models.js +3 -2
  90. package/dist/models.js.map +1 -1
  91. package/dist/persistence.cjs +16 -7
  92. package/dist/persistence.cjs.map +1 -1
  93. package/dist/persistence.js +11 -2
  94. package/dist/persistence.js.map +1 -1
  95. package/package.json +11 -1
  96. package/dist/chunk-BKRTYDVN.js +0 -312
  97. package/dist/chunk-BKRTYDVN.js.map +0 -1
  98. package/dist/chunk-NACDF3PK.js.map +0 -1
  99. package/dist/chunk-T6ZCG5AP.cjs.map +0 -1
  100. package/dist/chunk-U3PAW4PL.js.map +0 -1
  101. package/dist/chunk-V2EJLKGA.js.map +0 -1
  102. package/dist/chunk-WVDH34LK.cjs.map +0 -1
  103. package/dist/chunk-XK54DTRF.cjs +0 -325
  104. package/dist/chunk-XK54DTRF.cjs.map +0 -1
  105. package/dist/fs-session-store-2TF3ZWMT.js +0 -10
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkYARJG3GV_cjs = require('./chunk-YARJG3GV.cjs');
3
+ var chunk2QMK627M_cjs = require('./chunk-2QMK627M.cjs');
4
+ var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
4
5
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
5
6
  var chunk6DCTL32L_cjs = require('./chunk-6DCTL32L.cjs');
6
- var chunkOI6RHLGC_cjs = require('./chunk-OI6RHLGC.cjs');
7
- var chunkZNEYQ56O_cjs = require('./chunk-ZNEYQ56O.cjs');
7
+ var chunkT5ZWI3MC_cjs = require('./chunk-T5ZWI3MC.cjs');
8
+ var chunkDM6Y5B2G_cjs = require('./chunk-DM6Y5B2G.cjs');
8
9
  var chunkEQMLJ52C_cjs = require('./chunk-EQMLJ52C.cjs');
9
- var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
10
10
  var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
11
11
  var chunkOKLYRPKL_cjs = require('./chunk-OKLYRPKL.cjs');
12
12
  var chunkCZHPR2G7_cjs = require('./chunk-CZHPR2G7.cjs');
@@ -17,14 +17,14 @@ var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
17
17
  var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
18
18
  var chunkKNZU4YO5_cjs = require('./chunk-KNZU4YO5.cjs');
19
19
  var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
20
- var chunkSDJYLCJK_cjs = require('./chunk-SDJYLCJK.cjs');
20
+ var chunkTR4V2LHV_cjs = require('./chunk-TR4V2LHV.cjs');
21
21
  var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
22
22
  var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
23
23
  var chunk2CFEET3Y_cjs = require('./chunk-2CFEET3Y.cjs');
24
24
  var chunkRTLUZKDL_cjs = require('./chunk-RTLUZKDL.cjs');
25
25
  var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
26
26
  var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
27
- var chunkT6ZCG5AP_cjs = require('./chunk-T6ZCG5AP.cjs');
27
+ var chunkBC5EUG7R_cjs = require('./chunk-BC5EUG7R.cjs');
28
28
  var chunkFUASIT3E_cjs = require('./chunk-FUASIT3E.cjs');
29
29
  var chunkYTO5BRBD_cjs = require('./chunk-YTO5BRBD.cjs');
30
30
  var chunkVKJ7V7EB_cjs = require('./chunk-VKJ7V7EB.cjs');
@@ -1617,7 +1617,7 @@ function createRealCloudRun(options) {
1617
1617
  conversation: []
1618
1618
  };
1619
1619
  const apiKey = resolveApiKey(options.agentOptions.apiKey);
1620
- const baseUrl = chunkZNEYQ56O_cjs.getConfiguredBaseUrl();
1620
+ const baseUrl = chunkDM6Y5B2G_cjs.getConfiguredBaseUrl();
1621
1621
  const handle = new RealCloudRun(
1622
1622
  {
1623
1623
  id,
@@ -1700,7 +1700,7 @@ var RealCloudRun = class extends FixtureRunBase {
1700
1700
  async consumeStream(response) {
1701
1701
  let finalStatus = "finished";
1702
1702
  let finalText = "";
1703
- for await (const record of chunkZNEYQ56O_cjs.parseSseStream(response.body, this.controller.signal)) {
1703
+ for await (const record of chunkDM6Y5B2G_cjs.parseSseStream(response.body, this.controller.signal)) {
1704
1704
  const parsed = safeParse(record.data);
1705
1705
  if (parsed === void 0) continue;
1706
1706
  const update = this.applyRecord(record.event, parsed);
@@ -1809,7 +1809,7 @@ var CloudAgent = class {
1809
1809
  */
1810
1810
  isFixtureMode() {
1811
1811
  const apiKey = resolveApiKey(this.options.apiKey);
1812
- return chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() === void 0;
1812
+ return chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() === void 0;
1813
1813
  }
1814
1814
  // SE9 — integrated structured output; delegates to the shared helper.
1815
1815
  generate(message, options) {
@@ -1860,7 +1860,7 @@ var CloudAgent = class {
1860
1860
  const userText = typeof message === "string" ? message : message.text;
1861
1861
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1862
1862
  const apiKey = resolveApiKey(this.options.apiKey);
1863
- const useRealRuntime = apiKey !== void 0 && !chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() !== void 0;
1863
+ const useRealRuntime = apiKey !== void 0 && !chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() !== void 0;
1864
1864
  return useRealRuntime ? createRealCloudRun({
1865
1865
  agentId: this.agentId,
1866
1866
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -2175,7 +2175,7 @@ var PersonalityStore = class {
2175
2175
  async #persist(agentId, slug) {
2176
2176
  const filePath = this.#filePath();
2177
2177
  await promises.mkdir(path.dirname(filePath), { recursive: true });
2178
- await chunkSDJYLCJK_cjs.withFileLock(filePath, async () => {
2178
+ await chunkTR4V2LHV_cjs.withFileLock(filePath, async () => {
2179
2179
  const current = await readState(filePath);
2180
2180
  const nextAgents = { ...current.agents };
2181
2181
  if (slug === void 0) delete nextAgents[agentId];
@@ -2654,7 +2654,7 @@ function resolveWindowForRun(model, contextWindow) {
2654
2654
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2655
2655
  return chunkAMYY3JHQ_cjs.resolveEffectiveContextWindow({
2656
2656
  ...override !== void 0 ? { override } : {},
2657
- catalog: chunkT6ZCG5AP_cjs.getCatalogModelInfo(model)?.limit?.context,
2657
+ catalog: chunkBC5EUG7R_cjs.getCatalogModelInfo(model)?.limit?.context,
2658
2658
  margin: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_MARGIN,
2659
2659
  floor: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_FLOOR
2660
2660
  });
@@ -2680,7 +2680,7 @@ async function runPostRunLifecycle(inputs) {
2680
2680
  try {
2681
2681
  const partial = await safeConversation(run);
2682
2682
  if (partial !== void 0) {
2683
- chunkYARJG3GV_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2683
+ chunk2QMK627M_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2684
2684
  userText,
2685
2685
  conversation: partial
2686
2686
  });
@@ -2690,11 +2690,11 @@ async function runPostRunLifecycle(inputs) {
2690
2690
  chunkSXSPMRSV_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2691
2691
  `);
2692
2692
  }
2693
- await chunkYARJG3GV_cjs.flushSessionWrites();
2693
+ await chunk2QMK627M_cjs.flushSessionWrites();
2694
2694
  return;
2695
2695
  }
2696
2696
  if (result.result !== void 0) {
2697
- chunkYARJG3GV_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2697
+ chunk2QMK627M_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2698
2698
  }
2699
2699
  const conversation = await safeConversation(run);
2700
2700
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
@@ -2705,7 +2705,7 @@ async function runPostRunLifecycle(inputs) {
2705
2705
  }
2706
2706
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
2707
2707
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
2708
- chunkYARJG3GV_cjs.persistTurnToTranscript(
2708
+ chunk2QMK627M_cjs.persistTurnToTranscript(
2709
2709
  sessionStore,
2710
2710
  { cwd: workspaceCwd, agentId, model },
2711
2711
  agentId,
@@ -2717,7 +2717,7 @@ async function runPostRunLifecycle(inputs) {
2717
2717
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
2718
2718
  // `contextWindow` here would budget against a number the clamp already rejected.
2719
2719
  contextWindow: effectiveWindow,
2720
- summarize: chunkZNEYQ56O_cjs.buildDefaultSummarizer({
2720
+ summarize: chunkDM6Y5B2G_cjs.buildDefaultSummarizer({
2721
2721
  agentModel: model,
2722
2722
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
2723
2723
  })
@@ -2759,7 +2759,7 @@ async function runPostRunLifecycle(inputs) {
2759
2759
  agentId,
2760
2760
  runId: result.id
2761
2761
  });
2762
- await chunkYARJG3GV_cjs.flushSessionWrites();
2762
+ await chunk2QMK627M_cjs.flushSessionWrites();
2763
2763
  }
2764
2764
  async function safeConversation(run) {
2765
2765
  try {
@@ -3346,7 +3346,7 @@ var HISTOGRAM_NAMES = {
3346
3346
  };
3347
3347
  function safeRequire(moduleName) {
3348
3348
  try {
3349
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LLK2RS6I.cjs', document.baseURI).href)));
3349
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2VFZQEDW.cjs', document.baseURI).href)));
3350
3350
  return r(moduleName);
3351
3351
  } catch {
3352
3352
  return void 0;
@@ -3571,7 +3571,7 @@ var cachedOtel;
3571
3571
  function loadOtel() {
3572
3572
  if (cachedOtel === void 0) {
3573
3573
  try {
3574
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LLK2RS6I.cjs', document.baseURI).href)));
3574
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2VFZQEDW.cjs', document.baseURI).href)));
3575
3575
  const mod = r("@opentelemetry/api");
3576
3576
  cachedOtel = mod;
3577
3577
  } catch {
@@ -5770,7 +5770,7 @@ function applyToolResultGuard(parts, opts) {
5770
5770
  (p) => (
5771
5771
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
5772
5772
  // structured content); image blocks pass through untouched.
5773
- p.type === "tool_result" ? { ...p, content: chunkZNEYQ56O_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5773
+ p.type === "tool_result" ? { ...p, content: chunkDM6Y5B2G_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5774
5774
  )
5775
5775
  );
5776
5776
  }
@@ -5965,7 +5965,7 @@ function catalogCostFallback(provider, cleanedModel) {
5965
5965
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
5966
5966
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
5967
5967
  for (const key of candidates) {
5968
- const info = chunkT6ZCG5AP_cjs.getCatalogModelInfo(key);
5968
+ const info = chunkBC5EUG7R_cjs.getCatalogModelInfo(key);
5969
5969
  const cost = info?.cost;
5970
5970
  if (cost === void 0) continue;
5971
5971
  const [prov, ...modelParts] = key.split("/");
@@ -5977,7 +5977,7 @@ function catalogCostFallback(provider, cleanedModel) {
5977
5977
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
5978
5978
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
5979
5979
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
5980
- pricingVersion: chunkT6ZCG5AP_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5980
+ pricingVersion: chunkBC5EUG7R_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5981
5981
  };
5982
5982
  }
5983
5983
  return void 0;
@@ -6430,12 +6430,12 @@ var FallbackLlmClient = class {
6430
6430
  let lastError;
6431
6431
  for (const client of this.clients) {
6432
6432
  if (signal.aborted) throw abortError(signal);
6433
- const attempt = await chunkZNEYQ56O_cjs.tryFirstEvent(client, request, signal, true);
6433
+ const attempt = await chunkDM6Y5B2G_cjs.tryFirstEvent(client, request, signal, true);
6434
6434
  if (attempt.kind === "handshake_error") {
6435
6435
  lastError = attempt.error;
6436
6436
  continue;
6437
6437
  }
6438
- return yield* chunkZNEYQ56O_cjs.relayStream(attempt.generator, attempt.firstResult);
6438
+ return yield* chunkDM6Y5B2G_cjs.relayStream(attempt.generator, attempt.firstResult);
6439
6439
  }
6440
6440
  if (lastError !== void 0) throw lastError;
6441
6441
  throw new chunk2YGIBOUH_cjs.NetworkError("FallbackLlmClient has no providers configured", {
@@ -6816,7 +6816,7 @@ function resolveMcpCwd(configCwd) {
6816
6816
  function registerPluginProviderProfiles(entries) {
6817
6817
  let registered2 = 0;
6818
6818
  for (const entry of entries) {
6819
- chunkT6ZCG5AP_cjs.registerProvider(entry.profile);
6819
+ chunkBC5EUG7R_cjs.registerProvider(entry.profile);
6820
6820
  registered2 += 1;
6821
6821
  }
6822
6822
  return registered2;
@@ -7005,7 +7005,7 @@ function createRealLocalRun(options) {
7005
7005
  }
7006
7006
  var pluginProvidersAnnounced = false;
7007
7007
  function resolveRunProvider(options) {
7008
- chunkT6ZCG5AP_cjs.registerBuiltins();
7008
+ chunkBC5EUG7R_cjs.registerBuiltins();
7009
7009
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
7010
7010
  const registered2 = registerPluginProviderProfiles(profiles);
7011
7011
  if (registered2 > 0 && !pluginProvidersAnnounced) {
@@ -7015,15 +7015,15 @@ function resolveRunProvider(options) {
7015
7015
  `);
7016
7016
  }
7017
7017
  const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
7018
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6ZCG5AP_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7019
- const keyInferredProvider = chunkZNEYQ56O_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7020
- const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkZNEYQ56O_cjs.detectPrimaryProvider();
7018
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkBC5EUG7R_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7019
+ const keyInferredProvider = chunkDM6Y5B2G_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7020
+ const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkDM6Y5B2G_cjs.detectPrimaryProvider();
7021
7021
  const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
7022
7022
  return { primary, effectiveModelId };
7023
7023
  }
7024
7024
  function mergeExplicitApiKey(pools, primary, apiKey) {
7025
7025
  if (apiKey === void 0 || apiKey.length === 0) return pools;
7026
- if (chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7026
+ if (chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7027
7027
  const existing = pools?.[primary];
7028
7028
  if (existing !== void 0 && existing.length > 0) return pools;
7029
7029
  return { ...pools ?? {}, [primary]: [apiKey] };
@@ -7046,7 +7046,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
7046
7046
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
7047
7047
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7048
7048
  const rateLimitSink = options.sendOptions.onRunEvent;
7049
- const chain = chunkZNEYQ56O_cjs.resolveProviderChain({
7049
+ const chain = chunkDM6Y5B2G_cjs.resolveProviderChain({
7050
7050
  primary,
7051
7051
  ...fallback !== void 0 ? { fallback } : {},
7052
7052
  ...apiKeys !== void 0 ? { apiKeys } : {},
@@ -7328,7 +7328,7 @@ function buildRealRunOptions(args) {
7328
7328
  };
7329
7329
  }
7330
7330
  async function createFixtureRunHelper(args) {
7331
- const sessionMessages = chunkYARJG3GV_cjs.getSessionMessages(args.inputs.agentId);
7331
+ const sessionMessages = chunk2QMK627M_cjs.getSessionMessages(args.inputs.agentId);
7332
7332
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
7333
7333
  return createLocalRun({
7334
7334
  agentId: args.inputs.agentId,
@@ -7347,7 +7347,7 @@ async function createFixtureRunHelper(args) {
7347
7347
  }
7348
7348
  async function dispatchLocalRun(args) {
7349
7349
  const apiKey = resolveApiKey(args.inputs.options.apiKey);
7350
- if (chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey)) {
7350
+ if (chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey)) {
7351
7351
  return createRealLocalRun(
7352
7352
  buildRealRunOptions({
7353
7353
  inputs: args.inputs,
@@ -7603,10 +7603,10 @@ async function disposeLocalAgentSession(agent) {
7603
7603
  agent.lifecycleAbortController.abort();
7604
7604
  await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
7605
7605
  disposeSessionMcpClients(agent.agentId);
7606
- await chunkYARJG3GV_cjs.flushSessionWrites();
7606
+ await chunk2QMK627M_cjs.flushSessionWrites();
7607
7607
  await flushRegistrySaves(agent.workspaceCwd);
7608
7608
  await disposeSessionStore(agent.sessionStore);
7609
- chunkYARJG3GV_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7609
+ chunk2QMK627M_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7610
7610
  }
7611
7611
  async function reloadLocalAgent(agent) {
7612
7612
  if (agent.context !== void 0) await agent.context.refresh();
@@ -8380,7 +8380,7 @@ var LocalAgentMemory = class {
8380
8380
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
8381
8381
  const cfg = this.options.memory?.activeRecall;
8382
8382
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
8383
- if (this.breaker === void 0) this.breaker = new chunkZNEYQ56O_cjs.CircuitBreaker();
8383
+ if (this.breaker === void 0) this.breaker = new chunkDM6Y5B2G_cjs.CircuitBreaker();
8384
8384
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
8385
8385
  const result = await runActiveMemory({
8386
8386
  userText,
@@ -8782,8 +8782,8 @@ async function localAgentUsePersonality(args) {
8782
8782
  registry,
8783
8783
  store: args.personalityStore,
8784
8784
  invalidateCache: (reason) => args.invalidateCache(reason),
8785
- appendSessionMessage: (msg) => chunkYARJG3GV_cjs.appendSessionMessage(args.agentId, msg),
8786
- clearSession: () => chunkYARJG3GV_cjs.clearSession(args.agentId),
8785
+ appendSessionMessage: (msg) => chunk2QMK627M_cjs.appendSessionMessage(args.agentId, msg),
8786
+ clearSession: () => chunk2QMK627M_cjs.clearSession(args.agentId),
8787
8787
  opts: args.opts ?? {}
8788
8788
  })
8789
8789
  );
@@ -9137,7 +9137,7 @@ async function executeSendLocked(inputs, message, options) {
9137
9137
  if (inputs.options.onBeforeSend !== void 0) {
9138
9138
  await inputs.options.onBeforeSend({
9139
9139
  conversationId: inputs.agentId,
9140
- previousMessageCount: chunkYARJG3GV_cjs.getSessionMessages(inputs.agentId).length
9140
+ previousMessageCount: chunk2QMK627M_cjs.getSessionMessages(inputs.agentId).length
9141
9141
  });
9142
9142
  }
9143
9143
  await inputs.runPreHook(userText);
@@ -9149,8 +9149,8 @@ async function executeSendLocked(inputs, message, options) {
9149
9149
  userText,
9150
9150
  sendOptions: options
9151
9151
  });
9152
- const priorMessages = [...chunkYARJG3GV_cjs.getSessionMessages(inputs.agentId)];
9153
- chunkYARJG3GV_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9152
+ const priorMessages = [...chunk2QMK627M_cjs.getSessionMessages(inputs.agentId)];
9153
+ chunk2QMK627M_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9154
9154
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
9155
9155
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
9156
9156
  const portPathActive = shouldUsePortMemoryPath();
@@ -9312,7 +9312,7 @@ var LocalAgent = class {
9312
9312
  this.options = options;
9313
9313
  this.workspaceCwd = resolveCwd(options.local?.cwd);
9314
9314
  this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
9315
- this.sessionStore = options.local?.sessionStore ?? new chunkOI6RHLGC_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9315
+ this.sessionStore = options.local?.sessionStore ?? new chunkT5ZWI3MC_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9316
9316
  this.settingSourcesIncludeProject = includesSetting(options, "project");
9317
9317
  this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
9318
9318
  const sub = bootstrapSubmanagers({
@@ -9362,7 +9362,7 @@ var LocalAgent = class {
9362
9362
  );
9363
9363
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9364
9364
  try {
9365
- await chunkYARJG3GV_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9365
+ await chunk2QMK627M_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9366
9366
  await this.personalityStore.hydrate(this.agentId);
9367
9367
  } catch (err) {
9368
9368
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -9695,7 +9695,7 @@ async function createLocalAgent(options) {
9695
9695
  if (apiKey === void 0) {
9696
9696
  throw new chunk2YGIBOUH_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9697
9697
  }
9698
- const willFlowToProvider = !chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && !chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey);
9698
+ const willFlowToProvider = !chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && !chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey);
9699
9699
  const shape = validateApiKeyShape(apiKey, {
9700
9700
  strict: willFlowToProvider,
9701
9701
  // `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
@@ -9706,7 +9706,7 @@ async function createLocalAgent(options) {
9706
9706
  if (shape.malformed) {
9707
9707
  throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9708
9708
  }
9709
- if (!chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() === void 0 && !chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey)) {
9709
+ if (!chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() === void 0 && !chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey)) {
9710
9710
  throw new chunk2YGIBOUH_cjs.AuthenticationError("Invalid API key", {
9711
9711
  code: "authentication_error"
9712
9712
  });
@@ -9726,11 +9726,11 @@ async function createCloudAgent(options) {
9726
9726
  if (shape.malformed) {
9727
9727
  throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9728
9728
  }
9729
- const baseUrl = chunkZNEYQ56O_cjs.getConfiguredBaseUrl();
9729
+ const baseUrl = chunkDM6Y5B2G_cjs.getConfiguredBaseUrl();
9730
9730
  if (baseUrl === void 0) {
9731
9731
  return new CloudAgent(options);
9732
9732
  }
9733
- const response = await chunkZNEYQ56O_cjs.httpRequest("/v1/agents", {
9733
+ const response = await chunkDM6Y5B2G_cjs.httpRequest("/v1/agents", {
9734
9734
  apiKey,
9735
9735
  method: "POST",
9736
9736
  body: {
@@ -9755,7 +9755,7 @@ function resolveAgentPersistenceCwd(options) {
9755
9755
  return process.cwd();
9756
9756
  }
9757
9757
  async function rehydrateExistingAgent(agentId, existing, options) {
9758
- await chunkZNEYQ56O_cjs.discoverProviderPlugins();
9758
+ await chunkDM6Y5B2G_cjs.discoverProviderPlugins();
9759
9759
  await validateRehydratedAgent(agentId, existing);
9760
9760
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
9761
9761
  const mergedOptions = {
@@ -9883,7 +9883,7 @@ var Agent = class _Agent {
9883
9883
  pluginCount: enabledPluginNames(options.plugins).length
9884
9884
  });
9885
9885
  try {
9886
- await chunkZNEYQ56O_cjs.discoverProviderPlugins();
9886
+ await chunkDM6Y5B2G_cjs.discoverProviderPlugins();
9887
9887
  const agent = await runCreateUnderSpan(options, span);
9888
9888
  return agent;
9889
9889
  } catch (err) {
@@ -10152,9 +10152,9 @@ var Agent = class _Agent {
10152
10152
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10153
10153
  );
10154
10154
  }
10155
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-AXKDB6FC.cjs');
10155
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-6GKIS4SD.cjs');
10156
10156
  const { cwd, model, store } = await openLocalStore(reg);
10157
- return chunkYARJG3GV_cjs.enqueueSessionWrite(
10157
+ return chunk2QMK627M_cjs.enqueueSessionWrite(
10158
10158
  cwd,
10159
10159
  agentId,
10160
10160
  () => compactSessionTranscript({
@@ -10188,7 +10188,7 @@ var Agent = class _Agent {
10188
10188
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10189
10189
  );
10190
10190
  }
10191
- const { injectSessionTurn } = await import('./inject-session-TASLP5FA.cjs');
10191
+ const { injectSessionTurn } = await import('./inject-session-67SF65FC.cjs');
10192
10192
  const { cwd, model, store } = await openLocalStore(reg);
10193
10193
  await injectSessionTurn({
10194
10194
  store,
@@ -10315,7 +10315,7 @@ async function openLocalStore(reg) {
10315
10315
  const cwd = reg.cwd ?? process.cwd();
10316
10316
  const optModel = reg.options.model;
10317
10317
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10318
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-TL4RJTXZ.cjs');
10318
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-VXXDIBGM.cjs');
10319
10319
  const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-TNAJ4O3M.cjs');
10320
10320
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10321
10321
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
@@ -10333,5 +10333,5 @@ exports.generateCronId = generateCronId;
10333
10333
  exports.getPricingEntry = getPricingEntry;
10334
10334
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10335
10335
  exports.resolveApiKey = resolveApiKey;
10336
- //# sourceMappingURL=chunk-LLK2RS6I.cjs.map
10337
- //# sourceMappingURL=chunk-LLK2RS6I.cjs.map
10336
+ //# sourceMappingURL=chunk-2VFZQEDW.cjs.map
10337
+ //# sourceMappingURL=chunk-2VFZQEDW.cjs.map