@copilotkit/runtime 0.38.0-mme-alpha.0 → 1.0.0-beta.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/.turbo/turbo-build.log +41 -41
- package/CHANGELOG.md +10 -4
- package/dist/{chunk-6OJ47NCG.mjs → chunk-2PJG3NAC.mjs} +2 -2
- package/dist/{chunk-EWS5TMDA.mjs → chunk-6YGDE3YI.mjs} +91 -84
- package/dist/chunk-6YGDE3YI.mjs.map +1 -0
- package/dist/{chunk-XI3HBDMA.mjs → chunk-JBDOA7MK.mjs} +22 -11
- package/dist/chunk-JBDOA7MK.mjs.map +1 -0
- package/dist/{chunk-XXYCNRFT.mjs → chunk-JIKPSUGQ.mjs} +36 -69
- package/dist/chunk-JIKPSUGQ.mjs.map +1 -0
- package/dist/{index-d5ba24be.d.ts → index-0e75acd2.d.ts} +64 -38
- package/dist/index.d.ts +4 -4
- package/dist/index.js +163 -186
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{langchain-adapter-54784d29.d.ts → langchain-adapter-a02d1d38.d.ts} +4 -4
- package/dist/{langserve-63794237.d.ts → langserve-75ebbc38.d.ts} +1 -2
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +163 -186
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -10
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +118 -95
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +118 -95
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{pages-router-d94f01da.d.ts → pages-router-e81920d5.d.ts} +1 -1
- package/dist/service-adapters/index.d.ts +2 -2
- package/dist/service-adapters/index.js +28 -17
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +4 -4
- package/src/graphql/resolvers/copilot.resolver.ts +95 -24
- package/src/lib/copilot-runtime.ts +106 -36
- package/src/lib/index.ts +0 -1
- package/src/lib/integrations/shared.ts +1 -1
- package/src/service-adapters/experimental/groq/groq-adapter.ts +3 -1
- package/src/service-adapters/experimental/ollama/ollama-adapter.ts +3 -1
- package/src/service-adapters/google/google-genai-adapter.ts +3 -1
- package/src/service-adapters/langchain/langchain-adapter.ts +8 -9
- package/src/service-adapters/openai/openai-adapter.ts +8 -7
- package/src/service-adapters/openai/openai-assistant-adapter.ts +6 -8
- package/src/service-adapters/service-adapter.ts +1 -2
- package/dist/chunk-EWS5TMDA.mjs.map +0 -1
- package/dist/chunk-XI3HBDMA.mjs.map +0 -1
- package/dist/chunk-XXYCNRFT.mjs.map +0 -1
- package/src/lib/copilot-cloud.ts +0 -63
- /package/dist/{chunk-6OJ47NCG.mjs.map → chunk-2PJG3NAC.mjs.map} +0 -0
|
@@ -2,29 +2,11 @@ import * as graphql_yoga from 'graphql-yoga';
|
|
|
2
2
|
import { YogaInitialContext, createYoga } from 'graphql-yoga';
|
|
3
3
|
import * as graphql from 'graphql';
|
|
4
4
|
import * as pino from 'pino';
|
|
5
|
-
import {
|
|
6
|
-
import { R as RemoteChainParameters, A as ActionInput, C as CopilotServiceAdapter, a as RuntimeEventSource } from './langserve-
|
|
7
|
-
import { M as MessageInput } from './index-aa091e3c.js';
|
|
5
|
+
import { Parameter, Action } from '@copilotkit/shared';
|
|
6
|
+
import { R as RemoteChainParameters, A as ActionInput, C as CopilotServiceAdapter, a as RuntimeEventSource } from './langserve-75ebbc38.js';
|
|
7
|
+
import { M as MessageInput, a as Message } from './index-aa091e3c.js';
|
|
8
8
|
import { CopilotCloudOptions } from './lib/cloud/index.js';
|
|
9
9
|
|
|
10
|
-
interface CloudCheckGuardrailsInputParams {
|
|
11
|
-
cloud: CopilotCloudConfig;
|
|
12
|
-
publicApiKey: string;
|
|
13
|
-
messages: any[];
|
|
14
|
-
}
|
|
15
|
-
interface CloudCheckGuardrailsInputResponse {
|
|
16
|
-
status: "allowed" | "denied";
|
|
17
|
-
reason: string;
|
|
18
|
-
}
|
|
19
|
-
declare abstract class CopilotCloud {
|
|
20
|
-
abstract checkGuardrailsInput(params: CloudCheckGuardrailsInputParams): Promise<CloudCheckGuardrailsInputResponse>;
|
|
21
|
-
}
|
|
22
|
-
declare class RemoteCopilotCloud extends CopilotCloud {
|
|
23
|
-
private readonly cloudApiUrl;
|
|
24
|
-
constructor(cloudApiUrl?: string);
|
|
25
|
-
checkGuardrailsInput({ cloud, publicApiKey, messages, }: CloudCheckGuardrailsInputParams): Promise<CloudCheckGuardrailsInputResponse>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
10
|
/**
|
|
29
11
|
* Handles requests from frontend, provides function calling and various LLM backends.
|
|
30
12
|
*
|
|
@@ -129,38 +111,82 @@ interface CopilotRuntimeRequest {
|
|
|
129
111
|
serviceAdapter: CopilotServiceAdapter;
|
|
130
112
|
messages: MessageInput[];
|
|
131
113
|
actions: ActionInput[];
|
|
114
|
+
outputMessagesPromise: Promise<Message[]>;
|
|
115
|
+
properties: any;
|
|
132
116
|
threadId?: string;
|
|
133
117
|
runId?: string;
|
|
134
118
|
publicApiKey?: string;
|
|
135
119
|
}
|
|
136
120
|
interface CopilotRuntimeResponse {
|
|
137
|
-
threadId
|
|
121
|
+
threadId: string;
|
|
138
122
|
runId?: string;
|
|
139
123
|
eventSource: RuntimeEventSource;
|
|
140
124
|
actions: Action<any>[];
|
|
141
125
|
}
|
|
126
|
+
type ActionsConfiguration<T extends Parameter[] | [] = []> = Action<T>[] | ((ctx: {
|
|
127
|
+
properties: any;
|
|
128
|
+
}) => Action<T>[]);
|
|
129
|
+
interface OnBeforeRequestOptions {
|
|
130
|
+
threadId?: string;
|
|
131
|
+
runId?: string;
|
|
132
|
+
inputMessages: Message[];
|
|
133
|
+
properties: any;
|
|
134
|
+
}
|
|
135
|
+
type OnBeforeRequestHandler = (options: OnBeforeRequestOptions) => void | Promise<void>;
|
|
136
|
+
interface OnAfterRequestOptions {
|
|
137
|
+
threadId: string;
|
|
138
|
+
runId?: string;
|
|
139
|
+
inputMessages: Message[];
|
|
140
|
+
outputMessages: Message[];
|
|
141
|
+
properties: any;
|
|
142
|
+
}
|
|
143
|
+
type OnAfterRequestHandler = (options: OnAfterRequestOptions) => void | Promise<void>;
|
|
144
|
+
interface Middleware {
|
|
145
|
+
/**
|
|
146
|
+
* A function that is called before the request is processed.
|
|
147
|
+
*/
|
|
148
|
+
onBeforeRequest?: OnBeforeRequestHandler;
|
|
149
|
+
/**
|
|
150
|
+
* A function that is called after the request is processed.
|
|
151
|
+
*/
|
|
152
|
+
onAfterRequest?: OnAfterRequestHandler;
|
|
153
|
+
}
|
|
142
154
|
interface CopilotRuntimeConstructorParams<T extends Parameter[] | [] = []> {
|
|
143
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Middleware to be used by the runtime.
|
|
157
|
+
*
|
|
158
|
+
* ```ts
|
|
159
|
+
* onBeforeRequest: (options: {
|
|
160
|
+
* threadId?: string;
|
|
161
|
+
* runId?: string;
|
|
162
|
+
* inputMessages: Message[];
|
|
163
|
+
* properties: any;
|
|
164
|
+
* }) => void | Promise<void>;
|
|
165
|
+
* ```
|
|
166
|
+
*
|
|
167
|
+
* ```ts
|
|
168
|
+
* onAfterRequest: (options: {
|
|
169
|
+
* threadId?: string;
|
|
170
|
+
* runId?: string;
|
|
171
|
+
* inputMessages: Message[];
|
|
172
|
+
* outputMessages: Message[];
|
|
173
|
+
* properties: any;
|
|
174
|
+
* }) => void | Promise<void>;
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
middleware?: Middleware;
|
|
178
|
+
actions?: ActionsConfiguration<T>;
|
|
144
179
|
langserve?: RemoteChainParameters[];
|
|
145
|
-
debug?: boolean;
|
|
146
|
-
copilotCloud?: CopilotCloud;
|
|
147
180
|
}
|
|
148
181
|
declare class CopilotRuntime<const T extends Parameter[] | [] = []> {
|
|
149
|
-
actions:
|
|
182
|
+
actions: ActionsConfiguration<T>;
|
|
150
183
|
private langserve;
|
|
151
|
-
private
|
|
152
|
-
private
|
|
184
|
+
private onBeforeRequest?;
|
|
185
|
+
private onAfterRequest?;
|
|
153
186
|
constructor(params?: CopilotRuntimeConstructorParams<T>);
|
|
154
|
-
|
|
155
|
-
removeAction(actionName: string): void;
|
|
156
|
-
process({ serviceAdapter, messages, actions: clientSideActionsInput, threadId, runId, publicApiKey, }: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse>;
|
|
187
|
+
process(request: CopilotRuntimeRequest): Promise<CopilotRuntimeResponse>;
|
|
157
188
|
}
|
|
158
189
|
declare function flattenToolCallsNoDuplicates(toolsByPriority: ActionInput[]): ActionInput[];
|
|
159
|
-
/**
|
|
160
|
-
* @deprecated use CopilotRuntime instead
|
|
161
|
-
*/
|
|
162
|
-
declare class CopilotBackend extends CopilotRuntime {
|
|
163
|
-
}
|
|
164
190
|
|
|
165
191
|
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
166
192
|
|
|
@@ -173,7 +199,7 @@ type GraphQLContext = YogaInitialContext & {
|
|
|
173
199
|
logger: typeof logger;
|
|
174
200
|
};
|
|
175
201
|
interface CreateCopilotRuntimeServerOptions {
|
|
176
|
-
runtime: CopilotRuntime
|
|
202
|
+
runtime: CopilotRuntime<any>;
|
|
177
203
|
serviceAdapter: CopilotServiceAdapter;
|
|
178
204
|
endpoint: string;
|
|
179
205
|
baseUrl?: string;
|
|
@@ -195,4 +221,4 @@ declare function getCommonConfig(options: CreateCopilotRuntimeServerOptions): Co
|
|
|
195
221
|
|
|
196
222
|
declare function copilotRuntimeNodeHttpEndpoint(options: CreateCopilotRuntimeServerOptions): graphql_yoga.YogaServerInstance<{}, Partial<GraphQLContext>>;
|
|
197
223
|
|
|
198
|
-
export { CopilotRuntimeConstructorParams as C, GraphQLContext as G,
|
|
224
|
+
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, copilotRuntimeNodeHttpEndpoint as i };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { G as GoogleGenerativeAIAdapter, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams } from './langchain-adapter-
|
|
3
|
-
export { C as CopilotRuntimeServerInstance, a as config, c as copilotRuntimeNextJSAppRouterEndpoint, b as copilotRuntimeNextJSPagesRouterEndpoint } from './pages-router-
|
|
1
|
+
export { g as CommonConfig, b as CopilotRequestContextProperties, a as CopilotRuntime, C as CopilotRuntimeConstructorParams, c as CreateCopilotRuntimeServerOptions, G as GraphQLContext, e as buildSchema, i as copilotRuntimeNodeHttpEndpoint, d as createContext, f as flattenToolCallsNoDuplicates, h as getCommonConfig } from './index-0e75acd2.js';
|
|
2
|
+
export { G as GoogleGenerativeAIAdapter, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams } from './langchain-adapter-a02d1d38.js';
|
|
3
|
+
export { C as CopilotRuntimeServerInstance, a as config, c as copilotRuntimeNextJSAppRouterEndpoint, b as copilotRuntimeNextJSPagesRouterEndpoint } from './pages-router-e81920d5.js';
|
|
4
4
|
export { G as GuardrailsValidationFailureResponse, M as MessageStreamInterruptedResponse, U as UnknownErrorResponse } from './failed-response-status-reasons-0ab19e06.js';
|
|
5
5
|
import 'graphql-yoga';
|
|
6
6
|
import 'graphql';
|
|
7
7
|
import 'pino';
|
|
8
8
|
import '@copilotkit/shared';
|
|
9
|
-
import './langserve-
|
|
9
|
+
import './langserve-75ebbc38.js';
|
|
10
10
|
import './index-aa091e3c.js';
|
|
11
11
|
import './graphql/types/base/index.js';
|
|
12
12
|
import 'rxjs';
|