@adaptic/lumic-utils 1.0.16 → 1.0.17

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.
@@ -7873,10 +7873,38 @@ function translateContextToAnthropic(context) {
7873
7873
  continue;
7874
7874
  }
7875
7875
  if (msg.role === 'assistant') {
7876
- const content = typeof msg.content === 'string'
7877
- ? msg.content
7878
- : JSON.stringify(msg.content);
7879
- messages.push({ role: 'assistant', content });
7876
+ const assistantMsg = msg;
7877
+ // If the assistant message has tool_calls, translate to Anthropic tool_use blocks
7878
+ if (assistantMsg.tool_calls && assistantMsg.tool_calls.length > 0) {
7879
+ const contentBlocks = [];
7880
+ // Include text content if present
7881
+ if (typeof assistantMsg.content === 'string' && assistantMsg.content.trim()) {
7882
+ contentBlocks.push({ type: 'text', text: assistantMsg.content });
7883
+ }
7884
+ // Translate each tool_call to a tool_use block
7885
+ for (const tc of assistantMsg.tool_calls) {
7886
+ let input = {};
7887
+ try {
7888
+ input = JSON.parse(tc.function.arguments);
7889
+ }
7890
+ catch {
7891
+ input = { raw: tc.function.arguments };
7892
+ }
7893
+ contentBlocks.push({
7894
+ type: 'tool_use',
7895
+ id: tc.id,
7896
+ name: tc.function.name,
7897
+ input,
7898
+ });
7899
+ }
7900
+ messages.push({ role: 'assistant', content: contentBlocks });
7901
+ }
7902
+ else {
7903
+ const content = typeof assistantMsg.content === 'string'
7904
+ ? assistantMsg.content
7905
+ : JSON.stringify(assistantMsg.content);
7906
+ messages.push({ role: 'assistant', content });
7907
+ }
7880
7908
  continue;
7881
7909
  }
7882
7910
  if (msg.role === 'tool') {
@@ -22682,11 +22710,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
22682
22710
  async function loadApolloModules() {
22683
22711
  if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
22684
22712
  // Server-side (or Lambda): load the CommonJS‑based implementation.
22685
- return (await Promise.resolve().then(function () { return require('./apollo-client.server-bp1Spce0.js'); }));
22713
+ return (await Promise.resolve().then(function () { return require('./apollo-client.server-CS3TcmzK.js'); }));
22686
22714
  }
22687
22715
  else {
22688
22716
  // Client-side: load the ESM‑based implementation.
22689
- return (await Promise.resolve().then(function () { return require('./apollo-client.client-BxYrv3du.js'); }));
22717
+ return (await Promise.resolve().then(function () { return require('./apollo-client.client-NpMY129A.js'); }));
22690
22718
  }
22691
22719
  }
22692
22720
  /**
@@ -81397,4 +81425,4 @@ exports.withCorrelationId = withCorrelationId;
81397
81425
  exports.withMetrics = withMetrics;
81398
81426
  exports.withRateLimit = withRateLimit;
81399
81427
  exports.withRetry = withRetry;
81400
- //# sourceMappingURL=index-CeftMshp.js.map
81428
+ //# sourceMappingURL=index-Y9dzs7p_.js.map