@copilotkit/runtime 1.5.1-test-custom-tag-prerelease-1.0 → 1.5.1

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +49 -4
  2. package/package.json +2 -2
  3. package/src/graphql/resolvers/copilot.resolver.ts +16 -0
  4. package/src/graphql/types/agents-response.type.ts +22 -0
  5. package/src/lib/runtime/copilot-runtime.ts +50 -0
  6. package/__snapshots__/schema/schema.graphql +0 -262
  7. package/dist/chunk-44O2JGUY.mjs +0 -12
  8. package/dist/chunk-44O2JGUY.mjs.map +0 -1
  9. package/dist/chunk-CLGKEUOA.mjs +0 -1408
  10. package/dist/chunk-CLGKEUOA.mjs.map +0 -1
  11. package/dist/chunk-D2WLFQS6.mjs +0 -43
  12. package/dist/chunk-D2WLFQS6.mjs.map +0 -1
  13. package/dist/chunk-DFOKBSIS.mjs +0 -1
  14. package/dist/chunk-DFOKBSIS.mjs.map +0 -1
  15. package/dist/chunk-F4RA4OOZ.mjs +0 -80
  16. package/dist/chunk-F4RA4OOZ.mjs.map +0 -1
  17. package/dist/chunk-L3RX2YCQ.mjs +0 -25
  18. package/dist/chunk-L3RX2YCQ.mjs.map +0 -1
  19. package/dist/chunk-RFF5IIZJ.mjs +0 -66
  20. package/dist/chunk-RFF5IIZJ.mjs.map +0 -1
  21. package/dist/chunk-U3V2BCGI.mjs +0 -152
  22. package/dist/chunk-U3V2BCGI.mjs.map +0 -1
  23. package/dist/chunk-YEAV6DRC.mjs +0 -3281
  24. package/dist/chunk-YEAV6DRC.mjs.map +0 -1
  25. package/dist/chunk-YOQGCPIU.mjs +0 -25
  26. package/dist/chunk-YOQGCPIU.mjs.map +0 -1
  27. package/dist/copilot-runtime-6285d897.d.ts +0 -189
  28. package/dist/graphql/types/base/index.d.ts +0 -6
  29. package/dist/graphql/types/base/index.js +0 -63
  30. package/dist/graphql/types/base/index.js.map +0 -1
  31. package/dist/graphql/types/base/index.mjs +0 -8
  32. package/dist/graphql/types/base/index.mjs.map +0 -1
  33. package/dist/graphql/types/converted/index.d.ts +0 -2
  34. package/dist/graphql/types/converted/index.js +0 -124
  35. package/dist/graphql/types/converted/index.js.map +0 -1
  36. package/dist/graphql/types/converted/index.mjs +0 -17
  37. package/dist/graphql/types/converted/index.mjs.map +0 -1
  38. package/dist/groq-adapter-15d41154.d.ts +0 -281
  39. package/dist/index-ff3fbc33.d.ts +0 -87
  40. package/dist/index.d.ts +0 -23
  41. package/dist/index.js +0 -5039
  42. package/dist/index.js.map +0 -1
  43. package/dist/index.mjs +0 -76
  44. package/dist/index.mjs.map +0 -1
  45. package/dist/langserve-48e976ac.d.ts +0 -176
  46. package/dist/lib/cloud/index.d.ts +0 -6
  47. package/dist/lib/cloud/index.js +0 -18
  48. package/dist/lib/cloud/index.js.map +0 -1
  49. package/dist/lib/cloud/index.mjs +0 -1
  50. package/dist/lib/cloud/index.mjs.map +0 -1
  51. package/dist/lib/index.d.ts +0 -20
  52. package/dist/lib/index.js +0 -4687
  53. package/dist/lib/index.js.map +0 -1
  54. package/dist/lib/index.mjs +0 -58
  55. package/dist/lib/index.mjs.map +0 -1
  56. package/dist/lib/integrations/index.d.ts +0 -33
  57. package/dist/lib/integrations/index.js +0 -2091
  58. package/dist/lib/integrations/index.js.map +0 -1
  59. package/dist/lib/integrations/index.mjs +0 -34
  60. package/dist/lib/integrations/index.mjs.map +0 -1
  61. package/dist/lib/integrations/nest/index.d.ts +0 -14
  62. package/dist/lib/integrations/nest/index.js +0 -2000
  63. package/dist/lib/integrations/nest/index.js.map +0 -1
  64. package/dist/lib/integrations/nest/index.mjs +0 -13
  65. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  66. package/dist/lib/integrations/node-express/index.d.ts +0 -14
  67. package/dist/lib/integrations/node-express/index.js +0 -2000
  68. package/dist/lib/integrations/node-express/index.js.map +0 -1
  69. package/dist/lib/integrations/node-express/index.mjs +0 -13
  70. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  71. package/dist/lib/integrations/node-http/index.d.ts +0 -14
  72. package/dist/lib/integrations/node-http/index.js +0 -1986
  73. package/dist/lib/integrations/node-http/index.js.map +0 -1
  74. package/dist/lib/integrations/node-http/index.mjs +0 -12
  75. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  76. package/dist/service-adapters/index.d.ts +0 -84
  77. package/dist/service-adapters/index.js +0 -1448
  78. package/dist/service-adapters/index.js.map +0 -1
  79. package/dist/service-adapters/index.mjs +0 -26
  80. package/dist/service-adapters/index.mjs.map +0 -1
  81. package/dist/utils/index.d.ts +0 -49
  82. package/dist/utils/index.js +0 -174
  83. package/dist/utils/index.js.map +0 -1
  84. package/dist/utils/index.mjs +0 -12
  85. package/dist/utils/index.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,13 +1,58 @@
