Commit graph

365 commits

Author SHA1 Message Date
patriceckhart
4bec50ae9c fix(swarm): inherit host model provider for auto-spawn
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-22 17:39:21 +02:00
patriceckhart
6899695320 Merge pull request #43 from mi-skam/clipboard-paste-support
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-22 07:54:35 +02:00
patriceckhart
c56e04afd5 fix(tui): correct btw cursor offset
Only count the dialog frame padding row when padDialogFrame actually inserts it, so the btw editor cursor stays on the input row after a turn.

Co-authored-by: mi-skam <40042054+mi-skam@users.noreply.github.com>
2026-06-22 07:47:19 +02:00
patriceckhart
ab3d4c5ced fix: harden clipboard image paste
Preserve prompt whitespace when stripping clipboard image markers, accept osascript warning noise, support clipboard image file paths, and keep the existing user bubble rendering.

Co-authored-by: mi-skam <40042054+mi-skam@users.noreply.github.com>
2026-06-22 07:47:19 +02:00
mi-skam
1f663cb867
fix: use osascript for macos clipboard image paste 2026-06-21 22:31:34 +02:00
patriceckhart
821f51a0c3 Merge pull request #44 from patriceckhart/fix-swarm-tool-loop-turn-end
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-21 17:15:42 +02:00
mi-skam
2a4b07839d
fix(swarm): ignore tool-loop turn_end for completion 2026-06-21 15:25:47 +02:00
mi-skam
4a6d6915ca
Add clipboard paste support 2026-06-21 14:47:06 +02:00
patriceckhart
1a24a204b4 fix: correct image MIME by content and re-encode for kitty
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
read tool and Anthropic builder derived an image's media type from its
file extension, so a .png file containing JPEG bytes was declared
image/png. Anthropic sniffs the real bytes and 400s the whole request
on a mismatch, breaking the session and making it impossible to resume.

- read tool now sniffs the real format from magic bytes (sniffImageMIME)
- Anthropic request builder reconciles declared MIME against the actual
  bytes on every outbound image, repairing already-persisted sessions on
  continue/resume
- kitty renderer re-encodes non-PNG images to PNG (f=100 is PNG-only),
  fixing empty image boxes for JPEG/GIF screenshots
2026-06-20 18:18:52 +02:00
patriceckhart
0250ce1c48 fix(tui): keep scroll position stable in resumed sessions
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-19 18:09:33 +02:00
patriceckhart
292bc58eb6 fix(tui): scope live tool height reservation per call id 2026-06-19 18:09:33 +02:00
patriceckhart
31437ddf2b fix(tui): reserve live tool overlay height to stop band jump 2026-06-19 17:41:41 +02:00
patriceckhart
8cd6818405 feat(tui): show live bash command body
Some checks failed
ci / test (macos-latest) (push) Has been cancelled
ci / test (ubuntu-latest) (push) Has been cancelled
ci / test (windows-latest) (push) Has been cancelled
2026-06-18 07:34:23 +02:00
patriceckhart
6d28881e78 fix(extensions): isolate subprocess process groups 2026-06-18 07:27:38 +02:00
patriceckhart
4615780369 fix(jail): block POSIX-absolute cd targets on Windows
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
filepath.IsAbs("/etc") is false on Windows, so the cd-escape check
folded "/etc" back inside root via filepath.Join and let it through,
failing CI. Treat a leading forward slash that is not OS-absolute as an
escape attempt.
2026-06-17 17:24:02 +02:00
patriceckhart
bfd8c07cfa fix(jail,tui): emit OSC 7 cwd and stop false-positive cd jail errors
#38: emit OSC 7 (ESC ]7;file://host/path) on TUI setup and /cd so
terminals like kitty open new tabs/splits in the launch cwd instead of
inheriting a stale extension-subprocess directory. Verified end-to-end
against kitty 0.46.2.

