@ai-sdk-tool/parser 3.0.0 → 3.1.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.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { T as ToolCallProtocol } from './tool-call-protocol-Bn2CBcD-.cjs';
2
- export { i as isProtocolFactory } from './tool-call-protocol-Bn2CBcD-.cjs';
3
- import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, JSONSchema7, LanguageModelV3ToolCall, LanguageModelV3ToolResultPart } from '@ai-sdk/provider';
4
- export { createToolMiddleware, gemmaToolMiddleware, hermesToolMiddleware, morphXmlToolMiddleware, orchestratorToolMiddleware } from './v6.cjs';
1
+ import * as _ai_sdk_provider from '@ai-sdk/provider';
2
+ import { LanguageModelV3FunctionTool, LanguageModelV3ToolCall, LanguageModelV3Content, LanguageModelV3StreamPart, LanguageModelV3ProviderTool, JSONSchema7, LanguageModelV3, LanguageModelV3Middleware, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
3
+ import { ToolResultPart } from '@ai-sdk/provider-utils';
5
4
 
6
5
  /**
7
6
  * Heuristic Engine for XML Tool-Call Parsing
@@ -61,35 +60,57 @@ declare const dedupeShellStringTagsHeuristic: ToolCallHeuristic$1;
61
60
  declare const repairAgainstSchemaHeuristic: ToolCallHeuristic$1;
62
61
  declare const defaultPipelineConfig: PipelineConfig$1;
63
62
 
64
- interface JsonMixOptions {
63
+ interface TCMProtocol {
64
+ formatTools({ tools, toolSystemPromptTemplate, }: {
65
+ tools: LanguageModelV3FunctionTool[];
66
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
67
+ }): string;
68
+ formatToolCall(toolCall: LanguageModelV3ToolCall): string;
69
+ parseGeneratedText({ text, tools, options, }: {
70
+ text: string;
71
+ tools: LanguageModelV3FunctionTool[];
72
+ options?: {
73
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
74
+ };
75
+ }): LanguageModelV3Content[];
76
+ createStreamParser({ tools, options, }: {
77
+ tools: LanguageModelV3FunctionTool[];
78
+ options?: {
79
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
80
+ };
81
+ }): TransformStream<LanguageModelV3StreamPart, LanguageModelV3StreamPart>;
82
+ extractToolCallSegments?: ({ text, tools, }: {
83
+ text: string;
84
+ tools: LanguageModelV3FunctionTool[];
85
+ }) => string[];
86
+ }
87
+ type TCMCoreProtocol = TCMProtocol;
88
+ declare function isProtocolFactory(protocol: TCMProtocol | (() => TCMProtocol)): protocol is () => TCMProtocol;
89
+ declare function isTCMProtocolFactory(protocol: TCMProtocol | (() => TCMProtocol)): protocol is () => TCMProtocol;
90
+
91
+ interface JsonProtocolOptions {
65
92
  toolCallStart?: string;
66
93
  toolCallEnd?: string;
67
- toolResponseStart?: string;
68
- toolResponseEnd?: string;
69
94
  }
70
- declare const jsonMixProtocol: ({ toolCallStart, toolCallEnd, toolResponseStart, toolResponseEnd, }?: JsonMixOptions) => ToolCallProtocol;
95
+ declare const jsonProtocol: ({ toolCallStart, toolCallEnd, }?: JsonProtocolOptions) => TCMProtocol;
71
96
 
72
97
  type PipelineConfig = PipelineConfig$1;
73
98
  type ToolCallHeuristic = ToolCallHeuristic$1;
74
- interface MorphXmlProtocolOptions {
99
+ interface XmlProtocolOptions {
75
100
  heuristics?: ToolCallHeuristic[];
76
101
  pipeline?: PipelineConfig;
77
102
  maxReparses?: number;
78
103
  }
79
- declare const morphXmlProtocol: (protocolOptions?: MorphXmlProtocolOptions) => ToolCallProtocol;
104
+ declare const xmlProtocol: (protocolOptions?: XmlProtocolOptions) => TCMCoreProtocol;
80
105
 
81
- interface YamlXmlProtocolOptions {
106
+ interface YamlProtocolOptions {
82
107
  /**
83
108
  * Whether to include a system prompt example showing YAML multiline syntax.
84
109
  * @default true
85
110
  */
86
111
  includeMultilineExample?: boolean;
87
112
  }
