Commit Graph

3809 Commits

Author SHA1 Message Date
can1357 09d91301ae Merge remote-tracking branch 'fork-apoc/feat/cc-client-parity' 2026-06-02 10:31:52 +02:00
can1357 7ad8e1260e feat(coding-agent): added Claude Code MITM proxy for /v1/messages capture
- Added local CONNECT proxy with TLS interception to capture Claude API traffic.
- Drives Claude Code via headless PTY/xterm and extracts the first /v1/messages exchange.
- Added `claude:trace` npm script and CLI with JSON/text output modes.
- Added integration test using a fake Claude script against a local TLS server.
2026-06-02 10:31:40 +02:00
can1357 34f328f44a fix(ai): fixed Anthropic identity handling with deterministic install-based IDs
- Derived Anthropic and session metadata `device_id` from `getInstallId()` deterministically.
- Added CLAUDE bootstrap identity lookup and merged fallback into token exchange/refresh.
- Recovered `accountId` and `email` during token exchange/refresh when token payloads lacked them.
- Enforced bootstrap failures for non-OK responses and invalid JSON payloads.
2026-06-02 10:30:47 +02:00
can1357 3c398c7eb1 Merge remote-tracking branch 'origin/farm/48a24745/fix-anthropic-custom-headers-web-search' 2026-06-02 10:11:24 +02:00
can1357 53b998fc9c Merge remote-tracking branch 'origin/farm/1e6f50e9/document-anthropic-search-env-vars' 2026-06-02 10:11:15 +02:00
roboomp b3bcf966ee fix(coding-agent): resolve exa credentials through auth storage
ExaProvider.isAvailable() and searchExa() now consult AuthStorage so Exa credentials configured through the broker/credential store work alongside EXA_API_KEY, matching the other API-key search providers.

Refs #1695
2026-06-02 08:00:35 +00:00
roboomp b3ec588921 fix(coding-agent): honored Anthropic search base URL for fallback auth
- Passed ANTHROPIC_SEARCH_BASE_URL through to Anthropic web search calls that use authStorage fallback credentials instead of only applying it with ANTHROPIC_SEARCH_API_KEY.
- Added regression coverage asserting fallback Anthropic credentials use the search-specific base URL.
- Updated the environment and web_search docs to reflect the actual credential and base URL resolution order.

Fixes #1694
2026-06-02 07:57:34 +00:00
roboomp 963bdebf53 fix(coding-agent): require exa api key for web search
Exa web search no longer advertises availability without EXA_API_KEY and searchExa fails before attempting unauthenticated MCP.

Fixes #1695
2026-06-02 07:54:19 +00:00
roboomp 4bd0fe573c fix(anthropic): forward ANTHROPIC_CUSTOM_HEADERS for non-Foundry enterprise gateways
The Anthropic web search path built request headers via buildAnthropicSearchHeaders, which never threaded model headers through buildAnthropicHeaders, so ANTHROPIC_CUSTOM_HEADERS was dropped from every web-search request regardless of mode. The streaming path's resolveAnthropicCustomHeaders also gated on isFoundryEnabled(), so users with a corporate ANTHROPIC_BASE_URL + ANTHROPIC_CUSTOM_HEADERS (e.g. X-Gateway-Key) got 401s on web_search unless they set CLAUDE_CODE_USE_FOUNDRY=true.

Loosen the resolver to also apply when ANTHROPIC_BASE_URL points to a non-Anthropic host, export the baseUrl-keyed variant, and have buildAnthropicSearchHeaders pass the resolved custom headers as modelHeaders so search and streaming paths behave identically. Stock api.anthropic.com (no Foundry) still omits the headers.

Fixes #1693
2026-06-02 07:52:37 +00:00
roboomp 5b1e5a5c4a docs: documented ANTHROPIC_SEARCH_API_KEY and ANTHROPIC_SEARCH_BASE_URL
- Expanded the existing entries in docs/environment-variables.md so the override-semantics ('search-only, isolates from main ANTHROPIC_API_KEY / ANTHROPIC_BASE_URL / FOUNDRY_BASE_URL') are spelled out, and added a usage note for enterprise-gateway split routing.
- Surfaced the search-only env vars (ANTHROPIC_SEARCH_API_KEY / ANTHROPIC_SEARCH_BASE_URL / ANTHROPIC_SEARCH_MODEL) in the Anthropic provider section of docs/tools/web_search.md, where users were already looking.
- Added ANTHROPIC_SEARCH_BASE_URL alongside ANTHROPIC_SEARCH_API_KEY in 'omp --help' so the pair shows up together in the CLI env-var summary.

