@copilotkit/runtime 0.0.0-mme-load-agent-state-20250117154700

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 (176) hide show
  1. package/.eslintrc.js +7 -0
  2. package/CHANGELOG.md +929 -0
  3. package/README.md +46 -0
  4. package/__snapshots__/schema/schema.graphql +306 -0
  5. package/dist/chunk-44O2JGUY.mjs +12 -0
  6. package/dist/chunk-44O2JGUY.mjs.map +1 -0
  7. package/dist/chunk-4BWLNVK4.mjs +80 -0
  8. package/dist/chunk-4BWLNVK4.mjs.map +1 -0
  9. package/dist/chunk-4QJA7OT2.mjs +3395 -0
  10. package/dist/chunk-4QJA7OT2.mjs.map +1 -0
  11. package/dist/chunk-4YJIXJLO.mjs +25 -0
  12. package/dist/chunk-4YJIXJLO.mjs.map +1 -0
  13. package/dist/chunk-67KK2GZ5.mjs +3765 -0
  14. package/dist/chunk-67KK2GZ5.mjs.map +1 -0
  15. package/dist/chunk-7BOVBWKI.mjs +25 -0
  16. package/dist/chunk-7BOVBWKI.mjs.map +1 -0
  17. package/dist/chunk-B5KHNAW5.mjs +25 -0
  18. package/dist/chunk-B5KHNAW5.mjs.map +1 -0
  19. package/dist/chunk-CLGKEUOA.mjs +1408 -0
  20. package/dist/chunk-CLGKEUOA.mjs.map +1 -0
  21. package/dist/chunk-D2WLFQS6.mjs +43 -0
  22. package/dist/chunk-D2WLFQS6.mjs.map +1 -0
  23. package/dist/chunk-DFOKBSIS.mjs +1 -0
  24. package/dist/chunk-DFOKBSIS.mjs.map +1 -0
  25. package/dist/chunk-DKLATJGV.mjs +25 -0
  26. package/dist/chunk-DKLATJGV.mjs.map +1 -0
  27. package/dist/chunk-FYONHPZL.mjs +3397 -0
  28. package/dist/chunk-FYONHPZL.mjs.map +1 -0
  29. package/dist/chunk-HNUNXFTW.mjs +129 -0
  30. package/dist/chunk-HNUNXFTW.mjs.map +1 -0
  31. package/dist/chunk-OKUXS4SE.mjs +25 -0
  32. package/dist/chunk-OKUXS4SE.mjs.map +1 -0
  33. package/dist/chunk-P4PPTGPJ.mjs +25 -0
  34. package/dist/chunk-P4PPTGPJ.mjs.map +1 -0
  35. package/dist/chunk-RFF5IIZJ.mjs +66 -0
  36. package/dist/chunk-RFF5IIZJ.mjs.map +1 -0
  37. package/dist/chunk-U3V2BCGI.mjs +152 -0
  38. package/dist/chunk-U3V2BCGI.mjs.map +1 -0
  39. package/dist/chunk-U7EKYV47.mjs +80 -0
  40. package/dist/chunk-U7EKYV47.mjs.map +1 -0
  41. package/dist/chunk-XXYYCH4X.mjs +80 -0
  42. package/dist/chunk-XXYYCH4X.mjs.map +1 -0
  43. package/dist/chunk-YT7A6V5T.mjs +1420 -0
  44. package/dist/chunk-YT7A6V5T.mjs.map +1 -0
  45. package/dist/copilot-runtime-36700e00.d.ts +196 -0
  46. package/dist/copilot-runtime-8c442d65.d.ts +209 -0
  47. package/dist/graphql/types/base/index.d.ts +6 -0
  48. package/dist/graphql/types/base/index.js +63 -0
  49. package/dist/graphql/types/base/index.js.map +1 -0
  50. package/dist/graphql/types/base/index.mjs +8 -0
  51. package/dist/graphql/types/base/index.mjs.map +1 -0
  52. package/dist/graphql/types/converted/index.d.ts +2 -0
  53. package/dist/graphql/types/converted/index.js +187 -0
  54. package/dist/graphql/types/converted/index.js.map +1 -0
  55. package/dist/graphql/types/converted/index.mjs +17 -0
  56. package/dist/graphql/types/converted/index.mjs.map +1 -0
  57. package/dist/groq-adapter-696b5d29.d.ts +281 -0
  58. package/dist/groq-adapter-7a82cd22.d.ts +301 -0
  59. package/dist/index-a7f37670.d.ts +103 -0
  60. package/dist/index-cc2b17be.d.ts +87 -0
  61. package/dist/index.d.ts +23 -0
  62. package/dist/index.js +5597 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/index.mjs +76 -0
  65. package/dist/index.mjs.map +1 -0
  66. package/dist/langserve-9125a12e.d.ts +176 -0
  67. package/dist/langserve-e308c437.d.ts +209 -0
  68. package/dist/lib/cloud/index.d.ts +6 -0
  69. package/dist/lib/cloud/index.js +18 -0
  70. package/dist/lib/cloud/index.js.map +1 -0
  71. package/dist/lib/cloud/index.mjs +1 -0
  72. package/dist/lib/cloud/index.mjs.map +1 -0
  73. package/dist/lib/index.d.ts +20 -0
  74. package/dist/lib/index.js +5256 -0
  75. package/dist/lib/index.js.map +1 -0
  76. package/dist/lib/index.mjs +58 -0
  77. package/dist/lib/index.mjs.map +1 -0
  78. package/dist/lib/integrations/index.d.ts +33 -0
  79. package/dist/lib/integrations/index.js +2488 -0
  80. package/dist/lib/integrations/index.js.map +1 -0
  81. package/dist/lib/integrations/index.mjs +34 -0
  82. package/dist/lib/integrations/index.mjs.map +1 -0
  83. package/dist/lib/integrations/nest/index.d.ts +14 -0
  84. package/dist/lib/integrations/nest/index.js +2397 -0
  85. package/dist/lib/integrations/nest/index.js.map +1 -0
  86. package/dist/lib/integrations/nest/index.mjs +13 -0
  87. package/dist/lib/integrations/nest/index.mjs.map +1 -0
  88. package/dist/lib/integrations/node-express/index.d.ts +14 -0
  89. package/dist/lib/integrations/node-express/index.js +2397 -0
  90. package/dist/lib/integrations/node-express/index.js.map +1 -0
  91. package/dist/lib/integrations/node-express/index.mjs +13 -0
  92. package/dist/lib/integrations/node-express/index.mjs.map +1 -0
  93. package/dist/lib/integrations/node-http/index.d.ts +14 -0
  94. package/dist/lib/integrations/node-http/index.js +2383 -0
  95. package/dist/lib/integrations/node-http/index.js.map +1 -0
  96. package/dist/lib/integrations/node-http/index.mjs +12 -0
  97. package/dist/lib/integrations/node-http/index.mjs.map +1 -0
  98. package/dist/service-adapters/index.d.ts +84 -0
  99. package/dist/service-adapters/index.js +1460 -0
  100. package/dist/service-adapters/index.js.map +1 -0
  101. package/dist/service-adapters/index.mjs +26 -0
  102. package/dist/service-adapters/index.mjs.map +1 -0
  103. package/dist/utils/index.d.ts +49 -0
  104. package/dist/utils/index.js +174 -0
  105. package/dist/utils/index.js.map +1 -0
  106. package/dist/utils/index.mjs +12 -0
  107. package/dist/utils/index.mjs.map +1 -0
  108. package/jest.config.js +5 -0
  109. package/package.json +85 -0
  110. package/scripts/generate-gql-schema.ts +13 -0
  111. package/src/agents/langgraph/event-source.ts +287 -0
  112. package/src/agents/langgraph/events.ts +338 -0
  113. package/src/graphql/inputs/action.input.ts +16 -0
  114. package/src/graphql/inputs/agent-session.input.ts +13 -0
  115. package/src/graphql/inputs/agent-state.input.ts +10 -0
  116. package/src/graphql/inputs/cloud-guardrails.input.ts +16 -0
  117. package/src/graphql/inputs/cloud.input.ts +8 -0
  118. package/src/graphql/inputs/context-property.input.ts +10 -0
  119. package/src/graphql/inputs/custom-property.input.ts +15 -0
  120. package/src/graphql/inputs/extensions.input.ts +21 -0
  121. package/src/graphql/inputs/forwarded-parameters.input.ts +22 -0
  122. package/src/graphql/inputs/frontend.input.ts +14 -0
  123. package/src/graphql/inputs/generate-copilot-response.input.ts +51 -0
  124. package/src/graphql/inputs/load-agent-state.input.ts +10 -0
  125. package/src/graphql/inputs/message.input.ts +92 -0
  126. package/src/graphql/resolvers/copilot.resolver.ts +561 -0
  127. package/src/graphql/resolvers/state.resolver.ts +23 -0
  128. package/src/graphql/types/agents-response.type.ts +19 -0
  129. package/src/graphql/types/base/index.ts +10 -0
  130. package/src/graphql/types/converted/index.ts +136 -0
  131. package/src/graphql/types/copilot-response.type.ts +117 -0
  132. package/src/graphql/types/enums.ts +37 -0
  133. package/src/graphql/types/extensions-response.type.ts +23 -0
  134. package/src/graphql/types/guardrails-result.type.ts +20 -0
  135. package/src/graphql/types/load-agent-state-response.type.ts +17 -0
  136. package/src/graphql/types/message-status.type.ts +40 -0
  137. package/src/graphql/types/response-status.type.ts +66 -0
  138. package/src/index.ts +4 -0
  139. package/src/lib/cloud/index.ts +4 -0
  140. package/src/lib/index.ts +8 -0
  141. package/src/lib/integrations/index.ts +6 -0
  142. package/src/lib/integrations/nest/index.ts +17 -0
  143. package/src/lib/integrations/nextjs/app-router.ts +40 -0
  144. package/src/lib/integrations/nextjs/pages-router.ts +49 -0
  145. package/src/lib/integrations/node-express/index.ts +17 -0
  146. package/src/lib/integrations/node-http/index.ts +34 -0
  147. package/src/lib/integrations/shared.ts +110 -0
  148. package/src/lib/logger.ts +28 -0
  149. package/src/lib/runtime/copilot-runtime.ts +571 -0
  150. package/src/lib/runtime/remote-action-constructors.ts +304 -0
  151. package/src/lib/runtime/remote-actions.ts +174 -0
  152. package/src/lib/runtime/remote-lg-action.ts +669 -0
  153. package/src/lib/telemetry-client.ts +52 -0
  154. package/src/service-adapters/anthropic/anthropic-adapter.ts +204 -0
  155. package/src/service-adapters/anthropic/utils.ts +144 -0
  156. package/src/service-adapters/conversion.ts +64 -0
  157. package/src/service-adapters/events.ts +424 -0
  158. package/src/service-adapters/experimental/empty/empty-adapter.ts +33 -0
  159. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +79 -0
  160. package/src/service-adapters/google/google-genai-adapter.ts +39 -0
  161. package/src/service-adapters/groq/groq-adapter.ts +173 -0
  162. package/src/service-adapters/index.ts +16 -0
  163. package/src/service-adapters/langchain/langchain-adapter.ts +106 -0
  164. package/src/service-adapters/langchain/langserve.ts +87 -0
  165. package/src/service-adapters/langchain/types.ts +14 -0
  166. package/src/service-adapters/langchain/utils.ts +306 -0
  167. package/src/service-adapters/openai/openai-adapter.ts +211 -0
  168. package/src/service-adapters/openai/openai-assistant-adapter.ts +315 -0
  169. package/src/service-adapters/openai/utils.ts +161 -0
  170. package/src/service-adapters/service-adapter.ts +34 -0
  171. package/src/service-adapters/unify/unify-adapter.ts +144 -0
  172. package/src/utils/failed-response-status-reasons.ts +48 -0
  173. package/src/utils/index.ts +1 -0
  174. package/tsconfig.json +11 -0
  175. package/tsup.config.ts +16 -0
  176. package/typedoc.json +4 -0
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ <div align="center">
2
+ <a href="https://copilotkit.ai" target="_blank">
3
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo">
4
+ </a>
5
+
6
+ <br/>
7
+
8
+ <strong>
9
+ CopilotKit is the open-source framework for integrating powerful AI Copilots into any application. Easily implement custom AI Chatbots, AI Agents, AI Textareas, and more.
10
+ </strong>
11
+ </div>
12
+
13
+ <br/>
14
+
15
+ <div align="center">
16
+ <a href="https://www.npmjs.com/package/@copilotkit/react-core" target="_blank">
17
+ <img src="https://img.shields.io/npm/v/%40copilotkit%2Freact-core?logo=npm&logoColor=%23FFFFFF&label=Version&color=%236963ff" alt="NPM">
18
+ </a>
19
+ <img src="https://img.shields.io/github/license/copilotkit/copilotkit?color=%236963ff&label=License" alt="MIT">
20
+ <a href="https://discord.gg/6dffbvGU3D" target="_blank">
21
+ <img src="https://img.shields.io/discord/1122926057641742418?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff" alt="Discord">
22
+ </a>
23
+ </div>
24
+ <br/>
25
+
26
+ <div align="center">
27
+ <a href="https://discord.gg/6dffbvGU3D?ref=github_readme" target="_blank">
28
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_discord.png" alt="CopilotKit Discord" height="40px">
29
+ </a>
30
+ <a href="https://docs.copilotkit.ai?ref=github_readme" target="_blank">
31
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_docs.png" alt="CopilotKit GitHub" height="40px">
32
+ </a>
33
+ <a href="https://cloud.copilotkit.ai?ref=github_readme" target="_blank">
34
+ <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/btn_cloud.png" alt="CopilotKit GitHub" height="40px">
35
+ </a>
36
+ </div>
37
+
38
+ <br />
39
+
40
+ <div align="center">
41
+ <img src="https://github.com/CopilotKit/CopilotKit/raw/main/assets/animated-banner.gif" alt="CopilotKit Screenshot" style="border-radius: 15px;" />
42
+ </div>
43
+
44
+ # Documentation
45
+
46
+ To get started with CopilotKit, please check out the [documentation](https://docs.copilotkit.ai).
@@ -0,0 +1,306 @@
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
+ type Agent {
38
+ description: String!
39
+ id: String!
40
+ name: String!
41
+ }
42
+
43
+ input AgentSessionInput {
44
+ agentName: String!
45
+ nodeName: String
46
+ threadId: String
47
+ }
48
+
49
+ input AgentStateInput {
50
+ agentName: String!
51
+ state: String!
52
+ }
53
+
54
+ input AgentStateMessageInput {
55
+ active: Boolean!
56
+ agentName: String!
57
+ nodeName: String!
58
+ role: MessageRole!
59
+ runId: String!
60
+ running: Boolean!
61
+ state: String!
62
+ threadId: String!
63
+ }
64
+
65
+ type AgentStateMessageOutput implements BaseMessageOutput {
66
+ active: Boolean!
67
+ agentName: String!
68
+ createdAt: DateTimeISO!
69
+ id: String!
70
+ nodeName: String!
71
+ role: MessageRole!
72
+ runId: String!
73
+ running: Boolean!
74
+ state: String!
75
+ status: MessageStatus!
76
+ threadId: String!
77
+ }
78
+
79
+ type AgentsResponse {
80
+ agents: [Agent!]!
81
+ }
82
+
83
+ interface BaseMessageOutput {
84
+ createdAt: DateTimeISO!
85
+ id: String!
86
+ status: MessageStatus!
87
+ }
88
+
89
+ interface BaseResponseStatus {
90
+ code: ResponseStatusCode!
91
+ }
92
+
93
+ input CloudInput {
94
+ guardrails: GuardrailsInput
95
+ }
96
+
97
+ """The type of Copilot request"""
98
+ enum CopilotRequestType {
99
+ Chat
100
+ Suggestion
101
+ Task
102
+ TextareaCompletion
103
+ TextareaPopover
104
+ }
105
+
106
+ type CopilotResponse {
107
+ extensions: ExtensionsResponse
108
+ messages: [BaseMessageOutput!]!
109
+ runId: String
110
+ status: ResponseStatus!
111
+ threadId: String!
112
+ }
113
+
114
+ """
115
+ 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.
116
+ """
117
+ scalar DateTimeISO
118
+
119
+ input ExtensionsInput {
120
+ openaiAssistantAPI: OpenAIApiAssistantAPIInput
121
+ }
122
+
123
+ type ExtensionsResponse {
124
+ openaiAssistantAPI: OpenAIApiAssistantAPIResponse
125
+ }
126
+
127
+ type FailedMessageStatus {
128
+ code: MessageStatusCode!
129
+ reason: String!
130
+ }
131
+
132
+ type FailedResponseStatus implements BaseResponseStatus {
133
+ code: ResponseStatusCode!
134
+ details: JSON
135
+ reason: FailedResponseStatusReason!
136
+ }
137
+
138
+ enum FailedResponseStatusReason {
139
+ GUARDRAILS_VALIDATION_FAILED
140
+ MESSAGE_STREAM_INTERRUPTED
141
+ UNKNOWN_ERROR
142
+ }
143
+
144
+ input ForwardedParametersInput {
145
+ maxTokens: Float
146
+ model: String
147
+ stop: [String!]
148
+ temperature: Float
149
+ toolChoice: String
150
+ toolChoiceFunctionName: String
151
+ }
152
+
153
+ input FrontendInput {
154
+ actions: [ActionInput!]!
155
+ toDeprecate_fullContext: String
156
+ url: String
157
+ }
158
+
159
+ input GenerateCopilotResponseInput {
160
+ agentSession: AgentSessionInput
161
+ agentState: AgentStateInput
162
+ agentStates: [AgentStateInput!]
163
+ cloud: CloudInput
164
+ extensions: ExtensionsInput
165
+ forwardedParameters: ForwardedParametersInput
166
+ frontend: FrontendInput!
167
+ messages: [MessageInput!]!
168
+ metadata: GenerateCopilotResponseMetadataInput!
169
+ runId: String
170
+ threadId: String
171
+ }
172
+
173
+ input GenerateCopilotResponseMetadataInput {
174
+ requestType: CopilotRequestType
175
+ }
176
+
177
+ input GuardrailsInput {
178
+ inputValidationRules: GuardrailsRuleInput!
179
+ }
180
+
181
+ input GuardrailsRuleInput {
182
+ allowList: [String!] = []
183
+ denyList: [String!] = []
184
+ }
185
+
186
+ """
187
+ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
188
+ """
189
+ scalar JSON @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
190
+
191
+ """
192
+ The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).
193
+ """
194
+ scalar JSONObject @specifiedBy(url: "http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf")
195
+
196
+ input LoadAgentStateInput {
197
+ agentName: String!
198
+ threadId: String!
199
+ }
200
+
201
+ type LoadAgentStateResponse {
202
+ messages: String!
203
+ state: String!
204
+ threadExists: Boolean!
205
+ threadId: String!
206
+ }
207
+
208
+ input MessageInput {
209
+ actionExecutionMessage: ActionExecutionMessageInput
210
+ agentStateMessage: AgentStateMessageInput
211
+ createdAt: DateTimeISO!
212
+ id: String!
213
+ resultMessage: ResultMessageInput
214
+ textMessage: TextMessageInput
215
+ }
216
+
217
+ """The role of the message"""
218
+ enum MessageRole {
219
+ assistant
220
+ system
221
+ tool
222
+ user
223
+ }
224
+
225
+ union MessageStatus = FailedMessageStatus | PendingMessageStatus | SuccessMessageStatus
226
+
227
+ enum MessageStatusCode {
228
+ Failed
229
+ Pending
230
+ Success
231
+ }
232
+
233
+ type Mutation {
234
+ generateCopilotResponse(data: GenerateCopilotResponseInput!, properties: JSONObject): CopilotResponse!
235
+ }
236
+
237
+ input OpenAIApiAssistantAPIInput {
238
+ runId: String
239
+ threadId: String
240
+ }
241
+
242
+ type OpenAIApiAssistantAPIResponse {
243
+ runId: String
244
+ threadId: String
245
+ }
246
+
247
+ type PendingMessageStatus {
248
+ code: MessageStatusCode!
249
+ }
250
+
251
+ type PendingResponseStatus implements BaseResponseStatus {
252
+ code: ResponseStatusCode!
253
+ }
254
+
255
+ type Query {
256
+ availableAgents: AgentsResponse!
257
+ hello: String!
258
+ loadAgentState(data: LoadAgentStateInput!): LoadAgentStateResponse!
259
+ }
260
+
261
+ union ResponseStatus = FailedResponseStatus | PendingResponseStatus | SuccessResponseStatus
262
+
263
+ enum ResponseStatusCode {
264
+ Failed
265
+ Pending
266
+ Success
267
+ }
268
+
269
+ input ResultMessageInput {
270
+ actionExecutionId: String!
271
+ actionName: String!
272
+ parentMessageId: String
273
+ result: String!
274
+ }
275
+
276
+ type ResultMessageOutput implements BaseMessageOutput {
277
+ actionExecutionId: String!
278
+ actionName: String!
279
+ createdAt: DateTimeISO!
280
+ id: String!
281
+ result: String!
282
+ status: MessageStatus!
283
+ }
284
+
285
+ type SuccessMessageStatus {
286
+ code: MessageStatusCode!
287
+ }
288
+
289
+ type SuccessResponseStatus implements BaseResponseStatus {
290
+ code: ResponseStatusCode!
291
+ }
292
+
293
+ input TextMessageInput {
294
+ content: String!
295
+ parentMessageId: String
296
+ role: MessageRole!
297
+ }
298
+
299
+ type TextMessageOutput implements BaseMessageOutput {
300
+ content: [String!]!
301
+ createdAt: DateTimeISO!
302
+ id: String!
303
+ parentMessageId: String
304
+ role: MessageRole!
305
+ status: MessageStatus!
306
+ }
@@ -0,0 +1,12 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,80 @@
1
+ import {
2
+ getCommonConfig,
3
+ getRuntimeInstanceTelemetryInfo,
4
+ telemetry_client_default
5
+ } from "./chunk-FYONHPZL.mjs";
6
+ import {
7
+ __name
8
+ } from "./chunk-44O2JGUY.mjs";
9
+
10
+ // src/lib/integrations/nextjs/app-router.ts
11
+ import { createYoga } from "graphql-yoga";
12
+ function copilotRuntimeNextJSAppRouterEndpoint(options) {
13
+ var _a;
14
+ const commonConfig = getCommonConfig(options);
15
+ telemetry_client_default.setGlobalProperties({
16
+ runtime: {
17
+ framework: "nextjs-app-router"
18
+ }
19
+ });
20
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
21
+ telemetry_client_default.setGlobalProperties({
22
+ _copilotkit: options.properties._copilotkit
23
+ });
24
+ }
25
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
26
+ const logger = commonConfig.logging;
27
+ logger.debug("Creating NextJS App Router endpoint");
28
+ const yoga = createYoga({
29
+ ...commonConfig,
30
+ graphqlEndpoint: options.endpoint,
31
+ fetchAPI: {
32
+ Response: globalThis.Response
33
+ }
34
+ });
35
+ return {
36
+ handleRequest: yoga,
37
+ GET: yoga,
38
+ POST: yoga,
39
+ OPTIONS: yoga
40
+ };
41
+ }
42
+ __name(copilotRuntimeNextJSAppRouterEndpoint, "copilotRuntimeNextJSAppRouterEndpoint");
43
+
44
+ // src/lib/integrations/nextjs/pages-router.ts
45
+ import { createYoga as createYoga2 } from "graphql-yoga";
46
+ var config = {
47
+ api: {
48
+ bodyParser: false
49
+ }
50
+ };
51
+ function copilotRuntimeNextJSPagesRouterEndpoint(options) {
52
+ var _a;
53
+ const commonConfig = getCommonConfig(options);
54
+ telemetry_client_default.setGlobalProperties({
55
+ runtime: {
56
+ framework: "nextjs-pages-router"
57
+ }
58
+ });
59
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
60
+ telemetry_client_default.setGlobalProperties({
61
+ _copilotkit: options.properties._copilotkit
62
+ });
63
+ }
64
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
65
+ const logger = commonConfig.logging;
66
+ logger.debug("Creating NextJS Pages Router endpoint");
67
+ const yoga = createYoga2({
68
+ ...commonConfig,
69
+ graphqlEndpoint: options.endpoint
70
+ });
71
+ return yoga;
72
+ }
73
+ __name(copilotRuntimeNextJSPagesRouterEndpoint, "copilotRuntimeNextJSPagesRouterEndpoint");
74
+
75
+ export {
76
+ copilotRuntimeNextJSAppRouterEndpoint,
77
+ config,
78
+ copilotRuntimeNextJSPagesRouterEndpoint
79
+ };
80
+ //# sourceMappingURL=chunk-4BWLNVK4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/integrations/nextjs/app-router.ts","../src/lib/integrations/nextjs/pages-router.ts"],"sourcesContent":["import { createYoga } from \"graphql-yoga\";\nimport { CreateCopilotRuntimeServerOptions, getCommonConfig } from \"../shared\";\nimport telemetry, { getRuntimeInstanceTelemetryInfo } from \"../../telemetry-client\";\n\nexport function copilotRuntimeNextJSAppRouterEndpoint(options: CreateCopilotRuntimeServerOptions) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-app-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options.runtime),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS App Router endpoint\");\n\n const yoga = createYoga({\n ...commonConfig,\n graphqlEndpoint: options.endpoint,\n fetchAPI: { Response: globalThis.Response },\n });\n\n return {\n handleRequest: yoga,\n GET: yoga as any,\n POST: yoga as any,\n OPTIONS: yoga as any,\n };\n}\n","import { YogaServerInstance, createYoga } from \"graphql-yoga\";\nimport { CreateCopilotRuntimeServerOptions, GraphQLContext, getCommonConfig } from \"../shared\";\nimport telemetry, { getRuntimeInstanceTelemetryInfo } from \"../../telemetry-client\";\n\nexport const config = {\n api: {\n bodyParser: false,\n },\n};\n\nexport type CopilotRuntimeServerInstance<T> = YogaServerInstance<T, Partial<GraphQLContext>>;\n\n// This import is needed to fix the type error\n// Fix is currently in TypeScript 5.5 beta, waiting for stable version\n// https://github.com/microsoft/TypeScript/issues/42873#issuecomment-2066874644\nexport type {} from \"@whatwg-node/server\";\n\nexport function copilotRuntimeNextJSPagesRouterEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n): CopilotRuntimeServerInstance<GraphQLContext> {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-pages-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options.runtime),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS Pages Router endpoint\");\n\n const yoga = createYoga({\n ...commonConfig,\n graphqlEndpoint: options.endpoint,\n });\n\n return yoga;\n}\n"],"mappings":";;;;;;;;;;AAAA,SAASA,kBAAkB;AAIpB,SAASC,sCAAsCC,SAA0C;AAJhG;AAKE,QAAMC,eAAeC,gBAAgBF,OAAAA;AAErCG,2BAAUC,oBAAoB;IAC5BC,SAAS;MACPC,WAAW;IACb;EACF,CAAA;AAEA,OAAIN,aAAQO,eAARP,mBAAoBQ,aAAa;AACnCL,6BAAUC,oBAAoB;MAC5BI,aAAaR,QAAQO,WAAWC;IAClC,CAAA;EACF;AAEAL,2BAAUM,QACR,gCACAC,gCAAgCV,QAAQK,OAAO,CAAA;AAGjD,QAAMM,SAASV,aAAaW;AAC5BD,SAAOE,MAAM,qCAAA;AAEb,QAAMC,OAAOC,WAAW;IACtB,GAAGd;IACHe,iBAAiBhB,QAAQiB;IACzBC,UAAU;MAAEC,UAAUC,WAAWD;IAAS;EAC5C,CAAA;AAEA,SAAO;IACLE,eAAeP;IACfQ,KAAKR;IACLS,MAAMT;IACNU,SAASV;EACX;AACF;AAnCgBf;;;ACJhB,SAA6B0B,cAAAA,mBAAkB;AAIxC,IAAMC,SAAS;EACpBC,KAAK;IACHC,YAAY;EACd;AACF;AASO,SAASC,wCACdC,SAA0C;AAlB5C;AAoBE,QAAMC,eAAeC,gBAAgBF,OAAAA;AAErCG,2BAAUC,oBAAoB;IAC5BC,SAAS;MACPC,WAAW;IACb;EACF,CAAA;AAEA,OAAIN,aAAQO,eAARP,mBAAoBQ,aAAa;AACnCL,6BAAUC,oBAAoB;MAC5BI,aAAaR,QAAQO,WAAWC;IAClC,CAAA;EACF;AAEAL,2BAAUM,QACR,gCACAC,gCAAgCV,QAAQK,OAAO,CAAA;AAGjD,QAAMM,SAASV,aAAaW;AAC5BD,SAAOE,MAAM,uCAAA;AAEb,QAAMC,OAAOC,YAAW;IACtB,GAAGd;IACHe,iBAAiBhB,QAAQiB;EAC3B,CAAA;AAEA,SAAOH;AACT;AA/BgBf;","names":["createYoga","copilotRuntimeNextJSAppRouterEndpoint","options","commonConfig","getCommonConfig","telemetry","setGlobalProperties","runtime","framework","properties","_copilotkit","capture","getRuntimeInstanceTelemetryInfo","logger","logging","debug","yoga","createYoga","graphqlEndpoint","endpoint","fetchAPI","Response","globalThis","handleRequest","GET","POST","OPTIONS","createYoga","config","api","bodyParser","copilotRuntimeNextJSPagesRouterEndpoint","options","commonConfig","getCommonConfig","telemetry","setGlobalProperties","runtime","framework","properties","_copilotkit","capture","getRuntimeInstanceTelemetryInfo","logger","logging","debug","yoga","createYoga","graphqlEndpoint","endpoint"]}