88
- declare const yamlXmlProtocol: (_protocolOptions?: YamlXmlProtocolOptions) => ToolCallProtocol;
89
- /**
90
- * Default system prompt template for Orchestrator-style YAML+XML tool calling.
91
- */
92
- declare function orchestratorSystemPromptTemplate(tools: string, includeMultilineExample?: boolean): string;
113
+ declare const yamlProtocol: (_protocolOptions?: YamlProtocolOptions) => TCMCoreProtocol;
93
114
 
94
115
  type DebugLevel = "off" | "stream" | "parse";
95
116
  declare function getDebugLevel(): DebugLevel;
@@ -285,9 +306,122 @@ declare function parse(text: string, optsOrReviver?: ParseOptions | ((key: strin
285
306
  declare function stringify(obj: unknown): string;
286
307
 
287
308
  declare function isToolCallContent(content: unknown): content is LanguageModelV3ToolCall;
288
- declare function isToolResultPart(content: unknown): content is LanguageModelV3ToolResultPart;
309
+ declare function isToolResultPart(content: unknown): content is ToolResultPart;
289
310
  declare function hasInputProperty(obj: unknown): obj is {
290
311
  input?: unknown;
291
312
  };
292
313
 
293
- export { type DebugLevel, type HeuristicEngineOptions, type HeuristicPhase, type HeuristicResult, type IntermediateCall, type MorphXmlProtocolOptions, type OnErrorFn, type ParseOptions, type PipelineConfig$1 as PipelineConfig, type ToolCallHeuristic$1 as ToolCallHeuristic, type ToolCallMiddlewareProviderOptions, ToolCallProtocol, type YamlXmlProtocolOptions, applyHeuristicPipeline, balanceTagsHeuristic, createDynamicIfThenElseSchema, createIntermediateCall, decodeOriginalTools, dedupeShellStringTagsHeuristic, defaultPipelineConfig, encodeOriginalTools, escapeInvalidLtHeuristic, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, getDebugLevel, getPotentialStartIndex, hasInputProperty, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonMixProtocol, logParseFailure, logParsedChunk, logParsedSummary, logRawChunk, mergePipelineConfigs, morphXmlProtocol, normalizeCloseTagsHeuristic, orchestratorSystemPromptTemplate, originalToolsSchema, parse, repairAgainstSchemaHeuristic, stringify, transform, yamlXmlProtocol };
314
+ declare function wrapGenerate({ protocol, doGenerate, params, }: {
315
+ protocol: TCMCoreProtocol;
316
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
317
+ params: {
318
+ providerOptions?: ToolCallMiddlewareProviderOptions;
319
+ };
320
+ }): Promise<_ai_sdk_provider.LanguageModelV3GenerateResult>;
321
+
322
+ declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
323
+ declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
324
+ declare const yamlToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
325
+
326
+ declare function wrapStream({ protocol, doStream, doGenerate, params, }: {
327
+ protocol: TCMCoreProtocol;
328
+ doStream: () => ReturnType<LanguageModelV3["doStream"]>;
329
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
330
+ params: {
331
+ providerOptions?: ToolCallMiddlewareProviderOptions;
332
+ };
333
+ }): Promise<{
334
+ stream: ReadableStream<LanguageModelV3StreamPart>;
335
+ request?: {
336
+ body?: unknown;
337
+ };
338
+ response?: {
339
+ headers?: _ai_sdk_provider.SharedV3Headers;
340
+ };
341
+ }>;
342
+ declare function toolChoiceStream({ doGenerate, options, }: {
343
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
344
+ options?: {
345
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
346
+ };
347
+ }): Promise<{
348
+ request: {
349
+ body?: unknown;
350
+ };
351
+ response: _ai_sdk_provider.LanguageModelV3ResponseMetadata & {
352
+ headers?: _ai_sdk_provider.SharedV3Headers;
353
+ body?: unknown;
354
+ };
355
+ stream: ReadableStream<LanguageModelV3StreamPart>;
356
+ }>;
357
+
358
+ declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, toolResponsePromptTemplate, placement, }: {
359
+ protocol: TCMCoreProtocol | (() => TCMCoreProtocol);
360
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
361
+ toolResponsePromptTemplate?: (toolResult: ToolResultPart) => string;
362
+ placement?: "first" | "last";
363
+ }): LanguageModelV3Middleware;
364
+
365
+ declare function transformParams({ params, protocol, toolSystemPromptTemplate, toolResponsePromptTemplate, placement, }: {
366
+ params: {
367
+ prompt?: LanguageModelV3Prompt;
368
+ tools?: Array<LanguageModelV3FunctionTool | {
369
+ type: string;
370
+ }>;
371
+ providerOptions?: {
372
+ toolCallMiddleware?: {
373
+ toolChoice?: {
374
+ type: string;
375
+ };
376
+ };
377
+ };
378
+ toolChoice?: {
379
+ type: string;
380
+ toolName?: string;
381
+ };
382
+ };
383
+ protocol: TCMCoreProtocol | (() => TCMCoreProtocol);
384
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
385
+ toolResponsePromptTemplate?: (toolResult: ToolResultPart) => string;
386
+ placement?: "first" | "last";
387
+ }): {
388
+ prompt: LanguageModelV3Prompt;
389
+ tools: never[];
390
+ toolChoice: undefined;
391
+ providerOptions: SharedV3ProviderOptions;
392
+ } | {
393
+ responseFormat: {
394
+ type: "json";
395
+ schema: JSONSchema7;
396
+ name: string;
397
+ description: string | undefined;
398
+ };
399
+ providerOptions: {
400
+ toolCallMiddleware: {
401
+ toolChoice?: {
402
+ type: string;
403
+ toolName?: string;
404
+ } | undefined;
405
+ };
406
+ };
407
+ prompt: LanguageModelV3Prompt;
408
+ tools: never[];
409
+ toolChoice: undefined;
410
+ } | {
411
+ responseFormat: {
412
+ type: "json";
413
+ schema: JSONSchema7;
414
+ };
415
+ providerOptions: {
416
+ toolCallMiddleware: {
417
+ toolChoice: {
418
+ type: "required";
419
+ };
420
+ };
421
+ };
422
+ prompt: LanguageModelV3Prompt;
423
+ tools: never[];
424
+ toolChoice: undefined;
425
+ };
426
+
427
+ export { type DebugLevel, type HeuristicEngineOptions, type HeuristicPhase, type HeuristicResult, type IntermediateCall, type OnErrorFn, type ParseOptions, type PipelineConfig$1 as PipelineConfig, type TCMCoreProtocol, type TCMProtocol, type ToolCallHeuristic$1 as ToolCallHeuristic, type ToolCallMiddlewareProviderOptions, type XmlProtocolOptions, type YamlProtocolOptions, applyHeuristicPipeline, balanceTagsHeuristic, createDynamicIfThenElseSchema, createIntermediateCall, createToolMiddleware, decodeOriginalTools, dedupeShellStringTagsHeuristic, defaultPipelineConfig, encodeOriginalTools, escapeInvalidLtHeuristic, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, getDebugLevel, getPotentialStartIndex, hasInputProperty, hermesToolMiddleware, isProtocolFactory, isTCMProtocolFactory, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonProtocol, logParseFailure, logParsedChunk, logParsedSummary, logRawChunk, mergePipelineConfigs, normalizeCloseTagsHeuristic, originalToolsSchema, parse, repairAgainstSchemaHeuristic, stringify, toolChoiceStream, transform, transformParams, wrapGenerate, wrapStream, xmlProtocol, xmlToolMiddleware, yamlProtocol, yamlToolMiddleware };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { T as ToolCallProtocol } from './tool-call-protocol-Bn2CBcD-.js';
2
- export { i as isProtocolFactory } from './tool-call-protocol-Bn2CBcD-.js';
3
- import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, JSONSchema7, LanguageModelV3ToolCall, LanguageModelV3ToolResultPart } from '@ai-sdk/provider';
4
- export { createToolMiddleware, gemmaToolMiddleware, hermesToolMiddleware, morphXmlToolMiddleware, orchestratorToolMiddleware } from './v6.js';
1
+ import * as _ai_sdk_provider from '@ai-sdk/provider';
2
+ import { LanguageModelV3FunctionTool, LanguageModelV3ToolCall, LanguageModelV3Content, LanguageModelV3StreamPart, LanguageModelV3ProviderTool, JSONSchema7, LanguageModelV3, LanguageModelV3Middleware, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
3
+ import { ToolResultPart } from '@ai-sdk/provider-utils';
5
4
 
6
5
  /**
7
6
  * Heuristic Engine for XML Tool-Call Parsing
@@ -61,35 +60,57 @@ declare const dedupeShellStringTagsHeuristic: ToolCallHeuristic$1;
61
60
  declare const repairAgainstSchemaHeuristic: ToolCallHeuristic$1;
62
61
  declare const defaultPipelineConfig: PipelineConfig$1;
63
62
 
64
- interface JsonMixOptions {
63
+ interface TCMProtocol {
64
+ formatTools({ tools, toolSystemPromptTemplate, }: {
65
+ tools: LanguageModelV3FunctionTool[];
66
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
67
+ }): string;
68
+ formatToolCall(toolCall: LanguageModelV3ToolCall): string;
69
+ parseGeneratedText({ text, tools, options, }: {
70
+ text: string;
71
+ tools: LanguageModelV3FunctionTool[];
72
+ options?: {
73
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
74
+ };
75
+ }): LanguageModelV3Content[];
76
+ createStreamParser({ tools, options, }: {
77
+ tools: LanguageModelV3FunctionTool[];
78
+ options?: {
79
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
80
+ };
81
+ }): TransformStream<LanguageModelV3StreamPart, LanguageModelV3StreamPart>;
82
+ extractToolCallSegments?: ({ text, tools, }: {
83
+ text: string;
84
+ tools: LanguageModelV3FunctionTool[];
85
+ }) => string[];
86
+ }
87
+ type TCMCoreProtocol = TCMProtocol;
88
+ declare function isProtocolFactory(protocol: TCMProtocol | (() => TCMProtocol)): protocol is () => TCMProtocol;
89
+ declare function isTCMProtocolFactory(protocol: TCMProtocol | (() => TCMProtocol)): protocol is () => TCMProtocol;
90
+
91
+ interface JsonProtocolOptions {
65
92
  toolCallStart?: string;
66
93
  toolCallEnd?: string;
67
- toolResponseStart?: string;
68
- toolResponseEnd?: string;
69
94
  }
70
- declare const jsonMixProtocol: ({ toolCallStart, toolCallEnd, toolResponseStart, toolResponseEnd, }?: JsonMixOptions) => ToolCallProtocol;
95
+ declare const jsonProtocol: ({ toolCallStart, toolCallEnd, }?: JsonProtocolOptions) => TCMProtocol;
71
96
 
72
97
  type PipelineConfig = PipelineConfig$1;
73
98
  type ToolCallHeuristic = ToolCallHeuristic$1;
74
- interface MorphXmlProtocolOptions {
99
+ interface XmlProtocolOptions {
75
100
  heuristics?: ToolCallHeuristic[];
76
101
  pipeline?: PipelineConfig;
77
102
  maxReparses?: number;
78
103
  }
79
- declare const morphXmlProtocol: (protocolOptions?: MorphXmlProtocolOptions) => ToolCallProtocol;
104
+ declare const xmlProtocol: (protocolOptions?: XmlProtocolOptions) => TCMCoreProtocol;
80
105
 
81
- interface YamlXmlProtocolOptions {
106
+ interface YamlProtocolOptions {
82
107
  /**
83
108
  * Whether to include a system prompt example showing YAML multiline syntax.
84
109
  * @default true
85
110
  */
86
111
  includeMultilineExample?: boolean;
87
112
  }
