@ai-sdk/provider-utils 5.0.0-canary.32 → 5.0.0-canary.34
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 +13 -0
- package/dist/index.d.ts +44 -19
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/types/index.ts +7 -7
- package/src/types/sandbox.ts +36 -0
- package/src/types/tool-execute-function.ts +6 -0
- package/src/types/tool.ts +5 -12
- package/src/types/sensitive-context.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 69254e0: feat(ai): add toolMetadata for tool specific metdata
|
|
8
|
+
- 3015fc3: feat: sandbox shell execution abstraction
|
|
9
|
+
|
|
10
|
+
## 5.0.0-canary.33
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 2427d88: feat(ai): change Tool.sensitiveContext to telemetry.includeToolsContext and make it opt-in
|
|
15
|
+
|
|
3
16
|
## 5.0.0-canary.32
|
|
4
17
|
|
|
5
18
|
### Major 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,
|
|
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';
|
|
@@ -1158,14 +1158,6 @@ type Context = Record<string, unknown>;
|
|
|
1158
1158
|
|
|
1159
1159
|
type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
1160
1160
|
|
|
1161
|
-
/**
|
|
1162
|
-
* Top-level context properties that contain sensitive data and should be
|
|
1163
|
-
* excluded from telemetry.
|
|
1164
|
-
*/
|
|
1165
|
-
type SensitiveContext<CONTEXT extends Context | unknown | never> = {
|
|
1166
|
-
[KEY in keyof CONTEXT]?: boolean;
|
|
1167
|
-
} | undefined;
|
|
1168
|
-
|
|
1169
1161
|
/**
|
|
1170
1162
|
* Tool approval request prompt part.
|
|
1171
1163
|
*/
|
|
@@ -1290,6 +1282,40 @@ type UserContent = string | Array<TextPart | ImagePart | FilePart>;
|
|
|
1290
1282
|
*/
|
|
1291
1283
|
type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessage | ToolModelMessage;
|
|
1292
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
|
+
|
|
1293
1319
|
/**
|
|
1294
1320
|
* Additional options that are sent into each tool execution.
|
|
1295
1321
|
*/
|
|
@@ -1319,6 +1345,10 @@ interface ToolExecutionOptions<CONTEXT extends Context | unknown | never> {
|
|
|
1319
1345
|
* in `prepareStep` and update it there.
|
|
1320
1346
|
*/
|
|
1321
1347
|
context: CONTEXT;
|
|
1348
|
+
/**
|
|
1349
|
+
* The sandbox environment that the tool is operating in.
|
|
1350
|
+
*/
|
|
1351
|
+
sandbox?: Sandbox;
|
|
1322
1352
|
}
|
|
1323
1353
|
/**
|
|
1324
1354
|
* Function that executes the tool and returns either a single result or a stream of results.
|
|
@@ -1400,11 +1430,11 @@ type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JS
|
|
|
1400
1430
|
*
|
|
1401
1431
|
* Unlike `providerOptions`, this metadata is not sent to the language
|
|
1402
1432
|
* model. Instead, it is propagated onto the resulting tool call's
|
|
1403
|
-
* `
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1433
|
+
* `toolMetadata` so consumers can read it from tool call / result parts
|
|
1434
|
+
* and UI message parts. This is useful for sources of dynamic tools (e.g.
|
|
1435
|
+
* an MCP server) to identify themselves.
|
|
1406
1436
|
*/
|
|
1407
|
-
|
|
1437
|
+
metadata?: JSONObject;
|
|
1408
1438
|
/**
|
|
1409
1439
|
* The schema of the input that the tool expects.
|
|
1410
1440
|
* The language model will use this to generate the input.
|
|
@@ -1419,11 +1449,6 @@ type BaseTool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JS
|
|
|
1419
1449
|
* The context is passed to execute function as part of the execution options.
|
|
1420
1450
|
*/
|
|
1421
1451
|
contextSchema?: FlexibleSchema<CONTEXT>;
|
|
1422
|
-
/**
|
|
1423
|
-
* Marks top-level context properties that contain sensitive data and should be excluded from telemetry.
|
|
1424
|
-
* Properties marked as `true` are omitted from telemetry integrations.
|
|
1425
|
-
*/
|
|
1426
|
-
sensitiveContext?: SensitiveContext<CONTEXT>;
|
|
1427
1452
|
/**
|
|
1428
1453
|
* Whether the tool needs approval before it can be executed.
|
|
1429
1454
|
*
|
|
@@ -2043,4 +2068,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
2043
2068
|
dynamic?: boolean;
|
|
2044
2069
|
}
|
|
2045
2070
|
|
|
2046
|
-
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
|
|
2071
|
+
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.
|
|
865
|
+
var VERSION = true ? "5.0.0-canary.34" : "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 {
|