@copilotkit/vue 1.75.2 → 1.77.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/PARITY.md +93 -35
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +275 -158
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-JCCE1lgH.cjs +79 -0
- package/dist/use-render-activity-message-JCCE1lgH.cjs.map +1 -0
- package/dist/use-render-activity-message-bPlnHjQV.js +12499 -0
- package/dist/use-render-activity-message-bPlnHjQV.js.map +1 -0
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts +10 -42
- package/dist/v2/components/MCPAppsActivityRenderer.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts +8 -152
- package/dist/v2/components/chat/CopilotChatAssistantMessage.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatView.vue.d.ts +1 -1
- package/dist/v2/components/chat/CopilotPopupViewInternal.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/copilotChatToolCallItemRender.d.ts.map +1 -1
- package/dist/v2/components/chat/index.d.ts +3 -3
- package/dist/v2/hooks/use-agent.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.d.cts +2 -0
- package/dist/v2/index.d.mts +2 -0
- package/dist/v2/index.d.ts +2 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.mjs +189 -72
- package/dist/v2/index.mjs.map +1 -1
- package/package.json +8 -7
- package/src/v2/__tests__/utils/test-helpers.ts +26 -6
- package/src/v2/components/MCPAppsActivityRenderer.ts +175 -658
- package/src/v2/components/__tests__/MCPAppsActivityRenderer.test.ts +39 -20
- package/src/v2/components/__tests__/MCPAppsActivityRendererContentError.test.ts +122 -0
- package/src/v2/components/__tests__/MCPAppsActivityRendererSeed.test.ts +109 -0
- package/src/v2/components/chat/CopilotChat.vue +100 -20
- package/src/v2/components/chat/CopilotPopupViewInternal.vue +1 -1
- package/src/v2/components/chat/__tests__/CopilotChat.clearOnFresh.test.ts +130 -2
- package/src/v2/components/chat/__tests__/CopilotChat.e2e.test.ts +6 -1
- package/src/v2/components/chat/__tests__/CopilotChatToolRendering.e2e.test.ts +22 -40
- package/src/v2/components/chat/__tests__/CopilotChatToolRerenders.e2e.test.ts +12 -24
- package/src/v2/components/chat/__tests__/CopilotPopupView.slots.e2e.test.ts +20 -0
- package/src/v2/components/chat/copilotChatToolCallItemRender.ts +3 -2
- package/src/v2/hooks/__tests__/use-agent-headers.test.ts +83 -0
- package/src/v2/hooks/__tests__/use-agent-stability.test.ts +2 -0
- package/src/v2/hooks/__tests__/use-agent.e2e.test.ts +5 -3
- package/src/v2/hooks/__tests__/use-frontend-tool.e2e.test.ts +2 -2
- package/src/v2/hooks/use-agent.ts +3 -3
- package/src/v2/index.ts +5 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.renderCustomMessages.e2e.test.ts +6 -4
- package/vite.config.ts +7 -0
- package/dist/use-render-activity-message-CGdS03Xj.cjs +0 -85
- package/dist/use-render-activity-message-CGdS03Xj.cjs.map +0 -1
- package/dist/use-render-activity-message-XmuT9fKy.js +0 -9799
- package/dist/use-render-activity-message-XmuT9fKy.js.map +0 -1
package/PARITY.md
CHANGED
|
@@ -167,6 +167,53 @@ This preserves semantic parity with React while avoiding a Vue API that requires
|
|
|
167
167
|
4. Do not require Vue consumers to write `h(...)` render functions or TSX for the primary usage path.
|
|
168
168
|
5. Keep divergence minimal and explicit: runtime semantics should still match React.
|
|
169
169
|
|
|
170
|
+
## Architectural decision: MCP Apps host -> shared framework-agnostic package
|
|
171
|
+
|
|
172
|
+
`MCPAppsActivityRenderer` no longer implements the app<->host protocol. Vue
|
|
173
|
+
consumes `@copilotkit/mcp-apps-renderer` - the same package react-core and
|
|
174
|
+
Angular use - so the renderer is a thin adapter: it owns the iframe
|
|
175
|
+
(create/mount/size/remove) and wires session hooks to Vue refs, while
|
|
176
|
+
`bindMcpApp` owns the protocol.
|
|
177
|
+
|
|
178
|
+
### Rule
|
|
179
|
+
|
|
180
|
+
- The hand-rolled JSON-RPC router, sandbox HTML builder, request queue and
|
|
181
|
+
`PROTOCOL_VERSION` literal are deleted, not re-implemented per frontend.
|
|
182
|
+
- The bridge-free `/activity` entry is re-exported for activity registration;
|
|
183
|
+
the bridge itself loads through a dynamic `import()` so a non-MCP app does not
|
|
184
|
+
pay for it. Both the root entry and its subpaths stay `external` in
|
|
185
|
+
`vite.config.ts` so that lazy boundary survives the build.
|
|
186
|
+
- Session, iframe and fetched resource are held in `shallowRef` (Vue reactivity
|
|
187
|
+
boundary: they cross into the widget and proxies are not clone-safe).
|
|
188
|
+
- The bind watcher takes the container element as a source: an `immediate`
|
|
189
|
+
watcher runs before the template ref is populated.
|
|
190
|
+
|
|
191
|
+
### Observable behavior changes vs the previous Vue host
|
|
192
|
+
|
|
193
|
+
1. Protocol version moves from the hardcoded `2025-06-18` to the ext-apps
|
|
194
|
+
negotiated version; the host returns its own version rather than echoing the
|
|
195
|
+
widget's.
|
|
196
|
+
2. `ui/initialize` is validated against the spec schema by the bridge, so a
|
|
197
|
+
widget omitting required fields (e.g. `appCapabilities`) now fails initialize
|
|
198
|
+
instead of receiving a lenient hand-rolled response.
|
|
199
|
+
3. `ui/open-link` follows one policy shared by all three frontends: a scheme
|
|
200
|
+
denylist (`javascript:`, `data:`, `vbscript:`, `blob:`, `file:`) that keeps
|
|
201
|
+
custom-scheme deep links working, plus two guarantees Vue did not have -
|
|
202
|
+
embedded credentials refused, and `/path` style relative links resolved.
|
|
203
|
+
4. `ui/message` gains the `_meta.copilotkit` extension channel (top-level
|
|
204
|
+
`role`/`followUp` still honored) and the issue #5819 thread-capture guard.
|
|
205
|
+
5. Tool input/result are pushed by the session itself for activities that live in
|
|
206
|
+
the agent's message store, keyed on the activity `messageId`; the adapter only
|
|
207
|
+
forwards content for activities rendered from an external messages list.
|
|
208
|
+
6. The iframe is created up front and kept across tool input/result updates: it is
|
|
209
|
+
recreated only when the widget identity (`resourceUri`/`serverHash`/
|
|
210
|
+
`serverId`), the agent, the host or the message id changes.
|
|
211
|
+
7. Queue guarantees are shared rather than local: a 30s busy-agent timeout, and
|
|
212
|
+
teardown cancels the requests this widget owns instead of every request on its
|
|
213
|
+
thread. Only _waiting_ work is cancelled - `runAgent` exposes no abort.
|
|
214
|
+
8. Content rejected by the schema is reported as RECOVERABLE (`onContentError`)
|
|
215
|
+
and cleared when valid content resumes, distinct from a fatal session error.
|
|
216
|
+
|
|
170
217
|
## Vue-specific translation principles
|
|
171
218
|
|
|
172
219
|
- Providers:
|
|
@@ -333,8 +380,16 @@ Status values:
|
|
|
333
380
|
- `matched`: equivalent behavior and tests exist.
|
|
334
381
|
- `partial`: some behavior/tests exist, but parity depth is incomplete.
|
|
335
382
|
- `intentional-divergence`: API shape differs by design, behavior parity still required.
|
|
383
|
+
- `unmapped`: the React suite has no Vue counterpart yet. The behavior may be
|
|
384
|
+
covered elsewhere (a shared package, another frontend), which the note states;
|
|
385
|
+
it is still a Vue-side gap.
|
|
386
|
+
- `vue-only`: a Vue suite with no React counterpart. Used when Vue covers a
|
|
387
|
+
contract React has not pinned down yet, so the gap is on the React side; it is
|
|
388
|
+
not a licence to add Vue-specific coverage instead of mirroring React.
|
|
336
389
|
|
|
337
|
-
Current snapshot: mapped React->Vue counterpart rows are
|
|
390
|
+
Current snapshot: most mapped React->Vue counterpart rows are `matched` or
|
|
391
|
+
`intentional-divergence`. The exceptions are tracked explicitly in the matrix and
|
|
392
|
+
are all in the MCP Apps area: one `partial`, one `unmapped` and one `vue-only`.
|
|
338
393
|
|
|
339
394
|
### APIs and render model
|
|
340
395
|
|
|
@@ -362,40 +417,43 @@ Current snapshot: mapped React->Vue counterpart rows are either `matched` or `in
|
|
|
362
417
|
|
|
363
418
|
### Chat/component integration
|
|
364
419
|
|
|
365
|
-
| React test anchor | Vue counterpart | Status
|
|
366
|
-
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
367
|
-
| `CopilotChat.e2e.test.tsx` | `CopilotChat.e2e.test.ts` + `CopilotChat.test.ts` | matched
|
|
368
|
-
| `CopilotChatPropsRerender.e2e.test.tsx` | `CopilotChatPropsRerender.e2e.test.ts` | matched
|
|
369
|
-
| `copilot-chat-throttle.test.tsx` | `copilot-chat-throttle.test.ts` | matched
|
|
370
|
-
| `CopilotChat.attachments.test.tsx` | `CopilotChat.attachments.test.ts` | matched
|
|
371
|
-
| `CopilotChat.onError.test.tsx` | `CopilotChat.onError.test.ts` | matched
|
|
372
|
-
| `CopilotChat.slots.e2e.test.tsx` | `CopilotChat.slots.e2e.test.ts` | matched
|
|
373
|
-
| `CopilotChatActivityRendering.e2e.test.tsx` | `CopilotChatActivityRendering.e2e.test.ts` | matched
|
|
374
|
-
| `CopilotChatAssistantMessage.slots.e2e.test.tsx` | `CopilotChatAssistantMessage.slots.e2e.test.ts` | matched
|
|
375
|
-
| `CopilotChatAssistantMessage.test.tsx` | `CopilotChatAssistantMessage.test.ts` | matched
|
|
376
|
-
| `CopilotChatAssistantMessage.thumbs.test.tsx` | `CopilotChatAssistantMessage.thumbs.test.ts` | matched
|
|
377
|
-
| `CopilotChatInput.slots.e2e.test.tsx` | `CopilotChatInput.slots.e2e.test.ts` | matched
|
|
378
|
-
| `CopilotChatInput.test.tsx` | `CopilotChatInput.test.ts` | matched
|
|
379
|
-
| `CopilotChatSuggestionView.slots.e2e.test.tsx` | `CopilotChatSuggestionView.slots.e2e.test.ts` | matched
|
|
380
|
-
| `CopilotChatToolRendering.e2e.test.tsx` | `CopilotChatToolRendering.e2e.test.ts` | matched
|
|
381
|
-
| `CopilotChatToolRerenders.e2e.test.tsx` | `CopilotChatToolRerenders.e2e.test.ts` | matched
|
|
382
|
-
| `MCPAppsActivityRenderer.e2e.test.tsx` | `MCPAppsActivityRenderer.e2e.test.ts` | matched
|
|
383
|
-
| `MCPAppsUiMessage.e2e.test.tsx` | `MCPAppsUiMessage.e2e.test.ts` |
|
|
384
|
-
| `
|
|
385
|
-
| `
|
|
386
|
-
|
|
|
387
|
-
| `
|
|
388
|
-
| `
|
|
389
|
-
| `
|
|
390
|
-
| `
|
|
391
|
-
| `
|
|
392
|
-
| `CopilotChatView.
|
|
393
|
-
| `
|
|
394
|
-
|
|
|
395
|
-
|
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
398
|
-
| `
|
|
420
|
+
| React test anchor | Vue counterpart | Status | Notes |
|
|
421
|
+
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
422
|
+
| `CopilotChat.e2e.test.tsx` | `CopilotChat.e2e.test.ts` + `CopilotChat.test.ts` | matched | Full strict counterpart exists with React-matching suite/case wording and now passes on Vue chat-flow boundaries. |
|
|
423
|
+
| `CopilotChatPropsRerender.e2e.test.tsx` | `CopilotChatPropsRerender.e2e.test.ts` | matched | Dedicated strict counterpart now covers FOR-75 rerender stability parity through Vue slot analogues (`messageView` + `labels` inline-object regressions) with deterministic render-count assertions. |
|
|
424
|
+
| `copilot-chat-throttle.test.tsx` | `copilot-chat-throttle.test.ts` | matched | Dedicated strict counterpart verifies `CopilotChat` throttle forwarding and `CopilotSidebarProps`/`CopilotPopupProps` throttle inheritance parity. |
|
|
425
|
+
| `CopilotChat.attachments.test.tsx` | `CopilotChat.attachments.test.ts` | matched | Dedicated strict counterpart mirrors React `onUploadFailed` coverage (`invalid-type`, `file-too-large`, `upload-failed`, multi-reject, and valid-file no-failure), validates Vue attachment drop flow through `CopilotChat`, and now asserts stable attachment action identities across input-only rerenders. Attachment public-surface closure is complete via exported `CopilotChatAttachmentQueue` / `CopilotChatAttachmentRenderer` plus `Attachment` / `AttachmentsConfig` / `AttachmentModality` type exports. |
|
|
426
|
+
| `CopilotChat.onError.test.tsx` | `CopilotChat.onError.test.ts` | matched | Dedicated strict counterpart exists with React-matching suite and case wording. |
|
|
427
|
+
| `CopilotChat.slots.e2e.test.tsx` | `CopilotChat.slots.e2e.test.ts` | matched | Dedicated slot forwarding and override suite. |
|
|
428
|
+
| `CopilotChatActivityRendering.e2e.test.tsx` | `CopilotChatActivityRendering.e2e.test.ts` | matched | Suite/case titles and approach now match React, including the agent handed to activity renderers (now the registry agent with the thread pinned onto it, since thread cloning was removed), both `MockReconnectableAgent` durable-compaction restoration cases (`a2ui-surface` and `open-generative-ui`), and the `IntelligenceAgent /connect` gateway-replay restoration case (`restores a completed A2UI surface from IntelligenceAgent /connect gateway replay`) ported on `N3` with colocated Phoenix mock infrastructure (`MockPhoenixPush` / `MockPhoenixChannel` / `MockPhoenixSocket` / `mockPhoenixSockets` / `triggerJoin` / `serverPush`). |
|
|
429
|
+
| `CopilotChatAssistantMessage.slots.e2e.test.tsx` | `CopilotChatAssistantMessage.slots.e2e.test.ts` | matched | Dedicated strict slot counterpart now mirrors React section/case structure (`26` cases) using Vue slot translation boundaries. |
|
|
430
|
+
| `CopilotChatAssistantMessage.test.tsx` | `CopilotChatAssistantMessage.test.ts` | matched | Dedicated strict counterpart now mirrors the React unit suite structure/case wording (`32` mirrored cases) using Vue slot translation, including a `#layout` counterpart for children-render-prop coverage; Vue-only checks are isolated in a trailing block. |
|
|
431
|
+
| `CopilotChatAssistantMessage.thumbs.test.tsx` | `CopilotChatAssistantMessage.thumbs.test.ts` | matched | Dedicated strict counterpart for the React `#3457` thumbs callback payload fix. Asserts `@thumbs-up` / `@thumbs-down` emit the full `AssistantMessage` payload (id/role/content) and not an event-shaped object (no `nativeEvent`, `target`, or `currentTarget`). |
|
|
432
|
+
| `CopilotChatInput.slots.e2e.test.tsx` | `CopilotChatInput.slots.e2e.test.ts` | matched | Dedicated strict slot counterpart now mirrors the full React matrix (`48` cases) with Vue slot-first translation and React-matching section/case wording. |
|
|
433
|
+
| `CopilotChatInput.test.tsx` | `CopilotChatInput.test.ts` | matched | Dedicated strict counterpart mirrors the React suite/case structure and depth, including slash-command behavior plus the trailing container-dimension cache block (resize invalidation, warm-cache keystrokes, and fallback paths). Now also includes an "IME composition parity" block mirroring the React `#3318` guard (no-submit on Enter during composition, `isComposing: true` suppression, `keyCode === 229` suppression, and `compositionend`-then-submit) and the React `#3593` controlled-input clear-notification regressions that assert `update:modelValue("")` is emitted after button-click and Enter-key submits in controlled mode. |
|
|
434
|
+
| `CopilotChatSuggestionView.slots.e2e.test.tsx` | `CopilotChatSuggestionView.slots.e2e.test.ts` | matched | Dedicated strict counterpart mirrors the React section/case structure across container/suggestion slots, children-render-function drill-down, and loading-state scenarios using Vue slot translation. |
|
|
435
|
+
| `CopilotChatToolRendering.e2e.test.tsx` | `CopilotChatToolRendering.e2e.test.ts` | matched | Dedicated tool rendering/status suite. |
|
|
436
|
+
| `CopilotChatToolRerenders.e2e.test.tsx` | `CopilotChatToolRerenders.e2e.test.ts` | matched | Strict chat-flow parity rewrite is complete and now passes with React-matching rerender-prevention semantics. |
|
|
437
|
+
| `MCPAppsActivityRenderer.e2e.test.tsx` | `MCPAppsActivityRenderer.e2e.test.ts` | matched | Strict counterpart now passes with React-matching MCP activity flow coverage (request/loading/error/content and metadata scenarios). |
|
|
438
|
+
| `MCPAppsUiMessage.e2e.test.tsx` | `MCPAppsUiMessage.e2e.test.ts` | partial | Mirrors `ui/message` continuation semantics (`followUp` default/override behavior plus add-message assertions), but not React's `_meta.copilotkit` extension-channel case nor its thread-change follow-up guard. Marked `partial` per rule 8 rather than left `matched`. |
|
|
439
|
+
| `MCPAppsActivityRendererSeed.test.tsx` | `MCPAppsActivityRendererSeed.test.ts` | matched | Mirrors the self-subscription wiring: `messageId` is handed to `bindMcpApp`, and an activity absent from the agent store is seeded via `syncContent` right after binding (props that never change afterwards). |
|
|
440
|
+
| `MCPAppsProxy.e2e.test.tsx` | _(missing)_ | unmapped | `ui/initialize` negotiation, proxy error codes and the open-link policy are proven at the shared-package level and in Angular, not yet through the Vue adapter. |
|
|
441
|
+
| _(no React counterpart yet)_ | `MCPAppsActivityRendererContentError.test.ts` | vue-only | Vue-first coverage of the recoverable-content contract: a rejected activity update shows an error that DISAPPEARS once valid content resumes, while a fatal session error stays. React wires the same `onContentError` hook but has no DOM counterpart yet. |
|
|
442
|
+
| `A2UIMessageRenderer.test.tsx` | `A2UIMessageRenderer.test.ts` | matched | Dedicated strict counterpart mirrors the React A2UI rendering matrix (surface render, same-surface in-place update via `updateComponents` text flip, multi-surface independence) using the real `@copilotkit/a2ui-renderer` bridge, and asserts strict default-loading parity with React's `DefaultA2UILoading` (animated dot + `"Generating UI..."` label + three shimmer bars at 80% / 60% / 40% widths with staggered `cpk-a2ui-pulse` opacity animation and inline `@keyframes`). Custom `loadingComponent` override contract stays unchanged. |
|
|
443
|
+
| `OpenGenerativeUIRenderer.test.tsx` | `OpenGenerativeUIRenderer.test.ts` | matched | Dedicated strict counterpart mirrors the full React OpenGenerativeUI matrix — placeholder, final/preview sandbox creation, HTML wrapping/joining, `jsFunctions` and `jsExpressions` execution, recreation on html/function changes, `localApi` handler-identity (e.g. `localApi.addToCart.toBe(handler)`) and multi-handler identity, plus the progressive streaming matrix (chunk-arrival preview, throttled updates, preview→final handoff, `cssComplete` gating, non-meaningful body suppression, fast-path skip). |
|
|
444
|
+
| `CopilotChatMessageView.slots.e2e.test.tsx` | `CopilotChatMessageView.slots.e2e.test.ts` | matched | Dedicated slot precedence/fallback suite. |
|
|
445
|
+
| `CopilotChatMessageView.test.tsx` | `CopilotChatMessageView.test.ts` | matched | Dedicated strict counterpart mirrors the React file shape and wording, including activity rendering and duplicate-id deduplication behavior. |
|
|
446
|
+
| `CopilotChatUserMessage.slots.e2e.test.tsx` | `CopilotChatUserMessage.slots.e2e.test.ts` | matched | Dedicated strict slot counterpart now mirrors React section/case structure (`26` cases) using Vue slot composition for API-shape differences. |
|
|
447
|
+
| `CopilotChatView.onClick.e2e.test.tsx` | `CopilotChatView.onClick.e2e.test.ts` | matched | Dedicated strict counterpart now mirrors React section/case structure and behavior boundaries (`29` cases), translated through Vue slots where API shape differs. |
|
|
448
|
+
| `CopilotChatView.slots.e2e.test.tsx` | `CopilotChatView.slots.e2e.test.ts` | matched | Dedicated strict counterpart now mirrors React section/case structure and slot-system matrix (`43` cases), with Vue slot-first translation while preserving behavioral assertions. |
|
|
449
|
+
| `CopilotChatView.pinToSend.test.tsx` | `CopilotChatView.pinToSend.test.ts` | matched | Dedicated strict counterpart for the `pin-to-send` mode parity package (`N2`). Mirrors React case wording 1:1 across `pin-to-send` / `pin-to-bottom` / `none` / boolean back-compat, validating the `data-pin-to-send-spacer` element only renders for `autoScroll === "pin-to-send"`. Trailing Vue-specific block proves `LastUserMessageContext` reactivity (`provide(LastUserMessageKey, ref(...))`) drives `usePinToSend` updates the same way `<Provider value={...}>` rerender does in React. |
|
|
450
|
+
| `CopilotChatView.inputOverlay.test.tsx` | `CopilotChatView.inputOverlay.test.ts` | matched | Dedicated strict counterpart for the `N2` input-overlay parity package. Mirrors React case wording 1:1 across overlay positioning, attachment-queue DOM order above the input, welcome-screen exclusion, and the `paddingBottom = inputContainerHeight + 32` formula. Vue swaps a few React-only testids (`copilot-send-button` → `copilot-chat-input-send`, `copilot-attachment-queue` → `copilot-chat-attachment-queue`) where the React testid does not exist on Vue components. |
|
|
451
|
+
| `normalize-auto-scroll.test.ts` | `normalize-auto-scroll.test.ts` | matched | Dedicated strict counterpart for the `N2` `AutoScrollMode` helper. Mirrors React case wording 1:1 across all 7 cases (default, boolean back-compat, string passthrough, unknown-string fallback). |
|
|
452
|
+
| React `CopilotChatInput.tsx` `bottomAnchored` prop + `CopilotChatView.tsx` main-overlay forwarding | `CopilotChatInput.bottomAnchored.test.ts` | matched | Dedicated Vue counterpart for the `P1` license-banner offset contract (no React test counterpart exists at this granularity, so the file documents the Vue-side contract directly). Verifies `padding-bottom: var(--copilotkit-license-banner-offset, 0px)` is applied on the `[data-testid="copilot-chat-input-container"]` when `positioning="absolute"`, when `bottomAnchored=true` with `positioning="static"`, and is **not** applied for the welcome-screen static input. Also asserts `CopilotChatView`'s main run-state input forwards `bottomAnchored=true`. |
|
|
453
|
+
| React `CopilotChat.tsx` / `CopilotSidebar.tsx` / `CopilotPopup.tsx` inline feature-warning surface | `CopilotChat.licenseWarning.test.ts` | matched | Dedicated Vue counterpart for the `P1` inline license-warning parity surface. Mirrors React's `InlineFeatureWarning featureName="Chat"` / `"Sidebar"` / `"Popup"` rendering and `console.warn('[CopilotKit] Warning: "<feature>" feature is not licensed. Visit copilotkit.ai/pricing')` semantics. The default permissive `createLicenseContextValue(null)` path renders no warning; an explicit gated `LicenseContextKey` provided **inside** `CopilotKitProvider` (which itself re-`provide`s the permissive default) renders the inline warning + emits the matching console warning. |
|
|
454
|
+
| `CopilotModalHeader.slots.e2e.test.tsx` | `CopilotModalHeader.slots.e2e.test.ts` | matched | Dedicated strict counterpart now mirrors React section/case structure (`24` cases) via Vue slot translation, including layout/drill-down and mixed integration scenarios. |
|
|
455
|
+
| `CopilotPopupView.slots.e2e.test.tsx` | `CopilotPopupView.slots.e2e.test.ts` | matched | Dedicated strict counterpart now mirrors the full React section/case structure (`31` cases) across header slots, inherited chat-view slots, popup-specific props, integration, and toggle-button matrix. |
|
|
456
|
+
| `CopilotSidebarView.slots.e2e.test.tsx` | `CopilotSidebarView.slots.e2e.test.ts` | matched | Dedicated strict counterpart now mirrors the full React section/case structure (`25` cases) across header slots, inherited chat-view slots, width/mixed customization, integration, and toggle-button matrix. |
|
|
399
457
|
|
|
400
458
|
### Hooks and integration depth
|
|
401
459
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("@copilotkit/core"),A=require("@ag-ui/client"),e=require("./use-render-activity-message-CGdS03Xj.cjs"),i=require("vue"),C=require("@copilotkit/shared");function f(n){return typeof n!="function"?n:(o=>{const a=typeof o.result=="string"?{...o,result:C.parseJson(o.result,o.result)}:o;return n(a)})}function b(n,o){const a="parameters"in n?C.getZodParameters(n.parameters):void 0;if(n.name==="*"){e.useRenderTool({name:"*",render:f(n.render),..."agentId"in n?{agentId:n.agentId}:{}},o);return}const t=n;if("renderAndWaitForResponse"in t||"renderAndWait"in t){const l=t.render??t.renderAndWaitForResponse??t.renderAndWait;if(!l){console.warn(`[CopilotKit] useCopilotAction: HITL action '${t.name}' has no render function. Skipping.`);return}e.useHumanInTheLoop({name:t.name,description:t.description,parameters:a,render:f(l),agentId:t.agentId},o);return}if(t.available==="frontend"||t.available==="disabled"){t.render&&a?e.useRenderTool({name:t.name,parameters:a,render:f(t.render),agentId:t.agentId},o):console.warn(`[CopilotKit] useCopilotAction: action '${t.name}' with available="${t.available}" requires both 'render' and 'parameters'. Skipping registration.`);return}const c=t.handler?l=>Promise.resolve(t.handler(l)):void 0;let s;t.available==="remote"?s=!1:t.available!==void 0&&(s=!0),e.useFrontendTool({name:t.name,description:t.description,parameters:a,handler:c,followUp:t.followUp,render:f(t.render),available:s,agentId:t.agentId,get webmcp(){return t.webmcp}},o)}function _(n,o){const{name:a,description:t,parameters:c,handler:s,followUp:l,available:m,render:u,agentId:d}=n,p=C.getZodParameters(c),g=s?r=>Promise.resolve(s(r)):void 0,v=typeof u=="function"?r=>{const h=typeof r.result=="string"?{...r,result:C.parseJson(r.result,r.result)}:r;return u(h)}:u;e.useFrontendTool({name:a,description:t,parameters:p,handler:g,followUp:l,render:v,available:m===void 0?void 0:m!=="disabled",agentId:d,get webmcp(){return n.webmcp}},o)}function I(n,o){const{copilotkit:a}=e.useCopilotKit(),t=i.ref(void 0),c=o??[];return i.watch([()=>n.description,()=>n.value,()=>n.convert,()=>n.available,...c],(s,l,m)=>{const u=a.value;if(!u)return;const{description:d,value:p,convert:g,available:v}=n;let r;try{r=g?g(d,p):JSON.stringify(p)}catch(h){console.warn(`[CopilotKit] useCopilotReadable: failed to serialize value for "${d}":`,h),r=String(p)}v!=="disabled"&&(t.value=u.addContext({description:d,value:r}),m(()=>{t.value&&u.removeContext(t.value)}))},{immediate:!0}),t}const T=i.defineComponent({__name:"CopilotKit",props:{publicApiKey:{},publicLicenseKey:{},runtimeUrl:{},headers:{type:[Object,Function]},credentials:{},messageFilter:{type:Function},defaultThrottleMs:{},licenseToken:{},properties:{},useSingleEndpoint:{type:Boolean},agents__unsafe_dev_only:{},selfManagedAgents:{},renderToolCalls:{},renderActivityMessages:{},renderCustomMessages:{},frontendTools:{},humanInTheLoop:{},openGenerativeUI:{},showDevConsole:{type:[Boolean,String]},enableInspector:{type:Boolean},onError:{type:Function},a2ui:{},debug:{type:[Boolean,Object]}},setup(n){const o=n;return(a,t)=>(i.openBlock(),i.createBlock(e._sfc_main$15,i.normalizeProps(i.guardReactiveProps(o)),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16))}});exports.A2UIActivityContentSchema=e.A2UIActivityContentSchema;exports.A2UISurfaceActivityRenderer=e._sfc_main;exports.A2UISurfaceActivityType=e.A2UISurfaceActivityType;exports.CopilotChat=e.CopilotChat;exports.CopilotChatAssistantMessage=e._sfc_main$1;exports.CopilotChatAttachmentQueue=e._sfc_main$2;exports.CopilotChatAttachmentRenderer=e._sfc_main$3;exports.CopilotChatAudioRecorder=e._sfc_main$4;exports.CopilotChatConfigurationProvider=e._sfc_main$5;exports.CopilotChatDefaultLabels=e.CopilotChatDefaultLabels;exports.CopilotChatInput=e._sfc_main$6;exports.CopilotChatMessageView=e._sfc_main$7;exports.CopilotChatReasoningMessage=e._sfc_main$8;exports.CopilotChatSuggestionPill=e._sfc_main$9;exports.CopilotChatSuggestionView=e._sfc_main$10;exports.CopilotChatToggleButton=e.CopilotChatToggleButton;exports.CopilotChatToggleButtonCloseIcon=e.CopilotChatToggleButtonCloseIcon;exports.CopilotChatToggleButtonOpenIcon=e.CopilotChatToggleButtonOpenIcon;exports.CopilotChatToolCallsView=e._sfc_main$11;exports.CopilotChatUserMessage=e._sfc_main$12;exports.CopilotChatView=e._sfc_main$13;exports.CopilotKitCoreVue=e.CopilotKitCoreVue;exports.CopilotKitInspector=e._sfc_main$14;exports.CopilotKitProvider=e._sfc_main$15;exports.CopilotModalHeader=e.CopilotModalHeader;exports.CopilotPopup=e._sfc_main$16;exports.CopilotPopupView=e.CopilotPopupView;exports.CopilotSidebar=e._sfc_main$17;exports.CopilotSidebarView=e.CopilotSidebarView;exports.CopilotThreadsDrawer=e._sfc_main$18;exports.GenerateSandboxedUiArgsSchema=e.GenerateSandboxedUiArgsSchema;exports.LicenseContextKey=e.LicenseContextKey;exports.MCPAppsActivityContentSchema=e.MCPAppsActivityContentSchema;exports.MCPAppsActivityRenderer=e.MCPAppsActivityRenderer;exports.MCPAppsActivityType=e.MCPAppsActivityType;exports.OpenGenerativeUIActivityRenderer=e.OpenGenerativeUIActivityRenderer;exports.OpenGenerativeUIActivityType=e.OpenGenerativeUIActivityType;exports.OpenGenerativeUIContentSchema=e.OpenGenerativeUIContentSchema;exports.OpenGenerativeUIRenderer=e.OpenGenerativeUIRenderer;exports.OpenGenerativeUIToolRenderer=e.OpenGenerativeUIToolRenderer;exports.UseAgentUpdate=e.UseAgentUpdate;exports.createA2UIMessageRenderer=e.createA2UIMessageRenderer;exports.createDefaultLicenseRef=e.createDefaultLicenseRef;exports.defineToolCallRenderer=e.defineToolCallRenderer;exports.extractCompleteStyles=e.extractCompleteStyles;exports.getOperationSurfaceId=e.getOperationSurfaceId;exports.processPartialHtml=e.processPartialHtml;exports.useAgent=e.useAgent;exports.useAgentContext=e.useAgentContext;exports.useAttachments=e.useAttachments;exports.useCapabilities=e.useCapabilities;exports.useComponent=e.useComponent;exports.useConfigureSuggestions=e.useConfigureSuggestions;exports.useCopilotChatConfiguration=e.useCopilotChatConfiguration;exports.useCopilotKit=e.useCopilotKit;exports.useDefaultRenderTool=e.useDefaultRenderTool;exports.useHumanInTheLoop=e.useHumanInTheLoop;exports.useInterrupt=e.useInterrupt;exports.useKatexStyles=e.useKatexStyles;exports.useKeyboardHeight=e.useKeyboardHeight;exports.useLicenseContext=e.useLicenseContext;exports.useRenderActivityMessage=e.useRenderActivityMessage;exports.useRenderCustomMessages=e.useRenderCustomMessages;exports.useRenderTool=e.useRenderTool;exports.useSandboxFunctions=e.useSandboxFunctions;exports.useSuggestions=e.useSuggestions;exports.useThreads=e.useThreads;exports.vueBasicCatalog=e.vueBasicCatalog;Object.defineProperty(exports,"createLicenseContextValue",{enumerable:!0,get:()=>C.createLicenseContextValue});exports.CopilotKit=T;exports.useCopilotAction=b;exports.useCopilotReadable=I;exports.useFrontendTool=_;Object.keys(y).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>y[n]})});Object.keys(A).forEach(n=>{n!=="default"&&!Object.prototype.hasOwnProperty.call(exports,n)&&Object.defineProperty(exports,n,{enumerable:!0,get:()=>A[n]})});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("@copilotkit/core"),b=require("@ag-ui/client"),e=require("./use-render-activity-message-JCCE1lgH.cjs"),c=require("vue"),f=require("@copilotkit/mcp-apps-renderer/activity"),h=require("@copilotkit/shared");function C(a){return typeof a!="function"?a:(n=>{const o=typeof n.result=="string"?{...n,result:h.parseJson(n.result,n.result)}:n;return a(o)})}function R(a,n){const o="parameters"in a?h.getZodParameters(a.parameters):void 0;if(a.name==="*"){e.useRenderTool({name:"*",render:C(a.render),..."agentId"in a?{agentId:a.agentId}:{}},n);return}const t=a;if("renderAndWaitForResponse"in t||"renderAndWait"in t){const r=t.render??t.renderAndWaitForResponse??t.renderAndWait;if(!r){console.warn(`[CopilotKit] useCopilotAction: HITL action '${t.name}' has no render function. Skipping.`);return}e.useHumanInTheLoop({name:t.name,description:t.description,parameters:o,render:C(r),agentId:t.agentId},n);return}if(t.available==="frontend"||t.available==="disabled"){t.render&&o?e.useRenderTool({name:t.name,parameters:o,render:C(t.render),agentId:t.agentId},n):console.warn(`[CopilotKit] useCopilotAction: action '${t.name}' with available="${t.available}" requires both 'render' and 'parameters'. Skipping registration.`);return}const l=t.handler?r=>Promise.resolve(t.handler(r)):void 0;let s;t.available==="remote"?s=!1:t.available!==void 0&&(s=!0),e.useFrontendTool({name:t.name,description:t.description,parameters:o,handler:l,followUp:t.followUp,render:C(t.render),available:s,agentId:t.agentId,get webmcp(){return t.webmcp}},n)}function y(a,n){const{name:o,description:t,parameters:l,handler:s,followUp:r,available:p,render:m,agentId:u}=a,S=h.getZodParameters(l),d=s?i=>Promise.resolve(s(i)):void 0,g=typeof m=="function"?i=>{const v=typeof i.result=="string"?{...i,result:h.parseJson(i.result,i.result)}:i;return m(v)}:m;e.useFrontendTool({name:o,description:t,parameters:S,handler:d,followUp:r,render:g,available:p===void 0?void 0:p!=="disabled",agentId:u,get webmcp(){return a.webmcp}},n)}function A(a,n){const{copilotkit:o}=e.useCopilotKit(),t=c.ref(void 0),l=n??[];return c.watch([()=>a.description,()=>a.value,()=>a.convert,()=>a.available,...l],(s,r,p)=>{const m=o.value;if(!m)return;const{description:u,value:S,convert:d,available:g}=a;let i;try{i=d?d(u,S):JSON.stringify(S)}catch(v){console.warn(`[CopilotKit] useCopilotReadable: failed to serialize value for "${u}":`,v),i=String(S)}g!=="disabled"&&(t.value=m.addContext({description:u,value:i}),p(()=>{t.value&&m.removeContext(t.value)}))},{immediate:!0}),t}const T=c.defineComponent({__name:"CopilotKit",props:{publicApiKey:{},publicLicenseKey:{},runtimeUrl:{},headers:{type:[Object,Function]},credentials:{},messageFilter:{type:Function},defaultThrottleMs:{},licenseToken:{},properties:{},useSingleEndpoint:{type:Boolean},agents__unsafe_dev_only:{},selfManagedAgents:{},renderToolCalls:{},renderActivityMessages:{},renderCustomMessages:{},frontendTools:{},humanInTheLoop:{},openGenerativeUI:{},showDevConsole:{type:[Boolean,String]},enableInspector:{type:Boolean},onError:{type:Function},a2ui:{},debug:{type:[Boolean,Object]}},setup(a){const n=a;return(o,t)=>(c.openBlock(),c.createBlock(e._sfc_main$15,c.normalizeProps(c.guardReactiveProps(n)),{default:c.withCtx(()=>[c.renderSlot(o.$slots,"default")]),_:3},16))}});Object.defineProperty(exports,"PROTOCOL_VERSION",{enumerable:!0,get:()=>b.PROTOCOL_VERSION});exports.A2UIActivityContentSchema=e.A2UIActivityContentSchema;exports.A2UISurfaceActivityRenderer=e._sfc_main;exports.A2UISurfaceActivityType=e.A2UISurfaceActivityType;exports.ActivityDeltaEventSchema=e.ActivityDeltaEventSchema;exports.ActivityMessageSchema=e.ActivityMessageSchema;exports.ActivitySnapshotEventSchema=e.ActivitySnapshotEventSchema;exports.AddOperationSchema=e.AddOperationSchema;exports.AgentCapabilitiesSchema=e.AgentCapabilitiesSchema;exports.AssistantMessageSchema=e.AssistantMessageSchema;exports.AttributableSchema=e.AttributableSchema;exports.AudioInputContentSchema=e.AudioPartSchema;exports.AudioInputPartSchema=e.AudioPartSchema;exports.AudioPartSchema=e.AudioPartSchema;exports.BaseEventSchema=e.BaseEventSchema;exports.BaseMessageSchema=e.BaseMessageSchema;exports.ContentPartSchema=e.ContentPartSchema;exports.ContextSchema=e.ContextSchema;exports.CopilotChat=e.CopilotChat;exports.CopilotChatAssistantMessage=e._sfc_main$1;exports.CopilotChatAttachmentQueue=e._sfc_main$2;exports.CopilotChatAttachmentRenderer=e._sfc_main$3;exports.CopilotChatAudioRecorder=e._sfc_main$4;exports.CopilotChatConfigurationProvider=e._sfc_main$5;exports.CopilotChatDefaultLabels=e.CopilotChatDefaultLabels;exports.CopilotChatInput=e._sfc_main$6;exports.CopilotChatMessageView=e._sfc_main$7;exports.CopilotChatReasoningMessage=e._sfc_main$8;exports.CopilotChatSuggestionPill=e._sfc_main$9;exports.CopilotChatSuggestionView=e._sfc_main$10;exports.CopilotChatToggleButton=e.CopilotChatToggleButton;exports.CopilotChatToggleButtonCloseIcon=e.CopilotChatToggleButtonCloseIcon;exports.CopilotChatToggleButtonOpenIcon=e.CopilotChatToggleButtonOpenIcon;exports.CopilotChatToolCallsView=e._sfc_main$11;exports.CopilotChatUserMessage=e._sfc_main$12;exports.CopilotChatView=e._sfc_main$13;exports.CopilotKitCoreVue=e.CopilotKitCoreVue;exports.CopilotKitInspector=e._sfc_main$14;exports.CopilotKitProvider=e._sfc_main$15;exports.CopilotModalHeader=e.CopilotModalHeader;exports.CopilotPopup=e._sfc_main$16;exports.CopilotPopupView=e.CopilotPopupView;exports.CopilotSidebar=e._sfc_main$17;exports.CopilotSidebarView=e.CopilotSidebarView;exports.CopilotThreadsDrawer=e._sfc_main$18;exports.CopyOperationSchema=e.CopyOperationSchema;exports.CustomEventSchema=e.CustomEventSchema;exports.DataSourceSchema=e.DataSourceSchema;exports.DeveloperMessageSchema=e.DeveloperMessageSchema;exports.DocumentInputContentSchema=e.DocumentPartSchema;exports.DocumentInputPartSchema=e.DocumentPartSchema;exports.DocumentPartSchema=e.DocumentPartSchema;exports.EventSchema=e.EventSchema;exports.EventSchemas=e.EventSchema;exports.EventTypeSchema=e.EventTypeSchema;exports.ExecutionCapabilitiesSchema=e.ExecutionCapabilitiesSchema;exports.FileSourceSchema=e.FileSourceSchema;exports.FunctionCallSchema=e.FunctionCallSchema;exports.GenerateSandboxedUiArgsSchema=e.GenerateSandboxedUiArgsSchema;exports.HumanInTheLoopCapabilitiesSchema=e.HumanInTheLoopCapabilitiesSchema;exports.IdentityCapabilitiesSchema=e.IdentityCapabilitiesSchema;exports.ImageInputContentSchema=e.ImagePartSchema;exports.ImageInputPartSchema=e.ImagePartSchema;exports.ImagePartSchema=e.ImagePartSchema;exports.InputContentDataSourceSchema=e.DataSourceSchema;exports.InputContentSchema=e.ContentPartSchema;exports.InputContentSourceSchema=e.PartSourceSchema;exports.InputContentUrlSourceSchema=e.UrlSourceSchema;exports.InterruptSchema=e.InterruptSchema;exports.JsonPatchOperationSchema=e.JsonPatchOperationSchema;exports.JsonPatchSchema=e.JsonPatchSchema;exports.JsonPointerSchema=e.JsonPointerSchema;exports.LicenseContextKey=e.LicenseContextKey;exports.MCPAppsActivityRenderer=e.MCPAppsActivityRenderer;exports.MessageSchema=e.MessageSchema;exports.MessagesSnapshotEventSchema=e.MessagesSnapshotEventSchema;exports.MetadataSchema=e.MetadataSchema;exports.MoveOperationSchema=e.MoveOperationSchema;exports.MultiAgentCapabilitiesSchema=e.MultiAgentCapabilitiesSchema;exports.MultimodalCapabilitiesSchema=e.MultimodalCapabilitiesSchema;exports.MultimodalInputCapabilitiesSchema=e.MultimodalInputCapabilitiesSchema;exports.MultimodalOutputCapabilitiesSchema=e.MultimodalOutputCapabilitiesSchema;exports.OpenGenerativeUIActivityRenderer=e.OpenGenerativeUIActivityRenderer;exports.OpenGenerativeUIActivityType=e.OpenGenerativeUIActivityType;exports.OpenGenerativeUIContentSchema=e.OpenGenerativeUIContentSchema;exports.OpenGenerativeUIRenderer=e.OpenGenerativeUIRenderer;exports.OpenGenerativeUIToolRenderer=e.OpenGenerativeUIToolRenderer;exports.OptionalMetadataSchema=e.OptionalMetadataSchema;exports.OutputCapabilitiesSchema=e.OutputCapabilitiesSchema;exports.PartSourceSchema=e.PartSourceSchema;exports.RawEventSchema=e.RawEventSchema;exports.ReasoningCapabilitiesSchema=e.ReasoningCapabilitiesSchema;exports.ReasoningEncryptedValueEventSchema=e.ReasoningEncryptedValueEventSchema;exports.ReasoningEncryptedValueSubtypeSchema=e.ReasoningEncryptedValueSubtypeSchema;exports.ReasoningEndEventSchema=e.ReasoningEndEventSchema;exports.ReasoningMessageChunkEventSchema=e.ReasoningMessageChunkEventSchema;exports.ReasoningMessageContentEventSchema=e.ReasoningMessageContentEventSchema;exports.ReasoningMessageEndEventSchema=e.ReasoningMessageEndEventSchema;exports.ReasoningMessageSchema=e.ReasoningMessageSchema;exports.ReasoningMessageStartEventSchema=e.ReasoningMessageStartEventSchema;exports.ReasoningStartEventSchema=e.ReasoningStartEventSchema;exports.RemoveOperationSchema=e.RemoveOperationSchema;exports.ReplaceOperationSchema=e.ReplaceOperationSchema;exports.ResumeEntrySchema=e.ResumeEntrySchema;exports.RoleSchema=e.RoleSchema;exports.RunAgentInputSchema=e.RunAgentInputSchema;exports.RunErrorEventSchema=e.RunErrorEventSchema;exports.RunFinishedCancelledOutcomeSchema=e.RunFinishedCancelledOutcomeSchema;exports.RunFinishedEventSchema=e.RunFinishedEventSchema;exports.RunFinishedInterruptOutcomeSchema=e.RunFinishedInterruptOutcomeSchema;exports.RunFinishedOutcomeSchema=e.RunFinishedOutcomeSchema;exports.RunFinishedSuccessOutcomeSchema=e.RunFinishedSuccessOutcomeSchema;exports.RunStartedEventSchema=e.RunStartedEventSchema;exports.StateCapabilitiesSchema=e.StateCapabilitiesSchema;exports.StateDeltaEventSchema=e.StateDeltaEventSchema;exports.StateSchema=e.StateSchema;exports.StateSnapshotEventSchema=e.StateSnapshotEventSchema;exports.StepFinishedEventSchema=e.StepFinishedEventSchema;exports.StepStartedEventSchema=e.StepStartedEventSchema;exports.SubagentErrorEventSchema=e.SubagentErrorEventSchema;exports.SubagentFinishedEventSchema=e.SubagentFinishedEventSchema;exports.SubagentFinishedOutcomeSchema=e.SubagentFinishedOutcomeSchema;exports.SubagentFinishedSuccessOutcomeSchema=e.SubagentFinishedSuccessOutcomeSchema;exports.SubagentFinishedSuspendedOutcomeSchema=e.SubagentFinishedSuspendedOutcomeSchema;exports.SubagentInfoSchema=e.SubagentInfoSchema;exports.SubagentRunIdSchema=e.SubagentRunIdSchema;exports.SubagentStartedEventSchema=e.SubagentStartedEventSchema;exports.SystemMessageSchema=e.SystemMessageSchema;exports.TestOperationSchema=e.TestOperationSchema;exports.TextInputContentSchema=e.TextPartSchema;exports.TextMessageChunkEventSchema=e.TextMessageChunkEventSchema;exports.TextMessageContentEventSchema=e.TextMessageContentEventSchema;exports.TextMessageEndEventSchema=e.TextMessageEndEventSchema;exports.TextMessageRoleSchema=e.TextMessageRoleSchema;exports.TextMessageStartEventSchema=e.TextMessageStartEventSchema;exports.TextPartSchema=e.TextPartSchema;exports.TokenUsageSchema=e.TokenUsageSchema;exports.ToolCallArgsEventSchema=e.ToolCallArgsEventSchema;exports.ToolCallChunkEventSchema=e.ToolCallChunkEventSchema;exports.ToolCallEndEventSchema=e.ToolCallEndEventSchema;exports.ToolCallResultEventSchema=e.ToolCallResultEventSchema;exports.ToolCallSchema=e.ToolCallSchema;exports.ToolCallStartEventSchema=e.ToolCallStartEventSchema;exports.ToolMessageSchema=e.ToolMessageSchema;exports.ToolSchema=e.ToolSchema;exports.ToolsCapabilitiesSchema=e.ToolsCapabilitiesSchema;exports.TransportCapabilitiesSchema=e.TransportCapabilitiesSchema;exports.UrlSourceSchema=e.UrlSourceSchema;exports.UseAgentUpdate=e.UseAgentUpdate;exports.UserMessageSchema=e.UserMessageSchema;exports.VideoInputContentSchema=e.VideoPartSchema;exports.VideoInputPartSchema=e.VideoPartSchema;exports.VideoPartSchema=e.VideoPartSchema;exports.createA2UIMessageRenderer=e.createA2UIMessageRenderer;exports.createDefaultLicenseRef=e.createDefaultLicenseRef;exports.defineToolCallRenderer=e.defineToolCallRenderer;exports.extractCompleteStyles=e.extractCompleteStyles;exports.getOperationSurfaceId=e.getOperationSurfaceId;exports.processPartialHtml=e.processPartialHtml;exports.useAgent=e.useAgent;exports.useAgentContext=e.useAgentContext;exports.useAttachments=e.useAttachments;exports.useCapabilities=e.useCapabilities;exports.useComponent=e.useComponent;exports.useConfigureSuggestions=e.useConfigureSuggestions;exports.useCopilotChatConfiguration=e.useCopilotChatConfiguration;exports.useCopilotKit=e.useCopilotKit;exports.useDefaultRenderTool=e.useDefaultRenderTool;exports.useHumanInTheLoop=e.useHumanInTheLoop;exports.useInterrupt=e.useInterrupt;exports.useKatexStyles=e.useKatexStyles;exports.useKeyboardHeight=e.useKeyboardHeight;exports.useLicenseContext=e.useLicenseContext;exports.useRenderActivityMessage=e.useRenderActivityMessage;exports.useRenderCustomMessages=e.useRenderCustomMessages;exports.useRenderTool=e.useRenderTool;exports.useSandboxFunctions=e.useSandboxFunctions;exports.useSuggestions=e.useSuggestions;exports.useThreads=e.useThreads;exports.vueBasicCatalog=e.vueBasicCatalog;Object.defineProperty(exports,"MCPAppsActivityContentSchema",{enumerable:!0,get:()=>f.MCPAppsActivityContentSchema});Object.defineProperty(exports,"MCPAppsActivityType",{enumerable:!0,get:()=>f.MCPAppsActivityType});Object.defineProperty(exports,"ɵrunMcpFollowUp",{enumerable:!0,get:()=>f.ɵrunMcpFollowUp});Object.defineProperty(exports,"createLicenseContextValue",{enumerable:!0,get:()=>h.createLicenseContextValue});exports.CopilotKit=T;exports.useCopilotAction=R;exports.useCopilotReadable=A;exports.useFrontendTool=y;Object.keys(E).forEach(a=>{a!=="default"&&!Object.prototype.hasOwnProperty.call(exports,a)&&Object.defineProperty(exports,a,{enumerable:!0,get:()=>E[a]})});Object.keys(b).forEach(a=>{a!=="default"&&!Object.prototype.hasOwnProperty.call(exports,a)&&Object.defineProperty(exports,a,{enumerable:!0,get:()=>b[a]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/hooks/use-copilot-action.ts","../src/hooks/use-frontend-tool.ts","../src/hooks/use-copilot-readable.ts","../src/components/copilot-provider/CopilotKit.vue"],"sourcesContent":["/**\n * V1 compatibility wrapper for useCopilotAction.\n *\n * Accepts the legacy Parameter[] action format and routes to the appropriate\n * v2 composable (useFrontendTool, useHumanInTheLoop, or useRenderTool).\n */\nimport type { WatchSource } from \"vue\";\nimport type { WebMCPToolConfig } from \"@copilotkit/core\";\nimport type { Parameter, MappedParameterTypes } from \"@copilotkit/shared\";\nimport { getZodParameters, parseJson } from \"@copilotkit/shared\";\nimport { useFrontendTool as useFrontendToolV2 } from \"../v2/hooks/use-frontend-tool\";\nimport { useHumanInTheLoop as useHumanInTheLoopV2 } from \"../v2/hooks/use-human-in-the-loop\";\nimport { useRenderTool as useRenderToolV2 } from \"../v2/hooks/use-render-tool\";\nimport type { VueFrontendTool, VueHumanInTheLoop } from \"../v2/types\";\n\n// Wraps a v1 render function so a JSON-string `result` is parsed before being\n// passed through. Mirrors the v1 React behavior. If render is a Component\n// (object) rather than a function, returns it unchanged — Components receive\n// props through Vue's prop system and the user is responsible for parsing.\nfunction wrapRenderWithJsonResult<R>(render: R): R {\n if (typeof render !== \"function\") return render;\n return ((props: { result?: unknown }) => {\n const next =\n typeof props.result === \"string\"\n ? { ...props, result: parseJson(props.result, props.result) }\n : props;\n return (render as (p: unknown) => unknown)(next);\n }) as R;\n}\n\nexport interface FrontendAction<T extends Parameter[] | [] = []> {\n name: string;\n description?: string;\n parameters?: T;\n handler?: (args: MappedParameterTypes<T>) => unknown | Promise<unknown>;\n followUp?: boolean;\n available?: \"disabled\" | \"enabled\" | \"remote\" | \"frontend\";\n render?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n renderAndWaitForResponse?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n renderAndWait?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n agentId?: string;\n /**\n * Also expose this action to browser agents through the WebMCP API\n * (`document.modelContext`). `true` uses default annotations;\n * `{ annotations }` provides WebMCP annotations.\n */\n webmcp?: boolean | WebMCPToolConfig;\n}\n\nexport interface CatchAllFrontendAction {\n name: \"*\";\n render: (props: unknown) => unknown;\n}\n\nexport function useCopilotAction<const T extends Parameter[] | [] = []>(\n action: FrontendAction<T> | CatchAllFrontendAction,\n deps?: WatchSource<unknown>[],\n): void {\n const zodParameters =\n \"parameters\" in action\n ? getZodParameters(action.parameters as T)\n : undefined;\n\n // Catch-all render action\n if (action.name === \"*\") {\n useRenderToolV2(\n {\n name: \"*\",\n render: wrapRenderWithJsonResult(\n (action as CatchAllFrontendAction).render,\n ),\n ...(\"agentId\" in action\n ? { agentId: (action as FrontendAction<T>).agentId }\n : {}),\n },\n deps,\n );\n return;\n }\n\n const typedAction = action as FrontendAction<T>;\n\n // Human-in-the-loop: has renderAndWaitForResponse or renderAndWait\n if (\n \"renderAndWaitForResponse\" in typedAction ||\n \"renderAndWait\" in typedAction\n ) {\n const render =\n typedAction.render ??\n typedAction.renderAndWaitForResponse ??\n typedAction.renderAndWait;\n\n if (!render) {\n console.warn(\n `[CopilotKit] useCopilotAction: HITL action '${typedAction.name}' ` +\n `has no render function. Skipping.`,\n );\n return;\n }\n\n useHumanInTheLoopV2<MappedParameterTypes<T>>(\n {\n name: typedAction.name,\n description: typedAction.description,\n parameters: zodParameters,\n render: wrapRenderWithJsonResult(render) as VueHumanInTheLoop<\n MappedParameterTypes<T>\n >[\"render\"],\n agentId: typedAction.agentId,\n },\n deps,\n );\n return;\n }\n\n // Render-only: available is \"frontend\" or \"disabled\" (no handler invoked remotely)\n if (\n typedAction.available === \"frontend\" ||\n typedAction.available === \"disabled\"\n ) {\n if (typedAction.render && zodParameters) {\n useRenderToolV2(\n {\n name: typedAction.name,\n parameters: zodParameters,\n render: wrapRenderWithJsonResult(\n typedAction.render as (props: unknown) => unknown,\n ),\n agentId: typedAction.agentId,\n },\n deps,\n );\n } else {\n console.warn(\n `[CopilotKit] useCopilotAction: action '${typedAction.name}' ` +\n `with available=\"${typedAction.available}\" requires both ` +\n `'render' and 'parameters'. Skipping registration.`,\n );\n }\n return;\n }\n\n // Default: frontend tool with handler\n // Wrap the v1 handler (single-arg) to match v2's (args, context) => Promise<unknown> signature\n const normalizedHandler = typedAction.handler\n ? (args: MappedParameterTypes<T>) =>\n Promise.resolve(typedAction.handler!(args))\n : undefined;\n\n // Convert v1 available (string enum) to v2 available (boolean)\n // At this point, \"frontend\" and \"disabled\" have been handled above,\n // so remaining values are \"enabled\", \"remote\", or undefined.\n // \"remote\" means server-only: register the tool but mark it as not\n // available on the frontend (matches React's ActionInputAvailability.Remote).\n let normalizedAvailable: boolean | undefined;\n if (typedAction.available === \"remote\") {\n normalizedAvailable = false;\n } else if (typedAction.available !== undefined) {\n normalizedAvailable = true;\n }\n\n useFrontendToolV2<MappedParameterTypes<T>>(\n {\n name: typedAction.name,\n description: typedAction.description,\n parameters: zodParameters,\n handler: normalizedHandler,\n followUp: typedAction.followUp,\n render: wrapRenderWithJsonResult(typedAction.render),\n available: normalizedAvailable,\n agentId: typedAction.agentId,\n // Read webmcp at watch time: the action object may expose it as a getter\n // over reactive state, and capturing the initial value here would\n // re-register a stale configuration.\n get webmcp() {\n return typedAction.webmcp;\n },\n },\n deps,\n );\n}\n","/**\n * V1 compatibility wrapper for useFrontendTool.\n *\n * Accepts the legacy Parameter[] format and converts to Zod via getZodParameters,\n * then delegates to the v2 composable.\n */\nimport type { WatchSource } from \"vue\";\nimport type { WebMCPToolConfig } from \"@copilotkit/core\";\nimport {\n type Parameter,\n type MappedParameterTypes,\n getZodParameters,\n parseJson,\n} from \"@copilotkit/shared\";\nimport { useFrontendTool as useFrontendToolV2 } from \"../v2/hooks/use-frontend-tool\";\nimport type { VueFrontendTool } from \"../v2/types\";\n\nexport interface UseFrontendToolArgs<T extends Parameter[] | [] = []> {\n name: string;\n description?: string;\n parameters?: T;\n handler?: (args: MappedParameterTypes<T>) => unknown | Promise<unknown>;\n followUp?: boolean;\n available?: \"disabled\" | \"enabled\";\n render?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n agentId?: string;\n /**\n * Also expose this tool to browser agents through the WebMCP API\n * (`document.modelContext`). `true` uses default annotations;\n * `{ annotations }` provides WebMCP annotations.\n */\n webmcp?: boolean | WebMCPToolConfig;\n}\n\nexport function useFrontendTool<const T extends Parameter[] = []>(\n tool: UseFrontendToolArgs<T>,\n deps?: WatchSource<unknown>[],\n) {\n const {\n name,\n description,\n parameters,\n handler,\n followUp,\n available,\n render,\n agentId,\n } = tool;\n const zodParameters = getZodParameters(parameters);\n\n // Wrap the v1 handler (single-arg) to match v2's (args, context) => Promise<unknown> signature\n const normalizedHandler = handler\n ? (args: MappedParameterTypes<T>) => Promise.resolve(handler(args))\n : undefined;\n\n // Wrap render to parse JSON-string results before passing them to the\n // user's render function — matches the v1 React behavior. If render is a\n // Component rather than a function, leave it unchanged.\n const normalizedRender =\n typeof render === \"function\"\n ? (props: { result?: unknown }) => {\n const renderProps =\n typeof props.result === \"string\"\n ? { ...props, result: parseJson(props.result, props.result) }\n : props;\n return (render as (p: unknown) => unknown)(renderProps);\n }\n : render;\n\n useFrontendToolV2<MappedParameterTypes<T>>(\n {\n name,\n description,\n parameters: zodParameters,\n handler: normalizedHandler,\n followUp,\n render: normalizedRender,\n available: available === undefined ? undefined : available !== \"disabled\",\n agentId,\n // Read webmcp at watch time: the v1 args may expose it as a getter over\n // reactive state, and capturing the initial value here would re-register\n // a stale configuration.\n get webmcp() {\n return tool.webmcp;\n },\n },\n deps,\n );\n}\n","/**\n * V1 compatibility wrapper for useCopilotReadable.\n *\n * Provides app-state and other information to the Copilot context.\n * Delegates directly to the v2 CopilotKitCoreVue instance.\n */\nimport { watch, ref, type Ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../v2/providers/useCopilotKit\";\n\nexport interface UseCopilotReadableOptions {\n /** The description of the information to be added to the Copilot context. */\n description: string;\n /** The value to be added to the Copilot context. Object values are automatically stringified. */\n value: unknown;\n /** Whether the context is available to the Copilot. */\n available?: \"enabled\" | \"disabled\";\n /** Custom conversion function to serialize the value to a string. */\n convert?: (description: string, value: unknown) => string;\n}\n\nexport function useCopilotReadable(\n options: UseCopilotReadableOptions,\n deps?: WatchSource<unknown>[],\n): Ref<string | undefined> {\n const { copilotkit } = useCopilotKit();\n const ctxIdRef = ref<string | undefined>(undefined);\n\n const extraDeps = deps ?? [];\n\n watch(\n [\n () => options.description,\n () => options.value,\n () => options.convert,\n () => options.available,\n ...extraDeps,\n ],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n if (!core) return;\n\n const { description, value, convert, available } = options;\n\n let serializedValue: string;\n try {\n serializedValue = convert\n ? convert(description, value)\n : JSON.stringify(value);\n } catch (err) {\n console.warn(\n `[CopilotKit] useCopilotReadable: failed to serialize ` +\n `value for \"${description}\":`,\n err,\n );\n serializedValue = String(value);\n }\n\n if (available === \"disabled\") return;\n\n ctxIdRef.value = core.addContext({\n description,\n value: serializedValue,\n });\n\n onCleanup(() => {\n if (!ctxIdRef.value) return;\n core.removeContext(ctxIdRef.value);\n });\n },\n { immediate: true },\n );\n\n return ctxIdRef;\n}\n","<script setup lang=\"ts\">\n/**\n * V1 compatibility wrapper for CopilotKitProvider.\n *\n * Accepts the same props as CopilotKitProvider plus legacy v1 props\n * (publicApiKey, publicLicenseKey) and delegates to the v2 provider.\n */\nimport type { CopilotKitProps } from \"./types\";\nimport CopilotKitProvider from \"../../v2/providers/CopilotKitProvider.vue\";\n\nconst props = defineProps<CopilotKitProps>();\n</script>\n\n<template>\n <CopilotKitProvider v-bind=\"props\">\n <slot />\n </CopilotKitProvider>\n</template>\n"],"names":["wrapRenderWithJsonResult","render","props","next","parseJson","useCopilotAction","action","deps","zodParameters","getZodParameters","useRenderToolV2","typedAction","useHumanInTheLoopV2","normalizedHandler","args","normalizedAvailable","useFrontendToolV2","useFrontendTool","tool","name","description","parameters","handler","followUp","available","agentId","normalizedRender","renderProps","useCopilotReadable","options","copilotkit","useCopilotKit","ctxIdRef","ref","extraDeps","watch","_newValues","_old","onCleanup","core","value","convert","serializedValue","err","__props","_openBlock","_createBlock","CopilotKitProvider","_renderSlot","_ctx"],"mappings":"wPAmBA,SAASA,EAA4BC,EAAc,CACjD,OAAI,OAAOA,GAAW,WAAmBA,GAChCC,GAAgC,CACvC,MAAMC,EACJ,OAAOD,EAAM,QAAW,SACpB,CAAE,GAAGA,EAAO,OAAQE,EAAAA,UAAUF,EAAM,OAAQA,EAAM,MAAM,GACxDA,EACN,OAAQD,EAAmCE,CAAI,CACjD,EACF,CA0BO,SAASE,EACdC,EACAC,EACM,CACN,MAAMC,EACJ,eAAgBF,EACZG,EAAAA,iBAAiBH,EAAO,UAAe,EACvC,OAGN,GAAIA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AA,EAEFD,EAAkB,OAAOF,CAAK,CAChC,CAEIhB,IAAc,aAElBQ,EAAS,MAAQO,EAAK,WAAW,CAC/B,YAAAnB,EACA,MAAOsB,CAAA,CACR,EAEDJ,EAAU,IAAM,CACTN,EAAS,OACdO,EAAK,cAAcP,EAAS,KAAK,CACnC,CAAC,EACH,EACA,CAAE,UAAW,EAAA,CAAK,EAGbA,CACT,qkBChEA,MAAM9B,EAAQ0C,gBAIZC,EAAAA,UAAA,EAAAC,cAEqBC,EAAAA,mDAFO7C,CAAK,CAAA,EAAA,mBAC/B,IAAQ,CAAR8C,aAAQC,EAAA,OAAA,SAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/hooks/use-copilot-action.ts","../src/hooks/use-frontend-tool.ts","../src/hooks/use-copilot-readable.ts","../src/components/copilot-provider/CopilotKit.vue"],"sourcesContent":["/**\n * V1 compatibility wrapper for useCopilotAction.\n *\n * Accepts the legacy Parameter[] action format and routes to the appropriate\n * v2 composable (useFrontendTool, useHumanInTheLoop, or useRenderTool).\n */\nimport type { WatchSource } from \"vue\";\nimport type { WebMCPToolConfig } from \"@copilotkit/core\";\nimport type { Parameter, MappedParameterTypes } from \"@copilotkit/shared\";\nimport { getZodParameters, parseJson } from \"@copilotkit/shared\";\nimport { useFrontendTool as useFrontendToolV2 } from \"../v2/hooks/use-frontend-tool\";\nimport { useHumanInTheLoop as useHumanInTheLoopV2 } from \"../v2/hooks/use-human-in-the-loop\";\nimport { useRenderTool as useRenderToolV2 } from \"../v2/hooks/use-render-tool\";\nimport type { VueFrontendTool, VueHumanInTheLoop } from \"../v2/types\";\n\n// Wraps a v1 render function so a JSON-string `result` is parsed before being\n// passed through. Mirrors the v1 React behavior. If render is a Component\n// (object) rather than a function, returns it unchanged — Components receive\n// props through Vue's prop system and the user is responsible for parsing.\nfunction wrapRenderWithJsonResult<R>(render: R): R {\n if (typeof render !== \"function\") return render;\n return ((props: { result?: unknown }) => {\n const next =\n typeof props.result === \"string\"\n ? { ...props, result: parseJson(props.result, props.result) }\n : props;\n return (render as (p: unknown) => unknown)(next);\n }) as R;\n}\n\nexport interface FrontendAction<T extends Parameter[] | [] = []> {\n name: string;\n description?: string;\n parameters?: T;\n handler?: (args: MappedParameterTypes<T>) => unknown | Promise<unknown>;\n followUp?: boolean;\n available?: \"disabled\" | \"enabled\" | \"remote\" | \"frontend\";\n render?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n renderAndWaitForResponse?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n renderAndWait?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n agentId?: string;\n /**\n * Also expose this action to browser agents through the WebMCP API\n * (`document.modelContext`). `true` uses default annotations;\n * `{ annotations }` provides WebMCP annotations.\n */\n webmcp?: boolean | WebMCPToolConfig;\n}\n\nexport interface CatchAllFrontendAction {\n name: \"*\";\n render: (props: unknown) => unknown;\n}\n\nexport function useCopilotAction<const T extends Parameter[] | [] = []>(\n action: FrontendAction<T> | CatchAllFrontendAction,\n deps?: WatchSource<unknown>[],\n): void {\n const zodParameters =\n \"parameters\" in action\n ? getZodParameters(action.parameters as T)\n : undefined;\n\n // Catch-all render action\n if (action.name === \"*\") {\n useRenderToolV2(\n {\n name: \"*\",\n render: wrapRenderWithJsonResult(\n (action as CatchAllFrontendAction).render,\n ),\n ...(\"agentId\" in action\n ? { agentId: (action as FrontendAction<T>).agentId }\n : {}),\n },\n deps,\n );\n return;\n }\n\n const typedAction = action as FrontendAction<T>;\n\n // Human-in-the-loop: has renderAndWaitForResponse or renderAndWait\n if (\n \"renderAndWaitForResponse\" in typedAction ||\n \"renderAndWait\" in typedAction\n ) {\n const render =\n typedAction.render ??\n typedAction.renderAndWaitForResponse ??\n typedAction.renderAndWait;\n\n if (!render) {\n console.warn(\n `[CopilotKit] useCopilotAction: HITL action '${typedAction.name}' ` +\n `has no render function. Skipping.`,\n );\n return;\n }\n\n useHumanInTheLoopV2<MappedParameterTypes<T>>(\n {\n name: typedAction.name,\n description: typedAction.description,\n parameters: zodParameters,\n render: wrapRenderWithJsonResult(render) as VueHumanInTheLoop<\n MappedParameterTypes<T>\n >[\"render\"],\n agentId: typedAction.agentId,\n },\n deps,\n );\n return;\n }\n\n // Render-only: available is \"frontend\" or \"disabled\" (no handler invoked remotely)\n if (\n typedAction.available === \"frontend\" ||\n typedAction.available === \"disabled\"\n ) {\n if (typedAction.render && zodParameters) {\n useRenderToolV2(\n {\n name: typedAction.name,\n parameters: zodParameters,\n render: wrapRenderWithJsonResult(\n typedAction.render as (props: unknown) => unknown,\n ),\n agentId: typedAction.agentId,\n },\n deps,\n );\n } else {\n console.warn(\n `[CopilotKit] useCopilotAction: action '${typedAction.name}' ` +\n `with available=\"${typedAction.available}\" requires both ` +\n `'render' and 'parameters'. Skipping registration.`,\n );\n }\n return;\n }\n\n // Default: frontend tool with handler\n // Wrap the v1 handler (single-arg) to match v2's (args, context) => Promise<unknown> signature\n const normalizedHandler = typedAction.handler\n ? (args: MappedParameterTypes<T>) =>\n Promise.resolve(typedAction.handler!(args))\n : undefined;\n\n // Convert v1 available (string enum) to v2 available (boolean)\n // At this point, \"frontend\" and \"disabled\" have been handled above,\n // so remaining values are \"enabled\", \"remote\", or undefined.\n // \"remote\" means server-only: register the tool but mark it as not\n // available on the frontend (matches React's ActionInputAvailability.Remote).\n let normalizedAvailable: boolean | undefined;\n if (typedAction.available === \"remote\") {\n normalizedAvailable = false;\n } else if (typedAction.available !== undefined) {\n normalizedAvailable = true;\n }\n\n useFrontendToolV2<MappedParameterTypes<T>>(\n {\n name: typedAction.name,\n description: typedAction.description,\n parameters: zodParameters,\n handler: normalizedHandler,\n followUp: typedAction.followUp,\n render: wrapRenderWithJsonResult(typedAction.render),\n available: normalizedAvailable,\n agentId: typedAction.agentId,\n // Read webmcp at watch time: the action object may expose it as a getter\n // over reactive state, and capturing the initial value here would\n // re-register a stale configuration.\n get webmcp() {\n return typedAction.webmcp;\n },\n },\n deps,\n );\n}\n","/**\n * V1 compatibility wrapper for useFrontendTool.\n *\n * Accepts the legacy Parameter[] format and converts to Zod via getZodParameters,\n * then delegates to the v2 composable.\n */\nimport type { WatchSource } from \"vue\";\nimport type { WebMCPToolConfig } from \"@copilotkit/core\";\nimport {\n type Parameter,\n type MappedParameterTypes,\n getZodParameters,\n parseJson,\n} from \"@copilotkit/shared\";\nimport { useFrontendTool as useFrontendToolV2 } from \"../v2/hooks/use-frontend-tool\";\nimport type { VueFrontendTool } from \"../v2/types\";\n\nexport interface UseFrontendToolArgs<T extends Parameter[] | [] = []> {\n name: string;\n description?: string;\n parameters?: T;\n handler?: (args: MappedParameterTypes<T>) => unknown | Promise<unknown>;\n followUp?: boolean;\n available?: \"disabled\" | \"enabled\";\n render?: VueFrontendTool<MappedParameterTypes<T>>[\"render\"];\n agentId?: string;\n /**\n * Also expose this tool to browser agents through the WebMCP API\n * (`document.modelContext`). `true` uses default annotations;\n * `{ annotations }` provides WebMCP annotations.\n */\n webmcp?: boolean | WebMCPToolConfig;\n}\n\nexport function useFrontendTool<const T extends Parameter[] = []>(\n tool: UseFrontendToolArgs<T>,\n deps?: WatchSource<unknown>[],\n) {\n const {\n name,\n description,\n parameters,\n handler,\n followUp,\n available,\n render,\n agentId,\n } = tool;\n const zodParameters = getZodParameters(parameters);\n\n // Wrap the v1 handler (single-arg) to match v2's (args, context) => Promise<unknown> signature\n const normalizedHandler = handler\n ? (args: MappedParameterTypes<T>) => Promise.resolve(handler(args))\n : undefined;\n\n // Wrap render to parse JSON-string results before passing them to the\n // user's render function — matches the v1 React behavior. If render is a\n // Component rather than a function, leave it unchanged.\n const normalizedRender =\n typeof render === \"function\"\n ? (props: { result?: unknown }) => {\n const renderProps =\n typeof props.result === \"string\"\n ? { ...props, result: parseJson(props.result, props.result) }\n : props;\n return (render as (p: unknown) => unknown)(renderProps);\n }\n : render;\n\n useFrontendToolV2<MappedParameterTypes<T>>(\n {\n name,\n description,\n parameters: zodParameters,\n handler: normalizedHandler,\n followUp,\n render: normalizedRender,\n available: available === undefined ? undefined : available !== \"disabled\",\n agentId,\n // Read webmcp at watch time: the v1 args may expose it as a getter over\n // reactive state, and capturing the initial value here would re-register\n // a stale configuration.\n get webmcp() {\n return tool.webmcp;\n },\n },\n deps,\n );\n}\n","/**\n * V1 compatibility wrapper for useCopilotReadable.\n *\n * Provides app-state and other information to the Copilot context.\n * Delegates directly to the v2 CopilotKitCoreVue instance.\n */\nimport { watch, ref, type Ref } from \"vue\";\nimport type { WatchSource } from \"vue\";\nimport { useCopilotKit } from \"../v2/providers/useCopilotKit\";\n\nexport interface UseCopilotReadableOptions {\n /** The description of the information to be added to the Copilot context. */\n description: string;\n /** The value to be added to the Copilot context. Object values are automatically stringified. */\n value: unknown;\n /** Whether the context is available to the Copilot. */\n available?: \"enabled\" | \"disabled\";\n /** Custom conversion function to serialize the value to a string. */\n convert?: (description: string, value: unknown) => string;\n}\n\nexport function useCopilotReadable(\n options: UseCopilotReadableOptions,\n deps?: WatchSource<unknown>[],\n): Ref<string | undefined> {\n const { copilotkit } = useCopilotKit();\n const ctxIdRef = ref<string | undefined>(undefined);\n\n const extraDeps = deps ?? [];\n\n watch(\n [\n () => options.description,\n () => options.value,\n () => options.convert,\n () => options.available,\n ...extraDeps,\n ],\n (_newValues, _old, onCleanup) => {\n const core = copilotkit.value;\n if (!core) return;\n\n const { description, value, convert, available } = options;\n\n let serializedValue: string;\n try {\n serializedValue = convert\n ? convert(description, value)\n : JSON.stringify(value);\n } catch (err) {\n console.warn(\n `[CopilotKit] useCopilotReadable: failed to serialize ` +\n `value for \"${description}\":`,\n err,\n );\n serializedValue = String(value);\n }\n\n if (available === \"disabled\") return;\n\n ctxIdRef.value = core.addContext({\n description,\n value: serializedValue,\n });\n\n onCleanup(() => {\n if (!ctxIdRef.value) return;\n core.removeContext(ctxIdRef.value);\n });\n },\n { immediate: true },\n );\n\n return ctxIdRef;\n}\n","<script setup lang=\"ts\">\n/**\n * V1 compatibility wrapper for CopilotKitProvider.\n *\n * Accepts the same props as CopilotKitProvider plus legacy v1 props\n * (publicApiKey, publicLicenseKey) and delegates to the v2 provider.\n */\nimport type { CopilotKitProps } from \"./types\";\nimport CopilotKitProvider from \"../../v2/providers/CopilotKitProvider.vue\";\n\nconst props = defineProps<CopilotKitProps>();\n</script>\n\n<template>\n <CopilotKitProvider v-bind=\"props\">\n <slot />\n </CopilotKitProvider>\n</template>\n"],"names":["wrapRenderWithJsonResult","render","props","next","parseJson","useCopilotAction","action","deps","zodParameters","getZodParameters","useRenderToolV2","typedAction","useHumanInTheLoopV2","normalizedHandler","args","normalizedAvailable","useFrontendToolV2","useFrontendTool","tool","name","description","parameters","handler","followUp","available","agentId","normalizedRender","renderProps","useCopilotReadable","options","copilotkit","useCopilotKit","ctxIdRef","ref","extraDeps","watch","_newValues","_old","onCleanup","core","value","convert","serializedValue","err","__props","_openBlock","_createBlock","CopilotKitProvider","_renderSlot","_ctx"],"mappings":"4SAmBA,SAASA,EAA4BC,EAAc,CACjD,OAAI,OAAOA,GAAW,WAAmBA,GAChCC,GAAgC,CACvC,MAAMC,EACJ,OAAOD,EAAM,QAAW,SACpB,CAAE,GAAGA,EAAO,OAAQE,EAAAA,UAAUF,EAAM,OAAQA,EAAM,MAAM,GACxDA,EACN,OAAQD,EAAmCE,CAAI,CACjD,EACF,CA0BO,SAASE,EACdC,EACAC,EACM,CACN,MAAMC,EACJ,eAAgBF,EACZG,EAAAA,iBAAiBH,EAAO,UAAe,EACvC,OAGN,GAAIA,EAAO,OAAS,IAAK,CACvBI,EAAAA,cACE,CACE,KAAM,IACN,OAAQV,EACLM,EAAkC,MAAA,EAErC,GAAI,YAAaA,EACb,CAAE,QAAUA,EAA6B,OAAA,EACzC,CAAA,CAAC,EAEPC,CAAA,EAEF,MACF,CAEA,MAAMI,EAAcL,EAGpB,GACE,6BAA8BK,GAC9B,kBAAmBA,EACnB,CACA,MAAMV,EACJU,EAAY,QACZA,EAAY,0BACZA,EAAY,cAEd,GAAI,CAACV,EAAQ,C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