@copilotkit/runtime 1.9.2-next.12 → 1.9.2-next.14
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 +14 -0
- package/dist/{chunk-26EZI2OL.mjs → chunk-55VUNE6C.mjs} +2 -2
- package/dist/{chunk-67FD4ROM.mjs → chunk-J7IKWG2M.mjs} +24 -24
- package/dist/chunk-J7IKWG2M.mjs.map +1 -0
- package/dist/{chunk-GS7DO47Q.mjs → chunk-JTFQ5GIL.mjs} +1 -25
- package/dist/chunk-JTFQ5GIL.mjs.map +1 -0
- package/dist/{chunk-QYYJ4HZT.mjs → chunk-LHHL56Z2.mjs} +2 -2
- package/dist/{chunk-XRRSRDZR.mjs → chunk-LLFNFIOQ.mjs} +2 -2
- package/dist/{chunk-5242BPKE.mjs → chunk-OXUJLGHK.mjs} +2 -2
- package/dist/index.js +22 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/lib/index.js +22 -46
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- 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 +0 -24
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +2 -2
- package/src/lib/runtime/copilot-runtime.ts +21 -20
- package/src/service-adapters/openai/openai-adapter.ts +0 -14
- package/dist/chunk-67FD4ROM.mjs.map +0 -1
- package/dist/chunk-GS7DO47Q.mjs.map +0 -1
- /package/dist/{chunk-26EZI2OL.mjs.map → chunk-55VUNE6C.mjs.map} +0 -0
- /package/dist/{chunk-QYYJ4HZT.mjs.map → chunk-LHHL56Z2.mjs.map} +0 -0
- /package/dist/{chunk-XRRSRDZR.mjs.map → chunk-LLFNFIOQ.mjs.map} +0 -0
- /package/dist/{chunk-5242BPKE.mjs.map → chunk-OXUJLGHK.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomEventNames,
|
|
3
3
|
LangGraphAgent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-55VUNE6C.mjs";
|
|
5
5
|
import {
|
|
6
6
|
config,
|
|
7
7
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
8
8
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LLFNFIOQ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
copilotRuntimeNestEndpoint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LHHL56Z2.mjs";
|
|
13
13
|
import {
|
|
14
14
|
copilotRuntimeNodeExpressEndpoint
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OXUJLGHK.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CopilotRuntime,
|
|
18
18
|
addCustomHeaderPlugin,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getCommonConfig,
|
|
29
29
|
langGraphPlatformEndpoint,
|
|
30
30
|
resolveEndpointType
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-J7IKWG2M.mjs";
|
|
32
32
|
import "./chunk-SHBDMA63.mjs";
|
|
33
33
|
import {
|
|
34
34
|
AnthropicAdapter,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
OpenAIAssistantAdapter,
|
|
44
44
|
RemoteChain,
|
|
45
45
|
UnifyAdapter
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-JTFQ5GIL.mjs";
|
|
47
47
|
import {
|
|
48
48
|
GuardrailsValidationFailureResponse,
|
|
49
49
|
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.9.2-next.
|
|
47
|
+
version: "1.9.2-next.14",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -420,7 +420,6 @@ var OpenAIAdapter = class {
|
|
|
420
420
|
const { threadId: threadIdFromRequest, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
421
421
|
const tools = actions.map(convertActionInputToOpenAITool);
|
|
422
422
|
const threadId = threadIdFromRequest ?? (0, import_shared3.randomUUID)();
|
|
423
|
-
console.log("messages", messages);
|
|
424
423
|
const validToolUseIds = /* @__PURE__ */ new Set();
|
|
425
424
|
for (const message of messages) {
|
|
426
425
|
if (message.isActionExecutionMessage()) {
|
|
@@ -450,29 +449,6 @@ var OpenAIAdapter = class {
|
|
|
450
449
|
}
|
|
451
450
|
};
|
|
452
451
|
}
|
|
453
|
-
console.log("INPUT", {
|
|
454
|
-
model,
|
|
455
|
-
stream: true,
|
|
456
|
-
messages: openaiMessages,
|
|
457
|
-
...tools.length > 0 && {
|
|
458
|
-
tools
|
|
459
|
-
},
|
|
460
|
-
...(forwardedParameters == null ? void 0 : forwardedParameters.maxTokens) && {
|
|
461
|
-
max_tokens: forwardedParameters.maxTokens
|
|
462
|
-
},
|
|
463
|
-
...(forwardedParameters == null ? void 0 : forwardedParameters.stop) && {
|
|
464
|
-
stop: forwardedParameters.stop
|
|
465
|
-
},
|
|
466
|
-
...toolChoice && {
|
|
467
|
-
tool_choice: toolChoice
|
|
468
|
-
},
|
|
469
|
-
...this.disableParallelToolCalls && {
|
|
470
|
-
parallel_tool_calls: false
|
|
471
|
-
},
|
|
472
|
-
...(forwardedParameters == null ? void 0 : forwardedParameters.temperature) && {
|
|
473
|
-
temperature: forwardedParameters.temperature
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
452
|
try {
|
|
477
453
|
const stream = this.openai.beta.chat.completions.stream({
|
|
478
454
|
model,
|
|
@@ -4705,10 +4681,10 @@ please use an LLM adapter instead.`
|
|
|
4705
4681
|
return agents;
|
|
4706
4682
|
}
|
|
4707
4683
|
discoverAgentsFromAgui() {
|
|
4708
|
-
return Object.
|
|
4709
|
-
name: agent.agentName,
|
|
4710
|
-
id: agent.agentId,
|
|
4711
|
-
description: ""
|
|
4684
|
+
return Object.entries(this.agents ?? []).map(([key, agent]) => ({
|
|
4685
|
+
name: agent.agentName ?? key,
|
|
4686
|
+
id: agent.agentId ?? key,
|
|
4687
|
+
description: agent.description ?? ""
|
|
4712
4688
|
}));
|
|
4713
4689
|
}
|
|
4714
4690
|
async loadAgentState(graphqlContext, threadId, agentName) {
|
|
@@ -4771,25 +4747,25 @@ please use an LLM adapter instead.`
|
|
|
4771
4747
|
const propertyHeaders = graphqlContext.properties.authorization ? {
|
|
4772
4748
|
authorization: `Bearer ${graphqlContext.properties.authorization}`
|
|
4773
4749
|
} : null;
|
|
4774
|
-
let client;
|
|
4775
|
-
if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
4776
|
-
client = new import_langgraph_sdk2.Client({
|
|
4777
|
-
apiUrl: agent.endpoint.deploymentUrl,
|
|
4778
|
-
apiKey: agent.endpoint.langsmithApiKey,
|
|
4779
|
-
defaultHeaders: {
|
|
4780
|
-
...propertyHeaders
|
|
4781
|
-
}
|
|
4782
|
-
});
|
|
4783
|
-
} else {
|
|
4784
|
-
const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name];
|
|
4785
|
-
if (!aguiAgent) {
|
|
4786
|
-
throw new Error(`Agent: ${agent.name} could not be resolved`);
|
|
4787
|
-
}
|
|
4788
|
-
client = aguiAgent.client;
|
|
4789
|
-
}
|
|
4790
4750
|
let state = {};
|
|
4791
4751
|
try {
|
|
4792
|
-
|
|
4752
|
+
let client;
|
|
4753
|
+
if ("endpoint" in agent && agent.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
4754
|
+
client = new import_langgraph_sdk2.Client({
|
|
4755
|
+
apiUrl: agent.endpoint.deploymentUrl,
|
|
4756
|
+
apiKey: agent.endpoint.langsmithApiKey,
|
|
4757
|
+
defaultHeaders: {
|
|
4758
|
+
...propertyHeaders
|
|
4759
|
+
}
|
|
4760
|
+
});
|
|
4761
|
+
} else {
|
|
4762
|
+
const aguiAgent = graphqlContext._copilotkit.runtime.agents[agent.name];
|
|
4763
|
+
if (!aguiAgent) {
|
|
4764
|
+
throw new Error(`Agent: ${agent.name} could not be resolved`);
|
|
4765
|
+
}
|
|
4766
|
+
client = aguiAgent.client ?? null;
|
|
4767
|
+
}
|
|
4768
|
+
state = client ? (await client.threads.getState(threadId)).values : {};
|
|
4793
4769
|
} catch (error) {
|
|
4794
4770
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
4795
4771
|
console.debug(`Agent '${agentName}' configuration issue: ${errorMessage}`);
|