@v0-sdk/ai-tools 0.3.4 → 0.3.6

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 CHANGED
@@ -26,10 +26,10 @@ var v0Sdk = require('v0-sdk');
26
26
  projectId: zod.z.string().optional().describe('Project ID to associate with the chat'),
27
27
  modelConfiguration: zod.z.object({
28
28
  modelId: zod.z.enum([
29
- 'v0-1.5-sm',
30
- 'v0-1.5-md',
31
- 'v0-1.5-lg',
32
- 'v0-gpt-5'
29
+ 'v0-mini',
30
+ 'v0-pro',
31
+ 'v0-max',
32
+ 'v0-max-fast'
33
33
  ]).describe('Model to use for the chat'),
34
34
  imageGenerations: zod.z.boolean().optional().describe('Enable image generations'),
35
35
  thinking: zod.z.boolean().optional().describe('Enable thinking mode')
@@ -84,10 +84,10 @@ var v0Sdk = require('v0-sdk');
84
84
  })).optional().describe('File attachments for the message'),
85
85
  modelConfiguration: zod.z.object({
86
86
  modelId: zod.z.enum([
87
- 'v0-1.5-sm',
88
- 'v0-1.5-md',
89
- 'v0-1.5-lg',
90
- 'v0-gpt-5'
87
+ 'v0-mini',
88
+ 'v0-pro',
89
+ 'v0-max',
90
+ 'v0-max-fast'
91
91
  ]).describe('Model to use'),
92
92
  imageGenerations: zod.z.boolean().optional().describe('Enable image generations'),
93
93
  thinking: zod.z.boolean().optional().describe('Enable thinking mode')
@@ -669,7 +669,6 @@ var v0Sdk = require('v0-sdk');
669
669
  deploymentId
670
670
  });
