@copilotkit/runtime 1.1.2 → 1.1.3-feat-runtime-remote-actions.0
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/README.md +32 -37
- package/__snapshots__/schema/schema.graphql +42 -0
- package/dist/chunk-4WFNRUBE.mjs +260 -0
- package/dist/chunk-4WFNRUBE.mjs.map +1 -0
- package/dist/{chunk-MKV3LEJ6.mjs → chunk-6X5MPWIC.mjs} +795 -159
- package/dist/chunk-6X5MPWIC.mjs.map +1 -0
- package/dist/{chunk-URMISMK2.mjs → chunk-73NMP3DI.mjs} +2 -2
- package/dist/{chunk-CUVWSISN.mjs → chunk-BJ2LVHWA.mjs} +22 -4
- package/dist/chunk-BJ2LVHWA.mjs.map +1 -0
- package/dist/{chunk-74B76SMO.mjs → chunk-HYNSUFUM.mjs} +2 -2
- package/dist/{chunk-6PAC74F2.mjs → chunk-JV3CSVW6.mjs} +2 -2
- package/dist/{chunk-NPCP4YZB.mjs → chunk-OYUVLDJF.mjs} +2 -2
- package/dist/{chunk-GEIBJJQ4.mjs → chunk-TBZGOJJX.mjs} +14 -2
- package/dist/chunk-TBZGOJJX.mjs.map +1 -0
- package/dist/{shared-ec6c7db5.d.ts → copilot-runtime-d427e991.d.ts} +68 -37
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/graphql/types/converted/index.js +13 -0
- package/dist/graphql/types/converted/index.js.map +1 -1
- package/dist/graphql/types/converted/index.mjs +3 -1
- package/dist/{index-aa091e3c.d.ts → index-0476e4f7.d.ts} +24 -2
- package/dist/{groq-adapter-675b30c6.d.ts → index-079752b9.d.ts} +31 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1012 -246
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/{langserve-a54438c6.d.ts → langserve-d6073a3b.d.ts} +24 -11
- package/dist/lib/index.d.ts +8 -8
- package/dist/lib/index.js +1012 -246
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +8 -8
- package/dist/lib/integrations/index.d.ts +26 -7
- package/dist/lib/integrations/index.js +446 -183
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +6 -6
- package/dist/lib/integrations/nest/index.d.ts +5 -5
- package/dist/lib/integrations/nest/index.js +446 -183
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +4 -4
- package/dist/lib/integrations/node-express/index.d.ts +5 -5
- package/dist/lib/integrations/node-express/index.js +446 -183
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +4 -4
- package/dist/lib/integrations/node-http/index.d.ts +5 -5
- package/dist/lib/integrations/node-http/index.js +446 -183
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +3 -3
- package/dist/service-adapters/index.d.ts +3 -3
- package/dist/service-adapters/index.js +19 -1
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +3 -3
- package/dist/utils/index.d.ts +49 -1
- package/package.json +7 -5
- package/src/agents/langgraph/event-source.ts +222 -0
- package/src/agents/langgraph/events.ts +309 -0
- package/src/graphql/inputs/agent-session.input.ts +13 -0
- package/src/graphql/inputs/agent-state.input.ts +10 -0
- package/src/graphql/inputs/frontend.input.ts +3 -0
- package/src/graphql/inputs/generate-copilot-response.input.ts +11 -0
- package/src/graphql/inputs/message.input.ts +30 -0
- package/src/graphql/resolvers/copilot.resolver.ts +57 -12
- package/src/graphql/types/converted/index.ts +15 -0
- package/src/graphql/types/copilot-response.type.ts +29 -0
- package/src/graphql/types/enums.ts +1 -0
- package/src/lib/index.ts +1 -1
- package/src/lib/integrations/shared.ts +1 -1
- package/src/lib/runtime/copilot-runtime.ts +360 -0
- package/src/lib/runtime/remote-actions.ts +241 -0
- package/src/service-adapters/conversion.ts +16 -0
- package/src/service-adapters/events.ts +101 -19
- package/src/service-adapters/groq/groq-adapter.ts +13 -0
- package/src/service-adapters/openai/openai-adapter.ts +13 -0
- package/src/service-adapters/openai/openai-assistant-adapter.ts +14 -0
- package/dist/chunk-CUVWSISN.mjs.map +0 -1
- package/dist/chunk-GEIBJJQ4.mjs.map +0 -1
- package/dist/chunk-MKV3LEJ6.mjs.map +0 -1
- package/dist/chunk-RDEOIOQR.mjs +0 -155
- package/dist/chunk-RDEOIOQR.mjs.map +0 -1
- package/dist/failed-response-status-reasons-0ab19e06.d.ts +0 -49
- package/dist/pages-router-df82c666.d.ts +0 -21
- package/src/lib/copilot-runtime.ts +0 -225
- /package/dist/{chunk-URMISMK2.mjs.map → chunk-73NMP3DI.mjs.map} +0 -0
- /package/dist/{chunk-74B76SMO.mjs.map → chunk-HYNSUFUM.mjs.map} +0 -0
- /package/dist/{chunk-6PAC74F2.mjs.map → chunk-JV3CSVW6.mjs.map} +0 -0
- /package/dist/{chunk-NPCP4YZB.mjs.map → chunk-OYUVLDJF.mjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
telemetry_client_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6X5MPWIC.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__name
|
|
7
7
|
} from "./chunk-44O2JGUY.mjs";
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
config,
|
|
77
77
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
79
|
+
//# sourceMappingURL=chunk-OYUVLDJF.mjs.map
|
|
@@ -23,10 +23,22 @@ var ResultMessage = class extends BaseMessage {
|
|
|
23
23
|
result;
|
|
24
24
|
};
|
|
25
25
|
__name(ResultMessage, "ResultMessage");
|
|
26
|
+
var AgentStateMessage = class extends BaseMessage {
|
|
27
|
+
threadId;
|
|
28
|
+
agentName;
|
|
29
|
+
nodeName;
|
|
30
|
+
runId;
|
|
31
|
+
active;
|
|
32
|
+
role;
|
|
33
|
+
state;
|
|
34
|
+
running;
|
|
35
|
+
};
|
|
36
|
+
__name(AgentStateMessage, "AgentStateMessage");
|
|
26
37
|
|
|
27
38
|
export {
|
|
28
39
|
TextMessage,
|
|
29
40
|
ActionExecutionMessage,
|
|
30
|
-
ResultMessage
|
|
41
|
+
ResultMessage,
|
|
42
|
+
AgentStateMessage
|
|
31
43
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-TBZGOJJX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graphql/types/converted/index.ts"],"sourcesContent":["import {\n ActionExecutionMessageInput,\n ResultMessageInput,\n TextMessageInput,\n AgentStateMessageInput,\n} from \"../../inputs/message.input\";\nimport { BaseMessage } from \"../base\";\nimport { ActionExecutionScope, MessageRole } from \"../enums\";\n\nexport class TextMessage extends BaseMessage implements TextMessageInput {\n content: string;\n role: MessageRole;\n}\n\nexport type Message = BaseMessage;\n\nexport class ActionExecutionMessage\n extends BaseMessage\n implements Omit<ActionExecutionMessageInput, \"arguments\">\n{\n name: string;\n arguments: Record<string, any>;\n scope: ActionExecutionScope;\n}\n\nexport class ResultMessage extends BaseMessage implements ResultMessageInput {\n actionExecutionId: string;\n actionName: string;\n result: string;\n}\n\nexport class AgentStateMessage\n extends BaseMessage\n implements Omit<AgentStateMessageInput, \"state\">\n{\n threadId: string;\n agentName: string;\n nodeName: string;\n runId: string;\n active: boolean;\n role: MessageRole;\n state: any;\n running: boolean;\n}\n"],"mappings":";;;;;;;;AASO,IAAMA,cAAN,cAA0BC,YAAAA;EAC/BC;EACAC;AACF;AAHaH;AAON,IAAMI,yBAAN,cACGH,YAAAA;EAGRI;EACAC;EACAC;AACF;AAPaH;AASN,IAAMI,gBAAN,cAA4BP,YAAAA;EACjCQ;EACAC;EACAC;AACF;AAJaH;AAMN,IAAMI,oBAAN,cACGX,YAAAA;EAGRY;EACAC;EACAC;EACAC;EACAC;EACAd;EACAe;EACAC;AACF;AAZaP;","names":["TextMessage","BaseMessage","content","role","ActionExecutionMessage","name","arguments","scope","ResultMessage","actionExecutionId","actionName","result","AgentStateMessage","threadId","agentName","nodeName","runId","active","state","running"]}
|
|
@@ -1,11 +1,62 @@
|
|
|
1
|
+
import { Parameter, Action } from '@copilotkit/shared';
|
|
2
|
+
import { C as CopilotServiceAdapter, R as RemoteChainParameters, A as ActionInput, F as ForwardedParametersInput, a as RuntimeEventSource } from './langserve-d6073a3b.js';
|
|
3
|
+
import { M as MessageInput, a as Message } from './index-0476e4f7.js';
|
|
1
4
|
import * as graphql from 'graphql';
|
|
2
5
|
import * as pino from 'pino';
|
|
3
6
|
import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
4
|
-
import { Parameter, Action } from '@copilotkit/shared';
|
|
5
|
-
import { R as RemoteChainParameters, A as ActionInput, C as CopilotServiceAdapter, F as ForwardedParametersInput, a as RuntimeEventSource } from './langserve-a54438c6.js';
|
|
6
|
-
import { M as MessageInput, a as Message } from './index-aa091e3c.js';
|
|
7
7
|
import { CopilotCloudOptions } from './lib/cloud/index.js';
|
|
8
8
|
|
|
9
|
+
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
10
|
+
|
|
11
|
+
declare const logger: pino.Logger<never>;
|
|
12
|
+
type AnyPrimitive = string | boolean | number | null;
|
|
13
|
+
type CopilotRequestContextProperties = Record<string, AnyPrimitive | Record<string, AnyPrimitive>>;
|
|
14
|
+
type GraphQLContext = YogaInitialContext & {
|
|
15
|
+
_copilotkit: CreateCopilotRuntimeServerOptions;
|
|
16
|
+
properties: CopilotRequestContextProperties;
|
|
17
|
+
logger: typeof logger;
|
|
18
|
+
};
|
|
19
|
+
interface CreateCopilotRuntimeServerOptions {
|
|
20
|
+
runtime: CopilotRuntime<any>;
|
|
21
|
+
serviceAdapter: CopilotServiceAdapter;
|
|
22
|
+
endpoint: string;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
cloud?: CopilotCloudOptions;
|
|
25
|
+
properties?: CopilotRequestContextProperties;
|
|
26
|
+
logLevel?: LogLevel;
|
|
27
|
+
}
|
|
28
|
+
declare function createContext(initialContext: YogaInitialContext, copilotKitContext: CreateCopilotRuntimeServerOptions, contextLogger: typeof logger, properties?: CopilotRequestContextProperties): Promise<Partial<GraphQLContext>>;
|
|
29
|
+
declare function buildSchema(options?: {
|
|
30
|
+
emitSchemaFile?: string;
|
|
31
|
+
}): graphql.GraphQLSchema;
|
|
32
|
+
type CommonConfig = {
|
|
33
|
+
logging: typeof logger;
|
|
34
|
+
schema: ReturnType<typeof buildSchema>;
|
|
35
|
+
plugins: Parameters<typeof createYoga>[0]["plugins"];
|
|
36
|
+
context: (ctx: YogaInitialContext) => Promise<Partial<GraphQLContext>>;
|
|
37
|
+
};
|
|
38
|
+
declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): CommonConfig;
|
|
39
|
+
|
|
40
|
+
declare class AgentStateInput {
|
|
41
|
+
agentName: string;
|
|
42
|
+
state: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type RemoteActionDefinition = {
|
|
46
|
+
url: string;
|
|
47
|
+
onBeforeRequest?: ({ ctx }: {
|
|
48
|
+
ctx: GraphQLContext;
|
|
49
|
+
}) => {
|
|
50
|
+
headers?: Record<string, string> | undefined;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
declare class AgentSessionInput {
|
|
55
|
+
agentName: string;
|
|
56
|
+
threadId?: string;
|
|
57
|
+
nodeName?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
9
60
|
/**
|
|
10
61
|
* <Callout type="info">
|
|
11
62
|
* This is the reference for the `CopilotRuntime` class. For more information and example code snippets, please see [Concept: Copilot Runtime](/concepts/copilot-runtime).
|
|
@@ -24,27 +75,33 @@ interface CopilotRuntimeRequest {
|
|
|
24
75
|
serviceAdapter: CopilotServiceAdapter;
|
|
25
76
|
messages: MessageInput[];
|
|
26
77
|
actions: ActionInput[];
|
|
78
|
+
agentSession?: AgentSessionInput;
|
|
79
|
+
agentStates?: AgentStateInput[];
|
|
27
80
|
outputMessagesPromise: Promise<Message[]>;
|
|
28
|
-
properties: any;
|
|
29
81
|
threadId?: string;
|
|
30
82
|
runId?: string;
|
|
31
83
|
publicApiKey?: string;
|
|
84
|
+
graphqlContext: GraphQLContext;
|
|
32
85
|
forwardedParameters?: ForwardedParametersInput;
|
|
86
|
+
url?: string;
|
|
33
87
|
}
|
|
34
88
|
interface CopilotRuntimeResponse {
|
|
35
89
|
threadId: string;
|
|
36
90
|
runId?: string;
|
|
37
91
|
eventSource: RuntimeEventSource;
|
|
38
|
-
|
|
92
|
+
serverSideActions: Action<any>[];
|
|
93
|
+
actionInputsWithoutAgents: ActionInput[];
|
|
39
94
|
}
|
|
40
95
|
type ActionsConfiguration<T extends Parameter[] | [] = []> = Action<T>[] | ((ctx: {
|
|
41
96
|
properties: any;
|
|
97
|
+
url?: string;
|
|
42
98
|
}) => Action<T>[]);
|
|
43
99
|
interface OnBeforeRequestOptions {
|
|
44
100
|
threadId?: string;
|
|
45
101
|
runId?: string;
|
|
46
102
|
inputMessages: Message[];
|
|
47
103
|
properties: any;
|
|
104
|
+
url?: string;
|
|
48
105
|
}
|
|
49
106
|
type OnBeforeRequestHandler = (options: OnBeforeRequestOptions) => void | Promise<void>;
|
|
50
107
|
interface OnAfterRequestOptions {
|
|
@@ -53,6 +110,7 @@ interface OnAfterRequestOptions {
|
|
|
53
110
|
inputMessages: Message[];
|
|
54
111
|
outputMessages: Message[];
|
|
55
112
|
properties: any;
|
|
113
|
+
url?: string;
|
|
56
114
|
}
|
|
57
115
|
type OnAfterRequestHandler = (options: OnAfterRequestOptions) => void | Promise<void>;
|
|
58
116
|
interface Middleware {
|
|
@@ -90,47 +148,20 @@ interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []> {
|
|
|
90
148
|
*/
|
|
91
149
|
middleware?: Middleware;
|
|
92
150
|
actions?: ActionsConfiguration<T>;
|
|
151
|
+
remoteActions?: RemoteActionDefinition[];
|
|
93
152
|
langserve?: RemoteChainParameters[];
|
|
94
153
|
}
|
|
95
154
|
declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
96
155
|
actions: ActionsConfiguration<T>;
|
|
156
|
+
private remoteActionDefinitions;
|
|
97
157
|
private langserve;
|
|
98
158
|
private onBeforeRequest?;
|
|
99
159
|
private onAfterRequest?;
|
|
100
160
|
constructor(params?: CopilotRuntimeConstructorParams<T>);
|
|
101
|
-
|
|
161
|
+
processRuntimeRequest(request: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse>;
|
|
162
|
+
private processAgentRequest;
|
|
163
|
+
private getServerSideActions;
|
|
102
164
|
}
|
|
103
165
|
declare function flattenToolCallsNoDuplicates(toolsByPriority: ActionInput[]): ActionInput[];
|
|
104
166
|
|
|
105
|
-
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
106
|
-
|
|
107
|
-
declare const logger: pino.Logger<never>;
|
|
108
|
-
type AnyPrimitive = string | boolean | number | null;
|
|
109
|
-
type CopilotRequestContextProperties = Record<string, AnyPrimitive | Record<string, AnyPrimitive>>;
|
|
110
|
-
type GraphQLContext = YogaInitialContext & {
|
|
111
|
-
_copilotkit: CreateCopilotRuntimeServerOptions;
|
|
112
|
-
properties: CopilotRequestContextProperties;
|
|
113
|
-
logger: typeof logger;
|
|
114
|
-
};
|
|
115
|
-
interface CreateCopilotRuntimeServerOptions {
|
|
116
|
-
runtime: CopilotRuntime<any>;
|
|
117
|
-
serviceAdapter: CopilotServiceAdapter;
|
|
118
|
-
endpoint: string;
|
|
119
|
-
baseUrl?: string;
|
|
120
|
-
cloud?: CopilotCloudOptions;
|
|
121
|
-
properties?: CopilotRequestContextProperties;
|
|
122
|
-
logLevel?: LogLevel;
|
|
123
|
-
}
|
|
124
|
-
declare function createContext(initialContext: YogaInitialContext, copilotKitContext: CreateCopilotRuntimeServerOptions, contextLogger: typeof logger, properties?: CopilotRequestContextProperties): Promise<Partial<GraphQLContext>>;
|
|
125
|
-
declare function buildSchema(options?: {
|
|
126
|
-
emitSchemaFile?: string;
|
|
127
|
-
}): graphql.GraphQLSchema;
|
|
128
|
-
type CommonConfig = {
|
|
129
|
-
logging: typeof logger;
|
|
130
|
-
schema: ReturnType<typeof buildSchema>;
|
|
131
|
-
plugins: Parameters<typeof createYoga>[0]["plugins"];
|
|
132
|
-
context: (ctx: YogaInitialContext) => Promise<Partial<GraphQLContext>>;
|
|
133
|
-
};
|
|
134
|
-
declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): CommonConfig;
|
|
135
|
-
|
|
136
167
|
export { CopilotRuntimeConstructorParams as C, GraphQLContext as G, CopilotRuntime as a, CopilotRequestContextProperties as b, CreateCopilotRuntimeServerOptions as c, createContext as d, buildSchema as e, flattenToolCallsNoDuplicates as f, CommonConfig as g, getCommonConfig as h };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActionExecutionMessage, a as Message, R as ResultMessage, T as TextMessage } from '../../../index-
|
|
1
|
+
export { A as ActionExecutionMessage, b as AgentStateMessage, a as Message, R as ResultMessage, T as TextMessage } from '../../../index-0476e4f7.js';
|
|
2
2
|
import '../base/index.js';
|
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var converted_exports = {};
|
|
22
22
|
__export(converted_exports, {
|
|
23
23
|
ActionExecutionMessage: () => ActionExecutionMessage,
|
|
24
|
+
AgentStateMessage: () => AgentStateMessage,
|
|
24
25
|
ResultMessage: () => ResultMessage,
|
|
25
26
|
TextMessage: () => TextMessage
|
|
26
27
|
});
|
|
@@ -79,9 +80,21 @@ var ResultMessage = class extends BaseMessage {
|
|
|
79
80
|
result;
|
|
80
81
|
};
|
|
81
82
|
__name(ResultMessage, "ResultMessage");
|
|
83
|
+
var AgentStateMessage = class extends BaseMessage {
|
|
84
|
+
threadId;
|
|
85
|
+
agentName;
|
|
86
|
+
nodeName;
|
|
87
|
+
runId;
|
|
88
|
+
active;
|
|
89
|
+
role;
|
|
90
|
+
state;
|
|
91
|
+
running;
|
|
92
|
+
};
|
|
93
|
+
__name(AgentStateMessage, "AgentStateMessage");
|
|
82
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
83
95
|
0 && (module.exports = {
|
|
84
96
|
ActionExecutionMessage,
|
|
97
|
+
AgentStateMessage,
|
|
85
98
|
ResultMessage,
|
|
86
99
|
TextMessage
|
|
87
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/graphql/types/converted/index.ts","../../../../src/graphql/types/base/index.ts"],"sourcesContent":["import {\n ActionExecutionMessageInput,\n ResultMessageInput,\n TextMessageInput,\n} from \"../../inputs/message.input\";\nimport { BaseMessage } from \"../base\";\nimport { ActionExecutionScope, MessageRole } from \"../enums\";\n\nexport class TextMessage extends BaseMessage implements TextMessageInput {\n content: string;\n role: MessageRole;\n}\n\nexport type Message = BaseMessage;\n\nexport class ActionExecutionMessage\n extends BaseMessage\n implements Omit<ActionExecutionMessageInput, \"arguments\">\n{\n name: string;\n arguments: Record<string, any>;\n scope: ActionExecutionScope;\n}\n\nexport class ResultMessage extends BaseMessage implements ResultMessageInput {\n actionExecutionId: string;\n actionName: string;\n result: string;\n}\n","import { Field, InputType } from \"type-graphql\";\n\n@InputType()\nexport class BaseMessage {\n @Field(() => String)\n id: string;\n\n @Field(() => Date)\n createdAt: Date;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../src/graphql/types/converted/index.ts","../../../../src/graphql/types/base/index.ts"],"sourcesContent":["import {\n ActionExecutionMessageInput,\n ResultMessageInput,\n TextMessageInput,\n AgentStateMessageInput,\n} from \"../../inputs/message.input\";\nimport { BaseMessage } from \"../base\";\nimport { ActionExecutionScope, MessageRole } from \"../enums\";\n\nexport class TextMessage extends BaseMessage implements TextMessageInput {\n content: string;\n role: MessageRole;\n}\n\nexport type Message = BaseMessage;\n\nexport class ActionExecutionMessage\n extends BaseMessage\n implements Omit<ActionExecutionMessageInput, \"arguments\">\n{\n name: string;\n arguments: Record<string, any>;\n scope: ActionExecutionScope;\n}\n\nexport class ResultMessage extends BaseMessage implements ResultMessageInput {\n actionExecutionId: string;\n actionName: string;\n result: string;\n}\n\nexport class AgentStateMessage\n extends BaseMessage\n implements Omit<AgentStateMessageInput, \"state\">\n{\n threadId: string;\n agentName: string;\n nodeName: string;\n runId: string;\n active: boolean;\n role: MessageRole;\n state: any;\n running: boolean;\n}\n","import { Field, InputType } from \"type-graphql\";\n\n@InputType()\nexport class BaseMessage {\n @Field(() => String)\n id: string;\n\n @Field(() => Date)\n createdAt: Date;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA;;;;;;;;;;ACNA,0BAAiC;;;;;;;;;;;;;;;;;AAG1B,IAAMA,cAAN,MAAMA;EAEXC;EAGAC;AACF;AANaF;;MACVG,2BAAM,MAAMC,MAAAA;;GADFJ,YAAAA,WAAAA,MAAAA,MAAAA;;MAIVG,2BAAM,MAAME,IAAAA;qCACF,SAAA,cAAA,SAAA,IAAA;GALAL,YAAAA,WAAAA,aAAAA,MAAAA;AAAAA,cAAAA,aAAAA;MADZM,+BAAAA;GACYN,WAAAA;;;ADMN,IAAMO,cAAN,cAA0BC,YAAAA;EAC/BC;EACAC;AACF;AAHaH;AAON,IAAMI,yBAAN,cACGH,YAAAA;EAGRI;EACAC;EACAC;AACF;AAPaH;AASN,IAAMI,gBAAN,cAA4BP,YAAAA;EACjCQ;EACAC;EACAC;AACF;AAJaH;AAMN,IAAMI,oBAAN,cACGX,YAAAA;EAGRY;EACAC;EACAC;EACAC;EACAC;EACAd;EACAe;EACAC;AACF;AAZaP;","names":["BaseMessage","id","createdAt","Field","String","Date","InputType","TextMessage","BaseMessage","content","role","ActionExecutionMessage","name","arguments","scope","ResultMessage","actionExecutionId","actionName","result","AgentStateMessage","threadId","agentName","nodeName","runId","active","state","running"]}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionExecutionMessage,
|
|
3
|
+
AgentStateMessage,
|
|
3
4
|
ResultMessage,
|
|
4
5
|
TextMessage
|
|
5
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-TBZGOJJX.mjs";
|
|
6
7
|
import "../../../chunk-RMZWGQ46.mjs";
|
|
7
8
|
import "../../../chunk-44O2JGUY.mjs";
|
|
8
9
|
export {
|
|
9
10
|
ActionExecutionMessage,
|
|
11
|
+
AgentStateMessage,
|
|
10
12
|
ResultMessage,
|
|
11
13
|
TextMessage
|
|
12
14
|
};
|
|
@@ -7,13 +7,15 @@ declare enum MessageRole {
|
|
|
7
7
|
}
|
|
8
8
|
declare enum ActionExecutionScope {
|
|
9
9
|
server = "server",
|
|
10
|
-
client = "client"
|
|
10
|
+
client = "client",
|
|
11
|
+
passThrough = "passThrough"
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
declare class MessageInput extends BaseMessage {
|
|
14
15
|
textMessage?: TextMessageInput;
|
|
15
16
|
actionExecutionMessage?: ActionExecutionMessageInput;
|
|
16
17
|
resultMessage?: ResultMessageInput;
|
|
18
|
+
agentStateMessage?: AgentStateMessageInput;
|
|
17
19
|
}
|
|
18
20
|
declare class TextMessageInput {
|
|
19
21
|
content: string;
|
|
@@ -29,6 +31,16 @@ declare class ResultMessageInput {
|
|
|
29
31
|
actionName: string;
|
|
30
32
|
result: string;
|
|
31
33
|
}
|
|
34
|
+
declare class AgentStateMessageInput {
|
|
35
|
+
threadId: string;
|
|
36
|
+
agentName: string;
|
|
37
|
+
role: MessageRole;
|
|
38
|
+
state: string;
|
|
39
|
+
running: boolean;
|
|
40
|
+
nodeName: string;
|
|
41
|
+
runId: string;
|
|
42
|
+
active: boolean;
|
|
43
|
+
}
|
|
32
44
|
|
|
33
45
|
declare class TextMessage extends BaseMessage implements TextMessageInput {
|
|
34
46
|
content: string;
|
|
@@ -45,5 +57,15 @@ declare class ResultMessage extends BaseMessage implements ResultMessageInput {
|
|
|
45
57
|
actionName: string;
|
|
46
58
|
result: string;
|
|
47
59
|
}
|
|
60
|
+
declare class AgentStateMessage extends BaseMessage implements Omit<AgentStateMessageInput, "state"> {
|
|
61
|
+
threadId: string;
|
|
62
|
+
agentName: string;
|
|
63
|
+
nodeName: string;
|
|
64
|
+
runId: string;
|
|
65
|
+
active: boolean;
|
|
66
|
+
role: MessageRole;
|
|
67
|
+
state: any;
|
|
68
|
+
running: boolean;
|
|
69
|
+
}
|
|
48
70
|
|
|
49
|
-
export { ActionExecutionMessage as A, MessageInput as M, ResultMessage as R, TextMessage as T, Message as a };
|
|
71
|
+
export { ActionExecutionMessage as A, MessageInput as M, ResultMessage as R, TextMessage as T, Message as a, AgentStateMessage as b };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { C as CopilotServiceAdapter, b as CopilotRuntimeChatCompletionRequest, c as CopilotRuntimeChatCompletionResponse } from './langserve-d6073a3b.js';
|
|
1
2
|
import OpenAI from 'openai';
|
|
2
|
-
import { C as CopilotServiceAdapter, b as CopilotRuntimeChatCompletionRequest, c as CopilotRuntimeChatCompletionResponse } from './langserve-a54438c6.js';
|
|
3
3
|
import { GenerativeModel } from '@google/generative-ai';
|
|
4
4
|
import { BaseMessageChunk, AIMessage, AIMessageChunk, BaseMessage } from '@langchain/core/messages';
|
|
5
5
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
@@ -38,9 +38,19 @@ interface OpenAIAdapterParams {
|
|
|
38
38
|
* The model to use.
|
|
39
39
|
*/
|
|
40
40
|
model?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to disable parallel tool calls.
|
|
43
|
+
* You can disable parallel tool calls to force the model to execute tool calls sequentially.
|
|
44
|
+
* This is useful if you want to execute tool calls in a specific order so that the state changes
|
|
45
|
+
* introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
|
|
46
|
+
*
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disableParallelToolCalls?: boolean;
|
|
41
50
|
}
|
|
42
51
|
declare class OpenAIAdapter implements CopilotServiceAdapter {
|
|
43
52
|
private model;
|
|
53
|
+
private disableParallelToolCalls;
|
|
44
54
|
private _openai;
|
|
45
55
|
get openai(): OpenAI;
|
|
46
56
|
constructor(params?: OpenAIAdapterParams);
|
|
@@ -93,12 +103,22 @@ interface OpenAIAssistantAdapterParams {
|
|
|
93
103
|
* @default true
|
|
94
104
|
*/
|
|
95
105
|
fileSearchEnabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether to disable parallel tool calls.
|
|
108
|
+
* You can disable parallel tool calls to force the model to execute tool calls sequentially.
|
|
109
|
+
* This is useful if you want to execute tool calls in a specific order so that the state changes
|
|
110
|
+
* introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
|
|
111
|
+
*
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
disableParallelToolCalls?: boolean;
|
|
96
115
|
}
|
|
97
116
|
declare class OpenAIAssistantAdapter implements CopilotServiceAdapter {
|
|
98
117
|
private openai;
|
|
99
118
|
private codeInterpreterEnabled;
|
|
100
119
|
private assistantId;
|
|
101
120
|
private fileSearchEnabled;
|
|
121
|
+
private disableParallelToolCalls;
|
|
102
122
|
constructor(params: OpenAIAssistantAdapterParams);
|
|
103
123
|
process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
|
|
104
124
|
private submitToolOutputs;
|
|
@@ -240,9 +260,19 @@ interface GroqAdapterParams {
|
|
|
240
260
|
* The model to use.
|
|
241
261
|
*/
|
|
242
262
|
model?: string;
|
|
263
|
+
/**
|
|
264
|
+
* Whether to disable parallel tool calls.
|
|
265
|
+
* You can disable parallel tool calls to force the model to execute tool calls sequentially.
|
|
266
|
+
* This is useful if you want to execute tool calls in a specific order so that the state changes
|
|
267
|
+
* introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)
|
|
268
|
+
*
|
|
269
|
+
* @default false
|
|
270
|
+
*/
|
|
271
|
+
disableParallelToolCalls?: boolean;
|
|
243
272
|
}
|
|
244
273
|
declare class GroqAdapter implements CopilotServiceAdapter {
|
|
245
274
|
private model;
|
|
275
|
+
private disableParallelToolCalls;
|
|
246
276
|
private _groq;
|
|
247
277
|
get groq(): Groq;
|
|
248
278
|
constructor(params?: GroqAdapterParams);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema, d as createContext, f as flattenToolCallsNoDuplicates, h as getCommonConfig } from './
|
|
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 './
|
|
3
|
-
export {
|
|
1
|
+
export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema, d as createContext, f as flattenToolCallsNoDuplicates, h as getCommonConfig } from './copilot-runtime-d427e991.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 './index-079752b9.js';
|
|
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
|
-
export {
|
|
8
|
-
import 'graphql';
|
|
9
|
-
import 'pino';
|
|
10
|
-
import 'graphql-yoga';
|
|
7
|
+
export { GuardrailsValidationFailureResponse, MessageStreamInterruptedResponse, UnknownErrorResponse } from './utils/index.js';
|
|
11
8
|
import '@copilotkit/shared';
|
|
12
|
-
import './langserve-
|
|
13
|
-
import './index-
|
|
9
|
+
import './langserve-d6073a3b.js';
|
|
10
|
+
import './index-0476e4f7.js';
|
|
14
11
|
import './graphql/types/base/index.js';
|
|
15
12
|
import 'rxjs';
|
|
13
|
+
import 'graphql';
|
|
14
|
+
import 'pino';
|
|
15
|
+
import 'graphql-yoga';
|
|
16
16
|
import './lib/cloud/index.js';
|
|
17
17
|
import 'openai';
|
|
18
18
|
import '@google/generative-ai';
|