@copilotkit/a2ui-renderer 1.59.5 → 1.60.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.
|
@@ -21,11 +21,11 @@ interface A2UIComponentProps<T = any> {
|
|
|
21
21
|
surfaceId: string;
|
|
22
22
|
}
|
|
23
23
|
/** @deprecated - v0.9 components are loaded by the catalog. */
|
|
24
|
-
type ComponentLoader<
|
|
24
|
+
type ComponentLoader<_T = any> = () => Promise<{
|
|
25
25
|
default: any;
|
|
26
26
|
}>;
|
|
27
27
|
/** @deprecated - v0.9 uses Catalog instead of ComponentRegistration. */
|
|
28
|
-
interface ComponentRegistration<
|
|
28
|
+
interface ComponentRegistration<_T = any> {
|
|
29
29
|
component: any;
|
|
30
30
|
lazy?: boolean;
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/react-renderer/types.ts"],"mappings":";;;KAMY,KAAA,GAAQ,MAAA;AAAA,KACR,UAAA,GAAa,MAAA;AAAA,KACb,gBAAA;AAAA,KACA,OAAA;AAAA,KACA,SAAA;AAAA,KACA,qBAAA,GAAwB,MAAA;AAAA,KACxB,MAAA;AAAA,KACA,SAAA;AAAA,KACA,gBAAA;AAAA,KACA,WAAA;AAAA,KACA,WAAA;AAAA,KACA,YAAA;;;;UAKK,kBAAA;EACf,IAAA,EAAM,CAAA;EACN,SAAA;AAAA;;KAIU,eAAA,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/react-renderer/types.ts"],"mappings":";;;KAMY,KAAA,GAAQ,MAAA;AAAA,KACR,UAAA,GAAa,MAAA;AAAA,KACb,gBAAA;AAAA,KACA,OAAA;AAAA,KACA,SAAA;AAAA,KACA,qBAAA,GAAwB,MAAA;AAAA,KACxB,MAAA;AAAA,KACA,SAAA;AAAA,KACA,gBAAA;AAAA,KACA,WAAA;AAAA,KACA,WAAA;AAAA,KACA,YAAA;;;;UAKK,kBAAA;EACf,IAAA,EAAM,CAAA;EACN,SAAA;AAAA;;KAIU,eAAA,mBAAkC,OAAA;EAC5C,OAAA;AAAA;;UAIe,qBAAA;EACf,SAAA;EACA,IAAA;AAAA;;;;KAMU,gBAAA,IACV,OAAA,EAAS,sBAAA,YACC,OAAA;;;;UAKK,kBAAA;EACf,QAAA,GAAW,gBAAA;EACX,KAAA,GAAQ,KAAA;AAAA"}
|
|
@@ -21,11 +21,11 @@ interface A2UIComponentProps<T = any> {
|
|
|
21
21
|
surfaceId: string;
|
|
22
22
|
}
|
|
23
23
|
/** @deprecated - v0.9 components are loaded by the catalog. */
|
|
24
|
-
type ComponentLoader<
|
|
24
|
+
type ComponentLoader<_T = any> = () => Promise<{
|
|
25
25
|
default: any;
|
|
26
26
|
}>;
|
|
27
27
|
/** @deprecated - v0.9 uses Catalog instead of ComponentRegistration. */
|
|
28
|
-
interface ComponentRegistration<
|
|
28
|
+
interface ComponentRegistration<_T = any> {
|
|
29
29
|
component: any;
|
|
30
30
|
lazy?: boolean;
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/react-renderer/types.ts"],"mappings":";;;KAMY,KAAA,GAAQ,MAAA;AAAA,KACR,UAAA,GAAa,MAAA;AAAA,KACb,gBAAA;AAAA,KACA,OAAA;AAAA,KACA,SAAA;AAAA,KACA,qBAAA,GAAwB,MAAA;AAAA,KACxB,MAAA;AAAA,KACA,SAAA;AAAA,KACA,gBAAA;AAAA,KACA,WAAA;AAAA,KACA,WAAA;AAAA,KACA,YAAA;;;;UAKK,kBAAA;EACf,IAAA,EAAM,CAAA;EACN,SAAA;AAAA;;KAIU,eAAA,
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/react-renderer/types.ts"],"mappings":";;;KAMY,KAAA,GAAQ,MAAA;AAAA,KACR,UAAA,GAAa,MAAA;AAAA,KACb,gBAAA;AAAA,KACA,OAAA;AAAA,KACA,SAAA;AAAA,KACA,qBAAA,GAAwB,MAAA;AAAA,KACxB,MAAA;AAAA,KACA,SAAA;AAAA,KACA,gBAAA;AAAA,KACA,WAAA;AAAA,KACA,WAAA;AAAA,KACA,YAAA;;;;UAKK,kBAAA;EACf,IAAA,EAAM,CAAA;EACN,SAAA;AAAA;;KAIU,eAAA,mBAAkC,OAAA;EAC5C,OAAA;AAAA;;UAIe,qBAAA;EACf,SAAA;EACA,IAAA;AAAA;;;;KAMU,gBAAA,IACV,OAAA,EAAS,sBAAA,YACC,OAAA;;;;UAKK,kBAAA;EACf,QAAA,GAAW,gBAAA;EACX,KAAA,GAAQ,KAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ name: a2ui-renderer
|
|
|
3
3
|
description: >
|
|
4
4
|
Render A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the
|
|
5
5
|
runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via
|
|
6
|
-
<
|
|
6
|
+
<CopilotKit a2ui={{ theme }}>. Auto-activates via /info — do NOT
|
|
7
7
|
manually pass renderActivityMessages. createA2UIMessageRenderer ships from
|
|
8
8
|
@copilotkit/react-core/v2; low-level primitives (A2UIProvider, A2UIRenderer,
|
|
9
9
|
createCatalog) ship from @copilotkit/a2ui-renderer. Covers theme
|
|
@@ -26,7 +26,7 @@ sources:
|
|
|
26
26
|
- "CopilotKit/CopilotKit:packages/runtime/src/v2/runtime/core/runtime.ts"
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
This skill builds on copilotkit/react-core (for
|
|
29
|
+
This skill builds on copilotkit/react-core (for `CopilotKit` provider fundamentals) and
|
|
30
30
|
copilotkit/runtime (for CopilotRuntime fundamentals). Read those first.
|
|
31
31
|
|
|
32
32
|
## Setup
|
|
@@ -84,12 +84,12 @@ export async function action({ request }: Route.ActionArgs) {
|
|
|
84
84
|
### Client side (`app/root.tsx` or the app shell)
|
|
85
85
|
|
|
86
86
|
```tsx
|
|
87
|
-
import {
|
|
87
|
+
import { CopilotKit, CopilotChat } from "@copilotkit/react-core/v2";
|
|
88
88
|
import "@copilotkit/react-core/v2/styles.css";
|
|
89
89
|
|
|
90
90
|
export default function App() {
|
|
91
91
|
return (
|
|
92
|
-
<
|
|
92
|
+
<CopilotKit
|
|
93
93
|
runtimeUrl="/api/copilotkit"
|
|
94
94
|
a2ui={{
|
|
95
95
|
theme: {
|
|
@@ -100,7 +100,7 @@ export default function App() {
|
|
|
100
100
|
}}
|
|
101
101
|
>
|
|
102
102
|
<CopilotChat agentId="default" className="h-full" />
|
|
103
|
-
</
|
|
103
|
+
</CopilotKit>
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
```
|
|
@@ -141,9 +141,9 @@ const catalog = createCatalog(
|
|
|
141
141
|
{ includeBasicCatalog: true },
|
|
142
142
|
);
|
|
143
143
|
|
|
144
|
-
<
|
|
144
|
+
<CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme, catalog }}>
|
|
145
145
|
<CopilotChat agentId="default" />
|
|
146
|
-
</
|
|
146
|
+
</CopilotKit>;
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
`extractSchema(definitions)` is available for passing a JSON-serializable
|
|
@@ -154,7 +154,7 @@ real runtime schema value (Zod).
|
|
|
154
154
|
### Override the loading skeleton
|
|
155
155
|
|
|
156
156
|
```tsx
|
|
157
|
-
<
|
|
157
|
+
<CopilotKit
|
|
158
158
|
runtimeUrl="/api/copilotkit"
|
|
159
159
|
a2ui={{
|
|
160
160
|
theme,
|
|
@@ -162,7 +162,7 @@ real runtime schema value (Zod).
|
|
|
162
162
|
}}
|
|
163
163
|
>
|
|
164
164
|
<CopilotChat agentId="default" />
|
|
165
|
-
</
|
|
165
|
+
</CopilotKit>
|
|
166
166
|
```
|
|
167
167
|
|
|
168
168
|
## Common Mistakes
|
|
@@ -175,7 +175,7 @@ Wrong:
|
|
|
175
175
|
// server
|
|
176
176
|
new CopilotRuntime({ agents: { default: agent } });
|
|
177
177
|
// client
|
|
178
|
-
<
|
|
178
|
+
<CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme }} />;
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
Correct:
|
|
@@ -184,7 +184,7 @@ Correct:
|
|
|
184
184
|
// server
|
|
185
185
|
new CopilotRuntime({ agents: { default: agent }, a2ui: {} });
|
|
186
186
|
// client
|
|
187
|
-
<
|
|
187
|
+
<CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme }} />;
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
Without `runtime.a2ui`, `/info` never flags A2UI and the provider's a2ui prop
|
|
@@ -199,7 +199,7 @@ Wrong:
|
|
|
199
199
|
```tsx
|
|
200
200
|
import { createA2UIMessageRenderer } from "@copilotkit/react-core/v2";
|
|
201
201
|
|
|
202
|
-
<
|
|
202
|
+
<CopilotKit
|
|
203
203
|
runtimeUrl="/api/copilotkit"
|
|
204
204
|
renderActivityMessages={[createA2UIMessageRenderer({ theme })]}
|
|
205
205
|
/>;
|
|
@@ -208,10 +208,10 @@ import { createA2UIMessageRenderer } from "@copilotkit/react-core/v2";
|
|
|
208
208
|
Correct:
|
|
209
209
|
|
|
210
210
|
```tsx
|
|
211
|
-
<
|
|
211
|
+
<CopilotKit runtimeUrl="/api/copilotkit" a2ui={{ theme }} />
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
The `CopilotKit` provider auto-detects runtime A2UI via `/info` and injects the
|
|
215
215
|
built-in renderer. Passing it through `renderActivityMessages` duplicates the
|
|
216
216
|
renderer and can race with the auto-injected one.
|
|
217
217
|
|
|
@@ -290,7 +290,7 @@ import { createA2UIMessageRenderer } from "@copilotkitnext/a2ui-renderer";
|
|
|
290
290
|
Correct:
|
|
291
291
|
|
|
292
292
|
```ts
|
|
293
|
-
// Low-level primitives (rarely needed —
|
|
293
|
+
// Low-level primitives (rarely needed — the CopilotKit provider's a2ui prop is the default path):
|
|
294
294
|
import {
|
|
295
295
|
A2UIProvider,
|
|
296
296
|
A2UIRenderer,
|