671
671
  return {
672
- error: result.error,
673
672
  fullErrorText: result.fullErrorText,
674
673
  errorType: result.errorType,
675
674
  formattedError: result.formattedError
package/dist/index.d.ts CHANGED
@@ -27,7 +27,7 @@ declare function createChatTools(config?: V0ClientConfig): {
27
27
  chatPrivacy?: "public" | "private" | "team-edit" | "team" | "unlisted" | undefined;
28
28
  projectId?: string | undefined;
29
29
  modelConfiguration?: {
30
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
30
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
31
31
  imageGenerations?: boolean | undefined;
32
32
  thinking?: boolean | undefined;
33
33
  } | undefined;
@@ -72,7 +72,7 @@ declare function createChatTools(config?: V0ClientConfig): {
72
72
  url: string;
73
73
  }[] | undefined;
74
74
  modelConfiguration?: {
75
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
75
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
76
76
  imageGenerations?: boolean | undefined;
77
77
  thinking?: boolean | undefined;
78
78
  } | undefined;
@@ -387,7 +387,6 @@ declare function createDeploymentTools(config?: V0ClientConfig): {
387
387
  getDeploymentErrors: ai.Tool<{
388
388
  deploymentId: string;
389
389
  }, {
390
- error: string | undefined;
391
390
  fullErrorText: string | undefined;
392
391
  errorType: string | undefined;
393
392
  formattedError: string | undefined;
@@ -721,7 +720,6 @@ declare function v0Tools(config?: V0ToolsConfig): {
721
720
  getDeploymentErrors: ai.Tool<{
722
721
  deploymentId: string;
723
722
  }, {
724
- error: string | undefined;
725
723
  fullErrorText: string | undefined;
726
724
  errorType: string | undefined;
727
725
  formattedError: string | undefined;
@@ -869,7 +867,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
869
867
  chatPrivacy?: "public" | "private" | "team-edit" | "team" | "unlisted" | undefined;
870
868
  projectId?: string | undefined;
871
869
  modelConfiguration?: {
872
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
870
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
873
871
  imageGenerations?: boolean | undefined;
874
872
  thinking?: boolean | undefined;
875
873
  } | undefined;
@@ -914,7 +912,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
914
912
  url: string;
915
913
  }[] | undefined;
916
914
  modelConfiguration?: {
917
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
915
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
918
916
  imageGenerations?: boolean | undefined;
919
917
  thinking?: boolean | undefined;
920
918
  } | undefined;
@@ -1062,7 +1060,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
1062
1060
  chatPrivacy?: "public" | "private" | "team-edit" | "team" | "unlisted" | undefined;
1063
1061
  projectId?: string | undefined;
1064
1062
  modelConfiguration?: {
1065
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
1063
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
1066
1064
  imageGenerations?: boolean | undefined;
1067
1065
  thinking?: boolean | undefined;
1068
1066
  } | undefined;
@@ -1107,7 +1105,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
1107
1105
  url: string;
1108
1106
  }[] | undefined;
1109
1107
  modelConfiguration?: {
1110
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
1108
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
1111
1109
  imageGenerations?: boolean | undefined;
1112
1110
  thinking?: boolean | undefined;
1113
1111
  } | undefined;
@@ -1420,7 +1418,6 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
1420
1418
  getDeploymentErrors: ai.Tool<{
1421
1419
  deploymentId: string;
1422
1420
  }, {
1423
- error: string | undefined;
1424
1421
  fullErrorText: string | undefined;
1425
1422
  errorType: string | undefined;
1426
1423
  formattedError: string | undefined;
@@ -1732,7 +1729,6 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
1732
1729
  getDeploymentErrors: ai.Tool<{
1733
1730
  deploymentId: string;
1734
1731
  }, {
1735
- error: string | undefined;
1736
1732
  fullErrorText: string | undefined;
1737
1733
  errorType: string | undefined;
1738
1734
  formattedError: string | undefined;
@@ -1880,7 +1876,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
1880
1876
  chatPrivacy?: "public" | "private" | "team-edit" | "team" | "unlisted" | undefined;
1881
1877
  projectId?: string | undefined;
1882
1878
  modelConfiguration?: {
1883
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
1879
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
1884
1880
  imageGenerations?: boolean | undefined;
1885
1881
  thinking?: boolean | undefined;
1886
1882
  } | undefined;
@@ -1925,7 +1921,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
1925
1921
  url: string;
1926
1922
  }[] | undefined;
1927
1923
  modelConfiguration?: {
1928
- modelId: "v0-1.5-sm" | "v0-1.5-md" | "v0-1.5-lg" | "v0-gpt-5";
1924
+ modelId: "v0-mini" | "v0-pro" | "v0-max" | "v0-max-fast";
1929
1925
  imageGenerations?: boolean | undefined;
1930
1926
  thinking?: boolean | undefined;
1931
1927
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sources":["../src/types.ts","../src/tools/chat-tools.ts","../src/tools/project-tools.ts","../src/tools/deployment-tools.ts","../src/tools/user-tools.ts","../src/tools/hook-tools.ts","../src/index.ts"],"sourcesContent":["import type { V0ClientConfig } from 'v0-sdk'\n\nexport interface V0ToolsConfig extends V0ClientConfig {\n /**\n * Optional base URL for v0 API\n * @default \"https://api.v0.dev\"\n */\n baseUrl?: string\n /**\n * API key for v0 authentication\n * If not provided, will use V0_API_KEY environment variable\n */\n apiKey?: string\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates chat-related AI SDK tools\n */\nexport function createChatTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createChat = tool({\n description: 'Create a new chat with v0',\n inputSchema: z.object({\n message: z.string().describe('The initial message to start the chat'),\n system: z.string().optional().describe('System prompt for the chat'),\n attachments: z\n .array(\n z.object({\n url: z.string().describe('URL of the attachment'),\n }),\n )\n .optional()\n .describe('File attachments for the chat'),\n chatPrivacy: z\n .enum(['public', 'private', 'team-edit', 'team', 'unlisted'])\n .optional()\n .describe('Privacy setting for the chat'),\n projectId: z\n .string()\n .optional()\n .describe('Project ID to associate with the chat'),\n modelConfiguration: z\n .object({\n modelId: z\n .enum(['v0-1.5-sm', 'v0-1.5-md', 'v0-1.5-lg', 'v0-gpt-5'])\n .describe('Model to use for the chat'),\n imageGenerations: z\n .boolean()\n .optional()\n .describe('Enable image generations'),\n thinking: z.boolean().optional().describe('Enable thinking mode'),\n })\n .optional()\n .describe('Model configuration for the chat'),\n responseMode: z\n .enum(['sync', 'async'])\n .optional()\n .describe('Response mode for the chat'),\n }),\n execute: async ({\n message,\n system,\n attachments,\n chatPrivacy,\n projectId,\n modelConfiguration,\n responseMode,\n }) => {\n const result = await client.chats.create({\n message,\n system,\n attachments,\n chatPrivacy,\n projectId,\n modelConfiguration,\n responseMode,\n })\n\n // Handle streaming vs non-streaming responses\n if (result instanceof ReadableStream) {\n return {\n chatId: 'streaming-chat',\n webUrl: 'N/A (streaming response)',\n apiUrl: 'N/A (streaming response)',\n privacy: 'N/A (streaming response)',\n name: 'N/A (streaming response)',\n favorite: false,\n latestVersion: 'N/A (streaming response)',\n createdAt: 'N/A (streaming response)',\n }\n }\n\n return {\n chatId: result.id,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n privacy: result.privacy,\n name: result.name,\n favorite: result.favorite,\n latestVersion: result.latestVersion,\n createdAt: result.createdAt,\n }\n },\n })\n\n const sendMessage = tool({\n description: 'Send a message to an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to send message to'),\n message: z.string().describe('Message content to send'),\n attachments: z\n .array(\n z.object({\n url: z.string().describe('URL of the attachment'),\n }),\n )\n .optional()\n .describe('File attachments for the message'),\n modelConfiguration: z\n .object({\n modelId: z\n .enum(['v0-1.5-sm', 'v0-1.5-md', 'v0-1.5-lg', 'v0-gpt-5'])\n .describe('Model to use'),\n imageGenerations: z\n .boolean()\n .optional()\n .describe('Enable image generations'),\n thinking: z.boolean().optional().describe('Enable thinking mode'),\n })\n .optional()\n .describe('Model configuration'),\n responseMode: z\n .enum(['sync', 'async'])\n .optional()\n .describe('Response mode'),\n }),\n execute: async ({\n chatId,\n message,\n attachments,\n modelConfiguration,\n responseMode,\n }) => {\n const result = await client.chats.sendMessage({\n chatId,\n message,\n attachments,\n modelConfiguration,\n responseMode,\n })\n\n // Handle streaming vs non-streaming responses\n if (result instanceof ReadableStream) {\n return {\n chatId: 'streaming-chat',\n webUrl: 'N/A (streaming response)',\n latestVersion: 'N/A (streaming response)',\n updatedAt: 'N/A (streaming response)',\n }\n }\n\n return {\n chatId: result.id,\n webUrl: result.webUrl,\n latestVersion: result.latestVersion,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const getChat = tool({\n description: 'Get details of an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to retrieve'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.chats.getById({ chatId })\n\n return {\n chatId: result.id,\n name: result.name,\n privacy: result.privacy,\n webUrl: result.webUrl,\n favorite: result.favorite,\n createdAt: result.createdAt,\n updatedAt: result.updatedAt,\n latestVersion: result.latestVersion,\n messagesCount: result.messages.length,\n }\n },\n })\n\n const updateChat = tool({\n description: 'Update properties of an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to update'),\n name: z.string().optional().describe('New name for the chat'),\n privacy: z\n .enum(['public', 'private', 'team', 'team-edit', 'unlisted'])\n .optional()\n .describe('New privacy setting'),\n }),\n execute: async (params) => {\n const { chatId, name, privacy } = params\n const result = await client.chats.update({ chatId, name, privacy })\n\n return {\n chatId: result.id,\n name: result.name,\n privacy: result.privacy,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const deleteChat = tool({\n description: 'Delete an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to delete'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.chats.delete({ chatId })\n\n return {\n chatId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const favoriteChat = tool({\n description: 'Toggle favorite status of a chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat'),\n isFavorite: z.boolean().describe('Whether to mark as favorite or not'),\n }),\n execute: async (params) => {\n const { chatId, isFavorite } = params\n const result = await client.chats.favorite({ chatId, isFavorite })\n\n return {\n chatId: result.id,\n favorited: result.favorited,\n }\n },\n })\n\n const forkChat = tool({\n description: 'Fork an existing chat to create a new version',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to fork'),\n versionId: z\n .string()\n .optional()\n .describe('Specific version ID to fork from'),\n privacy: z\n .enum(['public', 'private', 'team', 'team-edit', 'unlisted'])\n .optional()\n .describe('Privacy setting for the forked chat'),\n }),\n execute: async (params) => {\n const { chatId, versionId, privacy } = params\n const result = await client.chats.fork({ chatId, versionId, privacy })\n\n return {\n originalChatId: chatId,\n newChatId: result.id,\n webUrl: result.webUrl,\n privacy: result.privacy,\n createdAt: result.createdAt,\n }\n },\n })\n\n const listChats = tool({\n description: 'List all chats',\n inputSchema: z.object({\n limit: z.number().optional().describe('Number of chats to return'),\n offset: z.number().optional().describe('Offset for pagination'),\n isFavorite: z.boolean().optional().describe('Filter by favorite status'),\n }),\n execute: async (params) => {\n const { limit, offset, isFavorite } = params\n const result = await client.chats.find({ limit, offset, isFavorite })\n\n return {\n chats: result.data.map((chat) => ({\n chatId: chat.id,\n name: chat.name,\n privacy: chat.privacy,\n webUrl: chat.webUrl,\n favorite: chat.favorite,\n createdAt: chat.createdAt,\n updatedAt: chat.updatedAt,\n })),\n }\n },\n })\n\n return {\n createChat,\n sendMessage,\n getChat,\n updateChat,\n deleteChat,\n favoriteChat,\n forkChat,\n listChats,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates project-related AI SDK tools\n */\nexport function createProjectTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createProject = tool({\n description: 'Create a new project in v0',\n inputSchema: z.object({\n name: z.string().describe('Name of the project'),\n description: z.string().optional().describe('Description of the project'),\n icon: z.string().optional().describe('Icon for the project'),\n environmentVariables: z\n .array(\n z.object({\n key: z.string().describe('Environment variable key'),\n value: z.string().describe('Environment variable value'),\n }),\n )\n .optional()\n .describe('Environment variables for the project'),\n instructions: z\n .string()\n .optional()\n .describe('Custom instructions for the project'),\n vercelProjectId: z\n .string()\n .optional()\n .describe('Associated Vercel project ID'),\n privacy: z\n .enum(['private', 'team'])\n .optional()\n .describe('Privacy setting for the project'),\n }),\n execute: async ({\n name,\n description,\n icon,\n environmentVariables,\n instructions,\n vercelProjectId,\n privacy,\n }) => {\n const result = await client.projects.create({\n name,\n description,\n icon,\n environmentVariables,\n instructions,\n vercelProjectId,\n privacy,\n })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n privacy: result.privacy,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n createdAt: result.createdAt,\n vercelProjectId: result.vercelProjectId,\n }\n },\n })\n\n const getProject = tool({\n description: 'Get details of an existing project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to retrieve'),\n }),\n execute: async (params) => {\n const { projectId } = params\n const result = await client.projects.getById({ projectId })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n instructions: result.instructions,\n privacy: result.privacy,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n createdAt: result.createdAt,\n updatedAt: result.updatedAt,\n vercelProjectId: result.vercelProjectId,\n chatsCount: result.chats.length,\n }\n },\n })\n\n const updateProject = tool({\n description: 'Update properties of an existing project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to update'),\n name: z.string().optional().describe('New name for the project'),\n description: z\n .string()\n .optional()\n .describe('New description for the project'),\n instructions: z\n .string()\n .optional()\n .describe('New instructions for the project'),\n privacy: z\n .enum(['private', 'team'])\n .optional()\n .describe('New privacy setting'),\n }),\n execute: async ({\n projectId,\n name,\n description,\n instructions,\n privacy,\n }) => {\n const result = await client.projects.update({\n projectId,\n name,\n description,\n instructions,\n privacy,\n })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n instructions: result.instructions,\n privacy: result.privacy,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const listProjects = tool({\n description: 'List all projects',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.projects.find()\n\n return {\n projects: result.data.map((project) => ({\n projectId: project.id,\n name: project.name,\n privacy: project.privacy,\n webUrl: project.webUrl,\n createdAt: project.createdAt,\n updatedAt: project.updatedAt,\n vercelProjectId: project.vercelProjectId,\n })),\n }\n },\n })\n\n const assignChatToProject = tool({\n description: 'Assign a chat to a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n chatId: z.string().describe('ID of the chat to assign'),\n }),\n execute: async (params) => {\n const { projectId, chatId } = params\n const result = await client.projects.assign({ projectId, chatId })\n\n return {\n projectId: result.id,\n assigned: result.assigned,\n }\n },\n })\n\n const getProjectByChat = tool({\n description: 'Get project details by chat ID',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.projects.getByChatId({ chatId })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n privacy: result.privacy,\n webUrl: result.webUrl,\n createdAt: result.createdAt,\n chatsCount: result.chats.length,\n }\n },\n })\n\n // Environment Variables Tools\n const createEnvironmentVariables = tool({\n description: 'Create environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariables: z\n .array(\n z.object({\n key: z.string().describe('Environment variable key'),\n value: z.string().describe('Environment variable value'),\n }),\n )\n .describe('Environment variables to create'),\n upsert: z\n .boolean()\n .optional()\n .describe('Whether to upsert existing variables'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariables, upsert, decrypted } = params\n const result = await client.projects.createEnvVars({\n projectId,\n environmentVariables,\n upsert,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n createdAt: envVar.createdAt,\n })),\n }\n },\n })\n\n const listEnvironmentVariables = tool({\n description: 'List environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, decrypted } = params\n const result = await client.projects.findEnvVars({\n projectId,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n createdAt: envVar.createdAt,\n updatedAt: envVar.updatedAt,\n })),\n }\n },\n })\n\n const updateEnvironmentVariables = tool({\n description: 'Update environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariables: z\n .array(\n z.object({\n id: z.string().describe('Environment variable ID'),\n value: z.string().describe('New environment variable value'),\n }),\n )\n .describe('Environment variables to update'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariables, decrypted } = params\n const result = await client.projects.updateEnvVars({\n projectId,\n environmentVariables,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n updatedAt: envVar.updatedAt,\n })),\n }\n },\n })\n\n const deleteEnvironmentVariables = tool({\n description: 'Delete environment variables from a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariableIds: z\n .array(z.string())\n .describe('IDs of environment variables to delete'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariableIds } = params\n const result = await client.projects.deleteEnvVars({\n projectId,\n environmentVariableIds,\n })\n\n return {\n deletedVariables: result.data.map((envVar) => ({\n id: envVar.id,\n deleted: envVar.deleted,\n })),\n }\n },\n })\n\n return {\n createProject,\n getProject,\n updateProject,\n listProjects,\n assignChatToProject,\n getProjectByChat,\n createEnvironmentVariables,\n listEnvironmentVariables,\n updateEnvironmentVariables,\n deleteEnvironmentVariables,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates deployment-related AI SDK tools\n */\nexport function createDeploymentTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createDeployment = tool({\n description: 'Create a new deployment from a chat version',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to deploy to'),\n chatId: z.string().describe('ID of the chat to deploy'),\n versionId: z.string().describe('ID of the specific version to deploy'),\n }),\n execute: async (params) => {\n const { projectId, chatId, versionId } = params\n const result = await client.deployments.create({\n projectId,\n chatId,\n versionId,\n })\n\n return {\n deploymentId: result.id,\n projectId: result.projectId,\n chatId: result.chatId,\n versionId: result.versionId,\n inspectorUrl: result.inspectorUrl,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n }\n },\n })\n\n const getDeployment = tool({\n description: 'Get details of an existing deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment to retrieve'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.getById({ deploymentId })\n\n return {\n deploymentId: result.id,\n projectId: result.projectId,\n chatId: result.chatId,\n versionId: result.versionId,\n inspectorUrl: result.inspectorUrl,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n }\n },\n })\n\n const deleteDeployment = tool({\n description: 'Delete an existing deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment to delete'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.delete({ deploymentId })\n\n return {\n deploymentId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const listDeployments = tool({\n description: 'List deployments by project, chat, and version',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n chatId: z.string().describe('ID of the chat'),\n versionId: z.string().describe('ID of the version'),\n }),\n execute: async (params) => {\n const { projectId, chatId, versionId } = params\n const result = await client.deployments.find({\n projectId,\n chatId,\n versionId,\n })\n\n return {\n deployments: result.data.map((deployment) => ({\n deploymentId: deployment.id,\n projectId: deployment.projectId,\n chatId: deployment.chatId,\n versionId: deployment.versionId,\n inspectorUrl: deployment.inspectorUrl,\n webUrl: deployment.webUrl,\n apiUrl: deployment.apiUrl,\n })),\n }\n },\n })\n\n const getDeploymentLogs = tool({\n description: 'Get logs for a deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment'),\n since: z.number().optional().describe('Timestamp to get logs since'),\n }),\n execute: async (params) => {\n const { deploymentId, since } = params\n const result = await client.deployments.findLogs({\n deploymentId,\n since,\n })\n\n return {\n logs: result.logs,\n nextSince: result.nextSince,\n }\n },\n })\n\n const getDeploymentErrors = tool({\n description: 'Get errors for a deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.findErrors({ deploymentId })\n\n return {\n error: result.error,\n fullErrorText: result.fullErrorText,\n errorType: result.errorType,\n formattedError: result.formattedError,\n }\n },\n })\n\n return {\n createDeployment,\n getDeployment,\n deleteDeployment,\n listDeployments,\n getDeploymentLogs,\n getDeploymentErrors,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates user-related AI SDK tools\n */\nexport function createUserTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const getCurrentUser = tool({\n description: 'Get current user information',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.get()\n\n return {\n userId: result.id,\n name: result.name,\n email: result.email,\n avatar: result.avatar,\n }\n },\n })\n\n const getUserBilling = tool({\n description: 'Get current user billing information',\n inputSchema: z.object({\n scope: z.string().optional().describe('Scope for billing information'),\n }),\n execute: async (params) => {\n const { scope } = params\n const result = await client.user.getBilling({ scope })\n\n if (result.billingType === 'token') {\n return {\n billingType: result.billingType,\n plan: result.data.plan,\n role: result.data.role,\n billingMode: result.data.billingMode,\n billingCycle: {\n start: result.data.billingCycle.start,\n end: result.data.billingCycle.end,\n },\n balance: {\n remaining: result.data.balance.remaining,\n total: result.data.balance.total,\n },\n onDemand: {\n balance: result.data.onDemand.balance,\n blocks: result.data.onDemand.blocks,\n },\n }\n } else {\n return {\n billingType: result.billingType,\n remaining: result.data.remaining,\n reset: result.data.reset,\n limit: result.data.limit,\n }\n }\n },\n })\n\n const getUserPlan = tool({\n description: 'Get current user plan information',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.getPlan()\n\n return {\n plan: result.plan,\n billingCycle: {\n start: result.billingCycle.start,\n end: result.billingCycle.end,\n },\n balance: {\n remaining: result.balance.remaining,\n total: result.balance.total,\n },\n }\n },\n })\n\n const getUserScopes = tool({\n description: 'Get user scopes/permissions',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.getScopes()\n\n return {\n scopes: result.data.map((scope) => ({\n id: scope.id,\n name: scope.name,\n })),\n }\n },\n })\n\n const getRateLimits = tool({\n description: 'Get current rate limit information',\n inputSchema: z.object({\n scope: z.string().optional().describe('Scope for rate limit information'),\n }),\n execute: async (params) => {\n const { scope } = params\n const result = await client.rateLimits.find({ scope })\n\n return {\n remaining: result.remaining,\n reset: result.reset,\n limit: result.limit,\n }\n },\n })\n\n return {\n getCurrentUser,\n getUserBilling,\n getUserPlan,\n getUserScopes,\n getRateLimits,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates webhook-related AI SDK tools\n */\nexport function createHookTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createHook = tool({\n description: 'Create a new webhook for v0 events',\n inputSchema: z.object({\n name: z.string().describe('Name of the webhook'),\n url: z.string().describe('URL to send webhook events to'),\n events: z\n .array(\n z.enum([\n 'chat.created',\n 'chat.updated',\n 'chat.deleted',\n 'message.created',\n 'message.updated',\n 'message.deleted',\n ]),\n )\n .describe('Events to listen for'),\n chatId: z\n .string()\n .optional()\n .describe('Specific chat ID to listen to events for'),\n }),\n execute: async (params) => {\n const { name, url, events, chatId } = params\n const result = await client.hooks.create({\n name,\n url,\n events,\n chatId,\n })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const getHook = tool({\n description: 'Get details of an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to retrieve'),\n }),\n execute: async (params) => {\n const { hookId } = params\n const result = await client.hooks.getById({ hookId })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const updateHook = tool({\n description: 'Update properties of an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to update'),\n name: z.string().optional().describe('New name for the webhook'),\n url: z.string().optional().describe('New URL for the webhook'),\n events: z\n .array(\n z.enum([\n 'chat.created',\n 'chat.updated',\n 'chat.deleted',\n 'message.created',\n 'message.updated',\n 'message.deleted',\n ]),\n )\n .optional()\n .describe('New events to listen for'),\n }),\n execute: async (params) => {\n const { hookId, name, url, events } = params\n const result = await client.hooks.update({\n hookId,\n name,\n url,\n events,\n })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const deleteHook = tool({\n description: 'Delete an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to delete'),\n }),\n execute: async (params) => {\n const { hookId } = params\n const result = await client.hooks.delete({ hookId })\n\n return {\n hookId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const listHooks = tool({\n description: 'List all webhooks',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.hooks.find()\n\n return {\n hooks: result.data.map((hook) => ({\n hookId: hook.id,\n name: hook.name,\n })),\n }\n },\n })\n\n return {\n createHook,\n getHook,\n updateHook,\n deleteHook,\n listHooks,\n }\n}\n","import type { V0ToolsConfig } from './types'\nimport { createChatTools } from './tools/chat-tools'\nimport { createProjectTools } from './tools/project-tools'\nimport { createDeploymentTools } from './tools/deployment-tools'\nimport { createUserTools } from './tools/user-tools'\nimport { createHookTools } from './tools/hook-tools'\n\n/**\n * Creates all v0 AI SDK tools as a flat object.\n *\n * ⚠️ Note: This includes ALL available tools (~20+ tools) which adds significant context.\n * Consider using v0ToolsByCategory() to select only the tools you need.\n *\n * @param config Configuration for v0 client\n * @returns Flat object with all v0 tools ready to use with AI SDK\n *\n * @example\n * ```typescript\n * import { generateText } from 'ai'\n * import { v0Tools } from '@v0-sdk/ai-tools'\n *\n * const result = await generateText({\n * model: 'openai/gpt-4',\n * prompt: 'Create a new React component',\n * tools: v0Tools({\n * apiKey: process.env.V0_API_KEY\n * })\n * })\n * ```\n */\nexport function v0Tools(config: V0ToolsConfig = {}) {\n // Use environment variable if apiKey not provided\n const clientConfig = {\n ...config,\n apiKey: config.apiKey || process.env.V0_API_KEY,\n }\n\n const chatTools = createChatTools(clientConfig)\n const projectTools = createProjectTools(clientConfig)\n const deploymentTools = createDeploymentTools(clientConfig)\n const userTools = createUserTools(clientConfig)\n const hookTools = createHookTools(clientConfig)\n\n return {\n ...chatTools,\n ...projectTools,\n ...deploymentTools,\n ...userTools,\n ...hookTools,\n }\n}\n\n/**\n * Creates v0 tools organized by category for selective usage (recommended).\n * This allows you to include only the tools you need, reducing context size.\n *\n * @param config Configuration for v0 client\n * @returns Object containing all v0 tools organized by category\n *\n * @example\n * ```typescript\n * import { generateText } from 'ai'\n * import { v0ToolsByCategory } from '@v0-sdk/ai-tools'\n *\n * const tools = v0ToolsByCategory({\n * apiKey: process.env.V0_API_KEY\n * })\n *\n * // Only include chat and project tools\n * const result = await generateText({\n * model: 'openai/gpt-4',\n * prompt: 'Create a new React component',\n * tools: {\n * ...tools.chat,\n * ...tools.project\n * }\n * })\n * ```\n */\nexport function v0ToolsByCategory(config: V0ToolsConfig = {}) {\n // Use environment variable if apiKey not provided\n const clientConfig = {\n ...config,\n apiKey: config.apiKey || process.env.V0_API_KEY,\n }\n\n return {\n /**\n * Chat-related tools for creating, managing, and interacting with v0 chats\n */\n chat: createChatTools(clientConfig),\n\n /**\n * Project-related tools for creating and managing v0 projects\n */\n project: createProjectTools(clientConfig),\n\n /**\n * Deployment-related tools for creating and managing deployments\n */\n deployment: createDeploymentTools(clientConfig),\n\n /**\n * User-related tools for getting user information, billing, and rate limits\n */\n user: createUserTools(clientConfig),\n\n /**\n * Webhook tools for creating and managing event hooks\n */\n hook: createHookTools(clientConfig),\n }\n}\n\n/**\n * @deprecated Use v0Tools instead (now returns flat structure by default)\n */\nexport function v0ToolsFlat(config: V0ToolsConfig = {}) {\n return v0Tools(config)\n}\n\n// Export individual tool creators for more granular usage\nexport { createChatTools } from './tools/chat-tools'\nexport { createProjectTools } from './tools/project-tools'\nexport { createDeploymentTools } from './tools/deployment-tools'\nexport { createUserTools } from './tools/user-tools'\nexport { createHookTools } from './tools/hook-tools'\n\n// Export types\nexport type { V0ToolsConfig } from './types'\n\n// Default export\nexport default v0Tools\n"],"names":[],"mappings":";;;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpKA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxEA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
1
+ {"version":3,"file":"index.d.ts","sources":["../src/types.ts","../src/tools/chat-tools.ts","../src/tools/project-tools.ts","../src/tools/deployment-tools.ts","../src/tools/user-tools.ts","../src/tools/hook-tools.ts","../src/index.ts"],"sourcesContent":["import type { V0ClientConfig } from 'v0-sdk'\n\nexport interface V0ToolsConfig extends V0ClientConfig {\n /**\n * Optional base URL for v0 API\n * @default \"https://api.v0.dev\"\n */\n baseUrl?: string\n /**\n * API key for v0 authentication\n * If not provided, will use V0_API_KEY environment variable\n */\n apiKey?: string\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates chat-related AI SDK tools\n */\nexport function createChatTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createChat = tool({\n description: 'Create a new chat with v0',\n inputSchema: z.object({\n message: z.string().describe('The initial message to start the chat'),\n system: z.string().optional().describe('System prompt for the chat'),\n attachments: z\n .array(\n z.object({\n url: z.string().describe('URL of the attachment'),\n }),\n )\n .optional()\n .describe('File attachments for the chat'),\n chatPrivacy: z\n .enum(['public', 'private', 'team-edit', 'team', 'unlisted'])\n .optional()\n .describe('Privacy setting for the chat'),\n projectId: z\n .string()\n .optional()\n .describe('Project ID to associate with the chat'),\n modelConfiguration: z\n .object({\n modelId: z\n .enum(['v0-mini', 'v0-pro', 'v0-max', 'v0-max-fast'])\n .describe('Model to use for the chat'),\n imageGenerations: z\n .boolean()\n .optional()\n .describe('Enable image generations'),\n thinking: z.boolean().optional().describe('Enable thinking mode'),\n })\n .optional()\n .describe('Model configuration for the chat'),\n responseMode: z\n .enum(['sync', 'async'])\n .optional()\n .describe('Response mode for the chat'),\n }),\n execute: async ({\n message,\n system,\n attachments,\n chatPrivacy,\n projectId,\n modelConfiguration,\n responseMode,\n }) => {\n const result = await client.chats.create({\n message,\n system,\n attachments,\n chatPrivacy,\n projectId,\n modelConfiguration,\n responseMode,\n })\n\n // Handle streaming vs non-streaming responses\n if (result instanceof ReadableStream) {\n return {\n chatId: 'streaming-chat',\n webUrl: 'N/A (streaming response)',\n apiUrl: 'N/A (streaming response)',\n privacy: 'N/A (streaming response)',\n name: 'N/A (streaming response)',\n favorite: false,\n latestVersion: 'N/A (streaming response)',\n createdAt: 'N/A (streaming response)',\n }\n }\n\n return {\n chatId: result.id,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n privacy: result.privacy,\n name: result.name,\n favorite: result.favorite,\n latestVersion: result.latestVersion,\n createdAt: result.createdAt,\n }\n },\n })\n\n const sendMessage = tool({\n description: 'Send a message to an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to send message to'),\n message: z.string().describe('Message content to send'),\n attachments: z\n .array(\n z.object({\n url: z.string().describe('URL of the attachment'),\n }),\n )\n .optional()\n .describe('File attachments for the message'),\n modelConfiguration: z\n .object({\n modelId: z\n .enum(['v0-mini', 'v0-pro', 'v0-max', 'v0-max-fast'])\n .describe('Model to use'),\n imageGenerations: z\n .boolean()\n .optional()\n .describe('Enable image generations'),\n thinking: z.boolean().optional().describe('Enable thinking mode'),\n })\n .optional()\n .describe('Model configuration'),\n responseMode: z\n .enum(['sync', 'async'])\n .optional()\n .describe('Response mode'),\n }),\n execute: async ({\n chatId,\n message,\n attachments,\n modelConfiguration,\n responseMode,\n }) => {\n const result = await client.chats.sendMessage({\n chatId,\n message,\n attachments,\n modelConfiguration,\n responseMode,\n })\n\n // Handle streaming vs non-streaming responses\n if (result instanceof ReadableStream) {\n return {\n chatId: 'streaming-chat',\n webUrl: 'N/A (streaming response)',\n latestVersion: 'N/A (streaming response)',\n updatedAt: 'N/A (streaming response)',\n }\n }\n\n return {\n chatId: result.id,\n webUrl: result.webUrl,\n latestVersion: result.latestVersion,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const getChat = tool({\n description: 'Get details of an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to retrieve'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.chats.getById({ chatId })\n\n return {\n chatId: result.id,\n name: result.name,\n privacy: result.privacy,\n webUrl: result.webUrl,\n favorite: result.favorite,\n createdAt: result.createdAt,\n updatedAt: result.updatedAt,\n latestVersion: result.latestVersion,\n messagesCount: result.messages.length,\n }\n },\n })\n\n const updateChat = tool({\n description: 'Update properties of an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to update'),\n name: z.string().optional().describe('New name for the chat'),\n privacy: z\n .enum(['public', 'private', 'team', 'team-edit', 'unlisted'])\n .optional()\n .describe('New privacy setting'),\n }),\n execute: async (params) => {\n const { chatId, name, privacy } = params\n const result = await client.chats.update({ chatId, name, privacy })\n\n return {\n chatId: result.id,\n name: result.name,\n privacy: result.privacy,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const deleteChat = tool({\n description: 'Delete an existing chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to delete'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.chats.delete({ chatId })\n\n return {\n chatId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const favoriteChat = tool({\n description: 'Toggle favorite status of a chat',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat'),\n isFavorite: z.boolean().describe('Whether to mark as favorite or not'),\n }),\n execute: async (params) => {\n const { chatId, isFavorite } = params\n const result = await client.chats.favorite({ chatId, isFavorite })\n\n return {\n chatId: result.id,\n favorited: result.favorited,\n }\n },\n })\n\n const forkChat = tool({\n description: 'Fork an existing chat to create a new version',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat to fork'),\n versionId: z\n .string()\n .optional()\n .describe('Specific version ID to fork from'),\n privacy: z\n .enum(['public', 'private', 'team', 'team-edit', 'unlisted'])\n .optional()\n .describe('Privacy setting for the forked chat'),\n }),\n execute: async (params) => {\n const { chatId, versionId, privacy } = params\n const result = await client.chats.fork({ chatId, versionId, privacy })\n\n return {\n originalChatId: chatId,\n newChatId: result.id,\n webUrl: result.webUrl,\n privacy: result.privacy,\n createdAt: result.createdAt,\n }\n },\n })\n\n const listChats = tool({\n description: 'List all chats',\n inputSchema: z.object({\n limit: z.number().optional().describe('Number of chats to return'),\n offset: z.number().optional().describe('Offset for pagination'),\n isFavorite: z.boolean().optional().describe('Filter by favorite status'),\n }),\n execute: async (params) => {\n const { limit, offset, isFavorite } = params\n const result = await client.chats.find({ limit, offset, isFavorite })\n\n return {\n chats: result.data.map((chat) => ({\n chatId: chat.id,\n name: chat.name,\n privacy: chat.privacy,\n webUrl: chat.webUrl,\n favorite: chat.favorite,\n createdAt: chat.createdAt,\n updatedAt: chat.updatedAt,\n })),\n }\n },\n })\n\n return {\n createChat,\n sendMessage,\n getChat,\n updateChat,\n deleteChat,\n favoriteChat,\n forkChat,\n listChats,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates project-related AI SDK tools\n */\nexport function createProjectTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createProject = tool({\n description: 'Create a new project in v0',\n inputSchema: z.object({\n name: z.string().describe('Name of the project'),\n description: z.string().optional().describe('Description of the project'),\n icon: z.string().optional().describe('Icon for the project'),\n environmentVariables: z\n .array(\n z.object({\n key: z.string().describe('Environment variable key'),\n value: z.string().describe('Environment variable value'),\n }),\n )\n .optional()\n .describe('Environment variables for the project'),\n instructions: z\n .string()\n .optional()\n .describe('Custom instructions for the project'),\n vercelProjectId: z\n .string()\n .optional()\n .describe('Associated Vercel project ID'),\n privacy: z\n .enum(['private', 'team'])\n .optional()\n .describe('Privacy setting for the project'),\n }),\n execute: async ({\n name,\n description,\n icon,\n environmentVariables,\n instructions,\n vercelProjectId,\n privacy,\n }) => {\n const result = await client.projects.create({\n name,\n description,\n icon,\n environmentVariables,\n instructions,\n vercelProjectId,\n privacy,\n })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n privacy: result.privacy,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n createdAt: result.createdAt,\n vercelProjectId: result.vercelProjectId,\n }\n },\n })\n\n const getProject = tool({\n description: 'Get details of an existing project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to retrieve'),\n }),\n execute: async (params) => {\n const { projectId } = params\n const result = await client.projects.getById({ projectId })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n instructions: result.instructions,\n privacy: result.privacy,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n createdAt: result.createdAt,\n updatedAt: result.updatedAt,\n vercelProjectId: result.vercelProjectId,\n chatsCount: result.chats.length,\n }\n },\n })\n\n const updateProject = tool({\n description: 'Update properties of an existing project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to update'),\n name: z.string().optional().describe('New name for the project'),\n description: z\n .string()\n .optional()\n .describe('New description for the project'),\n instructions: z\n .string()\n .optional()\n .describe('New instructions for the project'),\n privacy: z\n .enum(['private', 'team'])\n .optional()\n .describe('New privacy setting'),\n }),\n execute: async ({\n projectId,\n name,\n description,\n instructions,\n privacy,\n }) => {\n const result = await client.projects.update({\n projectId,\n name,\n description,\n instructions,\n privacy,\n })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n instructions: result.instructions,\n privacy: result.privacy,\n updatedAt: result.updatedAt,\n }\n },\n })\n\n const listProjects = tool({\n description: 'List all projects',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.projects.find()\n\n return {\n projects: result.data.map((project) => ({\n projectId: project.id,\n name: project.name,\n privacy: project.privacy,\n webUrl: project.webUrl,\n createdAt: project.createdAt,\n updatedAt: project.updatedAt,\n vercelProjectId: project.vercelProjectId,\n })),\n }\n },\n })\n\n const assignChatToProject = tool({\n description: 'Assign a chat to a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n chatId: z.string().describe('ID of the chat to assign'),\n }),\n execute: async (params) => {\n const { projectId, chatId } = params\n const result = await client.projects.assign({ projectId, chatId })\n\n return {\n projectId: result.id,\n assigned: result.assigned,\n }\n },\n })\n\n const getProjectByChat = tool({\n description: 'Get project details by chat ID',\n inputSchema: z.object({\n chatId: z.string().describe('ID of the chat'),\n }),\n execute: async (params) => {\n const { chatId } = params\n const result = await client.projects.getByChatId({ chatId })\n\n return {\n projectId: result.id,\n name: result.name,\n description: result.description,\n privacy: result.privacy,\n webUrl: result.webUrl,\n createdAt: result.createdAt,\n chatsCount: result.chats.length,\n }\n },\n })\n\n // Environment Variables Tools\n const createEnvironmentVariables = tool({\n description: 'Create environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariables: z\n .array(\n z.object({\n key: z.string().describe('Environment variable key'),\n value: z.string().describe('Environment variable value'),\n }),\n )\n .describe('Environment variables to create'),\n upsert: z\n .boolean()\n .optional()\n .describe('Whether to upsert existing variables'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariables, upsert, decrypted } = params\n const result = await client.projects.createEnvVars({\n projectId,\n environmentVariables,\n upsert,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n createdAt: envVar.createdAt,\n })),\n }\n },\n })\n\n const listEnvironmentVariables = tool({\n description: 'List environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, decrypted } = params\n const result = await client.projects.findEnvVars({\n projectId,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n createdAt: envVar.createdAt,\n updatedAt: envVar.updatedAt,\n })),\n }\n },\n })\n\n const updateEnvironmentVariables = tool({\n description: 'Update environment variables for a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariables: z\n .array(\n z.object({\n id: z.string().describe('Environment variable ID'),\n value: z.string().describe('New environment variable value'),\n }),\n )\n .describe('Environment variables to update'),\n decrypted: z\n .boolean()\n .optional()\n .describe('Whether to return decrypted values'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariables, decrypted } = params\n const result = await client.projects.updateEnvVars({\n projectId,\n environmentVariables,\n decrypted,\n })\n\n return {\n environmentVariables: result.data.map((envVar) => ({\n id: envVar.id,\n key: envVar.key,\n value: envVar.value,\n decrypted: envVar.decrypted,\n updatedAt: envVar.updatedAt,\n })),\n }\n },\n })\n\n const deleteEnvironmentVariables = tool({\n description: 'Delete environment variables from a project',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n environmentVariableIds: z\n .array(z.string())\n .describe('IDs of environment variables to delete'),\n }),\n execute: async (params) => {\n const { projectId, environmentVariableIds } = params\n const result = await client.projects.deleteEnvVars({\n projectId,\n environmentVariableIds,\n })\n\n return {\n deletedVariables: result.data.map((envVar) => ({\n id: envVar.id,\n deleted: envVar.deleted,\n })),\n }\n },\n })\n\n return {\n createProject,\n getProject,\n updateProject,\n listProjects,\n assignChatToProject,\n getProjectByChat,\n createEnvironmentVariables,\n listEnvironmentVariables,\n updateEnvironmentVariables,\n deleteEnvironmentVariables,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates deployment-related AI SDK tools\n */\nexport function createDeploymentTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createDeployment = tool({\n description: 'Create a new deployment from a chat version',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project to deploy to'),\n chatId: z.string().describe('ID of the chat to deploy'),\n versionId: z.string().describe('ID of the specific version to deploy'),\n }),\n execute: async (params) => {\n const { projectId, chatId, versionId } = params\n const result = await client.deployments.create({\n projectId,\n chatId,\n versionId,\n })\n\n return {\n deploymentId: result.id,\n projectId: result.projectId,\n chatId: result.chatId,\n versionId: result.versionId,\n inspectorUrl: result.inspectorUrl,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n }\n },\n })\n\n const getDeployment = tool({\n description: 'Get details of an existing deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment to retrieve'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.getById({ deploymentId })\n\n return {\n deploymentId: result.id,\n projectId: result.projectId,\n chatId: result.chatId,\n versionId: result.versionId,\n inspectorUrl: result.inspectorUrl,\n webUrl: result.webUrl,\n apiUrl: result.apiUrl,\n }\n },\n })\n\n const deleteDeployment = tool({\n description: 'Delete an existing deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment to delete'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.delete({ deploymentId })\n\n return {\n deploymentId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const listDeployments = tool({\n description: 'List deployments by project, chat, and version',\n inputSchema: z.object({\n projectId: z.string().describe('ID of the project'),\n chatId: z.string().describe('ID of the chat'),\n versionId: z.string().describe('ID of the version'),\n }),\n execute: async (params) => {\n const { projectId, chatId, versionId } = params\n const result = await client.deployments.find({\n projectId,\n chatId,\n versionId,\n })\n\n return {\n deployments: result.data.map((deployment) => ({\n deploymentId: deployment.id,\n projectId: deployment.projectId,\n chatId: deployment.chatId,\n versionId: deployment.versionId,\n inspectorUrl: deployment.inspectorUrl,\n webUrl: deployment.webUrl,\n apiUrl: deployment.apiUrl,\n })),\n }\n },\n })\n\n const getDeploymentLogs = tool({\n description: 'Get logs for a deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment'),\n since: z.number().optional().describe('Timestamp to get logs since'),\n }),\n execute: async (params) => {\n const { deploymentId, since } = params\n const result = await client.deployments.findLogs({\n deploymentId,\n since,\n })\n\n return {\n logs: result.logs,\n nextSince: result.nextSince,\n }\n },\n })\n\n const getDeploymentErrors = tool({\n description: 'Get errors for a deployment',\n inputSchema: z.object({\n deploymentId: z.string().describe('ID of the deployment'),\n }),\n execute: async (params) => {\n const { deploymentId } = params\n const result = await client.deployments.findErrors({ deploymentId })\n\n return {\n fullErrorText: result.fullErrorText,\n errorType: result.errorType,\n formattedError: result.formattedError,\n }\n },\n })\n\n return {\n createDeployment,\n getDeployment,\n deleteDeployment,\n listDeployments,\n getDeploymentLogs,\n getDeploymentErrors,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates user-related AI SDK tools\n */\nexport function createUserTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const getCurrentUser = tool({\n description: 'Get current user information',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.get()\n\n return {\n userId: result.id,\n name: result.name,\n email: result.email,\n avatar: result.avatar,\n }\n },\n })\n\n const getUserBilling = tool({\n description: 'Get current user billing information',\n inputSchema: z.object({\n scope: z.string().optional().describe('Scope for billing information'),\n }),\n execute: async (params) => {\n const { scope } = params\n const result = await client.user.getBilling({ scope })\n\n if (result.billingType === 'token') {\n return {\n billingType: result.billingType,\n plan: result.data.plan,\n role: result.data.role,\n billingMode: result.data.billingMode,\n billingCycle: {\n start: result.data.billingCycle.start,\n end: result.data.billingCycle.end,\n },\n balance: {\n remaining: result.data.balance.remaining,\n total: result.data.balance.total,\n },\n onDemand: {\n balance: result.data.onDemand.balance,\n blocks: result.data.onDemand.blocks,\n },\n }\n } else {\n return {\n billingType: result.billingType,\n remaining: result.data.remaining,\n reset: result.data.reset,\n limit: result.data.limit,\n }\n }\n },\n })\n\n const getUserPlan = tool({\n description: 'Get current user plan information',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.getPlan()\n\n return {\n plan: result.plan,\n billingCycle: {\n start: result.billingCycle.start,\n end: result.billingCycle.end,\n },\n balance: {\n remaining: result.balance.remaining,\n total: result.balance.total,\n },\n }\n },\n })\n\n const getUserScopes = tool({\n description: 'Get user scopes/permissions',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.user.getScopes()\n\n return {\n scopes: result.data.map((scope) => ({\n id: scope.id,\n name: scope.name,\n })),\n }\n },\n })\n\n const getRateLimits = tool({\n description: 'Get current rate limit information',\n inputSchema: z.object({\n scope: z.string().optional().describe('Scope for rate limit information'),\n }),\n execute: async (params) => {\n const { scope } = params\n const result = await client.rateLimits.find({ scope })\n\n return {\n remaining: result.remaining,\n reset: result.reset,\n limit: result.limit,\n }\n },\n })\n\n return {\n getCurrentUser,\n getUserBilling,\n getUserPlan,\n getUserScopes,\n getRateLimits,\n }\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport { createClient, type V0ClientConfig } from 'v0-sdk'\n\n/**\n * Creates webhook-related AI SDK tools\n */\nexport function createHookTools(config: V0ClientConfig = {}) {\n const client = createClient(config)\n\n const createHook = tool({\n description: 'Create a new webhook for v0 events',\n inputSchema: z.object({\n name: z.string().describe('Name of the webhook'),\n url: z.string().describe('URL to send webhook events to'),\n events: z\n .array(\n z.enum([\n 'chat.created',\n 'chat.updated',\n 'chat.deleted',\n 'message.created',\n 'message.updated',\n 'message.deleted',\n ]),\n )\n .describe('Events to listen for'),\n chatId: z\n .string()\n .optional()\n .describe('Specific chat ID to listen to events for'),\n }),\n execute: async (params) => {\n const { name, url, events, chatId } = params\n const result = await client.hooks.create({\n name,\n url,\n events,\n chatId,\n })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const getHook = tool({\n description: 'Get details of an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to retrieve'),\n }),\n execute: async (params) => {\n const { hookId } = params\n const result = await client.hooks.getById({ hookId })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const updateHook = tool({\n description: 'Update properties of an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to update'),\n name: z.string().optional().describe('New name for the webhook'),\n url: z.string().optional().describe('New URL for the webhook'),\n events: z\n .array(\n z.enum([\n 'chat.created',\n 'chat.updated',\n 'chat.deleted',\n 'message.created',\n 'message.updated',\n 'message.deleted',\n ]),\n )\n .optional()\n .describe('New events to listen for'),\n }),\n execute: async (params) => {\n const { hookId, name, url, events } = params\n const result = await client.hooks.update({\n hookId,\n name,\n url,\n events,\n })\n\n return {\n hookId: result.id,\n name: result.name,\n url: result.url,\n events: result.events,\n chatId: result.chatId,\n }\n },\n })\n\n const deleteHook = tool({\n description: 'Delete an existing webhook',\n inputSchema: z.object({\n hookId: z.string().describe('ID of the webhook to delete'),\n }),\n execute: async (params) => {\n const { hookId } = params\n const result = await client.hooks.delete({ hookId })\n\n return {\n hookId: result.id,\n deleted: result.deleted,\n }\n },\n })\n\n const listHooks = tool({\n description: 'List all webhooks',\n inputSchema: z.object({}),\n execute: async () => {\n const result = await client.hooks.find()\n\n return {\n hooks: result.data.map((hook) => ({\n hookId: hook.id,\n name: hook.name,\n })),\n }\n },\n })\n\n return {\n createHook,\n getHook,\n updateHook,\n deleteHook,\n listHooks,\n }\n}\n","import type { V0ToolsConfig } from './types'\nimport { createChatTools } from './tools/chat-tools'\nimport { createProjectTools } from './tools/project-tools'\nimport { createDeploymentTools } from './tools/deployment-tools'\nimport { createUserTools } from './tools/user-tools'\nimport { createHookTools } from './tools/hook-tools'\n\n/**\n * Creates all v0 AI SDK tools as a flat object.\n *\n * ⚠️ Note: This includes ALL available tools (~20+ tools) which adds significant context.\n * Consider using v0ToolsByCategory() to select only the tools you need.\n *\n * @param config Configuration for v0 client\n * @returns Flat object with all v0 tools ready to use with AI SDK\n *\n * @example\n * ```typescript\n * import { generateText } from 'ai'\n * import { v0Tools } from '@v0-sdk/ai-tools'\n *\n * const result = await generateText({\n * model: 'openai/gpt-4',\n * prompt: 'Create a new React component',\n * tools: v0Tools({\n * apiKey: process.env.V0_API_KEY\n * })\n * })\n * ```\n */\nexport function v0Tools(config: V0ToolsConfig = {}) {\n // Use environment variable if apiKey not provided\n const clientConfig = {\n ...config,\n apiKey: config.apiKey || process.env.V0_API_KEY,\n }\n\n const chatTools = createChatTools(clientConfig)\n const projectTools = createProjectTools(clientConfig)\n const deploymentTools = createDeploymentTools(clientConfig)\n const userTools = createUserTools(clientConfig)\n const hookTools = createHookTools(clientConfig)\n\n return {\n ...chatTools,\n ...projectTools,\n ...deploymentTools,\n ...userTools,\n ...hookTools,\n }\n}\n\n/**\n * Creates v0 tools organized by category for selective usage (recommended).\n * This allows you to include only the tools you need, reducing context size.\n *\n * @param config Configuration for v0 client\n * @returns Object containing all v0 tools organized by category\n *\n * @example\n * ```typescript\n * import { generateText } from 'ai'\n * import { v0ToolsByCategory } from '@v0-sdk/ai-tools'\n *\n * const tools = v0ToolsByCategory({\n * apiKey: process.env.V0_API_KEY\n * })\n *\n * // Only include chat and project tools\n * const result = await generateText({\n * model: 'openai/gpt-4',\n * prompt: 'Create a new React component',\n * tools: {\n * ...tools.chat,\n * ...tools.project\n * }\n * })\n * ```\n */\nexport function v0ToolsByCategory(config: V0ToolsConfig = {}) {\n // Use environment variable if apiKey not provided\n const clientConfig = {\n ...config,\n apiKey: config.apiKey || process.env.V0_API_KEY,\n }\n\n return {\n /**\n * Chat-related tools for creating, managing, and interacting with v0 chats\n */\n chat: createChatTools(clientConfig),\n\n /**\n * Project-related tools for creating and managing v0 projects\n */\n project: createProjectTools(clientConfig),\n\n /**\n * Deployment-related tools for creating and managing deployments\n */\n deployment: createDeploymentTools(clientConfig),\n\n /**\n * User-related tools for getting user information, billing, and rate limits\n */\n user: createUserTools(clientConfig),\n\n /**\n * Webhook tools for creating and managing event hooks\n */\n hook: createHookTools(clientConfig),\n }\n}\n\n/**\n * @deprecated Use v0Tools instead (now returns flat structure by default)\n */\nexport function v0ToolsFlat(config: V0ToolsConfig = {}) {\n return v0Tools(config)\n}\n\n// Export individual tool creators for more granular usage\nexport { createChatTools } from './tools/chat-tools'\nexport { createProjectTools } from './tools/project-tools'\nexport { createDeploymentTools } from './tools/deployment-tools'\nexport { createUserTools } from './tools/user-tools'\nexport { createHookTools } from './tools/hook-tools'\n\n// Export types\nexport type { V0ToolsConfig } from './types'\n\n// Default export\nexport default v0Tools\n"],"names":[],"mappings":";;;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpKA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1IA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvEA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzEA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
package/dist/index.js CHANGED
@@ -24,10 +24,10 @@ import { createClient } from 'v0-sdk';
24
24
  projectId: z.string().optional().describe('Project ID to associate with the chat'),
25
25
  modelConfiguration: z.object({
26
26
  modelId: z.enum([
27
- 'v0-1.5-sm',
28
- 'v0-1.5-md',
29
- 'v0-1.5-lg',
30
- 'v0-gpt-5'
27
+ 'v0-mini',
28
+ 'v0-pro',
29
+ 'v0-max',
30
+ 'v0-max-fast'
31
31
  ]).describe('Model to use for the chat'),
32
32
  imageGenerations: z.boolean().optional().describe('Enable image generations'),
33
33
  thinking: z.boolean().optional().describe('Enable thinking mode')
@@ -82,10 +82,10 @@ import { createClient } from 'v0-sdk';
82
82
  })).optional().describe('File attachments for the message'),
83
83
  modelConfiguration: z.object({
84
84
  modelId: z.enum([
85
- 'v0-1.5-sm',
86
- 'v0-1.5-md',
87
- 'v0-1.5-lg',
88
- 'v0-gpt-5'
85
+ 'v0-mini',
86
+ 'v0-pro',
87
+ 'v0-max',
88
+ 'v0-max-fast'
89
89
  ]).describe('Model to use'),
90
90
  imageGenerations: z.boolean().optional().describe('Enable image generations'),
91
91
  thinking: z.boolean().optional().describe('Enable thinking mode')
@@ -667,7 +667,6 @@ import { createClient } from 'v0-sdk';
667
667
  deploymentId
668
668
  });
669
669
  return {
670
- error: result.error,
671
670
  fullErrorText: result.fullErrorText,
672
671
  errorType: result.errorType,
673
672
  formattedError: result.formattedError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v0-sdk/ai-tools",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "AI SDK tools for the v0 Platform API",
5
5
  "homepage": "https://v0.dev/docs/api",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "license": "Apache-2.0",
33
33
  "dependencies": {
34
34
  "zod": "^3.23.8",
35
- "v0-sdk": "0.16.0"
35
+ "v0-sdk": "0.16.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^22.12.0",