Commit Graph

48 Commits

Author SHA1 Message Date
can1357 8276390877 refactor(coding-agent): standardized XML tags and RFC 2119 keywords across prompts
- Standardized XML tag naming from snake_case to kebab-case across 50+ prompt files for consistency.
- Replaced imperative language with RFC 2119 keywords (MUST/SHOULD/MAY/MUST NOT) throughout system and tool prompts for clarity.
- Removed artifactsDir parameter from Python executor and simplified environment variable handling to use PI_SESSION_FILE only.
- Renamed read_path.md to read-path.md and updated memory guidance with hierarchy rules and conflict resolution workflow.
- Added noEscape option to bash URL expansion and extracted cwd parameter from leading cd commands for improved path handling.
- Exported NO_PAGER_ENV constant from bash-interactive module for centralized environment variable management.
2026-02-22 17:12:27 +01:00
Emil Sit 1dc7384f27 docs(coding-agent): add autonomous memory documentation
- Add docs/memory.md covering usage, customization, how it works,
  model selection, configuration, and key files
- Add a brief README section
2026-02-21 14:38:04 +01:00
can1357 8c73c45ccc docs: document NanoGPT env var and login flow 2026-02-19 13:55:26 +01:00
can1357 e6f8001d9e feat: added 11 AI providers with OAuth and $pickenv() fallback support
- Added support for 11 new AI providers (Hugging Face, NVIDIA, Together, Ollama, LiteLLM, Xiaomi, Moonshot, Venice, Qwen Portal, vLLM, Cloudflare AI Gateway) with API key authentication and login flows.
- Implemented $pickenv() utility for environment variable fallback chains, enabling multi-key resolution for providers with alternative credential names.
- Extended KnownProvider and OAuthProvider types to include all 11 new providers with corresponding model manager functions and OAuth handlers.
- Expanded models.json with thousands of new model entries across all new providers and replaced deprecated opencode provider with cloudflare-ai-gateway.
- Refactored model generation script to use unified fetchProviderModelsFromCatalog() and centralized API key resolution for all providers.
2026-02-18 17:47:59 +01:00
can1357 bad4db1365 fix(models): aligned synthetic/cerebras auth and discovery 2026-02-18 15:43:46 +01:00
can1357 bc69fd207d feat: implemented dynamic model resolution across all providers with ModelManager API
- Added ModelManager API with createModelManager() factory for managing bundled and dynamically discovered models with configurable refresh strategies.
- Exported discovery utilities for fetching models from Antigravity, Codex, Cursor, Gemini, and OpenAI-compatible endpoints with provider-specific model manager configuration helpers.
- Renamed public API functions for clarity: getModel() -> getBundledModel(), getModels() -> getBundledModels(), getProviders() -> getBundledProviders().
- Added on-disk model caching with TTL-based invalidation and resolveProviderModels() function for runtime model resolution with source precedence.
- Refactored model discovery script to dynamically fetch models from Codex, Cursor, and Antigravity using OAuth credentials instead of hardcoded lists.
2026-02-18 01:38:05 +01:00
can1357 6fa0a685b5 refactor(coding-agent/tools): fixed double wrapped tools and improved tool wrapping logic
- Refactored tool wrapping logic from array-based function to per-tool wrapper with guard clause to prevent double-wrapping.
- Replaced Proxy-based tool wrapping with Object.defineProperties to preserve property access behavior and private fields on original tool objects.
- Consolidated tool wrapping into createTools function, removing intermediate wrapping step from sdk.ts.
- Extracted FETCH_DEFAULT_MAX_LINES constant to fetch.ts for local use instead of importing from truncate module.
- Converted else-if control flow to separate if statement for artifactId check in notice formatting logic.
2026-02-17 09:57:24 +01:00
can1357 cd4b3ec753 docs: removed system_info module references and reformatted documentation tables
- Removed system_info module references from natives documentation.
- Reformatted markdown tables in README and natives-media-system-utils documentation for improved readability.
- Removed system-info subsystem documentation including lifecycle, failure transitions, and platform-specific notes.
2026-02-17 05:46:02 +01:00
can1357 29e6d8677f docs: add secrets obfuscation reference 2026-02-16 19:27:49 +01:00
can1357 0bbe52dee7 feat(coding-agent): changed context promotion to trigger on overflow errors instead of threshold
- Changed context promotion to trigger on context overflow errors instead of a configurable threshold percentage.
- Removed the contextPromotion.thresholdPercent configuration setting.
- Updated context promotion to retry immediately on the promoted model without requiring compaction.
- Refactored context promotion logic to attempt promotion before compaction in the overflow handling flow.
- Updated agent session to merge context promotion checks into the compaction method for unified overflow handling.
- Updated tests to reflect overflow-based promotion triggering instead of threshold-based promotion.
2026-02-16 18:33:05 +01:00
can1357 ce0919bdf0 docs(models): documented context promotion fallback chains 2026-02-16 18:33:04 +01:00
can1357 53ad78f7fb docs: added comprehensive documentation for @oh-my-pi/pi-natives architecture
- Added comprehensive documentation for @oh-my-pi/pi-natives architecture covering three-layer design (TypeScript wrapper, addon loading/validation, Rust N-API module).
- Added deep-dive documentation for addon loading runtime including platform support, CPU variant selection, embedded addon extraction lifecycle, and validation contracts.
- Added binding contract documentation defining TypeScript-side API surface, wrapper behavior, and N-API addon validation with maintainer checklist.
- Added subsystem deep-dives for text/search pipeline (grep, glob, fs_cache, ANSI utilities), shell/PTY/process execution, task cancellation patterns, and media/system utilities.
2026-02-16 18:33:03 +01:00
can1357 2e45297c43 docs(docs): moved documentation to root docs directory and updated all references
- Moved documentation files from packages/coding-agent/docs/ to root docs/ directory to flatten the documentation structure.
- Updated all internal documentation links to account for the new file locations, adjusting relative paths to maintain correct references across the monorepo.
- Updated README.md and issue template configuration to reference documentation at the new root docs/ location instead of packages/coding-agent/docs/.
2026-02-16 18:33:03 +01:00
can1357 c12be01a5f fix(coding-agent): backported pi-mono changes (34878e..5133697)
packages/ai:
- fix: hardened OpenAI tool-call JSON parsing for malformed trailing arguments
- feat: routed GitHub Copilot Claude 4.x models through anthropic-messages
- feat: centralized dynamic Copilot headers and anthropic bearer auth handling
- feat: added optional StreamOptions.metadata propagation
- test: added Copilot headers/auth/routing coverage
- fix: updated model generator and models.json for Copilot Claude API mapping

