@copilotkit/vue 2.0.0-rc.8 → 2.0.0-rc.9
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/hooks/use-copilot-action.d.ts.map +1 -1
- package/dist/hooks/use-frontend-tool.d.ts +1 -1
- package/dist/hooks/use-frontend-tool.d.ts.map +1 -1
- package/dist/hooks/zod-parameters.d.ts +14 -0
- package/dist/hooks/zod-parameters.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +392 -290
- package/dist/index.mjs.map +1 -1
- package/dist/use-render-activity-message-B59A4R48.js +18097 -0
- package/dist/use-render-activity-message-B59A4R48.js.map +1 -0
- package/dist/use-render-activity-message-u0OVXjd8.cjs +92 -0
- package/dist/use-render-activity-message-u0OVXjd8.cjs.map +1 -0
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts +13 -45
- package/dist/v2/components/OpenGenerativeUIRenderer.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts +1 -1
- package/dist/v2/components/a2ui/A2UICatalogContext.d.ts.map +1 -1
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts +13 -5
- package/dist/v2/components/a2ui/A2UIRecoveryStates.d.ts.map +1 -1
- package/dist/v2/components/a2ui.d.ts +3 -7
- package/dist/v2/components/a2ui.d.ts.map +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +173 -173
- package/dist/v2/lib/processPartialHtml.d.ts +1 -2
- package/dist/v2/lib/processPartialHtml.d.ts.map +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts +1 -1
- package/dist/v2/providers/CopilotKitProvider.vue.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/hooks/__tests__/zod-parameters.test.ts +520 -0
- package/src/hooks/use-copilot-action.ts +2 -1
- package/src/hooks/use-frontend-tool.ts +3 -6
- package/src/hooks/zod-parameters.ts +162 -0
- package/src/v2/components/A2UIMessageRenderer.ts +3 -3
- package/src/v2/components/OpenGenerativeUIRenderer.ts +51 -373
- package/src/v2/components/__tests__/A2UICatalogContext.test.ts +1 -1
- package/src/v2/components/__tests__/OpenGenerativeUIRenderer.test.ts +55 -6
- package/src/v2/components/a2ui/A2UIBuiltInToolCallRenderer.ts +1 -1
- package/src/v2/components/a2ui/A2UICatalogContext.ts +10 -102
- package/src/v2/components/a2ui/A2UIRecoveryStates.ts +1 -1
- package/src/v2/components/a2ui.ts +1 -1
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.ts +26 -9
- package/src/v2/hooks/__tests__/zod-regression.test.ts +1 -1
- package/src/v2/lib/processPartialHtml.ts +6 -21
- package/src/v2/providers/CopilotKitProvider.vue +26 -34
- package/src/v2/providers/__tests__/CopilotKitProvider.a2ui.test.ts +1 -1
- package/vite.config.ts +2 -2
- package/dist/use-render-activity-message-C5LCG9a9.js +0 -16451
- package/dist/use-render-activity-message-C5LCG9a9.js.map +0 -1
- package/dist/use-render-activity-message-CPzguixR.cjs +0 -74
- package/dist/use-render-activity-message-CPzguixR.cjs.map +0 -1
- package/src/v2/lib/__tests__/processPartialHtml.test.ts +0 -84
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\n// Vue casts an absent boolean prop to `false`, so keep the provider's default.\nconst props = withDefaults(defineProps<CopilotKitProps>(), {\n injectStyles: true,\n});\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,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ts","../src/hooks/use-copilot-readable.ts","../src/components/copilot-provider/CopilotKit.vue"],"sourcesContent":["import * as z from \"zod\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport type { Parameter } from \"@copilotkit/shared\";\n\n/**\n * Convert a JSON Schema to a Zod schema. Resolves `$ref` against `$defs` /\n * `definitions`, maps `anyOf` / `oneOf` to unions, and falls back to\n * `z.any()` for circular refs and unsupported types.\n *\n * Moved here from `@copilotkit/shared` in 2.0 so that shared does not depend\n * on zod.\n */\nexport function convertJsonSchemaToZodSchema(\n jsonSchema: any,\n required: boolean,\n definitions?: Record<string, any>,\n visitedRefs?: Set<string>,\n): z.ZodSchema {\n // Resolve $ref references\n if (jsonSchema.$ref && definitions) {\n const refPath = jsonSchema.$ref.replace(\n /^#\\/\\$defs\\/|^#\\/definitions\\//,\n \"\",\n );\n\n // Detect circular $ref cycles\n const refs = visitedRefs ?? new Set<string>();\n if (refs.has(refPath)) {\n console.warn(\n `[CopilotKit] Circular $ref detected for \"${refPath}\" — falling back to z.any()`,\n );\n let schema = z.any();\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n const resolved = definitions[refPath];\n if (resolved) {\n // Clone the set so sibling branches don't see each other's visited refs\n const nextRefs = new Set(refs);\n nextRefs.add(refPath);\n return convertJsonSchemaToZodSchema(\n resolved,\n required,\n definitions,\n nextRefs,\n );\n }\n }\n\n // Collect top-level definitions for $ref resolution\n const defs = definitions ?? jsonSchema.$defs ?? jsonSchema.definitions;\n\n // Handle null-union types like [\"string\", \"null\"]\n if (Array.isArray(jsonSchema.type)) {\n const types = jsonSchema.type as string[];\n const hasNull = types.includes(\"null\");\n const nonNullTypes = types.filter((t: string) => t !== \"null\");\n const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : \"string\";\n const innerSchema = convertJsonSchemaToZodSchema(\n { ...jsonSchema, type: resolvedType },\n true,\n defs,\n visitedRefs,\n );\n let schema = hasNull ? z.union([innerSchema, z.null()]) : innerSchema;\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n // Handle anyOf / oneOf as z.union\n const unionVariants = jsonSchema.anyOf ?? jsonSchema.oneOf;\n if (Array.isArray(unionVariants) && unionVariants.length > 0) {\n if (unionVariants.length === 1) {\n return convertJsonSchemaToZodSchema(\n unionVariants[0],\n required,\n defs,\n visitedRefs,\n );\n }\n const schemas = unionVariants.map((v: any) =>\n convertJsonSchemaToZodSchema(v, true, defs, visitedRefs),\n );\n let schema = z.union(\n schemas as [z.ZodSchema, z.ZodSchema, ...z.ZodSchema[]],\n );\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n if (jsonSchema.type === \"object\") {\n const spec: { [key: string]: z.ZodSchema } = {};\n\n if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {\n return !required ? z.object(spec).optional() : z.object(spec);\n }\n\n for (const [key, value] of Object.entries(jsonSchema.properties)) {\n spec[key] = convertJsonSchemaToZodSchema(\n value,\n jsonSchema.required ? jsonSchema.required.includes(key) : false,\n defs,\n visitedRefs,\n );\n }\n let schema = z.object(spec).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"string\") {\n if (jsonSchema.enum && jsonSchema.enum.length > 0) {\n let schema = z\n .enum(jsonSchema.enum as [string, ...string[]])\n .describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n let schema = z.string().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"number\" || jsonSchema.type === \"integer\") {\n let schema = z.number().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"boolean\") {\n let schema = z.boolean().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"array\") {\n let itemSchema = convertJsonSchemaToZodSchema(\n jsonSchema.items,\n true,\n defs,\n visitedRefs,\n );\n let schema = z.array(itemSchema).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"null\") {\n let schema = z.null().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n\n // Fallback: accept any value rather than throwing\n console.warn(\n `[CopilotKit] Unsupported JSON schema type \"${jsonSchema.type ?? \"unknown\"}\" — falling back to z.any()`,\n );\n let schema = z.any();\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n}\n\n/** Convert v1 `Parameter[]` action parameters to a Zod object schema. */\nexport function getZodParameters<T extends [] | Parameter[] | undefined>(\n parameters: T,\n): any {\n if (!parameters) return z.object({});\n const jsonParams = actionParametersToJsonSchema(parameters);\n return convertJsonSchemaToZodSchema(jsonParams, true);\n}\n","/**\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 { parseJson } from \"@copilotkit/shared\";\nimport { getZodParameters } from \"./zod-parameters\";\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 { parseJson } from \"@copilotkit/shared\";\nimport type { Parameter, MappedParameterTypes } from \"@copilotkit/shared\";\nimport { getZodParameters } from \"./zod-parameters\";\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\n// Vue casts an absent boolean prop to `false`, so keep the provider's default.\nconst props = withDefaults(defineProps<CopilotKitProps>(), {\n injectStyles: true,\n});\n</script>\n\n<template>\n <CopilotKitProvider v-bind=\"props\">\n <slot />\n </CopilotKitProvider>\n</template>\n"],"names":["convertJsonSchemaToZodSchema","jsonSchema","required","definitions","visitedRefs","refPath","refs","schema","z","resolved","nextRefs","defs","types","hasNull","nonNullTypes","t","resolvedType","innerSchema","unionVariants","schemas","v","spec","key","value","itemSchema","getZodParameters","parameters","jsonParams","actionParametersToJsonSchema","wrapRenderWithJsonResult","render","props","next","parseJson","useCopilotAction","action","deps","zodParameters","useRenderToolV2","typedAction","useHumanInTheLoopV2","normalizedHandler","args","normalizedAvailable","useFrontendToolV2","useFrontendTool","tool","name","description","handler","followUp","available","agentId","renderProps","useCopilotReadable","options","copilotkit","useCopilotKit","ctxIdRef","ref","watch","_newValues","_old","onCleanup","core","convert","serializedValue","err","__props","_openBlock","_createBlock","CopilotKitProvider","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;AAYO,SAASA,EACdC,GACAC,GACAC,GACAC,GACa;AAEb,MAAIH,EAAW,QAAQE,GAAa;AAClC,UAAME,IAAUJ,EAAW,KAAK;AAAA,MAC9B;AAAA,MACA;AAAA,IAAA,GAIIK,IAAOF,KAAe,oBAAI,IAAA;AAChC,QAAIE,EAAK,IAAID,CAAO,GAAG;AACrB,cAAQ;AAAA,QACN,4CAA4CA,CAAO;AAAA,MAAA;AAErD,UAAIE,IAASC,EAAE,IAAA;AACf,aAAIP,EAAW,gBACbM,IAASA,EAAO,SAASN,EAAW,WAAW,IAE1CC,IAAWK,IAASA,EAAO,SAAA;AAAA,IACpC;AAEA,UAAME,IAAWN,EAAYE,CAAO;AACpC,QAAII,GAAU;A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