@copilotkit/runtime 1.5.12-next.5 → 1.5.12-next.7
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 +17 -0
- package/__snapshots__/schema/schema.graphql +33 -0
- package/dist/{chunk-MFDRA3BJ.mjs → chunk-34276UUU.mjs} +652 -285
- package/dist/chunk-34276UUU.mjs.map +1 -0
- package/dist/{chunk-XRW7ZSWJ.mjs → chunk-DLESGNLO.mjs} +2 -2
- package/dist/{chunk-TPTCSIAR.mjs → chunk-S3KKBII4.mjs} +42 -30
- package/dist/chunk-S3KKBII4.mjs.map +1 -0
- package/dist/{chunk-QDMAQO2C.mjs → chunk-UBYSQI43.mjs} +2 -2
- package/dist/{chunk-NORCONUM.mjs → chunk-WTUPF3W3.mjs} +2 -2
- package/dist/{copilot-runtime-1a224a0f.d.ts → copilot-runtime-8c442d65.d.ts} +16 -3
- 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 +727 -348
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- 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 +725 -346
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +4 -4
- package/dist/lib/integrations/index.js +504 -244
- 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 +504 -244
- 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 +504 -244
- 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 +504 -244
- 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 +155 -31
- package/src/lib/runtime/remote-action-constructors.ts +42 -33
- package/src/lib/runtime/remote-actions.ts +12 -7
- 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-MFDRA3BJ.mjs.map +0 -1
- package/dist/chunk-TPTCSIAR.mjs.map +0 -1
- /package/dist/{chunk-XRW7ZSWJ.mjs.map → chunk-DLESGNLO.mjs.map} +0 -0
- /package/dist/{chunk-QDMAQO2C.mjs.map → chunk-UBYSQI43.mjs.map} +0 -0
- /package/dist/{chunk-NORCONUM.mjs.map → chunk-WTUPF3W3.mjs.map} +0 -0
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.5.12-next.
|
|
47
|
+
version: "1.5.12-next.7",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -148,7 +148,7 @@ __export(lib_exports, {
|
|
|
148
148
|
module.exports = __toCommonJS(lib_exports);
|
|
149
149
|
|
|
150
150
|
// src/lib/runtime/copilot-runtime.ts
|
|
151
|
-
var
|
|
151
|
+
var import_shared13 = require("@copilotkit/shared");
|
|
152
152
|
|
|
153
153
|
// src/service-adapters/langchain/langserve.ts
|
|
154
154
|
var import_remote = require("langchain/runnables/remote");
|
|
@@ -388,8 +388,9 @@ var OpenAIAdapter = class {
|
|
|
388
388
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
389
389
|
}
|
|
390
390
|
async process(request) {
|
|
391
|
-
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
391
|
+
const { threadId: threadIdFromRequest, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
392
392
|
const tools = actions.map(convertActionInputToOpenAITool);
|
|
393
|
+
const threadId = threadIdFromRequest ?? (0, import_shared.randomUUID)();
|
|
393
394
|
let openaiMessages = messages.map(convertMessageToOpenAIMessage);
|
|
394
395
|
openaiMessages = limitMessagesToTokenCount(openaiMessages, tools, model);
|
|
395
396
|
let toolChoice = forwardedParameters == null ? void 0 : forwardedParameters.toolChoice;
|
|
@@ -487,7 +488,7 @@ var OpenAIAdapter = class {
|
|
|
487
488
|
eventStream$.complete();
|
|
488
489
|
});
|
|
489
490
|
return {
|
|
490
|
-
threadId
|
|
491
|
+
threadId
|
|
491
492
|
};
|
|
492
493
|
}
|
|
493
494
|
};
|
|
@@ -733,8 +734,8 @@ var LangChainAdapter = class {
|
|
|
733
734
|
}
|
|
734
735
|
async process(request) {
|
|
735
736
|
try {
|
|
736
|
-
const { eventSource, model, actions, messages, runId } = request;
|
|
737
|
-
const threadId =
|
|
737
|
+
const { eventSource, model, actions, messages, runId, threadId: threadIdFromRequest } = request;
|
|
738
|
+
const threadId = threadIdFromRequest ?? (0, import_shared3.randomUUID)();
|
|
738
739
|
const result = await this.options.chainFn({
|
|
739
740
|
messages: messages.map(convertMessageToLangChainMessage),
|
|
740
741
|
tools: actions.map(convertActionInputToLangChainTool),
|
|
@@ -795,8 +796,12 @@ var OpenAIAssistantAdapter = class {
|
|
|
795
796
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
796
797
|
}
|
|
797
798
|
async process(request) {
|
|
799
|
+
var _a, _b;
|
|
798
800
|
const { messages, actions, eventSource, runId, forwardedParameters } = request;
|
|
799
|
-
let threadId = request.
|
|
801
|
+
let threadId = (_b = (_a = request.extensions) == null ? void 0 : _a.openaiAssistantAPI) == null ? void 0 : _b.threadId;
|
|
802
|
+
if (!threadId) {
|
|
803
|
+
threadId = (await this.openai.beta.threads.create()).id;
|
|
804
|
+
}
|
|
800
805
|
const lastMessage = messages.at(-1);
|
|
801
806
|
let nextRunId = void 0;
|
|
802
807
|
if (lastMessage.isResultMessage() && runId) {
|
|
@@ -807,8 +812,15 @@ var OpenAIAssistantAdapter = class {
|
|
|
807
812
|
throw new Error("No actionable message found in the messages");
|
|
808
813
|
}
|
|
809
814
|
return {
|
|
815
|
+
runId: nextRunId,
|
|
810
816
|
threadId,
|
|
811
|
-
|
|
817
|
+
extensions: {
|
|
818
|
+
...request.extensions,
|
|
819
|
+
openaiAssistantAPI: {
|
|
820
|
+
threadId,
|
|
821
|
+
runId: nextRunId
|
|
822
|
+
}
|
|
823
|
+
}
|
|
812
824
|
};
|
|
813
825
|
}
|
|
814
826
|
async submitToolOutputs(threadId, runId, messages, eventSource) {
|
|
@@ -1076,7 +1088,7 @@ var UnifyAdapter = class {
|
|
|
1076
1088
|
eventStream$.complete();
|
|
1077
1089
|
});
|
|
1078
1090
|
return {
|
|
1079
|
-
threadId: request.threadId || (0, import_shared4.
|
|
1091
|
+
threadId: request.threadId || (0, import_shared4.randomUUID)()
|
|
1080
1092
|
};
|
|
1081
1093
|
}
|
|
1082
1094
|
};
|
|
@@ -1197,7 +1209,7 @@ var GroqAdapter = class {
|
|
|
1197
1209
|
eventStream$.complete();
|
|
1198
1210
|
});
|
|
1199
1211
|
return {
|
|
1200
|
-
threadId: threadId || (0, import_shared5.
|
|
1212
|
+
threadId: request.threadId || (0, import_shared5.randomUUID)()
|
|
1201
1213
|
};
|
|
1202
1214
|
}
|
|
1203
1215
|
};
|
|
@@ -1208,18 +1220,18 @@ var import_shared6 = require("@copilotkit/shared");
|
|
|
1208
1220
|
var EmptyAdapter = class {
|
|
1209
1221
|
async process(request) {
|
|
1210
1222
|
return {
|
|
1211
|
-
threadId: request.threadId || (0, import_shared6.
|
|
1223
|
+
threadId: request.threadId || (0, import_shared6.randomUUID)()
|
|
1212
1224
|
};
|
|
1213
1225
|
}
|
|
1214
1226
|
};
|
|
1215
1227
|
__name(EmptyAdapter, "EmptyAdapter");
|
|
1216
1228
|
|
|
1217
1229
|
// src/service-adapters/events.ts
|
|
1218
|
-
var
|
|
1230
|
+
var import_shared12 = require("@copilotkit/shared");
|
|
1219
1231
|
var import_rxjs2 = require("rxjs");
|
|
1220
1232
|
|
|
1221
1233
|
// src/lib/telemetry-client.ts
|
|
1222
|
-
var
|
|
1234
|
+
var import_shared11 = require("@copilotkit/shared");
|
|
1223
1235
|
|
|
1224
1236
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1225
1237
|
var import_node_crypto2 = require("crypto");
|
|
@@ -1467,6 +1479,7 @@ __name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
|
1467
1479
|
// src/lib/runtime/remote-lg-action.ts
|
|
1468
1480
|
var import_langgraph_sdk = require("@langchain/langgraph-sdk");
|
|
1469
1481
|
var import_node_crypto = require("crypto");
|
|
1482
|
+
var import_shared8 = require("@copilotkit/shared");
|
|
1470
1483
|
var import_partial_json = require("partial-json");
|
|
1471
1484
|
|
|
1472
1485
|
// src/graphql/types/enums.ts
|
|
@@ -1520,7 +1533,7 @@ async function execute(args) {
|
|
|
1520
1533
|
__name(execute, "execute");
|
|
1521
1534
|
async function streamEvents(controller, args) {
|
|
1522
1535
|
var _a, _b, _c, _d, _e, _f;
|
|
1523
|
-
const { deploymentUrl, langsmithApiKey, threadId:
|
|
1536
|
+
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2 } = args;
|
|
1524
1537
|
let nodeName = initialNodeName;
|
|
1525
1538
|
let state = initialState;
|
|
1526
1539
|
const { name, assistantId: initialAssistantId } = agent;
|
|
@@ -1528,15 +1541,18 @@ async function streamEvents(controller, args) {
|
|
|
1528
1541
|
apiUrl: deploymentUrl,
|
|
1529
1542
|
apiKey: langsmithApiKey
|
|
1530
1543
|
});
|
|
1531
|
-
let
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1544
|
+
let threadId = argsInitialThreadId ?? (0, import_shared8.randomUUID)();
|
|
1545
|
+
if (argsInitialThreadId && argsInitialThreadId.startsWith("ck-")) {
|
|
1546
|
+
threadId = argsInitialThreadId.substring(3);
|
|
1547
|
+
}
|
|
1548
|
+
if (!(0, import_shared8.isValidUUID)(threadId)) {
|
|
1549
|
+
console.warn(`Cannot use the threadId ${threadId} with LangGraph Platform. Must be a valid UUID.`);
|
|
1535
1550
|
}
|
|
1536
|
-
|
|
1537
|
-
|
|
1551
|
+
let wasInitiatedWithExistingThread = true;
|
|
1552
|
+
try {
|
|
1538
1553
|
await client.threads.get(threadId);
|
|
1539
|
-
}
|
|
1554
|
+
} catch (error) {
|
|
1555
|
+
wasInitiatedWithExistingThread = false;
|
|
1540
1556
|
await client.threads.create({
|
|
1541
1557
|
threadId
|
|
1542
1558
|
});
|
|
@@ -1549,7 +1565,7 @@ async function streamEvents(controller, args) {
|
|
|
1549
1565
|
}
|
|
1550
1566
|
const agentStateValues = agentState.values;
|
|
1551
1567
|
state.messages = agentStateValues.messages;
|
|
1552
|
-
const mode =
|
|
1568
|
+
const mode = threadId && nodeName != "__end__" && nodeName != void 0 && nodeName != null ? "continue" : "start";
|
|
1553
1569
|
let formattedMessages = [];
|
|
1554
1570
|
try {
|
|
1555
1571
|
formattedMessages = copilotkitMessagesToLangChain(messages);
|
|
@@ -1969,6 +1985,7 @@ function copilotkitMessagesToLangChain(messages) {
|
|
|
1969
1985
|
__name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
|
|
1970
1986
|
|
|
1971
1987
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1988
|
+
var import_shared9 = require("@copilotkit/shared");
|
|
1972
1989
|
function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
1973
1990
|
const agents = endpoint.agents.map((agent) => ({
|
|
1974
1991
|
name: agent.name,
|
|
@@ -2049,8 +2066,9 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2049
2066
|
type: "self-hosted",
|
|
2050
2067
|
agentsAmount: totalAgents
|
|
2051
2068
|
});
|
|
2069
|
+
const fetchUrl = `${url}/actions/execute`;
|
|
2052
2070
|
try {
|
|
2053
|
-
const response = await fetch(
|
|
2071
|
+
const response = await fetch(fetchUrl, {
|
|
2054
2072
|
method: "POST",
|
|
2055
2073
|
headers,
|
|
2056
2074
|
body: JSON.stringify({
|
|
@@ -2075,10 +2093,13 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2075
2093
|
}, "Executed remote action");
|
|
2076
2094
|
return result;
|
|
2077
2095
|
} catch (error) {
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2096
|
+
if (error instanceof import_shared9.CopilotKitError) {
|
|
2097
|
+
throw error;
|
|
2098
|
+
}
|
|
2099
|
+
throw new import_shared9.CopilotKitLowLevelError({
|
|
2100
|
+
error,
|
|
2101
|
+
url: fetchUrl
|
|
2102
|
+
});
|
|
2082
2103
|
}
|
|
2083
2104
|
}
|
|
2084
2105
|
}));
|
|
@@ -2106,37 +2127,48 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2106
2127
|
state = JSON.parse(jsonState);
|
|
2107
2128
|
}
|
|
2108
2129
|
}
|
|
2109
|
-
const
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2130
|
+
const fetchUrl = `${url}/agents/execute`;
|
|
2131
|
+
try {
|
|
2132
|
+
const response = await fetch(fetchUrl, {
|
|
2133
|
+
method: "POST",
|
|
2134
|
+
headers,
|
|
2135
|
+
body: JSON.stringify({
|
|
2136
|
+
name,
|
|
2137
|
+
threadId,
|
|
2138
|
+
nodeName,
|
|
2139
|
+
messages: [
|
|
2140
|
+
...messages,
|
|
2141
|
+
...additionalMessages
|
|
2142
|
+
],
|
|
2143
|
+
state,
|
|
2144
|
+
properties: graphqlContext.properties,
|
|
2145
|
+
actions: actionInputsWithoutAgents.map((action) => ({
|
|
2146
|
+
name: action.name,
|
|
2147
|
+
description: action.description,
|
|
2148
|
+
parameters: JSON.parse(action.jsonSchema)
|
|
2149
|
+
}))
|
|
2150
|
+
})
|
|
2151
|
+
});
|
|
2152
|
+
if (!response.ok) {
|
|
2153
|
+
logger2.error({
|
|
2154
|
+
url,
|
|
2155
|
+
status: response.status,
|
|
2156
|
+
body: await response.text()
|
|
2157
|
+
}, "Failed to execute remote agent");
|
|
2158
|
+
throw new Error("Failed to execute remote agent");
|
|
2159
|
+
}
|
|
2160
|
+
const eventSource = new RemoteLangGraphEventSource();
|
|
2161
|
+
streamResponse(response.body, eventSource.eventStream$);
|
|
2162
|
+
return eventSource.processLangGraphEvents();
|
|
2163
|
+
} catch (error) {
|
|
2164
|
+
if (error instanceof import_shared9.CopilotKitError) {
|
|
2165
|
+
throw error;
|
|
2166
|
+
}
|
|
2167
|
+
throw new import_shared9.CopilotKitLowLevelError({
|
|
2168
|
+
error,
|
|
2169
|
+
url: fetchUrl
|
|
2170
|
+
});
|
|
2136
2171
|
}
|
|
2137
|
-
const eventSource = new RemoteLangGraphEventSource();
|
|
2138
|
-
streamResponse(response.body, eventSource.eventStream$);
|
|
2139
|
-
return eventSource.processLangGraphEvents();
|
|
2140
2172
|
}
|
|
2141
2173
|
})) : [];
|
|
2142
2174
|
return [
|
|
@@ -2206,6 +2238,7 @@ function createHeaders(onBeforeRequest, graphqlContext) {
|
|
|
2206
2238
|
__name(createHeaders, "createHeaders");
|
|
2207
2239
|
|
|
2208
2240
|
// src/lib/runtime/remote-actions.ts
|
|
2241
|
+
var import_shared10 = require("@copilotkit/shared");
|
|
2209
2242
|
var EndpointType;
|
|
2210
2243
|
(function(EndpointType2) {
|
|
2211
2244
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
@@ -2223,8 +2256,9 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2223
2256
|
url
|
|
2224
2257
|
}, "Fetching actions from url");
|
|
2225
2258
|
const headers = createHeaders(onBeforeRequest, graphqlContext);
|
|
2259
|
+
const fetchUrl = `${url}/info`;
|
|
2226
2260
|
try {
|
|
2227
|
-
const response = await fetch(
|
|
2261
|
+
const response = await fetch(fetchUrl, {
|
|
2228
2262
|
method: "POST",
|
|
2229
2263
|
headers,
|
|
2230
2264
|
body: JSON.stringify({
|
|
@@ -2238,10 +2272,10 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2238
2272
|
status: response.status,
|
|
2239
2273
|
body: await response.text()
|
|
2240
2274
|
}, "Failed to fetch actions from url");
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
};
|
|
2275
|
+
throw new import_shared10.ResolvedCopilotKitError({
|
|
2276
|
+
status: response.status,
|
|
2277
|
+
isRemoteEndpoint: true
|
|
2278
|
+
});
|
|
2245
2279
|
}
|
|
2246
2280
|
const json = await response.json();
|
|
2247
2281
|
logger2.debug({
|
|
@@ -2249,13 +2283,13 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2249
2283
|
}, "Fetched actions from url");
|
|
2250
2284
|
return json;
|
|
2251
2285
|
} catch (error) {
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
};
|
|
2286
|
+
if (error instanceof import_shared10.CopilotKitError) {
|
|
2287
|
+
throw error;
|
|
2288
|
+
}
|
|
2289
|
+
throw new import_shared10.CopilotKitLowLevelError({
|
|
2290
|
+
error,
|
|
2291
|
+
url: fetchUrl
|
|
2292
|
+
});
|
|
2259
2293
|
}
|
|
2260
2294
|
}
|
|
2261
2295
|
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
@@ -2315,7 +2349,7 @@ __name(setupRemoteActions, "setupRemoteActions");
|
|
|
2315
2349
|
// src/lib/telemetry-client.ts
|
|
2316
2350
|
var import_node_crypto3 = require("crypto");
|
|
2317
2351
|
var packageJson = require_package();
|
|
2318
|
-
var telemetryClient = new
|
|
2352
|
+
var telemetryClient = new import_shared11.TelemetryClient({
|
|
2319
2353
|
packageName: packageJson.name,
|
|
2320
2354
|
packageVersion: packageJson.version
|
|
2321
2355
|
});
|
|
@@ -2625,13 +2659,13 @@ var RuntimeEventSource = class {
|
|
|
2625
2659
|
const errorMessage = `\u274C ${message}`;
|
|
2626
2660
|
if (!this.callback) {
|
|
2627
2661
|
this.stream(async (eventStream$) => {
|
|
2628
|
-
eventStream$.sendTextMessage((0,
|
|
2662
|
+
eventStream$.sendTextMessage((0, import_shared12.randomId)(), errorMessage);
|
|
2629
2663
|
});
|
|
2630
2664
|
} else {
|
|
2631
|
-
this.eventStream$.sendTextMessage((0,
|
|
2665
|
+
this.eventStream$.sendTextMessage((0, import_shared12.randomId)(), errorMessage);
|
|
2632
2666
|
}
|
|
2633
2667
|
}
|
|
2634
|
-
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
2668
|
+
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, threadId }) {
|
|
2635
2669
|
this.callback(this.eventStream$).catch((error) => {
|
|
2636
2670
|
console.error("Error in event source callback", error);
|
|
2637
2671
|
this.sendErrorMessageToChat();
|
|
@@ -2667,7 +2701,7 @@ var RuntimeEventSource = class {
|
|
|
2667
2701
|
(0, import_rxjs2.concatMap)((eventWithState) => {
|
|
2668
2702
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
2669
2703
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
2670
|
-
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionParentMessageId, eventWithState.actionExecutionId, actionInputsWithoutAgents).catch((error) => {
|
|
2704
|
+
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionParentMessageId, eventWithState.actionExecutionId, actionInputsWithoutAgents, threadId).catch((error) => {
|
|
2671
2705
|
console.error(error);
|
|
2672
2706
|
});
|
|
2673
2707
|
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
@@ -2684,7 +2718,7 @@ var RuntimeEventSource = class {
|
|
|
2684
2718
|
}
|
|
2685
2719
|
};
|
|
2686
2720
|
__name(RuntimeEventSource, "RuntimeEventSource");
|
|
2687
|
-
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionParentMessageId, actionExecutionId, actionInputsWithoutAgents) {
|
|
2721
|
+
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionParentMessageId, actionExecutionId, actionInputsWithoutAgents, threadId) {
|
|
2688
2722
|
var _a;
|
|
2689
2723
|
if (guardrailsResult$) {
|
|
2690
2724
|
const { status } = await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
@@ -2735,6 +2769,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
2735
2769
|
});
|
|
2736
2770
|
const stream = await action.langGraphAgentHandler({
|
|
2737
2771
|
name: action.name,
|
|
2772
|
+
threadId,
|
|
2738
2773
|
actionInputsWithoutAgents,
|
|
2739
2774
|
additionalMessages: [
|
|
2740
2775
|
agentExecution,
|
|
@@ -2834,6 +2869,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
|
2834
2869
|
|
|
2835
2870
|
// src/lib/runtime/copilot-runtime.ts
|
|
2836
2871
|
var import_rxjs3 = require("rxjs");
|
|
2872
|
+
var import_langgraph_sdk2 = require("@langchain/langgraph-sdk");
|
|
2837
2873
|
var CopilotRuntime = class {
|
|
2838
2874
|
actions;
|
|
2839
2875
|
remoteEndpointDefinitions;
|
|
@@ -2853,16 +2889,18 @@ var CopilotRuntime = class {
|
|
|
2853
2889
|
}
|
|
2854
2890
|
async processRuntimeRequest(request) {
|
|
2855
2891
|
var _a;
|
|
2856
|
-
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
|
|
2892
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url, extensions } = request;
|
|
2857
2893
|
const eventSource = new RuntimeEventSource();
|
|
2858
2894
|
try {
|
|
2859
2895
|
if (agentSession) {
|
|
2860
2896
|
return await this.processAgentRequest(request);
|
|
2861
2897
|
}
|
|
2862
2898
|
if (serviceAdapter instanceof EmptyAdapter) {
|
|
2863
|
-
throw new
|
|
2899
|
+
throw new import_shared13.CopilotKitMisuseError({
|
|
2900
|
+
message: `Invalid adapter configuration: EmptyAdapter is only meant to be used with agent lock mode.
|
|
2864
2901
|
For non-agent components like useCopilotChatSuggestions, CopilotTextarea, or CopilotTask,
|
|
2865
|
-
please use an LLM adapter instead.`
|
|
2902
|
+
please use an LLM adapter instead.`
|
|
2903
|
+
});
|
|
2866
2904
|
}
|
|
2867
2905
|
const messages = rawMessages.filter((message) => !message.agentStateMessage);
|
|
2868
2906
|
const inputMessages = convertGqlInputToMessages(messages);
|
|
@@ -2870,7 +2908,7 @@ please use an LLM adapter instead.`);
|
|
|
2870
2908
|
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
2871
2909
|
name: action.name,
|
|
2872
2910
|
description: action.description,
|
|
2873
|
-
jsonSchema: JSON.stringify((0,
|
|
2911
|
+
jsonSchema: JSON.stringify((0, import_shared13.actionParametersToJsonSchema)(action.parameters))
|
|
2874
2912
|
}));
|
|
2875
2913
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
2876
2914
|
...serverSideActionsInput,
|
|
@@ -2892,12 +2930,14 @@ please use an LLM adapter instead.`);
|
|
|
2892
2930
|
threadId,
|
|
2893
2931
|
runId,
|
|
2894
2932
|
eventSource,
|
|
2895
|
-
forwardedParameters
|
|
2933
|
+
forwardedParameters,
|
|
2934
|
+
extensions
|
|
2896
2935
|
});
|
|
2936
|
+
const nonEmptyThreadId = threadId ?? result.threadId;
|
|
2897
2937
|
outputMessagesPromise.then((outputMessages) => {
|
|
2898
2938
|
var _a2;
|
|
2899
2939
|
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
2900
|
-
threadId:
|
|
2940
|
+
threadId: nonEmptyThreadId,
|
|
2901
2941
|
runId: result.runId,
|
|
2902
2942
|
inputMessages,
|
|
2903
2943
|
outputMessages,
|
|
@@ -2907,16 +2947,20 @@ please use an LLM adapter instead.`);
|
|
|
2907
2947
|
}).catch((_error) => {
|
|
2908
2948
|
});
|
|
2909
2949
|
return {
|
|
2910
|
-
threadId:
|
|
2950
|
+
threadId: nonEmptyThreadId,
|
|
2911
2951
|
runId: result.runId,
|
|
2912
2952
|
eventSource,
|
|
2913
2953
|
serverSideActions,
|
|
2914
2954
|
actionInputsWithoutAgents: actionInputs.filter((action) => (
|
|
2915
2955
|
// TODO-AGENTS: do not exclude ALL server side actions
|
|
2916
2956
|
!serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
2917
|
-
))
|
|
2957
|
+
)),
|
|
2958
|
+
extensions: result.extensions
|
|
2918
2959
|
};
|
|
2919
2960
|
} catch (error) {
|
|
2961
|
+
if (error instanceof import_shared13.CopilotKitError) {
|
|
2962
|
+
throw error;
|
|
2963
|
+
}
|
|
2920
2964
|
console.error("Error getting response:", error);
|
|
2921
2965
|
eventSource.sendErrorMessageToChat();
|
|
2922
2966
|
throw error;
|
|
@@ -2927,54 +2971,131 @@ please use an LLM adapter instead.`);
|
|
|
2927
2971
|
const agents = this.remoteEndpointDefinitions.reduce(async (acc, endpoint) => {
|
|
2928
2972
|
const agents2 = await acc;
|
|
2929
2973
|
if (endpoint.type === EndpointType.LangGraphPlatform) {
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2932
|
-
|
|
2974
|
+
const client = new import_langgraph_sdk2.Client({
|
|
2975
|
+
apiUrl: endpoint.deploymentUrl,
|
|
2976
|
+
apiKey: endpoint.langsmithApiKey
|
|
2933
2977
|
});
|
|
2934
|
-
const
|
|
2935
|
-
const
|
|
2978
|
+
const data = await client.assistants.search();
|
|
2979
|
+
const endpointAgents = (data ?? []).map((entry) => ({
|
|
2936
2980
|
name: entry.graph_id,
|
|
2937
|
-
id: entry.assistant_id
|
|
2981
|
+
id: entry.assistant_id,
|
|
2982
|
+
description: "",
|
|
2983
|
+
endpoint
|
|
2984
|
+
}));
|
|
2985
|
+
return [
|
|
2986
|
+
...agents2,
|
|
2987
|
+
...endpointAgents
|
|
2988
|
+
];
|
|
2989
|
+
}
|
|
2990
|
+
const fetchUrl = `${endpoint.url}/info`;
|
|
2991
|
+
try {
|
|
2992
|
+
const response = await fetch(fetchUrl, {
|
|
2993
|
+
method: "POST",
|
|
2994
|
+
headers,
|
|
2995
|
+
body: JSON.stringify({
|
|
2996
|
+
properties: graphqlContext.properties
|
|
2997
|
+
})
|
|
2998
|
+
});
|
|
2999
|
+
if (!response.ok) {
|
|
3000
|
+
if (response.status === 404) {
|
|
3001
|
+
throw new import_shared13.CopilotKitApiDiscoveryError();
|
|
3002
|
+
}
|
|
3003
|
+
throw new import_shared13.ResolvedCopilotKitError({
|
|
3004
|
+
status: response.status,
|
|
3005
|
+
isRemoteEndpoint: true
|
|
3006
|
+
});
|
|
3007
|
+
}
|
|
3008
|
+
const data = await response.json();
|
|
3009
|
+
const endpointAgents = ((data == null ? void 0 : data.agents) ?? []).map((agent) => ({
|
|
3010
|
+
name: agent.name,
|
|
3011
|
+
description: agent.description ?? "" ?? "",
|
|
3012
|
+
id: (0, import_shared13.randomId)(),
|
|
3013
|
+
endpoint
|
|
2938
3014
|
}));
|
|
2939
3015
|
return [
|
|
2940
3016
|
...agents2,
|
|
2941
|
-
...
|
|
3017
|
+
...endpointAgents
|
|
2942
3018
|
];
|
|
3019
|
+
} catch (error) {
|
|
3020
|
+
if (error instanceof import_shared13.CopilotKitError) {
|
|
3021
|
+
throw error;
|
|
3022
|
+
}
|
|
3023
|
+
throw new import_shared13.CopilotKitLowLevelError({
|
|
3024
|
+
error,
|
|
3025
|
+
url: fetchUrl
|
|
3026
|
+
});
|
|
3027
|
+
}
|
|
3028
|
+
}, Promise.resolve([]));
|
|
3029
|
+
return agents;
|
|
3030
|
+
}
|
|
3031
|
+
async loadAgentState(graphqlContext, threadId, agentName) {
|
|
3032
|
+
const agentsWithEndpoints = await this.discoverAgentsFromEndpoints(graphqlContext);
|
|
3033
|
+
const agentWithEndpoint = agentsWithEndpoints.find((agent) => agent.name === agentName);
|
|
3034
|
+
if (!agentWithEndpoint) {
|
|
3035
|
+
throw new Error("Agent not found");
|
|
3036
|
+
}
|
|
3037
|
+
const headers = createHeaders(null, graphqlContext);
|
|
3038
|
+
if (agentWithEndpoint.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
3039
|
+
const client = new import_langgraph_sdk2.Client({
|
|
3040
|
+
apiUrl: agentWithEndpoint.endpoint.deploymentUrl,
|
|
3041
|
+
apiKey: agentWithEndpoint.endpoint.langsmithApiKey
|
|
3042
|
+
});
|
|
3043
|
+
const state = (await client.threads.getState(threadId)).values;
|
|
3044
|
+
if (Object.keys(state).length === 0) {
|
|
3045
|
+
return {
|
|
3046
|
+
threadId,
|
|
3047
|
+
threadExists: false,
|
|
3048
|
+
state: JSON.stringify({}),
|
|
3049
|
+
messages: JSON.stringify([])
|
|
3050
|
+
};
|
|
3051
|
+
} else {
|
|
3052
|
+
console.log(state);
|
|
3053
|
+
const { messages, ...stateWithoutMessages } = state;
|
|
3054
|
+
const copilotkitMessages = langchainMessagesToCopilotKit(messages);
|
|
3055
|
+
return {
|
|
3056
|
+
threadId,
|
|
3057
|
+
threadExists: true,
|
|
3058
|
+
state: JSON.stringify(stateWithoutMessages),
|
|
3059
|
+
messages: JSON.stringify(copilotkitMessages)
|
|
3060
|
+
};
|
|
2943
3061
|
}
|
|
2944
|
-
|
|
3062
|
+
} else if (agentWithEndpoint.endpoint.type === EndpointType.CopilotKit || !("type" in agentWithEndpoint.endpoint)) {
|
|
3063
|
+
const response = await fetch(`${agentWithEndpoint.endpoint.url}/agents/state`, {
|
|
2945
3064
|
method: "POST",
|
|
2946
3065
|
headers,
|
|
2947
3066
|
body: JSON.stringify({
|
|
2948
|
-
properties: graphqlContext.properties
|
|
3067
|
+
properties: graphqlContext.properties,
|
|
3068
|
+
threadId,
|
|
3069
|
+
name: agentName
|
|
2949
3070
|
})
|
|
2950
3071
|
});
|
|
2951
3072
|
const data = await response.json();
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
}
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
];
|
|
2961
|
-
}, Promise.resolve([]));
|
|
2962
|
-
return agents;
|
|
3073
|
+
return {
|
|
3074
|
+
...data,
|
|
3075
|
+
state: JSON.stringify(data.state),
|
|
3076
|
+
messages: JSON.stringify(data.messages)
|
|
3077
|
+
};
|
|
3078
|
+
} else {
|
|
3079
|
+
throw new Error(`Unknown endpoint type: ${agentWithEndpoint.endpoint.type}`);
|
|
3080
|
+
}
|
|
2963
3081
|
}
|
|
2964
3082
|
async processAgentRequest(request) {
|
|
2965
3083
|
var _a;
|
|
2966
|
-
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
2967
|
-
const {
|
|
3084
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest } = request;
|
|
3085
|
+
const { agentName, nodeName } = agentSession;
|
|
3086
|
+
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
2968
3087
|
const serverSideActions = await this.getServerSideActions(request);
|
|
2969
3088
|
const messages = convertGqlInputToMessages(rawMessages);
|
|
2970
3089
|
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
2971
3090
|
if (!agent) {
|
|
2972
|
-
throw new
|
|
3091
|
+
throw new import_shared13.CopilotKitAgentDiscoveryError({
|
|
3092
|
+
agentName
|
|
3093
|
+
});
|
|
2973
3094
|
}
|
|
2974
3095
|
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
2975
3096
|
name: action.name,
|
|
2976
3097
|
description: action.description,
|
|
2977
|
-
jsonSchema: JSON.stringify((0,
|
|
3098
|
+
jsonSchema: JSON.stringify((0, import_shared13.actionParametersToJsonSchema)(action.parameters))
|
|
2978
3099
|
}));
|
|
2979
3100
|
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
2980
3101
|
...serverSideActionsInput,
|
|
@@ -3102,14 +3223,14 @@ function resolveEndpointType(endpoint) {
|
|
|
3102
3223
|
__name(resolveEndpointType, "resolveEndpointType");
|
|
3103
3224
|
|
|
3104
3225
|
// src/lib/integrations/shared.ts
|
|
3105
|
-
var
|
|
3226
|
+
var import_type_graphql24 = require("type-graphql");
|
|
3106
3227
|
|
|
3107
3228
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
3108
|
-
var
|
|
3229
|
+
var import_type_graphql18 = require("type-graphql");
|
|
3109
3230
|
var import_rxjs4 = require("rxjs");
|
|
3110
3231
|
|
|
3111
3232
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
3112
|
-
var
|
|
3233
|
+
var import_type_graphql12 = require("type-graphql");
|
|
3113
3234
|
|
|
3114
3235
|
// src/graphql/inputs/message.input.ts
|
|
3115
3236
|
var import_type_graphql3 = require("type-graphql");
|
|
@@ -3625,7 +3746,8 @@ AgentStateInput = _ts_decorate9([
|
|
|
3625
3746
|
(0, import_type_graphql10.InputType)()
|
|
3626
3747
|
], AgentStateInput);
|
|
3627
3748
|
|
|
3628
|
-
// src/graphql/inputs/
|
|
3749
|
+
// src/graphql/inputs/extensions.input.ts
|
|
3750
|
+
var import_type_graphql11 = require("type-graphql");
|
|
3629
3751
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
3630
3752
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3631
3753
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3642,18 +3764,69 @@ function _ts_metadata10(k, v) {
|
|
|
3642
3764
|
return Reflect.metadata(k, v);
|
|
3643
3765
|
}
|
|
3644
3766
|
__name(_ts_metadata10, "_ts_metadata");
|
|
3767
|
+
var ExtensionsInput = class {
|
|
3768
|
+
openaiAssistantAPI;
|
|
3769
|
+
};
|
|
3770
|
+
__name(ExtensionsInput, "ExtensionsInput");
|
|
3771
|
+
_ts_decorate10([
|
|
3772
|
+
(0, import_type_graphql11.Field)(() => OpenAIApiAssistantAPIInput, {
|
|
3773
|
+
nullable: true
|
|
3774
|
+
}),
|
|
3775
|
+
_ts_metadata10("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
|
|
3776
|
+
], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
|
|
3777
|
+
ExtensionsInput = _ts_decorate10([
|
|
3778
|
+
(0, import_type_graphql11.InputType)()
|
|
3779
|
+
], ExtensionsInput);
|
|
3780
|
+
var OpenAIApiAssistantAPIInput = class {
|
|
3781
|
+
runId;
|
|
3782
|
+
threadId;
|
|
3783
|
+
};
|
|
3784
|
+
__name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
|
|
3785
|
+
_ts_decorate10([
|
|
3786
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
3787
|
+
nullable: true
|
|
3788
|
+
}),
|
|
3789
|
+
_ts_metadata10("design:type", String)
|
|
3790
|
+
], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
|
|
3791
|
+
_ts_decorate10([
|
|
3792
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
3793
|
+
nullable: true
|
|
3794
|
+
}),
|
|
3795
|
+
_ts_metadata10("design:type", String)
|
|
3796
|
+
], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
|
|
3797
|
+
OpenAIApiAssistantAPIInput = _ts_decorate10([
|
|
3798
|
+
(0, import_type_graphql11.InputType)()
|
|
3799
|
+
], OpenAIApiAssistantAPIInput);
|
|
3800
|
+
|
|
3801
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
3802
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
3803
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3804
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3805
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
3806
|
+
else
|
|
3807
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
3808
|
+
if (d = decorators[i])
|
|
3809
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3810
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3811
|
+
}
|
|
3812
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
3813
|
+
function _ts_metadata11(k, v) {
|
|
3814
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3815
|
+
return Reflect.metadata(k, v);
|
|
3816
|
+
}
|
|
3817
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
3645
3818
|
var GenerateCopilotResponseMetadataInput = class {
|
|
3646
3819
|
requestType;
|
|
3647
3820
|
};
|
|
3648
3821
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
3649
|
-
|
|
3650
|
-
(0,
|
|
3822
|
+
_ts_decorate11([
|
|
3823
|
+
(0, import_type_graphql12.Field)(() => CopilotRequestType, {
|
|
3651
3824
|
nullable: true
|
|
3652
3825
|
}),
|
|
3653
|
-
|
|
3826
|
+
_ts_metadata11("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
3654
3827
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
3655
|
-
GenerateCopilotResponseMetadataInput =
|
|
3656
|
-
(0,
|
|
3828
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate11([
|
|
3829
|
+
(0, import_type_graphql12.InputType)()
|
|
3657
3830
|
], GenerateCopilotResponseMetadataInput);
|
|
3658
3831
|
var GenerateCopilotResponseInput = class {
|
|
3659
3832
|
metadata;
|
|
@@ -3666,78 +3839,85 @@ var GenerateCopilotResponseInput = class {
|
|
|
3666
3839
|
agentSession;
|
|
3667
3840
|
agentState;
|
|
3668
3841
|
agentStates;
|
|
3842
|
+
extensions;
|
|
3669
3843
|
};
|
|
3670
3844
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
3671
|
-
|
|
3672
|
-
(0,
|
|
3845
|
+
_ts_decorate11([
|
|
3846
|
+
(0, import_type_graphql12.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
3673
3847
|
nullable: false
|
|
3674
3848
|
}),
|
|
3675
|
-
|
|
3849
|
+
_ts_metadata11("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
3676
3850
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
3677
|
-
|
|
3678
|
-
(0,
|
|
3851
|
+
_ts_decorate11([
|
|
3852
|
+
(0, import_type_graphql12.Field)(() => String, {
|
|
3679
3853
|
nullable: true
|
|
3680
3854
|
}),
|
|
3681
|
-
|
|
3855
|
+
_ts_metadata11("design:type", String)
|
|
3682
3856
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
3683
|
-
|
|
3684
|
-
(0,
|
|
3857
|
+
_ts_decorate11([
|
|
3858
|
+
(0, import_type_graphql12.Field)(() => String, {
|
|
3685
3859
|
nullable: true
|
|
3686
3860
|
}),
|
|
3687
|
-
|
|
3861
|
+
_ts_metadata11("design:type", String)
|
|
3688
3862
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
3689
|
-
|
|
3690
|
-
(0,
|
|
3863
|
+
_ts_decorate11([
|
|
3864
|
+
(0, import_type_graphql12.Field)(() => [
|
|
3691
3865
|
MessageInput
|
|
3692
3866
|
]),
|
|
3693
|
-
|
|
3867
|
+
_ts_metadata11("design:type", Array)
|
|
3694
3868
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
3695
|
-
|
|
3696
|
-
(0,
|
|
3697
|
-
|
|
3869
|
+
_ts_decorate11([
|
|
3870
|
+
(0, import_type_graphql12.Field)(() => FrontendInput),
|
|
3871
|
+
_ts_metadata11("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
3698
3872
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
3699
|
-
|
|
3700
|
-
(0,
|
|
3873
|
+
_ts_decorate11([
|
|
3874
|
+
(0, import_type_graphql12.Field)(() => CloudInput, {
|
|
3701
3875
|
nullable: true
|
|
3702
3876
|
}),
|
|
3703
|
-
|
|
3877
|
+
_ts_metadata11("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
3704
3878
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
3705
|
-
|
|
3706
|
-
(0,
|
|
3879
|
+
_ts_decorate11([
|
|
3880
|
+
(0, import_type_graphql12.Field)(() => ForwardedParametersInput, {
|
|
3707
3881
|
nullable: true
|
|
3708
3882
|
}),
|
|
3709
|
-
|
|
3883
|
+
_ts_metadata11("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
3710
3884
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
3711
|
-
|
|
3712
|
-
(0,
|
|
3885
|
+
_ts_decorate11([
|
|
3886
|
+
(0, import_type_graphql12.Field)(() => AgentSessionInput, {
|
|
3713
3887
|
nullable: true
|
|
3714
3888
|
}),
|
|
3715
|
-
|
|
3889
|
+
_ts_metadata11("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
3716
3890
|
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
3717
|
-
|
|
3718
|
-
(0,
|
|
3891
|
+
_ts_decorate11([
|
|
3892
|
+
(0, import_type_graphql12.Field)(() => AgentStateInput, {
|
|
3719
3893
|
nullable: true
|
|
3720
3894
|
}),
|
|
3721
|
-
|
|
3895
|
+
_ts_metadata11("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
3722
3896
|
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
3723
|
-
|
|
3724
|
-
(0,
|
|
3897
|
+
_ts_decorate11([
|
|
3898
|
+
(0, import_type_graphql12.Field)(() => [
|
|
3725
3899
|
AgentStateInput
|
|
3726
3900
|
], {
|
|
3727
3901
|
nullable: true
|
|
3728
3902
|
}),
|
|
3729
|
-
|
|
3903
|
+
_ts_metadata11("design:type", Array)
|
|
3730
3904
|
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
3731
|
-
|
|
3732
|
-
(0,
|
|
3905
|
+
_ts_decorate11([
|
|
3906
|
+
(0, import_type_graphql12.Field)(() => ExtensionsInput, {
|
|
3907
|
+
nullable: true
|
|
3908
|
+
}),
|
|
3909
|
+
_ts_metadata11("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
|
|
3910
|
+
], GenerateCopilotResponseInput.prototype, "extensions", void 0);
|
|
3911
|
+
GenerateCopilotResponseInput = _ts_decorate11([
|
|
3912
|
+
(0, import_type_graphql12.InputType)()
|
|
3733
3913
|
], GenerateCopilotResponseInput);
|
|
3734
3914
|
|
|
3735
3915
|
// src/graphql/types/copilot-response.type.ts
|
|
3736
|
-
var
|
|
3916
|
+
var import_type_graphql16 = require("type-graphql");
|
|
3737
3917
|
|
|
3738
3918
|
// src/graphql/types/message-status.type.ts
|
|
3739
|
-
var
|
|
3740
|
-
function
|
|
3919
|
+
var import_type_graphql13 = require("type-graphql");
|
|
3920
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
3741
3921
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3742
3922
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3743
3923
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3747,58 +3927,58 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
3747
3927
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3748
3928
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3749
3929
|
}
|
|
3750
|
-
__name(
|
|
3751
|
-
function
|
|
3930
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
3931
|
+
function _ts_metadata12(k, v) {
|
|
3752
3932
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3753
3933
|
return Reflect.metadata(k, v);
|
|
3754
3934
|
}
|
|
3755
|
-
__name(
|
|
3935
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
3756
3936
|
var MessageStatusCode;
|
|
3757
3937
|
(function(MessageStatusCode2) {
|
|
3758
3938
|
MessageStatusCode2["Pending"] = "pending";
|
|
3759
3939
|
MessageStatusCode2["Success"] = "success";
|
|
3760
3940
|
MessageStatusCode2["Failed"] = "failed";
|
|
3761
3941
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
3762
|
-
(0,
|
|
3942
|
+
(0, import_type_graphql13.registerEnumType)(MessageStatusCode, {
|
|
3763
3943
|
name: "MessageStatusCode"
|
|
3764
3944
|
});
|
|
3765
3945
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
3766
3946
|
code;
|
|
3767
3947
|
}, "BaseMessageStatus");
|
|
3768
|
-
|
|
3769
|
-
(0,
|
|
3770
|
-
|
|
3948
|
+
_ts_decorate12([
|
|
3949
|
+
(0, import_type_graphql13.Field)(() => MessageStatusCode),
|
|
3950
|
+
_ts_metadata12("design:type", String)
|
|
3771
3951
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
3772
|
-
BaseMessageStatus =
|
|
3773
|
-
(0,
|
|
3952
|
+
BaseMessageStatus = _ts_decorate12([
|
|
3953
|
+
(0, import_type_graphql13.ObjectType)()
|
|
3774
3954
|
], BaseMessageStatus);
|
|
3775
3955
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
3776
3956
|
code = "pending";
|
|
3777
3957
|
};
|
|
3778
3958
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
3779
|
-
PendingMessageStatus =
|
|
3780
|
-
(0,
|
|
3959
|
+
PendingMessageStatus = _ts_decorate12([
|
|
3960
|
+
(0, import_type_graphql13.ObjectType)()
|
|
3781
3961
|
], PendingMessageStatus);
|
|
3782
3962
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
3783
3963
|
code = "success";
|
|
3784
3964
|
};
|
|
3785
3965
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
3786
|
-
SuccessMessageStatus =
|
|
3787
|
-
(0,
|
|
3966
|
+
SuccessMessageStatus = _ts_decorate12([
|
|
3967
|
+
(0, import_type_graphql13.ObjectType)()
|
|
3788
3968
|
], SuccessMessageStatus);
|
|
3789
3969
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
3790
3970
|
code = "failed";
|
|
3791
3971
|
reason;
|
|
3792
3972
|
};
|
|
3793
3973
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
3794
|
-
|
|
3795
|
-
(0,
|
|
3796
|
-
|
|
3974
|
+
_ts_decorate12([
|
|
3975
|
+
(0, import_type_graphql13.Field)(() => String),
|
|
3976
|
+
_ts_metadata12("design:type", String)
|
|
3797
3977
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
3798
|
-
FailedMessageStatus =
|
|
3799
|
-
(0,
|
|
3978
|
+
FailedMessageStatus = _ts_decorate12([
|
|
3979
|
+
(0, import_type_graphql13.ObjectType)()
|
|
3800
3980
|
], FailedMessageStatus);
|
|
3801
|
-
var MessageStatusUnion = (0,
|
|
3981
|
+
var MessageStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
3802
3982
|
name: "MessageStatus",
|
|
3803
3983
|
types: () => [
|
|
3804
3984
|
PendingMessageStatus,
|
|
@@ -3809,8 +3989,8 @@ var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
|
|
|
3809
3989
|
|
|
3810
3990
|
// src/graphql/types/response-status.type.ts
|
|
3811
3991
|
var import_graphql_scalars = require("graphql-scalars");
|
|
3812
|
-
var
|
|
3813
|
-
function
|
|
3992
|
+
var import_type_graphql14 = require("type-graphql");
|
|
3993
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
3814
3994
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3815
3995
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3816
3996
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3820,30 +4000,30 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
3820
4000
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3821
4001
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3822
4002
|
}
|
|
3823
|
-
__name(
|
|
3824
|
-
function
|
|
4003
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
4004
|
+
function _ts_metadata13(k, v) {
|
|
3825
4005
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3826
4006
|
return Reflect.metadata(k, v);
|
|
3827
4007
|
}
|
|
3828
|
-
__name(
|
|
4008
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
3829
4009
|
var ResponseStatusCode;
|
|
3830
4010
|
(function(ResponseStatusCode2) {
|
|
3831
4011
|
ResponseStatusCode2["Pending"] = "pending";
|
|
3832
4012
|
ResponseStatusCode2["Success"] = "success";
|
|
3833
4013
|
ResponseStatusCode2["Failed"] = "failed";
|
|
3834
4014
|
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
3835
|
-
(0,
|
|
4015
|
+
(0, import_type_graphql14.registerEnumType)(ResponseStatusCode, {
|
|
3836
4016
|
name: "ResponseStatusCode"
|
|
3837
4017
|
});
|
|
3838
4018
|
var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
|
|
3839
4019
|
code;
|
|
3840
4020
|
}, "BaseResponseStatus");
|
|
3841
|
-
|
|
3842
|
-
(0,
|
|
3843
|
-
|
|
4021
|
+
_ts_decorate13([
|
|
4022
|
+
(0, import_type_graphql14.Field)(() => ResponseStatusCode),
|
|
4023
|
+
_ts_metadata13("design:type", String)
|
|
3844
4024
|
], BaseResponseStatus.prototype, "code", void 0);
|
|
3845
|
-
BaseResponseStatus =
|
|
3846
|
-
(0,
|
|
4025
|
+
BaseResponseStatus = _ts_decorate13([
|
|
4026
|
+
(0, import_type_graphql14.InterfaceType)({
|
|
3847
4027
|
resolveType(value) {
|
|
3848
4028
|
if (value.code === "success") {
|
|
3849
4029
|
return SuccessResponseStatus;
|
|
@@ -3855,14 +4035,14 @@ BaseResponseStatus = _ts_decorate12([
|
|
|
3855
4035
|
return void 0;
|
|
3856
4036
|
}
|
|
3857
4037
|
}),
|
|
3858
|
-
(0,
|
|
4038
|
+
(0, import_type_graphql14.ObjectType)()
|
|
3859
4039
|
], BaseResponseStatus);
|
|
3860
4040
|
var PendingResponseStatus = class extends BaseResponseStatus {
|
|
3861
4041
|
code = "pending";
|
|
3862
4042
|
};
|
|
3863
4043
|
__name(PendingResponseStatus, "PendingResponseStatus");
|
|
3864
|
-
PendingResponseStatus =
|
|
3865
|
-
(0,
|
|
4044
|
+
PendingResponseStatus = _ts_decorate13([
|
|
4045
|
+
(0, import_type_graphql14.ObjectType)({
|
|
3866
4046
|
implements: BaseResponseStatus
|
|
3867
4047
|
})
|
|
3868
4048
|
], PendingResponseStatus);
|
|
@@ -3870,8 +4050,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
|
|
|
3870
4050
|
code = "success";
|
|
3871
4051
|
};
|
|
3872
4052
|
__name(SuccessResponseStatus, "SuccessResponseStatus");
|
|
3873
|
-
SuccessResponseStatus =
|
|
3874
|
-
(0,
|
|
4053
|
+
SuccessResponseStatus = _ts_decorate13([
|
|
4054
|
+
(0, import_type_graphql14.ObjectType)({
|
|
3875
4055
|
implements: BaseResponseStatus
|
|
3876
4056
|
})
|
|
3877
4057
|
], SuccessResponseStatus);
|
|
@@ -3881,7 +4061,7 @@ var FailedResponseStatusReason;
|
|
|
3881
4061
|
FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
|
|
3882
4062
|
FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
3883
4063
|
})(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
|
|
3884
|
-
(0,
|
|
4064
|
+
(0, import_type_graphql14.registerEnumType)(FailedResponseStatusReason, {
|
|
3885
4065
|
name: "FailedResponseStatusReason"
|
|
3886
4066
|
});
|
|
3887
4067
|
var FailedResponseStatus = class extends BaseResponseStatus {
|
|
@@ -3890,22 +4070,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
|
|
|
3890
4070
|
details = null;
|
|
3891
4071
|
};
|
|
3892
4072
|
__name(FailedResponseStatus, "FailedResponseStatus");
|
|
3893
|
-
|
|
3894
|
-
(0,
|
|
3895
|
-
|
|
4073
|
+
_ts_decorate13([
|
|
4074
|
+
(0, import_type_graphql14.Field)(() => FailedResponseStatusReason),
|
|
4075
|
+
_ts_metadata13("design:type", String)
|
|
3896
4076
|
], FailedResponseStatus.prototype, "reason", void 0);
|
|
3897
|
-
|
|
3898
|
-
(0,
|
|
4077
|
+
_ts_decorate13([
|
|
4078
|
+
(0, import_type_graphql14.Field)(() => import_graphql_scalars.GraphQLJSON, {
|
|
3899
4079
|
nullable: true
|
|
3900
4080
|
}),
|
|
3901
|
-
|
|
4081
|
+
_ts_metadata13("design:type", typeof Record === "undefined" ? Object : Record)
|
|
3902
4082
|
], FailedResponseStatus.prototype, "details", void 0);
|
|
3903
|
-
FailedResponseStatus =
|
|
3904
|
-
(0,
|
|
4083
|
+
FailedResponseStatus = _ts_decorate13([
|
|
4084
|
+
(0, import_type_graphql14.ObjectType)({
|
|
3905
4085
|
implements: BaseResponseStatus
|
|
3906
4086
|
})
|
|
3907
4087
|
], FailedResponseStatus);
|
|
3908
|
-
var ResponseStatusUnion = (0,
|
|
4088
|
+
var ResponseStatusUnion = (0, import_type_graphql14.createUnionType)({
|
|
3909
4089
|
name: "ResponseStatus",
|
|
3910
4090
|
types: () => [
|
|
3911
4091
|
PendingResponseStatus,
|
|
@@ -3914,8 +4094,60 @@ var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
|
3914
4094
|
]
|
|
3915
4095
|
});
|
|
3916
4096
|
|
|
4097
|
+
// src/graphql/types/extensions-response.type.ts
|
|
4098
|
+
var import_type_graphql15 = require("type-graphql");
|
|
4099
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
4100
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4101
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4102
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4103
|
+
else
|
|
4104
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4105
|
+
if (d = decorators[i])
|
|
4106
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4107
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4108
|
+
}
|
|
4109
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
4110
|
+
function _ts_metadata14(k, v) {
|
|
4111
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4112
|
+
return Reflect.metadata(k, v);
|
|
4113
|
+
}
|
|
4114
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
4115
|
+
var ExtensionsResponse = class {
|
|
4116
|
+
openaiAssistantAPI;
|
|
4117
|
+
};
|
|
4118
|
+
__name(ExtensionsResponse, "ExtensionsResponse");
|
|
4119
|
+
_ts_decorate14([
|
|
4120
|
+
(0, import_type_graphql15.Field)(() => OpenAIApiAssistantAPIResponse, {
|
|
4121
|
+
nullable: true
|
|
4122
|
+
}),
|
|
4123
|
+
_ts_metadata14("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
|
|
4124
|
+
], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
|
|
4125
|
+
ExtensionsResponse = _ts_decorate14([
|
|
4126
|
+
(0, import_type_graphql15.ObjectType)()
|
|
4127
|
+
], ExtensionsResponse);
|
|
4128
|
+
var OpenAIApiAssistantAPIResponse = class {
|
|
4129
|
+
runId;
|
|
4130
|
+
threadId;
|
|
4131
|
+
};
|
|
4132
|
+
__name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
|
|
4133
|
+
_ts_decorate14([
|
|
4134
|
+
(0, import_type_graphql15.Field)(() => String, {
|
|
4135
|
+
nullable: true
|
|
4136
|
+
}),
|
|
4137
|
+
_ts_metadata14("design:type", String)
|
|
4138
|
+
], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
|
|
4139
|
+
_ts_decorate14([
|
|
4140
|
+
(0, import_type_graphql15.Field)(() => String, {
|
|
4141
|
+
nullable: true
|
|
4142
|
+
}),
|
|
4143
|
+
_ts_metadata14("design:type", String)
|
|
4144
|
+
], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
|
|
4145
|
+
OpenAIApiAssistantAPIResponse = _ts_decorate14([
|
|
4146
|
+
(0, import_type_graphql15.ObjectType)()
|
|
4147
|
+
], OpenAIApiAssistantAPIResponse);
|
|
4148
|
+
|
|
3917
4149
|
// src/graphql/types/copilot-response.type.ts
|
|
3918
|
-
function
|
|
4150
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
3919
4151
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3920
4152
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3921
4153
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3925,31 +4157,32 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
3925
4157
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3926
4158
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3927
4159
|
}
|
|
3928
|
-
__name(
|
|
3929
|
-
function
|
|
4160
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
4161
|
+
function _ts_metadata15(k, v) {
|
|
3930
4162
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3931
4163
|
return Reflect.metadata(k, v);
|
|
3932
4164
|
}
|
|
3933
|
-
__name(
|
|
3934
|
-
var BaseMessageOutput =
|
|
4165
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4166
|
+
var BaseMessageOutput = class {
|
|
3935
4167
|
id;
|
|
3936
4168
|
createdAt;
|
|
3937
4169
|
status;
|
|
3938
|
-
}
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
4170
|
+
};
|
|
4171
|
+
__name(BaseMessageOutput, "BaseMessageOutput");
|
|
4172
|
+
_ts_decorate15([
|
|
4173
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4174
|
+
_ts_metadata15("design:type", String)
|
|
3942
4175
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
3943
|
-
|
|
3944
|
-
(0,
|
|
3945
|
-
|
|
4176
|
+
_ts_decorate15([
|
|
4177
|
+
(0, import_type_graphql16.Field)(() => Date),
|
|
4178
|
+
_ts_metadata15("design:type", typeof Date === "undefined" ? Object : Date)
|
|
3946
4179
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
3947
|
-
|
|
3948
|
-
(0,
|
|
3949
|
-
|
|
4180
|
+
_ts_decorate15([
|
|
4181
|
+
(0, import_type_graphql16.Field)(() => MessageStatusUnion),
|
|
4182
|
+
_ts_metadata15("design:type", Object)
|
|
3950
4183
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
3951
|
-
BaseMessageOutput =
|
|
3952
|
-
(0,
|
|
4184
|
+
BaseMessageOutput = _ts_decorate15([
|
|
4185
|
+
(0, import_type_graphql16.InterfaceType)({
|
|
3953
4186
|
resolveType(value) {
|
|
3954
4187
|
if (value.hasOwnProperty("content")) {
|
|
3955
4188
|
return TextMessageOutput;
|
|
@@ -3970,24 +4203,24 @@ var TextMessageOutput = class {
|
|
|
3970
4203
|
parentMessageId;
|
|
3971
4204
|
};
|
|
3972
4205
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
3973
|
-
|
|
3974
|
-
(0,
|
|
3975
|
-
|
|
4206
|
+
_ts_decorate15([
|
|
4207
|
+
(0, import_type_graphql16.Field)(() => MessageRole),
|
|
4208
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
3976
4209
|
], TextMessageOutput.prototype, "role", void 0);
|
|
3977
|
-
|
|
3978
|
-
(0,
|
|
4210
|
+
_ts_decorate15([
|
|
4211
|
+
(0, import_type_graphql16.Field)(() => [
|
|
3979
4212
|
String
|
|
3980
4213
|
]),
|
|
3981
|
-
|
|
4214
|
+
_ts_metadata15("design:type", Array)
|
|
3982
4215
|
], TextMessageOutput.prototype, "content", void 0);
|
|
3983
|
-
|
|
3984
|
-
(0,
|
|
4216
|
+
_ts_decorate15([
|
|
4217
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
3985
4218
|
nullable: true
|
|
3986
4219
|
}),
|
|
3987
|
-
|
|
4220
|
+
_ts_metadata15("design:type", String)
|
|
3988
4221
|
], TextMessageOutput.prototype, "parentMessageId", void 0);
|
|
3989
|
-
TextMessageOutput =
|
|
3990
|
-
(0,
|
|
4222
|
+
TextMessageOutput = _ts_decorate15([
|
|
4223
|
+
(0, import_type_graphql16.ObjectType)({
|
|
3991
4224
|
implements: BaseMessageOutput
|
|
3992
4225
|
})
|
|
3993
4226
|
], TextMessageOutput);
|
|
@@ -3998,31 +4231,31 @@ var ActionExecutionMessageOutput = class {
|
|
|
3998
4231
|
parentMessageId;
|
|
3999
4232
|
};
|
|
4000
4233
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
4001
|
-
|
|
4002
|
-
(0,
|
|
4003
|
-
|
|
4234
|
+
_ts_decorate15([
|
|
4235
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4236
|
+
_ts_metadata15("design:type", String)
|
|
4004
4237
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
4005
|
-
|
|
4006
|
-
(0,
|
|
4238
|
+
_ts_decorate15([
|
|
4239
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
4007
4240
|
nullable: true,
|
|
4008
4241
|
deprecationReason: "This field will be removed in a future version"
|
|
4009
4242
|
}),
|
|
4010
|
-
|
|
4243
|
+
_ts_metadata15("design:type", String)
|
|
4011
4244
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
4012
|
-
|
|
4013
|
-
(0,
|
|
4245
|
+
_ts_decorate15([
|
|
4246
|
+
(0, import_type_graphql16.Field)(() => [
|
|
4014
4247
|
String
|
|
4015
4248
|
]),
|
|
4016
|
-
|
|
4249
|
+
_ts_metadata15("design:type", Array)
|
|
4017
4250
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
4018
|
-
|
|
4019
|
-
(0,
|
|
4251
|
+
_ts_decorate15([
|
|
4252
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
4020
4253
|
nullable: true
|
|
4021
4254
|
}),
|
|
4022
|
-
|
|
4255
|
+
_ts_metadata15("design:type", String)
|
|
4023
4256
|
], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
|
|
4024
|
-
ActionExecutionMessageOutput =
|
|
4025
|
-
(0,
|
|
4257
|
+
ActionExecutionMessageOutput = _ts_decorate15([
|
|
4258
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4026
4259
|
implements: BaseMessageOutput
|
|
4027
4260
|
})
|
|
4028
4261
|
], ActionExecutionMessageOutput);
|
|
@@ -4032,20 +4265,20 @@ var ResultMessageOutput = class {
|
|
|
4032
4265
|
result;
|
|
4033
4266
|
};
|
|
4034
4267
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
4035
|
-
|
|
4036
|
-
(0,
|
|
4037
|
-
|
|
4268
|
+
_ts_decorate15([
|
|
4269
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4270
|
+
_ts_metadata15("design:type", String)
|
|
4038
4271
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
4039
|
-
|
|
4040
|
-
(0,
|
|
4041
|
-
|
|
4272
|
+
_ts_decorate15([
|
|
4273
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4274
|
+
_ts_metadata15("design:type", String)
|
|
4042
4275
|
], ResultMessageOutput.prototype, "actionName", void 0);
|
|
4043
|
-
|
|
4044
|
-
(0,
|
|
4045
|
-
|
|
4276
|
+
_ts_decorate15([
|
|
4277
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4278
|
+
_ts_metadata15("design:type", String)
|
|
4046
4279
|
], ResultMessageOutput.prototype, "result", void 0);
|
|
4047
|
-
ResultMessageOutput =
|
|
4048
|
-
(0,
|
|
4280
|
+
ResultMessageOutput = _ts_decorate15([
|
|
4281
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4049
4282
|
implements: BaseMessageOutput
|
|
4050
4283
|
})
|
|
4051
4284
|
], ResultMessageOutput);
|
|
@@ -4060,40 +4293,40 @@ var AgentStateMessageOutput = class {
|
|
|
4060
4293
|
running;
|
|
4061
4294
|
};
|
|
4062
4295
|
__name(AgentStateMessageOutput, "AgentStateMessageOutput");
|
|
4063
|
-
|
|
4064
|
-
(0,
|
|
4065
|
-
|
|
4296
|
+
_ts_decorate15([
|
|
4297
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4298
|
+
_ts_metadata15("design:type", String)
|
|
4066
4299
|
], AgentStateMessageOutput.prototype, "threadId", void 0);
|
|
4067
|
-
|
|
4068
|
-
(0,
|
|
4069
|
-
|
|
4300
|
+
_ts_decorate15([
|
|
4301
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4302
|
+
_ts_metadata15("design:type", String)
|
|
4070
4303
|
], AgentStateMessageOutput.prototype, "agentName", void 0);
|
|
4071
|
-
|
|
4072
|
-
(0,
|
|
4073
|
-
|
|
4304
|
+
_ts_decorate15([
|
|
4305
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4306
|
+
_ts_metadata15("design:type", String)
|
|
4074
4307
|
], AgentStateMessageOutput.prototype, "nodeName", void 0);
|
|
4075
|
-
|
|
4076
|
-
(0,
|
|
4077
|
-
|
|
4308
|
+
_ts_decorate15([
|
|
4309
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4310
|
+
_ts_metadata15("design:type", String)
|
|
4078
4311
|
], AgentStateMessageOutput.prototype, "runId", void 0);
|
|
4079
|
-
|
|
4080
|
-
(0,
|
|
4081
|
-
|
|
4312
|
+
_ts_decorate15([
|
|
4313
|
+
(0, import_type_graphql16.Field)(() => Boolean),
|
|
4314
|
+
_ts_metadata15("design:type", Boolean)
|
|
4082
4315
|
], AgentStateMessageOutput.prototype, "active", void 0);
|
|
4083
|
-
|
|
4084
|
-
(0,
|
|
4085
|
-
|
|
4316
|
+
_ts_decorate15([
|
|
4317
|
+
(0, import_type_graphql16.Field)(() => MessageRole),
|
|
4318
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
4086
4319
|
], AgentStateMessageOutput.prototype, "role", void 0);
|
|
4087
|
-
|
|
4088
|
-
(0,
|
|
4089
|
-
|
|
4320
|
+
_ts_decorate15([
|
|
4321
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4322
|
+
_ts_metadata15("design:type", String)
|
|
4090
4323
|
], AgentStateMessageOutput.prototype, "state", void 0);
|
|
4091
|
-
|
|
4092
|
-
(0,
|
|
4093
|
-
|
|
4324
|
+
_ts_decorate15([
|
|
4325
|
+
(0, import_type_graphql16.Field)(() => Boolean),
|
|
4326
|
+
_ts_metadata15("design:type", Boolean)
|
|
4094
4327
|
], AgentStateMessageOutput.prototype, "running", void 0);
|
|
4095
|
-
AgentStateMessageOutput =
|
|
4096
|
-
(0,
|
|
4328
|
+
AgentStateMessageOutput = _ts_decorate15([
|
|
4329
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4097
4330
|
implements: BaseMessageOutput
|
|
4098
4331
|
})
|
|
4099
4332
|
], AgentStateMessageOutput);
|
|
@@ -4102,30 +4335,37 @@ var CopilotResponse = class {
|
|
|
4102
4335
|
status;
|
|
4103
4336
|
runId;
|
|
4104
4337
|
messages;
|
|
4338
|
+
extensions;
|
|
4105
4339
|
};
|
|
4106
4340
|
__name(CopilotResponse, "CopilotResponse");
|
|
4107
|
-
|
|
4108
|
-
(0,
|
|
4109
|
-
|
|
4341
|
+
_ts_decorate15([
|
|
4342
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4343
|
+
_ts_metadata15("design:type", String)
|
|
4110
4344
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
4111
|
-
|
|
4112
|
-
(0,
|
|
4113
|
-
|
|
4345
|
+
_ts_decorate15([
|
|
4346
|
+
(0, import_type_graphql16.Field)(() => ResponseStatusUnion),
|
|
4347
|
+
_ts_metadata15("design:type", Object)
|
|
4114
4348
|
], CopilotResponse.prototype, "status", void 0);
|
|
4115
|
-
|
|
4116
|
-
(0,
|
|
4349
|
+
_ts_decorate15([
|
|
4350
|
+
(0, import_type_graphql16.Field)({
|
|
4117
4351
|
nullable: true
|
|
4118
4352
|
}),
|
|
4119
|
-
|
|
4353
|
+
_ts_metadata15("design:type", String)
|
|
4120
4354
|
], CopilotResponse.prototype, "runId", void 0);
|
|
4121
|
-
|
|
4122
|
-
(0,
|
|
4355
|
+
_ts_decorate15([
|
|
4356
|
+
(0, import_type_graphql16.Field)(() => [
|
|
4123
4357
|
BaseMessageOutput
|
|
4124
4358
|
]),
|
|
4125
|
-
|
|
4359
|
+
_ts_metadata15("design:type", Array)
|
|
4126
4360
|
], CopilotResponse.prototype, "messages", void 0);
|
|
4127
|
-
|
|
4128
|
-
(0,
|
|
4361
|
+
_ts_decorate15([
|
|
4362
|
+
(0, import_type_graphql16.Field)(() => ExtensionsResponse, {
|
|
4363
|
+
nullable: true
|
|
4364
|
+
}),
|
|
4365
|
+
_ts_metadata15("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
|
|
4366
|
+
], CopilotResponse.prototype, "extensions", void 0);
|
|
4367
|
+
CopilotResponse = _ts_decorate15([
|
|
4368
|
+
(0, import_type_graphql16.ObjectType)()
|
|
4129
4369
|
], CopilotResponse);
|
|
4130
4370
|
|
|
4131
4371
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -4168,11 +4408,11 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
4168
4408
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
4169
4409
|
|
|
4170
4410
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
4171
|
-
var
|
|
4411
|
+
var import_shared14 = require("@copilotkit/shared");
|
|
4172
4412
|
|
|
4173
4413
|
// src/graphql/types/agents-response.type.ts
|
|
4174
|
-
var
|
|
4175
|
-
function
|
|
4414
|
+
var import_type_graphql17 = require("type-graphql");
|
|
4415
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
4176
4416
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4177
4417
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4178
4418
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4182,49 +4422,49 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
4182
4422
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4183
4423
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4184
4424
|
}
|
|
4185
|
-
__name(
|
|
4186
|
-
function
|
|
4425
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4426
|
+
function _ts_metadata16(k, v) {
|
|
4187
4427
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4188
4428
|
return Reflect.metadata(k, v);
|
|
4189
4429
|
}
|
|
4190
|
-
__name(
|
|
4430
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4191
4431
|
var Agent = class {
|
|
4192
4432
|
id;
|
|
4193
4433
|
name;
|
|
4194
4434
|
description;
|
|
4195
4435
|
};
|
|
4196
4436
|
__name(Agent, "Agent");
|
|
4197
|
-
|
|
4198
|
-
(0,
|
|
4199
|
-
|
|
4437
|
+
_ts_decorate16([
|
|
4438
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4439
|
+
_ts_metadata16("design:type", String)
|
|
4200
4440
|
], Agent.prototype, "id", void 0);
|
|
4201
|
-
|
|
4202
|
-
(0,
|
|
4203
|
-
|
|
4441
|
+
_ts_decorate16([
|
|
4442
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4443
|
+
_ts_metadata16("design:type", String)
|
|
4204
4444
|
], Agent.prototype, "name", void 0);
|
|
4205
|
-
|
|
4206
|
-
(0,
|
|
4207
|
-
|
|
4445
|
+
_ts_decorate16([
|
|
4446
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4447
|
+
_ts_metadata16("design:type", String)
|
|
4208
4448
|
], Agent.prototype, "description", void 0);
|
|
4209
|
-
Agent =
|
|
4210
|
-
(0,
|
|
4449
|
+
Agent = _ts_decorate16([
|
|
4450
|
+
(0, import_type_graphql17.ObjectType)()
|
|
4211
4451
|
], Agent);
|
|
4212
4452
|
var AgentsResponse = class {
|
|
4213
4453
|
agents;
|
|
4214
4454
|
};
|
|
4215
4455
|
__name(AgentsResponse, "AgentsResponse");
|
|
4216
|
-
|
|
4217
|
-
(0,
|
|
4456
|
+
_ts_decorate16([
|
|
4457
|
+
(0, import_type_graphql17.Field)(() => [
|
|
4218
4458
|
Agent
|
|
4219
4459
|
]),
|
|
4220
|
-
|
|
4460
|
+
_ts_metadata16("design:type", Array)
|
|
4221
4461
|
], AgentsResponse.prototype, "agents", void 0);
|
|
4222
|
-
AgentsResponse =
|
|
4223
|
-
(0,
|
|
4462
|
+
AgentsResponse = _ts_decorate16([
|
|
4463
|
+
(0, import_type_graphql17.ObjectType)()
|
|
4224
4464
|
], AgentsResponse);
|
|
4225
4465
|
|
|
4226
4466
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
4227
|
-
function
|
|
4467
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4228
4468
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4229
4469
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4230
4470
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4234,12 +4474,12 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
4234
4474
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4235
4475
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4236
4476
|
}
|
|
4237
|
-
__name(
|
|
4238
|
-
function
|
|
4477
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4478
|
+
function _ts_metadata17(k, v) {
|
|
4239
4479
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4240
4480
|
return Reflect.metadata(k, v);
|
|
4241
4481
|
}
|
|
4242
|
-
__name(
|
|
4482
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
4243
4483
|
function _ts_param(paramIndex, decorator) {
|
|
4244
4484
|
return function(target, key) {
|
|
4245
4485
|
decorator(target, key, paramIndex);
|
|
@@ -4286,10 +4526,10 @@ var CopilotResolver = class {
|
|
|
4286
4526
|
component: "CopilotResolver.availableAgents"
|
|
4287
4527
|
});
|
|
4288
4528
|
logger2.debug("Processing");
|
|
4289
|
-
const
|
|
4529
|
+
const agentsWithEndpoints = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
|
|
4290
4530
|
logger2.debug("Event source created, creating response");
|
|
4291
4531
|
return {
|
|
4292
|
-
agents
|
|
4532
|
+
agents: agentsWithEndpoints.map(({ endpoint, ...agentWithoutEndpoint }) => agentWithoutEndpoint)
|
|
4293
4533
|
};
|
|
4294
4534
|
}
|
|
4295
4535
|
async generateCopilotResponse(ctx, data, properties) {
|
|
@@ -4351,7 +4591,7 @@ var CopilotResolver = class {
|
|
|
4351
4591
|
rejectOutputMessagesPromise = reject;
|
|
4352
4592
|
});
|
|
4353
4593
|
logger2.debug("Processing");
|
|
4354
|
-
const { eventSource, threadId = (0,
|
|
4594
|
+
const { eventSource, threadId = (0, import_shared14.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = await copilotRuntime.processRuntimeRequest({
|
|
4355
4595
|
serviceAdapter,
|
|
4356
4596
|
messages: data.messages,
|
|
4357
4597
|
actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
|
|
@@ -4363,13 +4603,15 @@ var CopilotResolver = class {
|
|
|
4363
4603
|
forwardedParameters: data.forwardedParameters,
|
|
4364
4604
|
agentSession: data.agentSession,
|
|
4365
4605
|
agentStates: data.agentStates,
|
|
4366
|
-
url: data.frontend.url
|
|
4606
|
+
url: data.frontend.url,
|
|
4607
|
+
extensions: data.extensions
|
|
4367
4608
|
});
|
|
4368
4609
|
logger2.debug("Event source created, creating response");
|
|
4369
4610
|
const response = {
|
|
4370
4611
|
threadId,
|
|
4371
4612
|
runId,
|
|
4372
4613
|
status: (0, import_rxjs4.firstValueFrom)(responseStatus$),
|
|
4614
|
+
extensions,
|
|
4373
4615
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
4374
4616
|
var _a2, _b2;
|
|
4375
4617
|
logger2.debug("Messages repeater created");
|
|
@@ -4396,7 +4638,7 @@ var CopilotResolver = class {
|
|
|
4396
4638
|
});
|
|
4397
4639
|
outputMessages = [
|
|
4398
4640
|
(0, import_class_transformer3.plainToInstance)(TextMessage, {
|
|
4399
|
-
id: (0,
|
|
4641
|
+
id: (0, import_shared14.randomId)(),
|
|
4400
4642
|
createdAt: /* @__PURE__ */ new Date(),
|
|
4401
4643
|
content: result.reason,
|
|
4402
4644
|
role: MessageRole.assistant
|
|
@@ -4426,7 +4668,8 @@ var CopilotResolver = class {
|
|
|
4426
4668
|
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
4427
4669
|
// TODO-AGENTS: do not exclude ALL server side actions
|
|
4428
4670
|
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
4429
|
-
)
|
|
4671
|
+
),
|
|
4672
|
+
threadId
|
|
4430
4673
|
}).pipe(
|
|
4431
4674
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
4432
4675
|
// just the events that were emitted after the subscriber was added.
|
|
@@ -4587,7 +4830,7 @@ var CopilotResolver = class {
|
|
|
4587
4830
|
event
|
|
4588
4831
|
}, "Agent message event received");
|
|
4589
4832
|
pushMessage({
|
|
4590
|
-
id: (0,
|
|
4833
|
+
id: (0, import_shared14.randomId)(),
|
|
4591
4834
|
status: new SuccessMessageStatus(),
|
|
4592
4835
|
threadId: event.threadId,
|
|
4593
4836
|
agentName: event.agentName,
|
|
@@ -4600,7 +4843,7 @@ var CopilotResolver = class {
|
|
|
4600
4843
|
createdAt: /* @__PURE__ */ new Date()
|
|
4601
4844
|
});
|
|
4602
4845
|
outputMessages.push((0, import_class_transformer3.plainToInstance)(AgentStateMessage, {
|
|
4603
|
-
id: (0,
|
|
4846
|
+
id: (0, import_shared14.randomId)(),
|
|
4604
4847
|
threadId: event.threadId,
|
|
4605
4848
|
agentName: event.agentName,
|
|
4606
4849
|
nodeName: event.nodeName,
|
|
@@ -4644,38 +4887,38 @@ var CopilotResolver = class {
|
|
|
4644
4887
|
}
|
|
4645
4888
|
};
|
|
4646
4889
|
__name(CopilotResolver, "CopilotResolver");
|
|
4647
|
-
|
|
4648
|
-
(0,
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4890
|
+
_ts_decorate17([
|
|
4891
|
+
(0, import_type_graphql18.Query)(() => String),
|
|
4892
|
+
_ts_metadata17("design:type", Function),
|
|
4893
|
+
_ts_metadata17("design:paramtypes", []),
|
|
4894
|
+
_ts_metadata17("design:returntype", Promise)
|
|
4652
4895
|
], CopilotResolver.prototype, "hello", null);
|
|
4653
|
-
|
|
4654
|
-
(0,
|
|
4655
|
-
_ts_param(0, (0,
|
|
4656
|
-
|
|
4657
|
-
|
|
4896
|
+
_ts_decorate17([
|
|
4897
|
+
(0, import_type_graphql18.Query)(() => AgentsResponse),
|
|
4898
|
+
_ts_param(0, (0, import_type_graphql18.Ctx)()),
|
|
4899
|
+
_ts_metadata17("design:type", Function),
|
|
4900
|
+
_ts_metadata17("design:paramtypes", [
|
|
4658
4901
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext
|
|
4659
4902
|
]),
|
|
4660
|
-
|
|
4903
|
+
_ts_metadata17("design:returntype", Promise)
|
|
4661
4904
|
], CopilotResolver.prototype, "availableAgents", null);
|
|
4662
|
-
|
|
4663
|
-
(0,
|
|
4664
|
-
_ts_param(0, (0,
|
|
4665
|
-
_ts_param(1, (0,
|
|
4666
|
-
_ts_param(2, (0,
|
|
4905
|
+
_ts_decorate17([
|
|
4906
|
+
(0, import_type_graphql18.Mutation)(() => CopilotResponse),
|
|
4907
|
+
_ts_param(0, (0, import_type_graphql18.Ctx)()),
|
|
4908
|
+
_ts_param(1, (0, import_type_graphql18.Arg)("data")),
|
|
4909
|
+
_ts_param(2, (0, import_type_graphql18.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
|
|
4667
4910
|
nullable: true
|
|
4668
4911
|
})),
|
|
4669
|
-
|
|
4670
|
-
|
|
4912
|
+
_ts_metadata17("design:type", Function),
|
|
4913
|
+
_ts_metadata17("design:paramtypes", [
|
|
4671
4914
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
4672
4915
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
4673
4916
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
4674
4917
|
]),
|
|
4675
|
-
|
|
4918
|
+
_ts_metadata17("design:returntype", Promise)
|
|
4676
4919
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
4677
|
-
CopilotResolver =
|
|
4678
|
-
(0,
|
|
4920
|
+
CopilotResolver = _ts_decorate17([
|
|
4921
|
+
(0, import_type_graphql18.Resolver)(() => CopilotResponse)
|
|
4679
4922
|
], CopilotResolver);
|
|
4680
4923
|
|
|
4681
4924
|
// src/lib/integrations/shared.ts
|
|
@@ -4709,6 +4952,141 @@ function createLogger(options) {
|
|
|
4709
4952
|
}
|
|
4710
4953
|
__name(createLogger, "createLogger");
|
|
4711
4954
|
|
|
4955
|
+
// src/graphql/resolvers/state.resolver.ts
|
|
4956
|
+
var import_type_graphql21 = require("type-graphql");
|
|
4957
|
+
var import_type_graphql22 = require("type-graphql");
|
|
4958
|
+
var import_type_graphql23 = require("type-graphql");
|
|
4959
|
+
|
|
4960
|
+
// src/graphql/types/load-agent-state-response.type.ts
|
|
4961
|
+
var import_type_graphql19 = require("type-graphql");
|
|
4962
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
4963
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4964
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4965
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4966
|
+
else
|
|
4967
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4968
|
+
if (d = decorators[i])
|
|
4969
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4970
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4971
|
+
}
|
|
4972
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
4973
|
+
function _ts_metadata18(k, v) {
|
|
4974
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4975
|
+
return Reflect.metadata(k, v);
|
|
4976
|
+
}
|
|
4977
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
4978
|
+
var LoadAgentStateResponse = class {
|
|
4979
|
+
threadId;
|
|
4980
|
+
threadExists;
|
|
4981
|
+
state;
|
|
4982
|
+
messages;
|
|
4983
|
+
};
|
|
4984
|
+
__name(LoadAgentStateResponse, "LoadAgentStateResponse");
|
|
4985
|
+
_ts_decorate18([
|
|
4986
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
4987
|
+
_ts_metadata18("design:type", String)
|
|
4988
|
+
], LoadAgentStateResponse.prototype, "threadId", void 0);
|
|
4989
|
+
_ts_decorate18([
|
|
4990
|
+
(0, import_type_graphql19.Field)(() => Boolean),
|
|
4991
|
+
_ts_metadata18("design:type", Boolean)
|
|
4992
|
+
], LoadAgentStateResponse.prototype, "threadExists", void 0);
|
|
4993
|
+
_ts_decorate18([
|
|
4994
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
4995
|
+
_ts_metadata18("design:type", String)
|
|
4996
|
+
], LoadAgentStateResponse.prototype, "state", void 0);
|
|
4997
|
+
_ts_decorate18([
|
|
4998
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
4999
|
+
_ts_metadata18("design:type", String)
|
|
5000
|
+
], LoadAgentStateResponse.prototype, "messages", void 0);
|
|
5001
|
+
LoadAgentStateResponse = _ts_decorate18([
|
|
5002
|
+
(0, import_type_graphql19.ObjectType)()
|
|
5003
|
+
], LoadAgentStateResponse);
|
|
5004
|
+
|
|
5005
|
+
// src/graphql/inputs/load-agent-state.input.ts
|
|
5006
|
+
var import_type_graphql20 = require("type-graphql");
|
|
5007
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
5008
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5009
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5010
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5011
|
+
else
|
|
5012
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
5013
|
+
if (d = decorators[i])
|
|
5014
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5015
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5016
|
+
}
|
|
5017
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
5018
|
+
function _ts_metadata19(k, v) {
|
|
5019
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5020
|
+
return Reflect.metadata(k, v);
|
|
5021
|
+
}
|
|
5022
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
5023
|
+
var LoadAgentStateInput = class {
|
|
5024
|
+
threadId;
|
|
5025
|
+
agentName;
|
|
5026
|
+
};
|
|
5027
|
+
__name(LoadAgentStateInput, "LoadAgentStateInput");
|
|
5028
|
+
_ts_decorate19([
|
|
5029
|
+
(0, import_type_graphql20.Field)(() => String),
|
|
5030
|
+
_ts_metadata19("design:type", String)
|
|
5031
|
+
], LoadAgentStateInput.prototype, "threadId", void 0);
|
|
5032
|
+
_ts_decorate19([
|
|
5033
|
+
(0, import_type_graphql20.Field)(() => String),
|
|
5034
|
+
_ts_metadata19("design:type", String)
|
|
5035
|
+
], LoadAgentStateInput.prototype, "agentName", void 0);
|
|
5036
|
+
LoadAgentStateInput = _ts_decorate19([
|
|
5037
|
+
(0, import_type_graphql20.InputType)()
|
|
5038
|
+
], LoadAgentStateInput);
|
|
5039
|
+
|
|
5040
|
+
// src/graphql/resolvers/state.resolver.ts
|
|
5041
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
5042
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5043
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5044
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5045
|
+
else
|
|
5046
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
5047
|
+
if (d = decorators[i])
|
|
5048
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5049
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5050
|
+
}
|
|
5051
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
5052
|
+
function _ts_metadata20(k, v) {
|
|
5053
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5054
|
+
return Reflect.metadata(k, v);
|
|
5055
|
+
}
|
|
5056
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
5057
|
+
function _ts_param2(paramIndex, decorator) {
|
|
5058
|
+
return function(target, key) {
|
|
5059
|
+
decorator(target, key, paramIndex);
|
|
5060
|
+
};
|
|
5061
|
+
}
|
|
5062
|
+
__name(_ts_param2, "_ts_param");
|
|
5063
|
+
var StateResolver = class {
|
|
5064
|
+
async loadAgentState(ctx, data) {
|
|
5065
|
+
const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
|
|
5066
|
+
const agent = agents.find((agent2) => agent2.name === data.agentName);
|
|
5067
|
+
if (!agent) {
|
|
5068
|
+
throw new Error("Agent not found");
|
|
5069
|
+
}
|
|
5070
|
+
const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
|
|
5071
|
+
return state;
|
|
5072
|
+
}
|
|
5073
|
+
};
|
|
5074
|
+
__name(StateResolver, "StateResolver");
|
|
5075
|
+
_ts_decorate20([
|
|
5076
|
+
(0, import_type_graphql23.Query)(() => LoadAgentStateResponse),
|
|
5077
|
+
_ts_param2(0, (0, import_type_graphql22.Ctx)()),
|
|
5078
|
+
_ts_param2(1, (0, import_type_graphql21.Arg)("data")),
|
|
5079
|
+
_ts_metadata20("design:type", Function),
|
|
5080
|
+
_ts_metadata20("design:paramtypes", [
|
|
5081
|
+
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
5082
|
+
typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
|
|
5083
|
+
]),
|
|
5084
|
+
_ts_metadata20("design:returntype", Promise)
|
|
5085
|
+
], StateResolver.prototype, "loadAgentState", null);
|
|
5086
|
+
StateResolver = _ts_decorate20([
|
|
5087
|
+
(0, import_type_graphql21.Resolver)(() => LoadAgentStateResponse)
|
|
5088
|
+
], StateResolver);
|
|
5089
|
+
|
|
4712
5090
|
// src/lib/integrations/shared.ts
|
|
4713
5091
|
var logger = createLogger();
|
|
4714
5092
|
async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
|
|
@@ -4730,9 +5108,10 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
|
|
|
4730
5108
|
__name(createContext, "createContext");
|
|
4731
5109
|
function buildSchema(options = {}) {
|
|
4732
5110
|
logger.debug("Building GraphQL schema...");
|
|
4733
|
-
const schema = (0,
|
|
5111
|
+
const schema = (0, import_type_graphql24.buildSchemaSync)({
|
|
4734
5112
|
resolvers: [
|
|
4735
|
-
CopilotResolver
|
|
5113
|
+
CopilotResolver,
|
|
5114
|
+
StateResolver
|
|
4736
5115
|
],
|
|
4737
5116
|
emitSchemaFile: options.emitSchemaFile
|
|
4738
5117
|
});
|