@copilotkit/angular 0.5.1 → 0.5.3

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/dist/styles.css CHANGED
@@ -221,9 +221,6 @@
221
221
  .cpk\:bottom-0 {
222
222
  bottom: calc(var(--cpk-spacing) * 0);
223
223
  }
224
- .cpk\:bottom-6 {
225
- bottom: calc(var(--cpk-spacing) * 6);
226
- }
227
224
  .cpk\:left-0 {
228
225
  left: calc(var(--cpk-spacing) * 0);
229
226
  }
@@ -2000,6 +1997,14 @@
2000
1997
  --copilot-kit-error-background: #7f1d1d;
2001
1998
  --copilot-kit-error-border: #dc2626;
2002
1999
  --copilot-kit-error-text: #fca5a5;
2000
+ --a2ui-color-surface: var(--copilot-kit-secondary-color);
2001
+ --a2ui-color-border: rgb(64, 64, 64);
2002
+ --a2ui-color-muted: #a1a1aa;
2003
+ --a2ui-color-error: #f87171;
2004
+ --a2ui-color-input: var(--copilot-kit-input-background-color);
2005
+ --a2ui-color-on-input: var(--copilot-kit-secondary-contrast-color);
2006
+ --a2ui-color-placeholder: #262626;
2007
+ --a2ui-color-placeholder-highlight: #3f3f46;
2003
2008
  --copilot-kit-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
2004
2009
  --copilot-kit-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
2005
2010
  --copilot-kit-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
