Commit Graph

64 Commits

Author SHA1 Message Date
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
can1357 e131000ed2 refactor(coding-agent): extracted external editor handling into shared utility module
- Extracted external editor handling logic into shared utility module to reduce code duplication across hook-editor and input-controller components.
- Created new external-editor utility module with getEditorCommand() and openInEditor() functions for centralizing editor process management and temporary file handling.
- Simplified hook-editor component by replacing manual editor spawning and file operations with openInEditor() utility function call.
- Simplified input-controller component by replacing manual editor spawning and file operations with openInEditor() utility function call.
2026-02-05 06:13:58 +01:00
can1357 b59b104bad refactor(idgen): replaced nanoid with Snowflake ID generator
- Replaced nanoid and randomUUID with Snowflake ID generator across codebase for consistent distributed ID generation.
- Created new Snowflake utility module in packages/utils with support for 64-bit distributed ID generation with configurable epoch, machine ID, and sequence numbers.
- Updated session ID format documentation from nanoid to snowflake hex string format (16 hex characters).
- Removed nanoid dependency from package.json as it is now replaced by internal Snowflake implementation.
2026-02-05 03:48:08 +01:00
can1357 8ff2ef0ce0 refactor: migrated environment variable access from getEnv() to $env object API
- Migrated environment variable access from function-based `getEnv()` API to object property-based `$env` API across 43 files in the monorepo.
- Simplified `packages/utils/src/env.ts` by removing scoped environment variable logic (EnvScope, getEnvMap, getEnv functions) and replacing with direct `process.env` reference exported as `$env`.
- Updated `packages/ai/src/stream.ts` to remove environment parameter from KeyResolver functions and use global `$env` object instead of passed-in env parameter.
2026-02-05 03:07:40 +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 ba0b0f6d86 feat(coding-agent): refactored model role system and extracted model resolution utilities
- Added 'commit' model role for dedicated commit message generation.
- Exported 'resolveModelOverride' function from model-resolver module for public use.
- Refactored model role system to centralize role configuration in MODEL_ROLES registry.
- Extracted model resolution utilities into dedicated model-resolver module for improved code organization.
- Made 'tag' and 'color' properties optional in ModelRoleInfo interface to support roles without visual indicators.
- Enhanced model selector with defensive null/undefined checks for optional role properties.
2026-02-05 00:23:33 +01:00
can1357 67cd1509c6 chore(deps): updated SDK dependencies and added Puppeteer tool with stealth modules
- Updated @anthropic-ai/sdk from ^0.71.2 to ^0.72.1 in packages/ai.
- Updated @aws-sdk/client-bedrock-runtime from ^3.975.0 to ^3.982.0 in packages/ai.
- Updated @google/genai from ^1.38.0 to ^1.39.0 in packages/ai.
- Updated @smithy/node-http-handler from ^4.4.8 to ^4.4.9 in packages/ai.
- Updated openai from ^6.16.0 to ^6.17.0 in packages/ai.
- Removed proxy-agent and undici dependencies from packages/ai.
2026-02-04 09:25:45 +01:00
can1357 df118b0b50 feat(clipboard): added native clipboard support with arboard library integration
- Added native clipboard support with copyToClipboard() and readImageFromClipboard() functions using arboard library.
- Exported ClipboardImage type for clipboard image data with MIME type information.
- Migrated clipboard operations from shell commands to native arboard bindings for improved performance and reliability.
- Implemented Rust native module in pi-natives crate providing cross-platform clipboard access for Linux, macOS, and Windows.
- Added TypeScript bindings and type definitions for clipboard functionality in natives package.
2026-02-01 14:55:17 +01:00