Commit Graph

2669 Commits

Author SHA1 Message Date
can1357 e8eed16c1e chore: reformat 2026-03-17 14:52:06 +01:00
slact 2825c894f5 feat: session deletion (#448)
* feat: session deletion

* better session deletion cleanup error handling

* fix: complete deletion including artifacts
fix: native confirmation for session deletion

* even better native configmation for session picker

* fix(coding-agent): detach active session before deletion

* fix(coding-agent): keep failed session deletes visible

* fix(coding-agent): await session delete command

* fix(coding-agent): surface session artifact cleanup failures

---------

Co-authored-by: can1357 <me@can.ac>
Co-authored-by: Can Bölük <can1357@users.noreply.github.com>
2026-03-17 14:51:21 +01:00
Dragoy 5520eac002 fix(storage): support SQLite 3.37 without unixepoch (#451)
* fix(storage): support SQLite 3.37 without unixepoch

* fix(history): recreate index after migration
2026-03-17 14:50:32 +01:00
maximhar e27ceb2f96 fix: persist MCP discovery tool selections across session lifecycle (#453)
* fix: persist MCP discovery selections across session lifecycle

* fix: restore MCP discovery state on branch switches

* fix: preserve explicit MCP baseline on old branch contexts

* fix(coding-agent): preserve cleared MCP selections on resume

* fix(coding-agent): isolate MCP defaults across session switches

* fix(coding-agent): preserve MCP defaults across outages

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-17 14:49:54 +01:00
maximhar 571510bdf3 fix: MCP OAuth exact redirect URIs for Slack-style providers (#454)
* Add exact MCP OAuth redirect URI support

* Allow proxied HTTPS loopback MCP redirects

* Fix MCP OAuth busy-port test determinism

* Make MCP OAuth redirect test deterministic

* fix(coding-agent): honor exact loopback redirect ports

* fix(coding-agent): expand env vars in standalone MCP oauth config

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-17 14:49:23 +01:00
can1357 1b256ab151 chore: bump version to 13.12.8 2026-03-16 16:06:16 +01:00
can1357 9148ec01ec feat(session-manager): added optional sessionDir with multi-root migration support
- Made sessionDir parameter optional in SessionManager.create(), forkFrom(), continueRecent(), and list() methods with automatic default computation.
- Updated SessionManager.getDefaultSessionDir() to accept optional agentDir parameter for custom sessions root configuration.
- Changed SessionManager.list() signature to require cwd parameter as first argument with sessionDir now optional.
- Implemented multi-root session migration support by replacing global migration state with per-root tracking and extracting session directory encoding logic.
- Added resolveManagedSessionRoot() function to determine if session directory is managed and extract its root.
2026-03-16 16:06:04 +01:00
can1357 2cc53e86f1 feat(coding-agent): required sessionDir parameter to enforce explicit session path resolution
- Made sessionDir parameter required in SessionManager.create(), continueRecent(), and forkFrom() methods.
- Added SessionManager.getDefaultSessionDir() static method to explicitly resolve canonical default session directory.
- Changed SessionManager.list() signature to accept sessionDir directly instead of computing from cwd.
- Fixed SDK-created default sessions to honor configured agentDir for session storage and symlink-equivalent path resolution.
2026-03-16 15:46:06 +01:00
can1357 78177af8bc feat(coding-agent): added symlink resolution and path alias handling for consistent directory behavior
- Added symlink and path alias resolution to session directory handling for consistent behavior across aliased home and temp directories.
- Improved status line path display to strip display roots using canonical path resolution, correctly handling symlink-equivalent directory aliases.
- Added support for quoted paths in grep, ast_grep, and find tools to properly handle directory names with spaces.
- Improved ast_grep error messaging when no matches found with parse errors to suggest narrowing path/glob or setting language.
- Extracted path utility functions (resolveEquivalentPath, normalizePathForComparison, pathIsWithin, relativePathWithinRoot) to shared utils package.
- Added comprehensive test coverage for symlink alias resolution in status line path rendering and session directory handling.
2026-03-16 15:24:18 +01:00
can1357 7d6c60f957 feat(tools): added quoted path support to grep, ast_grep, find, and ast_edit tools
- Added support for quoted paths in grep, ast_grep, find, and ast_edit tools to handle paths with spaces.
- Introduced normalizePathLikeInput() utility function for consistent path and glob parameter normalization across tools.
- Enhanced ast_grep error messaging to warn about parse issues and suggest narrowing path/glob or setting lang parameter.
- Added comprehensive tests for quoted path handling in grep, ast_grep, and find tools with pattern matching.
2026-03-16 14:26:22 +01:00
daandden b7978c9e0d feat: add undo action and fix hotkeys rendering (#438)
* Fix prompt action undo and hotkeys rendering

* Fix prompt action test typechecks

* Simplify undo and hotkeys PR

* Fix editor formatting
2026-03-16 14:05:21 +01:00
can1357 24ef2302ea chore: bump version to 13.12.7 2026-03-16 13:55:33 +01:00
can1357 620d1c4513 feat(agent): added prompt() overload and MCP type guard for safer session handling
- Added overload for `prompt()` method accepting string input with optional options parameter.
- Added type guard `supportsMCPToolDiscoveryExecution()` with `MCPDiscoveryExecutionSession` type predicate for safer session type narrowing.
- Added default parameter value to `refreshToolChoiceForActiveTools()` for improved robustness.
2026-03-16 13:50:30 +01:00
Chrys4lisfag 13148050da fix: extract timeout field from all MCP discovery providers (#443) 2026-03-16 13:44:55 +01:00
maximhar 94ad651d17 feat: add MCP tool discovery search (#352)
* Add MCP tool discovery search and live refresh

* Fix MCP discovery review feedback

* Address remaining MCP discovery review comments

* feat: compact MCP discovery search results

* fix: align MCP discovery search contract

* feat: add MCP server tool counts to discovery hints

* fix(agent): corrected stale toolChoice validation against active tools

- Fixed stale forced toolChoice passed to provider after mid-turn tool refresh by validating against active tools.
- Added refreshToolChoiceForActiveTools() to filter invalid tool choices when available tools change.
- Changed getToolChoice config to use computed function instead of static property for dynamic validation.
- Fixed MCP tool selection tracking in coding-agent to distinguish between discovery-enabled and non-discovery sessions.
- Updated search_tool_bm25 to filter already-selected tools before applying limit parameter.

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-16 13:43:43 +01:00
can1357 53a46d94d8 chore: bump version to 13.12.6 2026-03-15 23:54:36 +01:00
can1357 ab49511632 feat(coding-agent): implemented dynamic llama.cpp server capability detection
- Updated llama.cpp model discovery to read context window from the `/props` endpoint's `default_generation_settings.n_ctx` field instead of using hardcoded 128000 default.
- Updated llama.cpp model discovery to detect vision capabilities from the `/props` endpoint's `modalities.vision` field instead of defaulting to text-only input.
- Changed llama.cpp `maxTokens` calculation to respect discovered context window limits, capping at 8192 or the server's context window, whichever is smaller.
- Added `#toLlamaCppNativeBaseUrl()` helper to normalize llama.cpp base URLs by stripping `/v1` suffix for native endpoint access.
- Added 3 test cases to verify context window, vision capability, and authorization header handling in llama.cpp discovery.
2026-03-15 23:54:03 +01:00
can1357 26d874b372 chore: bump version to 13.12.5 2026-03-15 23:20:18 +01:00
daandden 70bf7bbed2 fix(coding-agent): preserve unconsumed inline args in template expansion (#314)
* docs: map existing codebase

* fix(coding-agent): preserve unconsumed inline args in template expansion

fixes #281

* chore: remove .planning codebase artifacts

* Match OpenCode command fallback behavior

* Format inline arg fallback changes

---------

Co-authored-by: Vũ Anh Nguyễn <vu.anh.nguyen@mgm-tp.com>
2026-03-15 23:07:35 +01:00
can1357 82b70ead61 feat(coding-agent): added Ollama context discovery and attribution control
- Added automatic Ollama model context window discovery from metadata for accurate token limits.
- Added `attribution` option to `PromptOptions` for explicit billing and initiator attribution control.
- Added automatic clearing of completed and abandoned todo tasks after ~1 minute.
- Changed session directory migration to use `-tmp-` prefix instead of double-dash format.
- Updated Ollama model registration to use discovered context window instead of hardcoded 128000 token default.

Fixes #440
2026-03-15 23:05:20 +01:00
can1357 bdcc08a50c feat(coding-agent/session): added automatic migration of legacy session directories
- Added automatic migration of legacy absolute-path session directories with double-dash format to new canonical locations.
- Enhanced session directory encoding to use `-tmp-` prefix for temporary directories instead of legacy double-dash format for improved clarity.
- Extracted session directory migration logic into reusable helper functions for better maintainability.
- Updated test setup to mock home directory and verify session migration behavior with temporary paths.
2026-03-15 22:56:18 +01:00
can1357 dbc1c4af1d feat(coding-agent): added attribution option to control billing and initiator tracking
- Added `attribution` option to `PromptOptions` for controlling billing and initiator attribution.
- Updated subagent prompts to explicitly set `attribution: "agent"` for accurate billing attribution.
- Refactored message attribution logic to use configurable `promptAttribution` with fallback defaults.
- Added test coverage for `attribution` option in subagent reminder prompts.
Fixes #439.

feat(coding-agent): added attribution option and explicit session directory control

- Added `attribution` option to `PromptOptions` for explicit billing and initiator attribution control.
- Updated `SessionManager.create()` to require both `cwd` and `sessionDir` parameters for explicit session directory control.
- Changed session directory naming for temporary working directories from `--` format to `-tmp-` prefix.
- Made `cwd` and `sessionDir` fields mutable in SessionManager to support session relocation.
- Fixed automatic migration of legacy session directories to new `-tmp-` prefixed naming scheme.
- Updated all test fixtures to pass both `cwd` and `sessionDir` parameters to `SessionManager.create()`.
2026-03-15 22:56:18 +01:00
luke c0f14aa248 feat(coding-agent): auto-clear completed todo tasks (#435)
- Schedule auto-removal of completed/abandoned tasks after ~1 minute delay
- Strip already-done tasks when restoring session from branch history
- Add todo_auto_clear event to trigger UI refresh on removal
- Add blank line before Todos header for visual spacing
2026-03-15 19:02:02 +01:00
can1357 3495c3d91a chore: bump version to 13.12.4 2026-03-15 18:41:15 +01:00
can1357 f953a036c5 feat(coding-agent): exposed settings in CustomToolContext for session configuration
- Exposed `settings` instance in `CustomToolContext` for session-specific configuration access.
- Improved artifact spill configuration to use session settings with schema defaults as fallback.
- Refactored type annotations and removed Required wrappers for better type safety in settings handling.
- Replaced AgentTool type with Tool type in tool registry for improved type consistency.
2026-03-15 18:39:58 +01:00
can1357 a2a07fbce0 chore: bump version to 13.12.3 2026-03-15 17:38:49 +01:00
can1357 fc9170b506 docs(modes): clarified UI descriptions to reference token counts instead of page estimates
- Updated UI descriptions for compaction and artifact settings to reference token counts instead of page/line estimates.
2026-03-15 17:38:22 +01:00
can1357 3f1d7c6882 test: isolated plugin discovery test with XDG_DATA_HOME environment variable
- Updated plugin extension discovery test to use XDG_DATA_HOME instead of HOME for environment isolation.
- Replaced manual path construction with getPluginsDir() utility for consistency.
- Added XDG directory structure setup and path cache rebuild to ensure correct plugin resolution.
2026-03-15 17:36:59 +01:00
can1357 99848563bb chore: bump version to 13.12.2 2026-03-15 17:29:51 +01:00
luke 552f8b743c feat(coding-agent): expand settings with token threshold and artifact spill options (#406)
- Add compaction.thresholdTokens as fixed token limit alternative to percentage
- Token limit takes priority over percentage when set; options from 25K-500K
- Add more artifact spill threshold options (1KB-1MB) with size descriptions
- Add more artifact tail bytes/lines options with descriptions
- Clean up stale duplicate schema entries from tab reorganization
- Fix statusLine.separator UI metadata

Co-authored-by: Can Bölük <can1357@users.noreply.github.com>
2026-03-15 17:27:39 +01:00
can1357 92c4ff99ff refactor(coding-agent/session): eliminated redundant guard in flush method
- Removed redundant early return guard in flush() method, relying on existing null check within queued task.
2026-03-15 17:26:53 +01:00
can1357 b8e82008e3 feat(coding-agent): added extension filtering and granular capability identification
- Added `toExtensionId()` method to all capability types for granular extension identification and disabling.
- Added `disabledExtensions` and `includeDisabled` options to LoadOptions for filtering disabled capabilities by extension ID.
- Added plugin manifest support for `extensions` entry points with automatic discovery from installed plugins.
- Fixed skill loading to properly respect disabled skill names from custom directories.
- Improved cross-platform path handling by using `path.basename()` instead of string splitting in context file and state manager.
- Refactored capability index loading to validate source metadata and filter disabled extensions before processing.
2026-03-15 17:26:46 +01:00
can1357 3e08186d3e feat(coding-agent): added disabledExtensions setting to filter skills
Fixes #413
2026-03-15 17:04:55 +01:00
can1357 3e58ad2165 feat(coding-agent/modes): simplified whitespace visualization logic in diff component
Fixes #430.
2026-03-15 16:59:53 +01:00
can1357 d469c2a96b chore: bump version to 13.12.1 2026-03-15 16:51:30 +01:00
can1357 1bad87167b fix: init-xdg help and platform message 2026-03-15 16:51:11 +01:00
can1357 31427a8eef feat(patch): implemented binary-safe file rename with move-only validation
- Added support for move-only file operations that preserve exact bytes including binary content and special characters.
- Added validation to reject move operations where source and destination paths are identical.
- Implemented dedicated move-only handler with parent directory creation and binary-safe file rename operations.
- Added error handling for move operations on non-existent source files.
2026-03-15 16:50:48 +01:00
can1357 07389a4da0 chore: reformat 2026-03-15 16:43:17 +01:00
can1357 7204e704fc perf(coding-agent/ipy): eliminated buffer allocation in WebSocket message encoding
- Optimized WebSocket message serialization by eliminating intermediate buffer allocation and using encodeInto for in-place encoding.
2026-03-15 16:42:41 +01:00
Variable Fate 1957c702a4 fix(move): resolve quoted Windows paths and fresh-session ENOENT (#416) (#418)
Two /move bugs on Windows:
1. Quoted absolute paths (e.g. /move "C:\...") were treated as relative
   because surrounding quotes weren't stripped before path.isAbsolute().
2. /move before any model response threw ENOENT because the session
   .jsonl file hadn't been created on disk yet (lazy-persist).

Changes:
- Extract stripOuterDoubleQuotes() helper in path-utils.ts, use in
  handleMoveCommand() with empty-after-strip guard
- Guard session file rename with existsSync in moveTo(), leaving
  artifact dir rename independently guarded
- Guard #rewriteFile() with hadSessionFile || hasAssistant to preserve
  lazy-persist while still updating header cwd for existing files
- Add comprehensive test suite (13 tests) covering all moveTo() edge
  cases including header-only sessions, deferred persistence, and
  artifact migration
2026-03-15 16:39:30 +01:00
汐 758acc6b53 fix(xdg): add darwin support (#412) 2026-03-14 16:04:07 +01:00
can1357 07e2dfbf0b chore: bump version to 13.12.0 2026-03-14 15:03:25 +01:00
can1357 ddaa15c66b chore: reformat 2026-03-14 15:03:07 +01:00
汐 2ae1a042d8 feat(utils): full XDG Base Directory support for all path helpers (#407)
* feat(utils): full XDG Base Directory support for all path helpers

Implement XDG-first resolution across all omp path helpers, extend the
migration command to cover every data/state/cache location, and fix
five data-safety issues found in review.

dirs.ts:
- Add getXdgCachePath() helper ($XDG_CACHE_HOME/omp/<subpath>)
- Add isDefaultAgentDir() helper: XDG lookup is only valid when the
  resolved agentDir equals the process default (~/.omp/agent); custom
  profiles set via PI_CODING_AGENT_DIR or setAgentDir() are never
  silently redirected to the global XDG database
- Update 15 functions to XDG-first resolution:
    data:  getPluginsDir, getRemoteDir, getRemoteHostDir, getPythonEnvDir,
           getWorktreeBaseDir
    state: getReportsDir, getSshControlDir, getCrashLogPath, getDebugLogPath
    cache: getPuppeteerDir, getGpuCachePath, getNativesDir
- Guard XDG lookup with isDefaultAgentDir(agentDir ?? getAgentDir()) in
  all 9 agent-subdir helpers so that callers passing the global default
  agentDir still resolve to the migrated XDG location, while callers
  passing a non-default agentDir or running under a custom profile via
  setAgentDir() bypass XDG entirely
- Plugin-derived helpers delegate to getPluginsDir() and follow XDG
  resolution automatically

migrate-xdg.ts:
- Add getXdgCacheHome() helper
- Extend MigrationItem.category to include 'cache'
- Add 12 new migration entries: reports, plugins, remote, ssh-control,
  remote-host, python-env, puppeteer, wt, gpu_cache.json, natives,
  omp-crash.log, omp-debug.log
- Refuse to run when PI_CODING_AGENT_DIR points to a non-default
  profile: migration only makes sense for the default ~/.omp/agent tree
- copyDirectory returns skipped source paths (target existed, non-force)
- verifyIntegrity: remove size-mismatch early-return that masked stale
  targets as successful copies
- executeMigration: delete only entries that were actually copied;
  use rmdir on source dir so it is removed only when empty, preserving
  any skipped files for a subsequent --force run
- executeMigration: rename partial target to <target>.bak on integrity
  failure instead of deleting; preserves pre-existing user data while
  preventing getXdgDataPath from treating the partial tree as
  authoritative; source remains intact for re-copy on next run

test isolation:
- Set XDG_DATA_HOME/XDG_STATE_HOME to non-existent paths in
  memories-runtime.test.ts beforeEach/afterEach to prevent
  getXdgDataPath/getXdgStatePath from resolving to real user data

* fix(utils,coding-agent): fix XDG support issues

dirs.ts:
- Refactor path resolution into DirResolver class. XDG base dirs are
  resolved once at construction from env vars (Linux only, no
  existsSync). setAgentDir creates a fresh instance, naturally
  invalidating all cached paths and recomputing isDefaultProfile.
- getRootSubdir/agentSubdir accept optional XdgCategory parameter;
  when set, the XDG base replaces the config root. Every accessor
  is a one-liner delegate.
- Non-Linux platforms: XDG fields are null, zero overhead. No
  filesystem probing, no string comparisons on the hot path.
- Config-only subdirs (themes, tools, commands, prompts, modules)
  have no XDG category — they stay under the config root.
- Remove `import { env } from 'bun'`, use process.env consistently.
- Restore JSDoc comments to document actual defaults (~/.omp/...).

migrate-xdg.ts:
- Gate migrateToXdg on Linux — exits with clear error on other
  platforms.
- Fix data loss bug: verifyIntegrity now accepts a Set of skipped
  paths and skips verification for files that were intentionally not
  copied (pre-existing at target in non-force mode).
- Fix nested directory source deletion: recursive removeSourceEntries
  walks the tree and only deletes files not in the skipped set.
- Remove dead _sourcePath variable and unused force parameter from
  verifyIntegrity.
- Remove `import { env } from 'bun'`, use process.env consistently.

logger.ts:
- Revert JSDoc to document ~/.omp/logs/ as default.

oauth.ts:
- Replace direct getAgentSubdir call with getTestAuthPath().

CHANGELOG.md:
- Merge duplicate section headers under [Unreleased].
- Add missing blank line before [13.11.1].

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-14 14:52:12 +01:00
can1357 149f787fae feat(coding-agent): enabled per-rule interrupt mode overrides via frontmatter
- Added per-rule `interruptMode` override capability to TTSR interrupt logic via optional frontmatter field.
- Changed interrupt behavior to respect per-rule `interruptMode` settings with fallback to global `ttsr.interruptMode` configuration.
- Extended `Rule` and `RuleConfig` interfaces with optional `interruptMode` property for granular control.
- Updated rule discovery to extract and validate `interruptMode` from frontmatter with proper enum type checking.
2026-03-14 14:13:09 +01:00
can1357 2a20bd302e feat(ai): support extra body fields in openai-completions requests
Fixes #363
2026-03-14 13:52:12 +01:00
can1357 8f18464cd7 feat(config): reorganized settings into 8 focused categories with 15+ new customization options
- Reorganized settings tabs from 12 to 8 focused categories (appearance, model, interaction, context, editing, tools, tasks, providers) with consolidated status line settings.
- Added 15+ new settings for status line customization, sampling parameters, speech-to-text, web search, and edit mode configuration.
- Changed default agent model from `default` to `pi/task` for independent subtask configuration and updated model resolution to support single-pattern inheritance fallback.
- Updated system prompt to use ISO 8601 date format (YYYY-MM-DD) and renamed 25+ UI labels for consistency across settings interface.
- Updated tab icon symbols across unicode, nerd, and ASCII presets to reflect new tab organization.
- Simplified settings definitions and removed unused imports to reduce code complexity.
2026-03-14 13:44:20 +01:00
can1357 090a9cd14c feat(coding-agent): enabled task model role configuration for independent subtask execution
- Added task model role configuration enabling dedicated subtask execution with independent model selection.
- Changed default agent model from 'default' to 'pi/task' for independent subtask model configuration.
- Added single-pattern inheritance fallback allowing pi/task agents to inherit session model when unconfigured.
- Refactored model resolution logic into resolveAgentModelPatterns() function with structured fallback handling.
- Added resolveConfiguredModelPatterns() and helper functions for improved model pattern resolution.
2026-03-14 13:38:30 +01:00
can1357 b5faa7d4be feat(coding-agent): added cursor navigation to message boundaries
- Added `moveCursorToMessageStart()` and `moveCursorToMessageEnd()` prompt actions for cursor navigation to message boundaries.
- Exposed editor methods for cursor movement to message start and end positions in InputController keybindings.
- Implemented message boundary navigation in Editor class with private helper methods for cursor positioning.
- Removed remote compaction settings test suite to align with feature deprecation.
2026-03-14 13:38:29 +01:00
can1357 ca2860b200 feat: added OpenAI compatibility config and 10 new AI models with reasoning support
- Added support for provider-level OpenAI compatibility configuration enabling reasoning effort mapping and streaming usage fallback across models.
- Added 10 new AI models (DeepSeek V3.2, Llama 3.1 405B, Mistral Large 3, Pixtral Large, and others) with updated pricing and context windows.
- Fixed autocomplete to preserve ./ prefix in relative file/directory path completions and paste marker expansion to handle regex tokens literally.
- Changed system prompt date format to ISO 8601 and tool download timeout from 15s to 120s for improved cross-platform compatibility.
- Refactored OpenAI completions provider to extract token parsing logic and support choice-level usage fallback with improved message serialization.
2026-03-14 13:38:29 +01:00