Commit Graph

3243 Commits

Author SHA1 Message Date
can1357 b2dc706ee7 feat: enabled auto-retry for AI thinking loops
- Improved thinking loop detection logic by refining text normalization and treating stalls as retryable errors.
- Instrumented the agent session to recognize thinking loop markers within retryable error conditions.
- Automated the clearing of stale error banners upon successful auto-retry execution.
- Added comprehensive test coverage for chunked thinking loop errors and banner management.
2026-06-19 17:51:53 +02:00
can1357 8351536641 refactor(coding-agent): consolidated and prioritize perplexity authentication
- Moved authentication logic to `perplexity-auth.ts` to share logic between search providers and CLI commands.
- Updated authentication priority to prefer browser cookies over OAuth tokens during search operations.
- Modified the `token` CLI command to display active OAuth tokens when both an OAuth token and an API key are configured.
- Added comprehensive unit tests in `perplexity.test.ts` to verify authentication priority and precedence.
2026-06-19 17:44:59 +02:00
can1357 9478e3cc5c refactor: replaced ReturnType<typeof setTimeout> with Timer type
- Replaced usage of `ReturnType<typeof setTimeout>` and `ReturnType<typeof setInterval>` with the explicit `Timer` type across the codebase.
- Updated several type definitions and function signatures to use concrete types instead of inferred return types for improved clarity and maintainability.
2026-06-19 17:38:07 +02:00
can1357 2de02f2119 Merge PR #3019: fix: Windows test failures — path handling, EBUSY, SQLite handle leaks (@oldschoola) 2026-06-19 17:17:04 +02:00
can1357 f88cf45eb6 fix(lsp): also no-op workspace/{inlineValue,foldingRange}/refresh
The PR fixed the -32601 hang for the defined server->client refresh
requests but missed two real spec methods of the identical class:
workspace/inlineValue/refresh (LSP 3.17) and workspace/foldingRange/refresh.
A server emitting either still received Method not found and could stall.
Add both to the void-ack chain and extend the regression test.
2026-06-19 17:17:04 +02:00
can1357 a8966466bb Merge PR #3045: fix(lsp): reply to defined server requests with spec no-ops (@roboomp) 2026-06-19 17:17:04 +02:00
can1357 6486e2a14a Merge PR #3021: fix(ipc): harden worker IPC send against async EPIPE rejections (@oldschoola) 2026-06-19 17:16:37 +02:00
can1357 5c66faa81d Merge PR #3026: fix(coding-agent): guard theme getters against undefined theme before init (@oldschoola) 2026-06-19 17:16:37 +02:00
can1357 0916017b5a Merge PR #3037: fix(coding-agent): delay image credential lookup until execution (@roboomp) 2026-06-19 17:16:37 +02:00
can1357 480aa1763c Merge PR #3034: fix(mnemopi): isolate local embeddings worker in subprocess (@roboomp) 2026-06-19 17:16:36 +02:00
can1357 83221650f1 Merge PR #3038: fix(coding-agent): auto-enable append-only context for Ollama and local servers (@roboomp) 2026-06-19 17:16:18 +02:00
can1357 052b6b0c61 Merge PR #3006: fix(providers): accept Bedrock inference profile ARNs (@roboomp) 2026-06-19 17:16:18 +02:00
can1357 6f05108299 Merge PR #3023: fix(coding-agent): re-encode WebP for local-server models (@danzaio) 2026-06-19 17:16:07 +02:00
can1357 40101bd3eb Merge PR #3043: fix(catalog): omit Ollama Cloud output caps (@wolfiesch)
# Conflicts:
#	packages/catalog/src/models.json
2026-06-19 17:15:43 +02:00
can1357 67f6518e42 feat: enhanced tool robustness, improve authentication flow, and update API parameters
- Implement JSON repair and strict argument validation to sanitize raw payloads and redact sensitive information from agent event logs.
- Add automatic authentication fallback for benchmark model resolution to ensure consistent performance testing across providers.
- Refactor search tool API parameters by replacing `i` with a case-sensitive `case` boolean flag for clarity.
- Update session history formatting to ensure empty objects are consistently serialized as `{}` instead of empty strings.
2026-06-19 16:46:07 +02:00
can1357 7d28c60c86 refactor: renamed intent field from _i to i
- Renamed the global `INTENT_FIELD` constant from `_i` to `i`.
- Updated documentation strings, type annotations, and test expectations across packages to reflect the new field name.
- Ensured consistent usage of the constant in tool schema construction and intent serialization.
2026-06-19 16:42:33 +02:00
can1357 d46bd0139b refactor(coding-agent): fixed system prompt customization path
- Fixed `SYSTEM.md` integration to correctly include custom-rendered sections like rules and skills.
- Consolidated system prompt validation by requiring `<skills>` tag presence instead of specific prose.
- Removed redundant system prompt math-formatting tests and orphaned task batch documentation tests.
2026-06-19 16:16:37 +02:00
can1357 fd0dd40083 refactor(coding-agent): improved detection of reflowing markdown
- Replaced regex-based markdown detection with a stateful parser in `detectLiveReflowingMarkdown`.
- Correctly ignore table delimiters and mermaid markers when they appear inside fenced code blocks.
- Added tests to verify that code blocks containing markdown-like syntax do not prevent commit stability.
2026-06-19 16:11:40 +02:00
can1357 865694df7e fix: resolved streaming stability and reference isolation issues
- Prevent object reference sharing between agent snapshots and stream events by deep-cloning tool-call arguments.
- Stabilize GFM tables and Mermaid diagrams during streaming by delaying transcript block commits until content finalization.
- Implement session resume safety to prevent crashes when working directories are missing.
- Add comprehensive test suites to verify streaming commit stability and immutable snapshot isolation.
2026-06-19 16:09:00 +02:00
can1357 80a0a1b8a8 feat(utils): replaced createAbortableStream with abortableSource
- Introduced `abortableSource` as a lighter, direct-reader async generator.
- Removed the `createAbortableStream` public API to eliminate unnecessary stream wrapper layers.
- Updated internal stream processing to use `abortableSource` for improved memory and performance.
2026-06-19 16:06:18 +02:00
can1357 3f10bc5e43 perf(coding-agent/debug): optimized buffer eviction with head-index ring
- Replaced O(n) `Array.shift()` calls with O(1) head-index tracking in `RawSseDebugBuffer`.
- Implemented lazy compaction to reclaim the dead-prefix memory only when the leading window grows sufficiently large.
- Added comprehensive tests to verify ordering, dropped count accuracy, and buffer limits under heavy load.
2026-06-19 16:06:18 +02:00
can1357 a98230addc chore: update changelog & tests 2026-06-19 16:06:18 +02:00
can1357 45b2eb5ca8 Merge remote-tracking branch 'origin/farm/117835bc/fix-custom-system-prompt' 2026-06-19 16:06:15 +02:00
can1357 6d7dab0c68 fix(coding-agent): prevented crash when resuming session in deleted directory
- Export `directoryExists` in `utils` to safely validate working directories before traversal.
- Update `SessionManager` and startup logic to fallback to the launch directory if a session's recorded working directory no longer exists.
- Add regression tests to ensure sessions now correctly adopt the launch directory instead of crashing on missing paths.
2026-06-19 16:06:01 +02:00
roboomp bbbd256565 fix(prompting): preserved custom prompt project footer
Render the project footer for custom system prompts while omitting context and append text already emitted by the custom prompt template.

