905 Commits

Author SHA1 Message Date
Kujtim Hoxha
3eff8fa1d7 fix lint 2025-06-07 11:25:50 +02:00
Kujtim Hoxha
8c6e81791e refactor and document 2025-06-07 11:25:50 +02:00
Kujtim Hoxha
288325689e implement tool calls in the ui 2025-06-07 11:25:50 +02:00
Andrey Nering
b76edd40ef lint: fix unneeded lint comment 2025-06-07 11:25:50 +02:00
Andrey Nering
474c085101 lint: fix whitespace issues 2025-06-07 11:25:50 +02:00
Andrey Nering
09274460de chore: run gofumpt 2025-06-07 11:25:50 +02:00
Ayman Bagabas
bc67c13e66 fix: tui: use KeyPressMsg instead of KeyMsg
The `tea.KeyMsg` type can match both key presses and releases, which can
lead to unexpected behavior in the TUI. Use `tea.KeyPressMsg` explicitly
to ensure we match only key presses.
2025-06-07 11:25:50 +02:00
Kujtim Hoxha
9c4a47b895 fix tools calls 2025-06-07 11:25:50 +02:00
Kujtim Hoxha
25e9651655 add anim to the messages 2025-06-07 11:25:50 +02:00
Kujtim Hoxha
abbbc05fd7 refactor tool rendering 2025-06-07 11:25:50 +02:00
Ayman Bagabas
c891295f7c fix: tui: properly calculate quit dialog size
This uses the style frame size to calculate the quit dialog width.
2025-06-07 11:25:50 +02:00
Kujtim Hoxha
b364394cfe initial chat refactor
wip
2025-06-07 11:25:50 +02:00
Kujtim Hoxha
af838d1cd6 move to v2 2025-06-07 11:25:50 +02:00
Kayvan Sylvan
05b0570f48 refactor: upgrade Anthropic SDK to v1.4.0 and adapt provider code
### CHANGES

