@copilotkit/runtime 1.5.20 → 1.6.0-next.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/CHANGELOG.md +16 -0
- package/__snapshots__/schema/schema.graphql +1 -0
- package/dist/{chunk-BLOO7P5D.mjs → chunk-A25FIW7J.mjs} +2 -2
- package/dist/{chunk-U4EZU7AQ.mjs → chunk-C7GTLEVO.mjs} +2 -2
- package/dist/{chunk-HEILVP57.mjs → chunk-CCQ73DAH.mjs} +2 -2
- package/dist/{chunk-YAEZPJTK.mjs → chunk-CHDIEE43.mjs} +27 -9
- package/dist/chunk-CHDIEE43.mjs.map +1 -0
- package/dist/{copilot-runtime-084fb9c7.d.ts → copilot-runtime-67033bfa.d.ts} +1 -1
- package/dist/{groq-adapter-3b894689.d.ts → groq-adapter-9d15c927.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{langserve-3a591089.d.ts → langserve-7cc5be48.d.ts} +1 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +26 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +8 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +2 -2
- package/dist/lib/integrations/nest/index.js +8 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +2 -2
- package/dist/lib/integrations/node-express/index.js +8 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +8 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.d.ts +3 -3
- package/package.json +2 -2
- package/src/graphql/inputs/agent-state.input.ts +3 -0
- package/src/lib/runtime/remote-action-constructors.ts +10 -4
- package/src/lib/runtime/remote-lg-action.ts +5 -0
- package/dist/chunk-YAEZPJTK.mjs.map +0 -1
- /package/dist/{chunk-BLOO7P5D.mjs.map → chunk-A25FIW7J.mjs.map} +0 -0
- /package/dist/{chunk-U4EZU7AQ.mjs.map → chunk-C7GTLEVO.mjs.map} +0 -0
- /package/dist/{chunk-HEILVP57.mjs.map → chunk-CCQ73DAH.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Parameter, Action } from '@copilotkit/shared';
|
|
2
|
-
import { b as CopilotServiceAdapter, R as RemoteChainParameters, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-
|
|
2
|
+
import { b as CopilotServiceAdapter, R as RemoteChainParameters, A as ActionInput, d as AgentSessionInput, e as AgentStateInput, F as ForwardedParametersInput, E as ExtensionsInput, f as RuntimeEventSource, g as ExtensionsResponse } from './langserve-7cc5be48.js';
|
|
3
3
|
import { M as MessageInput, a as Message } from './index-f6d1f30b.js';
|
|
4
4
|
import * as graphql from 'graphql';
|
|
5
5
|
import * as pino from 'pino';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from './langserve-
|
|
2
|
+
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from './langserve-7cc5be48.js';
|
|
3
3
|
import { BaseMessageChunk, AIMessage, AIMessageChunk, BaseMessage } from '@langchain/core/messages';
|
|
4
4
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
5
5
|
import { IterableReadableStream, IterableReadableStreamInterface } from '@langchain/core/utils/stream';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { i as CommonConfig, d as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, e as CreateCopilotRuntimeServerOptions, G as GraphQLContext, b as addCustomHeaderPlugin, h as buildSchema, c as copilotKitEndpoint, g as createContext, f as flattenToolCallsNoDuplicates, j as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from './copilot-runtime-
|
|
2
|
-
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from './groq-adapter-
|
|
1
|
+
export { i as CommonConfig, d as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, e as CreateCopilotRuntimeServerOptions, G as GraphQLContext, b as addCustomHeaderPlugin, h as buildSchema, c as copilotKitEndpoint, g as createContext, f as flattenToolCallsNoDuplicates, j as getCommonConfig, l as langGraphPlatformEndpoint, r as resolveEndpointType } from './copilot-runtime-67033bfa.js';
|
|
2
|
+
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from './groq-adapter-9d15c927.js';
|
|
3
3
|
export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './lib/integrations/index.js';
|
|
4
4
|
export { copilotRuntimeNodeHttpEndpoint } from './lib/integrations/node-http/index.js';
|
|
5
5
|
export { copilotRuntimeNodeExpressEndpoint } from './lib/integrations/node-express/index.js';
|
|
6
6
|
export { copilotRuntimeNestEndpoint } from './lib/integrations/nest/index.js';
|
|
7
7
|
export { GuardrailsValidationFailureResponse, MessageStreamInterruptedResponse, UnknownErrorResponse } from './utils/index.js';
|
|
8
|
-
export { C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse, b as CopilotServiceAdapter, c as RemoteChain, R as RemoteChainParameters } from './langserve-
|
|
8
|
+
export { C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse, b as CopilotServiceAdapter, c as RemoteChain, R as RemoteChainParameters } from './langserve-7cc5be48.js';
|
|
9
9
|
export { AnthropicAdapter, AnthropicAdapterParams, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter } from './service-adapters/index.js';
|
|
10
10
|
import '@copilotkit/shared';
|
|
11
11
|
import './index-f6d1f30b.js';
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.
|
|
47
|
+
version: "1.6.0-next.1",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -2481,7 +2481,7 @@ async function execute(args) {
|
|
|
2481
2481
|
__name(execute, "execute");
|
|
2482
2482
|
async function streamEvents(controller, args) {
|
|
2483
2483
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2484
|
-
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2, properties, metaEvents } = args;
|
|
2484
|
+
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, configurable, messages, actions, logger: logger2, properties, metaEvents } = args;
|
|
2485
2485
|
let nodeName = initialNodeName;
|
|
2486
2486
|
let state = initialState;
|
|
2487
2487
|
const { name, assistantId: initialAssistantId } = agent;
|
|
@@ -2581,6 +2581,13 @@ async function streamEvents(controller, args) {
|
|
|
2581
2581
|
throw new Error("No agent id found");
|
|
2582
2582
|
}
|
|
2583
2583
|
const assistantId = retrievedAssistant.assistant_id;
|
|
2584
|
+
if (configurable) {
|
|
2585
|
+
await client.assistants.update(assistantId, {
|
|
2586
|
+
config: {
|
|
2587
|
+
configurable
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2584
2591
|
const graphInfo = await client.assistants.getGraph(assistantId);
|
|
2585
2592
|
let streamingStateExtractor = new StreamingStateExtractor([]);
|
|
2586
2593
|
let prevNodeName = null;
|
|
@@ -2996,7 +3003,6 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
2996
3003
|
handler: async (_args) => {
|
|
2997
3004
|
},
|
|
2998
3005
|
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
|
|
2999
|
-
var _a;
|
|
3000
3006
|
logger2.debug({
|
|
3001
3007
|
actionName: agent.name
|
|
3002
3008
|
}, "Executing LangGraph Platform agent");
|
|
@@ -3007,10 +3013,12 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
3007
3013
|
hashedLgcKey: (0, import_node_crypto2.createHash)("sha256").update(endpoint.langsmithApiKey).digest("hex")
|
|
3008
3014
|
});
|
|
3009
3015
|
let state = {};
|
|
3016
|
+
let configurable = {};
|
|
3010
3017
|
if (agentStates) {
|
|
3011
|
-
const jsonState =
|
|
3018
|
+
const jsonState = agentStates.find((state2) => state2.agentName === name);
|
|
3012
3019
|
if (jsonState) {
|
|
3013
|
-
state = JSON.parse(jsonState);
|
|
3020
|
+
state = JSON.parse(jsonState.state);
|
|
3021
|
+
configurable = JSON.parse(jsonState.configurable);
|
|
3014
3022
|
}
|
|
3015
3023
|
}
|
|
3016
3024
|
try {
|
|
@@ -3028,6 +3036,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
3028
3036
|
...additionalMessages
|
|
3029
3037
|
],
|
|
3030
3038
|
state,
|
|
3039
|
+
configurable,
|
|
3031
3040
|
properties: graphqlContext.properties,
|
|
3032
3041
|
actions: actionInputsWithoutAgents.map((action) => ({
|
|
3033
3042
|
name: action.name,
|
|
@@ -3124,7 +3133,6 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
3124
3133
|
handler: async (_args) => {
|
|
3125
3134
|
},
|
|
3126
3135
|
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
|
|
3127
|
-
var _a;
|
|
3128
3136
|
logger2.debug({
|
|
3129
3137
|
actionName: agent.name
|
|
3130
3138
|
}, "Executing remote agent");
|
|
@@ -3135,10 +3143,12 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
3135
3143
|
agentsAmount: json["agents"].length
|
|
3136
3144
|
});
|
|
3137
3145
|
let state = {};
|
|
3146
|
+
let configurable = {};
|
|
3138
3147
|
if (agentStates) {
|
|
3139
|
-
const jsonState =
|
|
3148
|
+
const jsonState = agentStates.find((state2) => state2.agentName === name);
|
|
3140
3149
|
if (jsonState) {
|
|
3141
|
-
state = JSON.parse(jsonState);
|
|
3150
|
+
state = JSON.parse(jsonState.state);
|
|
3151
|
+
configurable = JSON.parse(jsonState.configurable);
|
|
3142
3152
|
}
|
|
3143
3153
|
}
|
|
3144
3154
|
const fetchUrl = `${url}/agents/execute`;
|
|
@@ -3155,6 +3165,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
3155
3165
|
...additionalMessages
|
|
3156
3166
|
],
|
|
3157
3167
|
state,
|
|
3168
|
+
configurable,
|
|
3158
3169
|
properties: graphqlContext.properties,
|
|
3159
3170
|
actions: actionInputsWithoutAgents.map((action) => ({
|
|
3160
3171
|
name: action.name,
|
|
@@ -4814,6 +4825,7 @@ __name(_ts_metadata14, "_ts_metadata");
|
|
|
4814
4825
|
var AgentStateInput = class {
|
|
4815
4826
|
agentName;
|
|
4816
4827
|
state;
|
|
4828
|
+
configurable;
|
|
4817
4829
|
};
|
|
4818
4830
|
__name(AgentStateInput, "AgentStateInput");
|
|
4819
4831
|
_ts_decorate14([
|
|
@@ -4824,6 +4836,12 @@ _ts_decorate14([
|
|
|
4824
4836
|
(0, import_type_graphql15.Field)(() => String),
|
|
4825
4837
|
_ts_metadata14("design:type", String)
|
|
4826
4838
|
], AgentStateInput.prototype, "state", void 0);
|
|
4839
|
+
_ts_decorate14([
|
|
4840
|
+
(0, import_type_graphql15.Field)(() => String, {
|
|
4841
|
+
nullable: true
|
|
4842
|
+
}),
|
|
4843
|
+
_ts_metadata14("design:type", String)
|
|
4844
|
+
], AgentStateInput.prototype, "configurable", void 0);
|
|
4827
4845
|
AgentStateInput = _ts_decorate14([
|
|
4828
4846
|
(0, import_type_graphql15.InputType)()
|
|
4829
4847
|
], AgentStateInput);
|