@v0-sdk/ai-tools 0.3.9 → 3.0.0-canary.4360778

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,1031 +1 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
-
3
- var ai = require('ai');
4
- var zod = require('zod');
5
- var v0Sdk = require('v0-sdk');
6
-
7
- /**
8
- * Creates chat-related AI SDK tools
9
- */ function createChatTools(config = {}) {
10
- const client = v0Sdk.createClient(config);
11
- const createChat = ai.tool({
12
- description: 'Create a new chat with v0',
13
- inputSchema: zod.z.object({
14
- message: zod.z.string().describe('The initial message to start the chat'),
15
- system: zod.z.string().optional().describe('System prompt for the chat'),
16
- attachments: zod.z.array(zod.z.object({
17
- url: zod.z.string().describe('URL of the attachment')
18
- })).optional().describe('File attachments for the chat'),
19
- chatPrivacy: zod.z.enum([
20
- 'public',
21
- 'private',
22
- 'team-edit',
23
- 'team',
24
- 'unlisted'
25
- ]).optional().describe('Privacy setting for the chat'),
26
- projectId: zod.z.string().optional().describe('Project ID to associate with the chat'),
27
- modelConfiguration: zod.z.object({
28
- modelId: zod.z.enum([
29
- 'v0-mini',
30
- 'v0-pro',
31
- 'v0-max',
32
- 'v0-max-fast'
33
- ]).describe('Model to use for the chat'),
34
- imageGenerations: zod.z.boolean().optional().describe('Enable image generations'),
35
- thinking: zod.z.boolean().optional().describe('Enable thinking mode')
36
- }).optional().describe('Model configuration for the chat'),
37
- responseMode: zod.z.enum([
38
- 'sync',
39
- 'async'
40
- ]).optional().describe('Response mode for the chat')
41
- }),
42
- execute: async ({ message, system, attachments, chatPrivacy, projectId, modelConfiguration, responseMode })=>{
43
- const result = await client.chats.create({
44
- message,
45
- system,
46
- attachments,
47
- chatPrivacy,
48
- projectId,
49
- modelConfiguration,
50
- responseMode
51
- });
52
- // Handle streaming vs non-streaming responses
53
- if (result instanceof ReadableStream) {
54
- return {
55
- chatId: 'streaming-chat',
56
- webUrl: 'N/A (streaming response)',
57
- apiUrl: 'N/A (streaming response)',
58
- privacy: 'N/A (streaming response)',
59
- name: 'N/A (streaming response)',
60
- favorite: false,
61
- latestVersion: 'N/A (streaming response)',
62
- createdAt: 'N/A (streaming response)'
63
- };
64
- }
65
- return {
66
- chatId: result.id,
67
- webUrl: result.webUrl,
68
- apiUrl: result.apiUrl,
69
- privacy: result.privacy,
70
- name: result.name,
71
- favorite: result.favorite,
72
- latestVersion: result.latestVersion,
73
- createdAt: result.createdAt
74
- };
75
- }
76
- });
77
- const sendMessage = ai.tool({
78
- description: 'Send a message to an existing chat',
79
- inputSchema: zod.z.object({
80
- chatId: zod.z.string().describe('ID of the chat to send message to'),
81
- message: zod.z.string().describe('Message content to send'),
82
- attachments: zod.z.array(zod.z.object({
83
- url: zod.z.string().describe('URL of the attachment')
84
- })).optional().describe('File attachments for the message'),
85
- modelConfiguration: zod.z.object({
86
- modelId: zod.z.enum([
87
- 'v0-mini',
88
- 'v0-pro',
89
- 'v0-max',
90
- 'v0-max-fast'
91
- ]).describe('Model to use'),
92
- imageGenerations: zod.z.boolean().optional().describe('Enable image generations'),
93
- thinking: zod.z.boolean().optional().describe('Enable thinking mode')
94
- }).optional().describe('Model configuration'),
95
- responseMode: zod.z.enum([
96
- 'sync',
97
- 'async'
98
- ]).optional().describe('Response mode')
99
- }),
100
- execute: async ({ chatId, message, attachments, modelConfiguration, responseMode })=>{
101
- const result = await client.chats.sendMessage({
102
- chatId,
103
- message,
104
- attachments,
105
- modelConfiguration,
106
- responseMode
107
- });
108
- // Handle streaming vs non-streaming responses
109
- if (result instanceof ReadableStream) {
110
- return {
111
- chatId: 'streaming-chat',
112
- webUrl: 'N/A (streaming response)',
113
- latestVersion: 'N/A (streaming response)',
114
- updatedAt: 'N/A (streaming response)'
115
- };
116
- }
117
- return {
118
- chatId: result.id,
119
- webUrl: result.webUrl,
120
- latestVersion: result.latestVersion,
121
- updatedAt: result.updatedAt
122
- };
123
- }
124
- });
125
- const getChat = ai.tool({
126
- description: 'Get details of an existing chat',
127
- inputSchema: zod.z.object({
128
- chatId: zod.z.string().describe('ID of the chat to retrieve')
129
- }),
130
- execute: async (params)=>{
131
- const { chatId } = params;
132
- const result = await client.chats.getById({
133
- chatId
134
- });
135
- return {
136
- chatId: result.id,
137
- name: result.name,
138
- privacy: result.privacy,
139
- webUrl: result.webUrl,
140
- favorite: result.favorite,
141
- createdAt: result.createdAt,
142
- updatedAt: result.updatedAt,
143
- latestVersion: result.latestVersion,
144
- messagesCount: result.messages.length
145
- };
146
- }
147
- });
148
- const updateChat = ai.tool({
149
- description: 'Update properties of an existing chat',
150
- inputSchema: zod.z.object({
151
- chatId: zod.z.string().describe('ID of the chat to update'),
152
- name: zod.z.string().optional().describe('New name for the chat'),
153
- privacy: zod.z.enum([
154
- 'public',
155
- 'private',
156
- 'team',
157
- 'team-edit',
158
- 'unlisted'
159
- ]).optional().describe('New privacy setting')
160
- }),
161
- execute: async (params)=>{
162
- const { chatId, name, privacy } = params;
163
- const result = await client.chats.update({
164
- chatId,
165
- name,
166
- privacy
167
- });
168
- return {
169
- chatId: result.id,
170
- name: result.name,
171
- privacy: result.privacy,
172
- updatedAt: result.updatedAt
173
- };
174
- }
175
- });
176
- const deleteChat = ai.tool({
177
- description: 'Delete an existing chat',
178
- inputSchema: zod.z.object({
179
- chatId: zod.z.string().describe('ID of the chat to delete')
180
- }),
181
- execute: async (params)=>{
182
- const { chatId } = params;
183
- const result = await client.chats.delete({
184
- chatId
185
- });
186
- return {
187
- chatId: result.id,
188
- deleted: result.deleted
189
- };
190
- }
191
- });
192
- const favoriteChat = ai.tool({
193
- description: 'Toggle favorite status of a chat',
194
- inputSchema: zod.z.object({
195
- chatId: zod.z.string().describe('ID of the chat'),
196
- isFavorite: zod.z.boolean().describe('Whether to mark as favorite or not')
197
- }),
198
- execute: async (params)=>{
199
- const { chatId, isFavorite } = params;
200
- const result = await client.chats.favorite({
201
- chatId,
202
- isFavorite
203
- });
204
- return {
205
- chatId: result.id,
206
- favorited: result.favorited
207
- };
208
- }
209
- });
210
- const forkChat = ai.tool({
211
- description: 'Fork an existing chat to create a new version',
212
- inputSchema: zod.z.object({
213
- chatId: zod.z.string().describe('ID of the chat to fork'),
214
- versionId: zod.z.string().optional().describe('Specific version ID to fork from'),
215
- privacy: zod.z.enum([
216
- 'public',
217
- 'private',
218
- 'team',
219
- 'team-edit',
220
- 'unlisted'
221
- ]).optional().describe('Privacy setting for the forked chat')
222
- }),
223
- execute: async (params)=>{
224
- const { chatId, versionId, privacy } = params;
225
- const result = await client.chats.fork({
226
- chatId,
227
- versionId,
228
- privacy
229
- });
230
- return {
231
- originalChatId: chatId,
232
- newChatId: result.id,
233
- webUrl: result.webUrl,
234
- privacy: result.privacy,
235
- createdAt: result.createdAt
236
- };
237
- }
238
- });
239
- const listChats = ai.tool({
240
- description: 'List all chats',
241
- inputSchema: zod.z.object({
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
- }),
246
- execute: async (params)=>{
247
- const { limit, offset, isFavorite } = params;
248
- const result = await client.chats.find({
249
- limit,
250
- offset,
251
- isFavorite
252
- });
253
- return {
254
- chats: result.data.map((chat)=>({
255
- chatId: chat.id,
256
- name: chat.name,
257
- privacy: chat.privacy,
258
- webUrl: chat.webUrl,
259
- favorite: chat.favorite,
260
- createdAt: chat.createdAt,
261
- updatedAt: chat.updatedAt
262
- }))
263
- };
264
- }
265
- });
266
- return {
267
- createChat,
268
- sendMessage,
269
- getChat,
270
- updateChat,
271
- deleteChat,
272
- favoriteChat,
273
- forkChat,
274
- listChats
275
- };
276
- }
277
-
278
- /**
279
- * Creates project-related AI SDK tools
280
- */ function createProjectTools(config = {}) {
281
- const client = v0Sdk.createClient(config);
282
- const createProject = ai.tool({
283
- description: 'Create a new project in v0',
284
- inputSchema: zod.z.object({
285
- name: zod.z.string().describe('Name of the project'),
286
- description: zod.z.string().optional().describe('Description of the project'),
287
- icon: zod.z.string().optional().describe('Icon for the project'),
288
- environmentVariables: zod.z.array(zod.z.object({
289
- key: zod.z.string().describe('Environment variable key'),
290
- value: zod.z.string().describe('Environment variable value')
291
- })).optional().describe('Environment variables for the project'),
292
- instructions: zod.z.string().optional().describe('Custom instructions for the project'),
293
- vercelProjectId: zod.z.string().optional().describe('Associated Vercel project ID'),
294
- privacy: zod.z.enum([
295
- 'private',
296
- 'team'
297
- ]).optional().describe('Privacy setting for the project')
298
- }),
299
- execute: async ({ name, description, icon, environmentVariables, instructions, vercelProjectId, privacy })=>{
300
- const result = await client.projects.create({
301
- name,
302
- description,
303
- icon,
304
- environmentVariables,
305
- instructions,
306
- vercelProjectId,
307
- privacy
308
- });
309
- return {
310
- projectId: result.id,
311
- name: result.name,
312
- description: result.description,
313
- privacy: result.privacy,
314
- webUrl: result.webUrl,
315
- apiUrl: result.apiUrl,
316
- createdAt: result.createdAt,
317
- vercelProjectId: result.vercelProjectId
318
- };
319
- }
320
- });
321
- const getProject = ai.tool({
322
- description: 'Get details of an existing project',
323
- inputSchema: zod.z.object({
324
- projectId: zod.z.string().describe('ID of the project to retrieve')
325
- }),
326
- execute: async (params)=>{
327
- const { projectId } = params;
328
- const result = await client.projects.getById({
329
- projectId
330
- });
331
- return {
332
- projectId: result.id,
333
- name: result.name,
334
- description: result.description,
335
- instructions: result.instructions,
336
- privacy: result.privacy,
337
- webUrl: result.webUrl,
338
- apiUrl: result.apiUrl,
339
- createdAt: result.createdAt,
340
- updatedAt: result.updatedAt,
341
- vercelProjectId: result.vercelProjectId,
342
- chatsCount: result.chats.length
343
- };
344
- }
345
- });
346
- const updateProject = ai.tool({
347
- description: 'Update properties of an existing project',
348
- inputSchema: zod.z.object({
349
- projectId: zod.z.string().describe('ID of the project to update'),
350
- name: zod.z.string().optional().describe('New name for the project'),
351
- description: zod.z.string().optional().describe('New description for the project'),
352
- instructions: zod.z.string().optional().describe('New instructions for the project'),
353
- privacy: zod.z.enum([
354
- 'private',
355
- 'team'
356
- ]).optional().describe('New privacy setting')
357
- }),
358
- execute: async ({ projectId, name, description, instructions, privacy })=>{
359
- const result = await client.projects.update({
360
- projectId,
361
- name,
362
- description,
363
- instructions,
364
- privacy
365
- });
366
- return {
367
- projectId: result.id,
368
- name: result.name,
369
- description: result.description,
370
- instructions: result.instructions,
371
- privacy: result.privacy,
372
- updatedAt: result.updatedAt
373
- };
374
- }
375
- });
376
- const listProjects = ai.tool({
377
- description: 'List all projects',
378
- inputSchema: zod.z.object({}),
379
- execute: async ()=>{
380
- const result = await client.projects.find();
381
- return {
382
- projects: result.data.map((project)=>({
383
- projectId: project.id,
384
- name: project.name,
385
- privacy: project.privacy,
386
- webUrl: project.webUrl,
387
- createdAt: project.createdAt,
388
- updatedAt: project.updatedAt,
389
- vercelProjectId: project.vercelProjectId
390
- }))
391
- };
392
- }
393
- });
394
- const assignChatToProject = ai.tool({
395
- description: 'Assign a chat to a project',
396
- inputSchema: zod.z.object({
397
- projectId: zod.z.string().describe('ID of the project'),
398
- chatId: zod.z.string().describe('ID of the chat to assign')
399
- }),
400
- execute: async (params)=>{
401
- const { projectId, chatId } = params;
402
- const result = await client.projects.assign({
403
- projectId,
404
- chatId
405
- });
406
- return {
407
- projectId: result.id,
408
- assigned: result.assigned
409
- };
410
- }
411
- });
412
- const getProjectByChat = ai.tool({
413
- description: 'Get project details by chat ID',
414
- inputSchema: zod.z.object({
415
- chatId: zod.z.string().describe('ID of the chat')
416
- }),
417
- execute: async (params)=>{
418
- const { chatId } = params;
419
- const result = await client.projects.getByChatId({
420
- chatId
421
- });
422
- return {
423
- projectId: result.id,
424
- name: result.name,
425
- description: result.description,
426
- privacy: result.privacy,
427
- webUrl: result.webUrl,
428
- createdAt: result.createdAt,
429
- chatsCount: result.chats.length
430
- };
431
- }
432
- });
433
- // Environment Variables Tools
434
- const createEnvironmentVariables = ai.tool({
435
- description: 'Create environment variables for a project',
436
- inputSchema: zod.z.object({
437
- projectId: zod.z.string().describe('ID of the project'),
438
- environmentVariables: zod.z.array(zod.z.object({
439
- key: zod.z.string().describe('Environment variable key'),
440
- value: zod.z.string().describe('Environment variable value')
441
- })).describe('Environment variables to create'),
442
- upsert: zod.z.boolean().optional().describe('Whether to upsert existing variables'),
443
- decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
444
- }),
445
- execute: async (params)=>{
446
- const { projectId, environmentVariables, upsert, decrypted } = params;
447
- const result = await client.projects.createEnvVars({
448
- projectId,
449
- environmentVariables,
450
- upsert,
451
- decrypted
452
- });
453
- return {
454
- environmentVariables: result.data.map((envVar)=>({
455
- id: envVar.id,
456
- key: envVar.key,
457
- value: envVar.value,
458
- decrypted: envVar.decrypted,
459
- createdAt: envVar.createdAt
460
- }))
461
- };
462
- }
463
- });
464
- const listEnvironmentVariables = ai.tool({
465
- description: 'List environment variables for a project',
466
- inputSchema: zod.z.object({
467
- projectId: zod.z.string().describe('ID of the project'),
468
- decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
469
- }),
470
- execute: async (params)=>{
471
- const { projectId, decrypted } = params;
472
- const result = await client.projects.findEnvVars({
473
- projectId,
474
- decrypted
475
- });
476
- return {
477
- environmentVariables: result.data.map((envVar)=>({
478
- id: envVar.id,
479
- key: envVar.key,
480
- value: envVar.value,
481
- decrypted: envVar.decrypted,
482
- createdAt: envVar.createdAt,
483
- updatedAt: envVar.updatedAt
484
- }))
485
- };
486
- }
487
- });
488
- const updateEnvironmentVariables = ai.tool({
489
- description: 'Update environment variables for a project',
490
- inputSchema: zod.z.object({
491
- projectId: zod.z.string().describe('ID of the project'),
492
- environmentVariables: zod.z.array(zod.z.object({
493
- id: zod.z.string().describe('Environment variable ID'),
494
- value: zod.z.string().describe('New environment variable value')
495
- })).describe('Environment variables to update'),
496
- decrypted: zod.z.boolean().optional().describe('Whether to return decrypted values')
497
- }),
498
- execute: async (params)=>{
499
- const { projectId, environmentVariables, decrypted } = params;
500
- const result = await client.projects.updateEnvVars({
501
- projectId,
502
- environmentVariables,
503
- decrypted
504
- });
505
- return {
506
- environmentVariables: result.data.map((envVar)=>({
507
- id: envVar.id,
508
- key: envVar.key,
509
- value: envVar.value,
510
- decrypted: envVar.decrypted,
511
- updatedAt: envVar.updatedAt
512
- }))
513
- };
514
- }
515
- });
516
- const deleteEnvironmentVariables = ai.tool({
517
- description: 'Delete environment variables from a project',
518
- inputSchema: zod.z.object({
519
- projectId: zod.z.string().describe('ID of the project'),
520
- environmentVariableIds: zod.z.array(zod.z.string()).describe('IDs of environment variables to delete')
521
- }),
522
- execute: async (params)=>{
523
- const { projectId, environmentVariableIds } = params;
524
- const result = await client.projects.deleteEnvVars({
525
- projectId,
526
- environmentVariableIds
527
- });
528
- return {
529
- deletedVariables: result.data.map((envVar)=>({
530
- id: envVar.id,
531
- deleted: envVar.deleted
532
- }))
533
- };
534
- }
535
- });
536
- return {
537
- createProject,
538
- getProject,
539
- updateProject,
540
- listProjects,
541
- assignChatToProject,
542
- getProjectByChat,
543
- createEnvironmentVariables,
544
- listEnvironmentVariables,
545
- updateEnvironmentVariables,
546
- deleteEnvironmentVariables
547
- };
548
- }
549
-
550
- /**
551
- * Creates deployment-related AI SDK tools
552
- */ function createDeploymentTools(config = {}) {
553
- const client = v0Sdk.createClient(config);
554
- const createDeployment = ai.tool({
555
- description: 'Create a new deployment from a chat version',
556
- inputSchema: zod.z.object({
557
- projectId: zod.z.string().describe('ID of the project to deploy to'),
558
- chatId: zod.z.string().describe('ID of the chat to deploy'),
559
- versionId: zod.z.string().describe('ID of the specific version to deploy')
560
- }),
561
- execute: async (params)=>{
562
- const { projectId, chatId, versionId } = params;
563
- const result = await client.deployments.create({
564
- projectId,
565
- chatId,
566
- versionId
567
- });
568
- return {
569
- deploymentId: result.id,
570
- projectId: result.projectId,
571
- chatId: result.chatId,
572
- versionId: result.versionId,
573
- inspectorUrl: result.inspectorUrl,
574
- webUrl: result.webUrl,
575
- apiUrl: result.apiUrl
576
- };
577
- }
578
- });
579
- const getDeployment = ai.tool({
580
- description: 'Get details of an existing deployment',
581
- inputSchema: zod.z.object({
582
- deploymentId: zod.z.string().describe('ID of the deployment to retrieve')
583
- }),
584
- execute: async (params)=>{
585
- const { deploymentId } = params;
586
- const result = await client.deployments.getById({
587
- deploymentId
588
- });
589
- return {
590
- deploymentId: result.id,
591
- projectId: result.projectId,
592
- chatId: result.chatId,
593
- versionId: result.versionId,
594
- inspectorUrl: result.inspectorUrl,
595
- webUrl: result.webUrl,
596
- apiUrl: result.apiUrl
597
- };
598
- }
599
- });
600
- const deleteDeployment = ai.tool({
601
- description: 'Delete an existing deployment',
602
- inputSchema: zod.z.object({
603
- deploymentId: zod.z.string().describe('ID of the deployment to delete')
604
- }),
605
- execute: async (params)=>{
606
- const { deploymentId } = params;
607
- const result = await client.deployments.delete({
608
- deploymentId
609
- });
610
- return {
611
- deploymentId: result.id,
612
- deleted: result.deleted
613
- };
614
- }
615
- });
616
- const listDeployments = ai.tool({
617
- description: 'List deployments by project, chat, and version',
618
- inputSchema: zod.z.object({
619
- projectId: zod.z.string().describe('ID of the project'),
620
- chatId: zod.z.string().describe('ID of the chat'),
621
- versionId: zod.z.string().describe('ID of the version')
622
- }),
623
- execute: async (params)=>{
624
- const { projectId, chatId, versionId } = params;
625
- const result = await client.deployments.find({
626
- projectId,
627
- chatId,
628
- versionId
629
- });
630
- return {
631
- deployments: result.data.map((deployment)=>({
632
- deploymentId: deployment.id,
633
- projectId: deployment.projectId,
634
- chatId: deployment.chatId,
635
- versionId: deployment.versionId,
636
- inspectorUrl: deployment.inspectorUrl,
637
- webUrl: deployment.webUrl,
638
- apiUrl: deployment.apiUrl
639
- }))
640
- };
641
- }
642
- });
643
- const getDeploymentLogs = ai.tool({
644
- description: 'Get logs for a deployment',
645
- inputSchema: zod.z.object({
646
- deploymentId: zod.z.string().describe('ID of the deployment'),
647
- since: zod.z.number().optional().describe('Timestamp to get logs since')
648
- }),
649
- execute: async (params)=>{
650
- const { deploymentId, since } = params;
651
- const result = await client.deployments.findLogs({
652
- deploymentId,
653
- since
654
- });
655
- return {
656
- logs: result.logs,
657
- nextSince: result.nextSince
658
- };
659
- }
660
- });
661
- const getDeploymentErrors = ai.tool({
662
- description: 'Get errors for a deployment',
663
- inputSchema: zod.z.object({
664
- deploymentId: zod.z.string().describe('ID of the deployment')
665
- }),
666
- execute: async (params)=>{
667
- const { deploymentId } = params;
668
- const result = await client.deployments.findErrors({
669
- deploymentId
670
- });
671
- return {
672
- fullErrorText: result.fullErrorText,
673
- errorType: result.errorType,
674
- formattedError: result.formattedError
675
- };
676
- }
677
- });
678
- return {
679
- createDeployment,
680
- getDeployment,
681
- deleteDeployment,
682
- listDeployments,
683
- getDeploymentLogs,
684
- getDeploymentErrors
685
- };
686
- }
687
-
688
- /**
689
- * Creates user-related AI SDK tools
690
- */ function createUserTools(config = {}) {
691
- const client = v0Sdk.createClient(config);
692
- const getCurrentUser = ai.tool({
693
- description: 'Get current user information',
694
- inputSchema: zod.z.object({}),
695
- execute: async ()=>{
696
- const result = await client.user.get();
697
- return {
698
- userId: result.id,
699
- name: result.name,
700
- email: result.email,
701
- avatar: result.avatar
702
- };
703
- }
704
- });
705
- const getUserBilling = ai.tool({
706
- description: 'Get current user billing information',
707
- inputSchema: zod.z.object({
708
- scope: zod.z.string().optional().describe('Scope for billing information')
709
- }),
710
- execute: async (params)=>{
711
- const { scope } = params;
712
- const result = await client.user.getBilling({
713
- scope
714
- });
715
- if (result.billingType === 'token') {
716
- return {
717
- billingType: result.billingType,
718
- plan: result.data.plan,
719
- role: result.data.role,
720
- billingMode: result.data.billingMode,
721
- billingCycle: {
722
- start: result.data.billingCycle.start,
723
- end: result.data.billingCycle.end
724
- },
725
- balance: {
726
- remaining: result.data.balance.remaining,
727
- total: result.data.balance.total
728
- },
729
- onDemand: {
730
- balance: result.data.onDemand.balance,
731
- blocks: result.data.onDemand.blocks
732
- }
733
- };
734
- } else {
735
- return {
736
- billingType: result.billingType,
737
- remaining: result.data.remaining,
738
- reset: result.data.reset,
739
- limit: result.data.limit
740
- };
741
- }
742
- }
743
- });
744
- const getUserPlan = ai.tool({
745
- description: 'Get current user plan information',
746
- inputSchema: zod.z.object({}),
747
- execute: async ()=>{
748
- const result = await client.user.getPlan();
749
- return {
750
- plan: result.plan,
751
- billingCycle: {
752
- start: result.billingCycle.start,
753
- end: result.billingCycle.end
754
- },
755
- balance: {
756
- remaining: result.balance.remaining,
757
- total: result.balance.total
758
- }
759
- };
760
- }
761
- });
762
- const getUserScopes = ai.tool({
763
- description: 'Get user scopes/permissions',
764
- inputSchema: zod.z.object({}),
765
- execute: async ()=>{
766
- const result = await client.user.getScopes();
767
- return {
768
- scopes: result.data.map((scope)=>({
769
- id: scope.id,
770
- name: scope.name
771
- }))
772
- };
773
- }
774
- });
775
- const getRateLimits = ai.tool({
776
- description: 'Get current rate limit information',
777
- inputSchema: zod.z.object({
778
- scope: zod.z.string().optional().describe('Scope for rate limit information')
779
- }),
780
- execute: async (params)=>{
781
- const { scope } = params;
782
- const result = await client.rateLimits.find({
783
- scope
784
- });
785
- return {
786
- remaining: result.remaining,
787
- reset: result.reset,
788
- limit: result.limit
789
- };
790
- }
791
- });
792
- return {
793
- getCurrentUser,
794
- getUserBilling,
795
- getUserPlan,
796
- getUserScopes,
797
- getRateLimits
798
- };
799
- }
800
-
801
- /**
802
- * Creates webhook-related AI SDK tools
803
- */ function createHookTools(config = {}) {
804
- const client = v0Sdk.createClient(config);
805
- const createHook = ai.tool({
806
- description: 'Create a new webhook for v0 events',
807
- inputSchema: zod.z.object({
808
- name: zod.z.string().describe('Name of the webhook'),
809
- url: zod.z.string().describe('URL to send webhook events to'),
810
- events: zod.z.array(zod.z.enum([
811
- 'chat.created',
812
- 'chat.updated',
813
- 'chat.deleted',
814
- 'message.created',
815
- 'message.updated',
816
- 'message.deleted'
817
- ])).describe('Events to listen for'),
818
- chatId: zod.z.string().optional().describe('Specific chat ID to listen to events for')
819
- }),
820
- execute: async (params)=>{
821
- const { name, url, events, chatId } = params;
822
- const result = await client.hooks.create({
823
- name,
824
- url,
825
- events,
826
- chatId
827
- });
828
- return {
829
- hookId: result.id,
830
- name: result.name,
831
- url: result.url,
832
- events: result.events,
833
- chatId: result.chatId
834
- };
835
- }
836
- });
837
- const getHook = ai.tool({
838
- description: 'Get details of an existing webhook',
839
- inputSchema: zod.z.object({
840
- hookId: zod.z.string().describe('ID of the webhook to retrieve')
841
- }),
842
- execute: async (params)=>{
843
- const { hookId } = params;
844
- const result = await client.hooks.getById({
845
- hookId
846
- });
847
- return {
848
- hookId: result.id,
849
- name: result.name,
850
- url: result.url,
851
- events: result.events,
852
- chatId: result.chatId
853
- };
854
- }
855
- });
856
- const updateHook = ai.tool({
857
- description: 'Update properties of an existing webhook',
858
- inputSchema: zod.z.object({
859
- hookId: zod.z.string().describe('ID of the webhook to update'),
860
- name: zod.z.string().optional().describe('New name for the webhook'),
861
- url: zod.z.string().optional().describe('New URL for the webhook'),
862
- events: zod.z.array(zod.z.enum([
863
- 'chat.created',
864
- 'chat.updated',
865
- 'chat.deleted',
866
- 'message.created',
867
- 'message.updated',
868
- 'message.deleted'
869
- ])).optional().describe('New events to listen for')
870
- }),
871
- execute: async (params)=>{
872
- const { hookId, name, url, events } = params;
873
- const result = await client.hooks.update({
874
- hookId,
875
- name,
876
- url,
877
- events
878
- });
879
- return {
880
- hookId: result.id,
881
- name: result.name,
882
- url: result.url,
883
- events: result.events,
884
- chatId: result.chatId
885
- };
886
- }
887
- });
888
- const deleteHook = ai.tool({
889
- description: 'Delete an existing webhook',
890
- inputSchema: zod.z.object({
891
- hookId: zod.z.string().describe('ID of the webhook to delete')
892
- }),
893
- execute: async (params)=>{
894
- const { hookId } = params;
895
- const result = await client.hooks.delete({
896
- hookId
897
- });
898
- return {
899
- hookId: result.id,
900
- deleted: result.deleted
901
- };
902
- }
903
- });
904
- const listHooks = ai.tool({
905
- description: 'List all webhooks',
906
- inputSchema: zod.z.object({}),
907
- execute: async ()=>{
908
- const result = await client.hooks.find();
909
- return {
910
- hooks: result.data.map((hook)=>({
911
- hookId: hook.id,
912
- name: hook.name
913
- }))
914
- };
915
- }
916
- });
917
- return {
918
- createHook,
919
- getHook,
920
- updateHook,
921
- deleteHook,
922
- listHooks
923
- };
924
- }
925
-
926
- /**
927
- * Creates all v0 AI SDK tools as a flat object.
928
- *
929
- * ⚠️ Note: This includes ALL available tools (~20+ tools) which adds significant context.
930
- * Consider using v0ToolsByCategory() to select only the tools you need.
931
- *
932
- * @param config Configuration for v0 client
933
- * @returns Flat object with all v0 tools ready to use with AI SDK
934
- *
935
- * @example
936
- * ```typescript
937
- * import { generateText } from 'ai'
938
- * import { v0Tools } from '@v0-sdk/ai-tools'
939
- *
940
- * const result = await generateText({
941
- * model: 'openai/gpt-4',
942
- * prompt: 'Create a new React component',
943
- * tools: v0Tools({
944
- * apiKey: process.env.V0_API_KEY
945
- * })
946
- * })
947
- * ```
948
- */ function v0Tools(config = {}) {
949
- // Use environment variable if apiKey not provided
950
- const clientConfig = {
951
- ...config,
952
- apiKey: config.apiKey || process.env.V0_API_KEY
953
- };
954
- const chatTools = createChatTools(clientConfig);
955
- const projectTools = createProjectTools(clientConfig);
956
- const deploymentTools = createDeploymentTools(clientConfig);
957
- const userTools = createUserTools(clientConfig);
958
- const hookTools = createHookTools(clientConfig);
959
- return {
960
- ...chatTools,
961
- ...projectTools,
962
- ...deploymentTools,
963
- ...userTools,
964
- ...hookTools
965
- };
966
- }
967
- /**
968
- * Creates v0 tools organized by category for selective usage (recommended).
969
- * This allows you to include only the tools you need, reducing context size.
970
- *
971
- * @param config Configuration for v0 client
972
- * @returns Object containing all v0 tools organized by category
973
- *
974
- * @example
975
- * ```typescript
976
- * import { generateText } from 'ai'
977
- * import { v0ToolsByCategory } from '@v0-sdk/ai-tools'
978
- *
979
- * const tools = v0ToolsByCategory({
980
- * apiKey: process.env.V0_API_KEY
981
- * })
982
- *
983
- * // Only include chat and project tools
984
- * const result = await generateText({
985
- * model: 'openai/gpt-4',
986
- * prompt: 'Create a new React component',
987
- * tools: {
988
- * ...tools.chat,
989
- * ...tools.project
990
- * }
991
- * })
992
- * ```
993
- */ function v0ToolsByCategory(config = {}) {
994
- // Use environment variable if apiKey not provided
995
- const clientConfig = {
996
- ...config,
997
- apiKey: config.apiKey || process.env.V0_API_KEY
998
- };
999
- return {
1000
- /**
1001
- * Chat-related tools for creating, managing, and interacting with v0 chats
1002
- */ chat: createChatTools(clientConfig),
1003
- /**
1004
- * Project-related tools for creating and managing v0 projects
1005
- */ project: createProjectTools(clientConfig),
1006
- /**
1007
- * Deployment-related tools for creating and managing deployments
1008
- */ deployment: createDeploymentTools(clientConfig),
1009
- /**
1010
- * User-related tools for getting user information, billing, and rate limits
1011
- */ user: createUserTools(clientConfig),
1012
- /**
1013
- * Webhook tools for creating and managing event hooks
1014
- */ hook: createHookTools(clientConfig)
1015
- };
1016
- }
1017
- /**
1018
- * @deprecated Use v0Tools instead (now returns flat structure by default)
1019
- */ function v0ToolsFlat(config = {}) {
1020
- return v0Tools(config);
1021
- }
1022
-
1023
- exports.createChatTools = createChatTools;
1024
- exports.createDeploymentTools = createDeploymentTools;
1025
- exports.createHookTools = createHookTools;
1026
- exports.createProjectTools = createProjectTools;
1027
- exports.createUserTools = createUserTools;
1028
- exports.default = v0Tools;
1029
- exports.v0Tools = v0Tools;
1030
- exports.v0ToolsByCategory = v0ToolsByCategory;
1031
- exports.v0ToolsFlat = v0ToolsFlat;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`ai`),t=require(`v0`),n=require(`zod`);const r=n.z.object({message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the chat. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),i=n.z.object({message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the chat. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),a=n.z.object({files:n.z.array(n.z.object({name:n.z.string().describe(`Path of the file in the project.`),content:n.z.string().describe(`UTF-8 text content of the file.`)})).describe(`Source files used to seed the new chat.`),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),o=n.z.object({repo:n.z.object({url:n.z.string().describe(`GitHub repository URL, for example https://github.com/vercel/next.js.`),branch:n.z.string().describe(`Branch to import. If omitted, v0 uses the repository default branch.`).optional()}).describe(`Repository source for initialization. Supports public GitHub repositories and private repositories connected through Vercel.`),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),s=n.z.object({url:n.z.string().url().describe(`Zip archive used to seed the new chat.`),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),c=n.z.object({message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the chat. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the new chat.`).optional(),title:n.z.string().describe(`Title for the new chat.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Arbitrary key-value data to attach to the chat.`).optional()}),l=n.z.object({chatId:n.z.string(),name:n.z.string().describe(`Name for the Vercel project. When omitted, the chat's title is used.`).optional()}),u=n.z.object({chatId:n.z.string()}),d=n.z.object({chatId:n.z.string()}),f=n.z.object({chatId:n.z.string()}),p=n.z.object({chatId:n.z.string(),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Visibility setting for the duplicated chat.`),title:n.z.string().describe(`Custom title for the duplicated chat. If omitted, the original title is reused with an incremented suffix (e.g. "My Chat (2)").`).optional()}),m=n.z.object({chatId:n.z.string()}),h=n.z.object({chatId:n.z.string()}),g=n.z.object({chatId:n.z.string()}),_=n.z.object({limit:n.z.number().int().describe(`Maximum number of chats to return (1-100, default 20).`).optional(),cursor:n.z.string().describe(`Pagination cursor returned from a previous response.`).optional(),authorId:n.z.string().describe(`Restrict results to chats created by this user. Must be a member of the calling scope.`).optional(),vercelProjectId:n.z.string().describe(`Restrict results to chats associated with this Vercel project.`).optional(),metadata:n.z.record(n.z.string(),n.z.string()).describe(`Filter by metadata, e.g. metadata[environment]=production. Returns chats matching all supplied key-value pairs.`).optional()}),v=n.z.object({chatId:n.z.string(),messageId:n.z.string().describe(`The unique identifier of the message whose files to restore.`)}),y=n.z.object({chatId:n.z.string()}),b=n.z.object({chatId:n.z.string(),title:n.z.string().describe(`A new title to assign to the chat.`).optional(),privacy:n.z.enum([`public`,`private`,`team`,`team-edit`,`unlisted`]).describe(`Updated visibility setting for the chat.`).optional(),metadata:n.z.union([n.z.record(n.z.string(),n.z.union([n.z.string(),n.z.null()])),n.z.null()]).describe("User-defined key-value metadata. Merged with existing entries. Pass `null` for a value to delete that key, or pass `null` for the whole field to delete all entries. Maximum 50 active entries.").optional()}),x=n.z.object({chatId:n.z.string(),files:n.z.array(n.z.object({path:n.z.string().describe(`Project-relative file path, e.g. "app/page.tsx".`),content:n.z.union([n.z.string(),n.z.null()]).describe("New file content. Pass `null` to delete the file at this path.")})).describe(`The files to create, update, or delete. Each path must be unique.`)}),S=n.z.object({name:n.z.string().describe(`Display name for the MCP server.`),url:n.z.string().url().describe(`URL endpoint of the MCP server.`),description:n.z.string().describe(`Optional description of the MCP server.`).optional(),enabled:n.z.boolean().describe(`Whether the server should be enabled.`),auth:n.z.union([n.z.object({type:n.z.enum([`none`])}),n.z.object({type:n.z.enum([`bearer`]),token:n.z.string().describe(`Bearer token for authentication.`)}),n.z.object({type:n.z.enum([`custom-headers`]),headers:n.z.record(n.z.string(),n.z.string()).describe(`Custom headers to include in requests.`)}),n.z.object({type:n.z.enum([`oauth`]),config:n.z.object({authorizationUrl:n.z.string().url(),tokenUrl:n.z.string().url(),registrationUrl:n.z.string().url().optional(),clientId:n.z.string(),clientSecret:n.z.string().optional(),scopes:n.z.array(n.z.string()),usePKCE:n.z.boolean(),issuer:n.z.string().optional(),resource:n.z.string().optional(),clientIdMetadataDocumentSupported:n.z.boolean().optional()}).describe(`OAuth configuration discovered or manually set.`).optional(),connected:n.z.boolean().describe(`Whether OAuth is currently connected.`),expiresAt:n.z.string().describe(`ISO timestamp when the token expires.`).optional()})]).describe(`Authentication configuration.`),scope:n.z.enum([`user`,`team`]).describe(`Scope of the MCP server configuration.`)}),C=n.z.object({mcpServerId:n.z.string()}),w=n.z.object({mcpServerId:n.z.string()}),T=n.z.object({}),E=n.z.object({mcpServerId:n.z.string(),name:n.z.string().describe(`New display name.`).optional(),url:n.z.string().url().describe(`New URL endpoint.`).optional(),description:n.z.string().describe(`New description.`).optional(),enabled:n.z.boolean().describe(`Enable or disable.`).optional(),auth:n.z.union([n.z.object({type:n.z.enum([`none`])}),n.z.object({type:n.z.enum([`bearer`]),token:n.z.string().describe(`Bearer token for authentication.`)}),n.z.object({type:n.z.enum([`custom-headers`]),headers:n.z.record(n.z.string(),n.z.string()).describe(`Custom headers to include in requests.`)}),n.z.object({type:n.z.enum([`oauth`]),config:n.z.object({authorizationUrl:n.z.string().url(),tokenUrl:n.z.string().url(),registrationUrl:n.z.string().url().optional(),clientId:n.z.string(),clientSecret:n.z.string().optional(),scopes:n.z.array(n.z.string()),usePKCE:n.z.boolean(),issuer:n.z.string().optional(),resource:n.z.string().optional(),clientIdMetadataDocumentSupported:n.z.boolean().optional()}).describe(`OAuth configuration discovered or manually set.`).optional(),connected:n.z.boolean().describe(`Whether OAuth is currently connected.`),expiresAt:n.z.string().describe(`ISO timestamp when the token expires.`).optional()})]).describe(`New authentication configuration.`).optional(),scope:n.z.enum([`user`,`team`]).describe(`New scope.`).optional()}),D=n.z.object({chatId:n.z.string(),messageId:n.z.string()}),O=n.z.object({chatId:n.z.string(),limit:n.z.number().int(),cursor:n.z.string().optional()}),k=n.z.object({chatId:n.z.string(),task:n.z.union([n.z.object({type:n.z.enum([`confirmed-steps`]),connectedIntegrationNames:n.z.array(n.z.string()).describe(`Names of integrations that were successfully connected (e.g. "Neon", "Supabase"). Pass an empty array to skip.`).optional(),connectedMcpPresetNames:n.z.array(n.z.enum([`Linear`,`Notion`,`Context7`,`Sentry`,`Zapier`,`Glean`,`Hex`,`Sanity`,`Granola`,`PostHog`,`Contentful`,`Slack`])).describe(`Names of MCP presets that were connected (e.g. "Linear", "Sentry"). Pass an empty array to skip.`).optional(),appliedScripts:n.z.array(n.z.string()).describe(`Names of scripts that were applied.`).optional(),addedEnvVars:n.z.array(n.z.string()).describe(`Names of environment variables that were added.`).optional()}),n.z.object({type:n.z.enum([`plan-exit-response`]),status:n.z.enum([`approved`,`rejected`,`request-changes`]).describe(`Whether the plan is approved, rejected, or needs changes.`),content:n.z.string().describe(`Feedback or instructions for the agent.`)}),n.z.object({type:n.z.enum([`answered-questions`]),answers:n.z.array(n.z.object({questionId:n.z.string().describe(`The ID of the question being answered.`),questionText:n.z.string().describe(`The text of the question being answered.`),selectedLabels:n.z.array(n.z.string()).describe(`The labels of the selected options. For single-select questions, pass one item.`),customText:n.z.string().describe(`Free-form text input, used when the user selects "Other" or wants to add context.`).optional()})).describe(`Answers to the questions the agent asked.`)}),n.z.object({type:n.z.enum([`confirmed-permissions`]),permissions:n.z.array(n.z.object({type:n.z.enum([`ALLOW_DYNAMIC_TOOL_STRICT`]),toolName:n.z.string().describe(`The name of the tool being permitted.`),input:n.z.unknown().describe(`The tool call input arguments. Pass the exact input from the stopped task.`),taskNameActive:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown while the tool is running (e.g. "Running migration").`).optional(),taskNameComplete:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown after the tool completes (e.g. "Migration complete").`).optional(),userMessage:n.z.string().describe(`Optional message from the user about this permission.`).optional()})).describe(`The permissions to grant. Pass the suggestedPermissions from the stopped task.`),userMessage:n.z.string().describe(`Optional message from the user about the permission grant.`).optional()})]).describe(`The task resolution data. The latest message in the active chat fork must be an assistant message blocked on the matching task type.`),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`.").optional(),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`).optional()}).describe(`Overrides for the model behavior.`).optional()}),A=n.z.object({chatId:n.z.string(),task:n.z.union([n.z.object({type:n.z.enum([`confirmed-steps`]),connectedIntegrationNames:n.z.array(n.z.string()).describe(`Names of integrations that were successfully connected (e.g. "Neon", "Supabase"). Pass an empty array to skip.`).optional(),connectedMcpPresetNames:n.z.array(n.z.enum([`Linear`,`Notion`,`Context7`,`Sentry`,`Zapier`,`Glean`,`Hex`,`Sanity`,`Granola`,`PostHog`,`Contentful`,`Slack`])).describe(`Names of MCP presets that were connected (e.g. "Linear", "Sentry"). Pass an empty array to skip.`).optional(),appliedScripts:n.z.array(n.z.string()).describe(`Names of scripts that were applied.`).optional(),addedEnvVars:n.z.array(n.z.string()).describe(`Names of environment variables that were added.`).optional()}),n.z.object({type:n.z.enum([`plan-exit-response`]),status:n.z.enum([`approved`,`rejected`,`request-changes`]).describe(`Whether the plan is approved, rejected, or needs changes.`),content:n.z.string().describe(`Feedback or instructions for the agent.`)}),n.z.object({type:n.z.enum([`answered-questions`]),answers:n.z.array(n.z.object({questionId:n.z.string().describe(`The ID of the question being answered.`),questionText:n.z.string().describe(`The text of the question being answered.`),selectedLabels:n.z.array(n.z.string()).describe(`The labels of the selected options. For single-select questions, pass one item.`),customText:n.z.string().describe(`Free-form text input, used when the user selects "Other" or wants to add context.`).optional()})).describe(`Answers to the questions the agent asked.`)}),n.z.object({type:n.z.enum([`confirmed-permissions`]),permissions:n.z.array(n.z.object({type:n.z.enum([`ALLOW_DYNAMIC_TOOL_STRICT`]),toolName:n.z.string().describe(`The name of the tool being permitted.`),input:n.z.unknown().describe(`The tool call input arguments. Pass the exact input from the stopped task.`),taskNameActive:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown while the tool is running (e.g. "Running migration").`).optional(),taskNameComplete:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown after the tool completes (e.g. "Migration complete").`).optional(),userMessage:n.z.string().describe(`Optional message from the user about this permission.`).optional()})).describe(`The permissions to grant. Pass the suggestedPermissions from the stopped task.`),userMessage:n.z.string().describe(`Optional message from the user about the permission grant.`).optional()})]).describe(`The task resolution data. The latest message in the active chat fork must be an assistant message blocked on the matching task type.`),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`.").optional(),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`).optional()}).describe(`Overrides for the model behavior.`).optional()}),j=n.z.object({chatId:n.z.string(),task:n.z.union([n.z.object({type:n.z.enum([`confirmed-steps`]),connectedIntegrationNames:n.z.array(n.z.string()).describe(`Names of integrations that were successfully connected (e.g. "Neon", "Supabase"). Pass an empty array to skip.`).optional(),connectedMcpPresetNames:n.z.array(n.z.enum([`Linear`,`Notion`,`Context7`,`Sentry`,`Zapier`,`Glean`,`Hex`,`Sanity`,`Granola`,`PostHog`,`Contentful`,`Slack`])).describe(`Names of MCP presets that were connected (e.g. "Linear", "Sentry"). Pass an empty array to skip.`).optional(),appliedScripts:n.z.array(n.z.string()).describe(`Names of scripts that were applied.`).optional(),addedEnvVars:n.z.array(n.z.string()).describe(`Names of environment variables that were added.`).optional()}),n.z.object({type:n.z.enum([`plan-exit-response`]),status:n.z.enum([`approved`,`rejected`,`request-changes`]).describe(`Whether the plan is approved, rejected, or needs changes.`),content:n.z.string().describe(`Feedback or instructions for the agent.`)}),n.z.object({type:n.z.enum([`answered-questions`]),answers:n.z.array(n.z.object({questionId:n.z.string().describe(`The ID of the question being answered.`),questionText:n.z.string().describe(`The text of the question being answered.`),selectedLabels:n.z.array(n.z.string()).describe(`The labels of the selected options. For single-select questions, pass one item.`),customText:n.z.string().describe(`Free-form text input, used when the user selects "Other" or wants to add context.`).optional()})).describe(`Answers to the questions the agent asked.`)}),n.z.object({type:n.z.enum([`confirmed-permissions`]),permissions:n.z.array(n.z.object({type:n.z.enum([`ALLOW_DYNAMIC_TOOL_STRICT`]),toolName:n.z.string().describe(`The name of the tool being permitted.`),input:n.z.unknown().describe(`The tool call input arguments. Pass the exact input from the stopped task.`),taskNameActive:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown while the tool is running (e.g. "Running migration").`).optional(),taskNameComplete:n.z.union([n.z.string(),n.z.null()]).describe(`Label shown after the tool completes (e.g. "Migration complete").`).optional(),userMessage:n.z.string().describe(`Optional message from the user about this permission.`).optional()})).describe(`The permissions to grant. Pass the suggestedPermissions from the stopped task.`),userMessage:n.z.string().describe(`Optional message from the user about the permission grant.`).optional()})]).describe(`The task resolution data. The latest message in the active chat fork must be an assistant message blocked on the matching task type.`),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`.").optional(),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`).optional()}).describe(`Overrides for the model behavior.`).optional()}),M=n.z.object({chatId:n.z.string(),message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the message. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),action:n.z.object({type:n.z.enum([`fix-with-v0`])}).describe("An optional action. Use `fix-with-v0` to trigger automatic error fixing — the message should contain the error context.").optional()}),N=n.z.object({chatId:n.z.string(),message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the message. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),action:n.z.object({type:n.z.enum([`fix-with-v0`])}).describe("An optional action. Use `fix-with-v0` to trigger automatic error fixing — the message should contain the error context.").optional()}),P=n.z.object({chatId:n.z.string(),message:n.z.string().describe(`The prompt or instruction to send to the model.`),systemPrompt:n.z.string().describe(`System-level context for the chat, such as frameworks or development environment details.`).optional(),modelConfiguration:n.z.object({modelId:n.z.enum([`v0-auto`,`v0-mini`,`v0-pro`,`v0-max`,`v0-max-fast`]).describe("Model to use for the generation. `v0-auto` is deprecated and falls back to `v0-pro`."),imageGenerations:n.z.boolean().describe(`Enables image generations to generate up to 5 images per version.`)}).describe(`Overrides for the model behavior.`).optional(),mcpServerIds:n.z.array(n.z.string()).describe(`MCP server IDs to enable. When omitted, uses default enabled servers.`).optional(),attachments:n.z.array(n.z.object({url:n.z.string().describe(`URL of the attachment.`)})).describe(`Files or assets to include with the message.`).optional(),skills:n.z.array(n.z.union([n.z.object({type:n.z.enum([`remote`]).describe(`Discriminator: a skills.sh skill.`),id:n.z.string().describe(`Skill ID from skills.sh.`)}),n.z.object({type:n.z.enum([`memory`]).describe(`Discriminator: a user- or team-scoped memory skill.`),scope:n.z.enum([`user`,`team`]).describe(`Whether the skill lives in user or team memory.`),skillName:n.z.string().describe(`Name of the memory skill to attach.`)}),n.z.object({type:n.z.enum([`project`]).describe(`Discriminator: a skill defined in the project repo.`),skillName:n.z.string().describe(`Name of the project skill to attach.`)})])).describe("Skills to force-attach to the message. Supports skills.sh (`remote`), user/team memory (`memory`), and project (`project`) skills. Maximum 3.").optional(),action:n.z.object({type:n.z.enum([`fix-with-v0`])}).describe("An optional action. Use `fix-with-v0` to trigger automatic error fixing — the message should contain the error context.").optional()}),F=n.z.object({chatId:n.z.string(),messageId:n.z.string()}),I=n.z.object({name:n.z.string().describe(`A human-readable name for the webhook.`),events:n.z.array(n.z.enum([`chat.created`,`chat.updated`,`chat.deleted`,`message.created`,`message.updated`,`message.deleted`,`message.finished`])).describe(`List of event types the webhook should subscribe to.`),url:n.z.string().url().describe(`The target URL to receive the webhook payloads.`),chatId:n.z.union([n.z.string(),n.z.null()]).describe(`The ID of a chat to scope the webhook to.`)}),L=n.z.object({hookId:n.z.string()}),R=n.z.object({hookId:n.z.string()}),z=n.z.object({}),B=n.z.object({hookId:n.z.string(),name:n.z.string().describe(`A new display name for the webhook.`).optional(),events:n.z.array(n.z.enum([`chat.created`,`chat.updated`,`chat.deleted`,`message.created`,`message.updated`,`message.deleted`,`message.finished`])).describe(`Updated list of event types to subscribe to.`).optional(),url:n.z.string().url().describe(`A new target URL to receive webhook payloads.`).optional()});function V(n={}){let V=(0,t.createV0Client)(U(n));return{chatsCreate:(0,e.tool)({description:`Create Chat: Creates a new chat from a prompt. The request blocks until the model response is complete and returns the chat.`,inputSchema:r,execute:async e=>{let t={message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,attachments:e.attachments,mcpServerIds:e.mcpServerIds,skills:e.skills,privacy:e.privacy,title:e.title,metadata:e.metadata};return G(await V.chats.create(t))}}),chatsCreateAsync:(0,e.tool)({description:`Create Chat (Async): Creates a new chat with a user message and processes it in the background. Returns immediately with the chat ID and a "queued" status. Poll the apiUrl to check for completion.`,inputSchema:i,execute:async e=>{let t={message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,attachments:e.attachments,mcpServerIds:e.mcpServerIds,skills:e.skills,privacy:e.privacy,title:e.title,metadata:e.metadata};return G(await V.chats.createAsync(t))}}),chatsCreateFromFiles:(0,e.tool)({description:`Create Chat From Files: Creates a new chat from inline source files.`,inputSchema:a,execute:async e=>{let t={files:e.files,privacy:e.privacy,title:e.title,metadata:e.metadata};return G(await V.chats.createFromFiles(t))}}),chatsCreateFromRepo:(0,e.tool)({description:`Create Chat From Repository: Creates a new chat from a GitHub repository.`,inputSchema:o,execute:async e=>{let t={repo:e.repo,privacy:e.privacy,title:e.title,metadata:e.metadata};return G(await V.chats.createFromRepo(t))}}),chatsCreateFromZip:(0,e.tool)({description:`Create Chat From ZIP: Creates a new chat from a zip archive.`,inputSchema:s,execute:async e=>{let t={url:e.url,privacy:e.privacy,title:e.title,metadata:e.metadata};return G(await V.chats.createFromZip(t))}}),chatsCreateStream:(0,e.tool)({description:"Create Chat (Streaming): Creates a new chat with a user message and returns a Server-Sent Events stream. Events include initial chat state, title deltas, content chunk deltas, and final chat state. The response is `text/event-stream`; each event is `data: <JSON>\\n\\n` where the JSON conforms to ChatStreamEvent.",inputSchema:c,execute:async function*(e){let t={message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,attachments:e.attachments,mcpServerIds:e.mcpServerIds,skills:e.skills,privacy:e.privacy,title:e.title,metadata:e.metadata};yield*(await V.chats.createStream(t)).stream}}),chatsCreateVercelProject:(0,e.tool)({description:`Create Vercel Project: Creates a Vercel project and attaches it to the chat.`,inputSchema:l,execute:async e=>{let t={chatId:e.chatId,name:e.name};return G(await V.chats.createVercelProject(t))}}),chatsDelete:(0,e.tool)({description:`Delete Chat: Deletes a chat and all its associated messages and blocks. The requester must have edit access to the chat.`,inputSchema:u,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.delete(t))}}),chatsDeploy:(0,e.tool)({description:`Deploy Chat: Triggers a Vercel deployment for a chat. Creates a Vercel project if one does not exist.`,inputSchema:d,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.deploy(t))}}),chatsDownloadFiles:(0,e.tool)({description:`Download Chat Files: Downloads the source files for a chat as a ZIP archive.`,inputSchema:f,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.downloadFiles(t))}}),chatsDuplicate:(0,e.tool)({description:`Duplicate Chat: Creates a new chat by duplicating an existing chat.`,inputSchema:p,execute:async e=>{let t={chatId:e.chatId,privacy:e.privacy,title:e.title};return G(await V.chats.duplicate(t))}}),chatsGet:(0,e.tool)({description:`Get Chat: Retrieves a chat by ID.`,inputSchema:m,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.get(t))}}),chatsGetFiles:(0,e.tool)({description:`Get Chat Files: Returns the source files for a chat.`,inputSchema:h,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.getFiles(t))}}),chatsGetPreview:(0,e.tool)({description:`Get Preview URL: Returns the preview URL for a chat. If the preview isn't ready, the response is null. Poll this endpoint until the response is non-null.`,inputSchema:g,execute:async e=>{let t={chatId:e.chatId};return G(await V.chats.getPreview(t))}}),chatsList:(0,e.tool)({description:`List Chats: Lists chats accessible to the authenticated user. Use metadata[key]=value style query parameters to filter by metadata.`,inputSchema:_,execute:async e=>{let t={limit:e.limit,cursor:e.cursor,authorId:e.authorId,vercelProjectId:e.vercelProjectId,metadata:e.metadata};return G(await V.chats.list(t))}}),chatsRestoreMessage:(0,e.tool)({description:`Restore Message: Restores the files associated with a message. Pass an assistant message, or pass a user message to restore the files from its assistant reply. The associated files must not already be the latest files in the chat.`,inputSchema:v,execute:async e=>{let t={chatId:e.chatId,messageId:e.messageId};return G(await V.chats.restoreMessage(t))}}),chatsResume:(0,e.tool)({description:"Resume Chat Stream: Resumes consumption of the active assistant generation as Server-Sent Events. If the latest message has already finished, returns a closing chat-state event. The response is `text/event-stream`; each event is `data: <JSON>\\n\\n` where the JSON conforms to ChatStreamEvent.",inputSchema:y,execute:async function*(e){let t={chatId:e.chatId};yield*(await V.chats.resume(t)).stream}}),chatsUpdate:(0,e.tool)({description:`Update Chat: Updates a chat's title, privacy, or metadata.`,inputSchema:b,execute:async e=>{let t={chatId:e.chatId,title:e.title,privacy:e.privacy,metadata:e.metadata};return G(await V.chats.update(t))}}),chatsUpdateFiles:(0,e.tool)({description:`Update Chat Files: Creates, updates, or deletes files for a chat. Pass null to delete. This requires the chat's preview to be running.`,inputSchema:x,execute:async e=>{let t={chatId:e.chatId,files:e.files};return G(await V.chats.updateFiles(t))}}),mcpServersCreate:(0,e.tool)({description:`Create MCP Server: Creates a new MCP server configuration. Limited to 10 servers per user.`,inputSchema:S,execute:async e=>{let t={name:e.name,url:e.url,description:e.description,enabled:e.enabled,auth:e.auth,scope:e.scope};return G(await V.mcpServers.create(t))}}),mcpServersDelete:(0,e.tool)({description:`Delete MCP Server: Deletes an MCP server and cleans up associated OAuth tokens. This action is irreversible.`,inputSchema:C,execute:async e=>{let t={mcpServerId:e.mcpServerId};return G(await V.mcpServers.delete(t))}}),mcpServersGet:(0,e.tool)({description:`Get MCP Server: Retrieves a specific MCP server by ID.`,inputSchema:w,execute:async e=>{let t={mcpServerId:e.mcpServerId};return G(await V.mcpServers.get(t))}}),mcpServersList:(0,e.tool)({description:`List MCP Servers: Retrieves all MCP servers configured for the current user.`,inputSchema:T,execute:async()=>G(await V.mcpServers.list())}),mcpServersUpdate:(0,e.tool)({description:`Update MCP Server: Updates an existing MCP server configuration.`,inputSchema:E,execute:async e=>{let t={mcpServerId:e.mcpServerId,name:e.name,url:e.url,description:e.description,enabled:e.enabled,auth:e.auth,scope:e.scope};return G(await V.mcpServers.update(t))}}),messagesGet:(0,e.tool)({description:`Get Message: Fetches a single message in a chat.`,inputSchema:D,execute:async e=>{let t={chatId:e.chatId,messageId:e.messageId};return G(await V.messages.get(t))}}),messagesList:(0,e.tool)({description:`Get Messages: Get all messages in a chat.`,inputSchema:O,execute:async e=>{let t={chatId:e.chatId,limit:e.limit,cursor:e.cursor};return G(await V.messages.list(t))}}),messagesResolve:(0,e.tool)({description:`Resolve Task: Resolves a pending task in a chat, continuing the conversation. The latest message in the active chat fork must be an assistant message currently blocked on a matching task (integration setup, plan approval, question answers, or permission grants). Blocks until the model response is complete and returns the resulting message.`,inputSchema:k,execute:async e=>{let t={chatId:e.chatId,task:e.task,modelConfiguration:e.modelConfiguration};return G(await V.messages.resolve(t))}}),messagesResolveAsync:(0,e.tool)({description:"Resolve Task (Async): Resolves a pending task and processes it in the background. Returns immediately with the assistant message ID. Poll GET /chats/:chatId/messages/:messageId and check `finishReason` to detect completion.",inputSchema:A,execute:async e=>{let t={chatId:e.chatId,task:e.task,modelConfiguration:e.modelConfiguration};return G(await V.messages.resolveAsync(t))}}),messagesResolveStream:(0,e.tool)({description:"Resolve Task (Streaming): Resolves a pending task in a chat and returns a Server-Sent Events stream. Events include the initial assistant-message snapshot, content chunk deltas, final usage, and a closing message snapshot. The response is `text/event-stream`; each event is `data: <JSON>\\n\\n` where the JSON conforms to MessageStreamEvent.",inputSchema:j,execute:async function*(e){let t={chatId:e.chatId,task:e.task,modelConfiguration:e.modelConfiguration};yield*(await V.messages.resolveStream(t)).stream}}),messagesSend:(0,e.tool)({description:`Send Message: Sends a new message to an existing chat. Blocks until the model response is complete and returns the message response.`,inputSchema:M,execute:async e=>{let t={chatId:e.chatId,message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,mcpServerIds:e.mcpServerIds,attachments:e.attachments,skills:e.skills,action:e.action};return G(await V.messages.send(t))}}),messagesSendAsync:(0,e.tool)({description:"Send Message (Async): Sends a new message to an existing chat and processes it in the background. Returns immediately with the assistant message ID. Poll GET /chats/:chatId/messages/:messageId and check `finishReason` to detect completion.",inputSchema:N,execute:async e=>{let t={chatId:e.chatId,message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,mcpServerIds:e.mcpServerIds,attachments:e.attachments,skills:e.skills,action:e.action};return G(await V.messages.sendAsync(t))}}),messagesSendStream:(0,e.tool)({description:"Send Message (Streaming): Sends a new message to an existing chat and returns a Server-Sent Events stream. Events include the initial assistant-message snapshot, content chunk deltas, final usage, and a closing message snapshot. The response is `text/event-stream`; each event is `data: <JSON>\\n\\n` where the JSON conforms to MessageStreamEvent.",inputSchema:P,execute:async function*(e){let t={chatId:e.chatId,message:e.message,systemPrompt:e.systemPrompt,modelConfiguration:e.modelConfiguration,mcpServerIds:e.mcpServerIds,attachments:e.attachments,skills:e.skills,action:e.action};yield*(await V.messages.sendStream(t)).stream}}),messagesStop:(0,e.tool)({description:`Stop Message: Stops an in-flight assistant message generation. The agent aborts at the next safe point and the message is marked finished.`,inputSchema:F,execute:async e=>{let t={chatId:e.chatId,messageId:e.messageId};return G(await V.messages.stop(t))}}),webhooksCreate:(0,e.tool)({description:`Create Webhook: Creates a new webhook that listens for specific events. Supports optional association with a chat.`,inputSchema:I,execute:async e=>{let t={name:e.name,events:e.events,url:e.url,chatId:e.chatId};return G(await V.webhooks.create(t))}}),webhooksDelete:(0,e.tool)({description:`Delete Webhook: Deletes a webhook. This action is irreversible.`,inputSchema:L,execute:async e=>{let t={hookId:e.hookId};return G(await V.webhooks.delete(t))}}),webhooksGet:(0,e.tool)({description:`Get Webhook: Retrieves the details of a specific webhook using its ID.`,inputSchema:R,execute:async e=>{let t={hookId:e.hookId};return G(await V.webhooks.get(t))}}),webhooksList:(0,e.tool)({description:`List Webhooks: Retrieves a list of all webhooks in your workspace.`,inputSchema:z,execute:async()=>G(await V.webhooks.list())}),webhooksUpdate:(0,e.tool)({description:`Update Webhook: Updates the configuration of an existing webhook, including its name, event subscriptions, or target URL.`,inputSchema:B,execute:async e=>{let t={hookId:e.hookId,name:e.name,events:e.events,url:e.url};return G(await V.webhooks.update(t))}})}}function H(e={}){let t=V(e);return{chats:{chatsCreate:W(t,`chatsCreate`),chatsCreateAsync:W(t,`chatsCreateAsync`),chatsCreateFromFiles:W(t,`chatsCreateFromFiles`),chatsCreateFromRepo:W(t,`chatsCreateFromRepo`),chatsCreateFromZip:W(t,`chatsCreateFromZip`),chatsCreateStream:W(t,`chatsCreateStream`),chatsCreateVercelProject:W(t,`chatsCreateVercelProject`),chatsDelete:W(t,`chatsDelete`),chatsDeploy:W(t,`chatsDeploy`),chatsDownloadFiles:W(t,`chatsDownloadFiles`),chatsDuplicate:W(t,`chatsDuplicate`),chatsGet:W(t,`chatsGet`),chatsGetFiles:W(t,`chatsGetFiles`),chatsGetPreview:W(t,`chatsGetPreview`),chatsList:W(t,`chatsList`),chatsRestoreMessage:W(t,`chatsRestoreMessage`),chatsResume:W(t,`chatsResume`),chatsUpdate:W(t,`chatsUpdate`),chatsUpdateFiles:W(t,`chatsUpdateFiles`)},mcpServers:{mcpServersCreate:W(t,`mcpServersCreate`),mcpServersDelete:W(t,`mcpServersDelete`),mcpServersGet:W(t,`mcpServersGet`),mcpServersList:W(t,`mcpServersList`),mcpServersUpdate:W(t,`mcpServersUpdate`)},messages:{messagesGet:W(t,`messagesGet`),messagesList:W(t,`messagesList`),messagesResolve:W(t,`messagesResolve`),messagesResolveAsync:W(t,`messagesResolveAsync`),messagesResolveStream:W(t,`messagesResolveStream`),messagesSend:W(t,`messagesSend`),messagesSendAsync:W(t,`messagesSendAsync`),messagesSendStream:W(t,`messagesSendStream`),messagesStop:W(t,`messagesStop`)},webhooks:{webhooksCreate:W(t,`webhooksCreate`),webhooksDelete:W(t,`webhooksDelete`),webhooksGet:W(t,`webhooksGet`),webhooksList:W(t,`webhooksList`),webhooksUpdate:W(t,`webhooksUpdate`)}}}function U(e){let{apiKey:t,...n}=e,r=typeof process<`u`?process.env.V0_API_KEY:void 0,i=n.auth??t??r;return i===void 0?n:{...n,auth:i}}function W(e,t){let n=e[t];if(!n)throw Error(`Missing generated v0 tool: ${t}`);return n}function G(e){if(e&&typeof e==`object`&&(`data`in e||`error`in e)){let t=e;return t.error===void 0?t.data??null:{error:t.error}}return e}exports.v0Tools=V,exports.v0ToolsByCategory=H;