@v0-sdk/ai-tools 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +28 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -239,9 +239,9 @@ var v0Sdk = require('v0-sdk');
|
|
|
239
239
|
const listChats = ai.tool({
|
|
240
240
|
description: 'List all chats',
|
|
241
241
|
inputSchema: zod.z.object({
|
|
242
|
-
limit: zod.z.
|
|
243
|
-
offset: zod.z.
|
|
244
|
-
isFavorite: zod.z.
|
|
242
|
+
limit: zod.z.number().optional().describe('Number of chats to return'),
|
|
243
|
+
offset: zod.z.number().optional().describe('Offset for pagination'),
|
|
244
|
+
isFavorite: zod.z.boolean().optional().describe('Filter by favorite status')
|
|
245
245
|
}),
|
|
246
246
|
execute: async (params)=>{
|
|
247
247
|
const { limit, offset, isFavorite } = params;
|
|
@@ -440,7 +440,7 @@ var v0Sdk = require('v0-sdk');
|
|
|
440
440
|
value: zod.z.string().describe('Environment variable value')
|
|
441
441
|
})).describe('Environment variables to create'),
|
|
442
442
|
upsert: zod.z.boolean().optional().describe('Whether to upsert existing variables'),
|
|
443
|
-
decrypted: zod.z.
|
|
443
|
+
decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
|
|
444
444
|
}),
|
|
445
445
|
execute: async (params)=>{
|
|
446
446
|
const { projectId, environmentVariables, upsert, decrypted } = params;
|
|
@@ -465,7 +465,7 @@ var v0Sdk = require('v0-sdk');
|
|
|
465
465
|
description: 'List environment variables for a project',
|
|
466
466
|
inputSchema: zod.z.object({
|
|
467
467
|
projectId: zod.z.string().describe('ID of the project'),
|
|
468
|
-
decrypted: zod.z.
|
|
468
|
+
decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
|
|
469
469
|
}),
|
|
470
470
|
execute: async (params)=>{
|
|
471
471
|
const { projectId, decrypted } = params;
|
|
@@ -493,7 +493,7 @@ var v0Sdk = require('v0-sdk');
|
|
|
493
493
|
id: zod.z.string().describe('Environment variable ID'),
|
|
494
494
|
value: zod.z.string().describe('New environment variable value')
|
|
495
495
|
})).describe('Environment variables to update'),
|
|
496
|
-
decrypted: zod.z.
|
|
496
|
+
decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
|
|
497
497
|
}),
|
|
498
498
|
execute: async (params)=>{
|
|
499
499
|
const { projectId, environmentVariables, decrypted } = params;
|
|
@@ -644,7 +644,7 @@ var v0Sdk = require('v0-sdk');
|
|
|
644
644
|
description: 'Get logs for a deployment',
|
|
645
645
|
inputSchema: zod.z.object({
|
|
646
646
|
deploymentId: zod.z.string().describe('ID of the deployment'),
|
|
647
|
-
since: zod.z.
|
|
647
|
+
since: zod.z.number().optional().describe('Timestamp to get logs since')
|
|
648
648
|
}),
|
|
649
649
|
execute: async (params)=>{
|
|
650
650
|
const { deploymentId, since } = params;
|
package/dist/index.d.ts
CHANGED
|
@@ -161,9 +161,9 @@ declare function createChatTools(config?: V0ClientConfig): {
|
|
|
161
161
|
createdAt: string;
|
|
162
162
|
}>;
|
|
163
163
|
listChats: ai.Tool<{
|
|
164
|
-
isFavorite?:
|
|
165
|
-
limit?:
|
|
166
|
-
offset?:
|
|
164
|
+
isFavorite?: boolean | undefined;
|
|
165
|
+
limit?: number | undefined;
|
|
166
|
+
offset?: number | undefined;
|
|
167
167
|
}, {
|
|
168
168
|
chats: {
|
|
169
169
|
chatId: string;
|
|
@@ -267,7 +267,7 @@ declare function createProjectTools(config?: V0ClientConfig): {
|
|
|
267
267
|
key: string;
|
|
268
268
|
}[];
|
|
269
269
|
upsert?: boolean | undefined;
|
|
270
|
-
decrypted?:
|
|
270
|
+
decrypted?: boolean | undefined;
|
|
271
271
|
}, {
|
|
272
272
|
environmentVariables: {
|
|
273
273
|
id: string;
|
|
@@ -279,7 +279,7 @@ declare function createProjectTools(config?: V0ClientConfig): {
|
|
|
279
279
|
}>;
|
|
280
280
|
listEnvironmentVariables: ai.Tool<{
|
|
281
281
|
projectId: string;
|
|
282
|
-
decrypted?:
|
|
282
|
+
decrypted?: boolean | undefined;
|
|
283
283
|
}, {
|
|
284
284
|
environmentVariables: {
|
|
285
285
|
id: string;
|
|
@@ -296,7 +296,7 @@ declare function createProjectTools(config?: V0ClientConfig): {
|
|
|
296
296
|
value: string;
|
|
297
297
|
id: string;
|
|
298
298
|
}[];
|
|
299
|
-
decrypted?:
|
|
299
|
+
decrypted?: boolean | undefined;
|
|
300
300
|
}, {
|
|
301
301
|
environmentVariables: {
|
|
302
302
|
id: string;
|
|
@@ -368,7 +368,7 @@ declare function createDeploymentTools(config?: V0ClientConfig): {
|
|
|
368
368
|
}>;
|
|
369
369
|
getDeploymentLogs: ai.Tool<{
|
|
370
370
|
deploymentId: string;
|
|
371
|
-
since?:
|
|
371
|
+
since?: number | undefined;
|
|
372
372
|
}, {
|
|
373
373
|
logs: string[];
|
|
374
374
|
error: string | undefined;
|
|
@@ -695,7 +695,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
|
|
|
695
695
|
}>;
|
|
696
696
|
getDeploymentLogs: ai.Tool<{
|
|
697
697
|
deploymentId: string;
|
|
698
|
-
since?:
|
|
698
|
+
since?: number | undefined;
|
|
699
699
|
}, {
|
|
700
700
|
logs: string[];
|
|
701
701
|
error: string | undefined;
|
|
@@ -795,7 +795,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
|
|
|
795
795
|
key: string;
|
|
796
796
|
}[];
|
|
797
797
|
upsert?: boolean | undefined;
|
|
798
|
-
decrypted?:
|
|
798
|
+
decrypted?: boolean | undefined;
|
|
799
799
|
}, {
|
|
800
800
|
environmentVariables: {
|
|
801
801
|
id: string;
|
|
@@ -807,7 +807,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
|
|
|
807
807
|
}>;
|
|
808
808
|
listEnvironmentVariables: ai.Tool<{
|
|
809
809
|
projectId: string;
|
|
810
|
-
decrypted?:
|
|
810
|
+
decrypted?: boolean | undefined;
|
|
811
811
|
}, {
|
|
812
812
|
environmentVariables: {
|
|
813
813
|
id: string;
|
|
@@ -824,7 +824,7 @@ declare function v0Tools(config?: V0ToolsConfig): {
|
|
|
824
824
|
value: string;
|
|
825
825
|
id: string;
|
|
826
826
|
}[];
|
|
827
|
-
decrypted?:
|
|
827
|
+
decrypted?: boolean | undefined;
|
|
828
828
|
}, {
|
|
829
829
|
environmentVariables: {
|
|
830
830
|
id: string;
|
|
@@ -986,9 +986,9 @@ declare function v0Tools(config?: V0ToolsConfig): {
|
|
|
986
986
|
createdAt: string;
|
|
987
987
|
}>;
|
|
988
988
|
listChats: ai.Tool<{
|
|
989
|
-
isFavorite?:
|
|
990
|
-
limit?:
|
|
991
|
-
offset?:
|
|
989
|
+
isFavorite?: boolean | undefined;
|
|
990
|
+
limit?: number | undefined;
|
|
991
|
+
offset?: number | undefined;
|
|
992
992
|
}, {
|
|
993
993
|
chats: {
|
|
994
994
|
chatId: string;
|
|
@@ -1176,9 +1176,9 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
|
|
|
1176
1176
|
createdAt: string;
|
|
1177
1177
|
}>;
|
|
1178
1178
|
listChats: ai.Tool<{
|
|
1179
|
-
isFavorite?:
|
|
1180
|
-
limit?:
|
|
1181
|
-
offset?:
|
|
1179
|
+
isFavorite?: boolean | undefined;
|
|
1180
|
+
limit?: number | undefined;
|
|
1181
|
+
offset?: number | undefined;
|
|
1182
1182
|
}, {
|
|
1183
1183
|
chats: {
|
|
1184
1184
|
chatId: string;
|
|
@@ -1281,7 +1281,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
|
|
|
1281
1281
|
key: string;
|
|
1282
1282
|
}[];
|
|
1283
1283
|
upsert?: boolean | undefined;
|
|
1284
|
-
decrypted?:
|
|
1284
|
+
decrypted?: boolean | undefined;
|
|
1285
1285
|
}, {
|
|
1286
1286
|
environmentVariables: {
|
|
1287
1287
|
id: string;
|
|
@@ -1293,7 +1293,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
|
|
|
1293
1293
|
}>;
|
|
1294
1294
|
listEnvironmentVariables: ai.Tool<{
|
|
1295
1295
|
projectId: string;
|
|
1296
|
-
decrypted?:
|
|
1296
|
+
decrypted?: boolean | undefined;
|
|
1297
1297
|
}, {
|
|
1298
1298
|
environmentVariables: {
|
|
1299
1299
|
id: string;
|
|
@@ -1310,7 +1310,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
|
|
|
1310
1310
|
value: string;
|
|
1311
1311
|
id: string;
|
|
1312
1312
|
}[];
|
|
1313
|
-
decrypted?:
|
|
1313
|
+
decrypted?: boolean | undefined;
|
|
1314
1314
|
}, {
|
|
1315
1315
|
environmentVariables: {
|
|
1316
1316
|
id: string;
|
|
@@ -1381,7 +1381,7 @@ declare function v0ToolsByCategory(config?: V0ToolsConfig): {
|
|
|
1381
1381
|
}>;
|
|
1382
1382
|
getDeploymentLogs: ai.Tool<{
|
|
1383
1383
|
deploymentId: string;
|
|
1384
|
-
since?:
|
|
1384
|
+
since?: number | undefined;
|
|
1385
1385
|
}, {
|
|
1386
1386
|
logs: string[];
|
|
1387
1387
|
error: string | undefined;
|
|
@@ -1686,7 +1686,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
|
|
|
1686
1686
|
}>;
|
|
1687
1687
|
getDeploymentLogs: ai.Tool<{
|
|
1688
1688
|
deploymentId: string;
|
|
1689
|
-
since?:
|
|
1689
|
+
since?: number | undefined;
|
|
1690
1690
|
}, {
|
|
1691
1691
|
logs: string[];
|
|
1692
1692
|
error: string | undefined;
|
|
@@ -1786,7 +1786,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
|
|
|
1786
1786
|
key: string;
|
|
1787
1787
|
}[];
|
|
1788
1788
|
upsert?: boolean | undefined;
|
|
1789
|
-
decrypted?:
|
|
1789
|
+
decrypted?: boolean | undefined;
|
|
1790
1790
|
}, {
|
|
1791
1791
|
environmentVariables: {
|
|
1792
1792
|
id: string;
|
|
@@ -1798,7 +1798,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
|
|
|
1798
1798
|
}>;
|
|
1799
1799
|
listEnvironmentVariables: ai.Tool<{
|
|
1800
1800
|
projectId: string;
|
|
1801
|
-
decrypted?:
|
|
1801
|
+
decrypted?: boolean | undefined;
|
|
1802
1802
|
}, {
|
|
1803
1803
|
environmentVariables: {
|
|
1804
1804
|
id: string;
|
|
@@ -1815,7 +1815,7 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
|
|
|
1815
1815
|
value: string;
|
|
1816
1816
|
id: string;
|
|
1817
1817
|
}[];
|
|
1818
|
-
decrypted?:
|
|
1818
|
+
decrypted?: boolean | undefined;
|
|
1819
1819
|
}, {
|
|
1820
1820
|
environmentVariables: {
|
|
1821
1821
|
id: string;
|
|
@@ -1977,9 +1977,9 @@ declare function v0ToolsFlat(config?: V0ToolsConfig): {
|
|
|
1977
1977
|
createdAt: string;
|
|
1978
1978
|
}>;
|
|
1979
1979
|
listChats: ai.Tool<{
|
|
1980
|
-
isFavorite?:
|
|
1981
|
-
limit?:
|
|
1982
|
-
offset?:
|
|
1980
|
+
isFavorite?: boolean | undefined;
|
|
1981
|
+
limit?: number | undefined;
|
|
1982
|
+
offset?: number | undefined;
|
|
1983
1983
|
}, {
|
|
1984
1984
|
chats: {
|
|
1985
1985
|
chatId: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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.string().optional().describe('Number of chats to return'),\n offset: z.string().optional().describe('Offset for pagination'),\n isFavorite: z.string().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 .string()\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 .string()\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({ projectId, decrypted })\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 .string()\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.string().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 error: result.error,\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;;ACjKA;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;;ACjEA;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;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;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;;;"}
|
|
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 error: result.error,\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;;ACjKA;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;;ACjEA;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;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;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;;;"}
|
package/dist/index.js
CHANGED
|
@@ -237,9 +237,9 @@ import { createClient } from 'v0-sdk';
|
|
|
237
237
|
const listChats = tool({
|
|
238
238
|
description: 'List all chats',
|
|
239
239
|
inputSchema: z.object({
|
|
240
|
-
limit: z.
|
|
241
|
-
offset: z.
|
|
242
|
-
isFavorite: z.
|
|
240
|
+
limit: z.number().optional().describe('Number of chats to return'),
|
|
241
|
+
offset: z.number().optional().describe('Offset for pagination'),
|
|
242
|
+
isFavorite: z.boolean().optional().describe('Filter by favorite status')
|
|
243
243
|
}),
|
|
244
244
|
execute: async (params)=>{
|
|
245
245
|
const { limit, offset, isFavorite } = params;
|
|
@@ -438,7 +438,7 @@ import { createClient } from 'v0-sdk';
|
|
|
438
438
|
value: z.string().describe('Environment variable value')
|
|
439
439
|
})).describe('Environment variables to create'),
|
|
440
440
|
upsert: z.boolean().optional().describe('Whether to upsert existing variables'),
|
|
441
|
-
decrypted: z.
|
|
441
|
+
decrypted: z.boolean().optional().describe('Whether to return decrypted values')
|
|
442
442
|
}),
|
|
443
443
|
execute: async (params)=>{
|
|
444
444
|
const { projectId, environmentVariables, upsert, decrypted } = params;
|
|
@@ -463,7 +463,7 @@ import { createClient } from 'v0-sdk';
|
|
|
463
463
|
description: 'List environment variables for a project',
|
|
464
464
|
inputSchema: z.object({
|
|
465
465
|
projectId: z.string().describe('ID of the project'),
|
|
466
|
-
decrypted: z.
|
|
466
|
+
decrypted: z.boolean().optional().describe('Whether to return decrypted values')
|
|
467
467
|
}),
|
|
468
468
|
execute: async (params)=>{
|
|
469
469
|
const { projectId, decrypted } = params;
|
|
@@ -491,7 +491,7 @@ import { createClient } from 'v0-sdk';
|
|
|
491
491
|
id: z.string().describe('Environment variable ID'),
|
|
492
492
|
value: z.string().describe('New environment variable value')
|
|
493
493
|
})).describe('Environment variables to update'),
|
|
494
|
-
decrypted: z.
|
|
494
|
+
decrypted: z.boolean().optional().describe('Whether to return decrypted values')
|
|
495
495
|
}),
|
|
496
496
|
execute: async (params)=>{
|
|
497
497
|
const { projectId, environmentVariables, decrypted } = params;
|
|
@@ -642,7 +642,7 @@ import { createClient } from 'v0-sdk';
|
|
|
642
642
|
description: 'Get logs for a deployment',
|
|
643
643
|
inputSchema: z.object({
|
|
644
644
|
deploymentId: z.string().describe('ID of the deployment'),
|
|
645
|
-
since: z.
|
|
645
|
+
since: z.number().optional().describe('Timestamp to get logs since')
|
|
646
646
|
}),
|
|
647
647
|
execute: async (params)=>{
|
|
648
648
|
const { deploymentId, since } = params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v0-sdk/ai-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
35
|
+
"v0-sdk": "0.12.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.12.0",
|