- Upgrade Anthropic Go SDK dependency to version 1.4.0.
- Adapt provider code to breaking changes in the SDK.
- Update constructors for tool use and thinking parameters.
- Use new `OfText` field for accessing message content.
- Add Claude 4 Opus and Sonnet to documentation.
2025-06-07 10:12:37 +02:00
Tom X Nguyen
18f020cacd fix(provider/gemini): prevent empty parts in assistant messages 2025-06-07 10:03:52 +02:00
Kujtim Hoxha
d4c8d057e4 add openrouter deepseek free 2025-06-04 16:51:51 +02:00
Kujtim Hoxha
0c38c0f698 update readme and gemini 2025-06-04 15:09:49 +02:00
Pietjan Oostra
12a98d6940 Update readme & use provided logging package 2025-05-22 20:25:24 +02:00
Pietjan Oostra
a2524a1d05 Add local provider 2025-05-22 20:25:24 +02:00
Kujtim Hoxha
94d5fe0520 add sonnet 4 2025-05-22 20:05:52 +02:00
Radu Topala
103f1c1183 feat: non-interactive mode 2025-05-16 10:42:56 +02:00
mineo
a9fa9188bd feat: support VertexAI provider (#153)
* support: vertexai

fix

fix

set default for vertexai

added comment

fix

fix

* create schema

* fix README.md

* fix order

* added pupularity

* set tools if tools is exists

restore commentout

* fix comment

* set summarizer model
2025-05-15 20:25:21 +02:00
Adictya
49c710b900 Add completion menu for file paths (#145)
* feat(context-dialog): init

* chore(simple-list): refactor with generics

* fix(complete-module): fix fzf issues

* fix(complete-module): add fallbacks when rg or fzf is not available

* chore(complete-module): code improvements

* chore(complete-module): cleanup

* fix(complete-module): dialog keys cleanup

* fix(simple-list): add fallback message

* fix(commands-dialog): refactor to use simple-list

* fix(simple-list): add j and k keys

* fix(complete-module): cleanup and minor bug fixes

* fix(complete-module): self review

* fix(complete-module): remove old file
2025-05-15 16:07:50 +02:00
Kujtim Hoxha
3e424754b4 Improve summary to keep context (#159)
* improve summary to keep context

* improve loop

* remove debug msg
2025-05-15 15:59:18 +02:00
Aiden Cline
4f0c1c633a feat: add configuration persistence for model selections (#154) 2025-05-15 15:56:00 +02:00
Ed Zynda
e8b4bb0edd allow configuring shell (#157) 2025-05-15 15:53:47 +02:00
Ed Zynda
36faca4b4d feat: Support named arguments in custom commands (#158)
* Allow multiple named args

* fix: Fix styling in multi-arguments dialog

* Remove old unused modal

* Focus on only one input at a time
2025-05-15 15:52:24 +02:00
Kujtim Hoxha
90084ce43d Context Window Warning (#152)
* context window warning & compact command

* auto compact

* fix permissions

* update readme

* fix 3.5 context window

* small update

* remove unused interface

* remove unused msg
2025-05-09 19:30:57 +02:00
Nicholas Hamilton
9345830c8a Fix filepicker manual input (#146)
* fix: allows to type i while manual inputting filepath

* fix: file selection in filepicker focus mode

* remove duplicate code
2025-05-09 16:40:06 +02:00
Kujtim Hoxha
5307100f89 small fix 2025-05-09 16:37:02 +02:00
Ed Zynda
a58e607c5f feat: custom commands (#133)
* Implement custom commands

* Add User: prefix

* Reuse var

* Check if the agent is busy and if so report a warning

* Update README

* fix typo

* Implement user and project scoped custom commands

* Allow for $ARGUMENTS

* UI tweaks

* Update internal/tui/components/dialog/arguments.go

Co-authored-by: Kujtim Hoxha <kujtimii.h@gmail.com>

* Also search in $HOME/.opencode/commands

---------

Co-authored-by: Kujtim Hoxha <kujtimii.h@gmail.com>
2025-05-09 16:33:35 +02:00
mineo
cd04c44517 replace github.com/google/generative-ai-go with github.com/googleapis/go-genai (#138)
* replace to github.com/googleapis/go-genai

* fix history logic

* small fixes

---------

Co-authored-by: Kujtim Hoxha <kujtimii.h@gmail.com>
2025-05-09 14:15:38 +02:00
Joshua LaMorey-Salzmann
88711db796 Config fix correcting loose viper string check, default model now set correctly (#147) 2025-05-05 09:40:58 +02:00
phantomreactor
9fec8df7d0 add support for images (#144) 2025-05-02 22:23:58 +02:00
Kujtim Hoxha
603a3e3c71 add xai support (#135) 2025-05-01 14:17:33 +02:00
Aiden Cline
e14de7a211 fix: tweak the logic in config to ensure that env vs file configurations merge properly (#115) 2025-05-01 13:22:48 +02:00
Garrett Ladley
004cfe7e8e feat: test for getContextFromPaths (#105)
* feat: test for getContextFromPaths

* fix: use testify
2025-05-01 12:55:28 +02:00
Adam
58705a1352 fix: more intuitive keybinds (#121) 2025-05-01 12:51:07 +02:00
Adam
82de14371d feat: themes (#113)
* feat: themes

* feat: flexoki theme

* feat: onedark theme

* feat: monokai pro theme

* feat: opencode theme (default)

* feat: dracula theme

* feat: tokyonight theme

* feat: tron theme

* some small fixes

---------

Co-authored-by: Kujtim Hoxha <kujtimii.h@gmail.com>
2025-05-01 12:49:26 +02:00
Hunter Casten
76275e533e fix(openrouter): set api key from env (#129) 2025-04-30 12:50:57 +02:00
Isaac Scarrott
98e2910e82 feat: Add support for OpenRouter (#92)
* Add support for OpenRouter as a new model provider

- Introduced `ProviderOpenRouter` in the `models` package.
- Added OpenRouter-specific models, including `GPT41`, `GPT41Mini`, `GPT4o`, and others, with their configurations and costs.
- Updated `generateSchema` to include OpenRouter as a provider.
- Added OpenRouter-specific environment variable handling (`OPENROUTER_API_KEY`) in `config.go`.
- Implemented default model settings for OpenRouter agents in `setDefaultModelForAgent`.
- Updated `getProviderAPIKey` to retrieve the OpenRouter API key.
- Extended `SupportedModels` to include OpenRouter models.
- Added OpenRouter client initialization in the `provider` package.
- Modified `processGeneration` to handle `FinishReasonUnknown` in addition to `FinishReasonToolUse`.

* [feature/openrouter-provider] Add new models and provider to schema

- Added "deepseek-chat-free" and "deepseek-r1-free" to the list of supported models in `opencode-schema.json`.

* [feature/openrouter-provider] Add OpenRouter provider support and integrate new models

- Updated README.md to include OpenRouter as a supported provider and its configuration details.
- Added `OPENROUTER_API_KEY` to environment variable configuration.
- Introduced OpenRouter-specific models in `internal/llm/models/openrouter.go` with mappings to existing cost and token configurations.
- Updated `internal/config/config.go` to set default models for OpenRouter agents.
- Extended `opencode-schema.json` to include OpenRouter models in the schema definitions.
- Refactored model IDs and names to align with OpenRouter naming conventions.

* [feature/openrouter-provider] Refactor finish reason handling and tool call logic in agent and OpenAI provider

- Simplified finish reason check in `agent.go` by removing redundant variable assignment.
- Updated `openai.go` to override the finish reason to `FinishReasonToolUse` when tool calls are present.
- Ensured consistent finish reason handling in both `send` and `stream` methods of the OpenAI provider.

[feature/openrouter-provider] Refactor finish reason handling and tool call logic in agent and OpenAI provider

- Simplified finish reason check in `agent.go` by removing redundant variable assignment.
- Updated `openai.go` to override the finish reason to `FinishReasonToolUse` when tool calls are present.
- Ensured consistent finish reason handling in both `send` and `stream` methods of the OpenAI provider.

* **[feature/openrouter-provider] Add support for custom headers in OpenAI client configuration**

- Introduced a new `extraHeaders` field in the `openaiOptions` struct to allow specifying additional HTTP headers.
- Added logic in `newOpenAIClient` to apply `extraHeaders` to the OpenAI client configuration.
- Implemented a new option function `WithOpenAIExtraHeaders` to set custom headers in `openaiOptions`.
- Updated the OpenRouter provider configuration in `NewProvider` to include default headers (`HTTP-Referer` and `X-Title`) for OpenRouter API requests.

* Update OpenRouter model config and remove unsupported models

* [feature/openrouter-provider] Update OpenRouter models and default configurations

- Added new OpenRouter models: `claude-3.5-sonnet`, `claude-3-haiku`, `claude-3.7-sonnet`, `claude-3.5-haiku`, and `claude-3-opus` in `openrouter.go`.
- Updated default agent models in `config.go`:
  - `agents.coder.model` now uses `claude-3.7-sonnet`.
  - `agents.task.model` now uses `claude-3.7-sonnet`.
  - `agents.title.model` now uses `claude-3.5-haiku`.
- Updated `opencode-schema.json` to include the new models in the allowed list for schema validation.
- Adjusted logic in `setDefaultModelForAgent` to reflect the new default models.

* [feature/openrouter-provider] Remove unused ProviderEvent emission in stream function

The changes remove the emission of a `ProviderEvent` with type `EventContentStop` in the `stream` function of the `openaiClient` implementation. This event was sent upon successful stream completion but is no longer used.
2025-04-29 13:56:49 +02:00
Kujtim Hoxha
2941137416 fix diagnostics for deleted files 2025-04-28 19:37:42 +02:00
Aiden Cline
b3c0285db3 feat: model selection for given provider (#57)
* feat: model selection for given provider

* tweak: adjust cfg validation func, remove duplicated logic, consolidate agent updating into agent.go

* tweak: make the model dialog scrollable, adjust padding slightly for modal"

* feat: add provider selection, add hints, simplify some logic, add horizontal scrolling support, additional scroll indicators"

* remove nav help

* update docs

* increase number of visible models, make horizontal scroll "wrap"

* add provider popularity rankings
2025-04-28 19:25:06 +02:00
YJG
805aeff83c feat: add azure openai models (#74) 2025-04-28 15:42:57 +02:00
Kujtim Hoxha
bce2ec5c10 fix duplicate context 2025-04-27 20:43:27 +02:00
Kujtim Hoxha
292e9d90ca remove unnecessary var 2025-04-27 20:34:20 +02:00
Kujtim Hoxha
2b4441a0d1 fix context 2025-04-27 20:31:53 +02:00
Garrett Ladley
8f3a94df92 feat: configure context paths (#86) 2025-04-27 20:11:09 +02:00
Kujtim Hoxha
4415220555 fix minor issue 2025-04-27 19:24:46 +02:00
Kujtim Hoxha
a3a04d8a54 fix gemini provider 2025-04-27 19:12:02 +02:00