#39: stop blanket-rejecting cd into subdirectories of the sandbox root.
CheckCommand now resolves the cd target and rejects only real escapes.
Add Sandbox.DisplayPath to present jailed tool-result/error paths
relative to root, reducing the absolute-path bias that pushed the model
toward unjailing.
2026-06-17 17:15:37 +02:00
patriceckhart
5a4e4923f2 test(swarm): wait for inbox listener before send
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-17 16:38:56 +02:00
patriceckhart
d5d0754b13 Merge pull request #40 from pr-40 2026-06-17 16:25:05 +02:00
patriceckhart
a75054caec test(bedrock): format image tool result regression test 2026-06-17 16:25:05 +02:00
Raymond Gasper
f41efbe21c fix(bedrock): handle ImageBlock in tool results and user messages
The read tool wraps image data in a ToolResultBlock. The Bedrock
buildRequest serialiser only handled TextBlock in toolResult inner
content, so ImageBlock was silently dropped, leaving Bedrock an empty
content array which it rejects with HTTP 500.

Fix:
- Add case ImageBlock in the ToolResultBlock inner-content loop,
  serialising to Bedrock's native image wire format
  (image.format + image.source.bytes as base64).
- Add case ImageBlock for top-level user message content blocks
  (belt-and-suspenders: covers images attached directly by the user).
- Add encoding/base64 import.

Both paths reuse anthShrinkImageBytesIfTooBig to stay within
Bedrock's per-image dimension limits.

Tests: TestBedrockBuildRequestImageBlock and
TestBedrockBuildRequestImageInToolResult reproduce both failure modes.
2026-06-17 10:14:53 -04:00
patriceckhart
1d7dc39fe8 docs: document custom providers and updated insecure flag [release=skip]
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
Cover named custom providers in models.json (provider-level baseUrl and api format, model-level baseUrl override, derived API-key env vars, /login support, no-probe key storage). Note built-in models stay visible and correct the credential-resolution order. Update the --insecure description to cover models.json baseUrl endpoints.
2026-06-16 20:31:21 +02:00
Patric Eckhart
1dc884a676
Merge pull request #36 from pulyankote/feat/custom-llm-providers
Feature: implement pluggable custom LLM providers via JSON config
2026-06-16 20:20:54 +02:00
patriceckhart
ac7da16dd5 Harden custom provider support
Keep built-in models visible when merging models.json, accept custom provider API keys through the login flow, preserve model-level base URLs, and route custom clients through the scoped HTTP wrapper.

Also register providers from model-level baseUrl metadata, warn on unknown api values, dedupe login picker entries, and cover the custom-provider behavior with regression tests.

Co-authored-by: pulyankote <4314305+pulyankote@users.noreply.github.com>
2026-06-16 20:17:25 +02:00
Patric Eckhart
4570db2a3f
Merge branch 'main' into feat/custom-llm-providers 2026-06-16 19:43:15 +02:00
Gopinath
dc2d337239 feat(provider): support custom providers defined in models.json
Custom provider metadata now lives entirely in $ZOT_HOME/models.json
instead of a separate provider-config.json or auth.json base_url entry.

- Extend UserProvider to carry baseUrl and api format (openai/anthropic).
- Recognize custom providers in Resolve, the login picker, and the model
  list when credentials exist.
- Persist only API keys in auth.json; base URLs are read from models.json.
- Normalize custom provider env vars so my-company uses MY_COMPANY_API_KEY.
- Reuse NewOpenAICompat/NewAnthropicCompat for user-defined endpoints.
- Drop the checked-in provider-config.json example and modelListEndpoint.
2026-06-16 09:53:25 -07:00
patriceckhart
1cc654ebbf Recognize Esc and other control keys in kitty keyboard mode
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
Enabling the kitty keyboard protocol for Shift+Enter made terminals
report Esc as CSI 27 u, which the CSI-u parser dropped as KeyUnknown,
so Esc stopped aborting the agent. Map kitty control codepoints
(Esc=27, Tab=9, Backspace=127/8) back to their dedicated keys.
2026-06-16 07:46:29 +02:00
patriceckhart
ab7fb37046 Scope --insecure TLS to explicit base URL, drop global transport override
Builds on s3rj1k's --insecure flag (#35) but limits insecure TLS to the
resolved inference client for an explicit --base-url, instead of mutating
http.DefaultTransport process-wide. Built-in providers, auth, and model
discovery keep normal certificate verification. Documents the flag in
the CLI reference.