packages/coding-agent:
- fix: made CLI model resolution deterministic with provider-aware pattern parsing
- fix: corrected compaction boundary/context usage handling after compaction
- feat: expanded extension events and terminal input hook integration
- fix: hardened git source parsing to avoid local-path misclassification
- test: added git-url parser coverage and model-resolver cases

packages/tui:
- fix: scoped @ fuzzy autocomplete to typed path prefixes
- feat: added Windows VT input mode support via bun:ffi

docs:
- chore: updated porting sync point to 5133697
2026-02-16 10:08:53 +01:00
can1357 1845e96d13 feat(ai): migrated models export from TypeScript to JSON format and updated dependencies
- Migrated models export from TypeScript module to JSON format, changing the public API from importing MODELS from './models.generated' to importing from './models.json' with JSON import assertion.
- Updated @anthropic-ai/sdk dependency from ^0.72.1 to ^0.74.0.
- Simplified model generation script by replacing 49 lines of TypeScript code generation with direct JSON serialization.
- Updated @types/bun devDependency from ^1.3.8 to ^1.3.9 across all packages.
- Removed models.generated.ts exclusion from biome.json linting configuration.
2026-02-10 22:01:35 +01:00
can1357 acf8ab5225 style: stylistic changes 2026-02-10 07:39:39 +01:00
can1357 1c84a70417 fix(coding-agent): backported pi-mono changes (9ce00079..34878e)
packages/ai:
- feat: added OpenAI Codex stream test
- fix: google-gemini-cli provider cleanup
- fix: google-shared provider improvements
- fix: amazon-bedrock provider fix
- fix: openai-codex-responses provider fix
- chore: regenerated models

packages/coding-agent:
- feat: extension API reload method and UI sub-protocol
- feat: tilde expansion in custom skill directories
- feat: RPC mode reload support
- feat: tools-manager improvements
- fix: CLI args updates
- docs: extensions and RPC documentation updates

packages/tui:
- feat: kill-ring and undo-stack modules
- feat: editor enhancements (kill/yank, undo/redo)
- feat: input component improvements

