@copilotkit/runtime 1.5.12-next.6 → 1.5.12
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 +22 -0
- package/__snapshots__/schema/schema.graphql +33 -0
- package/dist/{chunk-XM2VJFL6.mjs → chunk-4LRVKGBI.mjs} +2 -2
- package/dist/{chunk-YGXAWYRB.mjs → chunk-IS3QAGOU.mjs} +2 -2
- package/dist/{chunk-ON4AESON.mjs → chunk-PFELVFS7.mjs} +540 -221
- package/dist/chunk-PFELVFS7.mjs.map +1 -0
- package/dist/{chunk-TPTCSIAR.mjs → chunk-S3KKBII4.mjs} +42 -30
- package/dist/chunk-S3KKBII4.mjs.map +1 -0
- package/dist/{chunk-BKIGYRXE.mjs → chunk-W6EE6OTN.mjs} +2 -2
- package/dist/{copilot-runtime-da917bd5.d.ts → copilot-runtime-8c442d65.d.ts} +16 -5
- package/dist/graphql/types/converted/index.d.ts +1 -1
- package/dist/{groq-adapter-c35c5374.d.ts → groq-adapter-7a82cd22.d.ts} +21 -1
- package/dist/{index-24315d90.d.ts → index-a7f37670.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +628 -297
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/{langserve-a16ef8f4.d.ts → langserve-e308c437.d.ts} +32 -3
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +626 -295
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/lib/integrations/index.d.ts +4 -4
- package/dist/lib/integrations/index.js +495 -237
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +5 -5
- package/dist/lib/integrations/nest/index.d.ts +3 -3
- package/dist/lib/integrations/nest/index.js +495 -237
- 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.d.ts +3 -3
- package/dist/lib/integrations/node-express/index.js +495 -237
- 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.d.ts +3 -3
- package/dist/lib/integrations/node-http/index.js +495 -237
- 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.d.ts +4 -4
- package/dist/service-adapters/index.js +23 -11
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +2 -2
- package/src/graphql/inputs/extensions.input.ts +21 -0
- package/src/graphql/inputs/generate-copilot-response.input.ts +4 -0
- package/src/graphql/inputs/load-agent-state.input.ts +10 -0
- package/src/graphql/resolvers/copilot.resolver.ts +8 -3
- package/src/graphql/resolvers/state.resolver.ts +23 -0
- package/src/graphql/types/agents-response.type.ts +1 -4
- package/src/graphql/types/copilot-response.type.ts +5 -1
- package/src/graphql/types/extensions-response.type.ts +23 -0
- package/src/graphql/types/load-agent-state-response.type.ts +17 -0
- package/src/lib/integrations/shared.ts +2 -1
- package/src/lib/runtime/copilot-runtime.ts +102 -9
- package/src/lib/runtime/remote-lg-action.ts +24 -12
- package/src/service-adapters/anthropic/anthropic-adapter.ts +2 -3
- package/src/service-adapters/empty/empty-adapter.ts +2 -2
- package/src/service-adapters/events.ts +5 -0
- package/src/service-adapters/experimental/ollama/ollama-adapter.ts +2 -2
- package/src/service-adapters/groq/groq-adapter.ts +2 -2
- package/src/service-adapters/langchain/langchain-adapter.ts +10 -3
- package/src/service-adapters/openai/openai-adapter.ts +4 -3
- package/src/service-adapters/openai/openai-assistant-adapter.ts +15 -4
- package/src/service-adapters/service-adapter.ts +4 -0
- package/src/service-adapters/unify/unify-adapter.ts +2 -3
- package/dist/chunk-ON4AESON.mjs.map +0 -1
- package/dist/chunk-TPTCSIAR.mjs.map +0 -1
- /package/dist/{chunk-XM2VJFL6.mjs.map → chunk-4LRVKGBI.mjs.map} +0 -0
- /package/dist/{chunk-YGXAWYRB.mjs.map → chunk-IS3QAGOU.mjs.map} +0 -0
- /package/dist/{chunk-BKIGYRXE.mjs.map → chunk-W6EE6OTN.mjs.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-TPTCSIAR.mjs";
|
|
3
|
+
} from "../../../chunk-PFELVFS7.mjs";
|
|
5
4
|
import "../../../chunk-U3V2BCGI.mjs";
|
|
5
|
+
import "../../../chunk-S3KKBII4.mjs";
|
|
6
6
|
import "../../../chunk-HNUNXFTW.mjs";
|
|
7
7
|
import "../../../chunk-D2WLFQS6.mjs";
|
|
8
8
|
import "../../../chunk-44O2JGUY.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-
|
|
2
|
-
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-
|
|
3
|
-
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
|
+
import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-e308c437.js';
|
|
2
|
+
export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-e308c437.js';
|
|
3
|
+
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-7a82cd22.js';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
|
-
import '../index-
|
|
5
|
+
import '../index-a7f37670.js';
|
|
6
6
|
import '../graphql/types/base/index.js';
|
|
7
7
|
import 'rxjs';
|
|
8
8
|
import '@copilotkit/shared';
|
|
@@ -282,8 +282,9 @@ var OpenAIAdapter = class {
|
|
|
282
282
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
283
283
|
}
|
|
284
284
|
async process(request) {
|
|
285
|
-
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
285
|
+
const { threadId: threadIdFromRequest, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
286
286
|
const tools = actions.map(convertActionInputToOpenAITool);
|
|
287
|
+
const threadId = threadIdFromRequest ?? (0, import_shared.randomUUID)();
|
|
287
288
|
let openaiMessages = messages.map(convertMessageToOpenAIMessage);
|
|
288
289
|
openaiMessages = limitMessagesToTokenCount(openaiMessages, tools, model);
|
|
289
290
|
let toolChoice = forwardedParameters == null ? void 0 : forwardedParameters.toolChoice;
|
|
@@ -381,7 +382,7 @@ var OpenAIAdapter = class {
|
|
|
381
382
|
eventStream$.complete();
|
|
382
383
|
});
|
|
383
384
|
return {
|
|
384
|
-
threadId
|
|
385
|
+
threadId
|
|
385
386
|
};
|
|
386
387
|
}
|
|
387
388
|
};
|
|
@@ -627,8 +628,8 @@ var LangChainAdapter = class {
|
|
|
627
628
|
}
|
|
628
629
|
async process(request) {
|
|
629
630
|
try {
|
|
630
|
-
const { eventSource, model, actions, messages, runId } = request;
|
|
631
|
-
const threadId =
|
|
631
|
+
const { eventSource, model, actions, messages, runId, threadId: threadIdFromRequest } = request;
|
|
632
|
+
const threadId = threadIdFromRequest ?? (0, import_shared3.randomUUID)();
|
|
632
633
|
const result = await this.options.chainFn({
|
|
633
634
|
messages: messages.map(convertMessageToLangChainMessage),
|
|
634
635
|
tools: actions.map(convertActionInputToLangChainTool),
|
|
@@ -689,8 +690,12 @@ var OpenAIAssistantAdapter = class {
|
|
|
689
690
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
690
691
|
}
|
|
691
692
|
async process(request) {
|
|
693
|
+
var _a, _b;
|
|
692
694
|
const { messages, actions, eventSource, runId, forwardedParameters } = request;
|
|
693
|
-
let threadId = request.
|
|
695
|
+
let threadId = (_b = (_a = request.extensions) == null ? void 0 : _a.openaiAssistantAPI) == null ? void 0 : _b.threadId;
|
|
696
|
+
if (!threadId) {
|
|
697
|
+
threadId = (await this.openai.beta.threads.create()).id;
|
|
698
|
+
}
|
|
694
699
|
const lastMessage = messages.at(-1);
|
|
695
700
|
let nextRunId = void 0;
|
|
696
701
|
if (lastMessage.isResultMessage() && runId) {
|
|
@@ -701,8 +706,15 @@ var OpenAIAssistantAdapter = class {
|
|
|
701
706
|
throw new Error("No actionable message found in the messages");
|
|
702
707
|
}
|
|
703
708
|
return {
|
|
709
|
+
runId: nextRunId,
|
|
704
710
|
threadId,
|
|
705
|
-
|
|
711
|
+
extensions: {
|
|
712
|
+
...request.extensions,
|
|
713
|
+
openaiAssistantAPI: {
|
|
714
|
+
threadId,
|
|
715
|
+
runId: nextRunId
|
|
716
|
+
}
|
|
717
|
+
}
|
|
706
718
|
};
|
|
707
719
|
}
|
|
708
720
|
async submitToolOutputs(threadId, runId, messages, eventSource) {
|
|
@@ -970,7 +982,7 @@ var UnifyAdapter = class {
|
|
|
970
982
|
eventStream$.complete();
|
|
971
983
|
});
|
|
972
984
|
return {
|
|
973
|
-
threadId: request.threadId || (0, import_shared4.
|
|
985
|
+
threadId: request.threadId || (0, import_shared4.randomUUID)()
|
|
974
986
|
};
|
|
975
987
|
}
|
|
976
988
|
};
|
|
@@ -1091,7 +1103,7 @@ var GroqAdapter = class {
|
|
|
1091
1103
|
eventStream$.complete();
|
|
1092
1104
|
});
|
|
1093
1105
|
return {
|
|
1094
|
-
threadId: threadId || (0, import_shared5.
|
|
1106
|
+
threadId: request.threadId || (0, import_shared5.randomUUID)()
|
|
1095
1107
|
};
|
|
1096
1108
|
}
|
|
1097
1109
|
};
|
|
@@ -1342,7 +1354,7 @@ var AnthropicAdapter = class {
|
|
|
1342
1354
|
eventStream$.complete();
|
|
1343
1355
|
});
|
|
1344
1356
|
return {
|
|
1345
|
-
threadId: threadId || (0, import_shared6.
|
|
1357
|
+
threadId: threadId || (0, import_shared6.randomUUID)()
|
|
1346
1358
|
};
|
|
1347
1359
|
}
|
|
1348
1360
|
};
|
|
@@ -1417,7 +1429,7 @@ var ExperimentalOllamaAdapter = class {
|
|
|
1417
1429
|
eventStream$.complete();
|
|
1418
1430
|
});
|
|
1419
1431
|
return {
|
|
1420
|
-
threadId: request.threadId || (0, import_shared7.
|
|
1432
|
+
threadId: request.threadId || (0, import_shared7.randomUUID)()
|
|
1421
1433
|
};
|
|
1422
1434
|
}
|
|
1423
1435
|
};
|
|
@@ -1428,7 +1440,7 @@ var import_shared8 = require("@copilotkit/shared");
|
|
|
1428
1440
|
var EmptyAdapter = class {
|
|
1429
1441
|
async process(request) {
|
|
1430
1442
|
return {
|
|
1431
|
-
threadId: request.threadId || (0, import_shared8.
|
|
1443
|
+
threadId: request.threadId || (0, import_shared8.randomUUID)()
|
|
1432
1444
|
};
|
|
1433
1445
|
}
|
|
1434
1446
|
};
|