Commit Graph

71 Commits

Author SHA1 Message Date
can1357 57b5a7e8cb fix(coding-agent/modes): used expanded editor text for input handling when available
- Updated input handling to call getExpandedText when available and fall back to getText.
2026-04-24 09:54:10 +02:00
can1357 5caddcebd6 feat(cross-cutting): added fd crate export and moved fuzzy-find bindings
- Removed `SearchDb` APIs and `searchDb` fields, dropping db-backed state from native and agent sessions.
- Replaced crate export `fff` with `fd`, moving fuzzy-find bindings into `fd.rs`.
- Removed `SearchDb`/picker fast-path logic from `glob` and `grep`, simplifying scan flow and dropping db args.
- Removed `SearchDb`/`getSearchDb` wiring from extension, tool, and task context constructors across coding-agent.
- Added over-indentation validation warnings in chunk-edit normalization for suspicious `~` body line formatting.
- Removed `bytes`, `fff-grep`, `fff-search`, and `blake3` deps, adding `grep-searcher = "0.1"`.
2026-04-13 21:25:50 +02:00
can1357 11b7ba7846 fix(coding-agent): respected session title source when formatting terminal titles
- Propagated session title source through terminal-title update calls so auto and user names are handled consistently across controllers.
- Suppressed auto-generated names in status-line segments and completion messages by falling back to cwd-based titles.
- Updated title formatter tests to verify auto-generated and user-specified session titles produce different terminal labels.
2026-04-13 06:22:37 +02:00
Christoph Gross 09810120ba feat(coding-agent): add /rename command with session accent coloring
- Add /rename <title> slash command to set an explicit session name,
  updating the session header, terminal tab title, and status line
- Add session_name status segment: displays the session name on the
  right side of the status bar with a stable djb2-hash-derived accent
  color unique to each name; shown in all presets when a name is set
- Add setSessionName source tracking ('user' vs 'auto'): auto-generated
  titles are silently ignored once the user has explicitly set a name,
  preventing the async title generation from overwriting a /rename
- Sanitize session names at storage time: strip C0/C1 control characters
  (including ANSI ESC) via static #sanitizeName before storing, blocking
  escape sequence injection into the TUI, terminal title, and session file
- Extend sanitizeStatusText to cover the full C0/C1 range as
  defense-in-depth (superset of the previous \r\n\t-only strip)
- Use stored (sanitized) name for showStatus message and terminal title
  in handleRenameCommand, not the raw user input
- Guard terminal title update in auto-title path via titleSource === 'auto'
  so a user rename is never overwritten by a late-resolving LLM call
- Reset #titleSource in #newSessionSync so each new session starts fresh
- Thread source parameter through AgentSession.setSessionName wrapper;
  extension API and RPC set_session_name treated as 'user' intent

Closes #658
2026-04-11 13:49:01 +02:00
can1357 ad9bc6943a feat(slash-commands): enabled slash commands to return remaining text as prompt input
- Enhanced slash command handlers to return remaining text as prompt input instead of consuming input entirely.
- Updated slash command parser to recognize both whitespace and colon (`:`) as command argument separators.
- Modified executeBuiltinSlashCommand return type to support string (remaining text) or boolean (consumed/not matched).
- Updated input controller to handle remaining text from slash commands and use it as prompt input.
2026-04-08 20:57:25 +02:00
can1357 211e5369a0 refactor(coding-agent): migrated image utilities to shared pi-utils package
- Extracted image metadata detection and MIME type utilities to @oh-my-pi/pi-utils package for shared use across projects.
- Consolidated image-input.ts and mime.ts modules into image-loading.ts with simplified API removing redundant metadata parameters.
- Updated all import paths across coding-agent to use readImageMetadata from @oh-my-pi/pi-utils instead of local utilities.
- Added peek-file utility module to @oh-my-pi/pi-utils with buffer pooling for efficient file header reading.
2026-04-08 14:42:51 +02:00
can1357 9b78a6fa85 refactor(natives): migrated native bindings to NAPI-RS with auto-generated types
- Migrated native bindings from TypeScript wrappers to NAPI-RS generated modules with auto-generated type definitions and runtime enums.
- Replaced chunk tree API with stateful ChunkState class supporting render, edit, and resolve operations with improved error handling.
- Converted callback signatures to error-first pattern (error, result) for shell, PTY, glob, and grep operations.
- Introduced type-safe enums for MacOSAppearance, GrepOutputMode, KeyEventType, ImageFormat, and AstMatchStrictness replacing string literals.
- Refactored chunk tree implementation with dedicated modules for edit, indent, resolve, and state management with comprehensive validation.
- Moved clipboard utilities from native bindings to coding-agent package with improved OSC 52 and Termux compatibility.
2026-04-07 02:00:59 +02:00
Patrik Sundberg 4d641a52b4 feat(coding-agent): add session observer (Ctrl+S) to view subagent sessions
Wire EventBus through task runtime so subagent lifecycle and progress
events propagate to the TUI. Add SessionObserverRegistry to track
active sessions, and a session observer overlay accessible via Ctrl+S
that shows a picker of running subagents and a read-only transcript
viewer that reads the subagent's session JSONL file to display
thinking, text, tool calls, and results.

