From e7a5ca144c772756de9eb866d294c6b66a79250c Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 21 Nov 2025 05:09:58 +0100 Subject: [PATCH] Release v0.8.4 --- package-lock.json | 30 ++--- packages/agent/package.json | 6 +- packages/ai/package.json | 2 +- packages/ai/src/models.generated.ts | 148 ++++++++++++------------ packages/coding-agent/CHANGELOG.md | 6 + packages/coding-agent/package.json | 8 +- packages/coding-agent/src/tools/read.ts | 88 ++++++-------- packages/pods/package.json | 4 +- packages/proxy/package.json | 2 +- packages/tui/package.json | 2 +- packages/web-ui/package.json | 6 +- 11 files changed, 145 insertions(+), 157 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc7d5eab..118427fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3847,11 +3847,11 @@ }, "packages/agent": { "name": "@mariozechner/pi-agent", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { - "@mariozechner/pi-ai": "^0.8.2", - "@mariozechner/pi-tui": "^0.8.2" + "@mariozechner/pi-ai": "^0.8.3", + "@mariozechner/pi-tui": "^0.8.3" }, "devDependencies": { "@types/node": "^24.3.0", @@ -3881,7 +3881,7 @@ }, "packages/ai": { "name": "@mariozechner/pi-ai", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.61.0", @@ -3922,12 +3922,12 @@ }, "packages/coding-agent": { "name": "@mariozechner/pi-coding-agent", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { - "@mariozechner/pi-agent": "^0.8.2", - "@mariozechner/pi-ai": "^0.8.2", - "@mariozechner/pi-tui": "^0.8.2", + "@mariozechner/pi-agent": "^0.8.3", + "@mariozechner/pi-ai": "^0.8.3", + "@mariozechner/pi-tui": "^0.8.3", "chalk": "^5.5.0", "diff": "^8.0.2", "glob": "^11.0.3" @@ -3964,10 +3964,10 @@ }, "packages/pods": { "name": "@mariozechner/pi", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { - "@mariozechner/pi-agent": "^0.8.2", + "@mariozechner/pi-agent": "^0.8.3", "chalk": "^5.5.0" }, "bin": { @@ -3980,7 +3980,7 @@ }, "packages/proxy": { "name": "@mariozechner/pi-proxy", - "version": "0.8.3", + "version": "0.8.4", "dependencies": { "@hono/node-server": "^1.14.0", "hono": "^4.6.16" @@ -3996,7 +3996,7 @@ }, "packages/tui": { "name": "@mariozechner/pi-tui", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { "@types/mime-types": "^2.1.4", @@ -4031,12 +4031,12 @@ }, "packages/web-ui": { "name": "@mariozechner/pi-web-ui", - "version": "0.8.3", + "version": "0.8.4", "license": "MIT", "dependencies": { "@lmstudio/sdk": "^1.5.0", - "@mariozechner/pi-ai": "^0.8.2", - "@mariozechner/pi-tui": "^0.8.2", + "@mariozechner/pi-ai": "^0.8.3", + "@mariozechner/pi-tui": "^0.8.3", "docx-preview": "^0.3.7", "jszip": "^3.10.1", "lucide": "^0.544.0", diff --git a/packages/agent/package.json b/packages/agent/package.json index 51bbd64b..763f5c27 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-agent", - "version": "0.8.3", + "version": "0.8.4", "description": "General-purpose agent with transport abstraction, state management, and attachment support", "type": "module", "main": "./dist/index.js", @@ -18,8 +18,8 @@ "prepublishOnly": "npm run clean && npm run build" }, "dependencies": { - "@mariozechner/pi-ai": "^0.8.3", - "@mariozechner/pi-tui": "^0.8.3" + "@mariozechner/pi-ai": "^0.8.4", + "@mariozechner/pi-tui": "^0.8.4" }, "keywords": [ "ai", diff --git a/packages/ai/package.json b/packages/ai/package.json index 9a29a74c..2b408903 100644 --- a/packages/ai/package.json +++ b/packages/ai/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-ai", - "version": "0.8.3", + "version": "0.8.4", "description": "Unified LLM API with automatic model discovery and provider configuration", "type": "module", "main": "./dist/index.js", diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.ts index a49853b0..b63a48af 100644 --- a/packages/ai/src/models.generated.ts +++ b/packages/ai/src/models.generated.ts @@ -5102,23 +5102,6 @@ export const MODELS = { contextWindow: 131072, maxTokens: 16384, } satisfies Model<"openai-completions">, - "meta-llama/llama-3.1-70b-instruct": { - id: "meta-llama/llama-3.1-70b-instruct", - name: "Meta: Llama 3.1 70B Instruct", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 0.39999999999999997, - output: 0.39999999999999997, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 131072, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "meta-llama/llama-3.1-405b-instruct": { id: "meta-llama/llama-3.1-405b-instruct", name: "Meta: Llama 3.1 405B Instruct", @@ -5136,6 +5119,23 @@ export const MODELS = { contextWindow: 130815, maxTokens: 4096, } satisfies Model<"openai-completions">, + "meta-llama/llama-3.1-70b-instruct": { + id: "meta-llama/llama-3.1-70b-instruct", + name: "Meta: Llama 3.1 70B Instruct", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 0.39999999999999997, + output: 0.39999999999999997, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 131072, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "mistralai/mistral-nemo": { id: "mistralai/mistral-nemo", name: "Mistral: Mistral Nemo", @@ -5153,9 +5153,9 @@ export const MODELS = { contextWindow: 131072, maxTokens: 16384, } satisfies Model<"openai-completions">, - "openai/gpt-4o-mini": { - id: "openai/gpt-4o-mini", - name: "OpenAI: GPT-4o-mini", + "openai/gpt-4o-mini-2024-07-18": { + id: "openai/gpt-4o-mini-2024-07-18", + name: "OpenAI: GPT-4o-mini (2024-07-18)", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -5170,9 +5170,9 @@ export const MODELS = { contextWindow: 128000, maxTokens: 16384, } satisfies Model<"openai-completions">, - "openai/gpt-4o-mini-2024-07-18": { - id: "openai/gpt-4o-mini-2024-07-18", - name: "OpenAI: GPT-4o-mini (2024-07-18)", + "openai/gpt-4o-mini": { + id: "openai/gpt-4o-mini", + name: "OpenAI: GPT-4o-mini", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -5272,6 +5272,23 @@ export const MODELS = { contextWindow: 128000, maxTokens: 4096, } satisfies Model<"openai-completions">, + "openai/gpt-4o-2024-05-13": { + id: "openai/gpt-4o-2024-05-13", + name: "OpenAI: GPT-4o (2024-05-13)", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text", "image"], + cost: { + input: 5, + output: 15, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 128000, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "openai/gpt-4o": { id: "openai/gpt-4o", name: "OpenAI: GPT-4o", @@ -5306,23 +5323,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 64000, } satisfies Model<"openai-completions">, - "openai/gpt-4o-2024-05-13": { - id: "openai/gpt-4o-2024-05-13", - name: "OpenAI: GPT-4o (2024-05-13)", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text", "image"], - cost: { - input: 5, - output: 15, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 128000, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "meta-llama/llama-3-70b-instruct": { id: "meta-llama/llama-3-70b-instruct", name: "Meta: Llama 3 70B Instruct", @@ -5442,23 +5442,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 4096, } satisfies Model<"openai-completions">, - "openai/gpt-4-turbo-preview": { - id: "openai/gpt-4-turbo-preview", - name: "OpenAI: GPT-4 Turbo Preview", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 10, - output: 30, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 128000, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "openai/gpt-3.5-turbo-0613": { id: "openai/gpt-3.5-turbo-0613", name: "OpenAI: GPT-3.5 Turbo (older v0613)", @@ -5476,6 +5459,23 @@ export const MODELS = { contextWindow: 4095, maxTokens: 4096, } satisfies Model<"openai-completions">, + "openai/gpt-4-turbo-preview": { + id: "openai/gpt-4-turbo-preview", + name: "OpenAI: GPT-4 Turbo Preview", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 10, + output: 30, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 128000, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "mistralai/mistral-small": { id: "mistralai/mistral-small", name: "Mistral Small", @@ -5578,23 +5578,6 @@ export const MODELS = { contextWindow: 8191, maxTokens: 4096, } satisfies Model<"openai-completions">, - "openai/gpt-3.5-turbo": { - id: "openai/gpt-3.5-turbo", - name: "OpenAI: GPT-3.5 Turbo", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 0.5, - output: 1.5, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 16385, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "openai/gpt-4": { id: "openai/gpt-4", name: "OpenAI: GPT-4", @@ -5612,6 +5595,23 @@ export const MODELS = { contextWindow: 8191, maxTokens: 4096, } satisfies Model<"openai-completions">, + "openai/gpt-3.5-turbo": { + id: "openai/gpt-3.5-turbo", + name: "OpenAI: GPT-3.5 Turbo", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 0.5, + output: 1.5, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 16385, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "openrouter/auto": { id: "openrouter/auto", name: "OpenRouter: Auto Router", diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 1dd01da0..b3c46c03 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased] +## [0.8.4] - 2025-11-21 + +### Fixed + +- **Read Tool Error Handling**: Fixed issue where the `read` tool would return errors as successful text content instead of throwing. Now properly throws errors for file not found and offset out of bounds conditions. + ## [0.8.3] - 2025-11-21 ### Improved diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 5243d7f7..f66214d9 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-coding-agent", - "version": "0.8.3", + "version": "0.8.4", "description": "Coding agent CLI with read, bash, edit, write tools and session management", "type": "module", "bin": { @@ -22,9 +22,9 @@ "prepublishOnly": "npm run clean && npm run build" }, "dependencies": { - "@mariozechner/pi-agent": "^0.8.3", - "@mariozechner/pi-ai": "^0.8.3", - "@mariozechner/pi-tui": "^0.8.3", + "@mariozechner/pi-agent": "^0.8.4", + "@mariozechner/pi-ai": "^0.8.4", + "@mariozechner/pi-tui": "^0.8.4", "chalk": "^5.5.0", "diff": "^8.0.2", "glob": "^11.0.3" diff --git a/packages/coding-agent/src/tools/read.ts b/packages/coding-agent/src/tools/read.ts index a70948a5..26128af0 100644 --- a/packages/coding-agent/src/tools/read.ts +++ b/packages/coding-agent/src/tools/read.ts @@ -83,18 +83,7 @@ export const readTool: AgentTool = { (async () => { try { // Check if file exists - try { - await access(absolutePath, constants.R_OK); - } catch { - if (signal) { - signal.removeEventListener("abort", onAbort); - } - resolve({ - content: [{ type: "text", text: `Error: File not found: ${path}` }], - details: undefined, - }); - return; - } + await access(absolutePath, constants.R_OK); // Check if aborted before reading if (aborted) { @@ -125,48 +114,41 @@ export const readTool: AgentTool = { // Check if offset is out of bounds if (startLine >= lines.length) { - content = [ - { - type: "text", - text: `Error: Offset ${offset} is beyond end of file (${lines.length} lines total)`, - }, - ]; - } else { - // Get the relevant lines - const selectedLines = lines.slice(startLine, endLine); - - // Truncate long lines and track which were truncated - let hadTruncatedLines = false; - const formattedLines = selectedLines.map((line) => { - if (line.length > MAX_LINE_LENGTH) { - hadTruncatedLines = true; - return line.slice(0, MAX_LINE_LENGTH); - } - return line; - }); - - let outputText = formattedLines.join("\n"); - - // Add notices - const notices: string[] = []; - - if (hadTruncatedLines) { - notices.push(`Some lines were truncated to ${MAX_LINE_LENGTH} characters for display`); - } - - if (endLine < lines.length) { - const remaining = lines.length - endLine; - notices.push( - `${remaining} more lines not shown. Use offset=${endLine + 1} to continue reading`, - ); - } - - if (notices.length > 0) { - outputText += `\n\n... (${notices.join(". ")})`; - } - - content = [{ type: "text", text: outputText }]; + throw new Error(`Offset ${offset} is beyond end of file (${lines.length} lines total)`); } + + // Get the relevant lines + const selectedLines = lines.slice(startLine, endLine); + + // Truncate long lines and track which were truncated + let hadTruncatedLines = false; + const formattedLines = selectedLines.map((line) => { + if (line.length > MAX_LINE_LENGTH) { + hadTruncatedLines = true; + return line.slice(0, MAX_LINE_LENGTH); + } + return line; + }); + + let outputText = formattedLines.join("\n"); + + // Add notices + const notices: string[] = []; + + if (hadTruncatedLines) { + notices.push(`Some lines were truncated to ${MAX_LINE_LENGTH} characters for display`); + } + + if (endLine < lines.length) { + const remaining = lines.length - endLine; + notices.push(`${remaining} more lines not shown. Use offset=${endLine + 1} to continue reading`); + } + + if (notices.length > 0) { + outputText += `\n\n... (${notices.join(". ")})`; + } + + content = [{ type: "text", text: outputText }]; } // Check if aborted after reading diff --git a/packages/pods/package.json b/packages/pods/package.json index cc4a6d57..dd15d3b9 100644 --- a/packages/pods/package.json +++ b/packages/pods/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi", - "version": "0.8.3", + "version": "0.8.4", "description": "CLI tool for managing vLLM deployments on GPU pods", "type": "module", "bin": { @@ -34,7 +34,7 @@ "node": ">=20.0.0" }, "dependencies": { - "@mariozechner/pi-agent": "^0.8.3", + "@mariozechner/pi-agent": "^0.8.4", "chalk": "^5.5.0" }, "devDependencies": {} diff --git a/packages/proxy/package.json b/packages/proxy/package.json index 6ce51de9..c8278d7f 100644 --- a/packages/proxy/package.json +++ b/packages/proxy/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-proxy", - "version": "0.8.3", + "version": "0.8.4", "type": "module", "description": "CORS and authentication proxy for pi-ai", "main": "dist/index.js", diff --git a/packages/tui/package.json b/packages/tui/package.json index 2659cde7..4fd93403 100644 --- a/packages/tui/package.json +++ b/packages/tui/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-tui", - "version": "0.8.3", + "version": "0.8.4", "description": "Terminal User Interface library with differential rendering for efficient text-based applications", "type": "module", "main": "dist/index.js", diff --git a/packages/web-ui/package.json b/packages/web-ui/package.json index 0026183b..53e562b0 100644 --- a/packages/web-ui/package.json +++ b/packages/web-ui/package.json @@ -1,6 +1,6 @@ { "name": "@mariozechner/pi-web-ui", - "version": "0.8.3", + "version": "0.8.4", "description": "Reusable web UI components for AI chat interfaces powered by @mariozechner/pi-ai", "type": "module", "main": "dist/index.js", @@ -18,8 +18,8 @@ }, "dependencies": { "@lmstudio/sdk": "^1.5.0", - "@mariozechner/pi-ai": "^0.8.3", - "@mariozechner/pi-tui": "^0.8.3", + "@mariozechner/pi-ai": "^0.8.4", + "@mariozechner/pi-tui": "^0.8.4", "docx-preview": "^0.3.7", "jszip": "^3.10.1", "lucide": "^0.544.0",