packages/agent:
- test: agent test additions
2026-02-10 03:15:19 +01:00
can1357 bfe175fc01 feat(natives): backported fixes from pi-mono (82d7da878..9ce00079) 2026-02-06 01:55:42 +01:00
can1357 f8950c22b4 refactor(auth-storage): cleanup auth.json mentions
- Migrated authentication storage from JSON-based (auth.json) to database-based (agent.db) format across test files and configuration.
- Simplified auth storage discovery in sdk.ts by removing manual path construction and fallback logic in favor of centralized getAgentDbPath() function.
- Removed dbPath instance property from AuthStorage class as database path is now managed centrally.
- Updated environment variable precedence documentation to reflect agent.db instead of auth.json as the lowest priority source.
- Removed OAuth provider section header comments from multiple test files for cleaner test organization.
- Added support for JSON and JSONC configuration file formats without requiring migration to YAML.
2026-02-05 14:30:22 +01:00
can1357 37c74bb19d perf: migrated timing measurements to Bun.nanoseconds() for higher precision
- Migrated timing measurements from `performance.now()` to `Bun.nanoseconds()` for higher precision benchmarking across all benchmark and timing-sensitive code.
- Updated elapsed time calculations to convert nanoseconds to milliseconds using division by 1e6 to maintain consistent time units.
- Increased benchmark precision from 4 to 6 decimal places for per-operation timing measurements.
- Refactored grep benchmark to use averaged timing values instead of storing individual iteration times, reducing memory overhead.
2026-02-05 06:19:49 +01:00
can1357 a1a4824cd7 docs(coding-agent): added LLM provider env vars and expanded CLI help documentation
- Added comprehensive environment variables documentation including API keys for 11 new LLM providers (Groq, Cerebras, xAI, OpenRouter, Mistral, z.ai, MiniMax, OpenCode, Cursor, Vercel AI Gateway, Perplexity) and cloud provider configuration.
- Expanded CLI help text with detailed API keys section documenting all supported LLM providers, cloud providers, search services, and model override configuration variables.
- Fixed redundant fallback check in porting guide example by removing duplicate `Bun.env.HOME` reference.
2026-02-05 04:51:42 +01:00
can1357 89e6479661 refactor: migrated environment variable access from process.env to Bun.env across 71 files
- Migrated all environment variable access from Node.js `process.env` to Bun runtime `Bun.env` API across the entire codebase.
- Updated 71 files including source code, tests, documentation, and configuration to use Bun's native environment variable API.
- Added comprehensive environment variables documentation in `packages/coding-agent/docs/environment-variables.md` covering 100+ environment variables organized by category.
- Updated CHANGELOG entries to reflect migration from `process.env` to `Bun.env` and environment variable prefix changes (PI_* vs OMP_*).
- Maintained identical behavior and logic across all changes - only the environment variable access method was updated.
2026-02-05 04:51:18 +01:00
can1357 ec801665bc refactor(env): migrated environment variables from OMP_ to PI_ prefix and centralized access via getEnv()
- Migrated environment variable access from direct process.env to centralized getEnv() utility function across all packages.
- Renamed environment variable prefix from OMP_ to PI_ throughout codebase (e.g., OMP_CODING_AGENT_DIR -> PI_CODING_AGENT_DIR).
- Removed automatic environment variable migration from PI_ to OMP_ prefixes via migrate-env.ts module.
- Removed env setting from configuration schema and applyEnvironmentVariables() method from settings.
- Updated CI/CD build configuration to use PI_COMPILED flag instead of OMP_COMPILED.
- Changed venvPath property in PythonRuntime from nullable (string | null) to optional (string | undefined).
2026-02-05 02:55:01 +01:00
can1357 7d60a1af85 docs(coding-agent): updated documentation
- Updated documentation to reflect product name change from 'pi' to 'omp' throughout guides and API references.
- Restructured extension and hook documentation to clarify discovery mechanisms, loading behavior, and configuration across multiple config systems (.omp, .pi, .claude, .codex).
- Updated SDK API documentation with new method signatures: discoverHooks() -> discoverExtensions(), SessionManager methods now async, settings format changed to YAML.
- Expanded session architecture documentation with new entry types (TtsrInjectionEntry, SessionInitEntry), updated field names (fromHook -> fromExtension), and clarified session file format versioning.
- Simplified session-tree-plan.md from detailed implementation checklist to architecture summary, removing completed tasks and rollout details.
2026-02-05 01:34:20 +01:00
can1357 696cd48f4e fix: backport fixes from pi-mono (52532c7c0..82d7da878)
packages/ai:
- fix: default tool call arguments to {} when nullish
- feat: add Vercel AI Gateway routing support

packages/tui:
- feat: add Ctrl+B/Ctrl+F cursor navigation keybindings
- feat: add character jump navigation (Ctrl+], Ctrl+Alt+])
- fix: support quoted paths with spaces in autocomplete