88
- declare const yamlXmlProtocol: (_protocolOptions?: YamlXmlProtocolOptions) => ToolCallProtocol;
89
- /**
90
- * Default system prompt template for Orchestrator-style YAML+XML tool calling.
91
- */
92
- declare function orchestratorSystemPromptTemplate(tools: string, includeMultilineExample?: boolean): string;
113
+ declare const yamlProtocol: (_protocolOptions?: YamlProtocolOptions) => TCMCoreProtocol;
93
114
 
94
115
  type DebugLevel = "off" | "stream" | "parse";
95
116
  declare function getDebugLevel(): DebugLevel;
@@ -285,9 +306,122 @@ declare function parse(text: string, optsOrReviver?: ParseOptions | ((key: strin
285
306
  declare function stringify(obj: unknown): string;
286
307
 
287
308
  declare function isToolCallContent(content: unknown): content is LanguageModelV3ToolCall;
288
- declare function isToolResultPart(content: unknown): content is LanguageModelV3ToolResultPart;
309
+ declare function isToolResultPart(content: unknown): content is ToolResultPart;
289
310
  declare function hasInputProperty(obj: unknown): obj is {
290
311
  input?: unknown;
291
312
  };
292
313
 
293
- export { type DebugLevel, type HeuristicEngineOptions, type HeuristicPhase, type HeuristicResult, type IntermediateCall, type MorphXmlProtocolOptions, type OnErrorFn, type ParseOptions, type PipelineConfig$1 as PipelineConfig, type ToolCallHeuristic$1 as ToolCallHeuristic, type ToolCallMiddlewareProviderOptions, ToolCallProtocol, type YamlXmlProtocolOptions, applyHeuristicPipeline, balanceTagsHeuristic, createDynamicIfThenElseSchema, createIntermediateCall, decodeOriginalTools, dedupeShellStringTagsHeuristic, defaultPipelineConfig, encodeOriginalTools, escapeInvalidLtHeuristic, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, getDebugLevel, getPotentialStartIndex, hasInputProperty, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonMixProtocol, logParseFailure, logParsedChunk, logParsedSummary, logRawChunk, mergePipelineConfigs, morphXmlProtocol, normalizeCloseTagsHeuristic, orchestratorSystemPromptTemplate, originalToolsSchema, parse, repairAgainstSchemaHeuristic, stringify, transform, yamlXmlProtocol };
314
+ declare function wrapGenerate({ protocol, doGenerate, params, }: {
315
+ protocol: TCMCoreProtocol;
316
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
317
+ params: {
318
+ providerOptions?: ToolCallMiddlewareProviderOptions;
319
+ };
320
+ }): Promise<_ai_sdk_provider.LanguageModelV3GenerateResult>;
321
+
322
+ declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
323
+ declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
324
+ declare const yamlToolMiddleware: _ai_sdk_provider.LanguageModelV3Middleware;
325
+
326
+ declare function wrapStream({ protocol, doStream, doGenerate, params, }: {
327
+ protocol: TCMCoreProtocol;
328
+ doStream: () => ReturnType<LanguageModelV3["doStream"]>;
329
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
330
+ params: {
331
+ providerOptions?: ToolCallMiddlewareProviderOptions;
332
+ };
333
+ }): Promise<{
334
+ stream: ReadableStream<LanguageModelV3StreamPart>;
335
+ request?: {
336
+ body?: unknown;
337
+ };
338
+ response?: {
339
+ headers?: _ai_sdk_provider.SharedV3Headers;
340
+ };
341
+ }>;
342
+ declare function toolChoiceStream({ doGenerate, options, }: {
343
+ doGenerate: () => ReturnType<LanguageModelV3["doGenerate"]>;
344
+ options?: {
345
+ onError?: (message: string, metadata?: Record<string, unknown>) => void;
346
+ };
347
+ }): Promise<{
348
+ request: {
349
+ body?: unknown;
350
+ };
351
+ response: _ai_sdk_provider.LanguageModelV3ResponseMetadata & {
352
+ headers?: _ai_sdk_provider.SharedV3Headers;
353
+ body?: unknown;
354
+ };
355
+ stream: ReadableStream<LanguageModelV3StreamPart>;
356
+ }>;
357
+
358
+ declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, toolResponsePromptTemplate, placement, }: {
359
+ protocol: TCMCoreProtocol | (() => TCMCoreProtocol);
360
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
361
+ toolResponsePromptTemplate?: (toolResult: ToolResultPart) => string;
362
+ placement?: "first" | "last";
363
+ }): LanguageModelV3Middleware;
364
+
365
+ declare function transformParams({ params, protocol, toolSystemPromptTemplate, toolResponsePromptTemplate, placement, }: {
366
+ params: {
367
+ prompt?: LanguageModelV3Prompt;
368
+ tools?: Array<LanguageModelV3FunctionTool | {
369
+ type: string;
370
+ }>;
371
+ providerOptions?: {
372
+ toolCallMiddleware?: {
373
+ toolChoice?: {
374
+ type: string;
375
+ };
376
+ };
377
+ };
378
+ toolChoice?: {
379
+ type: string;
380
+ toolName?: string;
381
+ };
382
+ };
383
+ protocol: TCMCoreProtocol | (() => TCMCoreProtocol);
384
+ toolSystemPromptTemplate: (tools: LanguageModelV3FunctionTool[]) => string;
385
+ toolResponsePromptTemplate?: (toolResult: ToolResultPart) => string;
386
+ placement?: "first" | "last";
387
+ }): {
388
+ prompt: LanguageModelV3Prompt;
389
+ tools: never[];
390
+ toolChoice: undefined;
391
+ providerOptions: SharedV3ProviderOptions;
392
+ } | {
393
+ responseFormat: {
394
+ type: "json";
395
+ schema: JSONSchema7;
396
+ name: string;
397
+ description: string | undefined;
398
+ };
399
+ providerOptions: {
400
+ toolCallMiddleware: {
401
+ toolChoice?: {
402
+ type: string;
403
+ toolName?: string;
404
+ } | undefined;
405
+ };
406
+ };
407
+ prompt: LanguageModelV3Prompt;
408
+ tools: never[];
409
+ toolChoice: undefined;
410
+ } | {
411
+ responseFormat: {
412
+ type: "json";
413
+ schema: JSONSchema7;
414
+ };
415
+ providerOptions: {
416
+ toolCallMiddleware: {
417
+ toolChoice: {
418
+ type: "required";
419
+ };
420
+ };
421
+ };
422
+ prompt: LanguageModelV3Prompt;
423
+ tools: never[];
424
+ toolChoice: undefined;
425
+ };
426
+
427
+ export { type DebugLevel, type HeuristicEngineOptions, type HeuristicPhase, type HeuristicResult, type IntermediateCall, type OnErrorFn, type ParseOptions, type PipelineConfig$1 as PipelineConfig, type TCMCoreProtocol, type TCMProtocol, type ToolCallHeuristic$1 as ToolCallHeuristic, type ToolCallMiddlewareProviderOptions, type XmlProtocolOptions, type YamlProtocolOptions, applyHeuristicPipeline, balanceTagsHeuristic, createDynamicIfThenElseSchema, createIntermediateCall, createToolMiddleware, decodeOriginalTools, dedupeShellStringTagsHeuristic, defaultPipelineConfig, encodeOriginalTools, escapeInvalidLtHeuristic, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, getDebugLevel, getPotentialStartIndex, hasInputProperty, hermesToolMiddleware, isProtocolFactory, isTCMProtocolFactory, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonProtocol, logParseFailure, logParsedChunk, logParsedSummary, logRawChunk, mergePipelineConfigs, normalizeCloseTagsHeuristic, originalToolsSchema, parse, repairAgainstSchemaHeuristic, stringify, toolChoiceStream, transform, transformParams, wrapGenerate, wrapStream, xmlProtocol, xmlToolMiddleware, yamlProtocol, yamlToolMiddleware };
package/dist/index.js CHANGED
@@ -1,18 +1,9 @@
1
- import "./chunk-DFOXAWP6.js";
2
- import {
3
- createToolMiddleware,
4
- gemmaToolMiddleware,
5
- hermesToolMiddleware,
6
- morphXmlToolMiddleware,
7
- orchestratorSystemPromptTemplate,
8
- orchestratorToolMiddleware,
9
- yamlXmlProtocol
10
- } from "./chunk-QPJA5CS6.js";
11
1
  import {
12
2
  applyHeuristicPipeline,
13
3
  balanceTagsHeuristic,
14
4
  createDynamicIfThenElseSchema,
15
5
  createIntermediateCall,
6
+ createToolMiddleware,
16
7
  decodeOriginalTools,
17
8
  dedupeShellStringTagsHeuristic,
18
9
  defaultPipelineConfig,
@@ -24,24 +15,33 @@ import {
24
15
  getDebugLevel,
25
16
  getPotentialStartIndex,
26
17
  hasInputProperty,
18
+ hermesToolMiddleware,
27
19
  isProtocolFactory,
20
+ isTCMProtocolFactory,
28
21
  isToolCallContent,
29
22
  isToolChoiceActive,
30
23
  isToolResultPart,
31
- jsonMixProtocol,
24
+ jsonProtocol,
32
25
  logParseFailure,
33
26
  logParsedChunk,
34
27
  logParsedSummary,
35
28
  logRawChunk,
36
29
  mergePipelineConfigs,
37
- morphXmlProtocol,
38
30
  normalizeCloseTagsHeuristic,
39
31
  originalToolsSchema,
40
32
  parse,
41
33
  repairAgainstSchemaHeuristic,
42
34
  stringify,
43
- transform
44
- } from "./chunk-NOYHOQOL.js";
35
+ toolChoiceStream,
36
+ transform,
37
+ transformParams,
38
+ wrapGenerate,
39
+ wrapStream,
40
+ xmlProtocol,
41
+ xmlToolMiddleware,
42
+ yamlProtocol,
43
+ yamlToolMiddleware
44
+ } from "./chunk-JVQVEA3K.js";
45
45
  export {
46
46
  applyHeuristicPipeline,
47
47
  balanceTagsHeuristic,
@@ -56,31 +56,34 @@ export {
56
56
  escapeRegExp,
57
57
  extractOnErrorOption,
58
58
  extractToolNamesFromOriginalTools,
59
- gemmaToolMiddleware,
60
59
  getDebugLevel,
61
60
  getPotentialStartIndex,
62
61
  hasInputProperty,
63
62
  hermesToolMiddleware,
64
63
  isProtocolFactory,
64
+ isTCMProtocolFactory,
65
65
  isToolCallContent,
66
66
  isToolChoiceActive,
67
67
  isToolResultPart,
68
- jsonMixProtocol,
68
+ jsonProtocol,
69
69
  logParseFailure,
70
70
  logParsedChunk,
71
71
  logParsedSummary,
72
72
  logRawChunk,
73
73
  mergePipelineConfigs,
74
- morphXmlProtocol,
75
- morphXmlToolMiddleware,
76
74
  normalizeCloseTagsHeuristic,
77
- orchestratorSystemPromptTemplate,
78
- orchestratorToolMiddleware,
79
75
  originalToolsSchema,
80
76
  parse,
81
77
  repairAgainstSchemaHeuristic,
82
78
  stringify,
79
+ toolChoiceStream,
83
80
  transform,
84
- yamlXmlProtocol
81
+ transformParams,
82
+ wrapGenerate,
83
+ wrapStream,
84
+ xmlProtocol,
85
+ xmlToolMiddleware,
86
+ yamlProtocol,
87
+ yamlToolMiddleware
85
88
  };
86
89
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk-tool/parser",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "AI SDK middleware for tool call parsing",
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,16 +17,6 @@
17
17
  "import": "./dist/index.js",
18
18
  "require": "./dist/index.cjs"
19
19
  },
20
- "./v5": {
21
- "types": "./dist/v5.d.ts",
22
- "import": "./dist/v5.js",
23
- "require": "./dist/v5.cjs"
24
- },
25
- "./v6": {
26
- "types": "./dist/v6.d.ts",
27
- "import": "./dist/v6.js",
28
- "require": "./dist/v6.cjs"
29
- },
30
20
  "./community": {
31
21
  "types": "./dist/community.d.ts",
32
22
  "import": "./dist/community.js",
@@ -47,14 +37,10 @@
47
37
  },
48
38
  "devDependencies": {
49
39
  "@ai-sdk/openai-compatible": "2.0.2",
50
- "@ai-sdk/provider-v5": "npm:@ai-sdk/provider@2.0.1",
51
- "@ai-sdk/provider-v6": "npm:@ai-sdk/provider@3.0.1",
52
40
  "@types/node": "^25.0.3",
53
- "ai": "6.0.5",
54
- "ai-v5": "npm:ai@5.0.117",
55
- "ai-v6": "npm:ai@6.0.5",
41
+ "ai": "6.0.6",
56
42
  "tsup": "^8.5.1",
57
- "zod": "^4.3.4",
43
+ "zod": "^4.3.5",
58
44
  "@ai-sdkx/tsconfig": "0.0.1"
59
45
  },
60
46
  "keywords": [],
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-DFOXAWP6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}