- Add TASK_SUBAGENT_LIFECYCLE_CHANNEL for start/end events
- Add SubagentProgressPayload.sessionFile for session file tracking
- Pass eventBus through sdk.ts -> main.ts -> InteractiveMode
- SessionObserverRegistry with multi-listener onChange pattern
- Overlay picker preserves selection position across live refreshes
- Viewer renders full transcript from session JSONL (thinking, text,
  tool calls with smart arg summaries, inline tool results)
2026-04-04 15:53:31 +02:00
can1357 49cb500175 feat(pi-natives): added unified picker coordination for file search operations
- Added `wait_for_picker_scan()` function to search_db module with cancellation token support for polling picker scan completion.
- Integrated picker-based file search into glob matching logic with `collect_files_from_picker()` helper to reuse shared SearchDb picker results.
- Refactored fff and grep modules to use centralized `wait_for_picker_scan()` wrapper instead of direct FilePicker calls, improving cancellation handling.
- Propagated SearchDb instance through agent session initialization and input controller to enable unified file picker coordination across search operations.
2026-03-27 11:40:50 +01:00
can1357 1d565bc3f7 Merge review/pr-477-fix 2026-03-26 19:14:52 +01:00
daandden 6ea9504b03 Make temporary model selector keybinding configurable (#539)
Fixes #533
2026-03-26 15:33:26 +01:00
iter 978f56121a Normalize pasted image formats before attach (#543)
Co-authored-by: iter <itertoolz@gmail.com>
2026-03-26 15:28:04 +01:00
Leo P afdfe24ea3 cleanup 2026-03-23 08:54:54 -04:00
Leo P e265c20d58 WIP 2026-03-23 08:54:54 -04:00
can1357 7fb18faf4c fix(coding-agent): backported pi-mono changes (1feccfed..b21b42d0)
packages/ai:
- feat: expose provider responseId on AssistantMessage
- feat: lazy-load provider modules for faster startup
- fix: hash foreign Responses API tool call IDs exceeding 64-char limit
- fix: ignore null chunks in openai-completions streams
- fix: keep image tool results inline for Gemini 3+ and Antigravity
- fix: correct Bedrock Claude 4.6 context window to 200k
- fix: support prompt caching for Bedrock application inference profiles
- fix: add OpenRouter reasoning payload format
- fix: ignore placeholder Vertex API keys
- fix: skip AJV validation in restricted runtimes
- fix: Anthropic OAuth client injection and responseId extraction
- fix: Codex incomplete/failed response status handling

packages/agent:
- fix: defer steering until after tool execution completes

packages/tui:
- feat: namespaced keybinding IDs with KeybindingsManager conflict detection
- feat: configurable select list column sizing (#2154 by @markusylisiurunen)
- fix: stream truncateToWidth for large strings
- fix: skip Termux height redraws
- fix: stop evicting unrelated default keybindings
- fix: resolve raw backspace ambiguity on Windows Terminal
- fix: clear stale scrollback on session switch (#2155 by @Perlence)
- fix: remove trailing markdown block spacing (#2152 by @markusylisiurunen)

packages/coding-agent:
- feat: add resizable share sidebar (#2435 by @dmmulroy)
- feat: emit OSC 133 command-executed marker
- feat: reload custom themes from disk watcher
- feat: add --fork session flag
- feat: file mutation queue for serialized writes
- feat: initial message consolidation utility
- fix: keybindings migrated to namespaced IDs
- fix: resolve waitForRetry() race when auto-retry produces tool calls
- fix: handle slash-delimited /model refs
- fix: refresh active model after provider updates
- fix: extended transient error patterns for retry
2026-03-22 18:28:40 +01:00
can1357 20cdf31b9f feat: display session title in terminal tab
fixes #461
2026-03-18 22:46:22 +01:00
can1357 fb76484aa4 fix: route all app-level shortcuts through KeybindingsManager
fixes #468
2026-03-18 22:46: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 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
AK 226133712b fix(coding-agent) Restrict automatic session title generation to the resolved smol model only. (#409)
* fix(coding-agent)

* edit: prefer smol title model with current-model fallback
2026-03-14 13:16:28 +01:00
maximhar 952db9fd93 feat: add ephemeral /btw side-question panel (#399)
* feat: add ephemeral /btw side-question panel

* fix: preserve /btw live context and payload hooks

* fix: send /btw question through session pipeline
2026-03-14 10:42:26 +01:00
can1357 08a4fe78a2 fix(coding-agent/modes): corrected role model cycling order to [smol, default, slow]
- Corrected role model cycling order from [slow, default, smol] to [smol, default, slow] to match expected progression.
2026-03-11 00:21:51 +01:00
can1357 4ed4cfb27c fix: honor per-role thinking in modelRoles helpers
Fixes #186
2026-03-11 00:03:48 +01:00
can1357 f256376e90 feat(coding-agent): added cancellation support for pending user submissions
- Introduced SubmittedUserInput type to track submission state including cancelled and started flags. Added startPendingSubmission, cancelPendingSubmission, markPendingSubmissionStarted, and finishPendingSubmission methods to manage the lifecycle of user input submissions. Enhanced escape key handling to prioritize canceling pending optimistic submissions before aborting active sessions.
2026-03-10 06:25:38 +01:00
can1357 e019a3e352 refactor(coding-agent): restructured loading animation lifecycle into ensureLoadingAnimation
- Extracted loading animation lifecycle management into centralized ensureLoadingAnimation() method.
- Consolidated duplicate loading animation setup across event-controller and interactive-mode into single reusable method.
- Updated showError() to properly clean up loading animation state when errors occur.
- Added comprehensive test coverage for InputController escape key behavior with optimistic submission.
2026-03-10 05:51:09 +01:00
ravshansbox c4715a918a Fix delayed display of submitted user messages (#312) 2026-03-10 02:42:46 +01:00
can1357 aa18e3f26d feat: add hash prompt actions
Fixes #283
2026-03-09 15:38:39 +01:00
can1357 8e3e0ebf9e feat: introduced Effort enum and ThinkingConfig for model-aware reasoning
- Introduced Effort enum and ThinkingConfig metadata for per-model reasoning capabilities with min/max effort levels.
- Migrated thinking level API from string-based ThinkingLevel to structured Effort enum across agent and AI packages.
- Added model-thinking module with effort mapping, policy application, and semantic versioning utilities for provider-specific thinking modes.
- Removed supportsXhigh() function and replaced effort clamping with model-aware validation using ThinkingConfig metadata.
- Expanded models.json with thinking configuration objects for 50+ models including Claude, Gemini, and OpenAI variants.
- Added Python analysis scripts for edit tool usage patterns and tool invocation stream processing.
2026-03-06 12:35:01 +01:00
can1357 894bfe5a71 fix(coding-agent): implemented Bun version validation
- Added Bun version validation at startup to enforce minimum version 1.3.7 for JSONL session parsing.
- Fixed `/resume` and `--resume` flags silently failing on older Bun runtimes by adding version check.

Fixes #277
2026-03-04 02:34:30 +01:00
can1357 16f643ed3c refactor(clipboard): restructured clipboard copy to synchronous execution
- Converted clipboard copy operation from async to synchronous execution across native and TypeScript layers.
- Simplified copy_to_clipboard return type from task::Async<()> to Result<()> in Rust implementation.
- Removed promise chains and async/await from clipboard handlers in command and input controllers.
- Updated clipboard module documentation to explain synchronous execution avoids AppKit pasteboard warnings.
- Reordered fix:rs script to run cargo fmt before cargo clippy for consistent formatting.
2026-03-04 01:51:23 +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
can1357 c0912708c1 refactor(coding-agent): centralized builtin slash command registry 2026-02-16 19:36:56 +01:00
can1357 262ca202a7 fix(coding-agent): use /changelog full subcommand instead of --full flag 2026-02-16 19:24:08 +01:00
can1357 f399b8e323 fix(coding-agent): fixes for PRs 80, 82, 85
- Parse --full as exact token in /changelog command
- Scope MCP disabled list to discovered servers only
- Guard malformed disabledServers config field
- Parse regex literal /pattern/flags syntax in secret entries
- Prevent infinite loop on zero-length regex matches
- Replace longer plain secrets before shorter prefixes
- Default secrets.enabled to false
2026-02-16 19:23:37 +01:00
can1357 647a688d24 Merge branch 'pr-85'
# Conflicts:
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/README.md
2026-02-16 19:19:52 +01:00
can1357 0419a9e01f feat(coding-agent/lsp): fixed LSP cancellation with abort signal support for file operations and requests
- Added abort signal support to LSP file operations (ensureFileOpen, refreshFile) enabling cancellation of long-running file operations.
- Added abort signal propagation through LSP request handlers (definition, references, hover, symbols, rename) with $/cancelRequest notification support.
- Added shouldBypassAutocompleteOnEscape callback to custom editor allowing parent components to override escape key handling behavior.
- Changed escape key handling in custom editor to respect bypass callback, enabling global escape handling during active operations.
- Fixed LSP operations to properly handle abort signals and throw ToolAbortError when operations are cancelled, with input controller bypassing autocomplete during streaming/loading states.
2026-02-16 18:33:04 +01:00
tctev 8b293edc30 feat: add pagination to /changelog command with --full flag 2026-02-16 11:12:33 +01:00
can1357 d1f41ae553 merge: PR #51 — speech-to-text with Alt+H (closes #51)
- Moved /stt slash command to 'omp setup stt' CLI command
- Fixed pip install blocking TUI (sync -> async)
- Fixed 'Transcribing...' status not clearing after success
2026-02-15 10:30:47 +01:00
daaximus 6969076386 feat(coding-agent): add speech-to-text with Alt+H keybinding
Cross-platform audio recording with automatic tool detection and
fallback chain (SoX > FFmpeg > arecord > PowerShell mciSendString).
Transcription via Python openai-whisper with automatic pip install
on first use.

Recording:
- SoX with explicit waveaudio device on Windows (-t waveaudio 0)
- FFmpeg with auto-detected dshow device name on Windows
- arecord for ALSA on Linux
- PowerShell mciSendString as zero-dependency Windows fallback
- Process health check after spawn, graceful stop for FFmpeg/PS
- Fallback chain: if one tool fails, tries the next automatically

Transcription:
- Python openai-whisper as primary backend (pip install openai-whisper)
- Custom WAV loader in transcribe.py using Python wave module
- Resamples to 16kHz mono via numpy (no ffmpeg dependency)
- Passes float32 numpy array directly to whisper.transcribe()
- 120s timeout with process kill guard

TUI integration:
- Alt+H keybinding to toggle recording (configurable in keybindings)
- /stt command with on|off|status|setup subcommands
- Status line segment showing REC/STT state
- Transcribed text inserted directly into editor prompt
- Lazy controller instantiation on first use

Settings:
- stt.enabled (default: false)
- stt.language (default: en)
- stt.modelName (default: base.en)

New files: packages/coding-agent/src/stt/{downloader,index,recorder,
setup,stt-controller,transcribe.py,transcriber}.ts
2026-02-15 10:23:48 +01:00
can1357 eaf267b867 fix(coding-agent): sanitized clipboard copy preview text for TUI display 2026-02-15 09:53:18 +01:00
Scott Hyndman be20f44edb feat(tui): Added Alt+Shift+C keyboard shortcut to copy prompt to clipboard 2026-02-15 09:53:17 +01:00
can1357 4571e505d9 feat(coding-agent): implemented codex-style memory system with two-phase extraction and consolidation pipeline
- Added autonomous memory extraction and consolidation system with two-phase pipeline for extracting durable knowledge and consolidating into reusable skills.
- Added /memory slash command with subcommands (view, clear, reset, enqueue, rebuild) for inspecting and managing memory maintenance.
- Added configurable memory settings including concurrency limits, lease timeouts, token budgets, and rollout age constraints.
- Added memory injection payload that includes learned context in system prompts with operational rules for reading and using memory artifacts.
- Improved system prompt building to support memory guidance injection and enhanced error handling in resolvePromptInput function for multiline input.
2026-02-14 02:02:48 +01:00
can1357 df7a45b774 feat(coding-agent): added /move command to relocate sessions to different working directories
- Added /move slash command to allow users to relocate sessions to different working directories.
- Added moveTo() method to SessionManager for programmatic session relocation with file system operations and rollback support.
- Added refreshSlashCommandState() method to InteractiveMode for dynamic slash command reloading when changing directories.
- Added setSlashCommands() method to AgentSession to allow external management of file-based slash commands.
- Added handleMoveCommand() handler in command-controller to process /move commands with validation and error handling.
2026-02-12 02:38:59 +01:00
can1357 4da2acbee4 fix(coding-agent): addressed review findings for runtime MCP support
- Removed unsafe OAuth endpoint extraction from error message text
- Fixed PKCE verifier storage with typed #codeVerifier field
- Fixed refresh token fallback using access token as refresh token
- Enforced restrictive file permissions (0o700/0o600) for MCP configs
- Fixed wizard buildConfig() to respect user-chosen env var and header names
- Fixed reauth endpoint discovery for non-OAuth servers
- Stored original config on connection, resolved config only for transport
- Added runtime type validation for enabled/timeout in config loaders
- Converted all TS private keywords to ES # private fields
- Wrapped uncaught throws in /mcp add with try/catch error handling
- Replaced new Promise with Promise.withResolvers() pattern
- Sanitized TUI output with replaceTabs/truncateToWidth
- Enforced http/https URL validation in add wizard
- Fixed greedy /mcp prefix match in input controller
- Corrected config filename references in MCP guide
- Added server name validation to updateMCPServer
- Fixed timeout timer leak in stdio transport
2026-02-10 14:31:19 +01:00
Dev Ned 7e4bedf18b Runtime MCP support (#17)
* + /mcp

- Reloads MCP manager in runtime state (no restart needed) and syncs with mcp.json.
- Handles OAuth discovery/auth flow automatically for auth-required servers.
- Validates server names and config shape before saving.
- Persists OAuth credentials in auth storage and links them to MCP config.
- Provides immediate connection checks and clear status messages.
- Supports enable/disable, reauth, and unauth flows that are easy to get wrong by hand.

* active agent tool registry runtime reload + token support for bearer auth http based transport

* +session rebind on succesful connection

* fix(coding-agent): address /mcp check failures

---------

Co-authored-by: can1357 <me@can.ac>
2026-02-10 14:09:41 +01:00
can1357 acf8ab5225 style: stylistic changes 2026-02-10 07:39:39 +01:00
can1357 ba8b9de696 fix(coding-agent): backported pi-mono changes (9ce0007..f9161c4)
packages/agent:
- feat: added hasQueuedMessages() and dequeue helpers for steering/follow-up queues
- fix: resume queued messages from continue() after auto-compaction

packages/ai:
- feat: added Bedrock cache retention support with PI_CACHE_RETENTION env var
- feat: added adaptive thinking for Bedrock Opus 4.6+ models
- feat: added AWS_BEDROCK_SKIP_AUTH for unauthenticated Bedrock proxies
- feat: added AWS_BEDROCK_FORCE_HTTP1 for custom endpoints requiring HTTP/1.1
- feat: re-exported Static, TSchema, Type from @sinclair/typebox
- fix: disabled OpenAI Responses storage by default (store: false)
- fix: clamped reasoning effort for gpt-5.3 Codex models (minimal -> low)
- fix: Bedrock supportsPromptCaching checks model cost fields

packages/coding-agent:
- feat: added /quit slash command as alias for /exit
- feat: added per-model overrides (modelOverrides) in models.json
- feat: merged custom models with built-ins by provider+id instead of replacing
- fix: assistant message spacer before tool executions without visible content
- fix: extension runner emit() type safety with narrowed event/result types
- fix: extension runner tool_result event chaining via dedicated emitToolResult()
- fix: queued messages not delivered after auto-compaction completes
2026-02-07 04:59:57 +01:00
can1357 a91a2f9d5d refactor(coding-agent/modes): extracted Alt+Enter follow-up message handling into dedicated handleFollowUp() method
- Extracted Alt+Enter follow-up message handling from inline editor callback into dedicated handleFollowUp() method.
- Moved follow-up keybinding registration to use new handleFollowUp() method instead of inline callback.
2026-02-06 03:07:40 +01:00
can1357 bfe175fc01 feat(natives): backported fixes from pi-mono (82d7da878..9ce00079) 2026-02-06 01:55:42 +01:00
can1357 1f7c4f6f90 refactor(stream-parsing): restructured stream utilities to use Web standard APIs and generic SSE parsing
- Refactored SSE stream parsing to use generic `readSseJson` utility instead of domain-specific handlers across multiple packages.
- Migrated from Node.js Buffer API to Web standard APIs (Uint8Array, TextDecoder, DataView) for cross-platform compatibility.
- Simplified stream transformation pipeline by consolidating multiple stream operations into unified `createTextLineSplitter` utility.
- Refactored `ptree.ts` to remove complex stream pumping infrastructure and simplify stderr handling with direct async iteration.
- Rewrote stream utilities to operate at binary level with byte-level parsing for improved efficiency and reduced string allocations.
- Updated TypeScript configuration to include DOM.AsyncIterable type definitions for async iterable DOM API support.
2026-02-05 10:59:47 +01:00