packages/coding-agent:
- feat: add set_session_name RPC command
- feat: add "none" option to doubleEscapeAction setting
- fix: respect .gitignore/.ignore/.fdignore when scanning package resources
- refactor: unified sessionTitle to sessionName across codebase
2026-02-01 08:14:40 +01:00
can1357 1e8e058ead feat: added cross-compilation support via CARGO_BUILD_TARGET and environment variable overrides
- Added support for cross-compilation via CARGO_BUILD_TARGET environment variable, enabling builds for non-native targets like ARM64 Linux.
- Added support for overriding platform and architecture detection via TARGET_PLATFORM and TARGET_ARCH environment variables.
- Modified native build script to search for release artifacts in target-specific directories when cross-compiling.
- Updated CI workflow to use cross-compilation toolchain for ARM64 Linux builds instead of native ARM64 runners.
- Created comprehensive porting guide documenting how to port hot paths to pi-natives with anatomy, checklist, and troubleshooting sections.
2026-02-01 07:44:34 +01:00
can1357 bf891b329c fix: backport fixes from pi-mono (9f3eef65f..52532c7c0)
packages/ai:
- fix: handle "sensitive" stop reason from Anthropic API
- fix: normalize tool call IDs with special characters for Responses API
- fix: add overflow detection for Bedrock, MiniMax, Kimi providers
- fix: 429 status is rate limiting, not context overflow

packages/tui:
- fix: refactored autocomplete state tracking
- fix: file autocomplete should not trigger on empty text
- fix: configurable autocomplete max visible items
- fix: improved table column width calculation with word-aware wrapping

