@theokit/sdk 2.12.0 → 2.13.1

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/index.cjs CHANGED
@@ -13452,7 +13452,7 @@ function parseHermesParams(inner) {
13452
13452
  const key2 = param[1];
13453
13453
  const value = param[2];
13454
13454
  if (key2 === void 0 || value === void 0) continue;
13455
- input[key2.trim()] = value;
13455
+ input[key2.trim()] = value.trim();
13456
13456
  }
13457
13457
  return input;
13458
13458
  }
@@ -13468,6 +13468,14 @@ var OpenAIClient = class {
13468
13468
  name = "openai";
13469
13469
  baseUrl;
13470
13470
  fetchImpl;
13471
+ /**
13472
+ * Whether this client recovers leaked Hermes tool-call dialect from assistant
13473
+ * text (theokit#58 follow-up). Observability for the route→client wiring of
13474
+ * `extractToolCallsFromContent`. @internal
13475
+ */
13476
+ get recoversLeakedToolCalls() {
13477
+ return this.options.extractToolCallsFromContent ?? false;
13478
+ }
13471
13479
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
13472
13480
  async *stream(request, signal) {
13473
13481
  const headers = {
@@ -14118,8 +14126,9 @@ function buildChain(options) {
14118
14126
  return clients;
14119
14127
  }
14120
14128
  function buildClient(name, routerOptions) {
14121
- const profile = getProviderProfile(name);
14122
- if (profile === void 0) return void 0;
14129
+ const baseProfile = getProviderProfile(name);
14130
+ if (baseProfile === void 0) return void 0;
14131
+ const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
14123
14132
  const ambient = currentCredentialPool(name);
14124
14133
  if (ambient !== void 0) {
14125
14134
  return new PoolAwareLlmClient(ambient, (apiKey) => selectTransport(profile, apiKey));
@@ -14521,11 +14530,13 @@ function buildLoopInputs(options, runId, userText) {
14521
14530
  const fallback = options.agentOptions.providers?.fallback;
14522
14531
  const apiKeys = options.agentOptions.providers?.apiKeys;
14523
14532
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
14533
+ const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
14524
14534
  const chain = resolveProviderChain({
14525
14535
  primary,
14526
14536
  ...fallback !== void 0 ? { fallback } : {},
14527
14537
  ...apiKeys !== void 0 ? { apiKeys } : {},
14528
- ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {}
14538
+ ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
14539
+ ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {}
14529
14540
  });
14530
14541
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
14531
14542
  return {