Skip to content

Context7 Platform -- Up-to-date docs for AI agents

CTX7-879: Context7 Vercel AI SDK Tools (#1122)

Fahreddin Özcanf820f7fecd5a
diff --git a/.changeset/slimy-dancers-wait.md b/.changeset/slimy-dancers-wait.md
new file mode 100644
index 00000000..b9423d15
--- /dev/null
+++ b/.changeset/slimy-dancers-wait.md
@@ -0,0 +1,11 @@
+---
+"@upstash/context7-tools-ai-sdk": minor
+---
+
+Initial release of `@upstash/context7-tools-ai-sdk` - Vercel AI SDK integration for Context7.
+
+### Features
+
+- **Tools**: `resolveLibrary()` and `getLibraryDocs()` tools compatible with AI SDK's `generateText` and `streamText`
+- **Agent**: Pre-configured `Context7Agent` that handles the multi-step documentation retrieval workflow automatically
+
diff --git a/.github/workflows/canary-release.yml b/.github/workflows/canary-release.yml
index d6388d1f..48b9d596 100644
--- a/.github/workflows/canary-release.yml
+++ b/.github/workflows/canary-release.yml
@@ -28,7 +28,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
- version: 9
+ version: 10
- name: Configure npm authentication
run: |
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 760e15f8..40d04628 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,7 +27,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
- version: 9
+ version: 10
- name: Configure npm authentication
run: |
diff --git a/.github/workflows/check.yaml b/.github/workflows/test.yml
similarity index 58%
rename from .github/workflows/check.yaml
rename to .github/workflows/test.yml
index 678e4a68..77d41ca6 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/test.yml
@@ -1,24 +1,22 @@
-name: Build Check
+name: Test
on:
- push:
- branches: [master]
pull_request:
+ push:
branches: [master]
+ workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
- build:
- name: Build
+ test:
runs-on: ubuntu-latest
steps:
- - name: Checkout repository
- uses: actions/checkout@v6
+ - uses: actions/checkout@v4
- - name: Setup Node.js
+ - name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
@@ -26,7 +24,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
- version: 9
+ version: 10
- name: Get pnpm store directory
id: pnpm-cache
@@ -42,14 +40,24 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- - name: Install dependencies
+ - name: Install Dependencies
run: pnpm install --frozen-lockfile
- - name: Run linter
- run: pnpm run lint:check
+ - name: Lint
+ run: pnpm lint:check
+
+ - name: Format
+ run: pnpm format:check
+
+ - name: Build
+ run: pnpm build
- - name: Check formatting
- run: pnpm run format:check
+ - name: Typecheck
+ run: pnpm typecheck
- - name: Build project
- run: pnpm run build
+ - name: Test
+ run: pnpm test
+ env:
+ AWS_REGION: ${{ secrets.AWS_REGION }}
+ AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }}
+ CONTEXT7_API_KEY: ${{ secrets.CONTEXT7_API_KEY }}
diff --git a/package.json b/package.json
index a777d6fd..5d9aaf5f 100644
--- a/package.json
+++ b/package.json
@@ -10,8 +10,11 @@
"build": "pnpm -r run build",
"build:sdk": "pnpm --filter @upstash/context7-sdk build",
"build:mcp": "pnpm --filter @upstash/context7-mcp build",
+ "build:ai-sdk": "pnpm --filter @upstash/context7-tools-ai-sdk build",
+ "typecheck": "pnpm -r run typecheck",
"test": "pnpm -r run test",
"test:sdk": "pnpm --filter @upstash/context7-sdk test",
+ "test:tools-ai-sdk": "pnpm --filter @upstash/context7-tools-ai-sdk test",
"clean": "pnpm -r run clean && rm -rf node_modules",
"lint": "pnpm -r run lint",
"lint:check": "pnpm -r run lint:check",
diff --git a/packages/mcp/package.json b/packages/mcp/package.json
index 8425abb8..5cb232e6 100644
--- a/packages/mcp/package.json
+++ b/packages/mcp/package.json
@@ -5,7 +5,8 @@
"description": "MCP server for Context7",
"scripts": {
"build": "tsc && chmod 755 dist/index.js",
- "test": "echo \"Error: no test specified\" && exit 1",
+ "test": "echo \"No tests yet\"",
+ "typecheck": "tsc --noEmit",
"lint": "eslint .",
"lint:check": "eslint .",
"format": "prettier --write .",
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index 9bc2006c..e556295c 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -6,6 +6,7 @@
"build": "tsup",
"test": "vitest run",
"test:watch": "vitest",
+ "typecheck": "tsc --noEmit",
"dev": "tsup --watch",
"clean": "rm -rf dist",
"lint": "eslint .",
diff --git a/packages/tools-ai-sdk/README.md b/packages/tools-ai-sdk/README.md
new file mode 100644
index 00000000..6afb130e
--- /dev/null
+++ b/packages/tools-ai-sdk/README.md
@@ -0,0 +1,101 @@
+# Upstash Context7 AI SDK
+
+`@upstash/context7-tools-ai-sdk` provides [Vercel AI SDK](https://ai-sdk.dev/) compatible tools and agents that give your AI applications access to up to date library documentation through Context7.
+
+Use this package to:
+
+- Add documentation lookup tools to your AI SDK workflows with `generateText` or `streamText`
+- Create documentation aware agents using the pre-configured `Context7Agent`
+- Build RAG pipelines that retrieve accurate, version specific code examples
+
+The package provides two main tools:
+
+- `resolveLibrary` - Searches Context7's database to find the correct library ID
+- `getLibraryDocs` - Fetches documentation for a specific library with optional topic filtering
+
+## Quick Start
+
+### Install
+
+```bash
+npm install @upstash/context7-tools-ai-sdk @upstash/context7-sdk ai zod
+```
+
+### Get API Key
+
+Get your API key from [Context7](https://context7.com)
+
+## Usage
+
+### Using Tools with `generateText`
+
+```typescript
+import { resolveLibrary, getLibraryDocs } from "@upstash/context7-tools-ai-sdk";
+import { generateText, stepCountIs } from "ai";
+import { openai } from "@ai-sdk/openai";
+
+const { text } = await generateText({
+ model: openai("gpt-4o"),
+ prompt: "How do I use React Server Components?",
+ tools: {
+ resolveLibrary: resolveLibrary(),
+ getLibraryDocs: getLibraryDocs(),
+ },
+ stopWhen: stepCountIs(5),
+});
+
+console.log(text);
+```
+
+### Using the Context7 Agent
+
+The package provides a pre-configured agent that handles the multi-step workflow automatically:
+
+```typescript
+import { Context7Agent } from "@upstash/context7-tools-ai-sdk";
+import { anthropic } from "@ai-sdk/anthropic";
+
+const agent = new Context7Agent({
+ model: anthropic("claude-sonnet-4-20250514"),
+});
+
+const { text } = await agent.generate({
+ prompt: "How do I set up routing in Next.js?",
+});
+
+console.log(text);
+```
+
+## Configuration
+
+### Environment Variables
+
+Set your API key via environment variable:
+
+```sh
+CONTEXT7_API_KEY=ctx7sk-...
+```
+
+Then use tools and agents without explicit configuration:
+
+```typescript
+const tool = resolveLibrary(); // Uses CONTEXT7_API_KEY automatically
+```
+
+## Docs
+
+See the [documentation](https://context7.com/docs/agentic-tools/ai-sdk/getting-started) for details.
+
+## Contributing
+
+### Running tests
+
+```sh
+pnpm test
+```
+
+### Building
+
+```sh
+pnpm build
+```
diff --git a/packages/tools-ai-sdk/eslint.config.js b/packages/tools-ai-sdk/eslint.config.js
new file mode 100644
index 00000000..aeb85ced
--- /dev/null
+++ b/packages/tools-ai-sdk/eslint.config.js
@@ -0,0 +1,47 @@
+import { defineConfig } from "eslint/config";
+import tseslint from "typescript-eslint";
+import eslintPluginPrettier from "eslint-plugin-prettier";
+
+export default defineConfig(
+ {
+ // Base ESLint configuration
+ ignores: ["node_modules/**", "build/**", "dist/**", ".git/**", ".github/**"],
+ },
+ {
+ files: ["**/*.ts", "**/*.tsx"],
+ languageOptions: {
+ ecmaVersion: 2020,
+ sourceType: "module",
+ parser: tseslint.parser,
+ parserOptions: {
+ project: "./tsconfig.json",
+ tsconfigRootDir: import.meta.dirname,
+ },
+ globals: {
+ // Add Node.js globals
+ process: "readonly",
+ require: "readonly",
+ module: "writable",
+ console: "readonly",
+ },
+ },
+ // Settings for all files
+ linterOptions: {
+ reportUnusedDisableDirectives: true,
+ },
+ plugins: {
+ "@typescript-eslint": tseslint.plugin,
+ prettier: eslintPluginPrettier,
+ },
+ rules: {
+ // TypeScript recommended rules
+ ...tseslint.configs.recommended.rules,
+ // TypeScript rules
+ "@typescript-eslint/explicit-module-boundary-types": "off",
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
+ "@typescript-eslint/no-explicit-any": "warn",
+ // Prettier integration
+ "prettier/prettier": "error",
+ },
+ }
+);
diff --git a/packages/tools-ai-sdk/package.json b/packages/tools-ai-sdk/package.json
new file mode 100644
index 00000000..661cc1b7
--- /dev/null
+++ b/packages/tools-ai-sdk/package.json
@@ -0,0 +1,69 @@
+{
+ "name": "@upstash/context7-tools-ai-sdk",
+ "version": "0.1.0",
+ "description": "Context7 tools for Vercel AI SDK",
+ "type": "module",
+ "main": "./dist/index.cjs",
+ "module": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js",
+ "require": "./dist/index.cjs"
+ },
+ "./agent": {
+ "types": "./dist/agent.d.ts",
+ "import": "./dist/agent.js",
+ "require": "./dist/agent.cjs"
+ }
+ },
+ "files": [
+ "dist"
+ ],
+ "scripts": {
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "test": "vitest run",
+ "typecheck": "tsc --noEmit",
+ "clean": "rm -rf dist"
+ },
+ "peerDependencies": {
+ "@upstash/context7-sdk": ">=0.1.0",
+ "ai": ">=5.0.0",
+ "zod": ">=3.24.0"
+ },
+ "devDependencies": {
+ "@upstash/context7-sdk": "workspace:*",
+ "ai": "^5.0.0",
+ "zod": "^3.24.0",
+ "@ai-sdk/amazon-bedrock": "^3.0.55",
+ "@types/node": "^22.13.14",
+ "dotenv": "^17.2.3",
+ "tsup": "^8.5.1",
+ "typescript": "^5.8.2",
+ "vitest": "^4.0.13"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/upstash/context7.git",
+ "directory": "packages/tools-ai-sdk"
+ },
+ "keywords": [
+ "context7",
+ "ai-sdk",
+ "vercel",
+ "documentation",
+ "agent",
+ "upstash"
+ ],
+ "author": "Upstash",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/upstash/context7/issues"
+ },
+ "homepage": "https://github.com/upstash/context7#readme",
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/tools-ai-sdk/src/agents/context7.ts b/packages/tools-ai-sdk/src/agents/context7.ts
new file mode 100644
index 00000000..817562da
--- /dev/null
+++ b/packages/tools-ai-sdk/src/agents/context7.ts
@@ -0,0 +1,75 @@
+import {
+ Experimental_Agent as Agent,
+ type Experimental_AgentSettings as AgentSettings,
+ type ToolSet,
+ stepCountIs,
+} from "ai";
+import { resolveLibrary, getLibraryDocs } from "@tools";
+import { AGENT_PROMPT } from "@prompts";
+
+/**
+ * Configuration for Context7 agent.
+ */
+export interface Context7AgentConfig extends AgentSettings<ToolSet> {
+ /**
+ * Context7 API key. If not provided, uses the CONTEXT7_API_KEY environment variable.
+ */
+ apiKey?: string;
+
+ /**
+ * Default maximum number of documentation results per request.
+ * @default 10
+ */
+ defaultMaxResults?: number;
+}
+
+/**
+ * Context7 documentation search agent
+ *
+ * The agent follows a multi-step workflow:
+ * 1. Resolves library names to Context7 library IDs
+ * 2. Fetches documentation for the resolved library
+ * 3. Provides answers with code examples
+ *
+ * @example
+ * ```typescript
+ * import { Context7Agent } from '@upstash/context7-tools-ai-sdk';
+ * import { anthropic } from '@ai-sdk/anthropic';
+ *
+ * const agent = new Context7Agent({
+ * model: anthropic('claude-sonnet-4-20250514'),
+ * apiKey: 'your-context7-api-key',
+ * });
+ *
+ * const result = await agent.generate({
+ * prompt: 'How do I use React Server Components?',
+ * });
+ * ```
+ */
+export class Context7Agent extends Agent<ToolSet> {
+ constructor(config: Context7AgentConfig) {
+ const {
+ model,
+ stopWhen = stepCountIs(5),
+ system,
+ apiKey,
+ defaultMaxResults,
+ tools,
+ ...agentSettings
+ } = config;
+
+ const context7Config = { apiKey, defaultMaxResults };
+
+ super({
+ ...agentSettings,
+ model,
+ system: system || AGENT_PROMPT,
+ tools: {
+ ...tools,
+ resolveLibrary: resolveLibrary(context7Config),
+ getLibraryDocs: getLibraryDocs(context7Config),
+ },
+ stopWhen,
+ });
+ }
+}
diff --git a/packages/tools-ai-sdk/src/agents/index.ts b/packages/tools-ai-sdk/src/agents/index.ts
new file mode 100644
index 00000000..d803381d
--- /dev/null
+++ b/packages/tools-ai-sdk/src/agents/index.ts
@@ -0,0 +1 @@
+export { Context7Agent, type Context7AgentConfig } from "./context7";
diff --git a/packages/tools-ai-sdk/src/index.test.ts b/packages/tools-ai-sdk/src/index.test.ts
new file mode 100644
index 00000000..58750d04
--- /dev/null
+++ b/packages/tools-ai-sdk/src/index.test.ts
@@ -0,0 +1,228 @@
+import { describe, test, expect } from "vitest";
+import { generateText, stepCountIs, tool } from "ai";
+import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
+import { z } from "zod";
+import {
+ resolveLibrary,
+ getLibraryDocs,
+ Context7Agent,
+ SYSTEM_PROMPT,
+ AGENT_PROMPT,
+ RESOLVE_LIBRARY_DESCRIPTION,
+} from "./index";
+
+const bedrock = createAmazonBedrock({
+ region: process.env.AWS_REGION,
+ apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK,
+});
+
+describe("@upstash/context7-tools-ai-sdk", () => {
+ describe("Tool structure", () => {
+ test("resolveLibrary() should return a tool object with correct structure", () => {
+ const tool = resolveLibrary();
+
+ expect(tool).toBeDefined();
+ expect(tool).toHaveProperty("execute");
+ expect(tool).toHaveProperty("inputSchema");
+ expect(tool).toHaveProperty("description");
+ expect(tool.description).toContain("library");
+ });
+
+ test("getLibraryDocs() should return a tool object with correct structure", () => {
+ const tool = getLibraryDocs();
+
+ expect(tool).toBeDefined();
+ expect(tool).toHaveProperty("execute");
+ expect(tool).toHaveProperty("inputSchema");
+ expect(tool).toHaveProperty("description");
+ expect(tool.description).toContain("documentation");
+ });
+
+ test("tools should accept custom config", () => {
+ const resolveTool = resolveLibrary({
+ apiKey: "ctx7sk-test-key",
+ });
+
+ const docsTool = getLibraryDocs({
+ apiKey: "ctx7sk-test-key",
+ defaultMaxResults: 5,
+ });
+
+ expect(resolveTool).toHaveProperty("execute");
+ expect(docsTool).toHaveProperty("execute");
+ });
+ });
+
+ describe("Tool usage with generateText", () => {
+ test("resolveLibrary tool should be called when searching for a library", async () => {
+ const result = await generateText({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ tools: {
+ resolveLibrary: resolveLibrary(),
+ },
+ toolChoice: { type: "tool", toolName: "resolveLibrary" },
+ stopWhen: stepCountIs(2),
+ prompt: "Search for 'react' library",
+ });
+
+ expect(result.toolCalls.length).toBeGreaterThan(0);
+ expect(result.toolCalls[0].toolName).toBe("resolveLibrary");
+ expect(result.toolResults.length).toBeGreaterThan(0);
+ const toolResult = result.toolResults[0] as unknown as { output: { success: boolean } };
+ expect(toolResult.output.success).toBe(true);
+ }, 30000);
+
+ test("getLibraryDocs tool should fetch documentation", async () => {
+ const result = await generateText({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ tools: {
+ getLibraryDocs: getLibraryDocs(),
+ },
+ toolChoice: { type: "tool", toolName: "getLibraryDocs" },
+ stopWhen: stepCountIs(2),
+ prompt: "Fetch documentation for library ID '/facebook/react' with topic 'hooks'",
+ });
+
+ expect(result.toolCalls.length).toBeGreaterThan(0);
+ expect(result.toolCalls[0].toolName).toBe("getLibraryDocs");
+ expect(result.toolResults.length).toBeGreaterThan(0);
+ const toolResult = result.toolResults[0] as unknown as { output: { success: boolean } };
+ expect(toolResult.output.success).toBe(true);
+ }, 30000);
+
+ test("both tools can work together in a multi-step flow", async () => {
+ const result = await generateText({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ tools: {
+ resolveLibrary: resolveLibrary(),
+ getLibraryDocs: getLibraryDocs(),
+ },
+ stopWhen: stepCountIs(5),
+ prompt:
+ "First use resolveLibrary to find the Next.js library, then use getLibraryDocs to get documentation about routing",
+ });
+
+ const allToolCalls = result.steps.flatMap((step) => step.toolCalls);
+ const toolNames = allToolCalls.map((call) => call.toolName);
+ expect(toolNames).toContain("resolveLibrary");
+ expect(toolNames).toContain("getLibraryDocs");
+ }, 60000);
+ });
+
+ describe("Context7Agent class", () => {
+ test("should create an agent instance with model", () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ });
+
+ expect(agent).toBeDefined();
+ expect(agent).toHaveProperty("generate");
+ expect(agent).toHaveProperty("stream");
+ });
+
+ test("should accept custom stopWhen condition", () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ stopWhen: stepCountIs(3),
+ });
+
+ expect(agent).toBeDefined();
+ });
+
+ test("should accept custom system prompt", () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ system: "Custom system prompt for testing",
+ });
+
+ expect(agent).toBeDefined();
+ });
+
+ test("should accept Context7 config options", () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ apiKey: "ctx7sk-test-key",
+ defaultMaxResults: 5,
+ });
+
+ expect(agent).toBeDefined();
+ });
+
+ test("should accept additional tools alongside Context7 tools", () => {
+ const customTool = tool({
+ description: "A custom test tool",
+ inputSchema: z.object({
+ input: z.string().describe("Test input"),
+ }),
+ execute: async ({ input }) => ({ result: `processed: ${input}` }),
+ });
+
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ tools: {
+ customTool,
+ },
+ });
+
+ expect(agent).toBeDefined();
+ });
+
+ test("should generate response using agent workflow", async () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ stopWhen: stepCountIs(5),
+ });
+
+ const result = await agent.generate({
+ prompt: "Find the React library and get documentation about hooks",
+ });
+
+ expect(result).toBeDefined();
+ expect(result.steps.length).toBeGreaterThan(0);
+
+ const allToolCalls = result.steps.flatMap((step) => step.toolCalls);
+ const toolNames = allToolCalls.map((call) => call.toolName);
+ expect(toolNames).toContain("resolveLibrary");
+ }, 60000);
+
+ test("should include Context7 tools in generate result", async () => {
+ const agent = new Context7Agent({
+ model: bedrock("anthropic.claude-3-haiku-20240307-v1:0"),
+ stopWhen: stepCountIs(5),
+ });
+
+ const result = await agent.generate({
+ prompt:
+ "Use resolveLibrary to search for Next.js, then use getLibraryDocs to get routing documentation",
+ });
+
+ expect(result).toBeDefined();
+
+ const allToolCalls = result.steps.flatMap((step) => step.toolCalls);
+ const toolNames = allToolCalls.map((call) => call.toolName);
+
+ expect(toolNames).toContain("resolveLibrary");
+ expect(toolNames).toContain("getLibraryDocs");
+ }, 60000);
+ });
+
+ describe("Prompt exports", () => {
+ test("should export SYSTEM_PROMPT", () => {
+ expect(SYSTEM_PROMPT).toBeDefined();
+ expect(typeof SYSTEM_PROMPT).toBe("string");
+ expect(SYSTEM_PROMPT.length).toBeGreaterThan(0);
+ });
+
+ test("should export AGENT_PROMPT", () => {
+ expect(AGENT_PROMPT).toBeDefined();
+ expect(typeof AGENT_PROMPT).toBe("string");
+ expect(AGENT_PROMPT).toContain("Context7");
+ });
+
+ test("should export RESOLVE_LIBRARY_DESCRIPTION", () => {
+ expect(RESOLVE_LIBRARY_DESCRIPTION).toBeDefined();
+ expect(typeof RESOLVE_LIBRARY_DESCRIPTION).toBe("string");
+ expect(RESOLVE_LIBRARY_DESCRIPTION).toContain("library");
+ });
+ });
+});
diff --git a/packages/tools-ai-sdk/src/index.ts b/packages/tools-ai-sdk/src/index.ts
new file mode 100644
index 00000000..8b24b1e3
--- /dev/null
+++ b/packages/tools-ai-sdk/src/index.ts
@@ -0,0 +1,23 @@
+// Agents
+export { Context7Agent, type Context7AgentConfig } from "@agents";
+
+// Tools
+export { resolveLibrary, getLibraryDocs, type Context7ToolsConfig } from "@tools";
+
+// Prompts
+export {
+ SYSTEM_PROMPT,
+ AGENT_PROMPT,
+ RESOLVE_LIBRARY_DESCRIPTION,
+ GET_LIBRARY_DOCS_DESCRIPTION,
+} from "@prompts";
+
+// Re-export useful types from SDK
+export type {
+ SearchResult,
+ SearchLibraryResponse,
+ CodeDocsResponse,
+ TextDocsResponse,
+ InfoDocsResponse,
+ Pagination,
+} from "@upstash/context7-sdk";
diff --git a/packages/tools-ai-sdk/src/prompts/index.ts b/packages/tools-ai-sdk/src/prompts/index.ts
new file mode 100644
index 00000000..407fb997
--- /dev/null
+++ b/packages/tools-ai-sdk/src/prompts/index.ts
@@ -0,0 +1,6 @@
+export {
+ SYSTEM_PROMPT,
+ AGENT_PROMPT,
+ RESOLVE_LIBRARY_DESCRIPTION,
+ GET_LIBRARY_DOCS_DESCRIPTION,
+} from "./system";
diff --git a/packages/tools-ai-sdk/src/prompts/system.ts b/packages/tools-ai-sdk/src/prompts/system.ts
new file mode 100644
index 00000000..44103ad6
--- /dev/null
+++ b/packages/tools-ai-sdk/src/prompts/system.ts
@@ -0,0 +1,81 @@
+/**
+ * System prompts for Context7 AI SDK agents
+ */
+
+/**
+ * Basic documentation assistant prompt
+ */
+export const SYSTEM_PROMPT = `You are a documentation search assistant powered by Context7.
+
+Your role is to help users find accurate, up-to-date documentation for libraries and frameworks.
+
+When answering questions:
+1. Search for the relevant library documentation
+2. Provide code examples when available
+3. Cite your sources by mentioning the library ID used`;
+
+/**
+ * Detailed multi-step workflow prompt for comprehensive documentation retrieval
+ */
+export const AGENT_PROMPT = `You are a documentation search assistant powered by Context7.
+
+CRITICAL WORKFLOW - YOU MUST FOLLOW THESE STEPS:
+
+Step 1: ALWAYS start by calling 'resolveLibrary' with the library name from the user's query
+ - Extract the main library/framework name (e.g., "React", "Next.js", "Vue")
+ - Call resolveLibrary with just the library name
+ - Review ALL the search results returned
+
+Step 2: Analyze the results from resolveLibrary and select the BEST library ID based on:
+ - Official sources (e.g., /reactjs/react.dev for React, /vercel/next.js for Next.js)
+ - Name similarity to what the user is looking for
+ - Description relevance
+ - Source reputation (High/Medium is better)
+ - Code snippet coverage (higher is better)
+ - Benchmark score (higher is better)
+
+Step 3: Call 'getLibraryDocs' with the selected library ID
+ - Use the exact library ID from the resolveLibrary results
+ - ALWAYS extract and include a relevant topic from the user's query (e.g., "Server-Side Rendering", "routing", "authentication")
+ - Start with page=1 (default)
+
+Step 4: If the documentation from page 1 isn't sufficient, call 'getLibraryDocs' again with page=2
+ - Use the same library ID and the SAME topic from step 3
+ - This gives you more comprehensive documentation
+
+Step 5: Provide a clear answer with code examples from the documentation
+
+IMPORTANT:
+- You MUST call resolveLibrary first before calling getLibraryDocs
+- Do NOT skip resolveLibrary - it helps you find the correct official documentation
+- Always cite which library ID you used`;
+
+/**
+ * Library resolution tool description
+ */
+export const RESOLVE_LIBRARY_DESCRIPTION = `Resolves a package/product name to a Context7-compatible library ID and returns a list of matching libraries.
+
+You MUST call this function before 'getLibraryDocs' to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query.
+
+Selection Process:
+1. Analyze the query to understand what library/package the user is looking for
+2. Return the most relevant match based on:
+- Name similarity to the query (exact matches prioritized)
+- Description relevance to the query's intent
+- Documentation coverage (prioritize libraries with higher Code Snippet counts)
+- Source reputation (consider libraries with High or Medium reputation more authoritative)
+- Benchmark Score: Quality indicator (100 is the highest score)
+
+Response Format:
+- Return the selected library ID in a clearly marked section
+- Provide a brief explanation for why this library was chosen
+- If multiple good matches exist, acknowledge this but proceed with the most relevant one
+- If no good matches exist, clearly state this and suggest query refinements
+
+For ambiguous queries, request clarification before proceeding with a best-guess match.`;
+
+/**
+ * Get library docs tool description
+ */
+export const GET_LIBRARY_DOCS_DESCRIPTION =
+ "Fetches up-to-date documentation for a library. You must call 'resolveLibrary' first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query. Use mode='code' (default) for API references and code examples, or mode='info' for conceptual guides, narrative information, and architectural questions.";
diff --git a/packages/tools-ai-sdk/src/tools/get-library-docs.ts b/packages/tools-ai-sdk/src/tools/get-library-docs.ts
new file mode 100644
index 00000000..04d28ab2
--- /dev/null
+++ b/packages/tools-ai-sdk/src/tools/get-library-docs.ts
@@ -0,0 +1,115 @@
+import { tool } from "ai";
+import { z } from "zod";
+import { Context7 } from "@upstash/context7-sdk";
+import type { Context7ToolsConfig } from "./types";
+import { GET_LIBRARY_DOCS_DESCRIPTION } from "@prompts";
+
+/**
+ * Tool to fetch documentation for a library using its Context7 library ID.
+ *
+ * Can be called with or without configuration. Uses CONTEXT7_API_KEY environment
+ * variable for authentication when no API key is provided.
+ *
+ * @param config Optional configuration options
+ * @returns AI SDK tool for fetching library documentation
+ *
+ * @example
+ * ```typescript
+ * import { resolveLibrary, getLibraryDocs } from '@upstash/context7-tools-ai-sdk';
+ * import { generateText, stepCountIs } from 'ai';
+ * import { openai } from '@ai-sdk/openai';
+ *
+ * const { text } = await generateText({
+ * model: openai('gpt-4o'),
+ * prompt: 'Find React documentation about hooks',
+ * tools: {
+ * resolveLibrary: resolveLibrary(),
+ * getLibraryDocs: getLibraryDocs(),
+ * },
+ * stopWhen: stepCountIs(5),
+ * });
+ * ```
+ */
+export function getLibraryDocs(config: Context7ToolsConfig = {}) {
+ const { apiKey, defaultMaxResults = 10 } = config;
+ const getClient = () => new Context7({ apiKey });
+
+ return tool({
+ description: GET_LIBRARY_DOCS_DESCRIPTION,
+ inputSchema: z.object({
+ libraryId: z
+ .string()
+ .describe(
+ "Exact Context7-compatible library ID (e.g., '/mongodb/docs', '/vercel/next.js', '/supabase/supabase', '/vercel/next.js/v14.3.0-canary.87') retrieved from 'resolveLibrary' or directly from user query in the format '/org/project' or '/org/project/version'."
+ ),
+ mode: z
+ .enum(["code", "info"])
+ .optional()
+ .default("code")
+ .describe(
+ "Documentation mode: 'code' for API references and code examples (default), 'info' for conceptual guides, narrative information, and architectural questions."
+ ),
+ topic: z
+ .string()
+ .optional()
+ .describe("Topic to focus documentation on (e.g., 'hooks', 'routing')."),
+ page: z
+ .number()
+ .int()
+ .min(1)
+ .max(10)
+ .optional()
+ .describe(
+ "Page number for pagination (start: 1, default: 1). If the context is not sufficient, try page=2, page=3, page=4, etc. with the same topic."
+ ),
+ }),
+ execute: async ({
+ libraryId,
+ mode = "code",
+ topic,
+ page = 1,
+ }: {
+ libraryId: string;
+ mode?: "code" | "info";
+ topic?: string;
+ page?: number;
+ }) => {
+ try {
+ const client = getClient();
+ const baseOptions = {
+ page,
+ limit: defaultMaxResults,
+ topic: topic?.trim() || undefined,
+ };
+
+ const response =
+ mode === "info"
+ ? await client.getDocs(libraryId, { ...baseOptions, mode: "info" })
+ : await client.getDocs(libraryId, { ...baseOptions, mode: "code" });
+
+ if (!response.snippets?.length) {
+ return {
+ success: false,
+ error:
+ "Documentation not found or not finalized for this library. This might have happened because you used an invalid Context7-compatible library ID. To get a valid Context7-compatible library ID, use the 'resolveLibrary' with the package name you wish to retrieve documentation for.",
+ libraryId,
+ };
+ }
+
+ return {
+ success: true,
+ libraryId,
+ snippets: response.snippets,
+ pagination: response.pagination,
+ totalTokens: response.totalTokens,
+ };
+ } catch (error) {
+ return {
+ success: false,
+ error: error instanceof Error ? error.message : "Failed to fetch documentation",
+ libraryId,
+ };
+ }
+ },
+ });
+}
diff --git a/packages/tools-ai-sdk/src/tools/index.ts b/packages/tools-ai-sdk/src/tools/index.ts
new file mode 100644
index 00000000..5d93fe7c
--- /dev/null
+++ b/packages/tools-ai-sdk/src/tools/index.ts
@@ -0,0 +1,3 @@
+export { resolveLibrary } from "./resolve-library";
+export { getLibraryDocs } from "./get-library-docs";
+export type { Context7ToolsConfig } from "./types";
diff --git a/packages/tools-ai-sdk/src/tools/resolve-library.ts b/packages/tools-ai-sdk/src/tools/resolve-library.ts
new file mode 100644
index 00000000..1c9771b0
--- /dev/null
+++ b/packages/tools-ai-sdk/src/tools/resolve-library.ts
@@ -0,0 +1,71 @@
+import { tool } from "ai";
+import { z } from "zod";
+import { Context7 } from "@upstash/context7-sdk";
+import { RESOLVE_LIBRARY_DESCRIPTION } from "@prompts";
+import type { Context7ToolsConfig } from "./types";
+
+/**
+ * Tool to resolve a library name to a Context7-compatible library ID.
+ *
+ * Can be called with or without configuration. Uses CONTEXT7_API_KEY environment
+ * variable for authentication when no API key is provided.
+ *
+ * @param config Optional configuration options
+ * @returns AI SDK tool for library resolution
+ *
+ * @example
+ * ```typescript
+ * import { resolveLibrary, getLibraryDocs } from '@upstash/context7-tools-ai-sdk';
+ * import { generateText, stepCountIs } from 'ai';
+ * import { openai } from '@ai-sdk/openai';
+ *
+ * const { text } = await generateText({
+ * model: openai('gpt-4o'),
+ * prompt: 'Find React documentation about hooks',
+ * tools: {
+ * resolveLibrary: resolveLibrary(),
+ * getLibraryDocs: getLibraryDocs(),
+ * },
+ * stopWhen: stepCountIs(5),
+ * });
+ * ```
+ */
+export function resolveLibrary(config: Context7ToolsConfig = {}) {
+ const { apiKey } = config;
+ const getClient = () => new Context7({ apiKey });
+
+ return tool({
+ description: RESOLVE_LIBRARY_DESCRIPTION,
+ inputSchema: z.object({
+ libraryName: z
+ .string()
+ .describe("Library name to search for and retrieve a Context7-compatible library ID."),
+ }),
+ execute: async ({ libraryName }: { libraryName: string }) => {
+ try {
+ const client = getClient();
+ const response = await client.searchLibrary(libraryName);
+
+ if (!response.results || response.results.length === 0) {
+ return {
+ success: false,
+ error: "No libraries found matching your query.",
+ suggestions: "Try a different search term or check the library name.",
+ };
+ }
+
+ return {
+ success: true,
+ results: response.results,
+ totalResults: response.results.length,
+ };
+ } catch (error) {
+ return {
+ success: false,
+ error: error instanceof Error ? error.message : "Failed to search libraries",
+ suggestions: "Check your API key and try again, or try a different search term.",
+ };
+ }
+ },
+ });
+}
diff --git a/packages/tools-ai-sdk/src/tools/types.ts b/packages/tools-ai-sdk/src/tools/types.ts
new file mode 100644
index 00000000..380d012f
--- /dev/null
+++ b/packages/tools-ai-sdk/src/tools/types.ts
@@ -0,0 +1,14 @@
+/**
+ * Configuration for Context7 tools
+ */
+export interface Context7ToolsConfig {
+ /**
+ * Context7 API key. If not provided, will use CONTEXT7_API_KEY environment variable.
+ */
+ apiKey?: string;
+ /**
+ * Default maximum number of documentation results per page.
+ * @default 10
+ */
+ defaultMaxResults?: number;
+}
diff --git a/packages/tools-ai-sdk/tsconfig.json b/packages/tools-ai-sdk/tsconfig.json
new file mode 100644
index 00000000..67cbe80f
--- /dev/null
+++ b/packages/tools-ai-sdk/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "lib": ["ESNext"],
+ "module": "esnext",
+ "target": "esnext",
+ "moduleResolution": "bundler",
+ "moduleDetection": "force",
+ "allowImportingTsExtensions": true,
+ "noEmit": true,
+ "strict": true,
+ "downlevelIteration": true,
+ "skipLibCheck": true,
+ "allowSyntheticDefaultImports": true,
+ "forceConsistentCasingInFileNames": true,
+ "allowJs": true,
+ "baseUrl": ".",
+ "paths": {
+ "@tools": ["./src/tools/index.ts"],
+ "@agents": ["./src/agents/index.ts"],
+ "@prompts": ["./src/prompts/index.ts"]
+ }
+ },
+ "include": ["src/**/*", "tsup.config.ts", "vitest.config.ts", "eslint.config.js"],
+ "exclude": ["node_modules", "dist", "examples"]
+}
diff --git a/packages/tools-ai-sdk/tsup.config.ts b/packages/tools-ai-sdk/tsup.config.ts
new file mode 100644
index 00000000..590d55a0
--- /dev/null
+++ b/packages/tools-ai-sdk/tsup.config.ts
@@ -0,0 +1,18 @@
+import { defineConfig } from "tsup";
+
+export default defineConfig({
+ entry: {
+ index: "./src/index.ts",
+ agent: "./src/agents/index.ts",
+ },
+ format: ["cjs", "esm"],
+ clean: true,
+ dts: true,
+ esbuildOptions(options) {
+ options.alias = {
+ "@tools": "./src/tools/index.ts",
+ "@agents": "./src/agents/index.ts",
+ "@prompts": "./src/prompts/index.ts",
+ };
+ },
+});
diff --git a/packages/tools-ai-sdk/vitest.config.ts b/packages/tools-ai-sdk/vitest.config.ts
new file mode 100644
index 00000000..2b71b676
--- /dev/null
+++ b/packages/tools-ai-sdk/vitest.config.ts
@@ -0,0 +1,20 @@
+import { defineConfig } from "vitest/config";
+import path from "path";
+import { config } from "dotenv";
+
+config();
+
+export default defineConfig({
+ test: {
+ globals: true,
+ environment: "node",
+ include: ["src/**/*.test.ts"],
+ },
+ resolve: {
+ alias: {
+ "@tools": path.resolve(__dirname, "./src/tools/index.ts"),
+ "@agents": path.resolve(__dirname, "./src/agents/index.ts"),
+ "@prompts": path.resolve(__dirname, "./src/prompts/index.ts"),
+ },
+ },
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 58cde648..34d2b4b6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -83,10 +83,79 @@ importers:
version: 5.9.3
vitest:
specifier: ^4.0.13
- version: 4.0.14(@types/[email protected])
+ version: 4.0.14(@opentelemetry/[email protected])(@types/[email protected])
+
+ packages/tools-ai-sdk:
+ devDependencies:
+ '@ai-sdk/amazon-bedrock':
+ specifier: ^3.0.55
+ version: 3.0.62([email protected])
+ '@types/node':
+ specifier: ^22.13.14
+ version: 22.19.1
+ '@upstash/context7-sdk':
+ specifier: workspace:*
+ version: link:../sdk
+ ai:
+ specifier: ^5.0.0
+ version: 5.0.104([email protected])
+ dotenv:
+ specifier: ^17.2.3
+ version: 17.2.3
+ tsup:
+ specifier: ^8.5.1
+ typescript:
+ specifier: ^5.8.2
+ version: 5.9.3
+ vitest:
+ specifier: ^4.0.13
+ version: 4.0.14(@opentelemetry/[email protected])(@types/[email protected])
+ zod:
+ specifier: ^3.24.0
+ version: 3.25.76
packages:
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-vVtndaj5zfHmgw8NSqN4baFDbFDTBZP6qufhKfqSNLtygEm8+8PL9XQX9urgzSzU3zp+zi3AmNNemvKLkkqblg==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-21PaHfoLmouOXXNINTsZJsMw+wE5oLR2He/1kq/sKokTVKyq7ObGT1LDk6ahwxaz/GoaNaGankMh+EgVcdv2Cw==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-oVAG6q72KsjKlrYdLhWjRO7rcqAR8CjokAbYuyVZoCO4Uh2PH/VzZoxZav71w2ipwlXhHCNaInGYWNs889MMDA==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-ypv1xXMsgGcNKUP+hglKqtdDuMg68nWHucPPAhIENrbFAI+xCHiqPVN8Zllxyv1TNZwGWUghPxJXU+Mqps0YRQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==}
+ engines: {node: '>=18'}
+
+ '@aws-crypto/[email protected]':
+ resolution: {integrity: sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==}
+ engines: {node: '>=16.0.0'}
+
+ '@aws-crypto/[email protected]':
+ resolution: {integrity: sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==}
+
+ '@aws-sdk/[email protected]':
+ resolution: {integrity: sha512-uz0/VlMd2pP5MepdrHizd+T+OKfyK4r3OA9JI+L/lPKg0YFQosdJNCKisr6o70E3dh8iMpFYxF1UN/4uZsyARg==}
+ engines: {node: '>=18.0.0'}
+
resolution: {integrity: sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==}
engines: {node: '>=6.9.0'}
@@ -561,6 +630,10 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
+ '@opentelemetry/[email protected]':
+ resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==}
+ engines: {node: '>=8.0.0'}
+
resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@@ -675,6 +748,42 @@ packages:
cpu: [x64]
os: [win32]
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-Ogt4Zi9hEbIP17oQMd68qYOHUzmH47UkK7q7Gl55iIm9oKt27MUGrC5JfpMroeHjdkOliOA4Qt3NQ1xMq/nrlA==}
+ engines: {node: '>=18.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==}
+ engines: {node: '>=14.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-DZZZBvC7sjcYh4MazJSGiWMI2L7E0oCiRHREDzIxi/M2LY79/21iXt6aPLHge82wi5LsuRF5A06Ds3+0mlh6CQ==}
+ engines: {node: '>=18.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-MvUbdnXDTwykR8cB1WZvNNwqoWVaTRA0RLlLmf/cIFNMM2cKWz01X4Ly6SMC4Kks30r8tT3Cty0jmeWfiuyHTA==}
+ engines: {node: '>=18.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==}
+ engines: {node: '>=14.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-kAY9hTKulTNevM2nlRtxAG2FQ3B2OR6QIrPY3zE5LqJy1oxzmgBGsHLWTcNhWXKchgA0WHW+mZkQrng/pgcCew==}
+ engines: {node: '>=18.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-CCQBwJIvXMLKxVbO88IukazJD9a4kQ9ZN7/UMGBjBcJYvatpWk+9g870El4cB8/EJxfe+k+y0GmR9CAzkF+Nbw==}
+ engines: {node: '>=18.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==}
+ engines: {node: '>=14.0.0'}
+
+ '@smithy/[email protected]':
+ resolution: {integrity: sha512-zBPfuzoI8xyBtR2P6WQj63Rz8i3AmfAaJLuNG8dWsfvPe8lO4aCPYLn879mEgHndZH1zQ2oXmG8O1GGzzaoZiw==}
+ engines: {node: '>=18.0.0'}
+
'@standard-schema/[email protected]':
resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==}
@@ -788,6 +897,10 @@ packages:
resolution: {integrity: sha512-SIV3/6eftCy1bNzCQoPmbWsRLujS8t5iDIZ4spZOBHqrM+yfX2ogg8Tt3PDTAVKw3sSCiUgg30uOAvK2r9zGjQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ '@vercel/[email protected]':
+ resolution: {integrity: sha512-fnYhv671l+eTTp48gB4zEsTW/YtRgRPnkI2nT7x6qw5rkI1Lq2hTmQIpHPgyThI0znLK+vX2n9XxKdXZ7BUbbw==}
+ engines: {node: '>= 20'}
+
'@vitest/[email protected]':
resolution: {integrity: sha512-RHk63V3zvRiYOWAV0rGEBRO820ce17hz7cI2kDmEdfQsBjT2luEKB5tCOc91u1oSQoUOZkSv3ZyzkdkSLD7lKw==}
@@ -831,6 +944,12 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
+ resolution: {integrity: sha512-MZOkL9++nY5PfkpWKBR3Rv+Oygxpb9S16ctv8h91GvrSif7UnNEdPMVZe3bUyMd2djxf0AtBk/csBixP0WwWZQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4.1.8
+
resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==}
peerDependencies:
@@ -874,6 +993,9 @@ packages:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-/djoAN709iY65ETD6LKCtyyEI04XIBP5xVvfmNxsEP0uJB5tyaGBztSryRr4HqMStr9R06PisQE7m9zDTXKu6g==}
+
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
@@ -1380,6 +1502,9 @@ packages:
resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
+ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
+
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
@@ -1840,6 +1965,9 @@ packages:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
+ resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
+
resolution: {integrity: sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==}
engines: {node: '>=18'}
@@ -2009,6 +2137,57 @@ packages:
snapshots:
+ dependencies:
+ '@ai-sdk/anthropic': 2.0.50([email protected])
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.18([email protected])
+ '@smithy/eventstream-codec': 4.2.5
+ '@smithy/util-utf8': 4.2.0
+ aws4fetch: 1.0.20
+ zod: 3.25.76
+
+ dependencies:
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.18([email protected])
+ zod: 3.25.76
+
+ dependencies:
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.18([email protected])
+ '@vercel/oidc': 3.0.5
+ zod: 3.25.76
+
+ dependencies:
+ '@ai-sdk/provider': 2.0.0
+ '@standard-schema/spec': 1.0.0
+ eventsource-parser: 3.0.6
+ zod: 3.25.76
+
+ '@ai-sdk/[email protected]':
+ dependencies:
+ json-schema: 0.4.0
+
+ '@aws-crypto/[email protected]':
+ dependencies:
+ '@aws-crypto/util': 5.2.0
+ '@aws-sdk/types': 3.936.0
+ tslib: 2.8.1
+
+ '@aws-crypto/[email protected]':
+ dependencies:
+ '@aws-sdk/types': 3.936.0
+ '@smithy/util-utf8': 2.3.0
+ tslib: 2.8.1
+
+ '@aws-sdk/[email protected]':
+ dependencies:
+ '@smithy/types': 4.9.0
+ tslib: 2.8.1
+
'@babel/[email protected]': {}
'@changesets/[email protected]':
@@ -2435,6 +2614,8 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.19.1
+ '@opentelemetry/[email protected]': {}
+
'@pkgr/[email protected]': {}
'@rollup/[email protected]':
@@ -2503,6 +2684,49 @@ snapshots:
'@rollup/[email protected]':
optional: true
+ '@smithy/[email protected]':
+ dependencies:
+ '@aws-crypto/crc32': 5.2.0
+ '@smithy/types': 4.9.0
+ '@smithy/util-hex-encoding': 4.2.0
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ '@smithy/is-array-buffer': 2.2.0
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ '@smithy/is-array-buffer': 4.2.0
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ '@smithy/util-buffer-from': 2.2.0
+ tslib: 2.8.1
+
+ '@smithy/[email protected]':
+ dependencies:
+ '@smithy/util-buffer-from': 4.2.0
+ tslib: 2.8.1
+
'@standard-schema/[email protected]': {}
@@ -2660,6 +2884,8 @@ snapshots:
'@typescript-eslint/types': 8.47.0
eslint-visitor-keys: 4.2.1
+ '@vercel/[email protected]': {}
+
'@vitest/[email protected]':
dependencies:
'@standard-schema/spec': 1.0.0
@@ -2710,6 +2936,14 @@ snapshots:
+ dependencies:
+ '@ai-sdk/gateway': 2.0.17([email protected])
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.18([email protected])
+ '@opentelemetry/api': 1.9.0
+ zod: 3.25.76
+
optionalDependencies:
ajv: 8.17.1
@@ -2748,6 +2982,8 @@ snapshots:
+
@@ -3296,6 +3532,8 @@ snapshots:
+
@@ -3724,6 +3962,8 @@ snapshots:
+
dependencies:
bundle-require: 5.1.0([email protected])
@@ -3803,7 +4043,7 @@ snapshots:
'@types/node': 22.19.1
fsevents: 2.3.3
dependencies:
'@vitest/expect': 4.0.14
'@vitest/mocker': 4.0.14([email protected](@types/[email protected]))
@@ -3826,6 +4066,7 @@ snapshots:
vite: 7.2.4(@types/[email protected])
why-is-node-running: 2.3.0
optionalDependencies:
+ '@opentelemetry/api': 1.9.0
'@types/node': 22.19.1
transitivePeerDependencies:
- jiti