@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
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.5.12
|
|
47
|
+
version: "1.5.12",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -157,8 +157,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
157
157
|
var import_reflect_metadata = require("reflect-metadata");
|
|
158
158
|
|
|
159
159
|
// src/lib/runtime/copilot-runtime.ts
|
|
160
|
-
var
|
|
161
|
-
var import_langgraph_sdk2 = require("@langchain/langgraph-sdk");
|
|
160
|
+
var import_shared15 = require("@copilotkit/shared");
|
|
162
161
|
|
|
163
162
|
// src/service-adapters/langchain/langserve.ts
|
|
164
163
|
var import_remote = require("langchain/runnables/remote");
|
|
@@ -398,8 +397,9 @@ var OpenAIAdapter = class {
|
|
|
398
397
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
399
398
|
}
|
|
400
399
|
async process(request) {
|
|
401
|
-
const { threadId, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
400
|
+
const { threadId: threadIdFromRequest, model = this.model, messages, actions, eventSource, forwardedParameters } = request;
|
|
402
401
|
const tools = actions.map(convertActionInputToOpenAITool);
|
|
402
|
+
const threadId = threadIdFromRequest ?? (0, import_shared.randomUUID)();
|
|
403
403
|
let openaiMessages = messages.map(convertMessageToOpenAIMessage);
|
|
404
404
|
openaiMessages = limitMessagesToTokenCount(openaiMessages, tools, model);
|
|
405
405
|
let toolChoice = forwardedParameters == null ? void 0 : forwardedParameters.toolChoice;
|
|
@@ -497,7 +497,7 @@ var OpenAIAdapter = class {
|
|
|
497
497
|
eventStream$.complete();
|
|
498
498
|
});
|
|
499
499
|
return {
|
|
500
|
-
threadId
|
|
500
|
+
threadId
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
503
|
};
|
|
@@ -743,8 +743,8 @@ var LangChainAdapter = class {
|
|
|
743
743
|
}
|
|
744
744
|
async process(request) {
|
|
745
745
|
try {
|
|
746
|
-
const { eventSource, model, actions, messages, runId } = request;
|
|
747
|
-
const threadId =
|
|
746
|
+
const { eventSource, model, actions, messages, runId, threadId: threadIdFromRequest } = request;
|
|
747
|
+
const threadId = threadIdFromRequest ?? (0, import_shared3.randomUUID)();
|
|
748
748
|
const result = await this.options.chainFn({
|
|
749
749
|
messages: messages.map(convertMessageToLangChainMessage),
|
|
750
750
|
tools: actions.map(convertActionInputToLangChainTool),
|
|
@@ -805,8 +805,12 @@ var OpenAIAssistantAdapter = class {
|
|
|
805
805
|
this.disableParallelToolCalls = (params == null ? void 0 : params.disableParallelToolCalls) || false;
|
|
806
806
|
}
|
|
807
807
|
async process(request) {
|
|
808
|
+
var _a, _b;
|
|
808
809
|
const { messages, actions, eventSource, runId, forwardedParameters } = request;
|
|
809
|
-
let threadId = request.
|
|
810
|
+
let threadId = (_b = (_a = request.extensions) == null ? void 0 : _a.openaiAssistantAPI) == null ? void 0 : _b.threadId;
|
|
811
|
+
if (!threadId) {
|
|
812
|
+
threadId = (await this.openai.beta.threads.create()).id;
|
|
813
|
+
}
|
|
810
814
|
const lastMessage = messages.at(-1);
|
|
811
815
|
let nextRunId = void 0;
|
|
812
816
|
if (lastMessage.isResultMessage() && runId) {
|
|
@@ -817,8 +821,15 @@ var OpenAIAssistantAdapter = class {
|
|
|
817
821
|
throw new Error("No actionable message found in the messages");
|
|
818
822
|
}
|
|
819
823
|
return {
|
|
824
|
+
runId: nextRunId,
|
|
820
825
|
threadId,
|
|
821
|
-
|
|
826
|
+
extensions: {
|
|
827
|
+
...request.extensions,
|
|
828
|
+
openaiAssistantAPI: {
|
|
829
|
+
threadId,
|
|
830
|
+
runId: nextRunId
|
|
831
|
+
}
|
|
832
|
+
}
|
|
822
833
|
};
|
|
823
834
|
}
|
|
824
835
|
async submitToolOutputs(threadId, runId, messages, eventSource) {
|
|
@@ -1086,7 +1097,7 @@ var UnifyAdapter = class {
|
|
|
1086
1097
|
eventStream$.complete();
|
|
1087
1098
|
});
|
|
1088
1099
|
return {
|
|
1089
|
-
threadId: request.threadId || (0, import_shared4.
|
|
1100
|
+
threadId: request.threadId || (0, import_shared4.randomUUID)()
|
|
1090
1101
|
};
|
|
1091
1102
|
}
|
|
1092
1103
|
};
|
|
@@ -1207,7 +1218,7 @@ var GroqAdapter = class {
|
|
|
1207
1218
|
eventStream$.complete();
|
|
1208
1219
|
});
|
|
1209
1220
|
return {
|
|
1210
|
-
threadId: threadId || (0, import_shared5.
|
|
1221
|
+
threadId: request.threadId || (0, import_shared5.randomUUID)()
|
|
1211
1222
|
};
|
|
1212
1223
|
}
|
|
1213
1224
|
};
|
|
@@ -1458,7 +1469,7 @@ var AnthropicAdapter = class {
|
|
|
1458
1469
|
eventStream$.complete();
|
|
1459
1470
|
});
|
|
1460
1471
|
return {
|
|
1461
|
-
threadId: threadId || (0, import_shared6.
|
|
1472
|
+
threadId: threadId || (0, import_shared6.randomUUID)()
|
|
1462
1473
|
};
|
|
1463
1474
|
}
|
|
1464
1475
|
};
|
|
@@ -1533,7 +1544,7 @@ var ExperimentalOllamaAdapter = class {
|
|
|
1533
1544
|
eventStream$.complete();
|
|
1534
1545
|
});
|
|
1535
1546
|
return {
|
|
1536
|
-
threadId: request.threadId || (0, import_shared7.
|
|
1547
|
+
threadId: request.threadId || (0, import_shared7.randomUUID)()
|
|
1537
1548
|
};
|
|
1538
1549
|
}
|
|
1539
1550
|
};
|
|
@@ -1544,7 +1555,7 @@ var import_shared8 = require("@copilotkit/shared");
|
|
|
1544
1555
|
var EmptyAdapter = class {
|
|
1545
1556
|
async process(request) {
|
|
1546
1557
|
return {
|
|
1547
|
-
threadId: request.threadId || (0, import_shared8.
|
|
1558
|
+
threadId: request.threadId || (0, import_shared8.randomUUID)()
|
|
1548
1559
|
};
|
|
1549
1560
|
}
|
|
1550
1561
|
};
|
|
@@ -1552,11 +1563,11 @@ __name(EmptyAdapter, "EmptyAdapter");
|
|
|
1552
1563
|
var ExperimentalEmptyAdapter = EmptyAdapter;
|
|
1553
1564
|
|
|
1554
1565
|
// src/service-adapters/events.ts
|
|
1555
|
-
var
|
|
1566
|
+
var import_shared14 = require("@copilotkit/shared");
|
|
1556
1567
|
var import_rxjs2 = require("rxjs");
|
|
1557
1568
|
|
|
1558
1569
|
// src/lib/telemetry-client.ts
|
|
1559
|
-
var
|
|
1570
|
+
var import_shared13 = require("@copilotkit/shared");
|
|
1560
1571
|
|
|
1561
1572
|
// src/lib/runtime/remote-action-constructors.ts
|
|
1562
1573
|
var import_node_crypto2 = require("crypto");
|
|
@@ -1804,6 +1815,7 @@ __name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
|
1804
1815
|
// src/lib/runtime/remote-lg-action.ts
|
|
1805
1816
|
var import_langgraph_sdk = require("@langchain/langgraph-sdk");
|
|
1806
1817
|
var import_node_crypto = require("crypto");
|
|
1818
|
+
var import_shared10 = require("@copilotkit/shared");
|
|
1807
1819
|
var import_partial_json = require("partial-json");
|
|
1808
1820
|
|
|
1809
1821
|
// src/graphql/types/enums.ts
|
|
@@ -1857,7 +1869,7 @@ async function execute(args) {
|
|
|
1857
1869
|
__name(execute, "execute");
|
|
1858
1870
|
async function streamEvents(controller, args) {
|
|
1859
1871
|
var _a, _b, _c, _d, _e, _f;
|
|
1860
|
-
const { deploymentUrl, langsmithApiKey, threadId:
|
|
1872
|
+
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2 } = args;
|
|
1861
1873
|
let nodeName = initialNodeName;
|
|
1862
1874
|
let state = initialState;
|
|
1863
1875
|
const { name, assistantId: initialAssistantId } = agent;
|
|
@@ -1865,15 +1877,18 @@ async function streamEvents(controller, args) {
|
|
|
1865
1877
|
apiUrl: deploymentUrl,
|
|
1866
1878
|
apiKey: langsmithApiKey
|
|
1867
1879
|
});
|
|
1868
|
-
let
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
initialThreadId = initialThreadId.substring(3);
|
|
1880
|
+
let threadId = argsInitialThreadId ?? (0, import_shared10.randomUUID)();
|
|
1881
|
+
if (argsInitialThreadId && argsInitialThreadId.startsWith("ck-")) {
|
|
1882
|
+
threadId = argsInitialThreadId.substring(3);
|
|
1872
1883
|
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1884
|
+
if (!(0, import_shared10.isValidUUID)(threadId)) {
|
|
1885
|
+
console.warn(`Cannot use the threadId ${threadId} with LangGraph Platform. Must be a valid UUID.`);
|
|
1886
|
+
}
|
|
1887
|
+
let wasInitiatedWithExistingThread = true;
|
|
1888
|
+
try {
|
|
1875
1889
|
await client.threads.get(threadId);
|
|
1876
|
-
}
|
|
1890
|
+
} catch (error) {
|
|
1891
|
+
wasInitiatedWithExistingThread = false;
|
|
1877
1892
|
await client.threads.create({
|
|
1878
1893
|
threadId
|
|
1879
1894
|
});
|
|
@@ -1886,7 +1901,7 @@ async function streamEvents(controller, args) {
|
|
|
1886
1901
|
}
|
|
1887
1902
|
const agentStateValues = agentState.values;
|
|
1888
1903
|
state.messages = agentStateValues.messages;
|
|
1889
|
-
const mode =
|
|
1904
|
+
const mode = threadId && nodeName != "__end__" && nodeName != void 0 && nodeName != null ? "continue" : "start";
|
|
1890
1905
|
let formattedMessages = [];
|
|
1891
1906
|
try {
|
|
1892
1907
|
formattedMessages = copilotkitMessagesToLangChain(messages);
|
|
@@ -2306,7 +2321,7 @@ function copilotkitMessagesToLangChain(messages) {
|
|
|
2306
2321
|
__name(copilotkitMessagesToLangChain, "copilotkitMessagesToLangChain");
|
|
2307
2322
|
|
|
2308
2323
|
// src/lib/runtime/remote-action-constructors.ts
|
|
2309
|
-
var
|
|
2324
|
+
var import_shared11 = require("@copilotkit/shared");
|
|
2310
2325
|
function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, messages, agentStates }) {
|
|
2311
2326
|
const agents = endpoint.agents.map((agent) => ({
|
|
2312
2327
|
name: agent.name,
|
|
@@ -2414,10 +2429,10 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2414
2429
|
}, "Executed remote action");
|
|
2415
2430
|
return result;
|
|
2416
2431
|
} catch (error) {
|
|
2417
|
-
if (error instanceof
|
|
2432
|
+
if (error instanceof import_shared11.CopilotKitError) {
|
|
2418
2433
|
throw error;
|
|
2419
2434
|
}
|
|
2420
|
-
throw new
|
|
2435
|
+
throw new import_shared11.CopilotKitLowLevelError({
|
|
2421
2436
|
error,
|
|
2422
2437
|
url: fetchUrl
|
|
2423
2438
|
});
|
|
@@ -2482,10 +2497,10 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2482
2497
|
streamResponse(response.body, eventSource.eventStream$);
|
|
2483
2498
|
return eventSource.processLangGraphEvents();
|
|
2484
2499
|
} catch (error) {
|
|
2485
|
-
if (error instanceof
|
|
2500
|
+
if (error instanceof import_shared11.CopilotKitError) {
|
|
2486
2501
|
throw error;
|
|
2487
2502
|
}
|
|
2488
|
-
throw new
|
|
2503
|
+
throw new import_shared11.CopilotKitLowLevelError({
|
|
2489
2504
|
error,
|
|
2490
2505
|
url: fetchUrl
|
|
2491
2506
|
});
|
|
@@ -2559,7 +2574,7 @@ function createHeaders(onBeforeRequest, graphqlContext) {
|
|
|
2559
2574
|
__name(createHeaders, "createHeaders");
|
|
2560
2575
|
|
|
2561
2576
|
// src/lib/runtime/remote-actions.ts
|
|
2562
|
-
var
|
|
2577
|
+
var import_shared12 = require("@copilotkit/shared");
|
|
2563
2578
|
var EndpointType;
|
|
2564
2579
|
(function(EndpointType2) {
|
|
2565
2580
|
EndpointType2["CopilotKit"] = "copilotKit";
|
|
@@ -2593,7 +2608,7 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2593
2608
|
status: response.status,
|
|
2594
2609
|
body: await response.text()
|
|
2595
2610
|
}, "Failed to fetch actions from url");
|
|
2596
|
-
throw new
|
|
2611
|
+
throw new import_shared12.ResolvedCopilotKitError({
|
|
2597
2612
|
status: response.status,
|
|
2598
2613
|
isRemoteEndpoint: true
|
|
2599
2614
|
});
|
|
@@ -2604,10 +2619,10 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
2604
2619
|
}, "Fetched actions from url");
|
|
2605
2620
|
return json;
|
|
2606
2621
|
} catch (error) {
|
|
2607
|
-
if (error instanceof
|
|
2622
|
+
if (error instanceof import_shared12.CopilotKitError) {
|
|
2608
2623
|
throw error;
|
|
2609
2624
|
}
|
|
2610
|
-
throw new
|
|
2625
|
+
throw new import_shared12.CopilotKitLowLevelError({
|
|
2611
2626
|
error,
|
|
2612
2627
|
url: fetchUrl
|
|
2613
2628
|
});
|
|
@@ -2670,7 +2685,7 @@ __name(setupRemoteActions, "setupRemoteActions");
|
|
|
2670
2685
|
// src/lib/telemetry-client.ts
|
|
2671
2686
|
var import_node_crypto3 = require("crypto");
|
|
2672
2687
|
var packageJson = require_package();
|
|
2673
|
-
var telemetryClient = new
|
|
2688
|
+
var telemetryClient = new import_shared13.TelemetryClient({
|
|
2674
2689
|
packageName: packageJson.name,
|
|
2675
2690
|
packageVersion: packageJson.version
|
|
2676
2691
|
});
|
|
@@ -2980,13 +2995,13 @@ var RuntimeEventSource = class {
|
|
|
2980
2995
|
const errorMessage = `\u274C ${message}`;
|
|
2981
2996
|
if (!this.callback) {
|
|
2982
2997
|
this.stream(async (eventStream$) => {
|
|
2983
|
-
eventStream$.sendTextMessage((0,
|
|
2998
|
+
eventStream$.sendTextMessage((0, import_shared14.randomId)(), errorMessage);
|
|
2984
2999
|
});
|
|
2985
3000
|
} else {
|
|
2986
|
-
this.eventStream$.sendTextMessage((0,
|
|
3001
|
+
this.eventStream$.sendTextMessage((0, import_shared14.randomId)(), errorMessage);
|
|
2987
3002
|
}
|
|
2988
3003
|
}
|
|
2989
|
-
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
|
|
3004
|
+
processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents, threadId }) {
|
|
2990
3005
|
this.callback(this.eventStream$).catch((error) => {
|
|
2991
3006
|
console.error("Error in event source callback", error);
|
|
2992
3007
|
this.sendErrorMessageToChat();
|
|
@@ -3022,7 +3037,7 @@ var RuntimeEventSource = class {
|
|
|
3022
3037
|
(0, import_rxjs2.concatMap)((eventWithState) => {
|
|
3023
3038
|
if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
|
|
3024
3039
|
const toolCallEventStream$ = new RuntimeEventSubject();
|
|
3025
|
-
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionParentMessageId, eventWithState.actionExecutionId, actionInputsWithoutAgents).catch((error) => {
|
|
3040
|
+
executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionParentMessageId, eventWithState.actionExecutionId, actionInputsWithoutAgents, threadId).catch((error) => {
|
|
3026
3041
|
console.error(error);
|
|
3027
3042
|
});
|
|
3028
3043
|
telemetry_client_default.capture("oss.runtime.server_action_executed", {});
|
|
@@ -3039,7 +3054,7 @@ var RuntimeEventSource = class {
|
|
|
3039
3054
|
}
|
|
3040
3055
|
};
|
|
3041
3056
|
__name(RuntimeEventSource, "RuntimeEventSource");
|
|
3042
|
-
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionParentMessageId, actionExecutionId, actionInputsWithoutAgents) {
|
|
3057
|
+
async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionParentMessageId, actionExecutionId, actionInputsWithoutAgents, threadId) {
|
|
3043
3058
|
var _a;
|
|
3044
3059
|
if (guardrailsResult$) {
|
|
3045
3060
|
const { status } = await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
|
|
@@ -3090,6 +3105,7 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
|
|
|
3090
3105
|
});
|
|
3091
3106
|
const stream = await action.langGraphAgentHandler({
|
|
3092
3107
|
name: action.name,
|
|
3108
|
+
threadId,
|
|
3093
3109
|
actionInputsWithoutAgents,
|
|
3094
3110
|
additionalMessages: [
|
|
3095
3111
|
agentExecution,
|
|
@@ -3189,6 +3205,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
|
3189
3205
|
|
|
3190
3206
|
// src/lib/runtime/copilot-runtime.ts
|
|
3191
3207
|
var import_rxjs3 = require("rxjs");
|
|
3208
|
+
var import_langgraph_sdk2 = require("@langchain/langgraph-sdk");
|
|
3192
3209
|
var CopilotRuntime = class {
|
|
3193
3210
|
actions;
|
|
3194
3211
|
remoteEndpointDefinitions;
|
|
@@ -3208,14 +3225,14 @@ var CopilotRuntime = class {
|
|
|
3208
3225
|
}
|
|
3209
3226
|
async processRuntimeRequest(request) {
|
|
3210
3227
|
var _a;
|
|
3211
|
-
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
|
|
3228
|
+
const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url, extensions } = request;
|
|
3212
3229
|
const eventSource = new RuntimeEventSource();
|
|
3213
3230
|
try {
|
|
3214
3231
|
if (agentSession) {
|
|
3215
3232
|
return await this.processAgentRequest(request);
|
|
3216
3233
|
}
|
|
3217
3234
|
if (serviceAdapter instanceof EmptyAdapter) {
|
|
3218
|
-
throw new
|
|
3235
|
+
throw new import_shared15.CopilotKitMisuseError({
|
|
3219
3236
|
message: `Invalid adapter configuration: EmptyAdapter is only meant to be used with agent lock mode.
|
|
3220
3237
|
For non-agent components like useCopilotChatSuggestions, CopilotTextarea, or CopilotTask,
|
|
3221
3238
|
please use an LLM adapter instead.`
|
|
@@ -3227,7 +3244,7 @@ please use an LLM adapter instead.`
|
|
|
3227
3244
|
const serverSideActionsInput = serverSideActions.map((action) => ({
|
|
3228
3245
|
name: action.name,
|
|
3229
3246
|
description: action.description,
|
|
3230
|
-
jsonSchema: JSON.stringify((0,
|
|
3247
|
+
jsonSchema: JSON.stringify((0, import_shared15.actionParametersToJsonSchema)(action.parameters))
|
|
3231
3248
|
}));
|
|
3232
3249
|
const actionInputs = flattenToolCallsNoDuplicates([
|
|
3233
3250
|
...serverSideActionsInput,
|
|
@@ -3249,12 +3266,14 @@ please use an LLM adapter instead.`
|
|
|
3249
3266
|
threadId,
|
|
3250
3267
|
runId,
|
|
3251
3268
|
eventSource,
|
|
3252
|
-
forwardedParameters
|
|
3269
|
+
forwardedParameters,
|
|
3270
|
+
extensions
|
|
3253
3271
|
});
|
|
3272
|
+
const nonEmptyThreadId = threadId ?? result.threadId;
|
|
3254
3273
|
outputMessagesPromise.then((outputMessages) => {
|
|
3255
3274
|
var _a2;
|
|
3256
3275
|
(_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
|
|
3257
|
-
threadId:
|
|
3276
|
+
threadId: nonEmptyThreadId,
|
|
3258
3277
|
runId: result.runId,
|
|
3259
3278
|
inputMessages,
|
|
3260
3279
|
outputMessages,
|
|
@@ -3264,17 +3283,18 @@ please use an LLM adapter instead.`
|
|
|
3264
3283
|
}).catch((_error) => {
|
|
3265
3284
|
});
|
|
3266
3285
|
return {
|
|
3267
|
-
threadId:
|
|
3286
|
+
threadId: nonEmptyThreadId,
|
|
3268
3287
|
runId: result.runId,
|
|
3269
3288
|
eventSource,
|
|
3270
3289
|
serverSideActions,
|
|
3271
3290
|
actionInputsWithoutAgents: actionInputs.filter((action) => (
|
|
3272
3291
|
// TODO-AGENTS: do not exclude ALL server side actions
|
|
3273
3292
|
!serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
3274
|
-
))
|
|
3293
|
+
)),
|
|
3294
|
+
extensions: result.extensions
|
|
3275
3295
|
};
|
|
3276
3296
|
} catch (error) {
|
|
3277
|
-
if (error instanceof
|
|
3297
|
+
if (error instanceof import_shared15.CopilotKitError) {
|
|
3278
3298
|
throw error;
|
|
3279
3299
|
}
|
|
3280
3300
|
console.error("Error getting response:", error);
|
|
@@ -3314,9 +3334,9 @@ please use an LLM adapter instead.`
|
|
|
3314
3334
|
});
|
|
3315
3335
|
if (!response.ok) {
|
|
3316
3336
|
if (response.status === 404) {
|
|
3317
|
-
throw new
|
|
3337
|
+
throw new import_shared15.CopilotKitApiDiscoveryError();
|
|
3318
3338
|
}
|
|
3319
|
-
throw new
|
|
3339
|
+
throw new import_shared15.ResolvedCopilotKitError({
|
|
3320
3340
|
status: response.status,
|
|
3321
3341
|
isRemoteEndpoint: true
|
|
3322
3342
|
});
|
|
@@ -3324,18 +3344,19 @@ please use an LLM adapter instead.`
|
|
|
3324
3344
|
const data = await response.json();
|
|
3325
3345
|
const endpointAgents = ((data == null ? void 0 : data.agents) ?? []).map((agent) => ({
|
|
3326
3346
|
name: agent.name,
|
|
3327
|
-
description: agent.description ?? "",
|
|
3328
|
-
id: (0,
|
|
3347
|
+
description: agent.description ?? "" ?? "",
|
|
3348
|
+
id: (0, import_shared15.randomId)(),
|
|
3349
|
+
endpoint
|
|
3329
3350
|
}));
|
|
3330
3351
|
return [
|
|
3331
3352
|
...agents2,
|
|
3332
3353
|
...endpointAgents
|
|
3333
3354
|
];
|
|
3334
3355
|
} catch (error) {
|
|
3335
|
-
if (error instanceof
|
|
3356
|
+
if (error instanceof import_shared15.CopilotKitError) {
|
|
3336
3357
|
throw error;
|
|
3337
3358
|
}
|
|
3338
|
-
throw new
|
|
3359
|
+
throw new import_shared15.CopilotKitLowLevelError({
|
|
3339
3360
|
error,
|
|
3340
3361
|
url: fetchUrl
|
|
3341
3362
|
});
|
|
@@ -3343,22 +3364,74 @@ please use an LLM adapter instead.`
|
|
|
3343
3364
|
}, Promise.resolve([]));
|
|
3344
3365
|
return agents;
|
|
3345
3366
|
}
|
|
3367
|
+
async loadAgentState(graphqlContext, threadId, agentName) {
|
|
3368
|
+
const agentsWithEndpoints = await this.discoverAgentsFromEndpoints(graphqlContext);
|
|
3369
|
+
const agentWithEndpoint = agentsWithEndpoints.find((agent) => agent.name === agentName);
|
|
3370
|
+
if (!agentWithEndpoint) {
|
|
3371
|
+
throw new Error("Agent not found");
|
|
3372
|
+
}
|
|
3373
|
+
const headers = createHeaders(null, graphqlContext);
|
|
3374
|
+
if (agentWithEndpoint.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
3375
|
+
const client = new import_langgraph_sdk2.Client({
|
|
3376
|
+
apiUrl: agentWithEndpoint.endpoint.deploymentUrl,
|
|
3377
|
+
apiKey: agentWithEndpoint.endpoint.langsmithApiKey
|
|
3378
|
+
});
|
|
3379
|
+
const state = (await client.threads.getState(threadId)).values;
|
|
3380
|
+
if (Object.keys(state).length === 0) {
|
|
3381
|
+
return {
|
|
3382
|
+
threadId,
|
|
3383
|
+
threadExists: false,
|
|
3384
|
+
state: JSON.stringify({}),
|
|
3385
|
+
messages: JSON.stringify([])
|
|
3386
|
+
};
|
|
3387
|
+
} else {
|
|
3388
|
+
console.log(state);
|
|
3389
|
+
const { messages, ...stateWithoutMessages } = state;
|
|
3390
|
+
const copilotkitMessages = langchainMessagesToCopilotKit(messages);
|
|
3391
|
+
return {
|
|
3392
|
+
threadId,
|
|
3393
|
+
threadExists: true,
|
|
3394
|
+
state: JSON.stringify(stateWithoutMessages),
|
|
3395
|
+
messages: JSON.stringify(copilotkitMessages)
|
|
3396
|
+
};
|
|
3397
|
+
}
|
|
3398
|
+
} else if (agentWithEndpoint.endpoint.type === EndpointType.CopilotKit || !("type" in agentWithEndpoint.endpoint)) {
|
|
3399
|
+
const response = await fetch(`${agentWithEndpoint.endpoint.url}/agents/state`, {
|
|
3400
|
+
method: "POST",
|
|
3401
|
+
headers,
|
|
3402
|
+
body: JSON.stringify({
|
|
3403
|
+
properties: graphqlContext.properties,
|
|
3404
|
+
threadId,
|
|
3405
|
+
name: agentName
|
|
3406
|
+
})
|
|
3407
|
+
});
|
|
3408
|
+
const data = await response.json();
|
|
3409
|
+
return {
|
|
3410
|
+
...data,
|
|
3411
|
+
state: JSON.stringify(data.state),
|
|
3412
|
+
messages: JSON.stringify(data.messages)
|
|
3413
|
+
};
|
|
3414
|
+
} else {
|
|
3415
|
+
throw new Error(`Unknown endpoint type: ${agentWithEndpoint.endpoint.type}`);
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3346
3418
|
async processAgentRequest(request) {
|
|
3347
3419
|
var _a;
|
|
3348
|
-
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
|
|
3349
|
-
const {
|
|
3420
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest } = request;
|
|
3421
|
+
const { agentName, nodeName } = agentSession;
|
|
3422
|
+
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
3350
3423
|
const serverSideActions = await this.getServerSideActions(request);
|
|
3351
3424
|
const messages = convertGqlInputToMessages(rawMessages);
|
|
3352
3425
|
const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
|
|
3353
3426
|
if (!agent) {
|
|
3354
|
-
throw new
|
|
3427
|
+
throw new import_shared15.CopilotKitAgentDiscoveryError({
|
|
3355
3428
|
agentName
|
|
3356
3429
|
});
|
|
3357
3430
|
}
|
|
3358
3431
|
const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
|
|
3359
3432
|
name: action.name,
|
|
3360
3433
|
description: action.description,
|
|
3361
|
-
jsonSchema: JSON.stringify((0,
|
|
3434
|
+
jsonSchema: JSON.stringify((0, import_shared15.actionParametersToJsonSchema)(action.parameters))
|
|
3362
3435
|
}));
|
|
3363
3436
|
const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
|
|
3364
3437
|
...serverSideActionsInput,
|
|
@@ -3486,14 +3559,14 @@ function resolveEndpointType(endpoint) {
|
|
|
3486
3559
|
__name(resolveEndpointType, "resolveEndpointType");
|
|
3487
3560
|
|
|
3488
3561
|
// src/lib/integrations/shared.ts
|
|
3489
|
-
var
|
|
3562
|
+
var import_type_graphql24 = require("type-graphql");
|
|
3490
3563
|
|
|
3491
3564
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
3492
|
-
var
|
|
3565
|
+
var import_type_graphql18 = require("type-graphql");
|
|
3493
3566
|
var import_rxjs4 = require("rxjs");
|
|
3494
3567
|
|
|
3495
3568
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
3496
|
-
var
|
|
3569
|
+
var import_type_graphql12 = require("type-graphql");
|
|
3497
3570
|
|
|
3498
3571
|
// src/graphql/inputs/message.input.ts
|
|
3499
3572
|
var import_type_graphql3 = require("type-graphql");
|
|
@@ -4009,7 +4082,8 @@ AgentStateInput = _ts_decorate9([
|
|
|
4009
4082
|
(0, import_type_graphql10.InputType)()
|
|
4010
4083
|
], AgentStateInput);
|
|
4011
4084
|
|
|
4012
|
-
// src/graphql/inputs/
|
|
4085
|
+
// src/graphql/inputs/extensions.input.ts
|
|
4086
|
+
var import_type_graphql11 = require("type-graphql");
|
|
4013
4087
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
4014
4088
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4015
4089
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -4026,18 +4100,69 @@ function _ts_metadata10(k, v) {
|
|
|
4026
4100
|
return Reflect.metadata(k, v);
|
|
4027
4101
|
}
|
|
4028
4102
|
__name(_ts_metadata10, "_ts_metadata");
|
|
4103
|
+
var ExtensionsInput = class {
|
|
4104
|
+
openaiAssistantAPI;
|
|
4105
|
+
};
|
|
4106
|
+
__name(ExtensionsInput, "ExtensionsInput");
|
|
4107
|
+
_ts_decorate10([
|
|
4108
|
+
(0, import_type_graphql11.Field)(() => OpenAIApiAssistantAPIInput, {
|
|
4109
|
+
nullable: true
|
|
4110
|
+
}),
|
|
4111
|
+
_ts_metadata10("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
|
|
4112
|
+
], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
|
|
4113
|
+
ExtensionsInput = _ts_decorate10([
|
|
4114
|
+
(0, import_type_graphql11.InputType)()
|
|
4115
|
+
], ExtensionsInput);
|
|
4116
|
+
var OpenAIApiAssistantAPIInput = class {
|
|
4117
|
+
runId;
|
|
4118
|
+
threadId;
|
|
4119
|
+
};
|
|
4120
|
+
__name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
|
|
4121
|
+
_ts_decorate10([
|
|
4122
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
4123
|
+
nullable: true
|
|
4124
|
+
}),
|
|
4125
|
+
_ts_metadata10("design:type", String)
|
|
4126
|
+
], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
|
|
4127
|
+
_ts_decorate10([
|
|
4128
|
+
(0, import_type_graphql11.Field)(() => String, {
|
|
4129
|
+
nullable: true
|
|
4130
|
+
}),
|
|
4131
|
+
_ts_metadata10("design:type", String)
|
|
4132
|
+
], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
|
|
4133
|
+
OpenAIApiAssistantAPIInput = _ts_decorate10([
|
|
4134
|
+
(0, import_type_graphql11.InputType)()
|
|
4135
|
+
], OpenAIApiAssistantAPIInput);
|
|
4136
|
+
|
|
4137
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
4138
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
4139
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4140
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4141
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4142
|
+
else
|
|
4143
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4144
|
+
if (d = decorators[i])
|
|
4145
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4146
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4147
|
+
}
|
|
4148
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
4149
|
+
function _ts_metadata11(k, v) {
|
|
4150
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4151
|
+
return Reflect.metadata(k, v);
|
|
4152
|
+
}
|
|
4153
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
4029
4154
|
var GenerateCopilotResponseMetadataInput = class {
|
|
4030
4155
|
requestType;
|
|
4031
4156
|
};
|
|
4032
4157
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
4033
|
-
|
|
4034
|
-
(0,
|
|
4158
|
+
_ts_decorate11([
|
|
4159
|
+
(0, import_type_graphql12.Field)(() => CopilotRequestType, {
|
|
4035
4160
|
nullable: true
|
|
4036
4161
|
}),
|
|
4037
|
-
|
|
4162
|
+
_ts_metadata11("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
4038
4163
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
4039
|
-
GenerateCopilotResponseMetadataInput =
|
|
4040
|
-
(0,
|
|
4164
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate11([
|
|
4165
|
+
(0, import_type_graphql12.InputType)()
|
|
4041
4166
|
], GenerateCopilotResponseMetadataInput);
|
|
4042
4167
|
var GenerateCopilotResponseInput = class {
|
|
4043
4168
|
metadata;
|
|
@@ -4050,78 +4175,85 @@ var GenerateCopilotResponseInput = class {
|
|
|
4050
4175
|
agentSession;
|
|
4051
4176
|
agentState;
|
|
4052
4177
|
agentStates;
|
|
4178
|
+
extensions;
|
|
4053
4179
|
};
|
|
4054
4180
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
4055
|
-
|
|
4056
|
-
(0,
|
|
4181
|
+
_ts_decorate11([
|
|
4182
|
+
(0, import_type_graphql12.Field)(() => GenerateCopilotResponseMetadataInput, {
|
|
4057
4183
|
nullable: false
|
|
4058
4184
|
}),
|
|
4059
|
-
|
|
4185
|
+
_ts_metadata11("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
4060
4186
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
4061
|
-
|
|
4062
|
-
(0,
|
|
4187
|
+
_ts_decorate11([
|
|
4188
|
+
(0, import_type_graphql12.Field)(() => String, {
|
|
4063
4189
|
nullable: true
|
|
4064
4190
|
}),
|
|
4065
|
-
|
|
4191
|
+
_ts_metadata11("design:type", String)
|
|
4066
4192
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
4067
|
-
|
|
4068
|
-
(0,
|
|
4193
|
+
_ts_decorate11([
|
|
4194
|
+
(0, import_type_graphql12.Field)(() => String, {
|
|
4069
4195
|
nullable: true
|
|
4070
4196
|
}),
|
|
4071
|
-
|
|
4197
|
+
_ts_metadata11("design:type", String)
|
|
4072
4198
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
4073
|
-
|
|
4074
|
-
(0,
|
|
4199
|
+
_ts_decorate11([
|
|
4200
|
+
(0, import_type_graphql12.Field)(() => [
|
|
4075
4201
|
MessageInput
|
|
4076
4202
|
]),
|
|
4077
|
-
|
|
4203
|
+
_ts_metadata11("design:type", Array)
|
|
4078
4204
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
4079
|
-
|
|
4080
|
-
(0,
|
|
4081
|
-
|
|
4205
|
+
_ts_decorate11([
|
|
4206
|
+
(0, import_type_graphql12.Field)(() => FrontendInput),
|
|
4207
|
+
_ts_metadata11("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
4082
4208
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
4083
|
-
|
|
4084
|
-
(0,
|
|
4209
|
+
_ts_decorate11([
|
|
4210
|
+
(0, import_type_graphql12.Field)(() => CloudInput, {
|
|
4085
4211
|
nullable: true
|
|
4086
4212
|
}),
|
|
4087
|
-
|
|
4213
|
+
_ts_metadata11("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
4088
4214
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
4089
|
-
|
|
4090
|
-
(0,
|
|
4215
|
+
_ts_decorate11([
|
|
4216
|
+
(0, import_type_graphql12.Field)(() => ForwardedParametersInput, {
|
|
4091
4217
|
nullable: true
|
|
4092
4218
|
}),
|
|
4093
|
-
|
|
4219
|
+
_ts_metadata11("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
4094
4220
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
4095
|
-
|
|
4096
|
-
(0,
|
|
4221
|
+
_ts_decorate11([
|
|
4222
|
+
(0, import_type_graphql12.Field)(() => AgentSessionInput, {
|
|
4097
4223
|
nullable: true
|
|
4098
4224
|
}),
|
|
4099
|
-
|
|
4225
|
+
_ts_metadata11("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
4100
4226
|
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
4101
|
-
|
|
4102
|
-
(0,
|
|
4227
|
+
_ts_decorate11([
|
|
4228
|
+
(0, import_type_graphql12.Field)(() => AgentStateInput, {
|
|
4103
4229
|
nullable: true
|
|
4104
4230
|
}),
|
|
4105
|
-
|
|
4231
|
+
_ts_metadata11("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
4106
4232
|
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
4107
|
-
|
|
4108
|
-
(0,
|
|
4233
|
+
_ts_decorate11([
|
|
4234
|
+
(0, import_type_graphql12.Field)(() => [
|
|
4109
4235
|
AgentStateInput
|
|
4110
4236
|
], {
|
|
4111
4237
|
nullable: true
|
|
4112
4238
|
}),
|
|
4113
|
-
|
|
4239
|
+
_ts_metadata11("design:type", Array)
|
|
4114
4240
|
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
4115
|
-
|
|
4116
|
-
(0,
|
|
4241
|
+
_ts_decorate11([
|
|
4242
|
+
(0, import_type_graphql12.Field)(() => ExtensionsInput, {
|
|
4243
|
+
nullable: true
|
|
4244
|
+
}),
|
|
4245
|
+
_ts_metadata11("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
|
|
4246
|
+
], GenerateCopilotResponseInput.prototype, "extensions", void 0);
|
|
4247
|
+
GenerateCopilotResponseInput = _ts_decorate11([
|
|
4248
|
+
(0, import_type_graphql12.InputType)()
|
|
4117
4249
|
], GenerateCopilotResponseInput);
|
|
4118
4250
|
|
|
4119
4251
|
// src/graphql/types/copilot-response.type.ts
|
|
4120
|
-
var
|
|
4252
|
+
var import_type_graphql16 = require("type-graphql");
|
|
4121
4253
|
|
|
4122
4254
|
// src/graphql/types/message-status.type.ts
|
|
4123
|
-
var
|
|
4124
|
-
function
|
|
4255
|
+
var import_type_graphql13 = require("type-graphql");
|
|
4256
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
4125
4257
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4126
4258
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4127
4259
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4131,58 +4263,58 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
4131
4263
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4132
4264
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4133
4265
|
}
|
|
4134
|
-
__name(
|
|
4135
|
-
function
|
|
4266
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
4267
|
+
function _ts_metadata12(k, v) {
|
|
4136
4268
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4137
4269
|
return Reflect.metadata(k, v);
|
|
4138
4270
|
}
|
|
4139
|
-
__name(
|
|
4271
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
4140
4272
|
var MessageStatusCode;
|
|
4141
4273
|
(function(MessageStatusCode2) {
|
|
4142
4274
|
MessageStatusCode2["Pending"] = "pending";
|
|
4143
4275
|
MessageStatusCode2["Success"] = "success";
|
|
4144
4276
|
MessageStatusCode2["Failed"] = "failed";
|
|
4145
4277
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
4146
|
-
(0,
|
|
4278
|
+
(0, import_type_graphql13.registerEnumType)(MessageStatusCode, {
|
|
4147
4279
|
name: "MessageStatusCode"
|
|
4148
4280
|
});
|
|
4149
4281
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
4150
4282
|
code;
|
|
4151
4283
|
}, "BaseMessageStatus");
|
|
4152
|
-
|
|
4153
|
-
(0,
|
|
4154
|
-
|
|
4284
|
+
_ts_decorate12([
|
|
4285
|
+
(0, import_type_graphql13.Field)(() => MessageStatusCode),
|
|
4286
|
+
_ts_metadata12("design:type", String)
|
|
4155
4287
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
4156
|
-
BaseMessageStatus =
|
|
4157
|
-
(0,
|
|
4288
|
+
BaseMessageStatus = _ts_decorate12([
|
|
4289
|
+
(0, import_type_graphql13.ObjectType)()
|
|
4158
4290
|
], BaseMessageStatus);
|
|
4159
4291
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
4160
4292
|
code = "pending";
|
|
4161
4293
|
};
|
|
4162
4294
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
4163
|
-
PendingMessageStatus =
|
|
4164
|
-
(0,
|
|
4295
|
+
PendingMessageStatus = _ts_decorate12([
|
|
4296
|
+
(0, import_type_graphql13.ObjectType)()
|
|
4165
4297
|
], PendingMessageStatus);
|
|
4166
4298
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
4167
4299
|
code = "success";
|
|
4168
4300
|
};
|
|
4169
4301
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
4170
|
-
SuccessMessageStatus =
|
|
4171
|
-
(0,
|
|
4302
|
+
SuccessMessageStatus = _ts_decorate12([
|
|
4303
|
+
(0, import_type_graphql13.ObjectType)()
|
|
4172
4304
|
], SuccessMessageStatus);
|
|
4173
4305
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
4174
4306
|
code = "failed";
|
|
4175
4307
|
reason;
|
|
4176
4308
|
};
|
|
4177
4309
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
4178
|
-
|
|
4179
|
-
(0,
|
|
4180
|
-
|
|
4310
|
+
_ts_decorate12([
|
|
4311
|
+
(0, import_type_graphql13.Field)(() => String),
|
|
4312
|
+
_ts_metadata12("design:type", String)
|
|
4181
4313
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
4182
|
-
FailedMessageStatus =
|
|
4183
|
-
(0,
|
|
4314
|
+
FailedMessageStatus = _ts_decorate12([
|
|
4315
|
+
(0, import_type_graphql13.ObjectType)()
|
|
4184
4316
|
], FailedMessageStatus);
|
|
4185
|
-
var MessageStatusUnion = (0,
|
|
4317
|
+
var MessageStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
4186
4318
|
name: "MessageStatus",
|
|
4187
4319
|
types: () => [
|
|
4188
4320
|
PendingMessageStatus,
|
|
@@ -4193,8 +4325,8 @@ var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
|
|
|
4193
4325
|
|
|
4194
4326
|
// src/graphql/types/response-status.type.ts
|
|
4195
4327
|
var import_graphql_scalars = require("graphql-scalars");
|
|
4196
|
-
var
|
|
4197
|
-
function
|
|
4328
|
+
var import_type_graphql14 = require("type-graphql");
|
|
4329
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
4198
4330
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4199
4331
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4200
4332
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4204,30 +4336,30 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
4204
4336
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4205
4337
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4206
4338
|
}
|
|
4207
|
-
__name(
|
|
4208
|
-
function
|
|
4339
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
4340
|
+
function _ts_metadata13(k, v) {
|
|
4209
4341
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4210
4342
|
return Reflect.metadata(k, v);
|
|
4211
4343
|
}
|
|
4212
|
-
__name(
|
|
4344
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
4213
4345
|
var ResponseStatusCode;
|
|
4214
4346
|
(function(ResponseStatusCode2) {
|
|
4215
4347
|
ResponseStatusCode2["Pending"] = "pending";
|
|
4216
4348
|
ResponseStatusCode2["Success"] = "success";
|
|
4217
4349
|
ResponseStatusCode2["Failed"] = "failed";
|
|
4218
4350
|
})(ResponseStatusCode || (ResponseStatusCode = {}));
|
|
4219
|
-
(0,
|
|
4351
|
+
(0, import_type_graphql14.registerEnumType)(ResponseStatusCode, {
|
|
4220
4352
|
name: "ResponseStatusCode"
|
|
4221
4353
|
});
|
|
4222
4354
|
var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
|
|
4223
4355
|
code;
|
|
4224
4356
|
}, "BaseResponseStatus");
|
|
4225
|
-
|
|
4226
|
-
(0,
|
|
4227
|
-
|
|
4357
|
+
_ts_decorate13([
|
|
4358
|
+
(0, import_type_graphql14.Field)(() => ResponseStatusCode),
|
|
4359
|
+
_ts_metadata13("design:type", String)
|
|
4228
4360
|
], BaseResponseStatus.prototype, "code", void 0);
|
|
4229
|
-
BaseResponseStatus =
|
|
4230
|
-
(0,
|
|
4361
|
+
BaseResponseStatus = _ts_decorate13([
|
|
4362
|
+
(0, import_type_graphql14.InterfaceType)({
|
|
4231
4363
|
resolveType(value) {
|
|
4232
4364
|
if (value.code === "success") {
|
|
4233
4365
|
return SuccessResponseStatus;
|
|
@@ -4239,14 +4371,14 @@ BaseResponseStatus = _ts_decorate12([
|
|
|
4239
4371
|
return void 0;
|
|
4240
4372
|
}
|
|
4241
4373
|
}),
|
|
4242
|
-
(0,
|
|
4374
|
+
(0, import_type_graphql14.ObjectType)()
|
|
4243
4375
|
], BaseResponseStatus);
|
|
4244
4376
|
var PendingResponseStatus = class extends BaseResponseStatus {
|
|
4245
4377
|
code = "pending";
|
|
4246
4378
|
};
|
|
4247
4379
|
__name(PendingResponseStatus, "PendingResponseStatus");
|
|
4248
|
-
PendingResponseStatus =
|
|
4249
|
-
(0,
|
|
4380
|
+
PendingResponseStatus = _ts_decorate13([
|
|
4381
|
+
(0, import_type_graphql14.ObjectType)({
|
|
4250
4382
|
implements: BaseResponseStatus
|
|
4251
4383
|
})
|
|
4252
4384
|
], PendingResponseStatus);
|
|
@@ -4254,8 +4386,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
|
|
|
4254
4386
|
code = "success";
|
|
4255
4387
|
};
|
|
4256
4388
|
__name(SuccessResponseStatus, "SuccessResponseStatus");
|
|
4257
|
-
SuccessResponseStatus =
|
|
4258
|
-
(0,
|
|
4389
|
+
SuccessResponseStatus = _ts_decorate13([
|
|
4390
|
+
(0, import_type_graphql14.ObjectType)({
|
|
4259
4391
|
implements: BaseResponseStatus
|
|
4260
4392
|
})
|
|
4261
4393
|
], SuccessResponseStatus);
|
|
@@ -4265,7 +4397,7 @@ var FailedResponseStatusReason;
|
|
|
4265
4397
|
FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
|
|
4266
4398
|
FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
|
|
4267
4399
|
})(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
|
|
4268
|
-
(0,
|
|
4400
|
+
(0, import_type_graphql14.registerEnumType)(FailedResponseStatusReason, {
|
|
4269
4401
|
name: "FailedResponseStatusReason"
|
|
4270
4402
|
});
|
|
4271
4403
|
var FailedResponseStatus = class extends BaseResponseStatus {
|
|
@@ -4274,22 +4406,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
|
|
|
4274
4406
|
details = null;
|
|
4275
4407
|
};
|
|
4276
4408
|
__name(FailedResponseStatus, "FailedResponseStatus");
|
|
4277
|
-
|
|
4278
|
-
(0,
|
|
4279
|
-
|
|
4409
|
+
_ts_decorate13([
|
|
4410
|
+
(0, import_type_graphql14.Field)(() => FailedResponseStatusReason),
|
|
4411
|
+
_ts_metadata13("design:type", String)
|
|
4280
4412
|
], FailedResponseStatus.prototype, "reason", void 0);
|
|
4281
|
-
|
|
4282
|
-
(0,
|
|
4413
|
+
_ts_decorate13([
|
|
4414
|
+
(0, import_type_graphql14.Field)(() => import_graphql_scalars.GraphQLJSON, {
|
|
4283
4415
|
nullable: true
|
|
4284
4416
|
}),
|
|
4285
|
-
|
|
4417
|
+
_ts_metadata13("design:type", typeof Record === "undefined" ? Object : Record)
|
|
4286
4418
|
], FailedResponseStatus.prototype, "details", void 0);
|
|
4287
|
-
FailedResponseStatus =
|
|
4288
|
-
(0,
|
|
4419
|
+
FailedResponseStatus = _ts_decorate13([
|
|
4420
|
+
(0, import_type_graphql14.ObjectType)({
|
|
4289
4421
|
implements: BaseResponseStatus
|
|
4290
4422
|
})
|
|
4291
4423
|
], FailedResponseStatus);
|
|
4292
|
-
var ResponseStatusUnion = (0,
|
|
4424
|
+
var ResponseStatusUnion = (0, import_type_graphql14.createUnionType)({
|
|
4293
4425
|
name: "ResponseStatus",
|
|
4294
4426
|
types: () => [
|
|
4295
4427
|
PendingResponseStatus,
|
|
@@ -4298,8 +4430,60 @@ var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
|
|
|
4298
4430
|
]
|
|
4299
4431
|
});
|
|
4300
4432
|
|
|
4433
|
+
// src/graphql/types/extensions-response.type.ts
|
|
4434
|
+
var import_type_graphql15 = require("type-graphql");
|
|
4435
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
4436
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4437
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4438
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4439
|
+
else
|
|
4440
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4441
|
+
if (d = decorators[i])
|
|
4442
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4443
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4444
|
+
}
|
|
4445
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
4446
|
+
function _ts_metadata14(k, v) {
|
|
4447
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4448
|
+
return Reflect.metadata(k, v);
|
|
4449
|
+
}
|
|
4450
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
4451
|
+
var ExtensionsResponse = class {
|
|
4452
|
+
openaiAssistantAPI;
|
|
4453
|
+
};
|
|
4454
|
+
__name(ExtensionsResponse, "ExtensionsResponse");
|
|
4455
|
+
_ts_decorate14([
|
|
4456
|
+
(0, import_type_graphql15.Field)(() => OpenAIApiAssistantAPIResponse, {
|
|
4457
|
+
nullable: true
|
|
4458
|
+
}),
|
|
4459
|
+
_ts_metadata14("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
|
|
4460
|
+
], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
|
|
4461
|
+
ExtensionsResponse = _ts_decorate14([
|
|
4462
|
+
(0, import_type_graphql15.ObjectType)()
|
|
4463
|
+
], ExtensionsResponse);
|
|
4464
|
+
var OpenAIApiAssistantAPIResponse = class {
|
|
4465
|
+
runId;
|
|
4466
|
+
threadId;
|
|
4467
|
+
};
|
|
4468
|
+
__name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
|
|
4469
|
+
_ts_decorate14([
|
|
4470
|
+
(0, import_type_graphql15.Field)(() => String, {
|
|
4471
|
+
nullable: true
|
|
4472
|
+
}),
|
|
4473
|
+
_ts_metadata14("design:type", String)
|
|
4474
|
+
], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
|
|
4475
|
+
_ts_decorate14([
|
|
4476
|
+
(0, import_type_graphql15.Field)(() => String, {
|
|
4477
|
+
nullable: true
|
|
4478
|
+
}),
|
|
4479
|
+
_ts_metadata14("design:type", String)
|
|
4480
|
+
], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
|
|
4481
|
+
OpenAIApiAssistantAPIResponse = _ts_decorate14([
|
|
4482
|
+
(0, import_type_graphql15.ObjectType)()
|
|
4483
|
+
], OpenAIApiAssistantAPIResponse);
|
|
4484
|
+
|
|
4301
4485
|
// src/graphql/types/copilot-response.type.ts
|
|
4302
|
-
function
|
|
4486
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
4303
4487
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4304
4488
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4305
4489
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4309,31 +4493,32 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
4309
4493
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4310
4494
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4311
4495
|
}
|
|
4312
|
-
__name(
|
|
4313
|
-
function
|
|
4496
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
4497
|
+
function _ts_metadata15(k, v) {
|
|
4314
4498
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4315
4499
|
return Reflect.metadata(k, v);
|
|
4316
4500
|
}
|
|
4317
|
-
__name(
|
|
4318
|
-
var BaseMessageOutput =
|
|
4501
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
4502
|
+
var BaseMessageOutput = class {
|
|
4319
4503
|
id;
|
|
4320
4504
|
createdAt;
|
|
4321
4505
|
status;
|
|
4322
|
-
}
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4506
|
+
};
|
|
4507
|
+
__name(BaseMessageOutput, "BaseMessageOutput");
|
|
4508
|
+
_ts_decorate15([
|
|
4509
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4510
|
+
_ts_metadata15("design:type", String)
|
|
4326
4511
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
4327
|
-
|
|
4328
|
-
(0,
|
|
4329
|
-
|
|
4512
|
+
_ts_decorate15([
|
|
4513
|
+
(0, import_type_graphql16.Field)(() => Date),
|
|
4514
|
+
_ts_metadata15("design:type", typeof Date === "undefined" ? Object : Date)
|
|
4330
4515
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
4331
|
-
|
|
4332
|
-
(0,
|
|
4333
|
-
|
|
4516
|
+
_ts_decorate15([
|
|
4517
|
+
(0, import_type_graphql16.Field)(() => MessageStatusUnion),
|
|
4518
|
+
_ts_metadata15("design:type", Object)
|
|
4334
4519
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
4335
|
-
BaseMessageOutput =
|
|
4336
|
-
(0,
|
|
4520
|
+
BaseMessageOutput = _ts_decorate15([
|
|
4521
|
+
(0, import_type_graphql16.InterfaceType)({
|
|
4337
4522
|
resolveType(value) {
|
|
4338
4523
|
if (value.hasOwnProperty("content")) {
|
|
4339
4524
|
return TextMessageOutput;
|
|
@@ -4354,24 +4539,24 @@ var TextMessageOutput = class {
|
|
|
4354
4539
|
parentMessageId;
|
|
4355
4540
|
};
|
|
4356
4541
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
4357
|
-
|
|
4358
|
-
(0,
|
|
4359
|
-
|
|
4542
|
+
_ts_decorate15([
|
|
4543
|
+
(0, import_type_graphql16.Field)(() => MessageRole),
|
|
4544
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
4360
4545
|
], TextMessageOutput.prototype, "role", void 0);
|
|
4361
|
-
|
|
4362
|
-
(0,
|
|
4546
|
+
_ts_decorate15([
|
|
4547
|
+
(0, import_type_graphql16.Field)(() => [
|
|
4363
4548
|
String
|
|
4364
4549
|
]),
|
|
4365
|
-
|
|
4550
|
+
_ts_metadata15("design:type", Array)
|
|
4366
4551
|
], TextMessageOutput.prototype, "content", void 0);
|
|
4367
|
-
|
|
4368
|
-
(0,
|
|
4552
|
+
_ts_decorate15([
|
|
4553
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
4369
4554
|
nullable: true
|
|
4370
4555
|
}),
|
|
4371
|
-
|
|
4556
|
+
_ts_metadata15("design:type", String)
|
|
4372
4557
|
], TextMessageOutput.prototype, "parentMessageId", void 0);
|
|
4373
|
-
TextMessageOutput =
|
|
4374
|
-
(0,
|
|
4558
|
+
TextMessageOutput = _ts_decorate15([
|
|
4559
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4375
4560
|
implements: BaseMessageOutput
|
|
4376
4561
|
})
|
|
4377
4562
|
], TextMessageOutput);
|
|
@@ -4382,31 +4567,31 @@ var ActionExecutionMessageOutput = class {
|
|
|
4382
4567
|
parentMessageId;
|
|
4383
4568
|
};
|
|
4384
4569
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
4385
|
-
|
|
4386
|
-
(0,
|
|
4387
|
-
|
|
4570
|
+
_ts_decorate15([
|
|
4571
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4572
|
+
_ts_metadata15("design:type", String)
|
|
4388
4573
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
4389
|
-
|
|
4390
|
-
(0,
|
|
4574
|
+
_ts_decorate15([
|
|
4575
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
4391
4576
|
nullable: true,
|
|
4392
4577
|
deprecationReason: "This field will be removed in a future version"
|
|
4393
4578
|
}),
|
|
4394
|
-
|
|
4579
|
+
_ts_metadata15("design:type", String)
|
|
4395
4580
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
4396
|
-
|
|
4397
|
-
(0,
|
|
4581
|
+
_ts_decorate15([
|
|
4582
|
+
(0, import_type_graphql16.Field)(() => [
|
|
4398
4583
|
String
|
|
4399
4584
|
]),
|
|
4400
|
-
|
|
4585
|
+
_ts_metadata15("design:type", Array)
|
|
4401
4586
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
4402
|
-
|
|
4403
|
-
(0,
|
|
4587
|
+
_ts_decorate15([
|
|
4588
|
+
(0, import_type_graphql16.Field)(() => String, {
|
|
4404
4589
|
nullable: true
|
|
4405
4590
|
}),
|
|
4406
|
-
|
|
4591
|
+
_ts_metadata15("design:type", String)
|
|
4407
4592
|
], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
|
|
4408
|
-
ActionExecutionMessageOutput =
|
|
4409
|
-
(0,
|
|
4593
|
+
ActionExecutionMessageOutput = _ts_decorate15([
|
|
4594
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4410
4595
|
implements: BaseMessageOutput
|
|
4411
4596
|
})
|
|
4412
4597
|
], ActionExecutionMessageOutput);
|
|
@@ -4416,20 +4601,20 @@ var ResultMessageOutput = class {
|
|
|
4416
4601
|
result;
|
|
4417
4602
|
};
|
|
4418
4603
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
4419
|
-
|
|
4420
|
-
(0,
|
|
4421
|
-
|
|
4604
|
+
_ts_decorate15([
|
|
4605
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4606
|
+
_ts_metadata15("design:type", String)
|
|
4422
4607
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
4423
|
-
|
|
4424
|
-
(0,
|
|
4425
|
-
|
|
4608
|
+
_ts_decorate15([
|
|
4609
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4610
|
+
_ts_metadata15("design:type", String)
|
|
4426
4611
|
], ResultMessageOutput.prototype, "actionName", void 0);
|
|
4427
|
-
|
|
4428
|
-
(0,
|
|
4429
|
-
|
|
4612
|
+
_ts_decorate15([
|
|
4613
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4614
|
+
_ts_metadata15("design:type", String)
|
|
4430
4615
|
], ResultMessageOutput.prototype, "result", void 0);
|
|
4431
|
-
ResultMessageOutput =
|
|
4432
|
-
(0,
|
|
4616
|
+
ResultMessageOutput = _ts_decorate15([
|
|
4617
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4433
4618
|
implements: BaseMessageOutput
|
|
4434
4619
|
})
|
|
4435
4620
|
], ResultMessageOutput);
|
|
@@ -4444,40 +4629,40 @@ var AgentStateMessageOutput = class {
|
|
|
4444
4629
|
running;
|
|
4445
4630
|
};
|
|
4446
4631
|
__name(AgentStateMessageOutput, "AgentStateMessageOutput");
|
|
4447
|
-
|
|
4448
|
-
(0,
|
|
4449
|
-
|
|
4632
|
+
_ts_decorate15([
|
|
4633
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4634
|
+
_ts_metadata15("design:type", String)
|
|
4450
4635
|
], AgentStateMessageOutput.prototype, "threadId", void 0);
|
|
4451
|
-
|
|
4452
|
-
(0,
|
|
4453
|
-
|
|
4636
|
+
_ts_decorate15([
|
|
4637
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4638
|
+
_ts_metadata15("design:type", String)
|
|
4454
4639
|
], AgentStateMessageOutput.prototype, "agentName", void 0);
|
|
4455
|
-
|
|
4456
|
-
(0,
|
|
4457
|
-
|
|
4640
|
+
_ts_decorate15([
|
|
4641
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4642
|
+
_ts_metadata15("design:type", String)
|
|
4458
4643
|
], AgentStateMessageOutput.prototype, "nodeName", void 0);
|
|
4459
|
-
|
|
4460
|
-
(0,
|
|
4461
|
-
|
|
4644
|
+
_ts_decorate15([
|
|
4645
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4646
|
+
_ts_metadata15("design:type", String)
|
|
4462
4647
|
], AgentStateMessageOutput.prototype, "runId", void 0);
|
|
4463
|
-
|
|
4464
|
-
(0,
|
|
4465
|
-
|
|
4648
|
+
_ts_decorate15([
|
|
4649
|
+
(0, import_type_graphql16.Field)(() => Boolean),
|
|
4650
|
+
_ts_metadata15("design:type", Boolean)
|
|
4466
4651
|
], AgentStateMessageOutput.prototype, "active", void 0);
|
|
4467
|
-
|
|
4468
|
-
(0,
|
|
4469
|
-
|
|
4652
|
+
_ts_decorate15([
|
|
4653
|
+
(0, import_type_graphql16.Field)(() => MessageRole),
|
|
4654
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
4470
4655
|
], AgentStateMessageOutput.prototype, "role", void 0);
|
|
4471
|
-
|
|
4472
|
-
(0,
|
|
4473
|
-
|
|
4656
|
+
_ts_decorate15([
|
|
4657
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4658
|
+
_ts_metadata15("design:type", String)
|
|
4474
4659
|
], AgentStateMessageOutput.prototype, "state", void 0);
|
|
4475
|
-
|
|
4476
|
-
(0,
|
|
4477
|
-
|
|
4660
|
+
_ts_decorate15([
|
|
4661
|
+
(0, import_type_graphql16.Field)(() => Boolean),
|
|
4662
|
+
_ts_metadata15("design:type", Boolean)
|
|
4478
4663
|
], AgentStateMessageOutput.prototype, "running", void 0);
|
|
4479
|
-
AgentStateMessageOutput =
|
|
4480
|
-
(0,
|
|
4664
|
+
AgentStateMessageOutput = _ts_decorate15([
|
|
4665
|
+
(0, import_type_graphql16.ObjectType)({
|
|
4481
4666
|
implements: BaseMessageOutput
|
|
4482
4667
|
})
|
|
4483
4668
|
], AgentStateMessageOutput);
|
|
@@ -4486,30 +4671,37 @@ var CopilotResponse = class {
|
|
|
4486
4671
|
status;
|
|
4487
4672
|
runId;
|
|
4488
4673
|
messages;
|
|
4674
|
+
extensions;
|
|
4489
4675
|
};
|
|
4490
4676
|
__name(CopilotResponse, "CopilotResponse");
|
|
4491
|
-
|
|
4492
|
-
(0,
|
|
4493
|
-
|
|
4677
|
+
_ts_decorate15([
|
|
4678
|
+
(0, import_type_graphql16.Field)(() => String),
|
|
4679
|
+
_ts_metadata15("design:type", String)
|
|
4494
4680
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
4495
|
-
|
|
4496
|
-
(0,
|
|
4497
|
-
|
|
4681
|
+
_ts_decorate15([
|
|
4682
|
+
(0, import_type_graphql16.Field)(() => ResponseStatusUnion),
|
|
4683
|
+
_ts_metadata15("design:type", Object)
|
|
4498
4684
|
], CopilotResponse.prototype, "status", void 0);
|
|
4499
|
-
|
|
4500
|
-
(0,
|
|
4685
|
+
_ts_decorate15([
|
|
4686
|
+
(0, import_type_graphql16.Field)({
|
|
4501
4687
|
nullable: true
|
|
4502
4688
|
}),
|
|
4503
|
-
|
|
4689
|
+
_ts_metadata15("design:type", String)
|
|
4504
4690
|
], CopilotResponse.prototype, "runId", void 0);
|
|
4505
|
-
|
|
4506
|
-
(0,
|
|
4691
|
+
_ts_decorate15([
|
|
4692
|
+
(0, import_type_graphql16.Field)(() => [
|
|
4507
4693
|
BaseMessageOutput
|
|
4508
4694
|
]),
|
|
4509
|
-
|
|
4695
|
+
_ts_metadata15("design:type", Array)
|
|
4510
4696
|
], CopilotResponse.prototype, "messages", void 0);
|
|
4511
|
-
|
|
4512
|
-
(0,
|
|
4697
|
+
_ts_decorate15([
|
|
4698
|
+
(0, import_type_graphql16.Field)(() => ExtensionsResponse, {
|
|
4699
|
+
nullable: true
|
|
4700
|
+
}),
|
|
4701
|
+
_ts_metadata15("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
|
|
4702
|
+
], CopilotResponse.prototype, "extensions", void 0);
|
|
4703
|
+
CopilotResponse = _ts_decorate15([
|
|
4704
|
+
(0, import_type_graphql16.ObjectType)()
|
|
4513
4705
|
], CopilotResponse);
|
|
4514
4706
|
|
|
4515
4707
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -4552,11 +4744,11 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
|
|
|
4552
4744
|
__name(UnknownErrorResponse, "UnknownErrorResponse");
|
|
4553
4745
|
|
|
4554
4746
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
4555
|
-
var
|
|
4747
|
+
var import_shared16 = require("@copilotkit/shared");
|
|
4556
4748
|
|
|
4557
4749
|
// src/graphql/types/agents-response.type.ts
|
|
4558
|
-
var
|
|
4559
|
-
function
|
|
4750
|
+
var import_type_graphql17 = require("type-graphql");
|
|
4751
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
4560
4752
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4561
4753
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4562
4754
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4566,49 +4758,49 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
4566
4758
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4567
4759
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4568
4760
|
}
|
|
4569
|
-
__name(
|
|
4570
|
-
function
|
|
4761
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
4762
|
+
function _ts_metadata16(k, v) {
|
|
4571
4763
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4572
4764
|
return Reflect.metadata(k, v);
|
|
4573
4765
|
}
|
|
4574
|
-
__name(
|
|
4766
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
4575
4767
|
var Agent = class {
|
|
4576
4768
|
id;
|
|
4577
4769
|
name;
|
|
4578
4770
|
description;
|
|
4579
4771
|
};
|
|
4580
4772
|
__name(Agent, "Agent");
|
|
4581
|
-
|
|
4582
|
-
(0,
|
|
4583
|
-
|
|
4773
|
+
_ts_decorate16([
|
|
4774
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4775
|
+
_ts_metadata16("design:type", String)
|
|
4584
4776
|
], Agent.prototype, "id", void 0);
|
|
4585
|
-
|
|
4586
|
-
(0,
|
|
4587
|
-
|
|
4777
|
+
_ts_decorate16([
|
|
4778
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4779
|
+
_ts_metadata16("design:type", String)
|
|
4588
4780
|
], Agent.prototype, "name", void 0);
|
|
4589
|
-
|
|
4590
|
-
(0,
|
|
4591
|
-
|
|
4781
|
+
_ts_decorate16([
|
|
4782
|
+
(0, import_type_graphql17.Field)(() => String),
|
|
4783
|
+
_ts_metadata16("design:type", String)
|
|
4592
4784
|
], Agent.prototype, "description", void 0);
|
|
4593
|
-
Agent =
|
|
4594
|
-
(0,
|
|
4785
|
+
Agent = _ts_decorate16([
|
|
4786
|
+
(0, import_type_graphql17.ObjectType)()
|
|
4595
4787
|
], Agent);
|
|
4596
4788
|
var AgentsResponse = class {
|
|
4597
4789
|
agents;
|
|
4598
4790
|
};
|
|
4599
4791
|
__name(AgentsResponse, "AgentsResponse");
|
|
4600
|
-
|
|
4601
|
-
(0,
|
|
4792
|
+
_ts_decorate16([
|
|
4793
|
+
(0, import_type_graphql17.Field)(() => [
|
|
4602
4794
|
Agent
|
|
4603
4795
|
]),
|
|
4604
|
-
|
|
4796
|
+
_ts_metadata16("design:type", Array)
|
|
4605
4797
|
], AgentsResponse.prototype, "agents", void 0);
|
|
4606
|
-
AgentsResponse =
|
|
4607
|
-
(0,
|
|
4798
|
+
AgentsResponse = _ts_decorate16([
|
|
4799
|
+
(0, import_type_graphql17.ObjectType)()
|
|
4608
4800
|
], AgentsResponse);
|
|
4609
4801
|
|
|
4610
4802
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
4611
|
-
function
|
|
4803
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
4612
4804
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4613
4805
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4614
4806
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -4618,12 +4810,12 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
4618
4810
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4619
4811
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4620
4812
|
}
|
|
4621
|
-
__name(
|
|
4622
|
-
function
|
|
4813
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
4814
|
+
function _ts_metadata17(k, v) {
|
|
4623
4815
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
4624
4816
|
return Reflect.metadata(k, v);
|
|
4625
4817
|
}
|
|
4626
|
-
__name(
|
|
4818
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
4627
4819
|
function _ts_param(paramIndex, decorator) {
|
|
4628
4820
|
return function(target, key) {
|
|
4629
4821
|
decorator(target, key, paramIndex);
|
|
@@ -4670,10 +4862,10 @@ var CopilotResolver = class {
|
|
|
4670
4862
|
component: "CopilotResolver.availableAgents"
|
|
4671
4863
|
});
|
|
4672
4864
|
logger2.debug("Processing");
|
|
4673
|
-
const
|
|
4865
|
+
const agentsWithEndpoints = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
|
|
4674
4866
|
logger2.debug("Event source created, creating response");
|
|
4675
4867
|
return {
|
|
4676
|
-
agents
|
|
4868
|
+
agents: agentsWithEndpoints.map(({ endpoint, ...agentWithoutEndpoint }) => agentWithoutEndpoint)
|
|
4677
4869
|
};
|
|
4678
4870
|
}
|
|
4679
4871
|
async generateCopilotResponse(ctx, data, properties) {
|
|
@@ -4735,7 +4927,7 @@ var CopilotResolver = class {
|
|
|
4735
4927
|
rejectOutputMessagesPromise = reject;
|
|
4736
4928
|
});
|
|
4737
4929
|
logger2.debug("Processing");
|
|
4738
|
-
const { eventSource, threadId = (0,
|
|
4930
|
+
const { eventSource, threadId = (0, import_shared16.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = await copilotRuntime.processRuntimeRequest({
|
|
4739
4931
|
serviceAdapter,
|
|
4740
4932
|
messages: data.messages,
|
|
4741
4933
|
actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
|
|
@@ -4747,13 +4939,15 @@ var CopilotResolver = class {
|
|
|
4747
4939
|
forwardedParameters: data.forwardedParameters,
|
|
4748
4940
|
agentSession: data.agentSession,
|
|
4749
4941
|
agentStates: data.agentStates,
|
|
4750
|
-
url: data.frontend.url
|
|
4942
|
+
url: data.frontend.url,
|
|
4943
|
+
extensions: data.extensions
|
|
4751
4944
|
});
|
|
4752
4945
|
logger2.debug("Event source created, creating response");
|
|
4753
4946
|
const response = {
|
|
4754
4947
|
threadId,
|
|
4755
4948
|
runId,
|
|
4756
4949
|
status: (0, import_rxjs4.firstValueFrom)(responseStatus$),
|
|
4950
|
+
extensions,
|
|
4757
4951
|
messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
4758
4952
|
var _a2, _b2;
|
|
4759
4953
|
logger2.debug("Messages repeater created");
|
|
@@ -4780,7 +4974,7 @@ var CopilotResolver = class {
|
|
|
4780
4974
|
});
|
|
4781
4975
|
outputMessages = [
|
|
4782
4976
|
(0, import_class_transformer3.plainToInstance)(TextMessage, {
|
|
4783
|
-
id: (0,
|
|
4977
|
+
id: (0, import_shared16.randomId)(),
|
|
4784
4978
|
createdAt: /* @__PURE__ */ new Date(),
|
|
4785
4979
|
content: result.reason,
|
|
4786
4980
|
role: MessageRole.assistant
|
|
@@ -4810,7 +5004,8 @@ var CopilotResolver = class {
|
|
|
4810
5004
|
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
4811
5005
|
// TODO-AGENTS: do not exclude ALL server side actions
|
|
4812
5006
|
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
4813
|
-
)
|
|
5007
|
+
),
|
|
5008
|
+
threadId
|
|
4814
5009
|
}).pipe(
|
|
4815
5010
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
4816
5011
|
// just the events that were emitted after the subscriber was added.
|
|
@@ -4971,7 +5166,7 @@ var CopilotResolver = class {
|
|
|
4971
5166
|
event
|
|
4972
5167
|
}, "Agent message event received");
|
|
4973
5168
|
pushMessage({
|
|
4974
|
-
id: (0,
|
|
5169
|
+
id: (0, import_shared16.randomId)(),
|
|
4975
5170
|
status: new SuccessMessageStatus(),
|
|
4976
5171
|
threadId: event.threadId,
|
|
4977
5172
|
agentName: event.agentName,
|
|
@@ -4984,7 +5179,7 @@ var CopilotResolver = class {
|
|
|
4984
5179
|
createdAt: /* @__PURE__ */ new Date()
|
|
4985
5180
|
});
|
|
4986
5181
|
outputMessages.push((0, import_class_transformer3.plainToInstance)(AgentStateMessage, {
|
|
4987
|
-
id: (0,
|
|
5182
|
+
id: (0, import_shared16.randomId)(),
|
|
4988
5183
|
threadId: event.threadId,
|
|
4989
5184
|
agentName: event.agentName,
|
|
4990
5185
|
nodeName: event.nodeName,
|
|
@@ -5028,38 +5223,38 @@ var CopilotResolver = class {
|
|
|
5028
5223
|
}
|
|
5029
5224
|
};
|
|
5030
5225
|
__name(CopilotResolver, "CopilotResolver");
|
|
5031
|
-
|
|
5032
|
-
(0,
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5226
|
+
_ts_decorate17([
|
|
5227
|
+
(0, import_type_graphql18.Query)(() => String),
|
|
5228
|
+
_ts_metadata17("design:type", Function),
|
|
5229
|
+
_ts_metadata17("design:paramtypes", []),
|
|
5230
|
+
_ts_metadata17("design:returntype", Promise)
|
|
5036
5231
|
], CopilotResolver.prototype, "hello", null);
|
|
5037
|
-
|
|
5038
|
-
(0,
|
|
5039
|
-
_ts_param(0, (0,
|
|
5040
|
-
|
|
5041
|
-
|
|
5232
|
+
_ts_decorate17([
|
|
5233
|
+
(0, import_type_graphql18.Query)(() => AgentsResponse),
|
|
5234
|
+
_ts_param(0, (0, import_type_graphql18.Ctx)()),
|
|
5235
|
+
_ts_metadata17("design:type", Function),
|
|
5236
|
+
_ts_metadata17("design:paramtypes", [
|
|
5042
5237
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext
|
|
5043
5238
|
]),
|
|
5044
|
-
|
|
5239
|
+
_ts_metadata17("design:returntype", Promise)
|
|
5045
5240
|
], CopilotResolver.prototype, "availableAgents", null);
|
|
5046
|
-
|
|
5047
|
-
(0,
|
|
5048
|
-
_ts_param(0, (0,
|
|
5049
|
-
_ts_param(1, (0,
|
|
5050
|
-
_ts_param(2, (0,
|
|
5241
|
+
_ts_decorate17([
|
|
5242
|
+
(0, import_type_graphql18.Mutation)(() => CopilotResponse),
|
|
5243
|
+
_ts_param(0, (0, import_type_graphql18.Ctx)()),
|
|
5244
|
+
_ts_param(1, (0, import_type_graphql18.Arg)("data")),
|
|
5245
|
+
_ts_param(2, (0, import_type_graphql18.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
|
|
5051
5246
|
nullable: true
|
|
5052
5247
|
})),
|
|
5053
|
-
|
|
5054
|
-
|
|
5248
|
+
_ts_metadata17("design:type", Function),
|
|
5249
|
+
_ts_metadata17("design:paramtypes", [
|
|
5055
5250
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
5056
5251
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
5057
5252
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
5058
5253
|
]),
|
|
5059
|
-
|
|
5254
|
+
_ts_metadata17("design:returntype", Promise)
|
|
5060
5255
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
5061
|
-
CopilotResolver =
|
|
5062
|
-
(0,
|
|
5256
|
+
CopilotResolver = _ts_decorate17([
|
|
5257
|
+
(0, import_type_graphql18.Resolver)(() => CopilotResponse)
|
|
5063
5258
|
], CopilotResolver);
|
|
5064
5259
|
|
|
5065
5260
|
// src/lib/integrations/shared.ts
|
|
@@ -5093,6 +5288,141 @@ function createLogger(options) {
|
|
|
5093
5288
|
}
|
|
5094
5289
|
__name(createLogger, "createLogger");
|
|
5095
5290
|
|
|
5291
|
+
// src/graphql/resolvers/state.resolver.ts
|
|
5292
|
+
var import_type_graphql21 = require("type-graphql");
|
|
5293
|
+
var import_type_graphql22 = require("type-graphql");
|
|
5294
|
+
var import_type_graphql23 = require("type-graphql");
|
|
5295
|
+
|
|
5296
|
+
// src/graphql/types/load-agent-state-response.type.ts
|
|
5297
|
+
var import_type_graphql19 = require("type-graphql");
|
|
5298
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
5299
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5300
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5301
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5302
|
+
else
|
|
5303
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
5304
|
+
if (d = decorators[i])
|
|
5305
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5306
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5307
|
+
}
|
|
5308
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
5309
|
+
function _ts_metadata18(k, v) {
|
|
5310
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5311
|
+
return Reflect.metadata(k, v);
|
|
5312
|
+
}
|
|
5313
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
5314
|
+
var LoadAgentStateResponse = class {
|
|
5315
|
+
threadId;
|
|
5316
|
+
threadExists;
|
|
5317
|
+
state;
|
|
5318
|
+
messages;
|
|
5319
|
+
};
|
|
5320
|
+
__name(LoadAgentStateResponse, "LoadAgentStateResponse");
|
|
5321
|
+
_ts_decorate18([
|
|
5322
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
5323
|
+
_ts_metadata18("design:type", String)
|
|
5324
|
+
], LoadAgentStateResponse.prototype, "threadId", void 0);
|
|
5325
|
+
_ts_decorate18([
|
|
5326
|
+
(0, import_type_graphql19.Field)(() => Boolean),
|
|
5327
|
+
_ts_metadata18("design:type", Boolean)
|
|
5328
|
+
], LoadAgentStateResponse.prototype, "threadExists", void 0);
|
|
5329
|
+
_ts_decorate18([
|
|
5330
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
5331
|
+
_ts_metadata18("design:type", String)
|
|
5332
|
+
], LoadAgentStateResponse.prototype, "state", void 0);
|
|
5333
|
+
_ts_decorate18([
|
|
5334
|
+
(0, import_type_graphql19.Field)(() => String),
|
|
5335
|
+
_ts_metadata18("design:type", String)
|
|
5336
|
+
], LoadAgentStateResponse.prototype, "messages", void 0);
|
|
5337
|
+
LoadAgentStateResponse = _ts_decorate18([
|
|
5338
|
+
(0, import_type_graphql19.ObjectType)()
|
|
5339
|
+
], LoadAgentStateResponse);
|
|
5340
|
+
|
|
5341
|
+
// src/graphql/inputs/load-agent-state.input.ts
|
|
5342
|
+
var import_type_graphql20 = require("type-graphql");
|
|
5343
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
5344
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5345
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5346
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5347
|
+
else
|
|
5348
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
5349
|
+
if (d = decorators[i])
|
|
5350
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5351
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5352
|
+
}
|
|
5353
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
5354
|
+
function _ts_metadata19(k, v) {
|
|
5355
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5356
|
+
return Reflect.metadata(k, v);
|
|
5357
|
+
}
|
|
5358
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
5359
|
+
var LoadAgentStateInput = class {
|
|
5360
|
+
threadId;
|
|
5361
|
+
agentName;
|
|
5362
|
+
};
|
|
5363
|
+
__name(LoadAgentStateInput, "LoadAgentStateInput");
|
|
5364
|
+
_ts_decorate19([
|
|
5365
|
+
(0, import_type_graphql20.Field)(() => String),
|
|
5366
|
+
_ts_metadata19("design:type", String)
|
|
5367
|
+
], LoadAgentStateInput.prototype, "threadId", void 0);
|
|
5368
|
+
_ts_decorate19([
|
|
5369
|
+
(0, import_type_graphql20.Field)(() => String),
|
|
5370
|
+
_ts_metadata19("design:type", String)
|
|
5371
|
+
], LoadAgentStateInput.prototype, "agentName", void 0);
|
|
5372
|
+
LoadAgentStateInput = _ts_decorate19([
|
|
5373
|
+
(0, import_type_graphql20.InputType)()
|
|
5374
|
+
], LoadAgentStateInput);
|
|
5375
|
+
|
|
5376
|
+
// src/graphql/resolvers/state.resolver.ts
|
|
5377
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
5378
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5379
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
5380
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5381
|
+
else
|
|
5382
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
5383
|
+
if (d = decorators[i])
|
|
5384
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5385
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5386
|
+
}
|
|
5387
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
5388
|
+
function _ts_metadata20(k, v) {
|
|
5389
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
5390
|
+
return Reflect.metadata(k, v);
|
|
5391
|
+
}
|
|
5392
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
5393
|
+
function _ts_param2(paramIndex, decorator) {
|
|
5394
|
+
return function(target, key) {
|
|
5395
|
+
decorator(target, key, paramIndex);
|
|
5396
|
+
};
|
|
5397
|
+
}
|
|
5398
|
+
__name(_ts_param2, "_ts_param");
|
|
5399
|
+
var StateResolver = class {
|
|
5400
|
+
async loadAgentState(ctx, data) {
|
|
5401
|
+
const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
|
|
5402
|
+
const agent = agents.find((agent2) => agent2.name === data.agentName);
|
|
5403
|
+
if (!agent) {
|
|
5404
|
+
throw new Error("Agent not found");
|
|
5405
|
+
}
|
|
5406
|
+
const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
|
|
5407
|
+
return state;
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5410
|
+
__name(StateResolver, "StateResolver");
|
|
5411
|
+
_ts_decorate20([
|
|
5412
|
+
(0, import_type_graphql23.Query)(() => LoadAgentStateResponse),
|
|
5413
|
+
_ts_param2(0, (0, import_type_graphql22.Ctx)()),
|
|
5414
|
+
_ts_param2(1, (0, import_type_graphql21.Arg)("data")),
|
|
5415
|
+
_ts_metadata20("design:type", Function),
|
|
5416
|
+
_ts_metadata20("design:paramtypes", [
|
|
5417
|
+
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
5418
|
+
typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
|
|
5419
|
+
]),
|
|
5420
|
+
_ts_metadata20("design:returntype", Promise)
|
|
5421
|
+
], StateResolver.prototype, "loadAgentState", null);
|
|
5422
|
+
StateResolver = _ts_decorate20([
|
|
5423
|
+
(0, import_type_graphql21.Resolver)(() => LoadAgentStateResponse)
|
|
5424
|
+
], StateResolver);
|
|
5425
|
+
|
|
5096
5426
|
// src/lib/integrations/shared.ts
|
|
5097
5427
|
var logger = createLogger();
|
|
5098
5428
|
async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
|
|
@@ -5114,9 +5444,10 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
|
|
|
5114
5444
|
__name(createContext, "createContext");
|
|
5115
5445
|
function buildSchema(options = {}) {
|
|
5116
5446
|
logger.debug("Building GraphQL schema...");
|
|
5117
|
-
const schema = (0,
|
|
5447
|
+
const schema = (0, import_type_graphql24.buildSchemaSync)({
|
|
5118
5448
|
resolvers: [
|
|
5119
|
-
CopilotResolver
|
|
5449
|
+
CopilotResolver,
|
|
5450
|
+
StateResolver
|
|
5120
5451
|
],
|
|
5121
5452
|
emitSchemaFile: options.emitSchemaFile
|
|
5122
5453
|
});
|