@copilotkit/vue 1.73.0 → 1.73.2-canary.1790068297
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +42 -41
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-6LwUTCNm.cjs +85 -0
- package/dist/use-render-activity-message-6LwUTCNm.cjs.map +1 -0
- package/dist/{use-render-activity-message-DI4kGqHF.js → use-render-activity-message-Di_L8HCv.js} +3513 -3468
- package/dist/use-render-activity-message-Di_L8HCv.js.map +1 -0
- package/dist/v2/components/chat/CopilotChat.vue.d.ts.map +1 -1
- package/dist/v2/components/chat/CopilotChatMessageView.vue.d.ts.map +1 -1
- package/dist/v2/hooks/use-human-in-the-loop.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 +25 -1
- package/dist/v2/providers/CopilotKitProvider.types.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/v2/components/chat/CopilotChat.vue +2 -8
- package/src/v2/components/chat/CopilotChatMessageView.vue +29 -3
- package/src/v2/components/chat/__tests__/CopilotChatMessageView.rowKeys.test.ts +140 -0
- package/src/v2/hooks/__tests__/use-human-in-the-loop.e2e.test.ts +32 -6
- package/src/v2/hooks/use-human-in-the-loop.ts +1 -0
- package/src/v2/providers/CopilotKitProvider.types.ts +28 -1
- package/src/v2/providers/CopilotKitProvider.vue +86 -6
- package/src/v2/providers/__tests__/CopilotKitProvider.hitl.e2e.test.ts +192 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.messageFilter.test.ts +159 -0
- package/src/v2/providers/__tests__/CopilotKitProvider.test.ts +275 -21
- package/src/v2/providers/__tests__/CopilotKitProvider.wildcard.test.ts +19 -1
- package/dist/use-render-activity-message-C45MYgwB.cjs +0 -85
- package/dist/use-render-activity-message-C45MYgwB.cjs.map +0 -1
- package/dist/use-render-activity-message-DI4kGqHF.js.map +0 -1
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-
|
|
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-6LwUTCNm.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]})});
|
|
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","C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d,IAAMA,EAAQ,QACd,IAAMA,EAAQ,UACd,GAAGK,CAAA,EAEL,CAACE,EAAYC,EAAMC,IAAc,CAC/B,MAAMC,EAAOT,EAAW,MACxB,GAAI,CAACS,EAAM,OAEX,KAAM,CAAE,YAAAnB,EAAa,MAAAoB,EAAO,QAAAC,EAAS,UAAAjB,GAAcK,EAEnD,IAAIa,EACJ,GAAI,CACFA,EAAkBD,EACdA,EAAQrB,EAAaoB,CAAK,EAC1B,KAAK,UAAUA,CAAK,CAC1B,OAASG,EAAK,CACZ,QAAQ,KACN,mEACgBvB,CAAW,KAC3BuB,CAAA,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,uiBChEA,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":"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,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1B,OAASG,EAAK,CACZ,QAAQ,KACN,mEACgBvB,CAAW,KAC3BuB,CAAA,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"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
export * from "@copilotkit/core";
|
|
2
2
|
export * from "@ag-ui/client";
|
|
3
|
-
import { aa as f, a3 as b, a2 as v, a0 as y, u as I } from "./use-render-activity-message-
|
|
4
|
-
import { A as k, _ as W, a as J, C as j, b as E, c as q, d as N, e as Q, f as Z, g as X, h as Y, i as ee, j as
|
|
3
|
+
import { aa as f, a3 as b, a2 as v, a0 as y, u as I } from "./use-render-activity-message-Di_L8HCv.js";
|
|
4
|
+
import { A as k, _ as W, a as J, C as j, b as E, c as q, d as N, e as Q, f as Z, g as X, h as Y, i as ee, j as te, k as ae, l as oe, m as ne, n as re, o as se, p as ie, q as le, r as de, s as ue, t as pe, v as ce, w as Ce, x as me, y as ge, z as fe, B as ve, G as he, L as Ae, M as be, D as ye, E as Ie, O as Re, F as Se, H as we, I as Te, J as xe, U as Ue, K as Pe, N as Me, P as Ke, Q as _e, R as ze, S as Be, T as Oe, V as Ve, W as Fe, X as Le, Y as He, Z as De, $ as Ge, a1 as $e, a4 as ke, a5 as We, a6 as Je, a7 as je, a8 as Ee, a9 as qe, ab as Ne, ac as Qe, ad as Ze, ae as Xe } from "./use-render-activity-message-Di_L8HCv.js";
|
|
5
5
|
import { ref as R, watch as S, defineComponent as w, openBlock as T, createBlock as x, normalizeProps as U, guardReactiveProps as P, withCtx as M, renderSlot as K } from "vue";
|
|
6
6
|
import { getZodParameters as h, parseJson as A } from "@copilotkit/shared";
|
|
7
|
-
import { createLicenseContextValue as
|
|
8
|
-
function c(
|
|
9
|
-
return typeof
|
|
10
|
-
const o = typeof
|
|
11
|
-
return
|
|
7
|
+
import { createLicenseContextValue as et } from "@copilotkit/shared";
|
|
8
|
+
function c(t) {
|
|
9
|
+
return typeof t != "function" ? t : ((a) => {
|
|
10
|
+
const o = typeof a.result == "string" ? { ...a, result: A(a.result, a.result) } : a;
|
|
11
|
+
return t(o);
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
function O(
|
|
15
|
-
const o = "parameters" in
|
|
16
|
-
if (
|
|
14
|
+
function O(t, a) {
|
|
15
|
+
const o = "parameters" in t ? h(t.parameters) : void 0;
|
|
16
|
+
if (t.name === "*") {
|
|
17
17
|
f(
|
|
18
18
|
{
|
|
19
19
|
name: "*",
|
|
20
20
|
render: c(
|
|
21
|
-
|
|
21
|
+
t.render
|
|
22
22
|
),
|
|
23
|
-
..."agentId" in
|
|
23
|
+
..."agentId" in t ? { agentId: t.agentId } : {}
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
a
|
|
26
26
|
);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
const e =
|
|
29
|
+
const e = t;
|
|
30
30
|
if ("renderAndWaitForResponse" in e || "renderAndWait" in e) {
|
|
31
31
|
const s = e.render ?? e.renderAndWaitForResponse ?? e.renderAndWait;
|
|
32
32
|
if (!s) {
|
|
@@ -43,7 +43,7 @@ function O(a, t) {
|
|
|
43
43
|
render: c(s),
|
|
44
44
|
agentId: e.agentId
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
a
|
|
47
47
|
);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
@@ -57,7 +57,7 @@ function O(a, t) {
|
|
|
57
57
|
),
|
|
58
58
|
agentId: e.agentId
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
a
|
|
61
61
|
) : console.warn(
|
|
62
62
|
`[CopilotKit] useCopilotAction: action '${e.name}' with available="${e.available}" requires both 'render' and 'parameters'. Skipping registration.`
|
|
63
63
|
);
|
|
@@ -82,10 +82,10 @@ function O(a, t) {
|
|
|
82
82
|
return e.webmcp;
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
a
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
|
-
function V(
|
|
88
|
+
function V(t, a) {
|
|
89
89
|
const {
|
|
90
90
|
name: o,
|
|
91
91
|
description: e,
|
|
@@ -95,7 +95,7 @@ function V(a, t) {
|
|
|
95
95
|
available: p,
|
|
96
96
|
render: i,
|
|
97
97
|
agentId: l
|
|
98
|
-
} =
|
|
98
|
+
} = t, d = h(u);
|
|
99
99
|
v(
|
|
100
100
|
{
|
|
101
101
|
name: o,
|
|
@@ -113,26 +113,26 @@ function V(a, t) {
|
|
|
113
113
|
// reactive state, and capturing the initial value here would re-register
|
|
114
114
|
// a stale configuration.
|
|
115
115
|
get webmcp() {
|
|
116
|
-
return
|
|
116
|
+
return t.webmcp;
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
a
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function F(t, a) {
|
|
123
123
|
const { copilotkit: o } = y(), e = R(void 0);
|
|
124
124
|
return S(
|
|
125
125
|
[
|
|
126
|
-
() =>
|
|
127
|
-
() =>
|
|
128
|
-
() =>
|
|
129
|
-
() =>
|
|
130
|
-
...
|
|
126
|
+
() => t.description,
|
|
127
|
+
() => t.value,
|
|
128
|
+
() => t.convert,
|
|
129
|
+
() => t.available,
|
|
130
|
+
...a ?? []
|
|
131
131
|
],
|
|
132
132
|
(r, s, p) => {
|
|
133
133
|
const i = o.value;
|
|
134
134
|
if (!i) return;
|
|
135
|
-
const { description: l, value: d, convert: C, available: g } =
|
|
135
|
+
const { description: l, value: d, convert: C, available: g } = t;
|
|
136
136
|
let n;
|
|
137
137
|
try {
|
|
138
138
|
n = C ? C(l, d) : JSON.stringify(d);
|
|
@@ -152,7 +152,7 @@ function L(a, t) {
|
|
|
152
152
|
{ immediate: !0 }
|
|
153
153
|
), e;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
155
|
+
const L = /* @__PURE__ */ w({
|
|
156
156
|
__name: "CopilotKit",
|
|
157
157
|
props: {
|
|
158
158
|
publicApiKey: {},
|
|
@@ -160,6 +160,7 @@ const H = /* @__PURE__ */ w({
|
|
|
160
160
|
runtimeUrl: {},
|
|
161
161
|
headers: { type: [Object, Function] },
|
|
162
162
|
credentials: {},
|
|
163
|
+
messageFilter: { type: Function },
|
|
163
164
|
defaultThrottleMs: {},
|
|
164
165
|
licenseToken: {},
|
|
165
166
|
properties: {},
|
|
@@ -178,9 +179,9 @@ const H = /* @__PURE__ */ w({
|
|
|
178
179
|
a2ui: {},
|
|
179
180
|
debug: { type: [Boolean, Object] }
|
|
180
181
|
},
|
|
181
|
-
setup(
|
|
182
|
-
const
|
|
183
|
-
return (o, e) => (T(), x(I, U(P(
|
|
182
|
+
setup(t) {
|
|
183
|
+
const a = t;
|
|
184
|
+
return (o, e) => (T(), x(I, U(P(a)), {
|
|
184
185
|
default: M(() => [
|
|
185
186
|
K(o.$slots, "default")
|
|
186
187
|
]),
|
|
@@ -201,8 +202,8 @@ export {
|
|
|
201
202
|
X as CopilotChatDefaultLabels,
|
|
202
203
|
Y as CopilotChatInput,
|
|
203
204
|
ee as CopilotChatMessageView,
|
|
204
|
-
|
|
205
|
-
|
|
205
|
+
te as CopilotChatReasoningMessage,
|
|
206
|
+
ae as CopilotChatSuggestionPill,
|
|
206
207
|
oe as CopilotChatSuggestionView,
|
|
207
208
|
ne as CopilotChatToggleButton,
|
|
208
209
|
re as CopilotChatToggleButtonCloseIcon,
|
|
@@ -210,7 +211,7 @@ export {
|
|
|
210
211
|
ie as CopilotChatToolCallsView,
|
|
211
212
|
le as CopilotChatUserMessage,
|
|
212
213
|
de as CopilotChatView,
|
|
213
|
-
|
|
214
|
+
L as CopilotKit,
|
|
214
215
|
ue as CopilotKitCoreVue,
|
|
215
216
|
pe as CopilotKitInspector,
|
|
216
217
|
I as CopilotKitProvider,
|
|
@@ -233,21 +234,21 @@ export {
|
|
|
233
234
|
Ue as UseAgentUpdate,
|
|
234
235
|
Pe as createA2UIMessageRenderer,
|
|
235
236
|
Me as createDefaultLicenseRef,
|
|
236
|
-
|
|
237
|
+
et as createLicenseContextValue,
|
|
237
238
|
Ke as defineToolCallRenderer,
|
|
238
239
|
_e as extractCompleteStyles,
|
|
239
240
|
ze as getOperationSurfaceId,
|
|
240
241
|
Be as processPartialHtml,
|
|
241
242
|
Oe as useAgent,
|
|
242
243
|
Ve as useAgentContext,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
Fe as useAttachments,
|
|
245
|
+
Le as useCapabilities,
|
|
246
|
+
He as useComponent,
|
|
247
|
+
De as useConfigureSuggestions,
|
|
247
248
|
O as useCopilotAction,
|
|
248
249
|
Ge as useCopilotChatConfiguration,
|
|
249
250
|
y as useCopilotKit,
|
|
250
|
-
|
|
251
|
+
F as useCopilotReadable,
|
|
251
252
|
$e as useDefaultRenderTool,
|
|
252
253
|
V as useFrontendTool,
|
|
253
254
|
b as useHumanInTheLoop,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","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","renderProps","useCopilotReadable","options","copilotkit","useCopilotKit","ctxIdRef","ref","watch","_newValues","_old","onCleanup","core","value","convert","serializedValue","err","__props","_openBlock","_createBlock","CopilotKitProvider","_renderSlot","_ctx"],"mappings":";;;;;;;AAmBA,SAASA,EAA4BC,GAAc;AACjD,SAAI,OAAOA,KAAW,aAAmBA,KACjC,CAACC,MAAgC;AACvC,UAAMC,IACJ,OAAOD,E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
|
1
|
+
{"version":3,"file":"index.mjs","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","renderProps","useCopilotReadable","options","copilotkit","useCopilotKit","ctxIdRef","ref","watch","_newValues","_old","onCleanup","core","value","convert","serializedValue","err","__props","_openBlock","_createBlock","CopilotKitProvider","_renderSlot","_ctx"],"mappings":";;;;;;;AAmBA,SAASA,EAA4BC,GAAc;AACjD,SAAI,OAAOA,KAAW,aAAmBA,KACjC,CAACC,MAAgC;AACvC,UAAMC,IACJ,OAAOD,EAAM,UAAW,WACpB,EAAE,GAAGA,GAAO,QAAQE,EAAUF,EAAM,QAAQA,EAAM,MAAM,MACxDA;AACN,WAAQD,EAAmCE,CAAI;AAAA,EACjD;AACF;AA0BO,SAASE,EACdC,GACAC,GACM;AACN,QAAMC,IACJ,gBAAgBF,IACZG,EAAiBH,EAAO,UAAe,IACvC;AAGN,MAAIA,EAAO,SAAS,KAAK;AACvBI,IAAAA;AAAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,QAAQV;AAAA,UACLM,EAAkC;AAAA,QAAA;AAAA,QAErC,GAAI,aAAaA,IACb,EAAE,SAAUA,EAA6B,QAAA,IACzC,CAAA;AAAA,MAAC;AAAA,MAEPC;AAAA,IAAA;AAEF;AAAA,EACF;AAEA,QAAMI,IAAcL;AAGpB,MACE,8BAA8BK,KAC9B,mBAAmBA,GACnB;AACA,UAAMV,IACJU,EAAY,UACZA,EAAY,4BACZA,EAAY;AAEd,QAAI,CAACV,GAAQ;AACX,cAAQ;AAAA,QACN,+CAA+CU,EAAY,IAAI;AAAA,MAAA;AAGjE;AAAA,IACF;AAEAC,IAAAA;AAAAA,MACE;AAAA,QACE,MAAMD,EAAY;AAAA,QAClB,aAAaA,EAAY;AAAA,QACzB,YAAYH;AAAA,QACZ,QAAQR,EAAyBC,CAAM;AAAA,QAGvC,SAASU,EAAY;AAAA,MAAA;AAAA,MAEvBJ;AAAA,IAAA;AAEF;AAAA,EACF;AAGA,MACEI,EAAY,cAAc,cAC1BA,EAAY,cAAc,YAC1B;AACA,IAAIA,EAAY,UA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