Fixes #1694
2026-06-02 07:49:59 +00:00
roboomp dbdc77697c fix(coding-agent): retried session resume even when initial restore failed
Post-extension session-model retry now covers the case where the initial restore failed entirely (e.g. saved default unavailable, last active role supplied by an extension) and the settings default filled in the active model. Also recomputes thinking-level from full precedence against the reclaimed model so a fallback model's defaultLevel does not become sticky.\n\nFixes #1649
2026-06-02 09:15:45 +02:00
roboomp 0494454528 fix(coding-agent): retried role restore after extension providers
Initial startup resume runs before extension providers register, so a role model supplied by an extension fell back to the saved default. Retry the preferred session-model candidates once provider registrations are processed and re-resolve thinking level for the new model.\n\nFixes #1649
2026-06-02 09:15:45 +02:00
roboomp cf9eb5b0f9 fix(coding-agent): skipped temporary resume models
Treat temporary model_change roles as non-restorable when resuming sessions so context-promotion and retry-fallback models do not override the saved default.\n\nFixes #1649
2026-06-02 09:15:45 +02:00
roboomp 00adc9c5d6 fix(coding-agent): fell back to saved default on resume
Try the last active role model first, then the saved default model when the role model cannot be restored during session switching or startup resume.\n\nFixes #1649
2026-06-02 09:15:45 +02:00
roboomp bb0991e6f3 fix(coding-agent): restored last active role model
Use the last model_change role when resuming an existing session instead of always restoring models.default. Covered both /resume switchSession and startup continue paths.\n\nFixes #1649
2026-06-02 09:15:44 +02:00
can1357 ab935e992c fix(legacy-pi-compat): scope rewrite hook to the import graph, not a dir
Address review of the in-place loader: the directory-subtree filter had two
regressions vs the old mirror.

- It only rewrote files under the entry's package root, so a `dist/`
  entry importing `../../shared/helper.ts` (or a symlink-escaping sibling)
  left that module's legacy `@(scope)/pi-*` / `@sinclair/typebox` imports
  un-rewritten.
- `findExtensionRoot` walked up to the nearest package.json, which for an
  ad-hoc extension under a project (e.g. `/repo/.omp/extensions/foo.ts`)
  resolved to the project root — so the permanent onLoad hook would then
  rewrite unrelated project/host source imported later.

Replace the directory filter with a precise scope: pre-walk the entry's
relative-import graph (static + dynamic `./`/`../` specifiers), collect each
module's realpath, and build the onLoad filter as an exact-path alternation
of just those modules. This matches exactly the set the old mirror tracked
(minus the copy): it covers `../src`/symlinked siblings and never touches
the host, other extensions, node_modules deps, or unrelated project files.