1
1
  # @copilotkit/runtime
2
2
 
3
- ## 1.5.1-test-custom-tag-prerelease-1.0
3
+ ## 1.5.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 896c825: testing a prerelease
7
+ - 5c01e9e: test prerelease #4
8
+ - da280ed: Test prerelease script
9
+ - 27e42d7: testing a prerelease
10
+ - 05240a9: test pre #2
11
+ - 33218fe: test prerelease #3
12
+ - 03f3d6f: Test next prerelease
13
+ - 649ebcc: - fix: add warning when using agents that are not available on agent related hooks
8
14
  - 6dfa0d2: - feat: add temperature parameter support for LLM completions
9
- - Updated dependencies [896c825]
10
- - @copilotkit/shared@1.5.1-test-custom-tag-prerelease-1.0
15
+ - Updated dependencies [5c01e9e]
16
+ - Updated dependencies [da280ed]
17
+ - Updated dependencies [27e42d7]
18
+ - Updated dependencies [05240a9]
19
+ - Updated dependencies [33218fe]
20
+ - Updated dependencies [03f3d6f]
21
+ - @copilotkit/shared@1.5.1
22
+
23
+ ## 1.5.1-next.3
24
+
25
+ ### Patch Changes
26
+
27
+ - 33218fe: test prerelease #3
28
+ - Updated dependencies [33218fe]
29
+ - @copilotkit/shared@1.5.1-next.3
30
+
31
+ ## 1.5.1-next.2
32
+
33
+ ### Patch Changes
34
+
35
+ - da280ed: Test prerelease script
36
+ - 649ebcc: - fix: add warning when using agents that are not available on agent related hooks
37
+ - Updated dependencies [da280ed]
38
+ - @copilotkit/shared@1.5.1-next.2
39
+
40
+ ## 1.5.1-next.1
41
+
42
+ ### Patch Changes
43
+
44
+ - 03f3d6f: Test next prerelease
45
+ - Updated dependencies [03f3d6f]
46
+ - @copilotkit/shared@1.5.1-next.1
47
+
48
+ ## 1.5.1-next.0
49
+
50
+ ### Patch Changes
51
+
52
+ - 27e42d7: testing a prerelease
53
+ - 6dfa0d2: - feat: add temperature parameter support for LLM completions
54
+ - Updated dependencies [27e42d7]
55
+ - @copilotkit/shared@1.5.1-next.0
11
56
 
12
57
  ## 1.5.0
13
58
 
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.5.1-test-custom-tag-prerelease-1.0",
12
+ "version": "1.5.1",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -58,7 +58,7 @@
58
58
  "rxjs": "^7.8.1",
