@theokit/sdk 2.12.0 → 2.13.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.
package/dist/a2a/index.js CHANGED
@@ -10252,6 +10252,14 @@ var init_openai2 = __esm({
10252
10252
  name = "openai";
10253
10253
  baseUrl;
10254
10254
  fetchImpl;
10255
+ /**
10256
+ * Whether this client recovers leaked Hermes tool-call dialect from assistant
10257
+ * text (theokit#58 follow-up). Observability for the route→client wiring of
10258
+ * `extractToolCallsFromContent`. @internal
10259
+ */
10260
+ get recoversLeakedToolCalls() {
10261
+ return this.options.extractToolCallsFromContent ?? false;
10262
+ }
10255
10263
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
10256
10264
  async *stream(request, signal) {
10257
10265
  const headers = {
@@ -10837,8 +10845,9 @@ function buildChain(options) {
10837
10845
  return clients;
10838
10846
  }
10839
10847
  function buildClient(name, routerOptions) {
10840
- const profile = getProviderProfile(name);
10841
- if (profile === void 0) return void 0;
10848
+ const baseProfile = getProviderProfile(name);
10849
+ if (baseProfile === void 0) return void 0;
10850
+ const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
10842
10851
  const ambient = currentCredentialPool(name);
10843
10852
  if (ambient !== void 0) {
10844
10853
  return new PoolAwareLlmClient(ambient, (apiKey) => selectTransport(profile, apiKey));
@@ -11267,11 +11276,13 @@ function buildLoopInputs(options, runId, userText) {
11267
11276
  const fallback = options.agentOptions.providers?.fallback;
11268
11277
  const apiKeys = options.agentOptions.providers?.apiKeys;
11269
11278
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
11279
+ const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
11270
11280
  const chain = resolveProviderChain({
11271
11281
  primary,
11272
11282
  ...fallback !== void 0 ? { fallback } : {},
11273
11283
  ...apiKeys !== void 0 ? { apiKeys } : {},
11274
- ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {}
11284
+ ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
11285
+ ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {}
11275
11286
  });
11276
11287
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
11277
11288
  return {