@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/eval.cjs CHANGED
@@ -10975,7 +10975,7 @@ function parseHermesParams(inner) {
10975
10975
  const key = param[1];
10976
10976
  const value = param[2];
10977
10977
  if (key === void 0 || value === void 0) continue;
10978
- input[key.trim()] = value;
10978
+ input[key.trim()] = value.trim();
10979
10979
  }
10980
10980
  return input;
10981
10981
  }
@@ -10991,6 +10991,14 @@ var OpenAIClient = class {
10991
10991
  name = "openai";
10992
10992
  baseUrl;
10993
10993
  fetchImpl;
10994
+ /**
10995
+ * Whether this client recovers leaked Hermes tool-call dialect from assistant
10996
+ * text (theokit#58 follow-up). Observability for the route→client wiring of
10997
+ * `extractToolCallsFromContent`. @internal
10998
+ */
10999
+ get recoversLeakedToolCalls() {
11000
+ return this.options.extractToolCallsFromContent ?? false;
11001
+ }
10994
11002
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: HTTP+SSE handshake + accumulator is intentionally one block
10995
11003
  async *stream(request, signal) {
10996
11004
  const headers = {
@@ -11641,8 +11649,9 @@ function buildChain(options) {
11641
11649
  return clients;
11642
11650
  }
11643
11651
  function buildClient(name, routerOptions) {
11644
- const profile = getProviderProfile(name);
11645
- if (profile === void 0) return void 0;
11652
+ const baseProfile = getProviderProfile(name);
11653
+ if (baseProfile === void 0) return void 0;
11654
+ const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
11646
11655
  const ambient = currentCredentialPool(name);
11647
11656
  if (ambient !== void 0) {
11648
11657
  return new PoolAwareLlmClient(ambient, (apiKey) => selectTransport(profile, apiKey));
@@ -12043,11 +12052,13 @@ function buildLoopInputs(options, runId, userText) {
12043
12052
  const fallback = options.agentOptions.providers?.fallback;
12044
12053
  const apiKeys = options.agentOptions.providers?.apiKeys;
12045
12054
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
12055
+ const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
12046
12056
  const chain = resolveProviderChain({
12047
12057
  primary,
12048
12058
  ...fallback !== void 0 ? { fallback } : {},
12049
12059
  ...apiKeys !== void 0 ? { apiKeys } : {},
12050
- ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {}
12060
+ ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
12061
+ ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {}
12051
12062
  });
12052
12063
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
12053
12064
  return {