🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

ai

Package Overview
Dependencies
Maintainers
5
Versions
1358
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai - npm Package Compare versions

Comparing version
6.0.220
to
6.0.221
+37
src/util/set-abort-timeout.ts
/**
* Schedules a timeout that aborts the given controller with a `TimeoutError`
* `DOMException`, matching the reason produced by `AbortSignal.timeout(ms)`.
*
* @param abortController - The controller to abort when the timeout elapses.
* If undefined, no timeout is scheduled.
* @param label - Human-readable label included in the error message
* (e.g. "Step", "Chunk").
* @param timeoutMs - Duration in milliseconds before the controller is aborted.
* If undefined, no timeout is scheduled.
* @returns The timeout id (suitable for passing to `clearTimeout`), or
* `undefined` if no timeout was scheduled.
*/
export function setAbortTimeout({
abortController,
label,
timeoutMs,
}: {
abortController: AbortController | undefined;
label: string;
timeoutMs: number | undefined;
}): ReturnType<typeof setTimeout> | undefined {
if (abortController == null || timeoutMs == null) {
return undefined;
}
return setTimeout(
() =>
abortController.abort(
new DOMException(
`${label} timeout of ${timeoutMs}ms exceeded`,
'TimeoutError',
),
),
timeoutMs,
);
}
+1
-1

@@ -155,3 +155,3 @@ "use strict";

// src/version.ts
var VERSION = true ? "6.0.220" : "0.0.0-test";
var VERSION = true ? "6.0.221" : "0.0.0-test";

@@ -158,0 +158,0 @@ // src/util/download/download.ts

@@ -135,3 +135,3 @@ // internal/index.ts

// src/version.ts
var VERSION = true ? "6.0.220" : "0.0.0-test";
var VERSION = true ? "6.0.221" : "0.0.0-test";

@@ -138,0 +138,0 @@ // src/util/download/download.ts

{
"name": "ai",
"version": "6.0.220",
"version": "6.0.221",
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",

@@ -48,5 +48,5 @@ "license": "Apache-2.0",

"@opentelemetry/api": "^1.9.0",
"@ai-sdk/gateway": "3.0.144",
"@ai-sdk/gateway": "3.0.145",
"@ai-sdk/provider": "3.0.13",
"@ai-sdk/provider-utils": "4.0.36"
"@ai-sdk/provider-utils": "4.0.37"
},

@@ -53,0 +53,0 @@ "devDependencies": {

@@ -55,2 +55,3 @@ import type {

import { prepareRetries } from '../util/prepare-retries';
import { setAbortTimeout } from '../util/set-abort-timeout';
import { VERSION } from '../version';

@@ -688,6 +689,7 @@ import type {

// Set up step timeout if configured
const stepTimeoutId =
stepTimeoutMs != null
? setTimeout(() => stepAbortController!.abort(), stepTimeoutMs)
: undefined;
const stepTimeoutId = setAbortTimeout({
abortController: stepAbortController,
label: 'Step',
timeoutMs: stepTimeoutMs,
});

@@ -694,0 +696,0 @@ try {

@@ -281,2 +281,3 @@ import {

const validatedElements: Array<ELEMENT> = [];
for (const element of outerValue.elements) {

@@ -298,5 +299,7 @@ const validationResult = await safeValidateTypes({

}
validatedElements.push(validationResult.value);
}
return outerValue.elements as Array<ELEMENT>;
return validatedElements;
},

@@ -303,0 +306,0 @@

@@ -174,6 +174,4 @@ import type {

// keep track of parsed tool calls so provider-emitted approval requests can reference them
// keep track of tool inputs for provider-side tool results
const toolInputs = new Map<string, unknown>();
// keep track of parsed tool calls so provider-emitted approval requests can reference them
const toolCallsByToolCallId = new Map<string, TypedToolCall<TOOLS>>();

@@ -353,4 +351,2 @@

toolInputs.set(toolCall.toolCallId, toolCall.input);
// Only execute tools that are not provider-executed:

@@ -410,3 +406,3 @@ if (tool.execute != null && toolCall.providerExecuted !== true) {

toolName,
input: toolInputs.get(chunk.toolCallId),
input: toolCall?.input,
providerExecuted: true,

@@ -427,3 +423,3 @@ error: chunk.result,

toolName,
input: toolInputs.get(chunk.toolCallId),
input: toolCall?.input,
output: chunk.result,

@@ -430,0 +426,0 @@ providerExecuted: true,

@@ -497,3 +497,3 @@ import {

state: 'approval-responded',
approval: { id, approved, reason },
approval: { ...part.approval, id, approved, reason },
}

@@ -500,0 +500,0 @@ : part;

@@ -249,6 +249,8 @@ import {

modelMessages.push({
role: 'assistant',
content,
});
if (content.length > 0) {
modelMessages.push({
role: 'assistant',
content,
});
}

@@ -301,3 +303,3 @@ // check if there are tool invocations with results in the block

toolPart.approval?.reason ??
'Tool execution denied.',
'Tool call execution denied.',
},

@@ -304,0 +306,0 @@ ...(toolPart.callProviderMetadata != null

@@ -40,2 +40,3 @@ export { callCompletionApi } from './call-completion-api';

isDataUIPart,
isDynamicToolUIPart,
isFileUIPart,

@@ -42,0 +43,0 @@ isReasoningUIPart,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display