@copilotkit/runtime 1.3.12 → 1.3.13
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/CHANGELOG.md +8 -0
- package/dist/{chunk-IXVCESAR.mjs → chunk-3LFBIWWK.mjs} +3 -3
- package/dist/{chunk-F2KJWMGD.mjs → chunk-76K222WC.mjs} +3 -3
- package/dist/{chunk-F2KJWMGD.mjs.map → chunk-76K222WC.mjs.map} +1 -1
- package/dist/{chunk-ZEHCLFJ2.mjs → chunk-CPAHDRLS.mjs} +28 -4
- package/dist/chunk-CPAHDRLS.mjs.map +1 -0
- package/dist/{chunk-IZP72K7I.mjs → chunk-DEZQR4EM.mjs} +2 -2
- package/dist/{chunk-WBLYFYMZ.mjs → chunk-MCUYYSCJ.mjs} +2 -2
- package/dist/{chunk-PRG6VWHR.mjs → chunk-SPZSO3T3.mjs} +2 -2
- package/dist/{chunk-24WEOOFX.mjs → chunk-Y6RQG5HF.mjs} +2 -2
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/lib/index.js +28 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +7 -7
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +3 -3
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +3 -3
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +2 -2
- package/dist/service-adapters/index.js +27 -3
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +2 -2
- package/package.json +4 -4
- package/src/service-adapters/langchain/utils.ts +31 -3
- package/dist/chunk-ZEHCLFJ2.mjs.map +0 -1
- /package/dist/{chunk-IXVCESAR.mjs.map → chunk-3LFBIWWK.mjs.map} +0 -0
- /package/dist/{chunk-IZP72K7I.mjs.map → chunk-DEZQR4EM.mjs.map} +0 -0
- /package/dist/{chunk-WBLYFYMZ.mjs.map → chunk-MCUYYSCJ.mjs.map} +0 -0
- /package/dist/{chunk-PRG6VWHR.mjs.map → chunk-SPZSO3T3.mjs.map} +0 -0
- /package/dist/{chunk-24WEOOFX.mjs.map → chunk-Y6RQG5HF.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotRuntime,
|
|
3
3
|
flattenToolCallsNoDuplicates
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3LFBIWWK.mjs";
|
|
5
5
|
import {
|
|
6
6
|
AnthropicAdapter,
|
|
7
7
|
GoogleGenerativeAIAdapter,
|
|
@@ -11,25 +11,25 @@ import {
|
|
|
11
11
|
OpenAIAssistantAdapter,
|
|
12
12
|
RemoteChain,
|
|
13
13
|
UnifyAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y6RQG5HF.mjs";
|
|
15
15
|
import {
|
|
16
16
|
config,
|
|
17
17
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
18
18
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-DEZQR4EM.mjs";
|
|
20
20
|
import {
|
|
21
21
|
copilotRuntimeNestEndpoint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SPZSO3T3.mjs";
|
|
23
23
|
import {
|
|
24
24
|
copilotRuntimeNodeExpressEndpoint
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MCUYYSCJ.mjs";
|
|
26
26
|
import {
|
|
27
27
|
buildSchema,
|
|
28
28
|
copilotRuntimeNodeHttpEndpoint,
|
|
29
29
|
createContext,
|
|
30
30
|
getCommonConfig
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-76K222WC.mjs";
|
|
32
|
+
import "./chunk-CPAHDRLS.mjs";
|
|
33
33
|
import {
|
|
34
34
|
GuardrailsValidationFailureResponse,
|
|
35
35
|
MessageStreamInterruptedResponse,
|
package/dist/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.3.
|
|
47
|
+
version: "1.3.13",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -577,20 +577,39 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
577
577
|
maybeSendActionExecutionResultIsMessage(eventStream$, actionExecution);
|
|
578
578
|
let reader = result.getReader();
|
|
579
579
|
let mode = null;
|
|
580
|
+
const toolCallDetails = {
|
|
581
|
+
name: null,
|
|
582
|
+
id: null,
|
|
583
|
+
index: null,
|
|
584
|
+
prevIndex: null
|
|
585
|
+
};
|
|
580
586
|
while (true) {
|
|
581
587
|
try {
|
|
582
588
|
const { done, value } = await reader.read();
|
|
583
589
|
let toolCallName = void 0;
|
|
584
590
|
let toolCallId = void 0;
|
|
585
591
|
let toolCallArgs = void 0;
|
|
592
|
+
let toolCallIndex = void 0;
|
|
593
|
+
let toolCallPrevIndex = void 0;
|
|
586
594
|
let hasToolCall = false;
|
|
587
595
|
let content = value == null ? void 0 : value.content;
|
|
588
596
|
if (isAIMessageChunk(value)) {
|
|
589
597
|
let chunk = (_d = value.tool_call_chunks) == null ? void 0 : _d[0];
|
|
590
|
-
toolCallName = chunk == null ? void 0 : chunk.name;
|
|
591
|
-
toolCallId = chunk == null ? void 0 : chunk.id;
|
|
592
598
|
toolCallArgs = chunk == null ? void 0 : chunk.args;
|
|
593
599
|
hasToolCall = chunk != void 0;
|
|
600
|
+
if (chunk == null ? void 0 : chunk.name)
|
|
601
|
+
toolCallDetails.name = chunk.name;
|
|
602
|
+
if ((chunk == null ? void 0 : chunk.index) != null) {
|
|
603
|
+
toolCallDetails.index = chunk.index;
|
|
604
|
+
if (toolCallDetails.prevIndex == null)
|
|
605
|
+
toolCallDetails.prevIndex = chunk.index;
|
|
606
|
+
}
|
|
607
|
+
if (chunk == null ? void 0 : chunk.id)
|
|
608
|
+
toolCallDetails.id = chunk.index != null ? `${chunk.id}-idx-${chunk.index}` : chunk.id;
|
|
609
|
+
toolCallName = toolCallDetails.name;
|
|
610
|
+
toolCallId = toolCallDetails.id;
|
|
611
|
+
toolCallIndex = toolCallDetails.index;
|
|
612
|
+
toolCallPrevIndex = toolCallDetails.prevIndex;
|
|
594
613
|
} else if (isBaseMessageChunk(value)) {
|
|
595
614
|
let chunk = (_f = (_e = value.additional_kwargs) == null ? void 0 : _e.tool_calls) == null ? void 0 : _f[0];
|
|
596
615
|
toolCallName = (_g = chunk == null ? void 0 : chunk.function) == null ? void 0 : _g.name;
|
|
@@ -609,7 +628,7 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
609
628
|
break;
|
|
610
629
|
}
|
|
611
630
|
if (mode === null) {
|
|
612
|
-
if (hasToolCall) {
|
|
631
|
+
if (hasToolCall && toolCallId && toolCallName) {
|
|
613
632
|
mode = "function";
|
|
614
633
|
eventStream$.sendActionExecutionStart(toolCallId, toolCallName);
|
|
615
634
|
} else if (content) {
|
|
@@ -620,6 +639,11 @@ async function streamLangChainResponse({ result, eventStream$, actionExecution }
|
|
|
620
639
|
if (mode === "message" && content) {
|
|
621
640
|
eventStream$.sendTextMessageContent(Array.isArray(content) ? ((_i = content[0]) == null ? void 0 : _i.text) ?? "" : content);
|
|
622
641
|
} else if (mode === "function" && toolCallArgs) {
|
|
642
|
+
if (toolCallIndex !== toolCallPrevIndex) {
|
|
643
|
+
eventStream$.sendActionExecutionEnd();
|
|
644
|
+
eventStream$.sendActionExecutionStart(toolCallId, toolCallName);
|
|
645
|
+
toolCallDetails.prevIndex = toolCallDetails.index;
|
|
646
|
+
}
|
|
623
647
|
eventStream$.sendActionExecutionArgs(toolCallArgs);
|
|
624
648
|
}
|
|
625
649
|
} catch (error) {
|