Fixes #3014
2026-06-19 12:09:34 +00:00
roboomp b4b11232e5 fix(prompting): preserved CLI prompt precedence over SYSTEM.md
Skip the secondary loadSystemPromptFiles capability walk when the caller already controls block 0 via customPrompt/resolvedCustomPrompt, so project/user SYSTEM.md cannot silently augment a CLI --system-prompt override.

Fixes #3014
2026-06-19 12:00:46 +00:00
roboomp 21f3496976 fix(prompting): preserved resolved system prompt text
Bypass path resolution when session startup has already loaded SYSTEM.md or APPEND_SYSTEM.md contents.

Fixes #3014
2026-06-19 11:57:16 +00:00
roboomp e2da0c5458 fix(prompting): rendered system prompt template for system md
Route resolved SYSTEM.md content through the custom prompt template path instead of replacing the fully rendered default prompt block.

Fixes #3014
2026-06-19 11:50:45 +00:00
Wolfgang Schoenberger 99c90a2ef1 fix(coding-agent): normalize cached Ollama Cloud output caps 2026-06-19 03:56:02 -07:00
roboomp ef901ecb0d fix(lsp): replied to defined server requests with spec no-ops
handleServerRequest fell through to a JSON-RPC -32601 Method not found for several defined server -> client requests (window/showMessageRequest, window/showDocument, workspace/{semanticTokens,inlayHint,codeLens,codeAction,diagnostic}/refresh). Servers that block on a real reply -- the same failure class as the client/registerCapability hang fixed in #3029 -- could stall waiting for an acknowledgement that never came.

Reply with the spec no-op result instead: null for showMessageRequest / *Refresh, { success: false } for showDocument. Headless omp cannot honour the UI surface, but it still owes a defined response.

Fixes #3044
2026-06-19 10:11:54 +00:00
Wolfgang Schoenberger 409af331e7 fix(catalog): omit Ollama Cloud output caps 2026-06-19 02:51:23 -07:00
roboomp 4353920b95 fix(coding-agent): include llama.cpp in append-only allowlist
ModelRegistry registers a built-in llama.cpp discovery as `provider:
"llama.cpp"` (model-registry.ts:1063), so a reverse-proxied or
public-DNS llama.cpp endpoint never trips the loopback heuristic and
was still falling through to no append-only context.