59
59
  "type-graphql": "2.0.0-rc.1",
60
60
  "zod": "^3.23.3",
61
- "@copilotkit/shared": "1.5.1-test-custom-tag-prerelease-1.0"
61
+ "@copilotkit/shared": "1.5.1"
62
62
  },
63
63
  "keywords": [
64
64
  "copilotkit",
@@ -42,6 +42,8 @@ import {
42
42
  } from "../types/converted";
43
43
  import telemetry from "../../lib/telemetry-client";
44
44
  import { randomId } from "@copilotkit/shared";
45
+ import { EndpointType, LangGraphPlatformAgent } from "../../lib/runtime/remote-actions";
46
+ import { AgentsResponse } from "../types/agents-response.type";
45
47
 
46
48
  const invokeGuardrails = async ({
47
49
  baseUrl,
@@ -106,6 +108,20 @@ export class CopilotResolver {
106
108
  return "Hello World";
107
109
  }
108
110
 
111
+ @Query(() => AgentsResponse)
112
+ async availableAgents(@Ctx() ctx: GraphQLContext) {
113
+ let logger = ctx.logger.child({ component: "CopilotResolver.availableAgents" });
114
+
115
+ logger.debug("Processing");
116
+ const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
117
+
118
+ logger.debug("Event source created, creating response");
119
+
120
+ return {
121
+ agents,
122
+ };
123
+ }
124
+
109
125
  @Mutation(() => CopilotResponse)
110
126
  async generateCopilotResponse(
111
127
  @Ctx() ctx: GraphQLContext,
@@ -0,0 +1,22 @@
1
+ import { Field, InterfaceType, ObjectType } from "type-graphql";
2
+ import { MessageRole } from "./enums";
3
+ import { MessageStatusUnion } from "./message-status.type";
4
+ import { ResponseStatusUnion } from "./response-status.type";
5
+
6
+ @ObjectType()
7
+ export class Agent {
8
+ @Field(() => String)
9
+ id: string;
10
+
11
+ @Field(() => String)
12
+ name: string;
13
+
14
+ @Field(() => String)
15
+ description?: string;
16
+ }
17
+
18
+ @ObjectType()
19
+ export class AgentsResponse {
20
+ @Field(() => [Agent])
21
+ agents: Agent[];
22
+ }
@@ -34,6 +34,8 @@ import { AgentSessionInput } from "../../graphql/inputs/agent-session.input";
34
34
  import { from } from "rxjs";
35
35
  import { AgentStateInput } from "../../graphql/inputs/agent-state.input";
36
36
  import { ActionInputAvailability } from "../../graphql/types/enums";
37
+ import { createHeaders } from "./remote-action-constructors";
38
+ import { Agent } from "../../graphql/types/agents-response.type";
37
39
 
38
40
  interface CopilotRuntimeRequest {
39
41
  serviceAdapter: CopilotServiceAdapter;
@@ -253,6 +255,54 @@ export class CopilotRuntime<const T extends Parameter[] | [] = []> {
253
255
  }
254
256
  }
255
257
 
258
+ async discoverAgentsFromEndpoints(graphqlContext: GraphQLContext): Promise<Agent[]> {
259
+ const headers = createHeaders(null, graphqlContext);
260
+ const agents = this.remoteEndpointDefinitions.reduce(
261
+ async (acc: Promise<Agent[]>, endpoint) => {
262
+ const agents = await acc;
263
+ if (endpoint.type === EndpointType.LangGraphPlatform) {
264
+ const response = await fetch(
265
+ `${(endpoint as LangGraphPlatformEndpoint).deploymentUrl}/assistants/search`,
266
+ {
267
+ method: "POST",
268
+ headers,
269
+ },
270
+ );
271
+
272
+ const data: Array<{ assistant_id: string; graph_id: string }> = await response.json();
273
+ const endpointAgents = (data ?? []).map((entry) => ({
274
+ name: entry.graph_id,
275
+ id: entry.assistant_id,
276
+ }));
277
+ return [...agents, ...endpointAgents];
278
+ }
279
+
280
+ interface InfoResponse {
281
+ agents?: Array<{
282
+ name: string;
283
+ description: string;
284
+ }>;
285
+ }
286
+
287
+ const response = await fetch(`${(endpoint as CopilotKitEndpoint).url}/info`, {
288
+ method: "POST",
289
+ headers,
290
+ body: JSON.stringify({ properties: graphqlContext.properties }),
291
+ });
292
+ const data: InfoResponse = await response.json();
293
+ const endpointAgents = (data?.agents ?? []).map((agent) => ({
294
+ name: agent.name,
295
+ description: agent.description,
296
+ id: randomId(), // Required by Agent type
297
+ }));
298
+ return [...agents, ...endpointAgents];
299
+ },
300
+ Promise.resolve([]),
301
+ );
302
+
303
+ return agents;
304
+ }
305
+
256
306
  private async processAgentRequest(
257
307
  request: CopilotRuntimeRequest,
258
308
  ): Promise<CopilotRuntimeResponse> {
@@ -1,262 +0,0 @@
1
- # -----------------------------------------------
2
- # !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
3
- # !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
4
- # -----------------------------------------------
5
-
6
- input ActionExecutionMessageInput {
7
- arguments: String!
8
- name: String!
9
- parentMessageId: String
10
- scope: String @deprecated(reason: "This field will be removed in a future version")
11
- }
12
-
13
- type ActionExecutionMessageOutput implements BaseMessageOutput {
14
- arguments: [String!]!
15
- createdAt: DateTimeISO!
16
- id: String!
17
- name: String!
18
- parentMessageId: String
19
- scope: String @deprecated(reason: "This field will be removed in a future version")
20
- status: MessageStatus!
21
- }
22
-
23
- input ActionInput {
24
- available: ActionInputAvailability
25
- description: String!
26
- jsonSchema: String!
27
- name: String!
28
- }
29
-
30
- """The availability of the frontend action"""
31
- enum ActionInputAvailability {
32
- disabled
33
- enabled
34
- remote
35
- }
36
-
37
- input AgentSessionInput {
38
- agentName: String!
39
- nodeName: String
40
- threadId: String
41
- }
42
-
43
- input AgentStateInput {
44
- agentName: String!
45
- state: String!
46
- }
47
-
48
- input AgentStateMessageInput {
49
- active: Boolean!
50
- agentName: String!
51
- nodeName: String!
52
- role: MessageRole!
53
- runId: String!
54
- running: Boolean!
55
- state: String!
56
- threadId: String!
57
- }
58
-
59
- type AgentStateMessageOutput implements BaseMessageOutput {
60
- active: Boolean!
61
- agentName: String!
62
- createdAt: DateTimeISO!
63
- id: String!
64
- nodeName: String!
65
- role: MessageRole!
66
- runId: String!
67
- running: Boolean!
68
- state: String!
69
- status: MessageStatus!
70
- threadId: String!
71
- }
72
-
73
- interface BaseMessageOutput {
74
- createdAt: DateTimeISO!
75
- id: String!
76
- status: MessageStatus!
77
- }
78
-
79
- interface BaseResponseStatus {
80
- code: ResponseStatusCode!
81
- }
82
-
83
- input CloudInput {
84
- guardrails: GuardrailsInput
85
- }
86
-
87
- """The type of Copilot request"""
88
- enum CopilotRequestType {
89
- Chat
90
- Suggestion
91
- Task
92
- TextareaCompletion
93
- TextareaPopover
94
- }
95
-
96
- type CopilotResponse {
97
- messages: [BaseMessageOutput!]!
98
- runId: String
99
- status: ResponseStatus!
100
- threadId: String!
101
- }
102
-
103
- """
104
- A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format.
105
- """
106
- scalar DateTimeISO
107
-
108
- type FailedMessageStatus {
109
- code: MessageStatusCode!
110
- reason: String!
111
- }
112
-
113
- type FailedResponseStatus implements BaseResponseStatus {
114
- code: ResponseStatusCode!
115
- details: JSON
116
- reason: FailedResponseStatusReason!
117
- }
118
-
119
- enum FailedResponseStatusReason {
120
- GUARDRAILS_VALIDATION_FAILED
121
- MESSAGE_STREAM_INTERRUPTED
122
- UNKNOWN_ERROR
123
- }
124
-
125
- input ForwardedParametersInput {
126
- maxTokens: Float
127
- model: String
128
- stop: [String!]
129
- temperature: Float
130
- toolChoice: String
131
- toolChoiceFunctionName: String
132
- }
133
-
134
- input FrontendInput {
135
- actions: [ActionInput!]!
136
- toDeprecate_fullContext: String
137
- url: String
138
- }
139
-
140
- input GenerateCopilotResponseInput {
141
- agentSession: AgentSessionInput
142
- agentState: AgentStateInput
143
- agentStates: [AgentStateInput!]
144
- cloud: CloudInput
145
- forwardedParameters: ForwardedParametersInput
146
- frontend: FrontendInput!
147
- messages: [MessageInput!]!
148
- metadata: GenerateCopilotResponseMetadataInput!
149
- runId: String
150
- threadId: String
151
- }
152
-
153
- input GenerateCopilotResponseMetadataInput {
154
- requestType: CopilotRequestType
155
- }
156
-
157
- input GuardrailsInput {
158
- inputValidationRules: GuardrailsRuleInput!
159
- }
160
-
161
- input GuardrailsRuleInput {
162
- allowList: [String!] = []
163
- denyList: [String!] = []
164
- }
165
-
166
- """
167
- The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
168
- """
169
- scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
170
-
171
- """
172
- The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
173
- """
174
- scalar JSONObject @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
175
-
176
- input MessageInput {
177
- actionExecutionMessage: ActionExecutionMessageInput
178
- agentStateMessage: AgentStateMessageInput
179
- createdAt: DateTimeISO!
180
- id: String!
181
- resultMessage: ResultMessageInput
182
- textMessage: TextMessageInput
183
- }
184
-
185
- """The role of the message"""
186
- enum MessageRole {
187
- assistant
188
- system
189
- tool
190
- user
191
- }
192
-
193
- union MessageStatus = FailedMessageStatus | PendingMessageStatus | SuccessMessageStatus
194
-
195
- enum MessageStatusCode {
196
- Failed
197
- Pending
198
- Success
199
- }
200
-
201
- type Mutation {
202
- generateCopilotResponse(data: GenerateCopilotResponseInput!, properties: JSONObject): CopilotResponse!
203
- }
204
-
205
- type PendingMessageStatus {
206
- code: MessageStatusCode!
207
- }
208
-
209
- type PendingResponseStatus implements BaseResponseStatus {
210
- code: ResponseStatusCode!
211
- }
212
-
213
- type Query {
214
- hello: String!
215
- }
216
-
217
- union ResponseStatus = FailedResponseStatus | PendingResponseStatus | SuccessResponseStatus
218
-
219
- enum ResponseStatusCode {
220
- Failed
221
- Pending
222
- Success
223
- }
224
-
225
- input ResultMessageInput {
226
- actionExecutionId: String!
227
- actionName: String!
228
- parentMessageId: String
229
- result: String!
230
- }
231
-
232
- type ResultMessageOutput implements BaseMessageOutput {
233
- actionExecutionId: String!
234
- actionName: String!
235
- createdAt: DateTimeISO!
236
- id: String!
237
- result: String!
238
- status: MessageStatus!
239
- }
240
-
241
- type SuccessMessageStatus {
242
- code: MessageStatusCode!
243
- }
244
-
245
- type SuccessResponseStatus implements BaseResponseStatus {
246
- code: ResponseStatusCode!
247
- }
248
-
249
- input TextMessageInput {
250
- content: String!
251
- parentMessageId: String
252
- role: MessageRole!
253
- }
254
-
255
- type TextMessageOutput implements BaseMessageOutput {
256
- content: [String!]!
257
- createdAt: DateTimeISO!
258
- id: String!
259
- parentMessageId: String
260
- role: MessageRole!
261
- status: MessageStatus!
262
- }
@@ -1,12 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __commonJS = (cb, mod) => function __require() {
5
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
- };
7
-
8
- export {
9
- __name,
10
- __commonJS
11
- };
12
- //# sourceMappingURL=chunk-44O2JGUY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}