Commit Graph

2524 Commits

Author SHA1 Message Date
can1357 2d732bb033 fix(coding-agent): resolved symlinked paths before passing to brush
- Resolved symlinked paths before passing to brush shell to keep `pwd` output aligned with canonical Git worktree paths.
- Added `resolveShellCwd` helper that safely resolves symlinks and falls back to original path on error.
- Added test case verifying symlinked directories are canonicalized before execution.
2026-03-09 15:39:05 +01:00
can1357 aa18e3f26d feat: add hash prompt actions
Fixes #283
2026-03-09 15:38:39 +01:00
can1357 111d5f9cc6 test: add thinking signature regressions 2026-03-09 15:38:39 +01:00
can1357 99127dc95d test(model-registry): cover gpt-5.4 context metadata 2026-03-09 15:38:39 +01:00
HvC 50a9f872de fix(tui): fixed windows numpad input (#339)
* fix(tui): fixed windows numpad input

* numlock handles in kitty CSI p2

* fix(tui): preserved modified numlock keypad nav

* fix(tui): restored autocomplete keystroke triggers

---------

Co-authored-by: Brit <lol@no.com>
2026-03-09 15:14:28 +01:00
RzNmKX d861a3d52a fix(ai): Bedrock thinking signature and tool_choice errors (#333)
* fix: strip invalid thinking signatures from aborted/errored messages

When a stream is interrupted mid-response, thinking blocks may have
empty or partial cryptographic signatures. These get persisted to
session history and sent on the next API call, causing:
'Invalid signature in thinking block'

transformMessages() now detects aborted/errored assistant messages and
clears thinkingSignature fields so they are treated as unsigned thinking
(converted to text by the serializer).

Also protect truncateForPersistence from corrupting signatures — clear
them entirely instead of truncating, since a partial signature is always
invalid.

* fix: disable thinking when tool_choice forces tool use on Bedrock

Bedrock rejects requests that combine extended thinking with forced
tool_choice (any or specific tool). The Anthropic provider already had
a guard (disableThinkingIfToolChoiceForced) but the Bedrock provider
was missing the equivalent check.

Also fix thinking block serialization: when a thinking block has no
valid signature (e.g., from an aborted stream), convert it to plain
text instead of sending it as reasoningContent without a signature.
The API requires the signature field on all reasoning blocks for models
that support it.

Add thinking block diagnostics to error messages for signature/thinking
related failures to aid debugging.
2026-03-09 15:02:19 +01:00
Miroslav Drbal [ApoC] 27d951ea37 fix(patch): HASHLINE_PREFIX_RE incorrectly strips comment lines matching '# Word:' pattern (#334)
* fix(patch): HASHLINE_PREFIX_RE strips comment lines with word: pattern

The regex used [0-9a-zA-Z]{1,16} for the hash ID segment, which matched
common comment patterns like '# Note:', '# TODO:', '# FIXME:'. When a
single-line replacement contained such a comment, nonEmpty===1 and
hashPrefixCount===1, triggering stripping and eating the comment prefix.

Actual hashline IDs are always exactly 2 chars from ZPMQVRWSNKTXJBYH.
Constrain the regex to that exact alphabet so no English word can match.

Also update tests that used fake IDs (AB, CD, EF) not in the real alphabet.

* test(patch): add regression tests for comment line prefix stripping bug

Three new tests in hashlineParseContent describe block:
- hashlineParseText preserves '# Word:' comment lines (unit)
- full pipeline: replacing '# Note:' comment line preserves prefix
- full pipeline: replacing '# TODO:' comment line preserves prefix

These would have caught the HASHLINE_PREFIX_RE bug where [0-9a-zA-Z]{1,16}
matched comment words, causing stripNewLinePrefixes to eat the '# Note:'
prefix when a single comment line was the sole replacement entry.

---------

Co-authored-by: Miroslav Drbal <miroslav.drbal@gendigital.com>
2026-03-09 14:59:52 +01:00
Miroslav Drbal [ApoC] e6d5a58ed1 fix(model-registry): remove hardcoded gpt-5.4 context window override (#335)
#applyHardcodedModelPolicies forced contextWindow=1_000_000 on any model
with id 'gpt-5.4' regardless of provider. This was wrong in every case:

- github-copilot/gpt-5.4: inflated from bundled 400K (and overwrote the
  ~274K that Copilot's live /models discovery returns via capabilities.limits)
- openai/gpt-5.4: deflated from bundled 1_050_000 to 1_000_000
- openai-codex, opencode, opencode-zen: same downgrade from 1_050_000

The method was called twice — after static load and after runtime discovery —
so it reliably clobbered the correct provider-specific value both times.

No documented rationale exists for the override. The bundled models.json
values are already correct. Remove the method and its two call sites.

fixes #332

Co-authored-by: Miroslav Drbal <miroslav.drbal@gendigital.com>
2026-03-09 14:59:06 +01:00
ravshansbox 731e46aa8e fix: preserved stale PR indicator during refresh (#346) 2026-03-09 14:57:15 +01:00
can1357 bd23578f55 chore: bump version to 13.9.11 2026-03-08 16:36:37 +01:00
can1357 1598210369 test: seed anthropic auth in handoff handoff tests 2026-03-08 16:36:16 +01:00
can1357 0462d9b88c chore(deps): removed redundant tsconfig.build.json files across packages
- Deleted tsconfig.build.json and tsconfig.check.json files that only extended the base tsconfig.json without adding configuration.
- Updated check:ts script to remove the unused packages/stats/tsconfig.client.json reference.
2026-03-08 16:31:57 +01:00
can1357 710cd638d6 chore: bump version to 13.9.10 2026-03-08 16:24:59 +01:00
can1357 6635129b7c test(coding-agent): updated 8 mock functions to accept unused parameters
- Updated 8 test mock functions to accept unused parameters for API compatibility.
2026-03-08 16:24:44 +01:00
can1357 486e585f39 refactor(coding-agent): migrated fetch mocks to hookFetch utility with resource cleanup
- Replaced vi.spyOn fetch mocking pattern with hookFetch utility across 5 test files.
- Migrated fetch mocks to use resource management with 'using' keyword for automatic cleanup.
- Removed @ts-expect-error comments related to fetch.preconnect type issues.
- Updated ts-hook-fetch rule documentation with expanded patterns and clearer lifecycle guidance.
2026-03-08 16:22:18 +01:00
can1357 9d4ddef7b6 fix(ai): corrected credential matching to compare by type and identity key
- Fixed API key credential matching to compare by type and identity key instead of object identity.
- Fixed credential deduplication to preserve existing credentials when replacement key matches.
- Fixed auth schema version preservation by conditionally writing schema version only on initial setup.
- Added test coverage for API key reuse, email deduplication, and schema version preservation.
2026-03-08 16:21:09 +01:00
can1357 005401e82a refactor: extracted fetch mocking into reusable hookFetch utility
- Extracted fetch mocking logic into reusable `hookFetch()` utility function with middleware-style handler pattern.
- Replaced manual `globalThis.fetch` assignment and restoration across 10 test files with `hookFetch()` calls using `using` statement for automatic cleanup.
- Implemented Disposable pattern with Symbol.dispose for fetch hook resource management, eliminating try-finally blocks.
- Exported `hookFetch` from utils public API to enable consistent fetch mocking across packages.
2026-03-08 16:16:54 +01:00
can1357 59ae4ff707 test(coding-agent): updated mock fetch to filter endpoints and ignore concurrent discovery
- Updated mock fetch handler to filter test endpoints and ignore concurrent provider discovery requests.
2026-03-08 15:59:06 +01:00
can1357 57c89cf503 refactor(auth-storage): restructured credential matching to use accountId
- Extracted OAuth identifier logic into public functions extractOAuthCredentialIdentifiers and extractOAuthTokenIdentifiers.
- Replaced single credentialIdentity string with multi-identifier resolveCredentialIdentifiers returning string[] for flexible matching.
- Changed credential deduplication from email-based to accountId-based matching in replaceAuthCredentialsForProvider.
- Updated auth-storage tests to verify accountId-prioritized deduplication behavior across soft-disable and hard-delete scenarios.
- Added documentation comments in coding-agent modules explaining partial JSON preservation for streaming tool previews.
- Documented streaming tool preview requirements and render paths in AGENTS.md.
2026-03-08 15:58:52 +01:00
can1357 19feec9592 feat(bash): added env parameter to bash tool for safe variable passing
- Added `env` parameter to bash tool for safe environment variable passing without shell re-parsing.
- Added support for rendering partial environment variable assignments in command preview during streaming.
- Updated bash tool prompt to recommend `env` parameter for multiline, quote-heavy, and untrusted values.
- Refactored tool execution component to conditionally merge partial JSON arguments during streaming.
- Added helper functions for environment variable normalization, escaping, and formatting.
2026-03-08 15:53:33 +01:00
can1357 15547f73c6 chore: bump version to 13.9.8 2026-03-08 08:16:18 +01:00
can1357 628e68e6ae fix(ai): corrected WebSocket fallback to safely replay buffered output over SSE
- Fixed WebSocket stream fallback logic to safely replay buffered output over SSE when WebSocket fails after partial content has been streamed.
- Added tracking flag to prevent unsafe replays of tool calls and terminal events during fallback transitions.
- Enhanced error recovery to reset output state when replaying buffered content over SSE connection.
2026-03-08 07:51:19 +01:00
can1357 85621f37bf feat(coding-agent/web): added docs.rs scraper with rustdoc JSON parsing and caching
- Added docs.rs scraper for extracting Rust crate documentation from rustdoc JSON, supporting modules, functions, structs, traits, enums, and other Rust items with intelligent caching.
- Implemented rustdoc JSON parsing with type rendering for complex Rust types including generics, lifetimes, trait bounds, and qualified paths.
- Added caching layer for rustdoc JSON with date-based versioning for 'latest' releases to reduce repeated fetches.
2026-03-08 07:50:16 +01:00
can1357 7139bc34aa docs(coding-agent/prompts): clarified agent prompts with fallback strategies and uncertainty handling
- Added fallback search strategies in librarian and explore agent prompts for handling empty results.
- Clarified task completion priority in system prompt by prohibiting premature tool call cessation.
- Consolidated and simplified 'Giving Up' guidance in subagent prompt with clearer uncertainty handling.
- Removed duplicate instructions and redundant phrasing to improve prompt clarity and conciseness.
2026-03-08 04:59:52 +01:00
can1357 d91540a1fa chore: bump version to 13.9.7 2026-03-08 04:49:35 +01:00
can1357 87b8716b8b style: fix biome formatting and import order 2026-03-08 04:49:26 +01:00
can1357 b316b418cc feat(coding-agent): added deferred recovery and template-based handoff prompts
- Added skipPostPromptRecoveryWait option to HandoffOptions for deferring recovery work in handoff operations.
- Added deferred auto-compaction scheduling for threshold-triggered handoffs via post-prompt task queue.
- Extracted handoff document template to dedicated system prompt file for improved maintainability and reusability.
- Changed handoff prompt generation to use template rendering with custom focus instructions support.
- Refactored prompt-in-flight tracking from boolean flag to counter for proper nested operation handling.
2026-03-08 04:48:12 +01:00
can1357 73355695f2 feat(coding-agent/tools): implemented path-scoped llms.txt discovery with content-quality fallback
- Moved llms.txt endpoint discovery to fallback strategy when rendered page content is low quality, prioritizing page-specific content over site-wide files.
- Enhanced llms.txt endpoint detection to scope candidates to the requested URL path, searching section-specific files before site-wide ones.
- Replaced getOrigin() with buildLlmEndpointCandidates() to generate path-scoped endpoint candidates with depth-based fallback strategy.
- Updated tryLlmEndpoints() to accept full URL and return endpoint metadata alongside content for better fallback tracking.
- Added 2 integration tests validating section-scoped llms.txt discovery and preference for rendered content over site-wide files.
2026-03-08 04:36:05 +01:00
can1357 c3d83c2003 chore: bump version to 13.9.6 2026-03-08 03:41:22 +01:00
can1357 d4e3d5881c docs(coding-agent/prompts): clarified contextual pattern mode targeting behavior in ast-grep and ast-edit
- Clarified contextual pattern mode behavior in ast-grep and ast-edit documentation to explain that results target the selected node, not the outer wrapper.
- Enhanced TypeScript pattern examples to include class method matching syntax with `class $_ { method(...) }` wrapper pattern.
- Removed redundant class method examples that were superseded by improved documentation of contextual pattern mode.
2026-03-08 03:40:58 +01:00
can1357 72b036dcc0 refactor(coding-agent): simplified AST tool parameters and expanded documentation
- Renamed parameter names in ast-grep and ast-edit tools from `patterns`/`selector` to `pat`/`sel` for brevity across schema, implementation, and tests.
- Expanded ast-grep and ast-edit tool documentation with 12+ new usage guidelines, examples, and critical notes on pattern syntax, metavariable placement, and error handling.
- Updated CHANGELOG.md to document parameter renames and expanded tool guidance for AST pattern syntax and metavariable usage.
- Reformatted test assertions and type annotations across ast-edit and ast-grep test files for improved readability.
2026-03-08 03:08:38 +01:00
can1357 c3323160be feat(coding-agent): added glob parameter to grep tools for file filtering
- Added `glob` parameter to `ast_grep`, `ast_edit`, and `grep` tools for filtering files relative to `path`.
- Implemented `combineSearchGlobs()` utility to merge glob patterns from multiple sources instead of throwing errors.
- Changed `grep` tool to combine glob patterns when both `path` and `glob` parameters are provided.
- Updated tool documentation to recommend pairing `path`, `glob`, and `lang` for language-scoped search in mixed repositories.
- Added comprehensive test coverage for combined path and glob parameter handling across grep, ast_grep, and ast_edit tools.
2026-03-08 02:52:29 +01:00
can1357 069d27423d chore: bump version to 13.9.5 2026-03-08 01:45:46 +01:00
can1357 aac0156476 chore: bump version to 13.9.4 2026-03-08 00:06:35 +01:00
can1357 568592ff77 chore(coding-agent/tools): removed obsolete TypeScript error suppressions from Kagi search tests
- Removed three @ts-expect-error comments that are no longer needed for fetch.preconnect mocking.
- The test mocks now work without requiring type suppression.
2026-03-08 00:06:12 +01:00
can1357 c4946363ca feat(coding-agent): added Ollama capability detection and improved provider integrations
- Added automatic Ollama model capability detection via /api/show endpoint to discover reasoning and input modality support.
- Improved Kagi API error handling with structured error parsing for JSON and plain text response formats.
- Fixed Cerebras streaming compatibility by omitting stream_options.include_usage parameter.
- Simplified API key credential storage to always replace credentials instead of merging for non-minimax providers.
- Updated Kagi Search API key format from 'kagi_...' to 'KG_...' and clarified beta access requirement in provider description.
Fixes #326.
Fixes #321.
Fixes #298.
2026-03-08 00:00:59 +01:00
can1357 7d5a230e26 fix: lowercased tool names in argument parsing
Fixes #324.
2026-03-07 23:53:16 +01:00
Miroslav Drbal [ApoC] a2223cef60 fix: correct context window percentage and provider token mapping (#306)
The context fullness gauge was driven by output token count, causing
erratic jumps between turns (e.g. 84% -> 64%) with no compaction.

Status bar and estimateContextTokens now use calculatePromptTokens()
which returns input + cacheRead + cacheWrite — the actual input context
size. Previously both used a formula that included the final output token
count, which fluctuates with response length and is not part of the
context window for the current request.

isContextOverflow's usage-based fallback (z.ai silent overflow) was
also missing cacheWrite (cache_creation_input_tokens). Per Anthropic
docs the threshold is input + cache_read + cache_creation — all three.
Ref: https://platform.claude.com/docs/en/about-claude/pricing#long-context-pricing

google.ts and google-vertex.ts were double-counting cached tokens.
Gemini's promptTokenCount already includes cachedContentTokenCount, so
assigning input = promptTokenCount and cacheRead = cachedContentTokenCount
overcounted by cachedContentTokenCount on every cached request. Fixed
by subtracting first, matching the OpenAI convention:
  input = promptTokenCount - cachedContentTokenCount
  cacheRead = cachedContentTokenCount
  => input + cacheRead = promptTokenCount (total prompt, no double-count)
Ref: https://ai.google.dev/api/generate-content#v1beta.GenerateContentResponse.UsageMetadata

All other providers validated: amazon-bedrock (inputTokens is uncached
by API contract), openai-completions/responses/azure (already subtract
cached), kimi/gitlab-duo (delegate to correct implementations), cursor
(API exposes output tokens only — input stays 0 by design).

Co-authored-by: Miroslav Drbal <miroslav.drbal@gendigital.com>
2026-03-07 23:11:15 +01:00
can1357 f06fec1a2b chore: bump version to 13.9.3 2026-03-07 22:28:35 +01:00
Adrian Glapiński 5770987f6e fix(coding-agent): parse Exa MCP plain-text web_search payloads (#303)
* fix(coding-agent): parse Exa MCP plain-text web_search payloads

* fix(coding-agent): preserve embedded Title lines in Exa plain-text parsing

* fix(coding-agent): support CRLF in Exa plain-text MCP parsing
2026-03-07 22:17:38 +01:00
Joshua Christman 44f5f4e6cf Add PUPPETEER_PROXY and PUPPETEER_PROXY_IGNORE_CERT_ERRORS env vars (#323)
* Add PUPPETEER_PROXY and PUPPETEER_PROXY_IGNORE_CERT_ERRORS env vars

- PUPPETEER_PROXY: routes browser traffic through specified proxy
- PUPPETEER_PROXY_IGNORE_CERT_ERRORS: ignore HTTPS cert errors when set

Made-with: Cursor

* fix(browser): gate PUPPETEER_PROXY_IGNORE_CERT_ERRORS on explicit truthy parse

Previously any non-empty value (including 'false', '0') enabled
--ignore-certificate-errors, silently disabling TLS verification when
operators intended to keep it on. Now only 'true', '1', 'yes', 'on'
(case-insensitive) enable the flag.

Made-with: Cursor
2026-03-07 22:13:08 +01:00
can1357 5293eaff29 feat(ai): added credential disable tracking with auditability improvements
- Added `disabledCause` parameter to credential deletion methods to track reason credentials are disabled.
- Changed credential disabling mechanism from boolean `disabled` flag to `disabled_cause` text field for better auditability.
- Fixed credential purging to respect disabled credentials during email deduplication operations.
- Refactored `replaceAuthCredentialsForProvider()` to update matching credentials instead of deleting all, preserving credential history.
2026-03-06 16:05:04 +01:00
can1357 8f88e8c82e feat(ai): added incremental history for remote compact
- Added incremental history mode to OpenAI responses .
- Changed OpenAI Codex to exclusively use websockets v2 protocol with fatal error detection for automatic SSE fallback.
- Fixed Gemini model parsing to strip `-preview` suffix for consistent model identification across API calls.
- Improved websocket error handling to extract and report detailed error messages from error events.
- Removed deprecated BETA_RESPONSES_WEBSOCKETS constant and websocket v2 feature flag branching logic.
2026-03-06 15:45:24 +01:00
can1357 6364c627ae fix: missing thresholds. 2026-03-06 12:54:53 +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 b696842570 feat: added serviceTier option and providerPayload field to OpenAI providers
- Added serviceTier option to OpenAI providers for controlling processing priority and cost across agent, completions, responses, and codex APIs.
- Added providerPayload field to messages for transport-native history reconstruction in OpenAI Responses and Codex APIs.
- Added /fast slash command and serviceTier setting to coding-agent for toggling OpenAI priority mode with fast mode indicator.
- Added remote compaction support with encrypted reasoning preservation for OpenAI models in coding-agent.
- Removed usage caching layer across all providers and refactored UsageFetchContext to eliminate cache and now dependencies.
- Fixed OpenAI Codex streaming service_tier inclusion, provider retry logic with exponential backoff, and email-based credential deduplication.
2026-03-06 12:34:57 +01:00
HvC b93c6c0e12 Offer handoff as a compaction strategy (#305)
* idiomatic rust fixes

* idiomatic rust fixes

* display an image if we are fetching an image

* MIME type strictness

* codex nagging me

* codex nagging

* handoff instead of compaction as context filled strategy and surfacing

* handoff instead of compaction as context filled strategy and surfacing p2

* handoff instead of compaction as context filled strategy and surfacing p3

* handoff instead of compaction as context filled strategy and surfacing p4

* handoff instead of compaction as context filled strategy and surfacing p5

* handoff instead of compaction as context filled strategy and surfacing, fixes

* failing fetch test from the fetch tool updates

* handoff focus prompt skeleton

* handoff focus prompt skeleton p2

* fetch bugs

* further codex improvements

* further codex improvements

---------

Co-authored-by: Brit <lol@no.com>
2026-03-06 03:12:31 +01:00
ravshansbox 00bc379f42 feat(ai,coding-agent): add opencode-go and rename opencode to opencode-zen (#310)
* feat(ai,coding-agent): add opencode-go and rename opencode to opencode-zen

* fix(ai): remove unsupported opencode-zen free models
2026-03-06 03:12:11 +01:00
can1357 bbe984ed5f chore: bump version to 13.9.2 2026-03-05 02:03:54 +01:00
can1357 b278ae85d1 fix(coding-agent): corrected off-by-one range errors in hashline edits
- Added auto-correction logic for off-by-one range start errors in hashline edits.
- Added safety check to prevent false-positive auto-correction when position already includes boundary.
- Added test coverage for off-by-one range correction and duplicate leading line handling.
- Extracted turn-aborted-guidance prompt to external markdown file for better maintainability.
2026-03-05 02:03:37 +01:00