@adaptic/lumic-utils 1.0.16 → 1.0.18
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/{apollo-client.client-BxYrv3du.js → apollo-client.client-Cz-ZMwuK.js} +3 -3
- package/dist/{apollo-client.client-BxYrv3du.js.map → apollo-client.client-Cz-ZMwuK.js.map} +1 -1
- package/dist/{apollo-client.client-D9cAiuA0.js → apollo-client.client-kEvzgHxw.js} +4 -4
- package/dist/{apollo-client.client-D9cAiuA0.js.map → apollo-client.client-kEvzgHxw.js.map} +1 -1
- package/dist/{apollo-client.server-bp1Spce0.js → apollo-client.server-BAuFJqgR.js} +3 -3
- package/dist/{apollo-client.server-bp1Spce0.js.map → apollo-client.server-BAuFJqgR.js.map} +1 -1
- package/dist/{apollo-client.server-CP1J8e9f.js → apollo-client.server-C2gZgUkR.js} +3 -3
- package/dist/{apollo-client.server-CP1J8e9f.js.map → apollo-client.server-C2gZgUkR.js.map} +1 -1
- package/dist/{index-BZdP8znv.js → index-27SewDPi.js} +2 -2
- package/dist/{index-BZdP8znv.js.map → index-27SewDPi.js.map} +1 -1
- package/dist/{index-CeftMshp.js → index-C3ihLNel.js} +59 -8
- package/dist/{index-CeftMshp.js.map → index-C3ihLNel.js.map} +1 -1
- package/dist/{index-BeN6McRy.js → index-C_0vRRAD.js} +2 -2
- package/dist/{index-BeN6McRy.js.map → index-C_0vRRAD.js.map} +1 -1
- package/dist/{index-COoh2hGG.js → index-UQOI_SLD.js} +59 -8
- package/dist/{index-COoh2hGG.js.map → index-UQOI_SLD.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/test.cjs +1 -1
- package/dist/test.mjs +1 -1
- package/package.json +1 -1
|
@@ -7873,10 +7873,38 @@ function translateContextToAnthropic(context) {
|
|
|
7873
7873
|
continue;
|
|
7874
7874
|
}
|
|
7875
7875
|
if (msg.role === 'assistant') {
|
|
7876
|
-
const
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
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') {
|
|
@@ -7893,7 +7921,30 @@ function translateContextToAnthropic(context) {
|
|
|
7893
7921
|
continue;
|
|
7894
7922
|
}
|
|
7895
7923
|
}
|
|
7896
|
-
|
|
7924
|
+
// Anthropic requires alternating user/assistant roles — merge consecutive
|
|
7925
|
+
// same-role messages into a single message with combined content blocks.
|
|
7926
|
+
const merged = [];
|
|
7927
|
+
for (const msg of messages) {
|
|
7928
|
+
const prev = merged[merged.length - 1];
|
|
7929
|
+
if (prev && prev.role === msg.role) {
|
|
7930
|
+
// Merge into the previous message by combining content blocks
|
|
7931
|
+
const prevBlocks = toContentBlocks(prev.content);
|
|
7932
|
+
const curBlocks = toContentBlocks(msg.content);
|
|
7933
|
+
prev.content = [...prevBlocks, ...curBlocks];
|
|
7934
|
+
}
|
|
7935
|
+
else {
|
|
7936
|
+
// Ensure content is in block form for consistency (string → TextBlock)
|
|
7937
|
+
merged.push({ role: msg.role, content: toContentBlocks(msg.content) });
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
return { messages: merged, systemText: systemParts.join('\n\n') };
|
|
7941
|
+
}
|
|
7942
|
+
/** Convert string or content block array to a uniform content block array. */
|
|
7943
|
+
function toContentBlocks(content) {
|
|
7944
|
+
if (typeof content === 'string') {
|
|
7945
|
+
return [{ type: 'text', text: content }];
|
|
7946
|
+
}
|
|
7947
|
+
return content;
|
|
7897
7948
|
}
|
|
7898
7949
|
/**
|
|
7899
7950
|
* Makes a call to the Anthropic Messages API.
|
|
@@ -22682,11 +22733,11 @@ let poolConfig = DEFAULT_POOL_CONFIG;
|
|
|
22682
22733
|
async function loadApolloModules() {
|
|
22683
22734
|
if (typeof window === "undefined" || process.env.AWS_EXECUTION_ENV) {
|
|
22684
22735
|
// Server-side (or Lambda): load the CommonJS‑based implementation.
|
|
22685
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.server-
|
|
22736
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.server-BAuFJqgR.js'); }));
|
|
22686
22737
|
}
|
|
22687
22738
|
else {
|
|
22688
22739
|
// Client-side: load the ESM‑based implementation.
|
|
22689
|
-
return (await Promise.resolve().then(function () { return require('./apollo-client.client-
|
|
22740
|
+
return (await Promise.resolve().then(function () { return require('./apollo-client.client-Cz-ZMwuK.js'); }));
|
|
22690
22741
|
}
|
|
22691
22742
|
}
|
|
22692
22743
|
/**
|
|
@@ -81397,4 +81448,4 @@ exports.withCorrelationId = withCorrelationId;
|
|
|
81397
81448
|
exports.withMetrics = withMetrics;
|
|
81398
81449
|
exports.withRateLimit = withRateLimit;
|
|
81399
81450
|
exports.withRetry = withRetry;
|
|
81400
|
-
//# sourceMappingURL=index-
|
|
81451
|
+
//# sourceMappingURL=index-C3ihLNel.js.map
|