@@ -0,0 +1,178 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Type, InjectionToken, OnDestroy } from '@angular/core';
3
+ import { ComponentApi, ComponentContext, ResolveA2uiProps, Catalog, SurfaceModel, DataContext, FunctionImplementation } from '@a2ui/web_core/v0_9';
4
+ export { ActionSchema, ChildListSchema, DynamicBooleanSchema, DynamicNumberSchema, DynamicStringSchema } from '@a2ui/web_core/v0_9';
5
+ import { A2UICatalog, A2UIClientEventMessage, A2UISurfaceError } from '@copilotkit/angular';
6
+ import { ZodRawShape, ZodObject, z } from 'zod';
7
+ import * as _copilotkit_angular_a2ui from '@copilotkit/angular/a2ui';
8
+
9
+ /**
10
+ * Web Component catalog entries, copied from `@a2ui/web_core/v0_9/universal`.
11
+ *
12
+ * TODO: delete this file once `@a2ui/web_core` is upgraded to 0.11.0 or later,
13
+ * and import `WebComponentImplementation`, `A2uiWebComponentElement`,
14
+ * `isWebComponentImplementation` and `registerUniversalElement` from
15
+ * `@a2ui/web_core/v0_9/universal` instead. We pin 0.10.4, which predates them.
16
+ */
17
+
18
+ /** A catalog entry rendered by a Custom Element. */
19
+ interface WebComponentImplementation extends ComponentApi {
20
+ /** The tag name the element is registered under. */
21
+ readonly tagName: string;
22
+ /** The Custom Element class. */
23
+ readonly element: CustomElementConstructor;
24
+ }
25
+ /**
26
+ * The contract a catalog Custom Element fulfills: the renderer assigns
27
+ * `context` after creating it, and the element binds itself from there.
28
+ */
29
+ interface A2uiWebComponentElement extends HTMLElement {
30
+ context?: ComponentContext;
31
+ }
32
+
33
+ /** A catalog entry rendered by an Angular component. */
34
+ interface CopilotA2UIComponentImplementation extends ComponentApi {
35
+ readonly component: Type<unknown>;
36
+ }
37
+ /** A catalog entry: an Angular component or a Custom Element. */
38
+ type CopilotA2UICatalogEntry = CopilotA2UIComponentImplementation | WebComponentImplementation;
39
+ /** A Custom Element to render a catalog entry with, instead of an Angular component. */
40
+ type A2UIWebComponent = Pick<WebComponentImplementation, "tagName" | "element">;
41
+ interface A2UIComponentDefinition<T extends ZodRawShape = ZodRawShape> {
42
+ props: ZodObject<T>;
43
+ /** Added to the schema advertised to the agent. */
44
+ description?: string;
45
+ }
46
+ type A2UICatalogDefinitions = Record<string, A2UIComponentDefinition<any>>;
47
+ /**
48
+ * Binder-resolved props for definition `K`: dynamic values become
49
+ * primitives, actions become closures, child lists become `{ id, basePath }`
50
+ * references, and dynamic props gain `set*` setters.
51
+ */
52
+ type A2UIProps<D extends A2UICatalogDefinitions, K extends keyof D> = ResolveA2uiProps<z.infer<D[K]["props"]>>;
53
+ type A2UIChildRef = string | {
54
+ id: string;
55
+ basePath?: string;
56
+ };
57
+
58
+ /**
59
+ * A catalog of Angular components. It carries its own renderer so the main
60
+ * entry point can mount it without importing this one.
61
+ */
62
+ declare class CopilotA2UICatalog extends Catalog<CopilotA2UICatalogEntry> implements A2UICatalog {
63
+ readonly surfaceComponent: Type<unknown>;
64
+ }
65
+
66
+ /**
67
+ * The A2UI basic catalog rendered with Angular components. Pass it as
68
+ * `a2ui.catalog`, or extend it with `createAngularCatalog(..., { includeBasicCatalog: true })`.
69
+ */
70
+ declare const basicCatalog: CopilotA2UICatalog;
71
+
72
+ interface ResolvedChildRef {
73
+ id: string;
74
+ basePath: string;
75
+ }
76
+
77
+ /**
78
+ * Renders a child of the current catalog component.
79
+ *
80
+ * @example
81
+ * ```html
82
+ * <copilot-a2ui-child [child]="props().child" />
83
+ * @for (child of props().children; track child.id) {
84
+ * <copilot-a2ui-child [child]="child" />
85
+ * }
86
+ * ```
87
+ */
88
+ declare class CopilotA2UIChild {
89
+ /** A child id, or a `{ id, basePath }` reference from a resolved child list. */
90
+ readonly child: _angular_core.InputSignal<A2UIChildRef | undefined>;
91
+ protected readonly context: _copilotkit_angular_a2ui.A2UIComponentContext;
92
+ protected readonly reference: _angular_core.Signal<ResolvedChildRef | undefined>;
93
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CopilotA2UIChild, never>;
94
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CopilotA2UIChild, "copilot-a2ui-child", never, { "child": { "alias": "child"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
95
+ }
96
+
97
+ /** Per-instance context of a catalog component; see {@link injectA2UIComponentContext}. */
98
+ interface A2UIComponentContext {
99
+ readonly surfaceId: string;
100
+ readonly componentId: string;
101
+ /** Absolute data-model path this component is scoped to. */
102
+ readonly basePath: string;
103
+ readonly theme: Record<string, unknown>;
104
+ readonly surface: SurfaceModel<CopilotA2UICatalogEntry>;
105
+ readonly dataContext: DataContext;
106
+ /** Dispatch a raw A2UI action, e.g. `{ event: { name, context } }`. */
107
+ dispatch(action: unknown): Promise<void>;
108
+ /** Write into the surface data model at a relative or absolute path. */
109
+ set(path: string, value: unknown): void;
110
+ }
111
+ declare const A2UI_COMPONENT_CONTEXT: InjectionToken<A2UIComponentContext>;
112
+ /** Inject the {@link A2UIComponentContext} of the current catalog component. */
113
+ declare function injectA2UIComponentContext(): A2UIComponentContext;
114
+
115
+ interface CreateAngularCatalogOptions {
116
+ /** Identifier advertised to the agent. */
117
+ catalogId?: string;
118
+ /** Functions for bindings and expressions. Defaults to the A2UI basic functions; pass `[]` to disable. */
119
+ functions?: FunctionImplementation[];
120
+ /** Include the basic catalog's components; definitions with the same name replace them. */
121
+ includeBasicCatalog?: boolean;
122
+ }
123
+ /**
124
+ * Build a {@link CopilotA2UICatalog} from zod definitions and, per entry, an
125
+ * Angular component or a Custom Element (`{ tagName, element }`).
126
+ * Without `includeBasicCatalog` the catalog contains exactly what you
127
+ * register, so include any layout primitives the agent should use.
128
+ */
129
+ declare function createAngularCatalog<D extends A2UICatalogDefinitions>(definitions: D, components: {
130
+ [K in keyof D]: Type<unknown> | A2UIWebComponent;
131
+ }, options?: CreateAngularCatalogOptions): CopilotA2UICatalog;
132
+
133
+ type Surface = SurfaceModel<CopilotA2UICatalogEntry>;
134
+ /**
135
+ * Renders A2UI operations with a {@link CopilotA2UICatalog}. Place it directly in
136
+ * a template to render operations outside the chat.
137
+ *
138
+ * @example
139
+ * ```html
140
+ * <copilot-a2ui-surface
141
+ * [operations]="operations()"
142
+ * [catalog]="dashboardCatalog"
143
+ * (action)="onAction($event)"
144
+ * />
145
+ * ```
146
+ */
147
+ declare class CopilotA2UISurface implements OnDestroy {
148
+ /** A2UI operations in v0.9 or legacy shape. */
149
+ readonly operations: _angular_core.InputSignal<readonly unknown[]>;
150
+ readonly catalog: _angular_core.InputSignal<CopilotA2UICatalog>;
151
+ /** Theme for surfaces the renderer creates itself. */
152
+ readonly theme: _angular_core.InputSignal<Record<string, unknown> | undefined>;
153
+ /** Shown until the first surface renders. */
154
+ readonly loadingComponent: _angular_core.InputSignal<Type<unknown> | undefined>;
155
+ readonly action: _angular_core.OutputEmitterRef<A2UIClientEventMessage>;
156
+ readonly error: _angular_core.OutputEmitterRef<A2UISurfaceError>;
157
+ /** Emits after each applied batch of operations. */
158
+ readonly rendered: _angular_core.OutputEmitterRef<void>;
159
+ protected readonly surfaces: _angular_core.WritableSignal<Surface[]>;
160
+ protected readonly errorMessage: _angular_core.WritableSignal<string | null>;
161
+ private readonly revision;
162
+ private processor;
163
+ private processorCatalog;
164
+ private lastOperationsHash;
165
+ private appliedOperationsCount;
166
+ constructor();
167
+ ngOnDestroy(): void;
168
+ /** Drops the processor and everything rendered from it. */
169
+ private reset;
170
+ private getProcessor;
171
+ private process;
172
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CopilotA2UISurface, never>;
173
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CopilotA2UISurface, "copilot-a2ui-surface", never, { "operations": { "alias": "operations"; "required": false; "isSignal": true; }; "catalog": { "alias": "catalog"; "required": true; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "loadingComponent": { "alias": "loadingComponent"; "required": false; "isSignal": true; }; }, { "action": "action"; "error": "error"; "rendered": "rendered"; }, never, never, true, never>;
174
+ }
175
+
176
+ export { A2UI_COMPONENT_CONTEXT, CopilotA2UICatalog, CopilotA2UIChild, CopilotA2UISurface, basicCatalog, createAngularCatalog, injectA2UIComponentContext };
177
+ export type { A2UICatalogDefinitions, A2UIChildRef, A2UIComponentContext, A2UIComponentDefinition, A2UIProps, A2UIWebComponent, A2uiWebComponentElement, CopilotA2UICatalogEntry, CopilotA2UIComponentImplementation, CreateAngularCatalogOptions, WebComponentImplementation };
178
+ //# sourceMappingURL=copilotkit-angular-a2ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilotkit-angular-a2ui.d.ts","sources":["../../src/a2ui/lib/universal.ts","../../src/a2ui/lib/types.ts","../../src/a2ui/lib/catalog.ts","../../src/a2ui/lib/basic/catalog.ts","../../src/a2ui/lib/child-ref.ts","../../src/a2ui/lib/child.ts","../../src/a2ui/lib/component-context.ts","../../src/a2ui/lib/create-catalog.ts","../../src/a2ui/lib/surface.ts"],"mappings":";;;;;;;;AAAA;;;;;;;AAOG;;AAGH;AACM,UAAW,0BAA2B,SAAQ,YAAY;;AAE9D;;AAEA,sBAAkB,wBAAwB;AAC3C;AAED;;;AAGG;AACG,UAAW,uBAAwB,SAAQ,WAAW;cAChD,gBAAgB;AAC3B;;ACnBD;AACM,UAAW,kCAAmC,SAAQ,YAAY;AACtE,wBAAoB,IAAI;AACzB;AAED;KACY,uBAAuB,GAC/B,kCAAkC,GAClC,0BAA0B;AAE9B;AACM,KAAM,gBAAgB,GAAG,IAAI,CACjC,0BAA0B;UAIX,uBAAuB,WAAW,WAAW,GAAG,WAAW;AAC1E,WAAO,SAAS;;;AAGjB;AAEK,KAAM,sBAAsB,GAAG,MAAM,SAEzC,uBAAuB;AAGzB;;;;AAIG;AACG,KAAM,SAAS,WACT,sBAAsB,uBAE9B,gBAAgB,CAAC,CAAC,CAAC,KAAK;AAEtB,KAAM,YAAY;;;;;ACpCxB;;;AAGG;AACH,cAAa,kBACX,SAAQ,OAAO,CAAC,uBAAuB,aAC5B,WAAW;AAEtB,+BAA2B,IAAI;AAChC;;AC8DD;;;AAGG;AACH,cAAa,YAAY,EAAA,kBAIxB;;UClFgB,gBAAgB;;;AAGhC;;ACAD;;;;;;;;;;AAUG;AACH,cAca,gBAAgB;;oBAEb,aAAA,CAAA,WAAA,CAAA,YAAA;AAEd,gCAA0B,wBAAA,CAAA,oBAAA;AAE1B,kCAA4B,aAAA,CAAA,MAAA,CAAAA,gBAAA;oDANjB,gBAAgB;sDAAhB,gBAAg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