@copilotkit/angular 0.6.0 → 2.0.0-rc.53
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/.attw.json +1 -2
- package/README.md +31 -133
- package/dist/README.md +31 -133
- package/dist/fesm2022/copilotkit-angular-generative-ui-chart.mjs +28 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui-chart.mjs.map +1 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui-icons.mjs +30 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui-icons.mjs.map +1 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui-map.mjs +28 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui-map.mjs.map +1 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui.mjs +11975 -0
- package/dist/fesm2022/copilotkit-angular-generative-ui.mjs.map +1 -0
- package/dist/fesm2022/copilotkit-angular-mcp-apps.mjs +43 -142
- package/dist/fesm2022/copilotkit-angular-mcp-apps.mjs.map +1 -1
- package/dist/fesm2022/copilotkit-angular.mjs +7422 -7467
- package/dist/fesm2022/copilotkit-angular.mjs.map +1 -1
- package/dist/types/copilotkit-angular-generative-ui-chart.d.ts +16 -0
- package/dist/types/copilotkit-angular-generative-ui-chart.d.ts.map +1 -0
- package/dist/types/copilotkit-angular-generative-ui-icons.d.ts +18 -0
- package/dist/types/copilotkit-angular-generative-ui-icons.d.ts.map +1 -0
- package/dist/types/copilotkit-angular-generative-ui-map.d.ts +16 -0
- package/dist/types/copilotkit-angular-generative-ui-map.d.ts.map +1 -0
- package/dist/types/copilotkit-angular-generative-ui.d.ts +8011 -0
- package/dist/types/copilotkit-angular-generative-ui.d.ts.map +1 -0
- package/dist/types/copilotkit-angular-mcp-apps.d.ts +234 -5560
- package/dist/types/copilotkit-angular-mcp-apps.d.ts.map +1 -1
- package/dist/types/copilotkit-angular.d.ts +1195 -820
- package/dist/types/copilotkit-angular.d.ts.map +1 -1
- package/package.json +54 -39
- package/scripts/generate-stylesheet.mjs +63 -0
- package/tsconfig.json +11 -1
- package/vitest.config.mts +6 -0
- package/dist/fesm2022/copilotkit-angular-a2ui.mjs +0 -1492
- package/dist/fesm2022/copilotkit-angular-a2ui.mjs.map +0 -1
- package/dist/styles.css +0 -2679
- package/dist/types/copilotkit-angular-a2ui.d.ts +0 -178
- package/dist/types/copilotkit-angular-a2ui.d.ts.map +0 -1
- package/scripts/scope-preflight.mjs +0 -100
package/.attw.json
CHANGED
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
First-party Angular bindings for CopilotKit core and AG-UI agents. The package
|
|
4
4
|
ships standalone chat, popup, and sidebar components as well as signal-based
|
|
5
5
|
headless APIs, tool and activity renderers, threads, memories, interrupts,
|
|
6
|
-
attachments,
|
|
6
|
+
attachments, generative UI, Open Generative UI, and opt-in MCP Apps support.
|
|
7
7
|
|
|
8
8
|
Want to contribute? Read the [Angular contribution guide](https://github.com/CopilotKit/CopilotKit/blob/main/packages/angular/CONTRIBUTING.md).
|
|
9
9
|
|
|
@@ -121,7 +121,6 @@ export interface CopilotKitConfig {
|
|
|
121
121
|
frontendTools?: FrontendToolConfig[];
|
|
122
122
|
humanInTheLoop?: HumanInTheLoopConfig[];
|
|
123
123
|
defaultToolRendering?: boolean;
|
|
124
|
-
a2ui?: A2UIConfig;
|
|
125
124
|
openGenerativeUI?: OpenGenerativeUIConfig;
|
|
126
125
|
}
|
|
127
126
|
```
|
|
@@ -142,9 +141,6 @@ export interface CopilotKitConfig {
|
|
|
142
141
|
- `defaultToolRendering`: Opt in to the text-only renderer for unknown tools.
|
|
143
142
|
It is disabled by default so missing renderers remain visible integration
|
|
144
143
|
errors rather than silently changing the experience.
|
|
145
|
-
- `a2ui`: Theme, catalog, schema, loading UI, and recovery policy for A2UI.
|
|
146
|
-
Surfaces render with the catalog from `@copilotkit/angular/a2ui` (see
|
|
147
|
-
below); without one, A2UI stays off.
|
|
148
144
|
- `openGenerativeUI`: Sandboxed UI functions and optional design guidance.
|
|
149
145
|
|
|
150
146
|
### Injection helpers
|
|
@@ -328,8 +324,12 @@ provideCopilotKit({
|
|
|
328
324
|
## Prebuilt UI
|
|
329
325
|
|
|
330
326
|
All UI exports are standalone Angular components. Import the component classes
|
|
331
|
-
directly
|
|
332
|
-
|
|
327
|
+
directly. They add their own styles, so you don't import a stylesheet. To load
|
|
328
|
+
the CSS as a cached file instead, add `@copilotkit/core/styles.css` to the
|
|
329
|
+
`styles` in `angular.json` and set `injectStyles: false` in `provideCopilotKit`.
|
|
330
|
+
For a CSP nonce, provide Angular's `CSP_NONCE`. If you build a layout from the
|
|
331
|
+
chat parts without `<copilot-chat>`, `<copilot-chat-view>`, `<copilot-popup>`
|
|
332
|
+
or `<copilot-sidebar>`, render `<copilot-kit-styles />` once.
|
|
333
333
|
|
|
334
334
|
### Full-page chat
|
|
335
335
|
|
|
@@ -412,11 +412,9 @@ Register application activity renderers with `registerRenderActivityMessage`
|
|
|
412
412
|
or the `renderActivityMessages` provider option. Application registrations
|
|
413
413
|
take precedence over optional built-ins.
|
|
414
414
|
|
|
415
|
-
-
|
|
416
|
-
`
|
|
417
|
-
|
|
418
|
-
React provider contract. Configure recovery exposure independently of
|
|
419
|
-
server-provided lifecycle content.
|
|
415
|
+
- Generative UI is a secondary entry point. Add `provideGenerativeUI` from
|
|
416
|
+
`@copilotkit/angular/generative-ui` to the application providers (see
|
|
417
|
+
below).
|
|
420
418
|
- Open Generative UI is enabled with `openGenerativeUI: { ... }`. Generated UI
|
|
421
419
|
runs in an isolated WebSandbox; expose only narrowly scoped
|
|
422
420
|
`sandboxFunctions` and never place credentials in browser configuration.
|
|
@@ -427,134 +425,34 @@ take precedence over optional built-ins.
|
|
|
427
425
|
server URL. The renderer uses the same inline `srcdoc` sandbox, sandbox
|
|
428
426
|
permissions, and resource-domain CSP as the React SDK.
|
|
429
427
|
|
|
430
|
-
###
|
|
428
|
+
### Generative UI
|
|
431
429
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
implements the A2UI basic components (Text, Row, Column, Card, Button,
|
|
436
|
-
TextField, and the rest):
|
|
437
|
-
|
|
438
|
-
```ts
|
|
439
|
-
import { basicCatalog } from "@copilotkit/angular/a2ui";
|
|
440
|
-
|
|
441
|
-
provideCopilotKit({
|
|
442
|
-
runtimeUrl: "/api/copilotkit",
|
|
443
|
-
a2ui: { catalog: basicCatalog },
|
|
444
|
-
});
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
For your own components, build a catalog with `createAngularCatalog`. It
|
|
448
|
-
contains exactly the components you register unless you pass
|
|
449
|
-
`includeBasicCatalog: true`, which adds the basic components; a definition
|
|
450
|
-
with the same name replaces the basic one. A component receives the resolved
|
|
451
|
-
props through a single `props` input, or through inputs named after the
|
|
452
|
-
schema keys. Props the agent has not sent yet arrive as `undefined`, so put
|
|
453
|
-
defaults in the template (`label() ?? "…"`) rather than in `input("…")`.
|
|
454
|
-
Containers render children with `<copilot-a2ui-child>`.
|
|
430
|
+
With generative UI, the agent renders Angular components in the chat. To
|
|
431
|
+
render the standard components, add `provideGenerativeUI` next to
|
|
432
|
+
`provideCopilotKit`:
|
|
455
433
|
|
|
456
434
|
```ts
|
|
435
|
+
import { provideCopilotKit } from "@copilotkit/angular";
|
|
457
436
|
import {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
DynamicStringSchema,
|
|
462
|
-
createAngularCatalog,
|
|
463
|
-
type A2UICatalogDefinitions,
|
|
464
|
-
type A2UIProps,
|
|
465
|
-
} from "@copilotkit/angular/a2ui";
|
|
466
|
-
|
|
467
|
-
const definitions = {
|
|
468
|
-
Column: { props: z.object({ children: ChildListSchema }) },
|
|
469
|
-
Card: {
|
|
470
|
-
props: z.object({
|
|
471
|
-
title: DynamicStringSchema,
|
|
472
|
-
child: z.string().optional(),
|
|
473
|
-
}),
|
|
474
|
-
},
|
|
475
|
-
PrimaryButton: {
|
|
476
|
-
props: z.object({ label: z.string(), action: ActionSchema.optional() }),
|
|
477
|
-
},
|
|
478
|
-
} satisfies A2UICatalogDefinitions;
|
|
479
|
-
|
|
480
|
-
@Component({
|
|
481
|
-
selector: "app-a2ui-card",
|
|
482
|
-
imports: [CopilotA2UIChild],
|
|
483
|
-
template: `
|
|
484
|
-
<article>
|
|
485
|
-
<h3>{{ props().title }}</h3>
|
|
486
|
-
<copilot-a2ui-child [child]="props().child" />
|
|
487
|
-
</article>
|
|
488
|
-
`,
|
|
489
|
-
})
|
|
490
|
-
export class CardComponent {
|
|
491
|
-
readonly props = input.required<A2UIProps<typeof definitions, "Card">>();
|
|
492
|
-
}
|
|
437
|
+
provideGenerativeUI,
|
|
438
|
+
standardUI,
|
|
439
|
+
} from "@copilotkit/angular/generative-ui";
|
|
493
440
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
{ catalogId: "copilotkit://dashboard-catalog", includeBasicCatalog: true },
|
|
502
|
-
);
|
|
503
|
-
|
|
504
|
-
provideCopilotKit({ runtimeUrl: "/api/copilotkit", a2ui: { catalog } });
|
|
441
|
+
bootstrapApplication(App, {
|
|
442
|
+
providers: [
|
|
443
|
+
provideCopilotKit({ runtimeUrl: "/api/copilotkit" }),
|
|
444
|
+
provideGenerativeUI({ ui: standardUI }),
|
|
445
|
+
],
|
|
446
|
+
});
|
|
505
447
|
```
|
|
506
448
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
`injectA2UIComponentContext()` to dispatch custom actions or write data-model
|
|
510
|
-
paths directly. `<copilot-a2ui-surface>` renders operations outside the chat
|
|
511
|
-
with the same catalog. `Icon` renders Material Symbols ligatures, so load that
|
|
512
|
-
font if the agent uses icons.
|
|
513
|
-
|
|
514
|
-
A catalog entry can also be a Custom Element, such as an existing design
|
|
515
|
-
system's web component: pass `{ tagName, element }` instead of an Angular
|
|
516
|
-
component. CopilotKit registers the element, renders it in place of the node,
|
|
517
|
-
and assigns the node's A2UI `ComponentContext` to its `context` property on
|
|
518
|
-
every update; the element reads its props and dispatches actions from there.
|
|
519
|
-
|
|
520
|
-
```ts
|
|
521
|
-
createAngularCatalog(
|
|
522
|
-
{ Badge: { props: z.object({ label: z.string() }) } },
|
|
523
|
-
{ Badge: { tagName: "acme-badge", element: AcmeBadge } },
|
|
524
|
-
);
|
|
525
|
-
```
|
|
449
|
+
To render your own components, give `provideGenerativeUI` a UI from
|
|
450
|
+
`createGenerativeUI`.
|
|
526
451
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
| Variable | Default | Used for |
|
|
532
|
-
| ----------------------------------------------------------------------- | ------------------------------------ | -------------------------------------------- |
|
|
533
|
-
| `--a2ui-color-primary` | `#007bff` | primary buttons, active tabs, selected chips |
|
|
534
|
-
| `--a2ui-color-on-primary` | `#fff` | text on the primary color |
|
|
535
|
-
| `--a2ui-color-surface` | `#fff` | cards, buttons, chips, dialogs |
|
|
536
|
-
| `--a2ui-color-border` | `#ccc` | borders and dividers |
|
|
537
|
-
| `--a2ui-color-muted` | `#666` | captions and secondary text |
|
|
538
|
-
| `--a2ui-color-error` | `red` | validation errors |
|
|
539
|
-
| `--a2ui-color-input`, `--a2ui-color-on-input` | system field colors | text inputs |
|
|
540
|
-
| `--a2ui-color-placeholder`, `--a2ui-color-placeholder-highlight` | `#f3f4f6`, `#e5e7eb` | loading and pending placeholders |
|
|
541
|
-
| `--a2ui-spacing-m` | `8px` | component margins and gaps |
|
|
542
|
-
| `--a2ui-row-gap`, `--a2ui-column-gap`, `--a2ui-list-gap` | `--a2ui-spacing-m` | space between children |
|
|
543
|
-
| `--a2ui-border-radius` | `8px` | cards, inputs, dialogs |
|
|
544
|
-
| `--a2ui-font-size-s`, `--a2ui-font-size-xs` | `14px`, `12px` | labels, captions |
|
|
545
|
-
| `--a2ui-card-padding`, `--a2ui-card-shadow` | `16px`, subtle shadow | Card |
|
|
546
|
-
| `--a2ui-button-padding`, `--a2ui-button-border-radius` | `8px 16px`, `4px` | Button, tabs |
|
|
547
|
-
| `--a2ui-input-padding` | `8px` | TextField, DateTimeInput |
|
|
548
|
-
| `--a2ui-chip-border-radius` | `16px` | ChoicePicker chips |
|
|
549
|
-
| `--a2ui-icon-size` | `24px` | Icon |
|
|
550
|
-
| `--a2ui-modal-backdrop`, `--a2ui-modal-padding`, `--a2ui-modal-z-index` | `rgba(0, 0, 0, 0.5)`, `24px`, `1000` | Modal |
|
|
551
|
-
|
|
552
|
-
`--a2ui-primary-color`, which the React and Vue renderers use, still works as
|
|
553
|
-
a fallback for `--a2ui-color-primary`.
|
|
554
|
-
|
|
555
|
-
As in the A2UI renderers, Row, Column and List space their children with a gap
|
|
556
|
-
rather than margins on each component, and a component's `weight` becomes its
|
|
557
|
-
`flex` grow factor inside a Row or Column.
|
|
452
|
+
React and Vue use `standardUI` automatically when the runtime turns generative
|
|
453
|
+
UI on. Angular does not, because the main entry point cannot load the
|
|
454
|
+
generative UI entry point. When the runtime turns generative UI on and no
|
|
455
|
+
`provideGenerativeUI` is set, CopilotKit logs a warning in development mode.
|
|
558
456
|
|
|
559
457
|
## Lifecycle and cleanup
|
|
560
458
|
|
|
@@ -591,7 +489,7 @@ platform where the package owns it. For SSR and hydration:
|
|
|
591
489
|
- do not access returned agents or run tools during server rendering;
|
|
592
490
|
- make runtime URLs absolute when the server and browser use different
|
|
593
491
|
origins, or proxy a same-origin `/api/copilotkit` endpoint;
|
|
594
|
-
- enable
|
|
492
|
+
- enable generative UI, Open Generative UI, audio recording, and MCP Apps in the browser;
|
|
595
493
|
their interactive sandboxes, custom elements, media APIs, and iframes become
|
|
596
494
|
active after hydration;
|
|
597
495
|
- avoid branching the component tree on `window` before hydration. Use Angular
|
package/dist/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
First-party Angular bindings for CopilotKit core and AG-UI agents. The package
|
|
4
4
|
ships standalone chat, popup, and sidebar components as well as signal-based
|
|
5
5
|
headless APIs, tool and activity renderers, threads, memories, interrupts,
|
|
6
|
-
attachments,
|
|
6
|
+
attachments, generative UI, Open Generative UI, and opt-in MCP Apps support.
|
|
7
7
|
|
|
8
8
|
Want to contribute? Read the [Angular contribution guide](https://github.com/CopilotKit/CopilotKit/blob/main/packages/angular/CONTRIBUTING.md).
|
|
9
9
|
|
|
@@ -121,7 +121,6 @@ export interface CopilotKitConfig {
|
|
|
121
121
|
frontendTools?: FrontendToolConfig[];
|
|
122
122
|
humanInTheLoop?: HumanInTheLoopConfig[];
|
|
123
123
|
defaultToolRendering?: boolean;
|
|
124
|
-
a2ui?: A2UIConfig;
|
|
125
124
|
openGenerativeUI?: OpenGenerativeUIConfig;
|
|
126
125
|
}
|
|
127
126
|
```
|
|
@@ -142,9 +141,6 @@ export interface CopilotKitConfig {
|
|
|
142
141
|
- `defaultToolRendering`: Opt in to the text-only renderer for unknown tools.
|
|
143
142
|
It is disabled by default so missing renderers remain visible integration
|
|
144
143
|
errors rather than silently changing the experience.
|
|
145
|
-
- `a2ui`: Theme, catalog, schema, loading UI, and recovery policy for A2UI.
|
|
146
|
-
Surfaces render with the catalog from `@copilotkit/angular/a2ui` (see
|
|
147
|
-
below); without one, A2UI stays off.
|
|
148
144
|
- `openGenerativeUI`: Sandboxed UI functions and optional design guidance.
|
|
149
145
|
|
|
150
146
|
### Injection helpers
|
|
@@ -328,8 +324,12 @@ provideCopilotKit({
|
|
|
328
324
|
## Prebuilt UI
|
|
329
325
|
|
|
330
326
|
All UI exports are standalone Angular components. Import the component classes
|
|
331
|
-
directly
|
|
332
|
-
|
|
327
|
+
directly. They add their own styles, so you don't import a stylesheet. To load
|
|
328
|
+
the CSS as a cached file instead, add `@copilotkit/core/styles.css` to the
|
|
329
|
+
`styles` in `angular.json` and set `injectStyles: false` in `provideCopilotKit`.
|
|
330
|
+
For a CSP nonce, provide Angular's `CSP_NONCE`. If you build a layout from the
|
|
331
|
+
chat parts without `<copilot-chat>`, `<copilot-chat-view>`, `<copilot-popup>`
|
|
332
|
+
or `<copilot-sidebar>`, render `<copilot-kit-styles />` once.
|
|
333
333
|
|
|
334
334
|
### Full-page chat
|
|
335
335
|
|
|
@@ -412,11 +412,9 @@ Register application activity renderers with `registerRenderActivityMessage`
|
|
|
412
412
|
or the `renderActivityMessages` provider option. Application registrations
|
|
413
413
|
take precedence over optional built-ins.
|
|
414
414
|
|
|
415
|
-
-
|
|
416
|
-
`
|
|
417
|
-
|
|
418
|
-
React provider contract. Configure recovery exposure independently of
|
|
419
|
-
server-provided lifecycle content.
|
|
415
|
+
- Generative UI is a secondary entry point. Add `provideGenerativeUI` from
|
|
416
|
+
`@copilotkit/angular/generative-ui` to the application providers (see
|
|
417
|
+
below).
|
|
420
418
|
- Open Generative UI is enabled with `openGenerativeUI: { ... }`. Generated UI
|
|
421
419
|
runs in an isolated WebSandbox; expose only narrowly scoped
|
|
422
420
|
`sandboxFunctions` and never place credentials in browser configuration.
|
|
@@ -427,134 +425,34 @@ take precedence over optional built-ins.
|
|
|
427
425
|
server URL. The renderer uses the same inline `srcdoc` sandbox, sandbox
|
|
428
426
|
permissions, and resource-domain CSP as the React SDK.
|
|
429
427
|
|
|
430
|
-
###
|
|
428
|
+
### Generative UI
|
|
431
429
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
implements the A2UI basic components (Text, Row, Column, Card, Button,
|
|
436
|
-
TextField, and the rest):
|
|
437
|
-
|
|
438
|
-
```ts
|
|
439
|
-
import { basicCatalog } from "@copilotkit/angular/a2ui";
|
|
440
|
-
|
|
441
|
-
provideCopilotKit({
|
|
442
|
-
runtimeUrl: "/api/copilotkit",
|
|
443
|
-
a2ui: { catalog: basicCatalog },
|
|
444
|
-
});
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
For your own components, build a catalog with `createAngularCatalog`. It
|
|
448
|
-
contains exactly the components you register unless you pass
|
|
449
|
-
`includeBasicCatalog: true`, which adds the basic components; a definition
|
|
450
|
-
with the same name replaces the basic one. A component receives the resolved
|
|
451
|
-
props through a single `props` input, or through inputs named after the
|
|
452
|
-
schema keys. Props the agent has not sent yet arrive as `undefined`, so put
|
|
453
|
-
defaults in the template (`label() ?? "…"`) rather than in `input("…")`.
|
|
454
|
-
Containers render children with `<copilot-a2ui-child>`.
|
|
430
|
+
With generative UI, the agent renders Angular components in the chat. To
|
|
431
|
+
render the standard components, add `provideGenerativeUI` next to
|
|
432
|
+
`provideCopilotKit`:
|
|
455
433
|
|
|
456
434
|
```ts
|
|
435
|
+
import { provideCopilotKit } from "@copilotkit/angular";
|
|
457
436
|
import {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
DynamicStringSchema,
|
|
462
|
-
createAngularCatalog,
|
|
463
|
-
type A2UICatalogDefinitions,
|
|
464
|
-
type A2UIProps,
|
|
465
|
-
} from "@copilotkit/angular/a2ui";
|
|
466
|
-
|
|
467
|
-
const definitions = {
|
|
468
|
-
Column: { props: z.object({ children: ChildListSchema }) },
|
|
469
|
-
Card: {
|
|
470
|
-
props: z.object({
|
|
471
|
-
title: DynamicStringSchema,
|
|
472
|
-
child: z.string().optional(),
|
|
473
|
-
}),
|
|
474
|
-
},
|
|
475
|
-
PrimaryButton: {
|
|
476
|
-
props: z.object({ label: z.string(), action: ActionSchema.optional() }),
|
|
477
|
-
},
|
|
478
|
-
} satisfies A2UICatalogDefinitions;
|
|
479
|
-
|
|
480
|
-
@Component({
|
|
481
|
-
selector: "app-a2ui-card",
|
|
482
|
-
imports: [CopilotA2UIChild],
|
|
483
|
-
template: `
|
|
484
|
-
<article>
|
|
485
|
-
<h3>{{ props().title }}</h3>
|
|
486
|
-
<copilot-a2ui-child [child]="props().child" />
|
|
487
|
-
</article>
|
|
488
|
-
`,
|
|
489
|
-
})
|
|
490
|
-
export class CardComponent {
|
|
491
|
-
readonly props = input.required<A2UIProps<typeof definitions, "Card">>();
|
|
492
|
-
}
|
|
437
|
+
provideGenerativeUI,
|
|
438
|
+
standardUI,
|
|
439
|
+
} from "@copilotkit/angular/generative-ui";
|
|
493
440
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
{ catalogId: "copilotkit://dashboard-catalog", includeBasicCatalog: true },
|
|
502
|
-
);
|
|
503
|
-
|
|
504
|
-
provideCopilotKit({ runtimeUrl: "/api/copilotkit", a2ui: { catalog } });
|
|
441
|
+
bootstrapApplication(App, {
|
|
442
|
+
providers: [
|
|
443
|
+
provideCopilotKit({ runtimeUrl: "/api/copilotkit" }),
|
|
444
|
+
provideGenerativeUI({ ui: standardUI }),
|
|
445
|
+
],
|
|
446
|
+
});
|
|
505
447
|
```
|
|
506
448
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
`injectA2UIComponentContext()` to dispatch custom actions or write data-model
|
|
510
|
-
paths directly. `<copilot-a2ui-surface>` renders operations outside the chat
|
|
511
|
-
with the same catalog. `Icon` renders Material Symbols ligatures, so load that
|
|
512
|
-
font if the agent uses icons.
|
|
513
|
-
|
|
514
|
-
A catalog entry can also be a Custom Element, such as an existing design
|
|
515
|
-
system's web component: pass `{ tagName, element }` instead of an Angular
|
|
516
|
-
component. CopilotKit registers the element, renders it in place of the node,
|
|
517
|
-
and assigns the node's A2UI `ComponentContext` to its `context` property on
|
|
518
|
-
every update; the element reads its props and dispatches actions from there.
|
|
519
|
-
|
|
520
|
-
```ts
|
|
521
|
-
createAngularCatalog(
|
|
522
|
-
{ Badge: { props: z.object({ label: z.string() }) } },
|
|
523
|
-
{ Badge: { tagName: "acme-badge", element: AcmeBadge } },
|
|
524
|
-
);
|
|
525
|
-
```
|
|
449
|
+
To render your own components, give `provideGenerativeUI` a UI from
|
|
450
|
+
`createGenerativeUI`.
|
|
526
451
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
| Variable | Default | Used for |
|
|
532
|
-
| ----------------------------------------------------------------------- | ------------------------------------ | -------------------------------------------- |
|
|
533
|
-
| `--a2ui-color-primary` | `#007bff` | primary buttons, active tabs, selected chips |
|
|
534
|
-
| `--a2ui-color-on-primary` | `#fff` | text on the primary color |
|
|
535
|
-
| `--a2ui-color-surface` | `#fff` | cards, buttons, chips, dialogs |
|
|
536
|
-
| `--a2ui-color-border` | `#ccc` | borders and dividers |
|
|
537
|
-
| `--a2ui-color-muted` | `#666` | captions and secondary text |
|
|
538
|
-
| `--a2ui-color-error` | `red` | validation errors |
|
|
539
|
-
| `--a2ui-color-input`, `--a2ui-color-on-input` | system field colors | text inputs |
|
|
540
|
-
| `--a2ui-color-placeholder`, `--a2ui-color-placeholder-highlight` | `#f3f4f6`, `#e5e7eb` | loading and pending placeholders |
|
|
541
|
-
| `--a2ui-spacing-m` | `8px` | component margins and gaps |
|
|
542
|
-
| `--a2ui-row-gap`, `--a2ui-column-gap`, `--a2ui-list-gap` | `--a2ui-spacing-m` | space between children |
|
|
543
|
-
| `--a2ui-border-radius` | `8px` | cards, inputs, dialogs |
|
|
544
|
-
| `--a2ui-font-size-s`, `--a2ui-font-size-xs` | `14px`, `12px` | labels, captions |
|
|
545
|
-
| `--a2ui-card-padding`, `--a2ui-card-shadow` | `16px`, subtle shadow | Card |
|
|
546
|
-
| `--a2ui-button-padding`, `--a2ui-button-border-radius` | `8px 16px`, `4px` | Button, tabs |
|
|
547
|
-
| `--a2ui-input-padding` | `8px` | TextField, DateTimeInput |
|
|
548
|
-
| `--a2ui-chip-border-radius` | `16px` | ChoicePicker chips |
|
|
549
|
-
| `--a2ui-icon-size` | `24px` | Icon |
|
|
550
|
-
| `--a2ui-modal-backdrop`, `--a2ui-modal-padding`, `--a2ui-modal-z-index` | `rgba(0, 0, 0, 0.5)`, `24px`, `1000` | Modal |
|
|
551
|
-
|
|
552
|
-
`--a2ui-primary-color`, which the React and Vue renderers use, still works as
|
|
553
|
-
a fallback for `--a2ui-color-primary`.
|
|
554
|
-
|
|
555
|
-
As in the A2UI renderers, Row, Column and List space their children with a gap
|
|
556
|
-
rather than margins on each component, and a component's `weight` becomes its
|
|
557
|
-
`flex` grow factor inside a Row or Column.
|
|
452
|
+
React and Vue use `standardUI` automatically when the runtime turns generative
|
|
453
|
+
UI on. Angular does not, because the main entry point cannot load the
|
|
454
|
+
generative UI entry point. When the runtime turns generative UI on and no
|
|
455
|
+
`provideGenerativeUI` is set, CopilotKit logs a warning in development mode.
|
|
558
456
|
|
|
559
457
|
## Lifecycle and cleanup
|
|
560
458
|
|
|
@@ -591,7 +489,7 @@ platform where the package owns it. For SSR and hydration:
|
|
|
591
489
|
- do not access returned agents or run tools during server rendering;
|
|
592
490
|
- make runtime URLs absolute when the server and browser use different
|
|
593
491
|
origins, or proxy a same-origin `/api/copilotkit` endpoint;
|
|
594
|
-
- enable
|
|
492
|
+
- enable generative UI, Open Generative UI, audio recording, and MCP Apps in the browser;
|
|
595
493
|
their interactive sandboxes, custom elements, media APIs, and iframes become
|
|
596
494
|
active after hydration;
|
|
597
495
|
- avoid branching the component tree on `window` before hydration. Use Angular
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { GENERATIVE_UI_CHART_LOADER } from '@copilotkit/angular/generative-ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Experimental. Draws the standard `Chart` component with chart.js, which
|
|
6
|
+
* loads in its own chunk the first time a chart renders. Without this
|
|
7
|
+
* provider, Chart shows its data as a table. Add `chart.js` to the app.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIChart()]
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function provideGenerativeUIChart() {
|
|
15
|
+
return makeEnvironmentProviders([
|
|
16
|
+
{
|
|
17
|
+
provide: GENERATIVE_UI_CHART_LOADER,
|
|
18
|
+
useValue: () => import('chart.js/auto'),
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Generated bundle index. Do not edit.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export { provideGenerativeUIChart };
|
|
28
|
+
//# sourceMappingURL=copilotkit-angular-generative-ui-chart.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotkit-angular-generative-ui-chart.mjs","sources":["../../src/generative-ui/chart/index.ts","../../src/generative-ui/chart/copilotkit-angular-generative-ui-chart.ts"],"sourcesContent":["import { makeEnvironmentProviders } from \"@angular/core\";\nimport type { EnvironmentProviders } from \"@angular/core\";\nimport { GENERATIVE_UI_CHART_LOADER } from \"@copilotkit/angular/generative-ui\";\n\n/**\n * Experimental. Draws the standard `Chart` component with chart.js, which\n * loads in its own chunk the first time a chart renders. Without this\n * provider, Chart shows its data as a table. Add `chart.js` to the app.\n *\n * @example\n * ```ts\n * providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIChart()]\n * ```\n */\nexport function provideGenerativeUIChart(): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: GENERATIVE_UI_CHART_LOADER,\n useValue: () => import(\"chart.js/auto\"),\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;AASG;SACa,wBAAwB,GAAA;AACtC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,0BAA0B;AACnC,YAAA,QAAQ,EAAE,MAAM,OAAO,eAAe,CAAC;AACxC,SAAA;AACF,KAAA,CAAC;AACJ;;ACrBA;;AAEG;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { GENERATIVE_UI_ICON_LOADER } from '@copilotkit/angular/generative-ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Experimental. Draws the standard `Icon` component, and the icons of
|
|
6
|
+
* Button and Select, with the Lucide icon set. The `lucide` package (the
|
|
7
|
+
* icon data, not a framework binding) loads in its own chunk the first time
|
|
8
|
+
* an icon renders. Without this provider, icons render nothing. Add
|
|
9
|
+
* `lucide` to the app.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIIcons()]
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
function provideGenerativeUIIcons() {
|
|
17
|
+
return makeEnvironmentProviders([
|
|
18
|
+
{
|
|
19
|
+
provide: GENERATIVE_UI_ICON_LOADER,
|
|
20
|
+
useValue: () => import('lucide'),
|
|
21
|
+
},
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generated bundle index. Do not edit.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
export { provideGenerativeUIIcons };
|
|
30
|
+
//# sourceMappingURL=copilotkit-angular-generative-ui-icons.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotkit-angular-generative-ui-icons.mjs","sources":["../../src/generative-ui/icons/index.ts","../../src/generative-ui/icons/copilotkit-angular-generative-ui-icons.ts"],"sourcesContent":["import { makeEnvironmentProviders } from \"@angular/core\";\nimport type { EnvironmentProviders } from \"@angular/core\";\nimport { GENERATIVE_UI_ICON_LOADER } from \"@copilotkit/angular/generative-ui\";\n\n/**\n * Experimental. Draws the standard `Icon` component, and the icons of\n * Button and Select, with the Lucide icon set. The `lucide` package (the\n * icon data, not a framework binding) loads in its own chunk the first time\n * an icon renders. Without this provider, icons render nothing. Add\n * `lucide` to the app.\n *\n * @example\n * ```ts\n * providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIIcons()]\n * ```\n */\nexport function provideGenerativeUIIcons(): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: GENERATIVE_UI_ICON_LOADER,\n useValue: () => import(\"lucide\"),\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;AAWG;SACa,wBAAwB,GAAA;AACtC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,yBAAyB;AAClC,YAAA,QAAQ,EAAE,MAAM,OAAO,QAAQ,CAAC;AACjC,SAAA;AACF,KAAA,CAAC;AACJ;;ACvBA;;AAEG;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { GENERATIVE_UI_MAP_LOADER } from '@copilotkit/angular/generative-ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Experimental. Draws the standard `Map` component with MapLibre GL, which
|
|
6
|
+
* loads in its own chunk the first time a map renders. Without this
|
|
7
|
+
* provider, Map shows its markers as a list. Add `maplibre-gl` to the app.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIMap()]
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function provideGenerativeUIMap() {
|
|
15
|
+
return makeEnvironmentProviders([
|
|
16
|
+
{
|
|
17
|
+
provide: GENERATIVE_UI_MAP_LOADER,
|
|
18
|
+
useValue: () => import('maplibre-gl'),
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Generated bundle index. Do not edit.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export { provideGenerativeUIMap };
|
|
28
|
+
//# sourceMappingURL=copilotkit-angular-generative-ui-map.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilotkit-angular-generative-ui-map.mjs","sources":["../../src/generative-ui/map/index.ts","../../src/generative-ui/map/copilotkit-angular-generative-ui-map.ts"],"sourcesContent":["import { makeEnvironmentProviders } from \"@angular/core\";\nimport type { EnvironmentProviders } from \"@angular/core\";\nimport { GENERATIVE_UI_MAP_LOADER } from \"@copilotkit/angular/generative-ui\";\n\n/**\n * Experimental. Draws the standard `Map` component with MapLibre GL, which\n * loads in its own chunk the first time a map renders. Without this\n * provider, Map shows its markers as a list. Add `maplibre-gl` to the app.\n *\n * @example\n * ```ts\n * providers: [provideGenerativeUI({ ui: standardUI }), provideGenerativeUIMap()]\n * ```\n */\nexport function provideGenerativeUIMap(): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: GENERATIVE_UI_MAP_LOADER,\n useValue: () => import(\"maplibre-gl\"),\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;AASG;SACa,sBAAsB,GAAA;AACpC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,wBAAwB;AACjC,YAAA,QAAQ,EAAE,MAAM,OAAO,aAAa,CAAC;AACtC,SAAA;AACF,KAAA,CAAC;AACJ;;ACrBA;;AAEG;;;;"}
|