@ai-sdk/provider-utils 5.0.0-canary.33 → 5.0.0-canary.35

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 5.0.0-canary.35
4
+
5
+ ### Patch Changes
6
+
7
+ - f634bac: feat(mcp): add new McpProviderMetadata type
8
+
9
+ ## 5.0.0-canary.34
10
+
11
+ ### Patch Changes
12
+
13
+ - 69254e0: feat(ai): add toolMetadata for tool specific metdata
14
+ - 3015fc3: feat: sandbox shell execution abstraction
15
+
3
16
  ## 5.0.0-canary.33
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SharedV4FileDataUrl, SharedV4FileDataReference, SharedV4FileDataText, SharedV4ProviderOptions, SharedV4ProviderReference, JSONValue, ImageModelV4File, LanguageModelV4FunctionTool, LanguageModelV4ProviderTool, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, APICallError, LanguageModelV4Prompt, LanguageModelV4CallOptions, SharedV4Warning, SharedV4ProviderMetadata, LanguageModelV4FilePart, JSONObject, LanguageModelV4StreamPart, TypeValidationContext } from '@ai-sdk/provider';
1
+ import { SharedV4FileDataUrl, SharedV4FileDataReference, SharedV4FileDataText, SharedV4ProviderOptions, SharedV4ProviderReference, JSONValue, ImageModelV4File, LanguageModelV4FunctionTool, LanguageModelV4ProviderTool, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, APICallError, LanguageModelV4Prompt, LanguageModelV4CallOptions, SharedV4Warning, JSONObject, LanguageModelV4FilePart, LanguageModelV4StreamPart, SharedV4ProviderMetadata, TypeValidationContext } from '@ai-sdk/provider';
2
2
  export { getErrorMessage } from '@ai-sdk/provider';
3
3
  import { StandardSchemaV1, StandardJSONSchemaV1 } from '@standard-schema/spec';
4
4
  export * from '@standard-schema/spec';
@@ -1282,6 +1282,40 @@ type UserContent = string | Array<TextPart | ImagePart | FilePart>;
1282
1282
  */
1283
1283
  type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
1284
1284
 
1285
+ /**
1286
+ * Sandbox environment that can execute commands.
1287
+ */
1288
+ type Sandbox = {
1289
+ /**
1290
+ * Description of the sandbox environment that can be added to the agent's instructions
1291
+ * so that the agent knows about relevant details such as the root directory, exposed
1292
+ * ports, the public hostname, etc.
1293
+ */
1294
+ readonly description: string;
1295
+ /**
1296
+ * Execute a command in the sandbox.
1297
+ */
1298
+ readonly executeCommand: (options: {
1299
+ /**
1300
+ * Command to execute in the sandbox.
1301
+ */
1302
+ command: string;
1303
+ }) => PromiseLike<{
1304
+ /**
1305
+ * Exit code returned by the command.
1306
+ */
1307
+ exitCode: number;
1308
+ /**
1309
+ * Standard output produced by the command.
1310
+ */
1311
+ stdout: string;
1312
+ /**
1313
+ * Standard error produced by the command.
1314
+ */
1315
+ stderr: string;
1316
+ }>;
1317
+ };
1318
+
1285
1319
  /**
1286
1320
  * Additional options that are sent into each tool execution.
1287
1321
  */
@@ -1311,6 +1345,10 @@ interface ToolExecutionOptions<CONTEXT extends Context | unknown | never> {
1311
1345
  * in `prepareStep` and update it there.
1312
1346
  */
1313
1347
  context: CONTEXT;
1348
+ /**
1349
+ * The sandbox environment that the tool is operating in.
1350
+ */
1351
+ sandbox?: Sandbox;
1314
1352
  }
1315
1353
  /**
1316
1354
  * Function that executes the tool and returns either a single result or a stream of results.
@@ -1379,6 +1417,8 @@ type ToolOutputProperties<INPUT, OUTPUT, CONTEXT extends Context | unknown | nev
1379
1417
  type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONValue | unknown | never = any, CONTEXT extends Context | unknown | never = any> = {
1380
1418
  /**
1381
1419
  * An optional title of the tool.
1420
+ *
1421
+ * @deprecated Use `providerMetadata` for source-specific tool display metadata.
1382
1422
  */
1383
1423
  title?: string;
1384
1424
  /**
@@ -1392,11 +1432,11 @@ type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JS
1392
1432
  *
1393
1433
  * Unlike `providerOptions`, this metadata is not sent to the language
1394
1434
  * model. Instead, it is propagated onto the resulting tool call's
1395
- * `providerMetadata` so consumers can read it from tool call / result
1396
- * parts and UI message parts. This is useful for sources of dynamic
1397
- * tools (e.g. an MCP server) to identify themselves.
1435
+ * `toolMetadata` so consumers can read it from tool call / result parts
1436
+ * and UI message parts. This is useful for sources of dynamic tools (e.g.
1437
+ * an MCP server) to identify themselves.
1398
1438
  */
