Commit Graph

2086 Commits

Author SHA1 Message Date
can1357 978b93ba62 refactor: migrated native tools to WASM-based implementation
- Consolidated grep, find, and image processing into a new `@oh-my-pi/pi-natives` WASM package.
- Eliminated subprocess overhead and simplified JS tool implementations.
- Updated CI to include Rust workspace, linting, formatting, and WASM build steps.
- Documented `Promise.withResolvers()` and `using` declarations for wasm-bindgen.
2026-01-29 09:29:21 +01:00
can1357 44b64e99d4 feat(coding-agent/session): enhanced session compaction with dynamic token ratio adjustment and improved summary preservation
- Added calculatePromptTokens() export to compute prompt-specific token counts from usage data.
- Added estimateEntriesTokens() helper to calculate total tokens across a range of session entries.
- Enhanced prepareCompaction() to dynamically adjust keepRecentTokens based on prompt-to-estimated token ratio for better context preservation.
- Improved compact() summary generation logic to preserve previous summaries when no new messages exist and handle edge cases with explicit fallback.
2026-01-29 00:22:55 +01:00
can1357 d9de0f02d8 refactor(event-stream): restructured event stream batching logic into base class to reduce test mock duplication
- Extracted delta event batching and throttling logic into AssistantMessageEventStream base class to eliminate duplication across test mocks.
- Changed access modifiers from private to protected in EventStream class to allow subclass customization of queue, waiting, and completion handling.
- Simplified MockAssistantStream implementations across five test files by removing custom event handling logic and delegating to AssistantMessageEventStream.
- Added protected methods deliver() and endWaiting() to EventStream to support subclass event delivery patterns.
- Implemented delta event type guard and merging utilities to consolidate event batching logic in one place.
2026-01-29 00:22:34 +01:00
can1357 6260ad6216 refactor(pi-utils): simplified ptree API and consolidated spawn variants into single function
- Simplified ptree API by removing spawnGroup and spawnAttached variants, consolidating into single spawn function.
- Replaced AsyncQueue class with simpler pushStream utility function for stream management.
- Refactored ChildProcess class to use AbortController instead of callback-based signal handling.
- Renamed captureText method to wait and execText function to exec for clearer API semantics.
- Removed mode parameter from exec function, eliminating distinction between spawn modes.
- Updated all call sites across coding-agent to use simplified ptree API.
2026-01-28 23:49:15 +01:00
can1357 e8f63f4502 refactor(pi-utils): replaced AbortController-based stream stopping with Promise.withResolvers
- Replaced AbortController-based stream stopping with Promise.withResolvers pattern for simpler control flow.
- Converted #streamStop field from AbortController to #requestStreamStop callback function.
- Removed #requestStreamStop method and inlined its logic into constructor for direct callback assignment.
2026-01-28 22:29:17 +01:00
can1357 669530fc41 chore: bump version to 8.12.3 2026-01-28 22:27:15 +01:00
can1357 6db649c9ed feat(coding-agent): added configurable ask timeout/notifications and centralized process execution
- Added configurable ask timeout and notification settings to control ask tool behavior and user notifications.
- Added AskSettings interface with timeout (in seconds, default 30) and notification method properties to settings manager.
- Added ask timeout and notification configuration options to settings UI with values for timeout (off, 15, 30, 60, 120 seconds) and notification methods (auto, bell, osc99, osc9, off).
- Refactored process execution across multiple tools (exec, fetch, grep, read, youtube scraper) to use centralized ptree.execText() API instead of custom implementations.
- Refactored ChildProcess class in ptree to use public readonly properties and Promise.withResolvers() for cleaner exit handling.
2026-01-28 22:27:07 +01:00
can1357 c22a1025ef refactor(pi-utils): migrated process spawning from cspawn to spawnGroup/spawnAttached with async resource management
- Migrated process spawning from `cspawn` to `spawnGroup` and `spawnAttached` APIs with explicit resource management using TypeScript's `using` statement.
- Refactored `ChildProcess` class to support process group management with new `isProcessGroup` getter and `[Symbol.dispose]()` method for automatic cleanup.
- Removed `cspawn` from public API exports in pi-utils, replacing it with `spawnGroup` and `spawnAttached` functions.
- Simplified `ChildProcess.kill()` method signature by removing signal parameter and eliminated `killAndWait()` method in favor of async disposable pattern.
- Converted `killChild` function to async implementation using Bun's `$` template and sleep-based polling for process termination.
2026-01-28 21:12:28 +01:00
can1357 38f0628496 chore: bump version to 8.12.2 2026-01-28 17:18:23 +01:00
can1357 4d66372720 feat(coding-agent): replaced ripgrep with glob-based file discovery and added outline UI components
- Added outline option to dialog and select UI components for rendering outlined lists in extension dialogs and ask tool.
- Replaced ripgrep-based file listing with fs.glob for project scans in system-prompt, find, and read tools.
- Added timeout tracking to ask tool multi-select flow to prevent hanging on selection operations.
- Created new OutlinedList component in hook-selector for rendering bordered list containers.
- Implemented globPaths utility function in pi-utils for glob-based file discovery with gitignore support.
2026-01-28 17:15:24 +01:00
can1357 0d3bef3f1c refactor(coding-agent/modes): restructured hook selector and input overlay management to use TUI overlay API
- Refactored hook selector and input overlay management to use TUI overlay API instead of manual container manipulation.
- Extracted dialog overlay options into a reusable constant with consistent styling (bottom-center anchor, 80% width, 70% max height).
- Added overlay handle tracking to properly manage overlay lifecycle and prevent duplicate overlays.
2026-01-28 17:09:11 +01:00
can1357 0cb4a7402b refactor(coding-agent): restructured timeout handling and improved resource disposal across tools
- Refactored runRg function signature to accept an options object with signal and timeoutMs properties instead of a direct signal parameter.
- Enhanced timeout error handling in grep.ts to catch ptree.TimeoutError exceptions and throw descriptive ToolError messages.
- Added proper resource disposal calls in extension-ui-controller.ts to dispose of hook selector and hook input before clearing editor containers.
- Simplified timeout handling by moving from AbortSignal-based approach to direct timeoutMs parameter in options object across system-prompt.ts, find.ts, and read.ts.
2026-01-28 16:59:41 +01:00
can1357 306f380d0f chore: bump version to 8.12.1 2026-01-28 15:46:28 +01:00
can1357 660262da47 refactor(coding-agent): restructured project tree scanning with ripgrep and fallback implementations
- Restructured project tree scanning to separate ripgrep-based and fallback implementations.
- Removed XML escaping function and changed tree output format from XML to plain text with visual indicators.
- Improved directory traversal to build complete directory contents map before rendering.
- Simplified tree rendering logic by removing XML tag generation and using text-based formatting.
2026-01-28 15:46:03 +01:00
can1357 0c5be1d660 fix(coding-agent): removed incorrect timeout unit conversion logic in cursor, fetch, gemini-image, and ssh tools
- Removed incorrect millisecond-to-second auto-conversion logic in timeout handling across cursor, fetch, gemini-image, and ssh tools.
- Fixed timeout parameter interpretation to respect user-provided values without automatic unit conversion heuristics.
2026-01-28 15:42:38 +01:00
can1357 dff3bf3d56 feat(coding-agent): added gitignore-aware project tree scanning with ripgrep integration
- Added gitignore-aware project tree scanning using ripgrep to respect .gitignore rules when discovering project structure.
- Implemented getGitignoreAllowedPaths() function to retrieve allowed files and directories based on gitignore rules with 5-second timeout.
- Enhanced scanProjectTree() to filter entries against gitignore-allowed paths while gracefully falling back to static filtering if ripgrep is unavailable.
2026-01-28 15:41:34 +01:00
can1357 3ffd817b61 chore: bump version to 8.12.0 2026-01-28 15:37:57 +01:00
can1357 85705a1e23 docs(coding-agent/prompts): restructured system prompt templates for improved clarity and consistency
- Restructured system prompt templates for improved clarity and consistency.
- Simplified XML tag structure in custom and system prompts by removing redundant wrapper elements and consolidating metadata.
- Updated skill and rule references to use inline path notation (e.g., `skill://<name>`, `rule://<name>`) instead of separate location tags.
- Improved prompt readability by reorganizing sections with clearer headers and more concise instructional text.
2026-01-28 15:36:19 +01:00
can1357 1583812610 feat(coding-agent): added project tree visualization to system prompts with configurable depth and entry limits
- Added project tree visualization to system prompts with configurable depth and entry limits.
- Implemented scanProjectTree function to recursively scan directory structure with intelligent truncation and sorting by modification time.
- Added renderProjectTree function to format scanned directory structure as XML with path collapsing for single-child directories.
- Integrated projectTree snapshot into both custom and main system prompt templates with conditional rendering.
- Added XML escaping utility to safely render file paths and names in prompt context.
2026-01-28 15:28:15 +01:00
can1357 7833b94532 feat(coding-agent/modes): added reset() method to CountdownTimer and integrated into HookSelectorComponent
- Added reset() method to CountdownTimer class to allow resetting countdown to initial value.
- Added initialMs field to CountdownTimer to track original timeout duration.
- Integrated countdown reset into HookSelectorComponent to reset timer on user interaction.
2026-01-28 15:22:07 +01:00
can1357 defdfd664f feat(ai/usage): integrated profile endpoint to resolve user emails with 24-hour caching
- Added profile endpoint integration to resolve user email addresses when not available in usage payload.
- Implemented profile caching with 24-hour TTL to reduce redundant API calls for email resolution.
- Added fetchProfile function to retrieve Claude account profile information from the API.
- Added buildProfileCacheKey function to generate cache keys based on provider, token fingerprint, and base URL.
- Added resolveEmail function to handle email resolution with fallback to profile API and caching.
2026-01-28 14:32:28 +01:00
can1357 7e58a02053 feat(ai/usage): added automatic token refresh for expired Kimi OAuth credentials
- Added automatic token refresh for expired Kimi OAuth credentials in usage provider.
- Imported refreshKimiToken function to enable token refresh capability.
- Enhanced error handling with validation for refresh token availability and try-catch block for refresh failures.
2026-01-28 14:29:17 +01:00
can1357 41c852cbc8 chore: bump version to 8.11.14 2026-01-28 14:22:04 +01:00
can1357 7b510ee6e7 feat(coding-agent): added skill message component and custom message support to AgentSession
- Added SkillMessageComponent to render /skill command messages as compact skill entries with expandable/collapsible UI showing skill metadata and optional full prompt content.
- Added promptCustomMessage() public method to AgentSession to support custom message types with metadata and details properties.
- Added SKILL_PROMPT_MESSAGE_TYPE constant and SkillPromptDetails interface to support skill-specific message handling.
- Enhanced patch tool documentation with guidance on structured block editing, error recovery, and best practices for maintaining code integrity.
- Refactored message handling in AgentSession by extracting _promptWithMessage() private method to consolidate common logic between prompt() and promptCustomMessage().
2026-01-28 14:22:01 +01:00
can1357 bcdcccf100 feat(coding-agent/config): added model preference matching system for intelligent model selection
- Added model preference matching system with ModelMatchPreferences and ModelPreferenceContext interfaces to enable intelligent model selection based on usage history and provider preferences.
- Implemented buildPreferenceContext and pickPreferredModel functions to rank and select models based on usage order, provider history, and deprioritization settings.
- Enhanced parseModelPattern function to accept optional ModelMatchPreferences parameter, enabling model resolution to consider user preferences and usage history.
- Updated model matching logic to prioritize models based on historical usage patterns and provider preferences when multiple candidates match a pattern.
2026-01-28 14:15:48 +01:00
can1357 b260dbb635 feat(coding-agent/prompts): added designer agent with UI/UX review and accessibility audit capabilities
- Added designer agent prompt with UI/UX specialist role, design review capabilities, and accessibility audit directives.
- Registered designer agent in embedded agent definitions with gemini-3-pro model support.
- Removed deep_task agent definition from embedded agents list.
2026-01-28 14:13:18 +01:00
can1357 8c007bfb95 chore: bump version to 8.10.13 2026-01-28 14:02:13 +01:00
can1357 fd06c41117 refactor(coding-agent/extensibility): restructured wrapper classes to use dynamic getters and safer property access
- Converted wrapper class properties to dynamic getters that delegate to underlying tool objects.
- Added optional chaining operators for safer null/undefined access in JSON schema property handling.
- Changed output metadata wrapper to use Object.create() with property descriptors instead of object spread syntax.
2026-01-28 14:02:00 +01:00
can1357 df00e12be8 chore: bump version to 8.10.12 2026-01-28 13:51:40 +01:00
can1357 811669def7 feat(coding-agent): added model-specific edit variant configuration for patch/replace modes
- Added model-specific edit variant configuration allowing users to specify 'patch' or 'replace' mode per model pattern.
- Added `getEditVariantForModel()` method to determine appropriate edit mode based on user settings and default patterns.
- Made EditTool's `patchMode`, `description`, and `parameters` dynamic properties that adapt based on the active model.
- Added fallback mechanism in model resolution to support tool creation before agent initialization.
2026-01-28 13:51:21 +01:00
can1357 505a40e71e feat(coding-agent/cli): added automatic browser opening when stats dashboard starts
- Added automatic browser opening when stats dashboard starts.
2026-01-28 13:39:53 +01:00
can1357 5f46437f70 feat(stats/client): added model statistics table and TTFT/throughput metrics to stats dashboard
- Added ModelStatsTable component to display model statistics with columns for model, provider, requests, cost, tokens, throughput, and error rate.
- Added 'models' tab to stats dashboard for viewing aggregated model performance metrics.
- Added TTFT (Time to First Token) metric display in request details and overview statistics.
- Added Tokens/s (throughput) metric calculation and display in request list and model statistics.
- Improved code formatting and accessibility by adding semantic HTML attributes (type='button', role, aria-modal) and reformatting style objects for readability.
- Refactored loadData function to use useCallback hook for better performance optimization.
2026-01-28 13:35:46 +01:00
can1357 e94514e4f2 build(deps): updated dependencies across packages including protoc-gen-es, typebox, and other libraries
- Updated @bufbuild/protoc-gen-es from ^2.10.2 to ^2.11.0.
- Updated @types/bun from ^1.2.18 to ^1.3.7.
- Updated prettier from ^3.8.0 to ^3.8.1.
- Updated @sinclair/typebox from ^0.34.46 to ^0.34.48 across multiple packages.
- Updated @bufbuild/protobuf from ^2.10.2 to ^2.11.0 in packages/ai.
- Updated multiple dependencies including chalk, diff, file-type, zod, winston, recharts, and mime-types to their latest patch and minor versions.
2026-01-28 13:27:58 +01:00
can1357 c5315bb7e1 feat(coding-agent/tools): improved artifact allocation for truncated fetch responses to preserve full content
- Added artifact allocation for truncated fetch responses to preserve full content in output artifacts.
- Integrated truncateHead utility to apply consistent truncation limits (DEFAULT_MAX_BYTES and DEFAULT_MAX_LINES) to fetch tool output.
- Refactored output formatting into buildOutput helper function to support both truncated and full content rendering.
2026-01-28 13:22:45 +01:00
can1357 a91330bae0 feat(ai): added Kimi Code provider integration with OAuth and token management
- Added Kimi Code provider integration with OAuth device authorization flow and token management.
- Added four new Kimi Code models (kimi-for-coding, kimi-k2, kimi-k2-turbo-preview, kimi-k2.5) with reasoning support and 262K context window.
- Added kimiUsageProvider for fetching and caching Kimi Code API usage quota information.
- Added kimi-code login command to CLI for OAuth authentication with Kimi Code.
- Updated openai-completions provider to support Kimi-specific headers and cached token formats.
- Updated MiniMax-M2 model pricing: input 1.2->0.6, output 1.2->3, cacheRead 0.6->0.1.
2026-01-28 13:22:19 +01:00
can1357 34569030c6 refactor(coding-agent): migrated import paths to relative imports and consolidated tool imports
- Migrated import paths from absolute package imports to relative imports throughout coding-agent modules.
- Consolidated related imports in tools/index.ts to reduce import statement count.
- Removed guideline about avoiding relative parent imports from AGENTS.md documentation.
- Reformatted code examples in AGENTS.md for improved readability with multi-line formatting.
2026-01-28 12:59:49 +01:00
can1357 88c46b9c88 feat(coding-agent/modes): added timeout support to hook selector with auto-selection on timeout
- Added timeout support to hook selector with auto-selection behavior on timeout.
- Extended ExtensionUIDialogOptions to include timeout and tui configuration properties.
- Changed hook selector timeout behavior from cancellation to auto-selecting the currently highlighted option.
- Updated UIContext.select() method signature to accept timeout option for automated selection scenarios.
2026-01-28 12:59:25 +01:00
can1357 0471a3fde7 chore: bump version to 8.10.11 2026-01-28 11:29:22 +01:00
can1357 12277cf982 refactor(coding-agent/task): simplified import path for subagent system prompt template to relative
- Simplified import path for subagent system prompt template from absolute to relative path.
2026-01-28 11:29:13 +01:00
can1357 59a3fdb1d1 build(deps): updated minimum Bun runtime requirement to >=1.3.7 across all packages
- Updated minimum Bun runtime requirement from >=1.0.0 to >=1.3.7 across all packages.
2026-01-28 04:12:18 +01:00
can1357 925491b79f chore: bump version to 8.9.10 2026-01-28 04:10:43 +01:00
can1357 ec463fe7c7 chore(scripts): updated Bun engine requirement to 1.3.7 and added version validation
- Updated minimum Bun engine requirement from 1.2.0 to 1.3.7 across root and coding-agent packages.
- Added Bun version validation to install.ps1 with Get-BunVersion, Test-BunVersion, and Assert-BunVersion functions to enforce minimum version requirement.
- Added Bun version validation to install.sh with version_ge and require_bun_version functions to enforce minimum version requirement.
2026-01-28 04:10:00 +01:00
can1357 1257dd8fac chore: bump version to 8.8.8 2026-01-28 04:01:10 +01:00
can1357 899f201f2d refactor(coding-agent): renamed output parameter to schema and restructured task metadata format
- Renamed 'output' parameter to 'schema' throughout task configuration and documentation for clarity.
- Updated task schema definition to use 'schema' field with improved description clarifying it defines expected response structure.
- Restructured task summary output format to consolidate metadata into tag attributes and simplify XML structure.
- Added truncation detection for task output exceeding 5000 character threshold with truncated flag.
- Removed charCount from task metadata, retaining only lineCount and charSize properties.
2026-01-28 04:00:32 +01:00
can1357 eb3ca1ddd2 refactor(coding-agent): restructured prompt rendering and tool utilities into dedicated modules
- Extracted tool choice mapping logic into dedicated utility module for provider-specific format conversions.
- Refactored task summary generation to use template-based rendering instead of string concatenation.
- Migrated system prompt generation to use Handlebars templates with structured data instead of hardcoded strings.
- Extracted JTD to TypeScript conversion logic into dedicated utility module for schema documentation.
- Consolidated prompt template rendering across multiple modules using unified renderPromptTemplate function.
- Simplified type assertions in stream module to use generic OptionsForApi type instead of provider-specific types.
2026-01-28 03:47:16 +01:00
can1357 a4bfb5795c refactor(coding-agent): renamed 'complete' tool to 'submit_result' for clarity and consistency
- Renamed 'complete' tool to 'submit_result' throughout codebase for clarity and consistency.
- Updated all tool references, function names, and variable names from 'complete' to 'submit_result' in executor, render, and tools modules.
- Renamed CompleteTool class to SubmitResultTool and CompleteDetails interface to SubmitResultDetails.
- Updated agent prompts and documentation to reference the new 'submit_result' tool name.
- Reorganized task.md prompt to move critical guidance to the top and restructure instructions for better clarity.
2026-01-28 03:28:03 +01:00
can1357 70a2c30177 feat(coding-agent): added tools list to system prompt and improved output preview logic
- Added available tools list to system prompt for agent coherence.
- Improved output preview logic to show full output for smaller results and truncate larger outputs to 10 lines.
2026-01-28 03:17:18 +01:00
can1357 9b90dabaa9 feat(coding-agent): added session compaction enhancements with auto-continue, tool pruning, and remote endpoint support
- Added session compaction auto-continue feature that automatically sends a synthetic continuation prompt after compaction completes when enabled in settings.
- Added tool output pruning system that intelligently removes verbose tool outputs from session history during compaction to reduce token usage while preserving critical information.
- Added short summary generation for compaction results, providing concise PR-style summaries of conversation changes alongside full summaries.
- Added session.compacting extension hook that allows extensions to customize compaction prompts, add context, and preserve metadata during summarization.
- Added synthetic message support to mark system-injected messages (like auto-continue prompts) and prevent them from being persisted to editor history.
2026-01-28 03:15:28 +01:00
can1357 cc91f80e99 feat: added toolChoice support and optimized TUI
- Added ToolChoice type and toolChoice parameter support across all AI providers (OpenAI, Azure OpenAI, Anthropic, Google) enabling fine-grained control over tool/function selection during LLM calls.
- Added toolChoice override capability to Agent.prompt() method and session prompt options allowing callers to control tool selection behavior per request.
- Added provider-specific tool choice mapping functions (mapAnthropicToolChoice, mapGoogleToolChoice, mapOpenAiToolChoice) to normalize tool choice formats across different LLM APIs.
- Removed kernel heartbeat/ping mechanism from PythonKernel, simplifying health monitoring by relying on direct isAlive() checks instead of periodic HTTP requests.
2026-01-28 02:53:58 +01:00
can1357 6b96418f87 feat(coding-agent/task): added detection and rendering of missing complete tool warning in agent output
- Added detection and rendering of missing complete tool warning in agent output.
- Introduced extractMissingCompleteWarning function to parse and separate warning messages from agent output.
- Enhanced renderOutputSection to display warning indicators alongside output content.
- Updated agent result rendering to show warning status icon when subagent exits without calling complete tool.
2026-01-28 02:00:38 +01:00