Commit Graph

3056 Commits

Author SHA1 Message Date
can1357 23a5afe8d9 feat(coding-agent): added auto-backgrounding for long bash jobs to avoid blocking
- Added bash.autoBackground.enabled and bash.autoBackground.thresholdMs settings with defaults for background job behavior.
- Added auto-backgrounding support for long foreground bash commands with managed job state and timeout threshold.
- Updated bash prompts, job-protocol messages, and tool activation checks to use async and auto-background support.
- Added background bash completion integration with AsyncJobManager and end-to-end tests for short/long auto-background scenarios.
2026-04-11 11:05:16 +02:00
can1357 ae85ed4cc7 feat(export): added richer export HTML tool-call rendering to debug calls
- Added richer session-export HTML rendering for tool calls, metadata badges, and todo trees.
- Added a persistent JavaScript execution tool backed by node:vm with cross-session KV/pubsub support.
- Replaced pythonExecution paths with jsExecution handling across tool labels and message rendering.
- Refactored tool-call rendering into dedicated renderers with shared helpers and fallback error handling.
2026-04-11 09:59:07 +02:00
can1357 2cd8f52f4e feat(tools): added SQLite database operations with read/write support and query validation
- Added SQLite path parsing and candidate validation for `.sqlite`, `.db`, `.db3`, and `.sqlite3` targets in read/write flows.
- Added SQLite read operations for table lists, schema views, row lookups, paginated queries, and raw SELECT mode.
- Added SQLite write operations for insert, update-by-key, and delete-by-key using JSON5 row payloads.
- Updated selector routing to validate SQLite headers and fall back to normal file reads/writes when not databases.
- Secured read mode by enforcing query validation to block destructive SQL execution on SQLite inputs.
2026-04-11 08:57:58 +02:00
can1357 90f1672b2b fix(coding-agent): resolved duplicate -c in coding-agent git commands
- Added SHORT_LIVED_GIT_CONFIG constants and withShortLivedGitConfig helper for short-lived overrides.
- Updated runCommand to route git args through short-lived config normalization and avoid duplicate -c entries.
- Added scripts/release git() helper and replaced raw release git invocations with config-safe calls.
- Added git-process-config tests asserting status and stage spawn git with disabled core.fsmonitor/untrackedCache.
2026-04-11 08:54:27 +02:00
can1357 5277e44139 feat(coding-agent): added canonical aliases for model role resolution
- Added canonical model equivalence types, cache helpers, and registry APIs for provider variant lookup.
- Changed model resolution to apply canonical ID overrides/excludes with provider order before fallback matching.
- Added canonical and provider model views in list-models and selector UI with canonical sorting/persistence.
- Updated role/model persistence to store selectors while runtime now resolves concrete canonical-backed provider models.
2026-04-11 08:28:50 +02:00
can1357 0dab29c07c feat(coding-agent): added coding-agent prompt: no estimates/no shims
- Updated the system prompt to omit time estimates and duration predictions from responses.
- Reinforced coding guidance to avoid speculative abstractions and compatibility shims unless they are needed.
2026-04-11 07:23:45 +02:00
can1357 342cbc01c7 fix(ai): corrected ai usage report parsing to preserve partial payload data
- Fixed usage report generation to preserve partial data when parsing payloads are incomplete.
- Fixed planType resolution to fall back to raw `plan_type` when parsed planType is missing.
- Fixed usage metadata population to set accountId and keep the original raw payload when parsed raw output is absent.
- Fixed usage report rendering to label unlimited plans and display a clear `-- no limits` status line.
2026-04-11 07:02:27 +02:00
can1357 1bb5234477 chore: bump version to 14.0.5 2026-04-11 06:39:46 +02:00
can1357 1c4c8c2851 Merge remote-tracking branch 'fork-inprealpha/feat/opencode-oauth-copilot' 2026-04-11 06:39:13 +02:00
can1357 90338f4dc6 test: updated the gemini-image test harness to use
- Updated the gemini-image test harness to use CustomToolContext, ModelRegistry, and ReadonlySessionManager types.
- Expanded getHeaderValue in gemini-image tests to handle string-array header values.
- Adjusted the resolve.rs stale-selector test to use a let-else Err(err) binding.
- Clarified the fence_marker doc comment to describe CommonMark triple-marker detection semantics.
2026-04-11 05:55:31 +02:00
can1357 77c8bf6e82 fix(chunk): corrected fenced code block indentation preservation and file validation
- Fixed markdown fenced code block rendering to preserve literal indentation instead of normalizing to tabs.
- Added validation to reject chunk selector operations on non-existent files with descriptive error message.
- Fixed chunk deletion to properly derive parent paths and mark ancestors with appropriate focus modes.
- Simplified path segment matching logic by removing unnecessary normalization of requested_segment parameter.
- Added comprehensive test coverage for fenced code block caret reads, indentation preservation, and file-not-found error handling.
2026-04-11 03:43:53 +02:00
can1357 7bf0e59d44 perf(coding-agent): optimized image compression with aggressive payload reduction strategy
- Reduced default image size limits to 1568px and 500KB to match Anthropic's internal thresholds.
- Optimized screenshot compression with 1024px max dimensions, 150KB budget, and 70% JPEG quality for aggressive payload reduction.
- Added fast-path optimization to skip re-encoding when images fit dimensions and are within 25% of byte budget.
- Refactored image encoding strategy to JPEG-only in quality/dimension reduction loops with improved quality ladder steps.
2026-04-11 03:42:26 +02:00
can1357 4ab4ca6d3b feat(chunk): added full-path selector resolution for unique chunks
- Added full-path selector resolution to match untruncated chunk identifiers when they resolve uniquely.
- Extracted path segment matching logic into reusable functions for improved maintainability.
- Added test coverage for full untruncated identifier path resolution.
2026-04-11 02:57:05 +02:00
can1357 0394213f9d fix(chunk): corrected stale chunk selector resolution with CRC fallback matching
- Added fallback logic to resolve stale chunk selectors by matching same-parent CRC when exact selector not found.
- Fixed stale child selector reuse to match chunks by checksum for sibling chunks with identical names.
- Added condition to check for Section chunk kind with Replace operation in region nullification logic.
- Expanded documentation with critical warnings about chunk name truncation and guidance for markdown editing with whitespace preservation.
2026-04-10 22:52:16 +02:00
can1357 6cd077e075 feat(coding-agent): added designer role with model fallback support and Gemini 3.1
- Added designer model role for UI/UX design tasks with Gemini 3.1 Pro as default model.
- Implemented model role fallback list support enabling automatic fallback to next available model when primary is unavailable.
- Refactored model role resolution to support multiple fallback patterns per role with thinking level mapping.
- Updated designer agent to use pi/designer role alias instead of explicit model list, removing spawns configuration.
- Added test coverage for model resolver fallback patterns and designer role override preferences.
- Added test coverage for geminiImageTool X-Title header routing through OpenRouter.
2026-04-10 22:07:02 +02:00
can1357 157eb1009f chore(ai): added X-Title header to OpenRouter and Gemini API requests for identification
- Added X-Title header to OpenRouter and Gemini API requests for identification.
2026-04-10 22:02:11 +02:00
can1357 9817bc83ea fix(lsp): cleared stale diagnostics cache before refreshing file state
- Fixed stale diagnostics being reused after unrelated file publishes by clearing cached diagnostics before refreshing file state.
- Added regression test to verify diagnostics cache is cleared when refreshing files.
2026-04-10 22:01:36 +02:00
can1357 3aa927bc80 refactor(coding-agent): restructured result building to eliminate duplication
- Extracted result building logic into reusable buildResult function to eliminate duplication across three code paths.
- Consolidated import of natives module to use namespace import instead of destructured imports for consistency.
- Reorganized signal timeout initialization to occur before conditional branches for clarity.
- Added test case verifying mtime-based sorting of recursive filename matches.
2026-04-10 21:45:53 +02:00
can1357 cc2801e6ef feat(coding-agent): added HTML content extraction with Readability and GFM markdown support
- Added `extractReadableFromHtml()` utility function with dual-path content extraction using Readability library and CSS selector fallback.
- Integrated Turndown library with GitHub Flavored Markdown plugin for improved HTML-to-markdown conversion supporting tables, strikethrough, and task lists.
- Refactored `getPageReadable()` action to use new extraction function, consolidating content parsing logic and improving maintainability.
- Added TypeScript type declarations for turndown-plugin-gfm module with custom Turndown rules for enhanced markdown formatting.
2026-04-10 21:31:28 +02:00
can1357 7213aaf128 refactor(chunk): restructured chunk rendering to separate prologue and body line counts
- Refactored chunk rendering to compute prologue and body line counts separately via new `chunk_head_body_lines()` function.
- Updated ellipsis marker format from line count to line range selection syntax (e.g., 'to expand above/below').
- Modified `render()` method signature to accept `head_lines` and `body_lines` parameters for precise line count display.
- Simplified no-changes response in chunk edit mode to omit redundant text when content matches.
- Expanded chunk-edit documentation with compound statement examples and region suffix behavior for non-code formats.
2026-04-10 21:14:10 +02:00
can1357 9edc885a40 fix(ai): corrected duplicate synthetic tool results by tracking persisted call IDs
- Fixed duplicate synthetic tool results by tracking persisted tool call IDs and skipping synthesis when real results exist.
- Fixed Codex search streamed answer handling to detect and skip image placeholder text, preferring final answer.
- Added test coverage for duplicate tool result prevention in message transformation pipeline.
2026-04-10 20:13:25 +02:00
can1357 23e0952876 refactor(lsp): extracted diagnostic target resolution into utility function
- Extracted diagnostic target resolution logic into new `resolveDiagnosticTargets()` utility function with glob pattern support.
- Consolidated glob pattern detection and file matching logic by replacing conditional branches with unified utility call.
- Added file existence checking with stat before glob expansion to handle bracket paths as literal targets.
- Added test coverage for bracket path handling in diagnostic target resolution.
2026-04-10 20:12:19 +02:00
can1357 fa375d6eaa refactor: restructured chunk region notation from @head/@body/@tail/@decl to ^/~ suffix format
- Simplified chunk region notation from @head/@body/@tail/@decl to ^/~ suffix format across all modules.
- Removed ChunkRegion::Tail and ChunkRegion::Decl enum variants and updated region matching logic accordingly.
- Added call-with-callback pattern detection via try_promote_call_with_callback() and trailing_callback_body() functions.
- Updated documentation and test fixtures to reflect new region selector syntax throughout codebase.
2026-04-10 17:27:49 +02:00
inprealpha 4a4032dbea Merge branch 'main' into feat/opencode-oauth-copilot 2026-04-10 20:41:36 +05:30
Abir Biswas bf3994ec6e fix(ai): harden Copilot OAuth with auth error handling, login tests, and rate-limit batching
- Detect 401/403 from Copilot and rewrite to actionable re-login message,
  invalidating stale credentials in the session layer (Fix 1)