packages/coding-agent:
- fix: preserve external config.yml edits on save (#1046 by @nicobailonMD)
- fix: resolve macOS NFD and curly quote variants in file paths
2026-01-30 00:22:13 +01:00
can1357 57a3650cc6 fix: backport fixes from pi-mono (3635e45f..9f3eef65f)
packages/ai:
- feat: HTTP proxy support via environment variables
- fix: correct provider error message typo
- fix: filter deprecated OpenCode models from generation

packages/tui:
- fix: scrollback overwrite when appending lines past viewport
- fix: keep overlays centered across resizes
- fix: handle multi-line text in insertTextAtCursor()

packages/coding-agent:
- fix: add /model instruction to no models warning
- fix: active path highlighting in HTML exports
2026-01-27 19:47:36 +01:00
can1357 7bb2e1aa58 feat(port): ported pi-mono improvements + worker & patch improvements
- added Azure OpenAI Responses support and OpenRouter routing compat
- improved patch applicator diagnostics and subagent context propagation
- updated editor cursor handling, keybindings, and working message API
- refreshed porting sync metadata
2026-01-25 13:50:08 +01:00
can1357 51d39e7eea refactor(imports): migrated node module imports to namespace imports
- Converted named imports from node modules (fs, path, os) to namespace imports across all packages.
- Extended extension loader error handling with isEacces and hasFsCode type guards.
2026-01-24 03:37:59 +01:00
can1357 a9ca7365ac chore: bump version to 5.6.7 2026-01-18 21:11:16 +01:00
can1357 1d414c1383 feat: added IPython-backed Python tool with streaming output and Jupyter integration
- Added IPython-backed Python tool with streaming output and image/JSON rendering.
- Implemented Jupyter kernel gateway integration with WebSocket communication.
- Added Python prelude with 30+ shell-like utility functions for file operations.
- Migrated environment variables from PI_ to OMP_ prefix with automatic migration.
- Added streaming output system with automatic spill-to-disk for large outputs.
- Reorganized settings interface into behavior, tools, display, voice, status, lsp, and exa tabs.
2026-01-18 19:32:27 +01:00
can1357 ac151519c1 feat: port upstream changes from pi-mono (72047c05..55769e75)
AI provider fixes:
- Fixed Claude tool prefix matching and Gemini 3 unsigned tool handling
- Added Bedrock thinking budget guardrails and tool id sanitization
- Added tool argument coercion and Codex response retry logic

TUI improvements:
- Improved Kitty key handling and editor behavior (scrolling, padding, kill ring)

Coding agent changes:
- Added extension input interception, compaction helpers, and UI updates
- Added session forking prompt for cross-project sessions
- Added APPEND_SYSTEM discovery, piped stdin print mode, and key hint exports

Docs:
- Updated pi-mono sync point
2026-01-18 17:52:58 +01:00
can1357 f1d71fbd9d feat: implemented Emacs-style kill ring with Alt+D and Ctrl+Y bindings
- Added automatic retry logic for OpenAI Codex responses with configurable delay and max retries.
- Added input event handlers for extensions to intercept user input and argument completion support.
- Added Emacs-style kill ring for text deletion operations with Alt+D and Ctrl+Y keybindings.
- Added configurable editor padding via editorPaddingX theme option and setMaxHeight() method.
- Fixed tool prefix handling in Claude provider to use case-insensitive comparison.
- Enhanced Kitty keyboard protocol support for better key detection and shifted symbol handling.
2026-01-18 17:12:18 +01:00
can1357 0b85098862 feat: port upstream changes from pi-mono (6730b4fa..b74535dc)
Provider additions:
- Added Amazon Bedrock provider with bedrock-converse-stream API
- Added MiniMax provider with OpenAI-compatible API
- Added EU cross-region inference model variants for Bedrock

Provider fixes:
- Fixed Gemini CLI retries with header parsing and empty stream retry logic
- Fixed Bedrock tool call transforms via transformMessages
- Fixed z.ai thinking/reasoning params
- Fixed OpenRouter+Anthropic cache control
- Fixed OpenAI responses timeout and service tier options
- Fixed tool call ID normalization for cross-provider switches
- Fixed thought signature validation for Google providers
- Fixed prompt cache key using session ID

TUI improvements:
- Added OverlayOptions API with CSS-like positioning (SizeValue, percentages)
- Added OverlayHandle for programmatic visibility control
- Added visible callback for responsive overlays
- Added pad parameter to truncateToWidth
- Added pageUp/pageDown key support
- Fixed numbered list items showing 1. when code blocks break continuity
- Fixed overlay width overflow crash with complex ANSI sequences
- Fixed light theme colors for WCAG AA compliance

Coding agent fixes:
- Fixed /new command to create new session file
- Fixed session selector to stay open when folder has no sessions
- Added session header emission in JSON print mode
- Added queued message hint with theme.tree.hook
- Exported highlightCode and getLanguageFromPath for extensions

Also renamed transorm-messages.ts to transform-messages.ts (typo fix)
2026-01-14 01:50:47 +01:00
can1357 a8293b98e4 docs: format tables in porting guide 2026-01-12 06:52:55 +01:00
can1357 741ab06ed2 feat: port upstream improvements from pi-mono (f1b64b9d..6730b4fa)
TUI:
- Add fuzzy matching module (moved from coding-agent)
- Remove Kitty protocol query timeout (fixes shift+enter delays)
- Add bracketed paste check for key release/repeat detection
- Rendering optimizations (only re-render changed lines)
- Add backslash+enter newline fallback, getExpandedText()
- Refactor input.ts to use keybindings manager

Coding-agent:
- Add /skill:name slash commands with enableSkillCommands setting
- Add cwd to SessionInfo for session list display
- Improve tree selector with custom summarization instructions
- Add dequeue (Alt+Up) to restore all queued messages at once
- Add shutdown request handling for extensions
- Component invalidate() fixes for theme changes
2026-01-12 03:18:30 +01:00
can1357 24f0e41db7 refactor(interactive): restructured interactive-mode.ts into separate controller and utility classes
- Extracted CommandController class handling slash commands and user-initiated actions from interactive-mode.ts.
- Extracted EventController class handling AgentSessionEvent processing from interactive-mode.ts.
- Extracted ExtensionUiController class managing TUI-based UI context for extensions and hooks from interactive-mode.ts.
- Extracted InputController class handling keyboard input and editor interactions from interactive-mode.ts.
- Extracted SelectorController class managing UI selector components from interactive-mode.ts.
- Extracted UiHelpers and VoiceManager utility classes from interactive-mode.ts.
2026-01-11 00:05:34 +01:00
can1357 f48bc666d9 fix(coding-agent): fixed credential blocking logic to check remaining available credentials
- Fixed credential blocking logic to correctly check for remaining available credentials instead of always returning true.
2026-01-10 18:02:36 +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 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 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 15fbe228b3 feat(monorepo): merged codex providers and extensions 2026-01-05 15:37:44 +01:00
Mario Zechner 78b5cbfd34 Add RPC protocol documentation with tool call correlation 2025-12-03 15:28:17 +01:00
Mario Zechner 1e79eabdbd Add comprehensive RPC protocol documentation 2025-12-03 15:22:20 +01:00
Mario Zechner 508d1bb2d6 Clean-up 2025-11-14 21:32:16 +01:00
Mario Zechner ffc9be8867 Agent package + coding agent WIP, refactored web-ui prompts 2025-10-17 11:47:01 +02:00
Mario Zechner f93e72a805 Committing manually like the monkey I am 2025-10-12 02:59:46 +02:00