Commit Graph

1709 Commits

Author SHA1 Message Date
can1357 223613479a fix(coding-agent): resolve resumable session lookup
Fixes #268
2026-03-03 14:22:53 +01:00
can1357 6357b245a5 fix: corrected resource tracking and context cleanup across MCP and virtualization layers
- Fixed resource refresh tracking by storing connection references alongside promises to prevent stale deduplication.
- Fixed update target resolution to explicitly handle missing ompPath and use path.resolve() for consistent normalization.
- Added error handling and logging in Smithery registry detail fetching to gracefully handle failures and track issues.
- Fixed virtualization context cleanup in error paths to prevent partially-started instances from remaining active.
- Fixed API key retrieval to use dynamic provider configuration instead of hardcoded provider string.
- Enhanced test utilities to capture and verify request parameters for improved test coverage and debugging.
2026-03-03 06:07:22 +01:00
can1357 0611e97dbc fix(ai,coding-agent): resolve copilot endpoint at provider layer
Fixes #260
2026-03-03 05:33:56 +01:00
can1357 b0fef96800 fix(coding-agent): harden omp update install-target detection
Use Bun-native command execution and PATH-prioritized resolution so updates apply to the installation users actually invoke.\n\nFixes #247
2026-03-03 05:29:26 +01:00
can1357 9935b9b351 feat(internal-urls): added mcp:// protocol for MCP resource access via read tool
- Added mcp:// internal URL protocol for reading MCP server resources via the read tool.
- Removed read_resource tool; MCP resource reading now integrated into read tool with mcp:// URLs.
- Implemented McpProtocolHandler with URI template matching for resolving MCP server resources.
- Updated MCP resource notifications to recommend read(path="mcp://<uri>") syntax.
2026-03-03 04:48:37 +01:00
Dev Ned c22ba6b49c feat: implemented Smithery Registry for MCP search (#96)
* Implemented Smithery MCP Searchable Registry

* refactor(coding-agent): consolidated MCP registry search and improve error handling

- Extracted `parseCommandArgs` and `stripControlChars` utilities to reduce duplication in MCP command controller. Replaced custom URL opening logic with centralized `openPath` utility across OAuth and registry flows.
- Enhanced Smithery auth error handling to gracefully degrade on file read failures with logging instead of throwing, and improved chmod error reporting. Normalized Smithery API base URL to strip trailing slashes.
- Improved registry search pagination to fetch multiple pages until sufficient results are found, with semantic mode support to preserve API relevance ranking. Deduplicated entries by identity key and applied local sorting only in non-semantic mode.

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-03 04:48:23 +01:00
can1357 ff73fdf18c fix(coding-agent/utils): fixed Bun.spawn options for opening paths
- Added stdin: "ignore" to prevent stdin from being inherited by spawned process.
- Removed windowsHide option which is not supported by Bun.spawn.
2026-03-03 04:16:17 +01:00
can1357 a88dd79f9c feat(task): surface explicit abort reasons for subagent results
- Add a dedicated abortReason field to SingleResult and thread it through task execution paths so aborted subagents show actionable context instead of a generic badge.
- Populate abortReason for signal cancellation, pre-start cancellation, submit_result aborted status, and missing submit_result after reminders

Fixes #248
2026-03-03 04:14:04 +01:00
haram 801553b118 Implement fuse-projfs as an alternative to fuse-overlay for Windows. (#244)
* Implement fuse-projfs to use ProjFS on WIndows.

* fix(pi-natives): prevent ProjFS session key mismatch and start race

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-03 04:12:30 +01:00
can1357 7ce8b6d5df fix(coding-agent): render hook selector/input inline instead of as overlay popup
Reverts the overlay change from 0d3bef3f1 that caused the plan mode
approval dialog to float over the plan content, making it unreadable.

Fixes #240
2026-03-03 04:03:59 +01:00
can1357 f6553a00ff fix(coding-agent): guard stale MCP subscription post-actions 2026-03-03 04:00:30 +01:00
can1357 7b4ab548c0 fix: corrected URI template expansion and MCP notification epoch handling
- Fixed URI template matching to handle empty string expansions in MCP resource queries.
- Fixed LM Studio URL validation to preserve invalid baseUrl instead of applying localhost fallback.
- Fixed MCP notification epoch handling to prevent unsubscribe calls when old subscriptions resolve after re-enabling.
- Extracted hardcoded LM Studio base URL to named constant for improved maintainability.
- Refactored notification epoch check logic for improved code clarity and readability.
2026-03-03 03:56:30 +01:00
can1357 019c593782 fix: resolve merged regression set across coding-agent and ai
- Normalize LM Studio discovery URLs to avoid duplicated /v1 segments
- Harden status-line PR cache with branch+repo context validation and guarded async writes
- Apply Foundry auth precedence correctly and preserve system trust roots when custom CA is provided
- Split Copilot premium multiplier handling by plan tier while preserving agent-initiated zero billing
- Catch MCP notification refresh failures and route read_resource via deterministic full template matching
- Add regression tests for each fix cluster and keep targeted suites green
2026-03-03 03:39:19 +01:00
can1357 3b0f86bd92 fix(prompts): clarified range selection guidance to prevent orphaned braces
- Clarified range selection guidance for hashline tool to prevent orphaned braces and duplication errors.
- Updated example to demonstrate correct end-range boundary inclusion in replace operations.
2026-03-03 03:31:29 +01:00
Sage Grigull 02ebc5e8e1 add LM Studio support (#259)
* feat: Add LM Studio as a supported model provider with OpenAI-compatible API fetching and discovery.

Add LM Studio as a supported AI provider with optional API key, environment variables, and discovery.

* feat: Add rustup as a dev dependency.

* fix: Refine LM Studio API key handling to conditionally send authorization headers during model discovery based on whether the key is a default local token or a custom key, and add new tests.

* feat: Enhance OAuth token and account ID resolution for model providers in the model registry.

* rebase for packages/ai/CHANGELOG.md

* feat: improve implicit model discovery to independently auto-detect Ollama and LM Studio, and refine LM Studio base URL handling.

---------

Co-authored-by: Can Bölük <can1357@users.noreply.github.com>
2026-03-03 03:26:57 +01:00
Miroslav Drbal [ApoC] 63b203b937 feat(mcp): resource notifications, subscriptions, and read_resource builtin tool (#254)
* feat(mcp): resource notifications, subscriptions, and read_resource builtin tool

- Add MCP resource subscription lifecycle (subscribe/unsubscribe on connect/disconnect)
- Wire mcp.notifications setting with live toggle support
- Add debounced followUp injection for resource change notifications
- Add global read_resource builtin tool with server resolution by URI/template scheme
- Add MCP prompt commands (buildMCPPromptCommands) with array content support
- Add server instructions injection into system prompt with attribution
- Add mcp.notificationDebounceMs configurable setting

Client (client.ts):
  listResources, listResourceTemplates, readResource with pagination
  subscribeToResources, unsubscribeFromResources
  listPrompts, getPrompt, serverSupportsPrompts
  serverSupportsResources, serverSupportsResourceSubscriptions

Manager (manager.ts):
  Notification dispatch with subscribed-URI guard
  Concurrent refresh deduplication via pending promise map
  setNotificationsEnabled with subscribe/unsubscribe toggle

Tests:
  client-resources.test.ts (31 tests)
  client-prompts.test.ts (20 tests)
  mcp-read-resource.test.ts (13 tests)

* fix(mcp): address PR review - eager prompt init and stale subscription cleanup

P1: Make setOnPromptsChanged eagerly fire for servers that already
have prompts loaded. The callback is registered after MCP discovery
has already loaded prompts and fired the hook, so without this the
handler is never called on the common startup path. The fix is in
the manager itself (not the caller), eliminating the race condition
regardless of when the callback is wired.

P2: Unsubscribe removed resource URIs on resource refresh.
refreshServerResources was subscribing to the new URI set and
overwriting #subscribedResources without unsubscribing URIs that
were previously subscribed but no longer present, leaving stale
subscriptions active on the server.

* fix(mcp): add resources and prompts to /mcp help text and subcommand completions

* feat(mcp): add /mcp notifications command

Shows per-server notification capabilities with subscription state:
- Lists supported notification types (tools/list_changed, resources/list_changed,
  prompts/list_changed) with check marks
- Shows resources/subscribe status with active subscription count
- Lists subscribed URIs with green ticks when notifications are enabled
- Displays overall enabled/disabled state (mcp.notifications setting)

* fix(mcp): address PR review comments on race conditions and stale state

- Await subscribe/unsubscribe in refreshServerResources so the refresh
  promise doesn't resolve before subscriptions are settled, preventing
  a second refresh from racing and overwriting tracking state (P2 #3)

- Guard setNotificationsEnabled subscribe .then() against a disable
  that happens while the subscribe request is in-flight (P2 #5)

- Re-check mcp.notifications setting inside debounce setTimeout
  callback so toggling off mid-window actually suppresses the
  follow-up message (P2 #4)

- Fire onToolsChanged and onPromptsChanged callbacks in
  disconnectServer so stale slash commands and tool registrations
  are cleaned up when a server is removed (P2 #2)

---------

Co-authored-by: Miroslav Drbal <miroslav.drbal@gendigital.com>
2026-03-03 03:26:07 +01:00
maximhar 7ea7b53783 feat(copilot): track premium requests with model multipliers (#255)
* Track Copilot premium requests with model multipliers

* refactor(copilot): source premium multipliers from models.json

* feat(copilot): add gpt-5.3-codex bundled model

* fix(stats): round premium request totals in summary

* fix(stats): round premium requests in sync summary
2026-03-03 03:26:00 +01:00
AK 4b651a95e9 add azure foundry support for claude code (#257) 2026-03-03 03:25:07 +01:00
Kevin Loftis 5ee80f3a36 feat: Add PR number segment to status bar (#258)
* Add PR number segment to status bar

Add a new 'pr' status line segment that shows the GitHub PR number
(e.g., #1234) as a clickable OSC 8 hyperlink when the current branch
has an associated pull request.

- Async lookup via 'gh pr view', cached per branch
- Invalidates on branch change via .git/HEAD watcher
- Falls back to hidden segment when no PR exists or gh unavailable
- Supports all theme presets (unicode, nerd font, ascii)
- Added to all preset layouts after the git segment

* Skip PR lookup on default branch, resolve dynamically

* Extract git-utils, add tests for parseGitHubRepo and parseDefaultBranch

* Fix PR lookup race condition, invalidation churn, and dotted repo names

- Guard #cachedPr writes against branch change during in-flight lookup
- Stop clearing PR cache in invalidate() (only .git/HEAD watcher should)
- Allow dots in GitHub repo names in parseGitHubRepo regex

* Simplify PR lookup: use gh pr view, try upstream/HEAD for default branch

- Replace gh pr list --head with gh pr view (requires gh repo set-default)
- Remove manual remote URL resolution — gh handles it
- Default branch detection falls back to upstream/HEAD when origin/HEAD is unset
2026-03-03 03:24:15 +01:00
HvC 0d2c5540db perf (pi-natives) : ast, fd, pty changes for performance (#252)
* perf (pi-natives -> fuzzy finder): precomputed query chars + fewer allocations in scoring

* restored fs-cache identity (oops)

* perf(pi-natives -> ast): parsed ast files once for multi-pattern search

* perf(pi-natives -> PTY waitloop tinto timed wait): reduced pty polling with timed waits

* fix codex suggestions

* surface websocket option

* ast in compile cancellation

* formatting and pty busy loop fix

---------

Co-authored-by: Brit <lol@no.com>
2026-03-03 03:23:25 +01:00
can1357 29005b90f9 fix(ai): corrected schema compatibility for Antigravity tool parameters
- Fixed schema compatibility issue by sanitizing patternProperties in tool parameters during Antigravity format conversion.
- Added sanitizeSchemaForCCA utility to remove unsupported schema properties when rewriting tools to legacy parameters format.
- Added test case verifying patternProperties removal during tool parameter conversion.
- Added PEP 563 forward reference support to Python prelude for improved type annotation compatibility.
2026-03-02 21:17:06 +01:00
maximhar 3119bfced5 fix(coding-agent): add explicit initiator attribution for Copilot headers (#246)
* fix(coding-agent): add explicit initiator attribution

Use message-level attribution for Copilot X-Initiator with role-based fallback, and persist attribution across custom/hook session paths.

Fixes #237

* fix(coding-agent): preserve legacy custom attribution fallback

* fix(coding-agent): remove async-result role special-case

* fix(coding-agent): inherit before_agent_start attribution from prompt

* test(coding-agent): tighten typing in attribution regressions
2026-03-02 17:01:44 +01:00
luke 09a768250b fix(ai): separate cache_control placement from system block construction (#245)
buildAnthropicSystemBlocks was unconditionally adding cache_control to system
blocks for OAuth cloaking. This triggered the early-return guard in
applyPromptCaching, which bailed before placing cache_control on conversation
messages. Result: only the system prompt (~21K tokens) was cached; conversation
history was sent as fresh uncached input every turn, dropping cache hit rate
from ~98% to ~40%.

Fix: make cache_control in buildAnthropicSystemBlocks opt-in via a cacheControl
option. The main streaming path (buildParams) omits it since applyPromptCaching
handles all cache breakpoint placement. External callers like the Anthropic
search provider that bypass applyPromptCaching pass cacheControl explicitly.

The guard in applyPromptCaching now only checks messages (for external callers
that pre-place breakpoints), not system/tool blocks.

Also removes dead hasCacheControlInBlocks function.

Introduced by: e7daffdda (feat: Claude fingerprint hardening)
Verified: cache hit rate restored from 20.8% to 99.3%.
2026-03-02 13:24:16 +01:00
HvC 28d9de74ce Implement Windows Sixel support and terminal capability checks (#241)
* windows sixel imp

* windows sixel imp, terminal capability check, pessimistic sixel selection

* fix codex suggestions

---------

Co-authored-by: Brit <lol@no.com>
2026-03-01 22:23:05 +01:00
can1357 9af71f5f61 feat(oauth-flow): enabled Codex identity for OAuth client registration
- Updated OAuth client name from 'oh-my-pi MCP' to 'Codex' for dynamic client registration.
- Added test coverage for OAuth client registration with Codex identity.
2026-03-01 20:51:51 +01:00
can1357 4e0f8aace0 fix(coding-agent): corrected exit_plan_mode to abort turn before approval
- Fixed exit_plan_mode handler to abort active agent turn before opening plan approval selector, ensuring proper session cleanup.
- Added test to verify abort is called before handleExitPlanModeTool in exit_plan_mode event handling.
2026-03-01 20:29:31 +01:00
luke 204f565f11 feat(coding-agent): add Kagi web search provider (#238)
- Add KagiProvider implementation (Search API v0)
- Register kagi in SearchProviderId type, provider map, and fallback order
- Add kagi to tool schema enum, SearchParams type, and settings UI
- Register KAGI_API_KEY in service provider map
- Update CHANGELOG
2026-03-01 19:40:40 +01:00
can1357 f1a63a5ed1 refactor(coding-agent/cli): restructured agents unpack to support user and project directories
- Replaced `getConfigDirs()` with `getAgentDir()` to resolve user agent directory at `~/.omp/agent/agents` by default.
- Added `--user` and `--project` flags to control target directory, with `--project` exporting to `./.omp/agents`.
- Updated help text and examples to document the new directory resolution behavior.
2026-03-01 15:51:11 +01:00
can1357 c87e909ea9 feat(coding-agent/cli): added agents unpack command to export bundled subagents
- Implemented `omp agents unpack` CLI subcommand to write bundled agent definitions to the local .omp/agents directory. Added support for --force flag to overwrite existing files and --dir flag to specify custom output directory. Integrated agents command into CLI router with JSON output option for programmatic use.
2026-03-01 15:49:20 +01:00
can1357 a21533de79 fix(coding-agent/web): improved retry logic for Gemini API with rate limit budgeting
- Added exponential backoff retry mechanism with configurable max retries for transient failures. Implemented rate limit budget tracking to prevent excessive delays on 429 responses. Fixed HTTP status propagation to prevent network errors from being retried when explicit HTTP failures occur.
2026-03-01 15:46:35 +01:00
can1357 4ae3568947 Merge branch 'fix/gemini-429-rotation' 2026-03-01 15:45:21 +01:00
can1357 d8d9a89d58 feat: stop passing AGENTS.md to subagents
Fixes #233
2026-03-01 15:44:55 +01:00
can1357 2551dc04a2 feat(mcp): added MCP OAuth server metadata discovery with header parsing
- Added `authServerUrl` field to `AuthDetectionResult` to capture MCP OAuth server metadata.
- Added `extractMcpAuthServerUrl()` function to parse and validate `Mcp-Auth-Server` header URLs from OAuth errors.
- Enhanced `discoverOAuthEndpoints()` to accept optional `authServerUrl` parameter and query `/.well-known/oauth-protected-resource` endpoint.
- Improved OAuth metadata extraction to handle multiple `clientId` field variations (`clientId`, `default_client_id`, `public_client_id`).
- Extracted metadata parsing logic into reusable `findEndpoints()` helper function supporting multiple OAuth metadata formats.
- Added comprehensive test coverage for OAuth endpoint discovery, header parsing, and error validation.

Fixes #235
2026-03-01 15:26:52 +01:00
n24q02m 06e25f0952 fix: revert aggressive rate limit rotation (Option A) 2026-03-01 17:58:26 +07:00
can1357 05ffa7ede1 fix(coding-agent): normalize Exa MCP tool payload parsing
Fixes #229
2026-03-01 11:36:34 +01:00
can1357 6c55076fe4 docs(coding-agent/prompts): removed incorrect indentation example from hashline documentation
- Deleted the 'Bad' example that incorrectly demonstrated guessing indentation as spaces instead of using actual tabs.
- Kept the 'Good' example that correctly shows using real tab characters in JSON to match file indentation.
2026-03-01 11:32:30 +01:00
can1357 49f37ef257 fix(ai): corrected tool argument coercion for malformed JSON with trailing braces
- Fixed tool argument coercion to handle malformed JSON with trailing wrapper braces by parsing leading JSON containers.
- Relaxed JSON detection heuristics to check only leading braces instead of requiring matching closing braces.
- Added test case for array strings with trailing wrapper braces from nested JSON malformation.
2026-03-01 11:29:58 +01:00
can1357 81f718d5ef feat(coding-agent): enabled AST tools auto-inclusion and AbortSignal cancellation
- Added auto-inclusion of ast_grep and ast_edit tools when their text-based counterparts are enabled.
- Made AST tool recommendations conditional in bash tool prompt based on session availability.
- Replaced timeout-based cancellation with AbortSignal-based cancellation in ask tool.
- Added auto-correction of escaped tab indentation in edits via PI_HASHLINE_AUTOCORRECT_ESCAPED_TABS environment variable.
- Added warning detection for suspicious Unicode escape placeholder in edit content.
2026-03-01 11:27:07 +01:00
n24q02m b235754182 fix(ai, coding-agent): robust 429 handling and smart backoff for Google Gemini
- Add `rate-limit-utils.ts` to classify 429/503 errors (Quota, Rate Limit, Capacity)
- Fix `google-gemini-cli` to fail-fast on 429s instead of getting stuck in internal retries
- Update `isUsageLimitErrorMessage` regex in `AgentSession` to catch all Google-specific error variations
- Implement smart backoff timings (30m for quota, 30s for rate limit, 45s+jitter for capacity)
- Remove 0% hiding logic in `/usage` to always display account rotation pool
- Add comprehensive unit tests for rate limit parsing and provider behavior
2026-03-01 17:22:57 +07:00
can1357 5347d89e76 fix(coding-agent): corrected variable initialization order in formatPromptContent
- Corrected variable initialization order in formatPromptContent to prevent stale trimmedStart value when ASCII symbol replacement occurs.
- Updated bash.md documentation to use ellipsis (...) instead of three dots (...) for consistency with ASCII symbol replacement behavior.
- Added test case verifying table row compaction and content deduplication during pre-render with ASCII symbol replacement.
2026-03-01 11:21:17 +01:00
can1357 1643cd4673 feat(ask): migrated ask tool to AbortSignal-based cancellation for unified abort handling
- Replaced timeout-based cancellation with AbortSignal-based cancellation in ask tool for unified abort handling.
- Added signal parameter to UIContext select() and input() methods to support external cancellation propagation.
- Fixed race condition in dialog overlay handling by replacing direct resolve() calls with settled flag wrapper.
- Added comprehensive test coverage for ask tool cancellation behavior across user-initiated and timeout scenarios.
2026-03-01 11:19:32 +01:00
can1357 3321cb8061 feat(coding-agent): enforced tool decision requirement in plan mode
- Enforced tool decision in plan mode--agent now requires calling either `ask` or `exit_plan_mode` when a turn ends without a required tool call.
- Fixed cancellation behavior of `ask` tool to abort the current turn instead of returning a normal cancelled selection, while timeout-driven auto-cancel still returns without aborting.
- Added plan-mode-tool-decision-reminder system prompt to guide agent when required tools are not called.
- Improved agent_end event handling to use fallback assistant message when #lastAssistantMessage is unavailable.
2026-03-01 11:16:54 +01:00
can1357 8663794c56 feat(coding-agent): added escaped tab auto-correction and Unicode escape detection
- Added auto-correction for escaped tab indentation in edits via PI_HASHLINE_AUTOCORRECT_ESCAPED_TABS environment variable.
- Added warning detection for suspicious Unicode escape placeholder \uDDDD in edit content.
- Clarified hashline documentation that \t in JSON represents real tab characters, not literal backslash-t strings.
- Added comprehensive test coverage for escaped tab auto-correction and Unicode escape detection.
2026-03-01 10:59:15 +01:00
can1357 93f1682ab4 docs(coding-agent/prompts): clarified plan mode constraints with template variables
- Clarified plan mode constraints and tool invocation patterns with template variables for dynamic tool names.
- Improved readability of critical directives by converting bullet points to parallel grammatical structure.
- Replaced hardcoded tool names (ask, exit_plan_mode) with template variables ({{askToolName}}, {{exitToolName}}) for flexibility.
2026-03-01 10:40:29 +01:00
can1357 c8324d1284 chore: disable exp. checkpoint tool by default 2026-03-01 09:59:58 +01:00
can1357 70de19815e feat(coding-agent): introduced checkpoint/rewind tools for context cost optimization
- Added checkpoint and rewind tools to create context checkpoints before exploratory work and rewind to replace exploration messages with concise reports.
- Added checkpoint.enabled setting to control availability of checkpoint and rewind tools in agent sessions.
- Added getCheckpointState() and setCheckpointState() methods to agent session API for checkpoint state management.
- Implemented checkpoint state tracking with message count, entry ID, and timestamp to enable context cost optimization during investigations.
2026-03-01 09:42:02 +01:00
can1357 1c30f5c972 feat: introduced render_mermaid tool for ASCII diagram output
- Added render_mermaid tool to convert Mermaid diagrams to ASCII output with configurable rendering options.
- Added renderMermaid.enabled setting to control availability of the render_mermaid tool.
- Changed Mermaid rendering from PNG terminal graphics to ASCII text format across theme and TUI components.
- Migrated mermaid utilities from pi-tui to pi-utils package with new ASCII rendering functions.
- Removed PNG-based mermaid rendering APIs (getMermaidImage, renderMermaidToPng) in favor of ASCII alternatives.
2026-03-01 09:40:57 +01:00
can1357 0fbd76d3fa feat(coding-agent/modes): added debug transcript export command to dump visible TUI conversation
- Added transcript export option to debug menu that writes visible TUI conversation to a temporary text file.
- Implemented handleDebugTranscriptCommand in CommandController to render chat messages, strip ANSI codes, and write to temp directory.
- Updated InteractiveModeContext interface and InteractiveMode to expose the new debug transcript command handler.
2026-03-01 08:53:49 +01:00
can1357 971f34f56b docs(coding-agent): documented hashline tool JSON safety requirements and helper
- Added `hlinejsonref` Handlebars helper for embedding hashline references inside JSON blocks in prompts.
- Enhanced hashline tool documentation with explicit prohibition on formatting-only edits.
- Added mandatory rule requiring indentation in `lines` to match surrounding context exactly from `read` output.
- Updated all hashline examples to use `hlinejsonref` instead of `hlineref` for JSON-safe references.
2026-03-01 08:09:24 +01:00
can1357 62004d9954 feat(coding-agent): introduced librarian and oracle agents with expanded tool support
- Added librarian and oracle agents for library research and technical diagnostics.
- Expanded tool support across explore, plan, and reviewer agents with lsp, fetch, web_search, and ast_grep.
- Added dependencies and risks output fields to explore agent for enhanced analysis.
- Renamed explore agent output field from query to summary with expanded description.
2026-03-01 06:06:15 +01:00