Commit Graph

42 Commits

Author SHA1 Message Date
can1357 7b5af2dd9f refactor(build): migrated imports to path aliases with per-package tsconfig support
- converted relative imports to path aliases ($c/*, $ai/*, $tui/*, etc.) across all packages
- added per-package tsconfig.json with complete path mappings for runtime resolution
- set importModuleSpecifier to non-relative for IDE auto-import preferences
- updated dev script to run from monorepo root for consistent path resolution
2026-01-23 11:56:32 +01:00
can1357 69c695cd53 refactor(coding-agent/core): simplified task artifact handling and file operations
- Removed bundled WorktreeCommand from custom commands loader.
- Simplified artifact handling from structured paths to direct file paths.
- Changed output file extension filter from .out.md to .md.
- Replaced fs operations with Bun.file() API for async file handling.
2026-01-21 04:40:48 +01:00
can1357 87c1de9fab fix(ai): corrected OAuth callback flows and hardened credential storage permissions
- Fixed OAuth callback flows for GitHub Copilot and Google Gemini to handle cancellation and manual input errors.
- Hardened database file permissions to 0o600 and directory creation to 0o700 to prevent credential leakage.
- Fixed cache invalidation for streaming edits and file existence checks for prompt templates.
- Fixed bash output streaming to prevent premature closure and LSP client request handling for aborted signals.
2026-01-21 01:44:31 +01:00
can1357 b2c94bef1a refactor(deps): restructured codebase to use centralized pi-utils package
- Created new @oh-my-pi/pi-utils workspace package with shared utilities for logging, process management, stream handling, and temporary directory management.
- Migrated all packages to use centralized logger from @oh-my-pi/pi-utils instead of local winston implementations.
- Replaced custom process spawning and stream reading implementations with standardized cspawn and readLines utilities across all modules.
- Converted synchronous file operations and process spawning to async patterns using Bun shell syntax and fs/promises.
- Added streaming edit abort functionality with configurable setting to abort on patch preview failures.
- Updated test framework from vitest to bun:test across all test suites.
2026-01-20 05:33:21 +01:00
can1357 fc1ae8dc72 refactor(coding-agent): migrated to class-based architecture for tool implementations
- Refactored output sanitization logic into centralized streaming-output module.
- Converted tool implementations from factory functions to class-based architecture.
- Updated SSH executor to use shared output streaming infrastructure.
- Moved voice recording logic from function to class-based implementation.
2026-01-19 16:16:54 +01:00
can1357 03cfbd81d4 feat(coding-agent): added vendored photon WASM for image processing
- Replaced external photon-node dependency with vendored WebAssembly implementation.
- Added local photon library with 200+ image processing functions and WASM bindings.
- Updated image conversion and resize utilities to use local photon implementation.
- Added error handling for unknown OAuth providers in AI package.
2026-01-19 00:02:12 +01:00
can1357 014b0fb23e fix(coding-agent): prevent clipboard image paste from getting stuck on Wayland 2026-01-14 03:32:06 +01:00
can1357 48b44a6ef8 refactor(coding-agent): simplify Photon integration with native Node.js binding
- Replaced @silvia-odwyer/photon (WASM) with @silvia-odwyer/photon-node (native)
- Removed async initialization wrapper (photon.ts)
- Removed ImageMagick fallback (image-magick.ts)
- Fixed truncateToWidth test to expect Unicode ellipsis
2026-01-14 03:15:10 +01:00
can1357 16fa5533e5 feat(coding-agent): migrated image processing from wasm-vips to Photon with graceful fallbacks
- Migrated image processing library from wasm-vips to Photon (Rust/WASM) for improved performance and reliability.
- Added graceful fallback for failed image resizing operations, allowing the system to use original images when WASM processing fails.
- Added error handling for image conversion failures in interactive mode to prevent crashes during WASM processing.
- Implemented lazy initialization pattern for Photon WASM module with proper resource cleanup using try-finally blocks.
- Added NULL_PROMPT environment variable support for debugging and testing system prompt generation.
2026-01-12 15:23:35 +01:00
can1357 2aec94bcd4 fix(coding-agent): cleaner & properly typed Vips integration 2026-01-12 12:09:00 +01:00
can1357 f9a7159035 fix(coding-agent): replace sharp with wasm-vips for cross-platform support 2026-01-12 11:45:26 +01:00
can1357 e6d33e0a48 feat(coding-agent): converted capability loading and discovery providers to async APIs with caching fs layer
- Converted SettingsManager.create(), loadSettings(), discoverSkills(), loadSlashCommands(), buildSystemPrompt(), loadSkills(), loadProjectContextFiles(), and getShellConfig() from synchronous to asynchronous APIs.
- Changed capability provider load() method from supporting both sync and async to async-only by removing loadSync().
- Removed fs property from LoadContext interface in capability types.
- Added new fs.ts module with caching layer for filesystem operations using readFile, readDirEntries, readDir, walkUp, and cache management functions.
- Refactored all discovery providers (builtin, claude, cline, codex, cursor, gemini, github, mcp-json, ssh, vscode, windsurf) to use async file operations with Promise.all for parallel loading.
2026-01-11 04:26:43 +01:00
can1357 48a9900784 feat: added extension UI customization APIs, SDK exports, CLI flags, and fixed clipboard/resize bugs
- Added setFooter(), setHeader(), and setEditorComponent() methods to ExtensionUIContext for custom UI components.
- Exported InteractiveModeOptions type and numerous UI components for programmatic SDK usage.
- Added --no-tools flag to disable all built-in tools and --no-extensions flag to disable extension discovery.
- Changed bash tool output truncation to recalculate on terminal resize instead of using cached width.
- Fixed Wayland clipboard copy (wl-copy) no longer blocking when the process doesn't exit promptly.
- Updated model pricing and renamed nex-agi/deepseek-v3.1-nex-n1 model removing :free suffix.
2026-01-10 07:11:01 +01:00
can1357 100061accb chore: merged in upstream changes
- Added ExtensionRuntime shared state with async extension factory support
- Introduced pluggable tool operations (BashOperations, FileOperations, etc.) for remote execution
- Added new CLI flags: --no-tools, --no-extensions, --no-skills
- Added login dialog, countdown timer, and component barrel export
- Added blockImages and thinkingBudgets settings
- Refactored stdin handling with StdinBuffer for improved key parsing
- Updated DEVELOPMENT.md with new architecture documentation
2026-01-10 06:32:51 +01:00
can1357 86ef2bd34b chore: bump version to 3.34.0 2026-01-09 12:17:04 +01:00
can1357 5a63120dd3 feat(ai): add @oh-my-pi/pi-ai package with tool name prefixing
- Port pi-ai from upstream with Bun-first approach (source files, no dist)
- Add cli_ prefix to tool names in OAuth mode to avoid collisions
- Improve beta header handling with proper deduplication
- Convert codex-instructions.md to Bun text embed
- Strip .js extensions from all imports
2026-01-09 12:10:03 +01:00
can1357 02cae69bb5 feat: added session storage abstraction and configurable bash interceptor rules
- Added in-memory session storage abstraction with SessionStorage interface and MemorySessionStorage implementation.
- Added configurable bash interceptor rules with pattern-based command interception settings.
- Added AbortSignal support to 80+ web scrapers for request cancellation.
- Changed task tool to require explicit task `id` field and single `agent` parameter at top level.
- Removed `submit_review` tool - reviewers now use `complete` tool with structured output.
- Replaced Date.now() and crypto.randomUUID() with nanoid() for unique ID generation throughout codebase.
2026-01-07 23:17:09 +01:00
can1357 c45f513b6b feat(web-fetch-handlers): added 50+ platform-specific content extractors
- Added 50+ specialized web-fetch handlers for platform-specific content extraction including GitHub, GitLab, npm, PyPI, crates.io, and many more.
- Added automatic yt-dlp installation for YouTube transcript extraction with fallback support.
- Added handlers for social platforms including Twitter/X via Nitter, Reddit, Mastodon, Bluesky, and Hacker News.
- Added handlers for academic sources including arXiv, PubMed, Semantic Scholar, bioRxiv, and IACR ePrint.
- Added Python tool installation support via uv or pip fallback for markitdown and html2text.
- Extracted URL handlers from monolithic web-fetch.ts into modular handler files with shared utilities.
2026-01-07 15:29:17 +01:00
can1357 5919b0df94 refactor: switched to upstream @mariozechner/pi-ai and removed unused packages
- Replaced local @oh-my-pi/pi-ai with upstream @mariozechner/pi-ai@0.37.4
- Added sessionId support to agent for provider caching (OpenAI Codex)
- Deleted packages/ai (now using upstream)
- Deleted packages/mom (unused)
- Deleted packages/web-ui (unused)
2026-01-06 22:25:24 +00:00
can1357 2e3de262fd feat(coding-agent): added bulk replace and OpenRouter image generation
- Added `all` parameter to edit tool for replacing all occurrences with fuzzy matching support.
- Added OpenRouter provider support for image generation when `OPENROUTER_API_KEY` is set.
- Renamed image tool from `gemini_image` to `generate_image` with updated default model.
- Added test cases for edit tool's `all: true` option covering multiple scenarios.
2026-01-06 22:13:24 +00:00
can1357 ca03a5e075 feat(coding-agent): added ImageMagick fallback for image ops when sharp unavailable
- Added ImageMagick fallback for image processing when sharp is unavailable.
- Added image-magick utility module with detection, conversion, and resize functions.
- Changed web_fetch tool label from 'web_fetch' to 'Web Fetch'.
- Updated image-convert and image-resize to use ImageMagick fallback instead of failing or returning original.
2026-01-06 22:04:24 +00:00
can1357 15fbe228b3 feat(monorepo): merged codex providers and extensions 2026-01-05 15:37:44 +01:00
can1357 790a5370bb feat: renamed binary from pi to omp with config migration support
- Renamed CLI binary and package from 'pi' to 'omp' across all platforms and installers.
- Changed environment variable prefix from PI_* to OMP_* with automatic migration support.
- Changed configuration directory from ~/.pi/ to ~/.omp/ with multi-path fallback discovery.
- Added getConfigDirPaths(), findConfigFile(), and readConfigFile() functions for config resolution across .omp, .pi, and .claude directories.
2026-01-03 15:54:45 +01:00
can1357 31cd0cebf9 refactor(coding-agent): extracted bash execution into dedicated executor
- Extracted bash execution logic from bash tool into dedicated BashExecutor with configurable cwd and timeout options.
- Added timeout handling with automatic process termination and timeout-specific result tracking.
- Simplified streaming output handling by replacing rolling buffer with string concatenation.
- Reformatted indentation from spaces to tabs across shell utility files.
2026-01-03 11:07:03 +01:00
can1357 f3a36eb433 feat(coding-agent): added shell environment snapshot to preserve user config
- Added shell environment snapshot feature to preserve user aliases, functions, and shell options across command executions.
- Added zsh support alongside bash for shell detection and configuration.
- Added PI_BASH_NO_CI, PI_BASH_NO_LOGIN, and PI_SHELL_PREFIX environment variables for shell customization.
- Changed Edit tool to reject .ipynb files with guidance to use NotebookEdit tool instead.
- Added shell-snapshot.ts module with snapshot caching, cleanup handlers, and source command generation.
2026-01-03 10:59:26 +01:00
can1357 50ab6b8b1b style: removed .js extension from imports and added node: prefix to builtins 2026-01-03 05:12:25 +01:00
can1357 7cc69d5d3e refactor(coding-agent): simplified shell and tool detection with Bun APIs
- Replaced hardcoded shell path detection with user's $SHELL preference for better environment compatibility.
- Simplified commandExists function to use Bun.which instead of spawning processes for faster tool detection.
- Updated getToolPath to return full binary path from Bun.which for more reliable tool resolution.
2026-01-03 00:16:25 +01:00
can1357 ddc240592f ci(workflows): consolidated release automation into unified publish workflow
- Replaced build-binaries workflow with unified publish workflow to consolidate release automation.
- Added matrix-based parallel binary builds across platforms for faster release cycles.
- Simplified CI workflow by removing concurrency settings and adding CLI smoke tests.
- Added npm publish step with provenance support for secure package distribution.
- Introduced skip_npm input to allow binary-only releases when needed.
2026-01-02 22:40:25 +01:00
can1357 26fd43d999 refactor(coding-agent): improved process cleanup with tree kill
- Replaced process group kill with descendant-aware tree traversal to handle non-leader processes.
- Added pgrep-based child discovery with /proc fallback for broader Linux compatibility.
- Introduced optional grace period parameter to allow SIGTERM before SIGKILL for graceful shutdown.
- Simplified focus return value in interactive mode for consistency.
2026-01-02 22:33:26 +01:00
can1357 560c9670a8 feat: added MCP support and plugin system for external tool integration
- Added MCP (Model Context Protocol) support with stdio and HTTP transports for external tool integration.
- Implemented plugin system with install, enable, configure, and doctor commands for extensibility.
- Added 22 Exa MCP tools for web search, LinkedIn, company research, and websets operations.
- Introduced LSP tool with rust-analyzer support for code intelligence (diagnostics, hover, references, code actions).
- Added task tool for delegating work to specialized subagents with parallel execution support.
- Implemented web_search and web_fetch tools with Anthropic and Perplexity provider support.
2026-01-02 17:54:42 +01:00
can1357 b85d3f6aa4 merge(pi/main): integrate upstream changes through v0.31.1
Merged 53 commits from pi/main including:
- Export HTML rewrite with tree sidebar and /share command
- Hooks API enhancements (custom status, editor, session management)
- Edit diff preview before tool execution
- TUI fixes (Unicode format chars, OSC 8 hyperlinks, emoji optimization)
- Gemini CLI rate limit retry with server-provided delay
- Various bug fixes and documentation updates

Resolved conflicts by preserving Bun migration (spawn→Bun.spawn,
fs→Bun.file) while accepting upstream's new features and APIs.
2026-01-02 14:34:27 +01:00
can1357 1cee37cf92 build: migrated from Node.js to Bun for native TypeScript support
- Migrated from Node.js to Bun runtime to leverage native TypeScript execution and faster startup times.
- Replaced npm with bun package manager and updated lockfile format.
- Converted Node.js APIs (child_process, fs, readline) to Bun equivalents across all packages.
- Updated shebang lines from node/tsx to bun for CLI entry points.
- Removed TypeScript build step by using source files directly as package entry points.
- Updated CI workflows to use Bun instead of Node.js for installation and testing.
2026-01-02 13:46:05 +01:00
Mr. Rc a21d1b266f Fix characters (#372)
* Fix cat command

* Fix text rendering crash from undefined code points in bash output

* Revert unintentional model parameter changes from fix cat command commit
2026-01-01 02:16:29 +01:00
Mario Zechner 6632efe323 refactor(hooks): split session events into individual typed events
Major changes:
- Replace monolithic SessionEvent with reason discriminator with individual
  event types: session_start, session_before_switch, session_switch,
  session_before_new, session_new, session_before_branch, session_branch,
  session_before_compact, session_compact, session_shutdown
- Each event has dedicated result type (SessionBeforeSwitchResult, etc.)
- HookHandler type now allows bare return statements (void in return type)
- HookAPI.on() has proper overloads for each event with correct typing

Additional fixes:
- AgentSession now always subscribes to agent in constructor (was only
  subscribing when external subscribe() called, breaking internal handlers)
- Standardize on undefined over null throughout codebase
- HookUIContext methods return undefined instead of null
- SessionManager methods return undefined instead of null
- Simplify hook exports to 'export type * from types.js'
- Add detailed JSDoc for skipConversationRestore vs cancel
- Fix createBranchedSession to rebuild index in persist mode
- newSession() now returns the session file path

Updated all example hooks, tests, and emission sites to use new event types.
2025-12-30 22:42:22 +01:00
Daniel Nouri 66309f4949 fix: Use bash instead of sh on Unix systems
The bash tool is named "bash" and described as executing bash commands,
but was using sh on Unix. On many distros (Ubuntu, Debian, Alpine, etc.),
/bin/sh is a POSIX-only shell that doesn't support bash syntax like [[ ]],
arrays, or here-strings. This caused the LLM to write bash syntax that
failed, wasting tokens on rewrites.

Now prefers /bin/bash on Unix, falling back to sh only if bash isn't found.
2025-12-26 23:12:57 +01:00
Mario Zechner a7aa118f64 Add project-specific settings and SettingsManager factories
- SettingsManager now loads .pi/settings.json from cwd (project settings)
- Project settings merge with global settings (deep merge for objects)
- Setters only modify global settings, project settings are read-only
- Add static factories: SettingsManager.create(cwd?, agentDir?), SettingsManager.inMemory(settings?)
- Add applyOverrides() for programmatic overrides
- Replace 'settings' option with 'settingsManager' in CreateAgentSessionOptions
- Update examples to use new pattern

Incorporates PR #276 approach
2025-12-22 12:23:02 +01:00
Mario Zechner f0c5be541f Enable more biome lints and fix things 2025-12-21 22:56:20 +01:00
Peter Steinberger 916101edcf fix(coding-agent): detect image MIME via file-type (#205)
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2025-12-17 17:11:56 +01:00
Mario Zechner 5cb6bbf421 Fix model selector fuzzy search to match provider and support multi-token queries 2025-12-15 18:05:32 +01:00
Mario Zechner a63092e830 Move config.ts from utils/ to src/ 2025-12-09 01:28:06 +01:00
Mario Zechner 94e30e5558 Fix path resolution in config.ts after file reorganization 2025-12-09 00:54:51 +01:00
Mario Zechner 58828adf76 Reorganize file structure: core/, utils/, modes/interactive/components/, modes/interactive/theme/ 2025-12-09 00:51:33 +01:00