@copilotkit/runtime 1.10.6 → 1.50.0-beta.0

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 (133) hide show
  1. package/dist/index.d.ts +1655 -27
  2. package/dist/index.js +2172 -5049
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +5441 -99
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/v2/index.d.ts +1 -0
  7. package/dist/v2/index.js +15 -0
  8. package/dist/v2/index.js.map +1 -0
  9. package/dist/v2/index.mjs +4 -0
  10. package/dist/v2/index.mjs.map +1 -0
  11. package/package.json +33 -21
  12. package/src/graphql/message-conversion/agui-to-gql.test.ts +1263 -0
  13. package/src/graphql/message-conversion/agui-to-gql.ts +333 -0
  14. package/src/graphql/message-conversion/gql-to-agui.test.ts +1578 -0
  15. package/src/graphql/message-conversion/gql-to-agui.ts +278 -0
  16. package/src/graphql/message-conversion/index.ts +2 -0
  17. package/src/graphql/message-conversion/roundtrip-conversion.test.ts +526 -0
  18. package/src/graphql/resolvers/copilot.resolver.ts +3 -48
  19. package/src/graphql/resolvers/state.resolver.ts +3 -2
  20. package/src/graphql/types/converted/index.ts +32 -6
  21. package/src/graphql/types/enums.ts +2 -2
  22. package/src/graphql/types/message-status.type.ts +3 -1
  23. package/src/lib/index.ts +1 -1
  24. package/src/lib/integrations/nextjs/app-router.ts +10 -11
  25. package/src/lib/integrations/nextjs/pages-router.ts +4 -11
  26. package/src/lib/integrations/node-http/index.ts +64 -5
  27. package/src/lib/integrations/shared.ts +1 -1
  28. package/src/lib/observability.ts +87 -0
  29. package/src/lib/runtime/{langgraph/langgraph-agent.ts → agent-integrations/langgraph.agent.ts} +5 -0
  30. package/src/lib/runtime/copilot-runtime.ts +346 -1333
  31. package/src/lib/runtime/types.ts +49 -0
  32. package/src/lib/runtime/utils.ts +87 -0
  33. package/src/lib/telemetry-client.ts +6 -5
  34. package/src/service-adapters/anthropic/anthropic-adapter.ts +5 -1
  35. package/src/service-adapters/bedrock/bedrock-adapter.ts +6 -1
  36. package/src/service-adapters/empty/empty-adapter.ts +3 -0
  37. package/src/service-adapters/events.ts +0 -254
  38. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +5 -1
  39. package/src/service-adapters/google/google-genai-adapter.ts +7 -1
  40. package/src/service-adapters/groq/groq-adapter.ts +5 -1
  41. package/src/service-adapters/langchain/langchain-adapter.ts +3 -0
  42. package/src/service-adapters/openai/openai-adapter.ts +5 -1
  43. package/src/service-adapters/openai/openai-assistant-adapter.ts +4 -0
  44. package/src/service-adapters/service-adapter.ts +3 -0
  45. package/src/service-adapters/unify/unify-adapter.ts +6 -1
  46. package/src/v2/index.ts +2 -0
  47. package/tsup.config.ts +2 -1
  48. package/dist/chunk-27JKTS6P.mjs +0 -1704
  49. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  50. package/dist/chunk-2OZAGFV3.mjs +0 -43
  51. package/dist/chunk-2OZAGFV3.mjs.map +0 -1
  52. package/dist/chunk-AMUJQ6IR.mjs +0 -50
  53. package/dist/chunk-AMUJQ6IR.mjs.map +0 -1
  54. package/dist/chunk-CEOMFPJU.mjs +0 -6020
  55. package/dist/chunk-CEOMFPJU.mjs.map +0 -1
  56. package/dist/chunk-DTPRUTNV.mjs +0 -25
  57. package/dist/chunk-DTPRUTNV.mjs.map +0 -1
  58. package/dist/chunk-FHD4JECV.mjs +0 -33
  59. package/dist/chunk-FHD4JECV.mjs.map +0 -1
  60. package/dist/chunk-I27F2UPA.mjs +0 -175
  61. package/dist/chunk-I27F2UPA.mjs.map +0 -1
  62. package/dist/chunk-LPEPX6NH.mjs +0 -25
  63. package/dist/chunk-LPEPX6NH.mjs.map +0 -1
  64. package/dist/chunk-PTYRVXXP.mjs +0 -80
  65. package/dist/chunk-PTYRVXXP.mjs.map +0 -1
  66. package/dist/chunk-SHBDMA63.mjs +0 -141
  67. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  68. package/dist/chunk-XWBDEXDA.mjs +0 -153
  69. package/dist/chunk-XWBDEXDA.mjs.map +0 -1
  70. package/dist/graphql/types/base/index.d.ts +0 -6
  71. package/dist/graphql/types/base/index.js +0 -63
  72. package/dist/graphql/types/base/index.js.map +0 -1
  73. package/dist/graphql/types/base/index.mjs +0 -8
  74. package/dist/graphql/types/base/index.mjs.map +0 -1
  75. package/dist/graphql/types/converted/index.d.ts +0 -2
  76. package/dist/graphql/types/converted/index.js +0 -200
  77. package/dist/graphql/types/converted/index.js.map +0 -1
  78. package/dist/graphql/types/converted/index.mjs +0 -19
  79. package/dist/graphql/types/converted/index.mjs.map +0 -1
  80. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  81. package/dist/index-96b330da.d.ts +0 -119
  82. package/dist/langserve-0c6100e3.d.ts +0 -257
  83. package/dist/lib/cloud/index.d.ts +0 -6
  84. package/dist/lib/cloud/index.js +0 -18
  85. package/dist/lib/cloud/index.js.map +0 -1
  86. package/dist/lib/cloud/index.mjs +0 -1
  87. package/dist/lib/cloud/index.mjs.map +0 -1
  88. package/dist/lib/index.d.ts +0 -212
  89. package/dist/lib/index.js +0 -7843
  90. package/dist/lib/index.js.map +0 -1
  91. package/dist/lib/index.mjs +0 -76
  92. package/dist/lib/index.mjs.map +0 -1
  93. package/dist/lib/integrations/index.d.ts +0 -34
  94. package/dist/lib/integrations/index.js +0 -3052
  95. package/dist/lib/integrations/index.js.map +0 -1
  96. package/dist/lib/integrations/index.mjs +0 -37
  97. package/dist/lib/integrations/index.mjs.map +0 -1
  98. package/dist/lib/integrations/nest/index.d.ts +0 -15
  99. package/dist/lib/integrations/nest/index.js +0 -2959
  100. package/dist/lib/integrations/nest/index.js.map +0 -1
  101. package/dist/lib/integrations/nest/index.mjs +0 -14
  102. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  103. package/dist/lib/integrations/node-express/index.d.ts +0 -15
  104. package/dist/lib/integrations/node-express/index.js +0 -2959
  105. package/dist/lib/integrations/node-express/index.js.map +0 -1
  106. package/dist/lib/integrations/node-express/index.mjs +0 -14
  107. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  108. package/dist/lib/integrations/node-http/index.d.ts +0 -15
  109. package/dist/lib/integrations/node-http/index.js +0 -2945
  110. package/dist/lib/integrations/node-http/index.js.map +0 -1
  111. package/dist/lib/integrations/node-http/index.mjs +0 -13
  112. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  113. package/dist/service-adapters/index.d.ts +0 -162
  114. package/dist/service-adapters/index.js +0 -1787
  115. package/dist/service-adapters/index.js.map +0 -1
  116. package/dist/service-adapters/index.mjs +0 -34
  117. package/dist/service-adapters/index.mjs.map +0 -1
  118. package/dist/service-adapters/shared/index.d.ts +0 -9
  119. package/dist/service-adapters/shared/index.js +0 -72
  120. package/dist/service-adapters/shared/index.js.map +0 -1
  121. package/dist/service-adapters/shared/index.mjs +0 -8
  122. package/dist/service-adapters/shared/index.mjs.map +0 -1
  123. package/dist/shared-0a7346ce.d.ts +0 -466
  124. package/dist/utils/index.d.ts +0 -65
  125. package/dist/utils/index.js +0 -175
  126. package/dist/utils/index.js.map +0 -1
  127. package/dist/utils/index.mjs +0 -12
  128. package/dist/utils/index.mjs.map +0 -1
  129. package/src/lib/runtime/__tests__/remote-action-constructors.test.ts +0 -246
  130. package/src/lib/runtime/agui-action.ts +0 -180
  131. package/src/lib/runtime/remote-action-constructors.ts +0 -331
  132. package/src/lib/runtime/remote-actions.ts +0 -217
  133. package/src/lib/runtime/remote-lg-action.ts +0 -1006
