feat: add tool approval and timeout settings

- Introduced ToolApprovalConfig and related types for managing tool execution approvals.
- Implemented WebFetch and ZxScript tools for fetching web content and executing scripts, respectively.
- Added token estimation utilities for context window management.
- Enhanced ModelInfo interface with context window size and max output tokens.
- Created API Retry Utility for handling transient failures with exponential backoff.
- Updated AIAgent preferences section to include Tool Approval & Timeout Settings dialog.
- Developed ToolApprovalSettingsDialog for configuring tool-specific approval rules and retry settings.
- Modified vitest configuration to support aliasing for easier imports and stubbing.
This commit is contained in:
linonetwo 2026-02-26 03:35:19 +08:00
parent 4255e7d4ec
commit 807311ef2e
44 changed files with 4190 additions and 151 deletions

View file

@ -147,6 +147,10 @@ export interface ModelInfo {
features?: ModelFeature[];
/** Model-specific parameters (e.g., ComfyUI workflow path) */
parameters?: Record<string, unknown>;
/** Input context window size in tokens (e.g. 128000 for GPT-4o, 200000 for Claude) */
contextWindowSize?: number;
/** Max output tokens (e.g. 4096, 16384) */
maxOutputTokens?: number;
/** Additional metadata */
metadata?: Record<string, unknown>;
}