1399
- providerMetadata?: SharedV4ProviderMetadata;
1439
+ metadata?: JSONObject;
1400
1440
  /**
1401
1441
  * The schema of the input that the tool expects.
1402
1442
  * The language model will use this to generate the input.
@@ -2030,4 +2070,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
2030
2070
  dynamic?: boolean;
2031
2071
  }
2032
2072
 
2033
- export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type DynamicTool, type ExecutableTool, type FetchFunction, type FileData, type FileDataData, type FileDataReference, type FileDataText, type FileDataUrl, type FilePart, type FlexibleSchema, type FunctionTool, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderDefinedTool, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderExecutedTool, type ProviderExecutedToolFactory, type ProviderOptions, type ProviderReference, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type StreamingToolCallDelta, StreamingToolCallTracker, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asArray, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertInlineFileDataToUint8Array, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createProviderExecutedToolFactory, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, detectMediaType, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, filterNullable, generateId, getFromApi, getRuntimeEnvironmentUserAgent, getTopLevelMediaType, injectJsonInstructionIntoMessages, isAbortError, isBuffer, isCustomReasoning, isExecutableTool, isFullMediaType, isNonNullable, isParsableJson, isProviderReference, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mapReasoningToProviderBudget, mapReasoningToProviderEffort, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, resolveFullMediaType, resolveProviderReference, safeParseJSON, safeValidateTypes, serializeModelOptions, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
2073
+ export { type Arrayable, type AssistantContent, type AssistantModelMessage, type Context, type CustomPart, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type DynamicTool, type ExecutableTool, type FetchFunction, type FileData, type FileDataData, type FileDataReference, type FileDataText, type FileDataUrl, type FilePart, type FlexibleSchema, type FunctionTool, type HasRequiredKey, type IdGenerator, type ImagePart, type InferSchema, type InferToolContext, type InferToolInput, type InferToolOutput, type InferToolSetContext, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderDefinedTool, type ProviderDefinedToolFactory, type ProviderDefinedToolFactoryWithOutputSchema, type ProviderExecutedTool, type ProviderExecutedToolFactory, type ProviderOptions, type ProviderReference, type ReasoningFilePart, type ReasoningPart, type Resolvable, type ResponseHandler, type Sandbox, type Schema, type StreamingToolCallDelta, StreamingToolCallTracker, type StreamingToolCallTrackerOptions, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type ToolSet, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asArray, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertInlineFileDataToUint8Array, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, createProviderExecutedToolFactory, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, detectMediaType, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, filterNullable, generateId, getFromApi, getRuntimeEnvironmentUserAgent, getTopLevelMediaType, injectJsonInstructionIntoMessages, isAbortError, isBuffer, isCustomReasoning, isExecutableTool, isFullMediaType, isNonNullable, isParsableJson, isProviderReference, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mapReasoningToProviderBudget, mapReasoningToProviderEffort, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, resolveFullMediaType, resolveProviderReference, safeParseJSON, safeValidateTypes, serializeModelOptions, stripFileExtension, tool, validateDownloadUrl, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.js CHANGED
@@ -862,7 +862,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
862
862
  }
863
863
 
864
864
  // src/version.ts
865
- var VERSION = true ? "5.0.0-canary.33" : "0.0.0-test";
865
+ var VERSION = true ? "5.0.0-canary.35" : "0.0.0-test";
866
866
 
867
867
  // src/get-from-api.ts
868
868
  var getOriginalFetch = () => globalThis.fetch;
@@ -3277,6 +3277,11 @@ function withoutTrailingSlash(url) {
3277
3277
  return url == null ? void 0 : url.replace(/\/$/, "");
3278
3278
  }
3279
3279
 
3280
+ // src/types/executable-tool.ts
3281
+ function isExecutableTool(tool2) {
3282
+ return tool2 != null && typeof tool2.execute === "function";
3283
+ }
3284
+
3280
3285
  // src/is-async-iterable.ts
3281
3286
  function isAsyncIterable(obj) {
3282
3287
  return obj != null && typeof obj[Symbol.asyncIterator] === "function";
@@ -3301,11 +3306,6 @@ async function* executeTool({
3301
3306
  }
3302
3307
  }
3303
3308
 
3304
- // src/types/executable-tool.ts
3305
- function isExecutableTool(tool2) {
3306
- return tool2 != null && typeof tool2.execute === "function";
3307
- }
3308
-
3309
3309
  // src/index.ts
3310
3310
  import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from "@workflow/serde";
3311
3311
  import {