@@ -1,162 +0,0 @@
1
- import { b as CopilotServiceAdapter, C as CopilotRuntimeChatCompletionRequest, a as CopilotRuntimeChatCompletionResponse } from '../langserve-0c6100e3.js';
2
- export { c as RemoteChain, R as RemoteChainParameters } from '../langserve-0c6100e3.js';
3
- export { convertServiceAdapterError } from './shared/index.js';
4
- import { L as LangChainAdapter } from '../groq-adapter-c8aec5c5.js';
5
- export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from '../groq-adapter-c8aec5c5.js';
6
- import Anthropic from '@anthropic-ai/sdk';
7
- import '../index-96b330da.js';
8
- import '../graphql/types/base/index.js';
9
- import 'rxjs';
10
- import '@copilotkit/shared';
11
- import 'openai';
12
- import '@langchain/core/messages';
13
- import '@langchain/core/tools';
14
- import '@langchain/core/utils/stream';
15
- import 'groq-sdk';
16
-
17
- /**
18
- * Copilot Runtime adapter for Anthropic.
19
- *
20
- * ## Example
21
- *
22
- * ```ts
23
- * import { CopilotRuntime, AnthropicAdapter } from "@copilotkit/runtime";
24
- * import Anthropic from "@anthropic-ai/sdk";
25
- *
26
- * const copilotKit = new CopilotRuntime();
27
- *
28
- * const anthropic = new Anthropic({
29
- * apiKey: "<your-api-key>",
30
- * });
31
- *
32
- * return new AnthropicAdapter({
33
- * anthropic,
34
- * promptCaching: {
35
- * enabled: true,
36
- * debug: true
37
- * }
38
- * });
39
- * ```
40
- */
41
-
42
- interface AnthropicPromptCachingConfig {
43
- /**
44
- * Whether to enable prompt caching.
45
- */
46
- enabled: boolean;
47
- /**
48
- * Whether to enable debug logging for cache operations.
49
- */
50
- debug?: boolean;
51
- }
52
- interface AnthropicAdapterParams {
53
- /**
54
- * An optional Anthropic instance to use. If not provided, a new instance will be
55
- * created.
56
- */
57
- anthropic?: Anthropic;
58
- /**
59
- * The model to use.
60
- */
61
- model?: string;
62
- /**
63
- * Configuration for prompt caching.
64
- * See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
65
- */
66
- promptCaching?: AnthropicPromptCachingConfig;
67
- }
68
- declare class AnthropicAdapter implements CopilotServiceAdapter {
69
- private model;
70
- private promptCaching;
71
- private _anthropic;
72
- get anthropic(): Anthropic;
73
- constructor(params?: AnthropicAdapterParams);
74
- /**
75
- * Adds cache control to system prompt
76
- */
77
- private addSystemPromptCaching;
78
- /**
79
- * Adds cache control to the final message
80
- */
81
- private addIncrementalMessageCaching;
82
- private shouldGenerateFallbackResponse;
83
- process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
84
- }
85
-
86
- interface OllamaAdapterOptions {
87
- model?: string;
88
- }
89
- declare class ExperimentalOllamaAdapter implements CopilotServiceAdapter {
90
- private model;
91
- constructor(options?: OllamaAdapterOptions);
92
- process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
93
- }
94
-
95
- /**
96
- * Copilot Runtime adapter for AWS Bedrock.
97
- *
98
- * ## Example
99
- *
100
- * ```ts
101
- * import { CopilotRuntime, BedrockAdapter } from "@copilotkit/runtime";
102
- *
103
- * const copilotKit = new CopilotRuntime();
104
- *
105
- * return new BedrockAdapter({
106
- * model: "amazon.nova-lite-v1:0",
107
- * region: "us-east-1",
108
- * credentials: {
109
- * accessKeyId: process.env.AWS_ACCESS_KEY_ID,
110
- * secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
111
- * }
112
- * });
113
- * ```
114
- */
115
-
116
- interface BedrockAdapterParams {
117
- /**
118
- * AWS Bedrock model ID to use.
119
- * @default "amazon.nova-lite-v1:0"
120
- */
121
- model?: string;
122
- /**
123
- * AWS region where Bedrock is available.
124
- * @default "us-east-1"
125
- */
126
- region?: string;
127
- /**
128
- * AWS credentials for Bedrock access.
129
- */
130
- credentials?: {
131
- accessKeyId?: string;
132
- secretAccessKey?: string;
133
- };
134
- }
135
- declare class BedrockAdapter extends LangChainAdapter {
136
- constructor(options?: BedrockAdapterParams);
137
- }
138
-
139
- /**
140
- * CopilotKit Empty Adapter
141
- *
142
- * This adapter is meant to preserve adherence to runtime requirements, while doing nothing
143
- * Ideal if you don't want to connect an LLM the to the runtime, and only use your LangGraph agent.
144
- * Be aware that Copilot Suggestions will not work if you use this adapter
145
- *
146
- * ## Example
147
- *
148
- * ```ts
149
- * import { CopilotRuntime, EmptyAdapter } from "@copilotkit/runtime";
150
- *
151
- * const copilotKit = new CopilotRuntime();
152
- *
153
- * return new EmptyAdapter();
154
- * ```
155
- */
156
-
157
- declare class EmptyAdapter implements CopilotServiceAdapter {
158
- process(request: CopilotRuntimeChatCompletionRequest): Promise<CopilotRuntimeChatCompletionResponse>;
159
- }
160
- declare const ExperimentalEmptyAdapter: typeof EmptyAdapter;
161
-
162
- export { AnthropicAdapter, AnthropicAdapterParams, AnthropicPromptCachingConfig, BedrockAdapter, BedrockAdapterParams, CopilotRuntimeChatCompletionRequest, CopilotRuntimeChatCompletionResponse, CopilotServiceAdapter, EmptyAdapter, ExperimentalEmptyAdapter, ExperimentalOllamaAdapter, LangChainAdapter };