Add "llama.cpp" to LOCAL_INFERENCE_PROVIDERS, refresh the docstring
on `hasLocalLoopbackBaseUrl` (it covers user-defined providers; built-
in local ids are caught by the allowlist), and extend the test to
exercise a public-host llama.cpp baseUrl so the allowlist path is
covered independently of the loopback heuristic.

Refs #3033
2026-06-19 08:26:14 +00:00
roboomp 9a07533924 fix(coding-agent): auto-enable append-only context for Ollama and local servers
Ollama, LM Studio, and llama.cpp / vLLM all do byte-prefix KV cache reuse
on the model server side. The agent loop's non-append-only path rebuilds
the system prompt and tool catalogue on every turn through fresh
allocations (`normalizeTools`, `convertToLlm`, optional memory-backend
`beforeAgentStartPrompt` injection), which dirties enough leading bytes
to invalidate the cache and force a full prompt re-evaluation.

`shouldAutoEnableAppendOnlyContext` previously only recognized DeepSeek
and Xiaomi Token Plan. Extend the auto-detect:

- Allowlist the known local-server provider ids (`ollama`,
  `ollama-cloud`, `lm-studio`).
- Detect user-defined local servers by parsing `baseUrl`: loopback,
  RFC1918 private IPv4, and `.local` mDNS hostnames.
- Keep the existing `compat.supportsStore` opt-in escape hatch and the
  explicit `provider.appendOnlyContext: on`/`off` override paths.

Regression coverage in `append-only-context-mode.test.ts` exercises
each new positive case plus negative samples (172.15/172.32 just outside
RFC1918, public hosts, malformed URLs).

Fixes #3033
2026-06-19 08:20:15 +00:00
roboomp 65782a75e6 fix(mnemopi): carry (model, cacheDir) on every embed for respawn safety
After `shutdownMnemopiEmbedClient()` clears `#worker` (session dispose, or
worker crash), mnemopi still holds the cached `LocalEmbeddingModel` wrapper.
The next embed re-spawned a fresh subprocess that had never received
`init`, and the bare `embed` request tripped the "embed before init" guard,
breaking local embeddings for the rest of the process.

- Carry `model` + `cacheDir` in every `embed` IPC; bind both into the
  `MnemopiSubprocessEmbeddingModel` closure when the wrapper is created.
- Worker calls `ensureLoaded(model, cacheDir)` in `handleEmbed` (idempotent
  for the same key, so steady-state embeds pay nothing). Drops the
  "embed before init" guard — `embed` self-initializes.
- Promotes the internal `WorkerHandle` interface to `MnemopiEmbedWorkerHandle`
  so the test seam can construct a fake worker.
- New regression test drives a fake worker, terminates + re-embeds the SAME
  cached wrapper, and asserts every embed message still carries the bound
  `(model, cacheDir)`.

Per review on #3034.
2026-06-19 08:20:14 +00:00
roboomp 37015331f5 fix(coding-agent): delayed image credential lookup
Stopped image tool registration from resolving provider credentials during session startup. Added coverage that registration stays lazy while execution still resolves credentials.

Fixes #3036
2026-06-19 08:19:55 +00:00
roboomp bf56a76e59 fix(mnemopi): isolated local embeddings worker in subprocess to skip onnxruntime napi crash
Moved mnemopi's local embedding provider out of the main agent process by
spawning a dedicated `Bun.spawn` child for fastembed + onnxruntime-node. The
agent CLI gains a hidden `__omp_worker_mnemopi_embed` dispatch; `loadMnemopi`
/ `loadMnemopiCore` install the subprocess-backed initializer through the
newly-exposed `setLocalModelInitializer` seam so every `embed()` call
round-trips through IPC instead of loading the NAPI module. The parent
SIGKILLs the child on dispose so the destructor that segfaults Bun on
Windows shutdown (NAPI finalizer at exit on npm installs, `process.dlopen`
constructor at session start on standalone binaries) never runs in any
address space the agent owns. Mirrors the tiny-model fix from #1607.

Adds `smokeTestMnemopiEmbedWorker` to `omp --smoke-test`, a new
`test/issue-3031-repro.test.ts` that pins the spawn/dispatch/signal-exit
contract and forbids re-importing `fastembed-runtime` from the agent surface,
and changelog entries.

