@@ -200,7 +200,7 @@ export type AllPartsEncoded =
200200 */
201201export const AllParts = < T extends Toolkit . Any | Toolkit . WithHandler < any > > (
202202 toolkit : T
203- ) : Schema . Schema < AllParts < Toolkit . Tools < T > > , AllPartsEncoded > => {
203+ ) : Schema . Schema < AllParts < T extends Toolkit . Any ? Toolkit . Tools < T > : Toolkit . WithHandlerTools < T > > , AllPartsEncoded > => {
204204 const toolCalls : Array < Schema . Schema < ToolCallPart < string , any > , ToolCallPartEncoded > > = [ ]
205205 const toolCallResults : Array < Schema . Schema < ToolResultPart < string , any , any > , ToolResultPartEncoded > > = [ ]
206206 for ( const tool of Object . values ( toolkit . tools as Record < string , Tool . Any > ) ) {
@@ -281,7 +281,7 @@ export type PartEncoded =
281281 */
282282export const Part = < T extends Toolkit . Any | Toolkit . WithHandler < any > > (
283283 toolkit : T
284- ) : Schema . Schema < Part < Toolkit . Tools < T > > , PartEncoded > => {
284+ ) : Schema . Schema < Part < T extends Toolkit . Any ? Toolkit . Tools < T > : Toolkit . WithHandlerTools < T > > , PartEncoded > => {
285285 const toolCalls : Array < Schema . Schema < ToolCallPart < string , any > , ToolCallPartEncoded > > = [ ]
286286 const toolCallResults : Array < Schema . Schema < ToolResultPart < string , any , any > , ToolResultPartEncoded > > = [ ]
287287 for ( const tool of Object . values ( toolkit . tools as Record < string , Tool . Any > ) ) {
@@ -365,7 +365,12 @@ export type StreamPartEncoded =
365365 */
366366export const StreamPart = < T extends Toolkit . Any | Toolkit . WithHandler < any > > (
367367 toolkit : T
368- ) : Schema . Schema < StreamPart < Toolkit . Tools < T > > , StreamPartEncoded > => {
368+ ) : Schema . Schema <
369+ StreamPart <
370+ T extends Toolkit . Any ? Toolkit . Tools < T > : Toolkit . WithHandlerTools < T >
371+ > ,
372+ StreamPartEncoded
373+ > => {
369374 const toolCalls : Array < Schema . Schema < ToolCallPart < string , any > , ToolCallPartEncoded > > = [ ]
370375 const toolCallResults : Array < Schema . Schema < ToolResultPart < string , any , any > , ToolResultPartEncoded > > = [ ]
371376 for ( const tool of Object . values ( toolkit . tools as Record < string , Tool . Any > ) ) {
0 commit comments