Adds a regression test that a non-imported sibling stays outside the rewrite
scope, and renames the ../src test to reflect graph-following.
2026-06-02 09:15:44 +02:00
can1357 c5e3698f45 fix(legacy-pi-compat): load extensions in place instead of mirroring
Legacy Pi extensions were mirrored module-by-module into a flat temp dir
(`omp-legacy-pi-file/entry-<hash>/`) with imports rewritten to absolute
URLs. Running from that temp root made `import.meta.url`/`__dirname`
resolve to the mirror, so `readFileSync(join(__dirname, "ui.html"))`-style
asset loads ENOENT'd — e.g. @plannotator/pi-extension's HTML never loaded
and it auto-approved plans (#1674). The standing remedy (#1675) copied
~30MB of .html/.css per startup with a fragile extension whitelist.

Bun's runtime plugins don't fire onResolve for transitive imports, which
is why the mirror pre-resolved everything. But onLoad does fire
transitively for file-namespace modules matching its filter, and a real
file import keeps import.meta.url pointing at the source. So:

- Load the extension entry in place via `import(pathToFileURL(real))`;
  realpath first so the path matches what Bun hands onLoad (macOS
  /var->/private/var, bun link/pnpm symlinks).
- Register one Bun.plugin() onLoad per extension *package root* (nearest
  package.json), filtered to that root's .js/.ts but excluding any
  node_modules segment, that rewrites only `@(scope)/pi-*` and the bare
  `@sinclair/typebox` specifier to absolute bundled/shim URLs.
- Everything else — relative siblings (incl. ../src), the extension's own
  node_modules deps (CJS/ESM), and bundled assets — resolves natively.

Removes the flat mirror, the temp-dir writes, the asset-copy problem, and
the now-dead `omp-legacy-pi-file:` namespace machinery. import.meta.url is
the real source file, so assets resolve exactly as under the original Pi
runtime. Adds an in-place load regression test covering asset reads,
submodule .css siblings, node_modules-excluded native deps, and
package-root-scoped ../src rewrites.

Fixes #1674.
2026-06-02 09:15:44 +02:00
SuperHedge 811c9e65d0 fix(coding-agent): show execution context in plan approval 2026-06-02 08:57:11 +02:00
can1357 7b5517b255 fix(open): fixed WSL local file opening via wslpath and wslview
- Converted existing local paths to Windows paths via `wslpath -w` before opening.
- Used `wslview` directly in WSL environments, bypassing `xdg-open`'s broken file-handler translation.
- Fell back to `xdg-open` for URLs or when `wslview` is unavailable.
- Added unit tests covering WSL file, URL, and fallback scenarios.
2026-06-02 08:42:44 +02:00
can1357 05d44836dd chore: typo 2026-06-02 08:42:43 +02:00
Can Bölük e5109e6c92 Merge pull request #1318 from ogormans-deptstack/feat/1313-hide-thinking-flag
feat: add --hide-thinking CLI flag to suppress thinking blocks in TUI
2026-06-02 09:31:49 +03:00
Can Bölük 20bcea6830 Merge branch 'main' into farm/b73cb08b/acp-background-opt-in 2026-06-02 09:30:07 +03:00
Can Bölük 9488cb52fe Merge branch 'main' into main 2026-06-02 09:28:09 +03:00
can1357 1a1c473e7f refactor(web-search): fold Kagi V1 into the kagi provider
Replace the sunset V0 Search API with V1 (POST /api/v1/search) under the
existing `kagi` provider id instead of shipping a parallel `kagi-v1`
provider. Credentials still resolve through the shared AuthStorage broker
(Bearer token, KAGI_API_KEY, /login kagi), and recency now maps to a
UTC-deterministic filters.after date.

- Merge V1 client into src/web/kagi.ts (categorized result buckets, direct
  answer, related/adjacent questions)
- Keep classifyProviderHttpError mapping for auth/quota signals
- Drop the kagi-v1 entries from the provider registry, order, type union,
  and settings schema
- Consolidate tests into web-search-kagi.test.ts
2026-06-02 08:26:55 +02:00
Can Bölük 3c024aa5ce Merge pull request #1687 from can1357/farm/802d1a6a/update-bypass-bun-manifest-cache
fix(update): bypass bun manifest cache so omp update sees fresh releases
2026-06-02 09:22:33 +03:00
roboomp a3fbeb4a0a style: bun run fix 2026-06-02 06:19:00 +00:00
roboomp 9abce6e974 fix(update): pinned npm registry and bypassed bun cache for omp update
omp resolves the update target by querying https://registry.npmjs.org/ directly, but `bun install -g pkg@<version>` would then consult bun's on-disk manifest snapshot AND honour the user's npm-mirror configuration (corporate proxy, Taobao, …). Either source can lag the upstream registry by minutes-to-hours, in which case bun rejects the version with `No version matching "X" found for specifier "@oh-my-pi/pi-coding-agent" (but package exists)` even though the registry omp just queried is serving it.

The bun install step now runs with both `--no-cache` (skip the manifest snapshot) and `--registry=https://registry.npmjs.org/` (pin the official catalog regardless of bunfig/.npmrc) so the install observes the same registry state the version check used. The registry URL is centralised in an `NPM_REGISTRY` constant shared by `getLatestRelease` and `buildBunInstallArgs`.

Fixes #1686
2026-06-02 06:18:54 +00:00
Can Bölük 7b20de4ef1 Merge pull request #1587 from devxplay-forks/feat/raw-paste
feat(clipboard): add raw text paste functionality with keyboard shortcut
2026-06-02 09:18:16 +03:00
Can Bölük 38360c0c3c Merge pull request #1311 from jiwangyihao/acp-terminal-release-content
fix(acp): show live execute tool details
2026-06-02 09:17:58 +03:00
Can Bölük 12970e2412 Merge pull request #1646 from can1357/farm/2a94e89d/honor-todo-clear-delay
fix(tui): honor todo auto-clear delay
2026-06-02 09:11:07 +03:00
Can Bölük 94177c2ab0 Merge branch 'main' into farm/3a53b91e/fix-exit-cursor-position 2026-06-02 08:55:01 +03:00
Can Bölük 2909b068d1 Merge branch 'main' into farm/d05e786c/cannot-log-out-opencode 2026-06-02 08:52:53 +03:00
Can Bölük 858b758ee3 Merge pull request #1669 from can1357/farm/cc346f1b/fix-resume-decline-fork-exit
fix(coding-agent): exited cleanly when declining cross-project resume fork
2026-06-02 08:52:05 +03:00
Can Bölük 1f0e0a490b Merge branch 'main' into farm/cc346f1b/fix-resume-decline-fork-exit 2026-06-02 08:49:46 +03:00
can1357 384a206737 refactor(task): replaced numeric-prefix ids with name-first agent output ids
- Changed `AgentOutputManager` to use requested names verbatim, adding `-2`/`-3` suffixes only on repeats (e.g. `Anna`, `Anna-2`).
- Renamed main agent id from `0-Main` to `Main`; nested ids now use dot notation without numeric prefix (e.g. `Parent.Child`).
- Updated task widget to render dotted hierarchy as `Parent>Child` breadcrumb without leading index.
- Resume scan now tracks seen names instead of a counter to avoid clobbering prior outputs.
2026-06-02 06:50:03 +02:00
can1357 c4e157590e feat(eval): replaced fixed concurrency cap with task.maxConcurrency bridge
- Removed the `concurrency` argument from `parallel()` and `pipeline()` in both JS and Python runtimes.
- Added `__concurrency__` bridge to resolve the pool ceiling live from `task.maxConcurrency` (default 32; 0 = unbounded).
- Eval fan-outs now run as wide as a `task` tool batch instead of being capped at 16.
2026-06-02 06:49:15 +02:00
can1357 a25b4dc2cc docs(coding-agent/prompts): added shared executor reuse guidance to eval tool
- Encouraged staging helpers, datasets, and clients once, then fanning out subagents that call them directly.
- Clarified that re-importing, re-fetching, or serializing across the task boundary is unnecessary.
2026-06-02 06:43:58 +02:00
can1357 a4dc8b597d docs(coding-agent/prompts): reworked orchestrator prompt for trivial inline edits and batching
- Updated the role contract to allow direct trivial edits while reserving substantial work for subagents.
- Reinforced that parallel work must be fanned out broadly and that one-off task dispatches are disallowed.
- Clarified that subagents make edits only, while the orchestrator runs verification for changed files.
2026-06-02 06:33:30 +02:00
can1357 1fcb49601a fix(coding-agent): synchronized preview diff updates to settle before rendering
- Tracked the latest in-flight preview diff recompute in ToolExecutionComponent and exposed it through a new whenPreviewSettled method.
- Updated component paths that trigger preview recomputation to retain the returned promise instead of fire-and-forget calls.
- Updated the streaming preview height test to await settled diff recomputation before assertions, eliminating requestRender race-based flakes.
2026-06-02 06:27:09 +02:00
can1357 5caed570ce fix(settings): added reloadForCwd to re-scope project settings on cwd change
- Added `Settings.reloadForCwd` to mutate the live instance in place, so `/move` and cross-project resume pick up the destination project's `.claude/settings.yml` and path-scoped `enabledModels`/`disabledProviders`.
- Wired `reloadForCwd` into `applyCwdChange` (interactive mode) and the `--resume` startup path so settings always follow the active working directory.
- Added tests covering path-scoped re-resolution, no-op on same directory, and disk-backed project layer load/drop.
2026-06-02 06:00:45 +02:00
can1357 7b3ea248d4 feat(coding-agent): enabled cross-project resume with folder/all scope fallback
- Enabled resume picker to preload sessions and toggle folder/all scope with Tab.
- Enabled resume flow to fall back to all-project sessions and switch cwd on resume.
- Added centralized applyCwdChange to refresh caches, commands, and UI after cwd updates.
- Updated session restoration to adopt restored session cwd and sessionDir when present.
2026-06-02 05:53:57 +02:00
can1357 b522fde56d perf(sqlite-reader): replaced full COUNT(*) scan with bounded row probing
- Added ROW_COUNT_PROBE_CAP to limit rows scanned when counting tables, preventing JS thread freezes on large databases.
- Used sqlite_stat1 estimates for tables exceeding the cap; exact counts only for provably small tables.
- Introduced TableRowCount type with exact/estimate/atLeast variants reflected in rendered output.
2026-06-02 05:24:21 +02:00
can1357 783971f575 fix(history-storage): restored session_id column and prompt-history ranking
- Fixed `session_id` never being created or populated; every history row had `NULL` for session.
- Added schema migration (`ALTER TABLE history ADD COLUMN session_id`) for pre-existing databases.
- Wired interactive mode to call `setSessionResolver(...)` so prompts are stamped with the active session at submission time.
- Re-enabled session ranking in `--resume` and in-session pickers via `matchingSessionIds()`, merging fuzzy and prompt-history signals.
2026-06-02 05:15:56 +02:00
can1357 8cd8fd9b70 fix(coding-agent/tools): aligned screenshot file extensions with saved buffer format
- Computed screenshot destination extensions from the MIME type of bytes being written.
- Updated auto-generated paths in screenshot and temp directories to use the matching extension.
2026-06-02 04:36:21 +02:00
roboomp aeea2c8a8a fix(coding-agent): preserved noninteractive cross-project resume failures
Separated the fork prompt result into accepted, declined, and unavailable states.
Interactive declines now return cleanly through runRootCommand, while non-TTY
invocations continue to fail with a diagnostic instead of silently exiting 0.

Updated regression coverage for both branches.

Fixes #1668
2026-06-01 22:36:10 +00:00
roboomp cea19b6ebf fix(coding-agent): exited cleanly when declining cross-project resume fork
createSessionManager threw `Session "X" is in another project (Y).` when
the user answered "n" to the fork prompt, and runRootCommand never caught
it. The throw bubbled up as an Uncaught Exception with a stack trace.

Return undefined from the decline branch instead, and treat
`typeof parsed.resume === "string" && !sessionManager` in runRootCommand
as a user cancellation: print a dimmed "Resume cancelled" message and
return cleanly (exit 0), mirroring how the picker UI handles
"No session selected".

Fixes #1668
2026-06-01 22:31:26 +00:00
Miroslav Drbal 5d3718e82e refactor(ai,agent): dedup cch placeholder constant, reuse TextEncoder, patch in-place, drop Uint8Array copy
- Extract CCH_PLACEHOLDER_STR so createClaudeBillingHeader and wrapFetchForCch share one literal
- Add module-level cchEncoder singleton; reused for CCH_PLACEHOLDER, SYSTEM_MARKER, and per-request encode (was allocating a new TextEncoder per eligible request)
- patchCch mutates the caller-owned buffer in-place instead of slicing the full body just to write 5 bytes
- clipboard: Buffer.from() already returns a Uint8Array subclass; drop the redundant new Uint8Array() copy

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-01 22:23:16 +02:00
roboomp 12cfdd68b1 fix(auth): limited logout to stored credentials
Filtered the logout selector to credentials that /logout can actually remove and reported ambient env/config auth when direct logout cannot clear it. Added selector coverage for env-only OpenCode providers.\n\nFixes #1658
2026-06-01 19:14:28 +00:00
can1357 47690d6495 Merge remote-tracking branch 'origin/farm/f765e67b/esc-keeps-autocomplete-dismissal' 2026-06-01 20:33:08 +02:00
can1357 503d29f408 fix(eval): resolved TDZ crash by splitting eval renderer into eval-render.ts
- Extracted TUI rendering from `eval.ts` into a dependency-light `eval-render.ts` to break the circular initialization chain.
- `renderers.ts` now imports `evalToolRenderer` from `eval-render` directly, avoiding re-entry into the root barrel while `eval.ts` is still initializing.
- `eval.ts` re-exports `evalToolRenderer` and `EVAL_DEFAULT_PREVIEW_LINES` for backward compatibility.
- Increased first-event timeout test budget from 50ms to 5000ms to prevent CI scheduler jitter from tripping the watchdog on success cases.
2026-06-01 20:31:46 +02:00