Fixes #3031
2026-06-19 08:09:50 +00:00
can1357 ea9ff271e5 Merge remote-tracking branch 'origin/farm/ba7d8cf5/lsp-register-capability' 2026-06-19 09:02:38 +02:00
can1357 29221ae202 Merge remote-tracking branch 'origin/farm/e2ad9334/gate-advisor-sub-options' 2026-06-19 09:02:29 +02:00
can1357 3c90f3bdd1 feat(coding-agent): ignored cache invalidation false positives for implicit providers
- Add a check requiring `cacheWrite > 0` to identify meaningful cache invalidation.
- Prevent false positives for providers with implicit caching that intermittently report zero reads without a fresh cache write.
- Add regression test case to verify implicit providers are not flagged as invalidations.
2026-06-19 09:02:22 +02:00
can1357 7864a1363c feat(coding-agent): consolidated macOS power settings into enum
- Replaced four individual power boolean settings with a single `power.sleepPrevention` enum for improved configuration management.
- Implemented automatic migration logic in `Settings.init` to map legacy macOS power booleans to the new enum levels.
- Updated `AgentSession` to utilize the new `sleepPrevention` enum for macOS power assertion lifecycle management.
- Changed default value of `display.cacheMissMarker` to `false` to suppress cache-miss markers.
- Added comprehensive unit tests in `settings-manager.test.ts` to verify backward-compatible migration behavior.
2026-06-19 08:54:20 +02:00
roboomp 1a9fef5014 fix(lsp): accepted dynamic capability registration
- Accepted client/registerCapability and client/unregisterCapability server requests so Expert can continue startup before semantic requests.\n- Allowed JSON-RPC string ids on LSP request/response handling.\n- Added a regression test for dynamic registration gating hover.\n\nFixes #3029
2026-06-19 06:50:02 +00:00
roboomp ffcbc5f876 fix(ux): gated advisor dependent settings
Added an advisorEnabled visibility predicate and wired the advisor dependent settings through it so the Model Advisor sub-options hide unless Enable Advisor is active. Added regression coverage for the settings UI adapter.\n\nFixes #3027
2026-06-19 06:39:24 +00:00
can1357 ed1c977bbb tests: remove stale openrouter tests 2026-06-19 08:11:40 +02:00
can1357 82c4c14fd7 feat(coding-agent): added tracking for expected cache invalidations
- Added tracking for expected cache invalidations during model changes, compactions, and plan-mode transitions.
- Included `cacheMissExplainedAt` metadata in session context to prevent displaying misleading cache miss warnings in the transcript.
- Updated controller logic to reset assistant usage markers when mode-switching or performing actions that invalidate the prompt cache.
2026-06-19 08:08:14 +02:00
can1357 65f0d0a245 refactor(coding-agent): renamed repeatToolDescriptions to inlineToolDescriptors
- Renamed `repeatToolDescriptions` to `inlineToolDescriptors` throughout configuration, SDK, and internal session management.
- Set the default value to `true` and updated descriptions to clarify the descriptor inlining behavior.
- Fixed the `/dump` command to prevent duplicate tool inventory output when inlining is enabled.
2026-06-19 08:05:49 +02:00
can1357 b877464575 refactor(coding-agent): migrated UI chrome to rounded box corners
- Switch all UI components and tests from sharp box corners (`boxSharp`) to rounded ones (`boxRound`).
- Update `Theme` to re-export sharp junction symbols (tees and cross) under `boxRound` to ensure consistent divider rendering in rounded boxes.
- Remove outdated architectural notes regarding forced tool-choice queues in documentation.
2026-06-19 07:57:15 +02:00
can1357 ed73429faa feat: implemented soft tool requirement and escalation system
- Introduced `SoftToolRequirement` to support non-invasive tool enforcement with lifecycle management and escalation.
- Added `ToolChoiceDirective` to coordinate hard and soft tool requirements within the agent loop.
- Optimized preview workflows in `coding-agent` by replacing forced tool choices with non-forcing pending invokers.
- Enhanced `CompactionSummaryMessage` to prioritize structured rendering for tool requirement reminders.
2026-06-19 07:51:27 +02:00
can1357 5e507b0165 feat(coding-agent): implemented detectCacheInvalidation to identify
- Implemented `detectCacheInvalidation` to identify when model requests lose their prompt cache.
- Added `CacheInvalidationMarkerComponent` to display a slim notice above affected assistant turns.
- Updated `ChatTranscriptBuilder` and `EventController` to track session usage and inject markers dynamically.
- Included comprehensive test coverage for invalidation detection logic and UI rendering.
2026-06-19 07:49:53 +02:00
DanZAIO fa0de71100 fix(coding-agent): track STB image decoders for discovered models 2026-06-19 02:33:34 -03:00
oldschoola cc3c956f26 fix(coding-agent/modes): guarded theme getters against undefined theme before init
- Added `typeof theme === "undefined"` guards to all four theme getters.
- Fallbacks return a usable plain-ASCII or plain-text theme instead of crashing.
- Added a pre-init test asserting the getters never throw.
2026-06-18 22:14:24 -07:00