Co-authored-by: s3rj1k <evasive.gyron@gmail.com>
2026-06-16 07:41:38 +02:00
patriceckhart
e0ca3fdd3e Merge pull request #35 from s3rj1k/main
Add --insecure flag to skip TLS verification

Co-authored-by: s3rj1k <evasive.gyron@gmail.com>
2026-06-16 07:41:13 +02:00
s3rj1k
5859d66f1a
Add --insecure flag to skip TLS verification 2026-06-16 00:38:22 +02:00
patriceckhart
94ece7d00e Support Shift-Enter in terminal input
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-15 18:54:26 +02:00
Patric Eckhart
9ee726bb20
Merge pull request #33 from xpepper/fix/zai-v4-chat-completions-path
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
fix(provider): keep Z.AI /v4 base from getting a spurious /v1 chat path
2026-06-15 08:04:05 +02:00
Pietro Di Bello
9bb884ebbc
fix(provider): keep /v4 base from getting a spurious /v1 chat path
The OpenAI-compatible client only treated a base URL ending in "/v1" as
already-versioned; any other base got "/v1/chat/completions" appended.

Z.AI's coding-plan base ends in "/paas/v4", so requests were sent to
".../paas/v4/v1/chat/completions" — a path that does not exist — and
every GLM model returned 404.

Match any trailing "/vN" version segment instead. This is behaviour-
identical for all existing providers (their versioned bases all end in
"/v1") and only changes Z.AI, which now hits ".../paas/v4/chat/completions".
2026-06-14 21:45:53 +02:00
patriceckhart
85a3c3b73e Add temperature option
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-14 11:42:31 +02:00
patriceckhart
798174c22c Fix telegram bot process checks on Windows
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
2026-06-13 17:39:14 +02:00
Patric Eckhart
7f954ceaa3
Merge pull request #30 from jameswei/fix/session-fork-after-compaction
Some checks failed
ci / test (macos-latest) (push) Has been cancelled
ci / test (ubuntu-latest) (push) Has been cancelled
ci / test (windows-latest) (push) Has been cancelled
fix(core): fork sessions from effective compacted transcript
2026-06-11 11:27:01 +02:00
Jia Wei
d1901d0d5c Fix session fork after compaction 2026-06-11 17:03:34 +08:00
Patric Eckhart
4685a30ec4
Merge pull request #28 from rgasper/file-picker-improvements
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
File picker improvements
2026-06-10 20:55:39 +02:00
Raymond Gasper
4a8d2ed68e fix(tui): clear @-picker filter when browsing into/out of a directory
In flat (non-recursive) mode, typing a filter to locate a directory and
then opening it with Right re-applied that same filter inside the
directory. Typing "@eda" then Right to open eda/ showed nothing,
because no child of eda/ matches "eda". The filter the user typed
selected the directory at the current level; it has no meaning one
level deeper.

Clear the text after the last "@" (keeping the bare "@" so the picker
stays open) whenever Right or Left successfully changes the browse
level. The filter was scoped to the level just left, so dropping it
shows the new directory's full contents.

Adds a regression test that opens eda/ after an "@eda" filter and
asserts the directory's contents are listed while the stale filter
would have matched nothing.
2026-06-10 09:41:35 -04:00
Raymond Gasper
1a3e0a572e fix(tui): honor nested .gitignore in recursive @-picker + raise entry cap
The recursive @-picker only read the repo's root .gitignore, so a
nested .gitignore (e.g. .opencode/.gitignore ignoring its own
node_modules) was invisible. WalkDir visits lexically, so a
dot-prefixed vendored tree got walked first and its node_modules
flooded the 5000-entry budget before the walk ever reached deeply
nested source files. The picker then fuzzy-matched against junk and
never surfaced the real target.

