@copilotkit/vue 1.81.0 → 1.83.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.
- package/AGENTS.md +8 -7
- package/CONTRIBUTOR_GUIDE.md +120 -0
- package/PARITY.md +19 -10
- package/README.md +24 -373
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/styles.css +1 -1
- package/dist/use-render-activity-message-B7sDGUl4.cjs +70 -0
- package/dist/use-render-activity-message-B7sDGUl4.cjs.map +1 -0
- package/dist/{use-render-activity-message-5H6AfuJB.js → use-render-activity-message-mQvByEYF.js} +3189 -3147
- package/dist/use-render-activity-message-mQvByEYF.js.map +1 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +10 -0
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/catalog.d.ts.map +1 -1
- package/dist/v2/components/a2ui/utils.d.ts +1 -1
- package/dist/v2/components/a2ui/utils.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAttachmentQueue.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts +54 -0
- package/dist/v2/components/chat/CopilotChatInput.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts +3 -0
- package/dist/v2/components/chat/CopilotChatReasoningMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeader.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts +4 -0
- package/dist/v2/components/chat/CopilotModalHeaderCloseButton.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotSidebarViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts +15 -0
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/dist/v2/providers/types.d.ts +9 -0
- package/dist/v2/providers/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/styles/globals.css +7 -0
- package/src/v2/components/__tests__/A2UIBasicCatalogColors.test.ts +188 -0
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +63 -0
- package/src/v2/components/a2ui/A2UICatalogContext.ts +14 -2
- package/src/v2/components/a2ui/catalog.ts +44 -15
- package/src/v2/components/a2ui/utils.ts +1 -1
- package/src/v2/components/chat/CopilotChatAttachmentQueue.vue +8 -3
- package/src/v2/components/chat/CopilotChatInput.vue +2 -2
- package/src/v2/components/chat/CopilotChatReasoningMessage.vue +11 -1
- package/src/v2/components/chat/CopilotModalHeader.vue +4 -1
- package/src/v2/components/chat/CopilotModalHeaderCloseButton.ts +11 -1
- package/src/v2/components/chat/CopilotSidebarViewInternal.vue +3 -1
- package/src/v2/components/chat/__tests__/CopilotChat.labels.test.ts +198 -0
- package/src/v2/providers/CopilotKitProvider.types.ts +15 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +50 -0
- package/src/v2/providers/types.ts +9 -0
- package/dist/use-render-activity-message-5H6AfuJB.js.map +0 -1
- package/dist/use-render-activity-message-DxOdM2Qt.cjs +0 -70
- package/dist/use-render-activity-message-DxOdM2Qt.cjs.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -4,14 +4,15 @@ This file defines contributor workflow for keeping `@copilotkit/vue` aligned wit
|
|
|
4
4
|
|
|
5
5
|
## Scope
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- Package implementation scope is limited to `packages/vue/**`.
|
|
8
|
+
- The documented integration exceptions are Vue docs and runnable examples under `showcase/**`, plus their registry, generated-catalog, and validation-workflow plumbing described in [Documentation ownership](#documentation-ownership).
|
|
9
|
+
- Keep other upstream changes outside the Vue package to a minimum until the Vue port is merged.
|
|
9
10
|
|
|
10
11
|
## Parity source of truth
|
|
11
12
|
|
|
12
13
|
- React remains the canonical behavioral reference: `packages/react-core/`, `packages/react-ui/`, and `packages/react-textarea/`.
|
|
13
14
|
- Use [PARITY.md](./PARITY.md) as the canonical Vue-side parity policy, architectural translation guide, strict test-port rulebook, and living React-to-Vue implementation/test matrix.
|
|
14
|
-
- Keep [README.md](./README.md)
|
|
15
|
+
- Keep [README.md](./README.md) as the slim npm-facing package entry point.
|
|
15
16
|
|
|
16
17
|
## Required parity workflow
|
|
17
18
|
|
|
@@ -49,8 +50,8 @@ When touching integration/build behavior:
|
|
|
49
50
|
|
|
50
51
|
1. `pnpm nx run @copilotkit/vue:build`
|
|
51
52
|
|
|
52
|
-
## Documentation
|
|
53
|
+
## Documentation ownership
|
|
53
54
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
55
|
+
- Canonical long-form Vue guides and API reference live in `showcase/shell-docs/src/content/`.
|
|
56
|
+
- Runnable Vue examples live in `showcase/vue/`; feature coverage is owned by `showcase/shared/frontend-registry.json`, generated frontend catalogs, and Showcase validation workflows. See [PARITY.md](./PARITY.md#package-boundary-and-documentation-placement) for the canonical policy.
|
|
57
|
+
- [PARITY.md](./PARITY.md) records parity governance and intentional differences; it is not a duplicate coverage catalog.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Contributor guide: keeping Vue in sync with React
|
|
2
|
+
|
|
3
|
+
Use this guide when changing `@copilotkit/vue`. It describes how to trace a
|
|
4
|
+
React feature into Vue, choose the right kind of translation, and keep behavior,
|
|
5
|
+
tests, and documentation aligned. General setup, branching, commits, and PR
|
|
6
|
+
guidance live in the [root contributing guide](../../CONTRIBUTING.md).
|
|
7
|
+
|
|
8
|
+
There is no blanket promise of one-to-one API or test parity. React is the
|
|
9
|
+
behavioral reference; Vue should match its behavior with the smallest
|
|
10
|
+
Vue-native differences.
|
|
11
|
+
|
|
12
|
+
## File responsibilities
|
|
13
|
+
|
|
14
|
+
| File | Reader | Purpose |
|
|
15
|
+
| -------------------------- | -------------------------- | --------------------------------------------------------------------------------------------- |
|
|
16
|
+
| [`README.md`](./README.md) | npm users | Installation, concise usage, and package-facing examples. |
|
|
17
|
+
| `CONTRIBUTOR_GUIDE.md` | Human contributors | Practical workflow for keeping Vue aligned with React. |
|
|
18
|
+
| [`AGENTS.md`](./AGENTS.md) | Contributors and agents | Short, required rules for package scope, reactivity, validation, and ownership. |
|
|
19
|
+
| [`PARITY.md`](./PARITY.md) | Contributors and reviewers | Detailed translation policy, test-port rules, intentional divergences, and the living matrix. |
|
|
20
|
+
|
|
21
|
+
Use this guide for orientation. Use `AGENTS.md` for package constraints and
|
|
22
|
+
`PARITY.md` for the rule or matrix row that applies to the feature. Do not copy
|
|
23
|
+
those documents' full policy or coverage table here.
|
|
24
|
+
|
|
25
|
+
## React references and Vue architecture
|
|
26
|
+
|
|
27
|
+
React is the canonical behavioral reference in:
|
|
28
|
+
|
|
29
|
+
- `packages/react-core/`
|
|
30
|
+
- `packages/react-ui/`
|
|
31
|
+
- `packages/react-textarea/`
|
|
32
|
+
|
|
33
|
+
Vue is one published package, not a parallel `vue-core` plus `vue-ui` split.
|
|
34
|
+
Current V2 code is primarily under `packages/vue/src/v2/`. The root
|
|
35
|
+
[`src/index.ts`](./src/index.ts) also exposes V1 compatibility wrappers from
|
|
36
|
+
`src/hooks/` and `src/components/copilot-provider/`, so check the public barrel
|
|
37
|
+
before adding or moving an export. Framework-agnostic behavior comes from
|
|
38
|
+
`@copilotkit/core`.
|
|
39
|
+
|
|
40
|
+
Headless React hooks and providers generally translate to Vue composables,
|
|
41
|
+
providers, or types. Render props and render-oriented hooks generally translate
|
|
42
|
+
to composable state plus named or scoped slots. Slots are the primary Vue
|
|
43
|
+
customization model; approved programmatic renderer APIs cover cases such as
|
|
44
|
+
ordered registration or agent scoping.
|
|
45
|
+
|
|
46
|
+
## Short sync workflow
|
|
47
|
+
|
|
48
|
+
1. Find the React implementation, public types, dedicated tests, and the matching
|
|
49
|
+
row in [`PARITY.md`](./PARITY.md). Search the canonical package trees and
|
|
50
|
+
`packages/vue/src` by public symbol or component name. A matching filename is
|
|
51
|
+
only a starting point.
|
|
52
|
+
2. Read the React tests before writing Vue code. Record the boundary and behavior
|
|
53
|
+
they assert so the Vue counterpart tests the same thing.
|
|
54
|
+
3. Classify the feature with the [translation decision tree](./PARITY.md#translation-decision-tree)
|
|
55
|
+
and [near-100% rule](./PARITY.md#near-100-translation-rule). If a new or
|
|
56
|
+
expanded Vue API may be needed, discuss that divergence before implementing it.
|
|
57
|
+
4. Implement in the existing Vue source area, keep the relevant barrel exports
|
|
58
|
+
aligned, and add the Vue counterpart at the same behavioral boundary. For
|
|
59
|
+
strict ports, follow the detailed [test translation policy](./PARITY.md#test-translation-policy);
|
|
60
|
+
for slot APIs, follow the [slot-suite policy](./PARITY.md#slot-system-suite-translation-policy).
|
|
61
|
+
5. Update the relevant `PARITY.md` matrix row in the same code change. Use
|
|
62
|
+
`matched`, `partial`, or `intentional-divergence` honestly. Add package usage
|
|
63
|
+
notes to `README.md`; route long-form docs and runnable examples to their
|
|
64
|
+
owners below.
|
|
65
|
+
|
|
66
|
+
## Expected framework differences versus behavior changes
|
|
67
|
+
|
|
68
|
+
Expected Vue differences include `ref`/`computed`/`watch` instead of React state
|
|
69
|
+
and effects, Vue lifecycle hooks, templates instead of JSX, and slots instead of
|
|
70
|
+
render props. These are translation mechanics.
|
|
71
|
+
|
|
72
|
+
Behavioral differences are different precedence or fallback, missing edge-case
|
|
73
|
+
handling, changed lifecycle or error semantics, or unsafe reactive proxies at a
|
|
74
|
+
clone or serialization boundary. Treat those as parity work, not as an automatic
|
|
75
|
+
framework exception. Document intentional differences in [`PARITY.md`](./PARITY.md)
|
|
76
|
+
and preserve the package reactivity rules in [`AGENTS.md`](./AGENTS.md).
|
|
77
|
+
|
|
78
|
+
## Documentation and Showcase ownership
|
|
79
|
+
|
|
80
|
+
Package README content is concise. CopilotKit guides, API reference, and reusable
|
|
81
|
+
snippets belong under [`showcase/shell-docs/src/content/`](../../showcase/shell-docs/src/content/);
|
|
82
|
+
the top-level `docs/` path is only a symlink. Follow the repository's
|
|
83
|
+
[documentation guidance](../../.claude/docs/documentation.md), including
|
|
84
|
+
`docs_mode` and `getDocsFolder()` when framework-owned docs are involved.
|
|
85
|
+
|
|
86
|
+
For showcase-driven docs, edit source inputs such as manifests, shared/root MDX,
|
|
87
|
+
snippets, demos, source regions, or sparse overrides. Do not edit generated
|
|
88
|
+
`showcase/shell-docs/src/data/frameworks/` files. Authored framework docs live in
|
|
89
|
+
their MDX tree and `meta.json`.
|
|
90
|
+
|
|
91
|
+
Runnable Vue journeys belong to the [`showcase/vue` host](../../showcase/vue/).
|
|
92
|
+
Feature coverage and catalog ownership belong to
|
|
93
|
+
[`showcase/shared/frontend-registry.json`](../../showcase/shared/frontend-registry.json)
|
|
94
|
+
and the existing Showcase generation and validation workflows. Read
|
|
95
|
+
[`showcase/AGENTS.md`](../../showcase/AGENTS.md) before changing a Showcase cell.
|
|
96
|
+
The Vue Storybook under [`examples/v2/vue/storybook`](../../examples/v2/vue/storybook)
|
|
97
|
+
is useful for component development, but is not the canonical integration or
|
|
98
|
+
long-form documentation owner.
|
|
99
|
+
|
|
100
|
+
## Nx validation
|
|
101
|
+
|
|
102
|
+
Run package tasks through Nx:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm nx run @copilotkit/vue:lint
|
|
106
|
+
pnpm nx run @copilotkit/vue:check-types
|
|
107
|
+
pnpm nx run @copilotkit/vue:test
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Run the build when changing exports, bundling, CSS, declarations, or integration
|
|
111
|
+
behavior:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pnpm nx run @copilotkit/vue:build
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
If the change includes the Vue Showcase host, use its current targets from the
|
|
118
|
+
[host README](../../showcase/vue/README.md): `test`, `build`, and
|
|
119
|
+
`consumer-check-types`. If it includes shell-docs, follow its
|
|
120
|
+
[validation commands](../../showcase/shell-docs/README.md#validate-changes).
|
package/PARITY.md
CHANGED
|
@@ -5,21 +5,30 @@ Keep it updated whenever React parity work lands in `packages/vue`.
|
|
|
5
5
|
|
|
6
6
|
## Scope and source of truth
|
|
7
7
|
|
|
8
|
-
-
|
|
8
|
+
- Primary implementation and parity-matrix scope: `packages/vue/**`. This file may point to executable Vue integration surfaces without duplicating their ownership data.
|
|
9
9
|
- Canonical source: `packages/react-core/`, `packages/react-ui/`, `packages/react-textarea/`.
|
|
10
10
|
- Goal: semantic parity plus high discoverability.
|
|
11
|
-
- Current priority: package
|
|
11
|
+
- Current priority: package parity within the established Vue package, documentation, and Showcase integration boundaries. Avoid broad shared-policy changes.
|
|
12
12
|
|
|
13
13
|
## Package boundary and documentation placement
|
|
14
14
|
|
|
15
15
|
- `@copilotkit/vue` follows the same single-package direction as `@copilotkit/react`.
|
|
16
16
|
- Core hooks/providers/types and UI-facing rendering primitives should live in this package.
|
|
17
17
|
- Keep scope aligned with React's package surface; avoid introducing a parallel `vue-ui` package split.
|
|
18
|
-
-
|
|
19
|
-
- Keep
|
|
20
|
-
-
|
|
18
|
+
- Long-form user documentation and API reference belong in `showcase/shell-docs/`.
|
|
19
|
+
- Keep `README.md` as the npm-facing package entry point for installation and concise usage.
|
|
20
|
+
- Runnable visual examples belong to the Showcase Vue host and generated frontend catalogs; Storybook is not the canonical integration surface.
|
|
21
21
|
- Keep parity policy, translation rules, checklist, and the living React-to-Vue matrix in this file.
|
|
22
|
-
-
|
|
22
|
+
- Showcase coverage and build ownership live in `showcase/shared/frontend-registry.json`, the generated frontend catalogs, and the existing Showcase validation/build workflows. Link to those sources instead of duplicating cell counts, feature counts, or a second coverage table here.
|
|
23
|
+
- Vue documentation governance: React root IA is canonical; Vue navigation is derived and filtered through frontend resolution; shared pages and Vue variants follow the established policy; automated tests, not a duplicated route table, verify parity.
|
|
24
|
+
- Vue-local documentation exceptions preserve the shared AG-UI Streams, thread-import, and Inspector pages without changing other frontend policy, while keeping A2UI and detailed v1 material outside the accepted Vue surface.
|
|
25
|
+
|
|
26
|
+
## Verification boundary
|
|
27
|
+
|
|
28
|
+
- Package behavior is verified by the Vue package's Nx test, type-check, lint, and build targets as applicable.
|
|
29
|
+
- Existing Showcase validation and build workflows provide automatic canonical-artifact, integration-image staging/build, and hosting-contract validation for relevant pull requests.
|
|
30
|
+
- There is no full automatic Vue browser/runtime matrix on every pull request. Artifact and image-build success is not browser/runtime passing evidence.
|
|
31
|
+
- Currently visible consumer type failures remain outside this passing evidence; this document does not suppress, allowlist, or redefine them.
|
|
23
32
|
|
|
24
33
|
## API compatibility policy
|
|
25
34
|
|
|
@@ -364,14 +373,14 @@ For package-level parity work, all items below are required before a ported Reac
|
|
|
364
373
|
4. Code-level docs parity:
|
|
365
374
|
New public hooks/composables include JSDoc on implementation with at least one usage example.
|
|
366
375
|
5. Package docs parity:
|
|
367
|
-
|
|
376
|
+
Concise npm-facing Vue notes remain documented in `README.md`; long-form user documentation and reference live in shell-docs.
|
|
368
377
|
|
|
369
|
-
|
|
378
|
+
Executable integration follow-up for user-visible features:
|
|
370
379
|
|
|
371
380
|
1. Visual parity:
|
|
372
|
-
Add or update the corresponding
|
|
381
|
+
Add or update the corresponding runnable surface in the Showcase Vue host/catalog.
|
|
373
382
|
2. Demo/example parity:
|
|
374
|
-
|
|
383
|
+
Update the Showcase-owned registry/catalog inputs without duplicating coverage data in this file.
|
|
375
384
|
|
|
376
385
|
## React -> Vue Parity Matrix
|
|
377
386
|
|
package/README.md
CHANGED
|
@@ -1,403 +1,54 @@
|
|
|
1
1
|
# @copilotkit/vue
|
|
2
2
|
|
|
3
|
-
Vue 3
|
|
4
|
-
|
|
5
|
-
## Documentation Location
|
|
6
|
-
|
|
7
|
-
Vue-specific documentation does not belong in the shared `docs/` V2 reference unless the repository adds a dedicated Vue docs section there.
|
|
8
|
-
|
|
9
|
-
- Keep package usage and API guidance in this README.
|
|
10
|
-
- Keep parity policy, architectural translation decisions, strict test-port rules, and the living React-to-Vue matrix in [PARITY.md](https://github.com/CopilotKit/CopilotKit/blob/main/packages/vue/PARITY.md).
|
|
11
|
-
- Put public-facing Vue API and component documentation in Vue Storybook under `examples/v2/vue/storybook`.
|
|
12
|
-
|
|
13
|
-
## Parity Delivery Checklist
|
|
14
|
-
|
|
15
|
-
The parity checklist and strict translatability rules are maintained in [PARITY.md](https://github.com/CopilotKit/CopilotKit/blob/main/packages/vue/PARITY.md). Use it as the source of truth for parity completion and for deciding when tests must mirror React literally.
|
|
16
|
-
|
|
17
|
-
## Parity Workflow
|
|
18
|
-
|
|
19
|
-
Follow [PARITY.md](https://github.com/CopilotKit/CopilotKit/blob/main/packages/vue/PARITY.md) for parity workflow. If a feature is not clearly near-100% translatable, discuss the API/test divergence before introducing a Vue-specific translation. Update the matrix in the same change when behavior or tests change.
|
|
3
|
+
Vue 3 components and composables for connecting an app to CopilotKit Runtime and rendering agent chat UI. The package includes `CopilotKitProvider`, `CopilotChat`, `CopilotSidebar`, `CopilotPopup`, and composables for agents, tools, context, suggestions, threads, interrupts, and custom rendering.
|
|
20
4
|
|
|
21
5
|
## Installation
|
|
22
6
|
|
|
23
7
|
```bash
|
|
24
|
-
|
|
8
|
+
npm install @copilotkit/vue
|
|
25
9
|
```
|
|
26
10
|
|
|
27
|
-
|
|
11
|
+
The package requires Vue 3.3 or newer. Your app also needs a Copilot Runtime endpoint, such as `/api/copilotkit`. If you host the runtime yourself, install `@copilotkit/runtime` in the server project.
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
import "@copilotkit/vue/styles.css";
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
`styles.css` is generated from `src/styles/globals.css` via Tailwind (`pnpm -C packages/vue build:css`).
|
|
34
|
-
The Vue package styles are self-contained and do not require importing `@copilotkit/react/styles.css`.
|
|
35
|
-
|
|
36
|
-
## Basic Usage
|
|
13
|
+
## Quick start
|
|
37
14
|
|
|
38
15
|
```vue
|
|
16
|
+
<!-- App.vue -->
|
|
39
17
|
<script setup lang="ts">
|
|
40
|
-
import { CopilotKitProvider } from "@copilotkit/vue";
|
|
18
|
+
import { CopilotChat, CopilotKitProvider } from "@copilotkit/vue/v2";
|
|
19
|
+
import "@copilotkit/vue/styles.css";
|
|
41
20
|
</script>
|
|
42
21
|
|
|
43
22
|
<template>
|
|
44
23
|
<CopilotKitProvider runtime-url="/api/copilotkit">
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
</
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Inspector
|
|
51
|
-
|
|
52
|
-
The provider mounts the Inspector automatically in development. It is never
|
|
53
|
-
loaded in production or during server rendering. Disable it when needed with
|
|
54
|
-
`<CopilotKitProvider :enable-inspector="false">`. The deprecated
|
|
55
|
-
`showDevConsole` prop does not control Inspector visibility.
|
|
56
|
-
|
|
57
|
-
## Provider Parity: `selfManagedAgents`, `onError`, and `a2ui`
|
|
58
|
-
|
|
59
|
-
`CopilotKitProvider` supports React-parity provider controls for local agent registration and runtime error handling.
|
|
60
|
-
|
|
61
|
-
```vue
|
|
62
|
-
<script setup lang="ts">
|
|
63
|
-
import { CopilotKitProvider } from "@copilotkit/vue";
|
|
64
|
-
import type { CopilotKitCoreErrorCode } from "@copilotkit/core";
|
|
65
|
-
|
|
66
|
-
function onProviderError(event: {
|
|
67
|
-
error: Error;
|
|
68
|
-
code: CopilotKitCoreErrorCode;
|
|
69
|
-
context: Record<string, any>;
|
|
70
|
-
}) {
|
|
71
|
-
console.error(
|
|
72
|
-
"CopilotKit provider error",
|
|
73
|
-
event.code,
|
|
74
|
-
event.context,
|
|
75
|
-
event.error,
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
</script>
|
|
79
|
-
|
|
80
|
-
<template>
|
|
81
|
-
<CopilotKitProvider
|
|
82
|
-
runtime-url="/api/copilotkit"
|
|
83
|
-
:self-managed-agents="{}"
|
|
84
|
-
:on-error="onProviderError"
|
|
85
|
-
:a2ui="{ theme: { mode: 'light' } }"
|
|
86
|
-
>
|
|
87
|
-
<slot />
|
|
88
|
-
</CopilotKitProvider>
|
|
89
|
-
</template>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Notes:
|
|
93
|
-
|
|
94
|
-
- `selfManagedAgents` is merged with `agents__unsafe_dev_only`, with `selfManagedAgents` taking precedence for duplicate IDs.
|
|
95
|
-
- `onError` receives provider-scope core errors and is independent from chat-level `CopilotChat.onError`.
|
|
96
|
-
- `a2ui.theme` customizes the built-in `a2ui-surface` fallback renderer when the runtime reports `a2uiEnabled: true`.
|
|
97
|
-
|
|
98
|
-
### Provider `debug` logging
|
|
99
|
-
|
|
100
|
-
`CopilotKitProvider` accepts a `debug` prop that mirrors the React `debug` surface. It toggles client-side debug logging on the underlying core and is kept in sync at runtime as the prop changes.
|
|
101
|
-
|
|
102
|
-
Supported values match React parity:
|
|
103
|
-
|
|
104
|
-
- `true` / `false` — enables or disables event + lifecycle logging (verbose payloads stay off).
|
|
105
|
-
- `{ events?: boolean; lifecycle?: boolean; verbose?: boolean }` — granular control; `verbose` opts into full event payloads.
|
|
106
|
-
|
|
107
|
-
```vue
|
|
108
|
-
<script setup lang="ts">
|
|
109
|
-
import { CopilotKitProvider, type DebugConfig } from "@copilotkit/vue";
|
|
110
|
-
|
|
111
|
-
const debug: DebugConfig = { events: true, lifecycle: true, verbose: false };
|
|
112
|
-
</script>
|
|
113
|
-
|
|
114
|
-
<template>
|
|
115
|
-
<CopilotKitProvider runtime-url="/api/copilotkit" :debug="debug">
|
|
116
|
-
<slot />
|
|
117
|
-
</CopilotKitProvider>
|
|
118
|
-
</template>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Prop updates are forwarded to the stable `CopilotKitCoreVue` instance via `setDebug(...)`, so changing `debug` at runtime does not recreate the provider or the core instance.
|
|
122
|
-
|
|
123
|
-
## Chat Error Parity: `CopilotChat.onError`
|
|
124
|
-
|
|
125
|
-
`CopilotChat` also exposes an `onError` callback with React-parity filtering semantics.
|
|
126
|
-
It only forwards errors for the resolved chat agent (or global errors without an `agentId`).
|
|
127
|
-
|
|
128
|
-
```vue
|
|
129
|
-
<script setup lang="ts">
|
|
130
|
-
import { CopilotChat } from "@copilotkit/vue";
|
|
131
|
-
|
|
132
|
-
function onChatError(event: {
|
|
133
|
-
error: Error;
|
|
134
|
-
code: string;
|
|
135
|
-
context: Record<string, any>;
|
|
136
|
-
}) {
|
|
137
|
-
console.error("CopilotChat error", event.code, event.context, event.error);
|
|
138
|
-
}
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<template>
|
|
142
|
-
<CopilotChat agent-id="default" :on-error="onChatError" />
|
|
143
|
-
</template>
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Notes:
|
|
147
|
-
|
|
148
|
-
- Provider `onError` and chat `onError` are independent subscriptions and can both fire for the same matching error.
|
|
149
|
-
- Chat `onError` ignores errors scoped to other `agentId` values.
|
|
150
|
-
|
|
151
|
-
## Chat Rendering (Slot-Based)
|
|
152
|
-
|
|
153
|
-
`@copilotkit/vue` uses Vue named/scoped slots for message, activity, and tool rendering:
|
|
154
|
-
|
|
155
|
-
- `CopilotChatMessageView`
|
|
156
|
-
- `CopilotChatToolCallsView`
|
|
157
|
-
- `CopilotChatInput`
|
|
158
|
-
|
|
159
|
-
```vue
|
|
160
|
-
<template>
|
|
161
|
-
<CopilotChatMessageView :messages="messages" :is-running="isRunning">
|
|
162
|
-
<template #message-before="{ message, runId, messageIndexInRun }">
|
|
163
|
-
<MessageMeta
|
|
164
|
-
:id="message.id"
|
|
165
|
-
:run-id="runId"
|
|
166
|
-
:index-in-run="messageIndexInRun"
|
|
167
|
-
/>
|
|
168
|
-
</template>
|
|
169
|
-
|
|
170
|
-
<template #assistant-message="{ message }">
|
|
171
|
-
<AssistantBubble :content="message.content" />
|
|
172
|
-
</template>
|
|
173
|
-
|
|
174
|
-
<template #activity-mcp-apps="{ content }">
|
|
175
|
-
<MyMcpActivity :content="content" />
|
|
176
|
-
</template>
|
|
177
|
-
|
|
178
|
-
<template #tool-call-search_docs="{ args, status, result }">
|
|
179
|
-
<SearchDocsToolCall :args="args" :status="status" :result="result" />
|
|
180
|
-
</template>
|
|
181
|
-
|
|
182
|
-
<template #tool-call="{ name, args, status }">
|
|
183
|
-
<GenericToolCall :name="name" :args="args" :status="status" />
|
|
184
|
-
</template>
|
|
185
|
-
</CopilotChatMessageView>
|
|
186
|
-
</template>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Supported message-level slots:
|
|
190
|
-
|
|
191
|
-
- `message-before`
|
|
192
|
-
- `assistant-message`
|
|
193
|
-
- `user-message`
|
|
194
|
-
- `reasoning-message`
|
|
195
|
-
- `activity-<activityType>` (dynamic)
|
|
196
|
-
- `activity-message` (fallback)
|
|
197
|
-
- `message-after`
|
|
198
|
-
- `cursor`
|
|
199
|
-
|
|
200
|
-
Supported tool-level slots:
|
|
201
|
-
|
|
202
|
-
- `tool-call-<toolName>` (dynamic)
|
|
203
|
-
- `tool-call` (fallback)
|
|
204
|
-
|
|
205
|
-
## Programmatic Custom Message Registration
|
|
206
|
-
|
|
207
|
-
Slots remain the primary Vue customization path for chat/message rendering. When you need reusable shared renderers with provider-managed ordering or agent scoping, `CopilotKitProvider` also accepts `render-custom-messages` as a secondary API.
|
|
208
|
-
|
|
209
|
-
```vue
|
|
210
|
-
<script setup lang="ts">
|
|
211
|
-
import { CopilotKitProvider, CopilotChat } from "@copilotkit/vue";
|
|
212
|
-
import { defineComponent } from "vue";
|
|
213
|
-
|
|
214
|
-
const AuditBadge = defineComponent({
|
|
215
|
-
props: {
|
|
216
|
-
message: { type: Object, required: true },
|
|
217
|
-
position: { type: String, required: true },
|
|
218
|
-
},
|
|
219
|
-
template: `
|
|
220
|
-
<div
|
|
221
|
-
v-if="position === 'after' && message.role === 'assistant'"
|
|
222
|
-
:data-testid="'audit-' + message.id"
|
|
223
|
-
>
|
|
224
|
-
Audited
|
|
225
|
-
</div>
|
|
226
|
-
`,
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
const renderCustomMessages = [
|
|
230
|
-
{ render: AuditBadge },
|
|
231
|
-
{ agentId: "sales-agent", render: AuditBadge },
|
|
232
|
-
];
|
|
233
|
-
</script>
|
|
234
|
-
|
|
235
|
-
<template>
|
|
236
|
-
<CopilotKitProvider
|
|
237
|
-
runtime-url="/api/copilotkit"
|
|
238
|
-
:render-custom-messages="renderCustomMessages"
|
|
239
|
-
>
|
|
240
|
-
<CopilotChat agent-id="sales-agent" />
|
|
24
|
+
<main style="height: 100dvh">
|
|
25
|
+
<CopilotChat />
|
|
26
|
+
</main>
|
|
241
27
|
</CopilotKitProvider>
|
|
242
28
|
</template>
|
|
243
29
|
```
|
|
244
30
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
- `#message-before` / `#message-after` for local template-level customization in a specific chat or message view
|
|
248
|
-
- provider `render-custom-messages` for reusable renderer registration, ordered evaluation, and agent-scoped overrides
|
|
249
|
-
|
|
250
|
-
## Reasoning Messages
|
|
251
|
-
|
|
252
|
-
`CopilotChatMessageView` supports reasoning messages via the `reasoning-message` slot, with a default `CopilotChatReasoningMessage` fallback.
|
|
253
|
-
|
|
254
|
-
Default reasoning behavior mirrors React semantics:
|
|
31
|
+
Import `@copilotkit/vue/styles.css` once in your app. `CopilotChat` uses the provider's default agent when `agent-id` is omitted. The chat fills its parent, so give that container a height.
|
|
255
32
|
|
|
256
|
-
|
|
257
|
-
- Switches to `Thought for ...` when reasoning finishes.
|
|
258
|
-
- Auto-opens while streaming and auto-collapses on completion.
|
|
259
|
-
- Hides the chat-level cursor when the latest message is reasoning.
|
|
33
|
+
## Imports and compatibility
|
|
260
34
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
- **Providers**: `CopilotKitProvider`, `CopilotChatConfigurationProvider`
|
|
264
|
-
- **Composables**: `useCopilotKit`, `useCopilotChatConfiguration`, `useAgent`, `useAgentContext`, `useFrontendTool`, `useRenderTool`, `useDefaultRenderTool`, `useComponent`, `useHumanInTheLoop`, `useSuggestions`, `useConfigureSuggestions`, `useThreads`, `useInterrupt`
|
|
265
|
-
- **Components**: `CopilotChat`, `CopilotKitInspector`, `CopilotChatAssistantMessage`, `CopilotChatUserMessage`, `CopilotChatReasoningMessage`, `CopilotChatMessageView`, `CopilotChatSuggestionPill`, `CopilotChatSuggestionView`, `CopilotChatInput`, `CopilotChatToggleButton`, `CopilotModalHeader`, `CopilotChatView`, `CopilotChatToolCallsView`, `CopilotSidebarView`, `CopilotPopupView`, `CopilotSidebar`, `CopilotPopup`, `MCPAppsActivityRenderer`, `A2UISurfaceActivityRenderer`
|
|
266
|
-
- **Markdown Renderer**: `CopilotChatAssistantMessage` uses `streamdown-vue` (with KaTeX support)
|
|
267
|
-
- **Core**: `CopilotKitCoreVue`
|
|
268
|
-
|
|
269
|
-
## Threads
|
|
270
|
-
|
|
271
|
-
```vue
|
|
272
|
-
<script setup lang="ts">
|
|
273
|
-
import { useThreads } from "@copilotkit/vue";
|
|
274
|
-
|
|
275
|
-
const {
|
|
276
|
-
threads,
|
|
277
|
-
isLoading,
|
|
278
|
-
hasMoreThreads,
|
|
279
|
-
isFetchingMoreThreads,
|
|
280
|
-
fetchMoreThreads,
|
|
281
|
-
renameThread,
|
|
282
|
-
deleteThread,
|
|
283
|
-
} = useThreads({
|
|
284
|
-
agentId: "agent-1",
|
|
285
|
-
includeArchived: false,
|
|
286
|
-
limit: 20,
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
function loadMoreThreads() {
|
|
290
|
-
if (hasMoreThreads.value && !isFetchingMoreThreads.value) {
|
|
291
|
-
fetchMoreThreads();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
</script>
|
|
295
|
-
|
|
296
|
-
<template>
|
|
297
|
-
<div v-if="isLoading">Loading…</div>
|
|
298
|
-
<ul v-else>
|
|
299
|
-
<li v-for="thread in threads" :key="thread.id">
|
|
300
|
-
{{ thread.name ?? "Untitled" }}
|
|
301
|
-
<button @click="renameThread(thread.id, 'Renamed')">Rename</button>
|
|
302
|
-
<button @click="deleteThread(thread.id)">Delete</button>
|
|
303
|
-
</li>
|
|
304
|
-
</ul>
|
|
305
|
-
<button
|
|
306
|
-
v-if="hasMoreThreads"
|
|
307
|
-
:disabled="isFetchingMoreThreads"
|
|
308
|
-
@click="loadMoreThreads"
|
|
309
|
-
>
|
|
310
|
-
{{ isFetchingMoreThreads ? "Loading..." : "Load more" }}
|
|
311
|
-
</button>
|
|
312
|
-
</template>
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
`useThreads` is a headless composable for CopilotKit Intelligence thread lists scoped to the runtime-authenticated user and provided `agentId`. It supports optional `includeArchived` and `limit` inputs, subscribes to realtime metadata updates when the runtime exposes a websocket URL, and returns reactive refs for `threads`, `isLoading`, `error`, `hasMoreThreads`, and `isFetchingMoreThreads`, plus `fetchMoreThreads()`.
|
|
316
|
-
|
|
317
|
-
### `useInterrupt`
|
|
318
|
-
|
|
319
|
-
`useInterrupt` handles agent `on_interrupt` events without requiring Vue users to write render functions or TSX.
|
|
320
|
-
|
|
321
|
-
For in-chat usage, combine the composable with the `#interrupt` slot on `CopilotChat`:
|
|
322
|
-
|
|
323
|
-
```vue
|
|
324
|
-
<script setup lang="ts">
|
|
325
|
-
import { useInterrupt } from "@copilotkit/vue";
|
|
326
|
-
|
|
327
|
-
useInterrupt({
|
|
328
|
-
handler: async ({ event }) => ({ label: String(event.value) }),
|
|
329
|
-
});
|
|
330
|
-
</script>
|
|
331
|
-
|
|
332
|
-
<template>
|
|
333
|
-
<CopilotChat>
|
|
334
|
-
<template #interrupt="{ event, result, resolve }">
|
|
335
|
-
<button @click="resolve({ approved: true, value: event.value })">
|
|
336
|
-
{{ result?.label ?? event.value }}
|
|
337
|
-
</button>
|
|
338
|
-
</template>
|
|
339
|
-
</CopilotChat>
|
|
340
|
-
</template>
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
For manual placement, use `renderInChat: false` and consume the returned refs:
|
|
35
|
+
Use the `/v2` subpath for new code:
|
|
344
36
|
|
|
345
37
|
```ts
|
|
346
|
-
const { interrupt, result, hasInterrupt, resolveInterrupt } = useInterrupt({
|
|
347
|
-
renderInChat: false,
|
|
348
|
-
});
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
## Icon Foundation (Internal)
|
|
352
|
-
|
|
353
|
-
- Chat/UI components should import icons from `src/components/icons/index.ts`.
|
|
354
|
-
- Do not import from `lucide-vue-next` directly in Vue package components.
|
|
355
|
-
- This adapter is internal and intentionally not exported from the package root.
|
|
356
|
-
|
|
357
|
-
## Text Input
|
|
358
|
-
|
|
359
|
-
```vue
|
|
360
|
-
<script setup lang="ts">
|
|
361
|
-
import { ref } from "vue";
|
|
362
38
|
import {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const input = ref("");
|
|
368
|
-
|
|
369
|
-
function onSubmitMessage(value: string) {
|
|
370
|
-
console.log("submit:", value);
|
|
371
|
-
}
|
|
372
|
-
</script>
|
|
373
|
-
|
|
374
|
-
<template>
|
|
375
|
-
<CopilotChatConfigurationProvider thread-id="thread-1" agent-id="default">
|
|
376
|
-
<CopilotChatInput
|
|
377
|
-
v-model="input"
|
|
378
|
-
:tools-menu="[
|
|
379
|
-
{ label: 'Insert template', action: () => console.log('template') },
|
|
380
|
-
]"
|
|
381
|
-
@submit-message="onSubmitMessage"
|
|
382
|
-
@add-file="() => {}"
|
|
383
|
-
@start-transcribe="() => {}"
|
|
384
|
-
@cancel-transcribe="() => {}"
|
|
385
|
-
@finish-transcribe="() => {}"
|
|
386
|
-
/>
|
|
387
|
-
</CopilotChatConfigurationProvider>
|
|
388
|
-
</template>
|
|
39
|
+
CopilotChat,
|
|
40
|
+
CopilotKitProvider,
|
|
41
|
+
useFrontendTool,
|
|
42
|
+
} from "@copilotkit/vue/v2";
|
|
389
43
|
```
|
|
390
44
|
|
|
391
|
-
|
|
45
|
+
The root import, `@copilotkit/vue`, re-exports the v2 API and keeps compatibility wrappers for `CopilotKit`, `useCopilotAction`, `useFrontendTool`, and `useCopilotReadable`. The legacy tool wrappers accept `Parameter[]` definitions. Use `/v2` for the current Standard Schema tool APIs, including Zod, Valibot, and ArkType schemas.
|
|
46
|
+
|
|
47
|
+
In Vue templates, camelCase props become kebab-case attributes. For example, `runtimeUrl` is written as `runtime-url`, and boolean or object props use `:` bindings such as `:enable-inspector="false"`. Vue rendering customization uses named and scoped slots where React uses render props.
|
|
392
48
|
|
|
393
|
-
|
|
394
|
-
- `toolsMenu`: nested menu items + separators (`"-"`)
|
|
395
|
-
- `positioning`: `"static" | "absolute"`
|
|
396
|
-
- `keyboardHeight`: number (mobile keyboard offset)
|
|
397
|
-
- `showDisclaimer`: explicit override, otherwise defaults by positioning
|
|
49
|
+
## Documentation
|
|
398
50
|
|
|
399
|
-
|
|
51
|
+
- [Vue getting started guide](https://docs.copilotkit.ai/vue)
|
|
52
|
+
- [Vue API reference](https://docs.copilotkit.ai/reference/vue)
|
|
400
53
|
|
|
401
|
-
|
|
402
|
-
- `start-transcribe-button`, `cancel-transcribe-button`, `finish-transcribe-button`
|
|
403
|
-
- `audio-recorder`, `disclaimer`, `layout`
|
|
54
|
+
The full Vue docs cover runtime setup, prebuilt chat components, composables, tools, threads, interrupts, attachments, voice, and customization.
|