@copilotkit/angular 0.2.0 → 0.3.1-canary.rc-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.
@@ -0,0 +1,343 @@
1
+ import { z } from 'zod/v4';
2
+ import * as _angular_core from '@angular/core';
3
+ import { InjectionToken, EnvironmentProviders } from '@angular/core';
4
+ import { AbstractAgent } from '@ag-ui/client';
5
+ import { ActivityRenderer, RenderActivityMessageConfig } from '@copilotkit/angular';
6
+
7
+ /**
8
+ * Content schema for `activityType: "mcp-apps"` activity messages: a snapshot
9
+ * of an MCP Apps tool call, carrying the middleware server hash, optional
10
+ * stable server id, the ui:// resource to render, and its tool exchange.
11
+ *
12
+ * Kept local and declared with the `zod/v4` API so the Angular browser bundle
13
+ * validates protocol data without taking a direct MCP client SDK dependency.
14
+ */
15
+ declare const mcpAppsSnapshotContentSchema: z.ZodObject<{
16
+ serverHash: z.ZodString;
17
+ serverId: z.ZodOptional<z.ZodString>;
18
+ resourceUri: z.ZodString;
19
+ result: z.ZodObject<{
20
+ content: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
21
+ type: z.ZodLiteral<"text">;
22
+ text: z.ZodString;
23
+ annotations: z.ZodOptional<z.ZodObject<{
24
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
25
+ user: "user";
26
+ assistant: "assistant";
27
+ }>>>;
28
+ priority: z.ZodOptional<z.ZodNumber>;
29
+ lastModified: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$loose>>;
31
+ }, z.core.$loose>, z.ZodObject<{
32
+ type: z.ZodLiteral<"image">;
33
+ data: z.ZodString;
34
+ mimeType: z.ZodString;
35
+ annotations: z.ZodOptional<z.ZodObject<{
36
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
37
+ user: "user";
38
+ assistant: "assistant";
39
+ }>>>;
40
+ priority: z.ZodOptional<z.ZodNumber>;
41
+ lastModified: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$loose>>;
43
+ }, z.core.$loose>, z.ZodObject<{
44
+ type: z.ZodLiteral<"audio">;
45
+ data: z.ZodString;
46
+ mimeType: z.ZodString;
47
+ annotations: z.ZodOptional<z.ZodObject<{
48
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
49
+ user: "user";
50
+ assistant: "assistant";
51
+ }>>>;
52
+ priority: z.ZodOptional<z.ZodNumber>;
53
+ lastModified: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$loose>>;
55
+ }, z.core.$loose>, z.ZodObject<{
56
+ type: z.ZodLiteral<"resource">;
57
+ resource: z.ZodUnion<readonly [z.ZodObject<{
58
+ uri: z.ZodString;
59
+ mimeType: z.ZodOptional<z.ZodString>;
60
+ text: z.ZodString;
61
+ }, z.core.$loose>, z.ZodObject<{
62
+ uri: z.ZodString;
63
+ mimeType: z.ZodOptional<z.ZodString>;
64
+ blob: z.ZodString;
65
+ }, z.core.$loose>]>;
66
+ annotations: z.ZodOptional<z.ZodObject<{
67
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
68
+ user: "user";
69
+ assistant: "assistant";
70
+ }>>>;
71
+ priority: z.ZodOptional<z.ZodNumber>;
72
+ lastModified: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$loose>>;
74
+ }, z.core.$loose>, z.ZodObject<{
75
+ type: z.ZodLiteral<"resource_link">;
76
+ uri: z.ZodString;
77
+ name: z.ZodString;
78
+ description: z.ZodOptional<z.ZodString>;
79
+ mimeType: z.ZodOptional<z.ZodString>;
80
+ annotations: z.ZodOptional<z.ZodObject<{
81
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
82
+ user: "user";
83
+ assistant: "assistant";
84
+ }>>>;
85
+ priority: z.ZodOptional<z.ZodNumber>;
86
+ lastModified: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$loose>>;
88
+ }, z.core.$loose>]>>>;
89
+ structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ isError: z.ZodOptional<z.ZodBoolean>;
91
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
92
+ }, z.core.$loose>;
93
+ toolInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
94
+ }, z.core.$loose>;
95
+ /** Parsed content of an `mcp-apps` activity message. */
96
+ type MCPAppsSnapshotContent = z.infer<typeof mcpAppsSnapshotContentSchema>;
97
+
98
+ /**
99
+ * Renders one MCP App snapshot through the same agent-mediated protocol used
100
+ * by the other CopilotKit frontends. Each instance owns its queued work and
101
+ * sandbox listener, while requests remain serialized per agent thread.
102
+ */
103
+ declare class CopilotMCPAppsWidget {
104
+ private readonly config;
105
+ private readonly copilotKit;
106
+ private readonly platformId;
107
+ private readonly ownerId;
108
+ private readonly queue;
109
+ private renderVersion;
110
+ readonly data: _angular_core.InputSignal<{
111
+ [x: string]: unknown;
112
+ serverHash: string;
113
+ resourceUri: string;
114
+ result: {
115
+ [x: string]: unknown;
116
+ content: ({
117
+ [x: string]: unknown;
118
+ type: "text";
119
+ text: string;
120
+ annotations?: {
121
+ [x: string]: unknown;
122
+ audience?: ("user" | "assistant")[];
123
+ priority?: number;
124
+ lastModified?: string;
125
+ };
126
+ } | {
127
+ [x: string]: unknown;
128
+ type: "image";
129
+ data: string;
130
+ mimeType: string;
131
+ annotations?: {
132
+ [x: string]: unknown;
133
+ audience?: ("user" | "assistant")[];
134
+ priority?: number;
135
+ lastModified?: string;
136
+ };
137
+ } | {
138
+ [x: string]: unknown;
139
+ type: "audio";
140
+ data: string;
141
+ mimeType: string;
142
+ annotations?: {
143
+ [x: string]: unknown;
144
+ audience?: ("user" | "assistant")[];
145
+ priority?: number;
146
+ lastModified?: string;
147
+ };
148
+ } | {
149
+ [x: string]: unknown;
150
+ type: "resource";
151
+ resource?: {
152
+ [x: string]: unknown;
153
+ uri: string;
154
+ text: string;
155
+ mimeType?: string;
156
+ } | {
157
+ [x: string]: unknown;
158
+ uri: string;
159
+ blob: string;
160
+ mimeType?: string;
161
+ };
162
+ annotations?: {
163
+ [x: string]: unknown;
164
+ audience?: ("user" | "assistant")[];
165
+ priority?: number;
166
+ lastModified?: string;
167
+ };
168
+ } | {
169
+ [x: string]: unknown;
170
+ type: "resource_link";
171
+ uri: string;
172
+ name: string;
173
+ description?: string;
174
+ mimeType?: string;
175
+ annotations?: {
176
+ [x: string]: unknown;
177
+ audience?: ("user" | "assistant")[];
178
+ priority?: number;
179
+ lastModified?: string;
180
+ };
181
+ })[];
182
+ structuredContent?: Record<string, unknown>;
183
+ isError?: boolean;
184
+ _meta?: Record<string, unknown>;
185
+ };
186
+ serverId?: string;
187
+ toolInput?: Record<string, unknown>;
188
+ }>;
189
+ readonly agent: _angular_core.InputSignal<AbstractAgent>;
190
+ private readonly renderSession;
191
+ private readonly appFrame;
192
+ protected readonly loading: _angular_core.WritableSignal<boolean>;
193
+ protected readonly error: _angular_core.WritableSignal<string>;
194
+ constructor();
195
+ private renderApp;
196
+ private connectSandbox;
197
+ private handleMessage;
198
+ private handleUIMessage;
199
+ private handleOpenLink;
200
+ private handleToolCall;
201
+ private sendResponse;
202
+ private sendError;
203
+ private sendNotification;
204
+ private fail;
205
+ private resetFrame;
206
+ private throwIfStale;
207
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CopilotMCPAppsWidget, never>;
208
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CopilotMCPAppsWidget, "copilot-mcp-apps-widget", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "agent": { "alias": "agent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
209
+ }
210
+
211
+ /**
212
+ * Activity renderer for `mcp-apps` snapshots. Renders the referenced MCP App
213
+ * inline via {@link CopilotMCPAppsWidget}. Resource and tool requests are
214
+ * proxied through the activity's selected AG-UI agent.
215
+ */
216
+ declare class CopilotMCPAppsActivityRenderer implements ActivityRenderer<MCPAppsSnapshotContent> {
217
+ readonly activityType: _angular_core.InputSignal<string>;
218
+ readonly content: _angular_core.InputSignal<{
219
+ [x: string]: unknown;
220
+ serverHash: string;
221
+ resourceUri: string;
222
+ result: {
223
+ [x: string]: unknown;
224
+ content: ({
225
+ [x: string]: unknown;
226
+ type: "text";
227
+ text: string;
228
+ annotations?: {
229
+ [x: string]: unknown;
230
+ audience?: ("user" | "assistant")[];
231
+ priority?: number;
232
+ lastModified?: string;
233
+ };
234
+ } | {
235
+ [x: string]: unknown;
236
+ type: "image";
237
+ data: string;
238
+ mimeType: string;
239
+ annotations?: {
240
+ [x: string]: unknown;
241
+ audience?: ("user" | "assistant")[];
242
+ priority?: number;
243
+ lastModified?: string;
244
+ };
245
+ } | {
246
+ [x: string]: unknown;
247
+ type: "audio";
248
+ data: string;
249
+ mimeType: string;
250
+ annotations?: {
251
+ [x: string]: unknown;
252
+ audience?: ("user" | "assistant")[];
253
+ priority?: number;
254
+ lastModified?: string;
255
+ };
256
+ } | {
257
+ [x: string]: unknown;
258
+ type: "resource";
259
+ resource?: {
260
+ [x: string]: unknown;
261
+ uri: string;
262
+ text: string;
263
+ mimeType?: string;
264
+ } | {
265
+ [x: string]: unknown;
266
+ uri: string;
267
+ blob: string;
268
+ mimeType?: string;
269
+ };
270
+ annotations?: {
271
+ [x: string]: unknown;
272
+ audience?: ("user" | "assistant")[];
273
+ priority?: number;
274
+ lastModified?: string;
275
+ };
276
+ } | {
277
+ [x: string]: unknown;
278
+ type: "resource_link";
279
+ uri: string;
280
+ name: string;
281
+ description?: string;
282
+ mimeType?: string;
283
+ annotations?: {
284
+ [x: string]: unknown;
285
+ audience?: ("user" | "assistant")[];
286
+ priority?: number;
287
+ lastModified?: string;
288
+ };
289
+ })[];
290
+ structuredContent?: Record<string, unknown>;
291
+ isError?: boolean;
292
+ _meta?: Record<string, unknown>;
293
+ };
294
+ serverId?: string;
295
+ toolInput?: Record<string, unknown>;
296
+ }>;
297
+ readonly message: _angular_core.InputSignal<{
298
+ role: "activity";
299
+ content: Record<string, any>;
300
+ id: string;
301
+ activityType: string;
302
+ }>;
303
+ readonly agent: _angular_core.InputSignal<AbstractAgent>;
304
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CopilotMCPAppsActivityRenderer, never>;
305
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CopilotMCPAppsActivityRenderer, "copilot-mcp-apps-activity-renderer", never, { "activityType": { "alias": "activityType"; "required": true; "isSignal": true; }; "content": { "alias": "content"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": true; "isSignal": true; }; "agent": { "alias": "agent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
306
+ }
307
+ /**
308
+ * Ready-to-register render config for `mcp-apps` activity messages. Pass it
309
+ * to `provideCopilotKit({ renderActivityMessages: [...] })`.
310
+ */
311
+ declare const mcpAppsActivityRendererConfig: RenderActivityMessageConfig<MCPAppsSnapshotContent>;
312
+
313
+ interface MCPAppsHostInfo {
314
+ name: string;
315
+ version: string;
316
+ }
317
+ interface MCPAppsConfig {
318
+ /** Maximum time to wait for a busy agent before a queued request fails. */
319
+ idleTimeoutMs?: number;
320
+ /** Maximum time to wait for the sandbox proxy initialization handshake. */
321
+ initializationTimeoutMs?: number;
322
+ /** Host identity announced during the MCP Apps initialization handshake. */
323
+ hostInfo?: MCPAppsHostInfo;
324
+ /** Additional protocol capabilities announced to embedded MCP Apps. */
325
+ hostCapabilities?: Record<string, unknown>;
326
+ /** Additional non-secret UI context announced to embedded MCP Apps. */
327
+ hostContext?: Record<string, unknown>;
328
+ }
329
+ declare const DEFAULT_MCP_APPS_CONFIG: Readonly<Required<MCPAppsConfig>>;
330
+ /** Holds renderer behavior configuration registered via `provideMCPApps`. */
331
+ declare const MCP_APPS_CONFIG: InjectionToken<Required<MCPAppsConfig>>;
332
+
333
+ /**
334
+ * Configures and registers the built-in MCP Apps renderer.
335
+ *
336
+ * MCP resource and tool requests always travel through the selected AG-UI
337
+ * agent. Server URLs deliberately are not accepted by this browser provider.
338
+ * Application renderers retain precedence over this built-in registration.
339
+ */
340
+ declare function provideMCPApps(config?: MCPAppsConfig): EnvironmentProviders;
341
+
342
+ export { CopilotMCPAppsActivityRenderer, CopilotMCPAppsWidget, DEFAULT_MCP_APPS_CONFIG, MCP_APPS_CONFIG, mcpAppsActivityRendererConfig, mcpAppsSnapshotContentSchema, provideMCPApps };
343
+ export type { MCPAppsConfig, MCPAppsHostInfo, MCPAppsSnapshotContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/angular",
3
- "version": "0.2.0",
3
+ "version": "0.3.1-canary.rc-1",
4
4
  "description": "Angular library for CopilotKit",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -9,21 +9,55 @@
9
9
  "directory": "packages/angular"
10
10
  },
11
11
  "type": "module",
12
+ "sideEffects": false,
12
13
  "main": "dist/fesm2022/copilotkit-angular.mjs",
13
14
  "module": "dist/fesm2022/copilotkit-angular.mjs",
14
- "types": "dist/types/copilotkit-angular.d.ts",
15
+ "types": "dist/index.d.ts",
15
16
  "exports": {
16
17
  ".": {
17
18
  "import": {
18
- "types": "./dist/types/copilotkit-angular.d.ts",
19
+ "types": "./dist/index.d.ts",
19
20
  "default": "./dist/fesm2022/copilotkit-angular.mjs"
20
21
  }
21
22
  },
23
+ "./mcp-apps": {
24
+ "import": {
25
+ "types": "./dist/mcp-apps/index.d.ts",
26
+ "default": "./dist/fesm2022/copilotkit-angular-mcp-apps.mjs"
27
+ }
28
+ },
22
29
  "./styles.css": "./dist/styles.css"
23
30
  },
24
31
  "publishConfig": {
25
32
  "access": "public"
26
33
  },
34
+ "copilotkit": {
35
+ "angularSupport": {
36
+ "compilerMajor": 20,
37
+ "rxjs": "^7.8.0",
38
+ "testedRxjs": "7.8.1",
39
+ "supportedMajors": [
40
+ {
41
+ "angular": "20.3.26",
42
+ "cdk": "20.2.14",
43
+ "major": 20,
44
+ "typescript": "5.9.3"
45
+ },
46
+ {
47
+ "angular": "21.2.18",
48
+ "cdk": "21.2.14",
49
+ "major": 21,
50
+ "typescript": "5.9.3"
51
+ },
52
+ {
53
+ "angular": "22.0.7",
54
+ "cdk": "22.0.5",
55
+ "major": 22,
56
+ "typescript": "6.0.3"
57
+ }
58
+ ]
59
+ }
60
+ },
27
61
  "dependencies": {
28
62
  "@ag-ui/client": "0.0.57",
29
63
  "@ag-ui/core": "0.0.57",
@@ -31,28 +65,28 @@
31
65
  "clsx": "^2.1.1",
32
66
  "highlight.js": "^11.11.1",
33
67
  "katex": "^0.16.22",
34
- "lucide-angular": "^0.540.0",
35
68
  "marked": "^16.2.0",
36
69
  "rxjs": "^7.8.1",
37
70
  "tailwind-merge": "^2.6.0",
38
71
  "tslib": "^2.6.0",
72
+ "zod": "^3.25.75",
39
73
  "zod-to-json-schema": "^3.24.5",
40
- "@copilotkit/a2ui-renderer": "1.63.1",
41
- "@copilotkit/core": "1.63.1",
42
- "@copilotkit/shared": "1.63.1",
43
- "@copilotkit/web-components": "1.63.1"
74
+ "@copilotkit/core": "1.63.3-canary.rc-1",
75
+ "@copilotkit/shared": "1.63.3-canary.rc-1",
76
+ "@copilotkit/a2ui-renderer": "1.63.3-canary.rc-1",
77
+ "@copilotkit/web-components": "1.63.3-canary.rc-1"
44
78
  },
45
79
  "devDependencies": {
46
- "@analogjs/vite-plugin-angular": "^1.20.2",
47
- "@analogjs/vitest-angular": "^1.20.2",
48
- "@angular/cdk": "^21.2.13",
49
- "@angular/common": "^21.2.15",
50
- "@angular/compiler": "^21.2.15",
51
- "@angular/compiler-cli": "^21.2.15",
52
- "@angular/core": "^21.2.15",
53
- "@angular/platform-browser": "^21.2.15",
54
- "@angular/platform-browser-dynamic": "^21.2.15",
55
- "@lucide/build-icons": "^1.1.0",
80
+ "@analogjs/vite-plugin-angular": "1.20.2",
81
+ "@analogjs/vitest-angular": "1.20.2",
82
+ "@angular-devkit/architect": "0.2003.26",
83
+ "@angular/cdk": "20.2.14",
84
+ "@angular/common": "20.3.26",
85
+ "@angular/compiler": "20.3.26",
86
+ "@angular/compiler-cli": "20.3.26",
87
+ "@angular/core": "20.3.26",
88
+ "@angular/platform-browser": "20.3.26",
89
+ "@angular/platform-browser-dynamic": "20.3.26",
56
90
  "@tailwindcss/cli": "^4.1.11",
57
91
  "@tailwindcss/postcss": "^4.1.11",
58
92
  "@tailwindcss/typography": "^0.5.16",
@@ -60,9 +94,11 @@
60
94
  "@types/node": "^22.5.1",
61
95
  "@vitest/ui": "^3.2.4",
62
96
  "autoprefixer": "^10.4.16",
97
+ "axe-core": "4.11.1",
98
+ "chokidar": "4.0.3",
63
99
  "concurrently": "^9.1.0",
64
100
  "jsdom": "^24.0.0",
65
- "ng-packagr": "^21.2.3",
101
+ "ng-packagr": "20.3.2",
66
102
  "postcss": "^8.4.31",
67
103
  "reflect-metadata": "^0.2.2",
68
104
  "rimraf": "^6.0.1",
@@ -73,17 +109,16 @@
73
109
  "typescript": "5.9.3",
74
110
  "vite": "^7.1.4",
75
111
  "vitest": "^3.2.4",
76
- "zod": "^3.22.4",
77
112
  "@copilotkit/typescript-config": "1.55.0-next.8"
78
113
  },
79
114
  "peerDependencies": {
80
- "@angular/cdk": "^19.0.0 || ^20.0.0 || ^21.0.0",
81
- "@angular/common": "^19.0.0 || ^20.0.0 || ^21.0.0",
82
- "@angular/core": "^19.0.0 || ^20.0.0 || ^21.0.0",
115
+ "@angular/cdk": "^20.0.0 || ^21.0.0 || ^22.0.0",
116
+ "@angular/common": "^20.0.0 || ^21.0.0 || ^22.0.0",
117
+ "@angular/core": "^20.0.0 || ^21.0.0 || ^22.0.0",
83
118
  "rxjs": "^7.8.0"
84
119
  },
85
120
  "scripts": {
86
- "build": "ng-packagr -p ng-package.json && npm run build:css",
121
+ "build": "ng-packagr -p ng-package.json && node scripts/normalize-package-exports.mjs && npm run build:css",
87
122
  "build:css": "tailwindcss -i ./src/styles/globals.css -o ./src/styles/generated.css && node scripts/scope-preflight.mjs ./src/styles/generated.css && node -e \"const fs=require('fs');fs.mkdirSync('./dist',{recursive:true});fs.cpSync('./src/styles/generated.css','./dist/styles.css')\"",
88
123
  "dev": "concurrently \"ng-packagr -p ng-package.json --watch\" \"npm run dev:css\"",
89
124
  "dev:css": "tailwindcss -i ./src/styles/globals.css -o ./src/styles/generated.css --watch",
@@ -0,0 +1,17 @@
1
+ import { readFile, writeFile } from "node:fs/promises";
2
+
3
+ const manifestUrl = new URL("../dist/package.json", import.meta.url);
4
+ const manifest = JSON.parse(await readFile(manifestUrl, "utf8"));
5
+
6
+ for (const entry of Object.values(manifest.exports ?? {})) {
7
+ if (
8
+ entry &&
9
+ typeof entry === "object" &&
10
+ "types" in entry &&
11
+ "default" in entry
12
+ ) {
13
+ delete entry.import;
14
+ }
15
+ }
16
+
17
+ await writeFile(manifestUrl, `${JSON.stringify(manifest, null, 2)}\n`);
package/tsconfig.json CHANGED
@@ -18,6 +18,7 @@
18
18
  "importHelpers": true,
19
19
  "types": ["node"],
20
20
  "paths": {
21
+ "@copilotkit/angular": ["./src/public-api.ts"],
21
22
  "@copilotkit/a2ui-renderer/web-components": [
22
23
  "../a2ui-renderer/src/web-components/index.ts"
23
24
  ],
package/vitest.config.mts CHANGED
@@ -10,6 +10,9 @@ const r = (...p: string[]) => resolve(__dirname, ...p);
10
10
  export default defineConfig(({ mode }) => ({
11
11
  plugins: [angular()],
12
12
  resolve: {
13
+ alias: {
14
+ "@copilotkit/angular": r("src/public-api.ts"),
15
+ },
13
16
  dedupe: [
14
17
  "@angular/core",
15
18
  "@angular/common",