- Add ignore.Stack: a per-directory .gitignore chain pushed/popped as
  the recursive walk descends, with git-style nearest-file-wins
  semantics including nested negations. scanRecursive now prunes
  nested-ignored trees like node_modules.
- Raise maxRecursiveEntries 5000 -> 50000 and maxRecursiveDepth
  12 -> 24. The bottleneck is per-keystroke fuzzy.Find, not memory:
  a fileEntry is ~120 bytes (~6 MB at 50k), and benchmarked
  fuzzy.Find latency is ~2ms @ 5k, ~13ms @ 50k, ~21ms @ 100k, so 50k
  keeps ranking under one 60Hz frame while holding a large monorepo
  once nested-gitignore pruning has done its job.

Verified against the reporting monorepo: the fully-pruned tree is
4397 entries (node_modules=0), scan ~360ms once (cached after),
match ~2.5ms per keystroke, and @pipeline.py now finds
eda/rjg/enk-1150/pipeline.py.

Adds regression tests at both the ignore.Stack layer and the
file_suggest layer, including a repro of the nested-node_modules +
deep-file scenario.
2026-06-10 09:13:18 -04:00
patriceckhart
9b298e6228 feat(provider): temporarily add claude-fable-5 to the Bedrock catalog
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
Four entries (bare, us., eu., global.) with 1M context, 128k output,
adaptive thinking, and Bedrock pricing (10/50, cache 1/12.5). The bare
id resolves through the cross-region inference profile logic like the
other anthropic.claude- models. Remove once Bedrock model discovery
picks the id up. Note: the Bedrock Converse client has no thinking-mode
wiring yet, so AdaptiveThinking is informational on this route for now.
2026-06-10 07:50:47 +02:00
Patric Eckhart
4c2e835f45
Merge pull request #25 from rgasper/feat/fuzzy-recursive-file-suggest
feat(tui): fuzzy @-file matching with toggleable recursive search
2026-06-10 07:37:25 +02:00
Raymond Gasper
fb08ad382b feat(tui): apply .gitignore in both @-picker modes + add respect_gitignore toggle
Previously gitignore filtering ran only in recursive mode; the default
flat directory browse showed .git/, node_modules/, etc. Apply it in
both modes and make it user-controllable.

- Flat scan() now also skips .git and gitignored entries.
- New respectGitignore flag on the suggester (default on), persisted as
  respect_gitignore in config.json, surfaced as a /settings checkbox,
  and plumbed through SettingsStore/InteractiveConfig/cli. Toggling
  flips the picker live.
- .git is always pruned in recursive mode regardless of the toggle, to
  protect the entry budget.
- Tests for flat-mode filtering and the toggle across both modes.
2026-06-09 15:57:50 -04:00
Raymond Gasper
3ce9c2861f refactor: honor .gitignore in recursive @-search instead of a hardcoded denylist
Replace the static recursiveSkipDirs list (which would inevitably drift
as new tools appear) with the project's root .gitignore. Most caches
that bloat a recursive walk \u2014 build outputs, dependency dirs, and IaC
caches like .terraform/.terragrunt-cache \u2014 are already gitignored in
real projects.

- Extract the existing .gitignore matcher from agent/extcmd.go into a
  new leaf package, packages/ignore, so packages/agent/modes can share
  it without an import cycle. extcmd keeps thin aliases for its tests.
- scanRecursive now loads the root .gitignore and prunes ignored
  entries, plus an unconditional .git skip (rarely self-listed).
- Tests: gitignore-driven pruning in the picker, plus unit tests for
  the extracted matcher.

No new dependencies.
2026-06-09 15:54:23 -04:00
Raymond Gasper
e7439baaa6 feat(tui): skip IaC caches (.terraform, .terragrunt-cache, ...) in recursive @-search
Add Terraform/Terragrunt/Pulumi/Serverless/CDK provider and module
caches to the recursive walk skip list. These hold copies of
downloaded providers and generated module trees that would otherwise
dominate the entry budget with non-source files.
2026-06-09 15:48:41 -04:00
Raymond Gasper
7ac6034d1d feat(tui): fuzzy @-file matching with toggleable recursive search
The @-mention file picker previously did a plain case-insensitive
substring match within a single directory, only reachable nesting via
arrow-key drill-down.