- Add 9 unit tests for loginGitHubCopilot device-code flow (Fix 2)
- Centralize duplicated "opencode/1.3.15" User-Agent into a single
  exported COPILOT_USER_AGENT / OPENCODE_HEADERS constant (Fix 3)
- Batch model enablement to 5-at-a-time to avoid rate limits (Fix 4)
2026-04-10 20:36:13 +05:30
can1357 4a1ca64a7b docs(chunk): documented chunk-edit region semantics with table format and examples
- Restructured chunk-edit region documentation into table format for clarity and scannability.
- Clarified region semantics with concrete examples and consolidated redundant explanations.
2026-04-10 16:24:55 +02:00
can1357 bb550efc6b chore: cleaned up documentation, test infrastructure, and dependencies across tooling
- Enhanced chunk-edit tool documentation with clarifications on @decl region behavior and guidance for attribute/decorator modifications.
- Improved chunk edit implementation to handle @body region scanning and markdown blank-line preservation with additional test coverage.
- Added oracle model review synthesis to rate-edit-tool.py for aggregating findings across multiple model reviews.
- Updated test infrastructure to run TypeScript and Rust tests in parallel using cargo nextest with improved logging control.
- Updated TypeScript dependencies including @typescript/native-preview and typescript to latest versions.
2026-04-10 15:53:41 +02:00
can1357 476a689c6f refactor(coding-agent): migrated session cleanup to async iterator pattern
- Extracted `raceWithAbort()` utility to pi-utils package for reuse across projects.
- Replaced local `raceAbort()` implementation with imported `raceWithAbort()` from pi-utils.
- Refactored cleanup timer to use async iterator pattern with `timers.setInterval()` instead of callback-based `setInterval()`.
- Converted `#cleanupIdleSessions()` and `#disposeSession()` from async to synchronous methods with async cleanup loop delegated to `#runCleanupLoop()`.
2026-04-10 15:04:46 +02:00
can1357 f4b6b32262 refactor(modes): restructured event controller into dedicated handler methods for type safety
- Extracted large switch statement into 16 dedicated event handler methods for improved maintainability and type safety.
- Introduced AgentSessionEventHandlers type and handler dispatch map to enable compile-time verification of event coverage.
2026-04-10 14:49:06 +02:00
can1357 d60ee622a4 refactor: restructured hash API and cache tracking across TypeScript and Rust
- Migrated hash API calls from Bun.hash.xxHash64() to Bun.hash() across TypeScript packages for simplified hash generation.
- Consolidated mermaid cache failure tracking by replacing separate failed Set with null values in cache Map.
- Refactored schema-based child extraction in Rust by introducing promotion_fields tracking and schema_wrapper_child() helper function.
- Updated TypeScript configuration files with reformatted arrays and added compiler options for consistency.
2026-04-10 14:26:06 +02:00
can1357 b60c0cc3ce refactor: migrated tab width resolution to pi-utils with EditorConfig caching
- Extracted tab width resolution from pi-natives to pi-utils with EditorConfig caching support.
- Made tabWidth parameter required in native text functions (visibleWidth, truncateToWidth, wrapTextWithAnsi, sliceWithWidth, extractSegments).
- Removed process-wide tab width state management from pi-natives text module.
- Consolidated wrapper node promotion logic in chunk classification with abbreviated string representations.
- Removed path-clean and pathdiff dependencies from pi-natives.
- Updated all consuming packages to import tab width functions from pi-utils and pass explicit tabWidth parameters.
2026-04-10 14:18:36 +02:00
can1357 0e5dfd542b chore: bump version to 14.0.4 2026-04-10 13:34:27 +02:00
can1357 6bf09bedb0 refactor(chunk): restructured language classifiers to declarative rule tables
- Migrated language classifiers from imperative methods to declarative semantic rule tables with ClassifierTables and StructuralOverrides.
- Extracted node shape analysis into dedicated shape module with field priority constants and helper functions for AST traversal.
- Added schema module with language-aware node metadata and thread-local language context management.
- Centralized environment variable parsing across codebase using $flag(), $envpos(), and isBunTestRuntime() utilities.
- Added PI_CHUNK_AUTOINDENT configuration to control indentation normalization in chunk read/edit operations.
- Enhanced system prompt with instruction priority, output contract, tool persistence, and completeness guidelines.
2026-04-10 13:33:00 +02:00
can1357 55e27e842e refactor(coding-agent): extracted language detection into dedicated module
- Extracted language detection logic into dedicated module for reusability across LSP and theme subsystems.
- Unified extension-to-language mapping with dual identifiers (highlight and LSP) to eliminate duplication.
- Consolidated detectLanguageId and getLanguageFromPath into single source of truth in lang-from-path module.
2026-04-10 10:42:50 +02:00
can1357 5fb98634b1 feat: implemented merge conflict detection and resolution API for chunk state
- Added merge conflict detection and resolution API with hasConflicts() and conflictCount() methods to ChunkState.
- Implemented conflict marker parsing supporting standard and diff3-style formats with accept_ours() resolution.
- Extended ChunkKind enum with Hunk, Conflict, Ours, and Theirs variants for diff and merge conflict representation.
- Added virtual_content field to ChunkNode for rendering conflict branches and improved diff parsing with block-level file chunk handling.
- Implemented conflict metadata tracking across edits with validation preventing direct modifications to virtual conflict branches.
2026-04-10 07:44:12 +02:00
can1357 e102958f06 fix(edit): corrected hashlineParseText to handle undefined values
- Extended hashlineParseText to accept undefined in addition to null, preventing type errors when undefined is passed.
- Updated null check to use loose equality (==) to handle both null and undefined cases.
2026-04-09 20:13:58 +02:00
can1357 fa12644267 chore: bump version to 14.0.3 2026-04-09 20:03:21 +02:00
can1357 5d48656544 revert: restructured indentation from tab-based to space-based representation
This reverts commit 29376dac2b.
2026-04-09 20:02:57 +02:00
Can Bölük 77075ca406 Merge pull request #649 from bobags2/fix/ollama-use-openai-responses-api
fix: use OpenAI Responses API for Ollama instead of Completions
2026-04-09 19:27:17 +02:00
can1357 c0ba48cb68 fix(coding-agent): normalize cached Ollama discovery transport 2026-04-09 18:57:52 +02:00
can1357 69c915e9d8 fix(ai): preserve Copilot enterprise metadata in peeked credentials 2026-04-09 18:57:51 +02:00
can1357 a9e0f02657 refactor(review): render extra instructions from template 2026-04-09 18:57:51 +02:00
bobags2 ff3cf964e8 fix: use OpenAI Responses API for Ollama instead of Completions
Ollama has supported the OpenAI Responses API since v0.6+. The Completions
stream is prone to stalling errors ("OpenAI completions stream stalled while
waiting for the next event"), especially with tool calls. The Responses API
is more robust and supports the same features.

Changes:
- pi-ai/openai-compat.ts: Changed ollamaModelManagerOptions() and
  fetchOllamaNativeModels() to use api: "openai-responses" instead
  of "openai-completions"
- coding-agent/model-registry.ts: Changed implicit ollama discovery
  provider from "openai-completions" to "openai-responses"

Users with existing model caches should clear them after upgrading
(e.g. delete the ollama entry from ~/.omp/agent/models.db).
2026-04-09 18:47:09 +02:00
Miroslav Drbal 93f7953603 feat(review): support inline custom instructions in /review command
Pass args directly to /review to append them as additional instructions
to the generated prompt for all structured review modes (PR-style,
uncommitted, specific commit). When inline args are present, option 4
(custom editor) is suppressed from the menu. The no-UI (Task tool) path
forwards args as a focus hint.

Adds appendInstructions() helper to centralize the prompt append format.
2026-04-09 18:47:08 +02:00
Abir Biswas bafa3b8a06 fix: github.com enterprise routing and structured Copilot OAuth credentials 2026-04-09 18:47:08 +02:00
Abir Biswas 31e4b91019 feat(ai): replace GitHub Copilot auth with opencode OAuth flow
Replace VSCode extension impersonation (client ID Iv1.b507a08c87ecfe98,
User-Agent GitHubCopilotChat/0.35.0) with the opencode OAuth app
(Ov23li8tweQw6odWQebz, User-Agent opencode/1.3.15).

Key changes:
- OAuth device flow now uses JSON body encoding and opencode headers
- GitHub OAuth token is used directly for all API requests; no JWT
  exchange or refresh cycle needed
- Base URL changed from api.individual.githubcopilot.com to
  api.githubcopilot.com across models.json, openai-compat.ts, and
  the oauth module
- Removed proxy-ep JWT base URL extraction from github-copilot-headers.ts
  and openai-compat.ts (resolveGitHubCopilotBaseUrl now passes through
  the model baseUrl unchanged)
- refreshGitHubCopilotToken is now a synchronous identity return
- All 25 bundled Copilot model definitions updated to new headers/baseUrl
- Tests updated to reflect plain GitHub token format and new base URL

Existing users will need to re-authenticate once with /login github-copilot.
2026-04-09 18:47:08 +02:00
Can Bölük d6993d0029 Merge pull request #648 from sundbp/session-observer-tmux-fix
fix(coding-agent): stop repetitive scrolling in session observer viewer
2026-04-09 18:44:38 +02:00
Can Bölük 1aa21a368a Merge pull request #646 from Blues-star/fix/windows-lsp-local-bin-detection
fix: TypeScript LSP detection on Windows
2026-04-09 18:44:30 +02:00
Patrik Sundberg bb5f332eca fix(coding-agent): stop repetitive scrolling in session observer viewer
Move live stats (tokens, tools, duration) from the header — which scrolls
above the TUI viewport for long transcripts — to a stable Text component
placed after the viewerContainer. Stats are updated in-place via setText()
so the diff algorithm sees changes near the bottom of rendered output,
avoiding the fullRender(true) trigger when firstChanged < viewportTop.

Previously every ~150ms progress update changed the header stats line,
which sat above the viewport for large transcripts. The TUI's safety
check (firstChanged < previousContentViewportTop) forced a full screen
clear and re-render each cycle. In multiplexers (tmux/zellij) this
produced visible repetitive scrolling because scrollback is preserved
across clears.
2026-04-09 02:19:41 +01:00
can1357 a4e44208da chore: bump version to 14.0.2 2026-04-09 02:35:59 +02:00