🎩 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
1373
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.230
to
6.0.231
+19
src/generate-text/filter-active-tools.ts
import type { ToolSet } from './tool-set';
export function filterActiveTools<TOOLS extends ToolSet>({
tools,
activeTools,
}: {
tools: TOOLS | undefined;
activeTools: Array<keyof TOOLS> | undefined;
}): TOOLS | undefined {
if (tools == null || activeTools == null) {
return tools;
}
return Object.fromEntries(
Object.entries(tools).filter(([name]) =>
activeTools.includes(name as keyof TOOLS),
),
) as TOOLS;
}
+1
-1

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

// src/version.ts
var VERSION = true ? "6.0.230" : "0.0.0-test";
var VERSION = true ? "6.0.231" : "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.230" : "0.0.0-test";
var VERSION = true ? "6.0.231" : "0.0.0-test";

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

{
"name": "ai",
"version": "6.0.230",
"version": "6.0.231",
"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.153",
"@ai-sdk/provider": "3.0.14",
"@ai-sdk/provider-utils": "4.0.40"
"@ai-sdk/provider-utils": "4.0.40",
"@ai-sdk/gateway": "3.0.154"
},

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

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

import { extractTextContent } from './extract-text-content';
import { filterActiveTools } from './filter-active-tools';
import type { GenerateTextResult } from './generate-text-result';

@@ -688,2 +689,6 @@ import { DefaultGeneratedFile } from './generated-file';

do {
if (steps.length > 0) {
mergedAbortSignal?.throwIfAborted();
}
// Set up step timeout if configured

@@ -729,2 +734,6 @@ const stepTimeoutId = setAbortTimeout({

prepareStepResult?.activeTools ?? activeTools;
const stepToolSet = filterActiveTools({
tools,
activeTools: stepActiveTools,
});

@@ -922,3 +931,3 @@ const { toolChoice: stepToolChoice, tools: stepTools } =

toolCall,
tools,
tools: stepToolSet,
repairToolCall,

@@ -941,3 +950,3 @@ system,

const tool = tools?.[toolCall.toolName];
const tool = stepToolSet?.[toolCall.toolName];

@@ -1019,3 +1028,3 @@ if (tool == null) {

if (tools != null) {
if (stepToolSet != null) {
clientToolOutputs.push(

@@ -1028,3 +1037,3 @@ ...(await executeTools({

),
tools,
tools: stepToolSet,
tracer,

@@ -1057,3 +1066,3 @@ telemetry,

if (!toolCall.providerExecuted) continue;
const tool = tools?.[toolCall.toolName];
const tool = stepToolSet?.[toolCall.toolName];
if (tool?.type === 'provider' && tool.supportsDeferredResults) {

@@ -1087,3 +1096,3 @@ // Check if this tool call already has a result in the current response

toolApprovalRequests: Object.values(toolApprovalRequests),
tools,
tools: stepToolSet,
});

@@ -1095,3 +1104,3 @@

content: stepContent,
tools,
tools: stepToolSet,
})),

@@ -1098,0 +1107,0 @@ );

@@ -24,5 +24,5 @@ import type { JSONObject } from '@ai-sdk/provider';

export const uiMessageChunkSchema = lazySchema(() =>
zodSchema(
zodSchema<UIMessageChunk>(
z.union([
z.strictObject({
z.looseObject({
type: z.literal('text-start'),

@@ -32,3 +32,3 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('text-delta'),

@@ -39,3 +39,3 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('text-end'),

@@ -45,7 +45,7 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('error'),
errorText: z.string(),
}),
z.strictObject({
z.looseObject({
type: z.literal('tool-input-start'),

@@ -60,3 +60,3 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-input-delta'),

@@ -66,3 +66,3 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-input-available'),

@@ -78,3 +78,3 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-input-error'),

@@ -91,3 +91,3 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-approval-request'),

@@ -98,3 +98,3 @@ approvalId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-output-available'),

@@ -109,3 +109,3 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-output-error'),

@@ -119,7 +119,7 @@ toolCallId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('tool-output-denied'),
toolCallId: z.string(),
}),
z.strictObject({
z.looseObject({
type: z.literal('reasoning-start'),

@@ -129,3 +129,3 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('reasoning-delta'),

@@ -136,3 +136,3 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('reasoning-end'),

@@ -142,3 +142,3 @@ id: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('source-url'),

@@ -150,3 +150,3 @@ sourceId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('source-document'),

@@ -159,3 +159,3 @@ sourceId: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.literal('file'),

@@ -166,3 +166,3 @@ url: z.string(),

}),
z.strictObject({
z.looseObject({
type: z.custom<`data-${string}`>(

@@ -177,9 +177,9 @@ (value): value is `data-${string}` =>

}),
z.strictObject({
z.looseObject({
type: z.literal('start-step'),
}),
z.strictObject({
z.looseObject({
type: z.literal('finish-step'),
}),
z.strictObject({
z.looseObject({
type: z.literal('start'),

@@ -189,3 +189,3 @@ messageId: z.string().optional(),

}),
z.strictObject({
z.looseObject({
type: z.literal('finish'),

@@ -204,7 +204,7 @@ finishReason: z

}),
z.strictObject({
z.looseObject({
type: z.literal('abort'),
reason: z.string().optional(),
}),
z.strictObject({
z.looseObject({
type: z.literal('message-metadata'),

@@ -211,0 +211,0 @@ messageMetadata: z.unknown(),

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