- Rank matches with sahilm/fuzzy (pinned v0.1.1 to avoid the go 1.24.5
  directive in v0.1.2, which would exceed CI's Go 1.23).
- Add a recursive mode that walks the whole project tree below cwd,
  matching cwd-relative paths (e.g. @foobar finds src/foo/bar.go),
  skipping heavy dirs (.git, node_modules, ...) and bounded by entry
  and depth caps. Arrow drill-down is disabled in this mode.
- Persist as recursive_file_suggest in config.json, surfaced as a
  /settings checkbox, plumbed through SettingsStore/InteractiveConfig/
  cli. Toggling live flips the picker without a restart.
- Tests for fuzzy ranking, recursive cross-dir match, heavy-dir
  pruning, and cache reset on toggle.
2026-06-09 15:44:47 -04:00
patriceckhart
15f76e0fcd feat(provider): temporarily add claude-fable-5 to the builtin catalog
Some checks are pending
ci / test (macos-latest) (push) Waiting to run
ci / test (ubuntu-latest) (push) Waiting to run
ci / test (windows-latest) (push) Waiting to run
Speculative Anthropic entry (1M context, 128k output, adaptive thinking,
10/50 pricing) so the model resolves on both the api-key and OAuth route
with correct cost tracking and thinking mode. AdaptiveThinking cannot be
expressed via models.json, hence the catalog entry. Remove once the id
is live and discoverable upstream.
2026-06-09 20:20:35 +02:00
patriceckhart
ffca64d4fd Merge #24: clamp max_tokens to fit context window (proportional reserve)
Fixes OpenRouter rejecting requests where max_tokens equals the served
context window. Prefer top_provider.context_length on discovery and clamp
max_tokens to ContextWindow minus a proportional reserve (window/8 capped
at 4096). Reworked from the original PR so the reserve derives from the
window, not MaxOutput: models whose output already fits are untouched and
small-window models are not over-penalized.

Co-authored-by: Neil-urk12 <neil-urk12@users.noreply.github.com>
2026-06-09 19:29:54 +02:00
patriceckhart
d2fa18270d fix(provider): clamp max_tokens to fit context window with proportional reserve
OpenRouter enforces input + max_output <= served context_length and
rejects requests where max_tokens equals the whole window, which happens
for models whose catalog MaxOutput is set equal to ContextWindow (e.g.
nemotron-3-super-120B). Two parts:

- discover.go (from #24): prefer top_provider.context_length when it is
  smaller than the inflated model-level context_length, so ContextWindow
  reflects the limit OpenRouter actually serves.
- openai.go: clamp max_tokens to ContextWindow minus a reserve. The
  reserve is derived from the window (window/8, capped at 4096), never
  from MaxOutput, so models whose output already fits the window are
  untouched and small-window models (gpt-4) are not over-penalized.

Adds buildRequest clamp tests (fits-window no-op, large-window cap,
small-window proportional reserve, floor, explicit-request passthrough)
and an httptest-based DiscoverOpenRouter test for the served-context
preference.

Co-authored-by: Neil-urk12 <neil-urk12@users.noreply.github.com>
2026-06-09 19:29:48 +02:00
patriceckhart
b68008327d Merge remote-tracking branch 'origin/main' into pr-24 2026-06-09 19:22:05 +02:00
patriceckhart
c2c9a5ea28 Merge #23: request model's full output-token budget per turn
Thread the resolved model's catalog MaxOutput through to
provider.Request.MaxTokens so each turn requests the model's full output
capacity. Fixes Bedrock silently truncating long writes/edits at its
4096 default (stopReason=length). Other providers already defaulted to
MaxOutput on a zero request, so this is a no-op for them. Also surfaces
StopLength explicitly in the TUI instead of ending silently.

Co-authored-by: Raymond Gasper <raymondgasper@fastmail.com>
2026-06-09 18:38:10 +02:00