Commit Graph

2589 Commits

Author SHA1 Message Date
can1357 7ab04f617e chore: bump version to 13.11.0 2026-03-12 17:38:11 +01:00
can1357 09e73b549b refactor(coding-agent/tools): restructured tools to inject Settings through render functions
- Threaded Settings parameter through renderUrl and renderHtmlToText functions for dependency injection.
- Changed settings import from default export to type-only import in fetch.ts.
- Added vi.clearAllMocks() calls to test setup hooks for proper mock isolation.
2026-03-12 17:37:52 +01:00
can1357 7040d58396 feat(coding-agent): added Parallel AI provider for web search and content extraction
- Added Parallel AI provider integration for web search with fast and research modes.
- Added Parallel extract API for URL content and YouTube video extraction with fallback support.
- Added /login parallel command and PARALLEL_API_KEY environment variable authentication.
- Added providers.parallelFetch configuration setting to control Parallel extract usage.
- Integrated Parallel provider into web search priority order between Exa and Kagi.
- Updated HTML-to-text and YouTube scrapers to prefer Parallel extract over fallback providers.
2026-03-12 17:08:35 +01:00
can1357 afcb2ec52a fix(coding-agent/utils): corrected buffer encoding in image utilities
- Corrected buffer-to-base64 conversion by wrapping raw buffers with Buffer.from() to ensure proper encoding across image processing utilities.
- Updated 6 buffer conversion calls in fetch, image-input, and image-resize modules for consistency.
2026-03-11 16:59:50 +01:00
can1357 f751d413a5 refactor(prompts): clarified hashline tool documentation structure
- Simplified hashline tool documentation by consolidating workflow and checklist sections into concise opening guidance.
- Reorganized examples to emphasize block-boundary shapes (a) and (b) with clearer bad/good comparisons.
- Removed redundant rules section and integrated key constraints into critical section for single source of truth.
2026-03-11 03:49:01 +01:00
can1357 79840b07f4 refactor(prompts): clarified hashline tool behavior across operations
- Clarified hashline tool documentation to distinguish behavior of `lines` field across `replace`, `prepend`, and `append` operations.
- Refined `edits[n].pos` description to specify 'first line' for replace operation.
2026-03-11 03:48:55 +01:00
can1357 d393d01b97 fix(hashline): corrected no-op detection to check array length before comparing lines
- Fixed line normalization to trim trailing whitespace and strip carriage returns instead of removing all whitespace.
- Fixed no-op detection to check array length equality before comparing lines, preventing false classification of multi-line expansions.
- Added clarification to hashline tool documentation on `replace` operation semantics and `lines` boundary constraints.
- Added test case validating single-line to multi-line expansion behavior and firstChangedLine calculation.
2026-03-11 03:21:21 +01:00
can1357 bf0b6de4fa refactor(lsp): extracted diagnostic formatting into reusable utility
- Extracted diagnostic message formatting into reusable `formatGroupedDiagnosticMessages()` utility function.
- Consolidated diagnostic output formatting across lsp/index.ts and tools/output-meta.ts to use shared utility.
- Added `DIAG_PATH_RE` regex pattern to parse diagnostic message format with file path, line, and column.
2026-03-11 03:18:01 +01:00
can1357 ffa208adcf feat(modes): added /copy subcommands for flexible code and command extraction
- Added `/copy` command subcommands (code, all, cmd, last) for flexible code block and command copying.
- Added support for copying last executed bash or python command via `/copy cmd` subcommand.
- Refactored handleCopyCommand() to route subcommands with dedicated private methods for each copy operation.
- Added regex-based code block extraction from markdown with fallback warnings for missing blocks.
2026-03-11 03:08:51 +01:00
can1357 c8d4946d70 feat(coding-agent): refactored eager todo messaging for cleaner categorization
- Changed eager todo reminder message role from 'developer' to 'custom' with customType field for better message categorization.
- Removed userRequest parameter from eager todo prelude generation to simplify prompt template rendering.
- Updated eager todo prompt to avoid redundant todo_write calls unless task state materially changed.
- Modified eager todo reminder message to use string content with display: false property instead of array format.
2026-03-11 03:08:32 +01:00
can1357 1932b35062 refactor(session): restructured eager todo injection to prepended message pattern
- Refactored eager todo injection from recursive prompt call to prepended message pattern.
- Removed state fields for todo injection tracking and consolidated logic into message composition.
- Added prependMessages option to promptWithMessage for composing messages before main prompt.
- Updated system prompt to require todo creation before substantive work on user requests.
2026-03-11 02:52:39 +01:00
can1357 b18a528ff7 fix(coding-agent/session): fixed race condition in eager todo prompt handling on user abort
- Fixed race condition where outer prompt would continue after user abort during eager todo's inner prompt by checking generation counter before proceeding.
2026-03-11 01:11:30 +01:00
can1357 a1be87ad9b feat(coding-agent/task): added optional assignment field to track raw task text separately from templates
- Added optional `assignment` field to task result and progress interfaces to track raw per-task assignment text separately from full templated task.
- Updated task rendering to display assignment text instead of full task template when available, improving clarity of task display.
- Modified task section rendering to show trimmed assignment text with fallback to task field if assignment is not available.
- Propagated assignment field through task executor, template renderer, and result objects to maintain consistency across task processing pipeline.
2026-03-11 01:11:20 +01:00
can1357 2a5968ec47 fix(tui): fixed OSC 11 background color detection and query race conditions
- Fixed OSC 11 background color detection to handle partial escape sequences that arrive mid-buffer, preventing user input from being swallowed.
- Fixed race condition where overlapping OSC 11 queries would be incorrectly cancelled by DA1 sentinels from previous queries by implementing a query queueing mechanism.
- Refactored OSC 11 query handling to use queuing instead of immediate restart, improving robustness of terminal appearance detection.
- Added comprehensive test coverage for terminal appearance detection including partial buffer handling, query queueing, and debouncing behavior.
- Added test cases for theme auto-detection to verify terminal-reported appearance takes precedence over environment variables and platform-specific detection.
2026-03-11 01:11:00 +01:00
汐 af383e5618 fix(path): PI_CONFIG_DIR discovery (#358)
* fix(path): PI_CONFIG_DIR discovery

* refactor: centralize agent dir name into getConfigAgentDirName()

- Add getConfigAgentDirName() to utils/dirs.ts as single source of truth
- Replace duplicated "/agent" suffix construction in helpers.ts and config.ts
- Let biome format mcp/manager.ts canonically

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-11 01:07:57 +01:00
lederniermagicien 486fd4c753 refactor(theme): replace CoreFoundation FFI with OSC 11 for machine-agnostic dark/light detection (#347)
* refactor(theme): replace CoreFoundation FFI + Mode 2031 with OSC 11 for dark/light detection

Replace the 415-line Rust CoreFoundation FFI module and Mode 2031-only
detection with OSC 11 background color queries — the machine-agnostic
method used by Neovim, fish, bat, and terminal-colorsaurus.

Detection stack:
- OSC 11 query + DA1 sentinel at startup (works over SSH, mobile clients)
- Mode 2031 subscribe: re-queries OSC 11 with 100ms debounce (Neovim
  convention) instead of trusting binary dark/light value directly
- 2s OSC 11 poll for terminals without Mode 2031 (Warp, Alacritty,
  WezTerm, iTerm2); self-disables once Mode 2031 fires
- COLORFGBG env var fallback (free, no I/O)
- macOS defaults read fallback (Zellij edge case)

Deleted:
- crates/pi-natives/src/appearance.rs (414 lines of unsafe FFI)
- packages/natives/src/appearance/ (66 lines of TS bindings)
- macOS appearance observer and SIGWINCH coupling in theme.ts

Net: -424 lines. Rust crate lighter, detection works over SSH.

* fix(theme): ignore bogus zellij osc11 dark reading

* fix(theme): scope macOS fallback to broken terminal paths

* fix(tui): swallow DA1 sentinels for OSC 11 probes

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-11 00:58:17 +01:00
can1357 1a5bbc3e51 feat(coding-agent): added details field to TodoItem for storing implementation specifics
- Added optional `details` field to TodoItem type for storing implementation specifics, file paths, and edge cases.
- Enhanced todo item display to show multi-line details with automatic indentation in interactive and reminder modes.
- Updated eager-todo system prompt to enforce separation of short task content (5-10 words) from detailed implementation information.
- Extended TodoWriteTool to support creating and updating tasks with details field via add_task and update operations.
- Added comprehensive test coverage for details field handling across todo operations (replace, add_task, update).
2026-03-11 00:56:54 +01:00
can1357 6535e9ce7e fix(coding-agent/tools): fixed path resolution to accept bare directory names in path lists
- Fixed path resolution to accept bare directory names without trailing slashes in comma/space-separated path lists.
- Added existence check for bare path tokens before rejecting them as invalid, allowing directory names like 'packages' to be resolved correctly.
- Added test case verifying grep tool accepts bare space-separated directory names without trailing slashes.
2026-03-11 00:55:12 +01:00
can1357 bb0026cb32 feat(coding-agent): added eager todo configuration and per-turn tool choice overrides
- Added 'todo.eager' configuration setting to automatically create a comprehensive todo list after the first user message.
- Added 'buildNamedToolChoice' utility function to build provider-aware tool choice constraints for named tools.
- Modified tool choice resolution to support per-turn tool choice overrides via consumeNextToolChoiceOverride() method.
- Implemented eager todo enforcement mechanism that injects a synthetic prompt to encourage todo creation when conditions are met.
- Extracted tool choice building logic into reusable utility module for better code organization.
- Added comprehensive test coverage for eager todo enforcement functionality in AgentSession.
2026-03-11 00:54:55 +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 36d2fed5d9 fix(coding-agent/tools): fixed error messages in tools to reference correct scope path variable
- Corrected error messages in ast-edit, ast-grep, grep, and find tools to reference the correct scope path variable instead of incorrect variable names.
2026-03-10 23:59:44 +01:00
can1357 88364ee830 feat(coding-agent/tools): added multi-path search support to find, grep, ast_grep, and ast_edit tools
- Added support for comma/space-separated path lists in find, grep, ast_grep, and ast_edit tools, allowing users to search multiple directories with a single query (e.g., 'apps/,packages/,phases/' or 'apps/ packages/ phases/').
- Added resolveMultiSearchPath and resolveMultiFindPattern utility functions to path-utils for intelligent parsing and resolution of multi-path search inputs with automatic common base path detection.
- Updated tool documentation for find, grep, ast_grep, and ast_edit to clarify that path parameters accept files, directories, glob patterns, or comma/space-separated path lists.
- Refactored path resolution logic in find, grep, ast_grep, and ast_edit tools to use unified multi-path handling with intelligent delimiter detection (comma or whitespace).
2026-03-10 22:35:32 +01:00
can1357 61aa2c2bee chore: bump version to 13.10.1 2026-03-10 20:15:23 +01:00
can1357 7818c5c316 feat(coding-agent): enabled interactive input submission and fixed continue path state handling
- Exported `submitInteractiveInput()` function for programmatic submission of user input in interactive mode.
- Fixed continue special path to skip optimistic submission state check for already-started prompts.
- Added 2 test cases covering continue submission behavior and optimistic state cancellation.
2026-03-10 20:15:03 +01:00
can1357 48927fd5dc fix(coding-agent/tools): corrected tool output to hide internal harness fields
- Added `__partialJson` to hidden argument keys to prevent internal harness fields from appearing in user-facing tool output.
2026-03-10 20:01:58 +01:00
can1357 bcfbc710de fix(mcp): force OAuth token refresh on 401/403 auth errors
#resolveAuthConfig only refreshed tokens within the 5-minute pre-expiry
window, so the onAuthError retry path reused stale credentials when
tokens were revoked, clocks skewed, or expires was missing. Add a
forceRefresh parameter and pass true from the auth error handler so
401/403 always triggers an unconditional refresh attempt.
2026-03-10 18:40:18 +01:00
Kevin Loftis 6f02d42eb4 feat: add MCP OAuth token refresh (#359)
* Add OAuth token refresh for MCP connections

Proactive refresh with 5-minute buffer before token expiry, plus
retry on 401/403 with automatic token refresh for HTTP transports.
Persist tokenUrl, clientId, and clientSecret in auth config so
refresh can happen without re-prompting the user.

* docs(coding-agent): updated CHANGELOG for MCP OAuth token refresh
2026-03-10 18:31:01 +01:00
Miroslav Drbal [ApoC] 49adac4890 fix(coding-agent): fix EBUSY crash in terminal breadcrumb write on Windows (#357)
writeTerminalBreadcrumb used void Bun.write() — discarding the promise.
When parallel tasks write the same breadcrumb file concurrently on
Windows, Bun.write fails with EBUSY. The discarded promise rejects
unhandled, crashing the process.

Replace void with .catch(() => {}) to properly swallow best-effort
failures.

Co-authored-by: Miroslav Drbal <miroslav.drbal@gendigital.com>
2026-03-10 18:29:40 +01:00
Adrian Glapiński 224fa9680b fix(coding-agent): clarify Exa web search settings (#356)
* fix(coding-agent): clarify Exa web search settings

* Delete packages/coding-agent/test/settings-defs.test.ts

---------

Co-authored-by: Can Bölük <can1357@users.noreply.github.com>
2026-03-10 18:29:21 +01:00
can1357 535a828f9c chore: bump version to 13.10.0 2026-03-10 08:10:33 +01:00
can1357 2d808ec99a docs(coding-agent/prompts): clarified block-boundary edit shapes in hashline tool docs
- Restructured hashline tool documentation to clarify block-boundary edit shapes and consolidate critical rules.
- Removed redundant recovery section and merged guidance into main rules for improved clarity.
- Reorganized examples to explicitly label shape (a) and shape (b) block replacement patterns.
2026-03-10 08:07:52 +01:00
can1357 0ac395d153 fix(compaction): preserved text signature metadata during OpenAI history build
- Preserved text signature metadata (id and phase) when building OpenAI native history during session compaction.
- Added test case validating that codex assistant text signature metadata is correctly preserved in remote compaction history.
2026-03-10 07:52:01 +01:00
can1357 2a56458fa9 chore: bump version to 13.9.16 2026-03-10 07:45:20 +01:00
can1357 02a32d5b9a refactor: migrated OpenAI stream processing to shared module
- Extracted OpenAI Responses API stream processing logic into shared module with 424 lines of reusable utilities.
- Consolidated text signature encoding, tool call normalization, and message conversion functions into openai-responses-shared module.
- Refactored openai-responses.ts and azure-openai-responses.ts to delegate stream processing to shared processResponsesStream() helper.
- Removed 473 lines of duplicated stream event handling and utility functions across OpenAI provider implementations.
2026-03-10 07:43:36 +01:00
can1357 1962938fa5 feat: added payload interception and signature metadata for provider requests
- Added `onPayload` callback option to intercept and transform provider request payloads before transmission across agent and AI packages.
- Added structured text signature metadata with phase information to OpenAI and Azure OpenAI providers for enhanced response tracking.
- Added `before_provider_request` extension event to coding-agent for chaining payload transformations across multiple handlers.
- Improved error messages in `response.failed` events with detailed error codes, messages, and incomplete reasons from provider responses.
2026-03-10 07:38:13 +01:00
elliotllliu a648772ae5 fix: auto-retry on OpenAI stream stall errors (#355)
When the OpenAI responses stream stalls (e.g. with github-copilot/
gpt-5.4), the error message "stream stalled while waiting for the
next event" is now recognized as a retryable transient error.

Two locations updated:
- packages/ai/src/utils/retry.ts: add "stream stall" to
  TRANSIENT_MESSAGE_PATTERN (used by provider-level retry logic)
- packages/coding-agent/src/session/agent-session.ts: add
  "stream stall" to #isRetryableErrorMessage() regex (used by
  agent-session retry loop for both thrown errors and error
  AssistantMessages)

Fixes #348

Co-authored-by: GitHub User <user@example.com>
2026-03-10 07:28:16 +01:00
can1357 acf4b45062 fix(coding-agent): backported pi-mono changes (5133697..15e0957b0)
packages/ai:
- fix: improve GitHub Copilot OAuth polling and Codex stream recovery
- fix: allow google-vertex authentication via GOOGLE_CLOUD_API_KEY
- fix: send Gemini/Claude provider-specific thinking headers and thought-signature fallbacks correctly
- test: added coverage for Gemini CLI alignment, Codex streaming, and stream edge cases

packages/coding-agent:
- feat: add treeFilterMode setting for the session tree selector default
- fix: prefer later-loaded explicit extensions when commands conflict
- fix: truncate serialized tool results during compaction summarization to prevent overflow
- fix: normalize CRLF in write tool previews
- fix: use shell-based external editor launch on Windows
- test: added compaction serialization and extension runner precedence coverage

packages/tui:
- fix: chain slash-command argument autocomplete after tab-completing the command name
- fix: normalize pasted tabs in Input using configured indentation
- fix: render blockquote lists, tables, and fenced code blocks correctly
- fix: ignore unsupported Kitty CSI-u modifiers and enable modifyOtherKeys fallback cleanup
- test: added editor, input, keys, and markdown regression coverage
2026-03-10 07:27:30 +01:00
can1357 0eff46b0f3 feat(ai): added model-specific credential selection with plan-based prioritization
- Added `modelId` parameter to `getApiKey()` for model-specific credential selection.
- Implemented plan-based account prioritization for OpenAI Codex Pro models, preferring Pro plan accounts.
- Added `AuthApiKeyOptions` type to support model-specific authentication configuration.
- Added helper functions for OpenAI Codex Pro model detection and plan-based ranking logic.
2026-03-10 07:13:48 +01:00
can1357 82e4f168b9 feat: implemented background model discovery with provider caching for faster startup
- Added background model discovery with provider status tracking and 24-hour model caching to improve startup performance.
- Changed model discovery timeout from 3000ms to 250ms and deferred blocking refresh to background operations for faster initialization.
- Fixed model discovery to preserve cached models when providers are unavailable or unauthenticated.
- Added validation in Kitty key formatting to reject unsupported modifiers and improved error handling.
- Reorganized CI workflow to run TypeScript linting in check job and conditional Rust checks in native job matrix.
- Updated system prompt and tool guidance to recommend combined investigation-and-edit workflows and maintainable code practices.
2026-03-10 07:08:00 +01:00
can1357 6e98995085 refactor(web-search): simplified web-search API by removing provider param
- Removed provider parameter from web search tool schema; provider selection now handled internally.
- Removed deprecated no_fallback option from search parameters; fallback behavior is now automatic.
- Renamed SearchParams type to SearchToolParams and introduced SearchQueryParams for CLI queries.
- Updated executeSearch() to accept SearchQueryParams with optional provider selection.
2026-03-10 06:26:09 +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 dc90bb15c0 chore: bump version to 13.9.15 2026-03-10 05:51:27 +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
can1357 8fe602173b chore: bump version to 13.9.14 2026-03-10 04:24:07 +01:00
can1357 fc9cd327f7 refactor: less tools for explore, less enthusiastic exploring 2026-03-10 04:23:54 +01:00
can1357 d30d55119c chore: bump version to 13.9.13 2026-03-10 04:10:50 +01:00
can1357 d139e30e1d test(coding-agent): updated interactive mode status test to use buildSessionContext
- Imported buildSessionContext from session-manager module.
- Replaced inline session context object with buildSessionContext factory call in test assertion.
2026-03-10 04:10:36 +01:00
can1357 e27afce0b2 feat: system prompt changes + better AST-grep guidance 2026-03-10 04:08:08 +01:00
can1357 0015dff67a fix(coding-agent/config): changed inspect_image.enabled default from true to false
- Updated the default value for the inspect_image.enabled setting to false to align with expected behavior.
2026-03-10 02:54:09 +01:00