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