11import { z } from 'zod'
2+ import { genericToolResponseSchema } from '@/lib/api/contracts/tools/shared'
23import { defineRouteContract } from '@/lib/api/contracts/types'
34
4- const internalToolResponseSchema = z
5- . object ( {
6- success : z . boolean ( ) . optional ( ) ,
7- output : z . unknown ( ) . optional ( ) ,
8- error : z . string ( ) . optional ( ) ,
9- details : z . array ( z . unknown ( ) ) . optional ( ) ,
10- } )
11- . passthrough ( )
12-
135const a2aBaseBodySchema = z . object ( {
146 agentUrl : z . string ( ) . min ( 1 , 'Agent URL is required' ) ,
157 apiKey : z . string ( ) . optional ( ) ,
@@ -61,7 +53,7 @@ export const a2aGetAgentCardContract = defineRouteContract({
6153 body : a2aGetAgentCardBodySchema ,
6254 response : {
6355 mode : 'json' ,
64- schema : internalToolResponseSchema ,
56+ schema : genericToolResponseSchema ,
6557 } ,
6658} )
6759
@@ -71,7 +63,7 @@ export const a2aSendMessageContract = defineRouteContract({
7163 body : a2aSendMessageBodySchema ,
7264 response : {
7365 mode : 'json' ,
74- schema : internalToolResponseSchema ,
66+ schema : genericToolResponseSchema ,
7567 } ,
7668} )
7769
@@ -81,7 +73,7 @@ export const a2aGetTaskContract = defineRouteContract({
8173 body : a2aGetTaskBodySchema ,
8274 response : {
8375 mode : 'json' ,
84- schema : internalToolResponseSchema ,
76+ schema : genericToolResponseSchema ,
8577 } ,
8678} )
8779
@@ -91,7 +83,7 @@ export const a2aCancelTaskContract = defineRouteContract({
9183 body : a2aCancelTaskBodySchema ,
9284 response : {
9385 mode : 'json' ,
94- schema : internalToolResponseSchema ,
86+ schema : genericToolResponseSchema ,
9587 } ,
9688} )
9789
@@ -101,7 +93,7 @@ export const a2aResubscribeContract = defineRouteContract({
10193 body : a2aResubscribeBodySchema ,
10294 response : {
10395 mode : 'json' ,
104- schema : internalToolResponseSchema ,
96+ schema : genericToolResponseSchema ,
10597 } ,
10698} )
10799
@@ -111,7 +103,7 @@ export const a2aSetPushNotificationContract = defineRouteContract({
111103 body : a2aSetPushNotificationBodySchema ,
112104 response : {
113105 mode : 'json' ,
114- schema : internalToolResponseSchema ,
106+ schema : genericToolResponseSchema ,
115107 } ,
116108} )
117109
@@ -121,7 +113,7 @@ export const a2aGetPushNotificationContract = defineRouteContract({
121113 body : a2aGetPushNotificationBodySchema ,
122114 response : {
123115 mode : 'json' ,
124- schema : internalToolResponseSchema ,
116+ schema : genericToolResponseSchema ,
125117 } ,
126118} )
127119
@@ -131,6 +123,6 @@ export const a2aDeletePushNotificationContract = defineRouteContract({
131123 body : a2aDeletePushNotificationBodySchema ,
132124 response : {
133125 mode : 'json' ,
134- schema : internalToolResponseSchema ,
126+ schema : genericToolResponseSchema ,
135127 } ,
136128} )
0 commit comments