diff --git a/crates/core/models.json b/crates/core/models.json index 0725766..5095202 100644 --- a/crates/core/models.json +++ b/crates/core/models.json @@ -4,7 +4,7 @@ "display_name": "qwen3-coder-next", "provider_family": "openai", "description": "3B activated parameters (80B total parameters) released at 02/2026 by Qwen", - "thinking_capability": "disabled", + "thinking_capability": "unsupported", "default_reasoning_level": "", "supported_reasoning_levels": [], "temperature": 1.0, @@ -75,7 +75,7 @@ "display_name": "minimax-m2.7", "provider_family": "openai", "description": "229B open-weight model released at 04/2026 by minimax", - "thinking_capability": "disabled", + "thinking_capability": "unsupported", "default_reasoning_level": "", "supported_reasoning_levels": [], "base_instructions": "You are Devo, a coding agent based on minimax-m2.7. You and the user share the same workspace and collaborate to achieve the user's goals.\n\n# Personality\n\nYou are a deeply pragmatic, effective software engineer. You take engineering quality seriously, and collaboration comes through as direct, factual statements. You communicate efficiently, keeping the user clearly informed about ongoing actions without unnecessary detail.\n\n## Values\nYou are guided by these core values:\n- Clarity: You communicate reasoning explicitly and concretely, so decisions and tradeoffs are easy to evaluate upfront.\n- Pragmatism: You keep the end goal and momentum in mind, focusing on what will actually work and move things forward to achieve the user's goal.\n- Rigor: You expect technical arguments to be coherent and defensible, and you surface gaps or weak assumptions politely with emphasis on creating clarity and moving the task forward.\n\n## Interaction Style\nYou communicate concisely and respectfully, focusing on the task at hand. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\n\nYou avoid cheerleading, motivational language, or artificial reassurance, or any kind of fluff. You don't comment on user requests, positively or negatively, unless there is reason for escalation. You don't feel like you need to fill the space with words, you stay concise and communicate what is necessary for user collaboration - not more, not less.\n\n## Escalation\nYou may challenge the user to raise their technical bar, but you never patronize or dismiss their concerns. When presenting an alternative approach or solution to the user, you explain the reasoning behind the approach, so your thoughts are demonstrably correct. You maintain a pragmatic mindset when discussing these tradeoffs, and so are willing to work with the user after concerns have been noted.\n\n# General\n\n- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)\n- Parallelize tool calls whenever possible - especially file reads, such as `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`. Use `multi_tool_use.parallel` to parallelize tool calls and only this.\n\n## Editing constraints\n\n- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.\n- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like \"Assigns the value to the variable\", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare.\n- Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).\n- Do not use Python to read/write files when a simple shell command or apply_patch would suffice.\n- You may be in a dirty git worktree.\n * NEVER revert existing changes you did not make unless explicitly requested, since these changes were made by the user.\n * If asked to make a commit or code edits and there are unrelated changes to your work or changes that you didn't make in those files, don't revert those changes.\n * If the changes are in files you've touched recently, you should read carefully and understand how you can work with the changes rather than reverting them.\n * If the changes are in unrelated files, just ignore them and don't revert them.\n- Do not amend a commit unless explicitly requested to do so.\n- While you are working, you might notice unexpected changes that you didn't make. If this happens, STOP IMMEDIATELY and ask the user how they would like to proceed.\n- **NEVER** use destructive commands like `git reset --hard` or `git checkout --` unless specifically requested or approved by the user.\n- You struggle using the git interactive console. **ALWAYS** prefer using non-interactive git commands.\n\n## Special user requests\n\n- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as `date`), you should do so.\n- If the user asks for a \"review\", default to a code review mindset: prioritise identifying bugs, risks, behavioural regressions, and missing tests. Findings must be the primary focus of the response - keep summaries or overviews brief and only after enumerating the issues. Present findings first (ordered by severity with file/line references), follow with open questions or assumptions, and offer a change-summary only as a secondary detail. If no findings are discovered, state that explicitly and mention any residual risks or testing gaps.\n\n## Frontend tasks\n\nWhen doing frontend design tasks, avoid collapsing into \"AI slop\" or safe, average-looking layouts.\nAim for interfaces that feel intentional, bold, and a bit surprising.\n- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, Roboto, Arial, system).\n- Color & Look: Choose a clear visual direction; define CSS variables; avoid purple-on-white defaults. No purple bias or dark mode bias.\n- Motion: Use a few meaningful animations (page-load, staggered reveals) instead of generic micro-motions.\n- Background: Don't rely on flat, single-color backgrounds; use gradients, shapes, or subtle patterns to build atmosphere.\n- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary themes, type families, and visual languages across outputs.\n- Ensure the page loads properly on both desktop and mobile\n\nException: If working within an existing website or design system, preserve the established patterns, structure, and visual language.\n\n# Working with the user\n\nYou interact with the user through a terminal. You have 2 ways of communicating with the users:\n- Share intermediary updates in `commentary` channel. \n- After you have completed all your work, send a message to the `final` channel.\nYou are producing plain text that will later be styled by the program you run in. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value. Follow the formatting rules exactly.\n\n## Autonomy and persistence\nPersist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.\n\nUnless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.\n\n## Formatting rules\n\n- You may format with GitHub-flavored Markdown.\n- Structure your answer if necessary, the complexity of the answer should match the task. If the task is simple, your answer should be a one-liner. Order sections from general to specific to supporting.\n- Never use nested bullets. Keep lists flat (single level). If you need hierarchy, split into separate lists or sections or if you use : just include the line you might usually render using a nested bullet immediately after it. For numbered lists, only use the `1. 2. 3.` style markers (with a period), never `1)`.\n- Headers are optional, only use them when you think they are necessary. If you do use them, use short Title Case (1-3 words) wrapped in **…**. Don't add a blank line.\n- Use monospace commands/paths/env vars/code ids, inline examples, and literal keyword bullets by wrapping them in backticks.\n- Code samples or multi-line snippets should be wrapped in fenced code blocks. Include an info string as often as possible.\n- File References: When referencing files in your response follow the below rules:\n * Use markdown links (not inline code) for clickable files.\n * Each file reference should have a stand-alone path; use inline code for non-clickable paths (for example, directories).\n * For clickable/openable file references, the path target must be an absolute filesystem path. Labels may be short (for example, `[app.ts](/abs/path/app.ts)`).\n * Optionally include line/column (1‑based): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\n * Do not use URIs like file://, vscode://, or https://.\n * Do not provide range of lines\n * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n- Don’t use emojis or em dashes unless explicitly instructed.\n\n## Final answer instructions\n- Balance conciseness to not overwhelm the user with appropriate detail for the request. Do not narrate abstractly; explain what you are doing and why.\n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- The user does not see command execution outputs. When asked to show the output of a command (e.g. `git show`), relay the important details in your answer or summarize the key lines so the user understands the result.\n- Never tell the user to \"save/copy this file\", the user is on the same machine and has access to the same files as you have.\n- If the user asks for a code explanation, structure your answer with code references.\n- When given a simple task, just provide the outcome in a short answer without strong formatting.\n- When you make big or complex changes, state the solution first, then walk the user through what you did and why.\n- For casual chit-chat, just chat.\n- If you weren't able to do something, for example run tests, tell the user.\n- If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps. When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number.\n\n## Intermediary updates \n\n- Intermediary updates go to the `commentary` channel.\n- User updates are short updates while you are working, they are NOT final answers.\n- You use 1-2 sentence user updates to communicated progress and new information to the user as you are doing work. \n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- You provide user updates frequently, every 20s.\n- Before exploring or doing substantial work, you start with a user update acknowledging the request and explaining your first step. You should include your understanding of the user request and explain what you will do. Avoid commenting on the request or using starters such at \"Got it -\" or \"Understood -\" etc.\n- When exploring, e.g. searching, reading files you provide user updates as you go, every 20s, explaining what context you are gathering and what you've learned. Vary your sentence structure when providing these updates to avoid sounding repetitive - in particular, don't start each sentence the same way.\n- After you have sufficient context, and the work is substantial you provide a longer plan (this is the only user update that may be longer than 2 sentences and can contain formatting).\n- Before performing file edits of any kind, you provide updates explaining what edits you are making.\n- As you are thinking, you very frequently provide updates even if not taking any actions, informing the user of your progress. You interrupt your thinking and send multiple updates in a row if thinking for more than 100 words.\n- Tone of your updates MUST match your personality.\n", @@ -141,38 +141,40 @@ ] }, { - "slug": "deepseek-chat", - "display_name": "deepseek-chat", + "slug": "deepseek-v4-flash", + "display_name": "deepseek-v4-flash", "provider_family": "openai", - "description": "685B deepseek v3 flagship model released by deepseek at 2025.", + "description": "deepseek v4 flash model released by deepseek at 2026.", "thinking_capability": "toggle", "default_reasoning_level": "", - "supported_reasoning_levels": [], - "thinking_implementation": { - "model_variant": { - "variants": [ - { - "selection_value": "disabled", - "model_slug": "deepseek-chat", - "reasoning_effort": null, - "label": "Off", - "description": "Fast without thinking" - }, - { - "selection_value": "enabled", - "model_slug": "deepseek-reasoner", - "reasoning_effort": null, - "label": "On", - "description": "Enable the thinking" - } - ] - } + "supported_reasoning_levels": ["high", "max"], + "base_instructions": "You are Devo, a coding agent based on Deepseek. You and the user share the same workspace and collaborate to achieve the user's goals.\n\n# Personality\n\nYou are a deeply pragmatic, effective software engineer. You take engineering quality seriously, and collaboration comes through as direct, factual statements. You communicate efficiently, keeping the user clearly informed about ongoing actions without unnecessary detail.\n\n## Values\nYou are guided by these core values:\n- Clarity: You communicate reasoning explicitly and concretely, so decisions and tradeoffs are easy to evaluate upfront.\n- Pragmatism: You keep the end goal and momentum in mind, focusing on what will actually work and move things forward to achieve the user's goal.\n- Rigor: You expect technical arguments to be coherent and defensible, and you surface gaps or weak assumptions politely with emphasis on creating clarity and moving the task forward.\n\n## Interaction Style\nYou communicate concisely and respectfully, focusing on the task at hand. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\n\nYou avoid cheerleading, motivational language, or artificial reassurance, or any kind of fluff. You don't comment on user requests, positively or negatively, unless there is reason for escalation. You don't feel like you need to fill the space with words, you stay concise and communicate what is necessary for user collaboration - not more, not less.\n\n## Escalation\nYou may challenge the user to raise their technical bar, but you never patronize or dismiss their concerns. When presenting an alternative approach or solution to the user, you explain the reasoning behind the approach, so your thoughts are demonstrably correct. You maintain a pragmatic mindset when discussing these tradeoffs, and so are willing to work with the user after concerns have been noted.\n\n# General\n\n- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)\n- Parallelize tool calls whenever possible - especially file reads, such as `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`. Use `multi_tool_use.parallel` to parallelize tool calls and only this.\n\n## Editing constraints\n\n- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.\n- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like \"Assigns the value to the variable\", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare.\n- Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).\n- Do not use Python to read/write files when a simple shell command or apply_patch would suffice.\n- You may be in a dirty git worktree.\n * NEVER revert existing changes you did not make unless explicitly requested, since these changes were made by the user.\n * If asked to make a commit or code edits and there are unrelated changes to your work or changes that you didn't make in those files, don't revert those changes.\n * If the changes are in files you've touched recently, you should read carefully and understand how you can work with the changes rather than reverting them.\n * If the changes are in unrelated files, just ignore them and don't revert them.\n- Do not amend a commit unless explicitly requested to do so.\n- While you are working, you might notice unexpected changes that you didn't make. If this happens, STOP IMMEDIATELY and ask the user how they would like to proceed.\n- **NEVER** use destructive commands like `git reset --hard` or `git checkout --` unless specifically requested or approved by the user.\n- You struggle using the git interactive console. **ALWAYS** prefer using non-interactive git commands.\n\n## Special user requests\n\n- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as `date`), you should do so.\n- If the user asks for a \"review\", default to a code review mindset: prioritise identifying bugs, risks, behavioural regressions, and missing tests. Findings must be the primary focus of the response - keep summaries or overviews brief and only after enumerating the issues. Present findings first (ordered by severity with file/line references), follow with open questions or assumptions, and offer a change-summary only as a secondary detail. If no findings are discovered, state that explicitly and mention any residual risks or testing gaps.\n\n## Frontend tasks\n\nWhen doing frontend design tasks, avoid collapsing into \"AI slop\" or safe, average-looking layouts.\nAim for interfaces that feel intentional, bold, and a bit surprising.\n- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, Roboto, Arial, system).\n- Color & Look: Choose a clear visual direction; define CSS variables; avoid purple-on-white defaults. No purple bias or dark mode bias.\n- Motion: Use a few meaningful animations (page-load, staggered reveals) instead of generic micro-motions.\n- Background: Don't rely on flat, single-color backgrounds; use gradients, shapes, or subtle patterns to build atmosphere.\n- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary themes, type families, and visual languages across outputs.\n- Ensure the page loads properly on both desktop and mobile\n\nException: If working within an existing website or design system, preserve the established patterns, structure, and visual language.\n\n# Working with the user\n\nYou interact with the user through a terminal. You have 2 ways of communicating with the users:\n- Share intermediary updates in `commentary` channel. \n- After you have completed all your work, send a message to the `final` channel.\nYou are producing plain text that will later be styled by the program you run in. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value. Follow the formatting rules exactly.\n\n## Autonomy and persistence\nPersist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.\n\nUnless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.\n\n## Formatting rules\n\n- You may format with GitHub-flavored Markdown.\n- Structure your answer if necessary, the complexity of the answer should match the task. If the task is simple, your answer should be a one-liner. Order sections from general to specific to supporting.\n- Never use nested bullets. Keep lists flat (single level). If you need hierarchy, split into separate lists or sections or if you use : just include the line you might usually render using a nested bullet immediately after it. For numbered lists, only use the `1. 2. 3.` style markers (with a period), never `1)`.\n- Headers are optional, only use them when you think they are necessary. If you do use them, use short Title Case (1-3 words) wrapped in **…**. Don't add a blank line.\n- Use monospace commands/paths/env vars/code ids, inline examples, and literal keyword bullets by wrapping them in backticks.\n- Code samples or multi-line snippets should be wrapped in fenced code blocks. Include an info string as often as possible.\n- File References: When referencing files in your response follow the below rules:\n * Use markdown links (not inline code) for clickable files.\n * Each file reference should have a stand-alone path; use inline code for non-clickable paths (for example, directories).\n * For clickable/openable file references, the path target must be an absolute filesystem path. Labels may be short (for example, `[app.ts](/abs/path/app.ts)`).\n * Optionally include line/column (1‑based): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\n * Do not use URIs like file://, vscode://, or https://.\n * Do not provide range of lines\n * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n- Don’t use emojis or em dashes unless explicitly instructed.\n\n## Final answer instructions\n- Balance conciseness to not overwhelm the user with appropriate detail for the request. Do not narrate abstractly; explain what you are doing and why.\n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- The user does not see command execution outputs. When asked to show the output of a command (e.g. `git show`), relay the important details in your answer or summarize the key lines so the user understands the result.\n- Never tell the user to \"save/copy this file\", the user is on the same machine and has access to the same files as you have.\n- If the user asks for a code explanation, structure your answer with code references.\n- When given a simple task, just provide the outcome in a short answer without strong formatting.\n- When you make big or complex changes, state the solution first, then walk the user through what you did and why.\n- For casual chit-chat, just chat.\n- If you weren't able to do something, for example run tests, tell the user.\n- If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps. When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number.\n\n## Intermediary updates \n\n- Intermediary updates go to the `commentary` channel.\n- User updates are short updates while you are working, they are NOT final answers.\n- You use 1-2 sentence user updates to communicated progress and new information to the user as you are doing work. \n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- You provide user updates frequently, every 20s.\n- Before exploring or doing substantial work, you start with a user update acknowledging the request and explaining your first step. You should include your understanding of the user request and explain what you will do. Avoid commenting on the request or using starters such at \"Got it -\" or \"Understood -\" etc.\n- When exploring, e.g. searching, reading files you provide user updates as you go, every 20s, explaining what context you are gathering and what you've learned. Vary your sentence structure when providing these updates to avoid sounding repetitive - in particular, don't start each sentence the same way.\n- After you have sufficient context, and the work is substantial you provide a longer plan (this is the only user update that may be longer than 2 sentences and can contain formatting).\n- Before performing file edits of any kind, you provide updates explaining what edits you are making.\n- As you are thinking, you very frequently provide updates even if not taking any actions, informing the user of your progress. You interrupt your thinking and send multiple updates in a row if thinking for more than 100 words.\n- Tone of your updates MUST match your personality.\n", + "temperature": 1.0, + "top_p": 0.95, + "context_window": 1000000, + "max_tokens": 384000, + "effective_context_window_percent": 95, + "truncation_policy": { + "mode": "tokens", + "limit": 10000 }, + "input_modalities": [ + "text" + ] + }, + { + "slug": "deepseek-v4-pro", + "display_name": "deepseek-v4-pro", + "provider_family": "openai", + "description": "deepseek v4 pro model released by deepseek at 2026.", + "thinking_capability": "toggle", + "default_reasoning_level": "", + "supported_reasoning_levels": ["high", "max"], "base_instructions": "You are Devo, a coding agent based on Deepseek. You and the user share the same workspace and collaborate to achieve the user's goals.\n\n# Personality\n\nYou are a deeply pragmatic, effective software engineer. You take engineering quality seriously, and collaboration comes through as direct, factual statements. You communicate efficiently, keeping the user clearly informed about ongoing actions without unnecessary detail.\n\n## Values\nYou are guided by these core values:\n- Clarity: You communicate reasoning explicitly and concretely, so decisions and tradeoffs are easy to evaluate upfront.\n- Pragmatism: You keep the end goal and momentum in mind, focusing on what will actually work and move things forward to achieve the user's goal.\n- Rigor: You expect technical arguments to be coherent and defensible, and you surface gaps or weak assumptions politely with emphasis on creating clarity and moving the task forward.\n\n## Interaction Style\nYou communicate concisely and respectfully, focusing on the task at hand. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\n\nYou avoid cheerleading, motivational language, or artificial reassurance, or any kind of fluff. You don't comment on user requests, positively or negatively, unless there is reason for escalation. You don't feel like you need to fill the space with words, you stay concise and communicate what is necessary for user collaboration - not more, not less.\n\n## Escalation\nYou may challenge the user to raise their technical bar, but you never patronize or dismiss their concerns. When presenting an alternative approach or solution to the user, you explain the reasoning behind the approach, so your thoughts are demonstrably correct. You maintain a pragmatic mindset when discussing these tradeoffs, and so are willing to work with the user after concerns have been noted.\n\n# General\n\n- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)\n- Parallelize tool calls whenever possible - especially file reads, such as `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`. Use `multi_tool_use.parallel` to parallelize tool calls and only this.\n\n## Editing constraints\n\n- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.\n- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like \"Assigns the value to the variable\", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare.\n- Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).\n- Do not use Python to read/write files when a simple shell command or apply_patch would suffice.\n- You may be in a dirty git worktree.\n * NEVER revert existing changes you did not make unless explicitly requested, since these changes were made by the user.\n * If asked to make a commit or code edits and there are unrelated changes to your work or changes that you didn't make in those files, don't revert those changes.\n * If the changes are in files you've touched recently, you should read carefully and understand how you can work with the changes rather than reverting them.\n * If the changes are in unrelated files, just ignore them and don't revert them.\n- Do not amend a commit unless explicitly requested to do so.\n- While you are working, you might notice unexpected changes that you didn't make. If this happens, STOP IMMEDIATELY and ask the user how they would like to proceed.\n- **NEVER** use destructive commands like `git reset --hard` or `git checkout --` unless specifically requested or approved by the user.\n- You struggle using the git interactive console. **ALWAYS** prefer using non-interactive git commands.\n\n## Special user requests\n\n- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as `date`), you should do so.\n- If the user asks for a \"review\", default to a code review mindset: prioritise identifying bugs, risks, behavioural regressions, and missing tests. Findings must be the primary focus of the response - keep summaries or overviews brief and only after enumerating the issues. Present findings first (ordered by severity with file/line references), follow with open questions or assumptions, and offer a change-summary only as a secondary detail. If no findings are discovered, state that explicitly and mention any residual risks or testing gaps.\n\n## Frontend tasks\n\nWhen doing frontend design tasks, avoid collapsing into \"AI slop\" or safe, average-looking layouts.\nAim for interfaces that feel intentional, bold, and a bit surprising.\n- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, Roboto, Arial, system).\n- Color & Look: Choose a clear visual direction; define CSS variables; avoid purple-on-white defaults. No purple bias or dark mode bias.\n- Motion: Use a few meaningful animations (page-load, staggered reveals) instead of generic micro-motions.\n- Background: Don't rely on flat, single-color backgrounds; use gradients, shapes, or subtle patterns to build atmosphere.\n- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary themes, type families, and visual languages across outputs.\n- Ensure the page loads properly on both desktop and mobile\n\nException: If working within an existing website or design system, preserve the established patterns, structure, and visual language.\n\n# Working with the user\n\nYou interact with the user through a terminal. You have 2 ways of communicating with the users:\n- Share intermediary updates in `commentary` channel. \n- After you have completed all your work, send a message to the `final` channel.\nYou are producing plain text that will later be styled by the program you run in. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value. Follow the formatting rules exactly.\n\n## Autonomy and persistence\nPersist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.\n\nUnless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.\n\n## Formatting rules\n\n- You may format with GitHub-flavored Markdown.\n- Structure your answer if necessary, the complexity of the answer should match the task. If the task is simple, your answer should be a one-liner. Order sections from general to specific to supporting.\n- Never use nested bullets. Keep lists flat (single level). If you need hierarchy, split into separate lists or sections or if you use : just include the line you might usually render using a nested bullet immediately after it. For numbered lists, only use the `1. 2. 3.` style markers (with a period), never `1)`.\n- Headers are optional, only use them when you think they are necessary. If you do use them, use short Title Case (1-3 words) wrapped in **…**. Don't add a blank line.\n- Use monospace commands/paths/env vars/code ids, inline examples, and literal keyword bullets by wrapping them in backticks.\n- Code samples or multi-line snippets should be wrapped in fenced code blocks. Include an info string as often as possible.\n- File References: When referencing files in your response follow the below rules:\n * Use markdown links (not inline code) for clickable files.\n * Each file reference should have a stand-alone path; use inline code for non-clickable paths (for example, directories).\n * For clickable/openable file references, the path target must be an absolute filesystem path. Labels may be short (for example, `[app.ts](/abs/path/app.ts)`).\n * Optionally include line/column (1‑based): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\n * Do not use URIs like file://, vscode://, or https://.\n * Do not provide range of lines\n * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n- Don’t use emojis or em dashes unless explicitly instructed.\n\n## Final answer instructions\n- Balance conciseness to not overwhelm the user with appropriate detail for the request. Do not narrate abstractly; explain what you are doing and why.\n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- The user does not see command execution outputs. When asked to show the output of a command (e.g. `git show`), relay the important details in your answer or summarize the key lines so the user understands the result.\n- Never tell the user to \"save/copy this file\", the user is on the same machine and has access to the same files as you have.\n- If the user asks for a code explanation, structure your answer with code references.\n- When given a simple task, just provide the outcome in a short answer without strong formatting.\n- When you make big or complex changes, state the solution first, then walk the user through what you did and why.\n- For casual chit-chat, just chat.\n- If you weren't able to do something, for example run tests, tell the user.\n- If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps. When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number.\n\n## Intermediary updates \n\n- Intermediary updates go to the `commentary` channel.\n- User updates are short updates while you are working, they are NOT final answers.\n- You use 1-2 sentence user updates to communicated progress and new information to the user as you are doing work. \n- Do not begin responses with conversational interjections or meta commentary. Avoid openers such as acknowledgements (“Done —”, “Got it”, “Great question, ”) or framing phrases.\n- You provide user updates frequently, every 20s.\n- Before exploring or doing substantial work, you start with a user update acknowledging the request and explaining your first step. You should include your understanding of the user request and explain what you will do. Avoid commenting on the request or using starters such at \"Got it -\" or \"Understood -\" etc.\n- When exploring, e.g. searching, reading files you provide user updates as you go, every 20s, explaining what context you are gathering and what you've learned. Vary your sentence structure when providing these updates to avoid sounding repetitive - in particular, don't start each sentence the same way.\n- After you have sufficient context, and the work is substantial you provide a longer plan (this is the only user update that may be longer than 2 sentences and can contain formatting).\n- Before performing file edits of any kind, you provide updates explaining what edits you are making.\n- As you are thinking, you very frequently provide updates even if not taking any actions, informing the user of your progress. You interrupt your thinking and send multiple updates in a row if thinking for more than 100 words.\n- Tone of your updates MUST match your personality.\n", "temperature": 1.0, "top_p": 0.95, - "context_window": 256000, - "max_tokens": 8192, + "context_window": 1000000, + "max_tokens": 384000, "effective_context_window_percent": 95, "truncation_policy": { "mode": "tokens", diff --git a/crates/core/src/model_preset.rs b/crates/core/src/model_preset.rs index 488b6f4..0e824c2 100644 --- a/crates/core/src/model_preset.rs +++ b/crates/core/src/model_preset.rs @@ -94,7 +94,7 @@ impl Default for ModelPreset { display_name: String::new(), provider: ProviderWireApi::OpenAIChatCompletions, description: None, - thinking_capability: ThinkingCapability::Disabled, + thinking_capability: ThinkingCapability::Unsupported, default_reasoning_effort: Some(ReasoningEffort::default()), thinking_implementation: None, base_instructions: String::new(), @@ -150,7 +150,7 @@ fn default_input_modalities() -> Vec { } fn default_thinking_capability() -> ThinkingCapability { - ThinkingCapability::Disabled + ThinkingCapability::Unsupported } fn deserialize_optional_string<'de, D>(deserializer: D) -> Result, D::Error> diff --git a/crates/core/src/query.rs b/crates/core/src/query.rs index aabef99..d09015e 100644 --- a/crates/core/src/query.rs +++ b/crates/core/src/query.rs @@ -41,6 +41,7 @@ pub enum QueryEvent { /// Incremental reasoning text from the assistant. ReasoningDelta(String), /// Incremental token usage update from the provider stream. + /// TODO: Review the mechanism from the OpenAI API / Anthropic API documentation. UsageDelta { input_tokens: usize, output_tokens: usize, @@ -94,6 +95,12 @@ enum ErrorClass { Unretryable, } +enum ProviderRetryDecision { + RetryAfter(Duration), + CompactAndRetry, + Fail, +} + fn classify_error(e: &anyhow::Error) -> ErrorClass { let msg = e.to_string().to_lowercase(); // TODO: Expand the error of ContextTooLong @@ -153,8 +160,41 @@ fn classify_error(e: &anyhow::Error) -> ErrorClass { } } +fn provider_retry_decision( + error: &anyhow::Error, + retry_count: &mut usize, + context_compacted: &mut bool, +) -> ProviderRetryDecision { + match classify_error(error) { + ErrorClass::ContextTooLong => { + if *context_compacted { + ProviderRetryDecision::Fail + } else { + *context_compacted = true; + ProviderRetryDecision::CompactAndRetry + } + } + ErrorClass::RateLimit | ErrorClass::ServerError => { + if *retry_count >= MAX_RETRIES { + ProviderRetryDecision::Fail + } else { + *retry_count += 1; + ProviderRetryDecision::RetryAfter(retry_backoff_duration(*retry_count)) + } + } + ErrorClass::ParameterError + | ErrorClass::FileContentAnomaly + | ErrorClass::AuthenticationFailure + | ErrorClass::FeatureUnavailable + | ErrorClass::TaskNotFound + | ErrorClass::NoApiPermission + | ErrorClass::FileTooLarge + | ErrorClass::Unretryable => ProviderRetryDecision::Fail, + } +} + // --------------------------------------------------------------------------- -// Session compaction (capabilities 1.3 / 1.7) +// Session compaction // --------------------------------------------------------------------------- /// TODO: The context compact is weired, should compact with a seperate LLM invoke. @@ -259,22 +299,9 @@ fn build_system_prompt(base_instructions: &str) -> String { sections.join("\n\n") } -/// TODO: Here the shell has issue, on windows, it always return cmd.exe, however, -/// the windows usually powershell fn build_environment_context(cwd: &Path) -> String { - let shell = std::env::var("SHELL") - .ok() - .or_else(|| std::env::var("COMSPEC").ok()) - .unwrap_or_else(|| "unknown".to_string()); - - let shell = shell - .rsplit(std::path::MAIN_SEPARATOR) - .next() - .unwrap_or(&shell) - .to_lowercase(); - + let shell = shell_basename(); let current_date = chrono::Local::now().format("%Y-%m-%d").to_string(); - let timezone = iana_time_zone::get_timezone().unwrap_or_else(|_| "UTC".to_string()); format!( @@ -286,6 +313,85 @@ fn build_environment_context(cwd: &Path) -> String { ) } +pub fn default_shell_name() -> String { + #[cfg(target_os = "windows")] + { + return default_shell_windows(); + } + + #[cfg(target_os = "android")] + { + return default_shell_android(); + } + + #[cfg(any( + target_os = "linux", + target_os = "macos", + target_os = "freebsd", + target_os = "openbsd", + target_os = "netbsd", + target_os = "dragonfly" + ))] + { + return default_shell_unix(); + } + + #[allow(unreachable_code)] + "sh".to_string() +} + +#[cfg(target_os = "windows")] +fn default_shell_windows() -> String { + use std::env; + + if let Some(shell) = env::var_os("COMSPEC") + && !shell.is_empty() + { + return shell.to_string_lossy().into_owned(); + } + + "cmd.exe".to_string() +} + +#[cfg(target_os = "android")] +fn default_shell_android() -> String { + if let Some(shell) = env::var_os("SHELL") { + if !shell.is_empty() { + return shell.to_string_lossy().into_owned(); + } + } + + "/system/bin/sh".to_string() +} + +#[cfg(any( + target_os = "linux", + target_os = "macos", + target_os = "freebsd", + target_os = "openbsd", + target_os = "netbsd", + target_os = "dragonfly" +))] +fn default_shell_unix() -> String { + if let Some(shell) = env::var_os("SHELL") { + if !shell.is_empty() { + return shell.to_string_lossy().into_owned(); + } + } + + "/bin/sh".to_string() +} + +pub fn shell_basename() -> String { + let shell = default_shell_name(); + + Path::new(&shell) + .file_name() + .and_then(|name| name.to_str()) + .map(|s| s.to_ascii_lowercase()) + .unwrap_or(shell.to_ascii_lowercase()) +} + fn build_prefetched_user_inputs(cwd: &Path) -> Vec { let mut inputs = Vec::new(); if let Some(text) = load_prompt_md(cwd) { @@ -365,7 +471,7 @@ pub async fn query( let mut retry_count: usize = 0; let mut context_compacted = false; - loop { + 'query_loop: loop { for prompt in session.drain_pending_user_prompts() { session.push_message(Message::user(prompt)); } @@ -444,11 +550,7 @@ pub async fn query( let stream_result = provider.completion_stream(request).await; let mut stream = match stream_result { - Ok(s) => { - retry_count = 0; - context_compacted = false; - s - } + Ok(s) => s, Err(e) => { warn!( provider = provider.name(), @@ -457,41 +559,24 @@ pub async fn query( error = ?e, "failed to create provider stream" ); - match classify_error(&e) { - ErrorClass::ContextTooLong => { - // Compact history and retry once - if context_compacted { - return Err(AgentError::ContextTooLong); - } - warn!("context_too_long — compacting and retrying"); + match provider_retry_decision(&e, &mut retry_count, &mut context_compacted) { + ProviderRetryDecision::CompactAndRetry => { + warn!("context_too_long - compacting and retrying"); compact_session(session); - context_compacted = true; session.turn_count -= 1; continue; } - ErrorClass::RateLimit | ErrorClass::ServerError => { - if retry_count < MAX_RETRIES { - retry_count += 1; - let backoff = retry_backoff_duration(retry_count); - warn!( - attempt = retry_count, - backoff_ms = backoff.as_millis(), - "transient error — retrying with exponential backoff" - ); - sleep(backoff).await; - session.turn_count -= 1; - continue; - } - return Err(AgentError::Provider(e)); + ProviderRetryDecision::RetryAfter(backoff) => { + warn!( + attempt = retry_count, + backoff_ms = backoff.as_millis(), + "transient provider error - retrying with exponential backoff" + ); + sleep(backoff).await; + session.turn_count -= 1; + continue; } - ErrorClass::ParameterError - | ErrorClass::FileContentAnomaly - | ErrorClass::AuthenticationFailure - | ErrorClass::FeatureUnavailable - | ErrorClass::TaskNotFound - | ErrorClass::NoApiPermission - | ErrorClass::FileTooLarge - | ErrorClass::Unretryable => { + ProviderRetryDecision::Fail => { return Err(AgentError::Provider(e)); } } @@ -565,11 +650,42 @@ pub async fn query( error = ?e, "stream error" ); - return Err(AgentError::Provider(e)); + if !assistant_text.is_empty() + || !reasoning_text.is_empty() + || !tool_uses.is_empty() + || final_response.is_some() + { + return Err(AgentError::Provider(e)); + } + + match provider_retry_decision(&e, &mut retry_count, &mut context_compacted) { + ProviderRetryDecision::CompactAndRetry => { + warn!("context_too_long - compacting and retrying"); + compact_session(session); + session.turn_count -= 1; + continue 'query_loop; + } + ProviderRetryDecision::RetryAfter(backoff) => { + warn!( + attempt = retry_count, + backoff_ms = backoff.as_millis(), + "transient provider stream error - retrying with exponential backoff" + ); + sleep(backoff).await; + session.turn_count -= 1; + continue 'query_loop; + } + ProviderRetryDecision::Fail => { + return Err(AgentError::Provider(e)); + } + } } } } + retry_count = 0; + context_compacted = false; + if let Some(response) = &final_response { if assistant_text.is_empty() { assistant_text = response @@ -889,6 +1005,14 @@ mod tests { requests: Arc>>, } + struct TransientStreamCreateProvider { + attempts: AtomicUsize, + } + + struct TransientStreamEventProvider { + attempts: AtomicUsize, + } + #[async_trait] impl devo_provider::ModelProviderSDK for CapturingProvider { async fn completion(&self, _request: ModelRequest) -> Result { @@ -918,6 +1042,74 @@ mod tests { } } + #[async_trait] + impl devo_provider::ModelProviderSDK for TransientStreamCreateProvider { + async fn completion(&self, _request: ModelRequest) -> Result { + unreachable!("tests stream responses only") + } + + async fn completion_stream( + &self, + _request: ModelRequest, + ) -> Result> + Send>>> { + let attempt = self.attempts.fetch_add(1, Ordering::SeqCst); + if attempt == 0 { + return Err(anyhow::anyhow!("503 service unavailable")); + } + + Ok(Box::pin(futures::stream::iter(vec![Ok( + StreamEvent::MessageDone { + response: ModelResponse { + id: "resp".into(), + content: vec![ResponseContent::Text("done".into())], + stop_reason: Some(StopReason::EndTurn), + usage: Usage::default(), + metadata: Default::default(), + }, + }, + )]))) + } + + fn name(&self) -> &str { + "transient-stream-create-provider" + } + } + + #[async_trait] + impl devo_provider::ModelProviderSDK for TransientStreamEventProvider { + async fn completion(&self, _request: ModelRequest) -> Result { + unreachable!("tests stream responses only") + } + + async fn completion_stream( + &self, + _request: ModelRequest, + ) -> Result> + Send>>> { + let attempt = self.attempts.fetch_add(1, Ordering::SeqCst); + if attempt == 0 { + return Ok(Box::pin(futures::stream::iter(vec![Err(anyhow::anyhow!( + "500 internal server error" + ))]))); + } + + Ok(Box::pin(futures::stream::iter(vec![Ok( + StreamEvent::MessageDone { + response: ModelResponse { + id: "resp".into(), + content: vec![ResponseContent::Text("done".into())], + stop_reason: Some(StopReason::EndTurn), + usage: Usage::default(), + metadata: Default::default(), + }, + }, + )]))) + } + + fn name(&self) -> &str { + "transient-stream-event-provider" + } + } + #[async_trait] impl Tool for MutatingTool { fn name(&self) -> &str { @@ -947,6 +1139,68 @@ mod tests { } } + #[tokio::test] + async fn query_retries_transient_stream_creation_errors() { + let provider = TransientStreamCreateProvider { + attempts: AtomicUsize::new(0), + }; + let registry = Arc::new(ToolRegistry::new()); + let orchestrator = ToolOrchestrator::new(Arc::clone(®istry)); + let mut session = SessionState::new(SessionConfig::default(), std::env::temp_dir()); + session.push_message(Message::user("hello")); + + query( + &mut session, + &TurnConfig { + model: Model::default(), + thinking_selection: None, + }, + &provider, + registry, + &orchestrator, + None, + ) + .await + .expect("query should retry and succeed"); + + assert_eq!(provider.attempts.load(Ordering::SeqCst), 2); + assert_eq!( + session.messages.last(), + Some(&Message::assistant_text("done")) + ); + } + + #[tokio::test] + async fn query_retries_transient_stream_event_errors_before_content() { + let provider = TransientStreamEventProvider { + attempts: AtomicUsize::new(0), + }; + let registry = Arc::new(ToolRegistry::new()); + let orchestrator = ToolOrchestrator::new(Arc::clone(®istry)); + let mut session = SessionState::new(SessionConfig::default(), std::env::temp_dir()); + session.push_message(Message::user("hello")); + + query( + &mut session, + &TurnConfig { + model: Model::default(), + thinking_selection: None, + }, + &provider, + registry, + &orchestrator, + None, + ) + .await + .expect("query should retry and succeed"); + + assert_eq!(provider.attempts.load(Ordering::SeqCst), 2); + assert_eq!( + session.messages.last(), + Some(&Message::assistant_text("done")) + ); + } + #[tokio::test] async fn query_uses_session_permission_mode_for_mutating_tools() { let mut registry = ToolRegistry::new(); diff --git a/crates/protocol/src/model.rs b/crates/protocol/src/model.rs index 831454d..fe4d067 100644 --- a/crates/protocol/src/model.rs +++ b/crates/protocol/src/model.rs @@ -225,7 +225,7 @@ impl Default for Model { display_name: String::new(), provider: ProviderWireApi::OpenAIChatCompletions, description: None, - thinking_capability: ThinkingCapability::Disabled, + thinking_capability: ThinkingCapability::Unsupported, default_reasoning_effort: Some(ReasoningEffort::default()), thinking_implementation: None, base_instructions: String::new(), @@ -269,7 +269,7 @@ impl Model { pub fn effective_thinking_implementation(&self) -> ThinkingImplementation { self.thinking_implementation.clone().unwrap_or({ - if matches!(self.thinking_capability, ThinkingCapability::Disabled) { + if matches!(self.thinking_capability, ThinkingCapability::Unsupported) { ThinkingImplementation::Disabled } else { ThinkingImplementation::RequestParameter @@ -283,7 +283,7 @@ impl Model { pub fn default_thinking_selection(&self) -> Option { match &self.thinking_capability { - ThinkingCapability::Disabled => None, + ThinkingCapability::Unsupported => None, ThinkingCapability::Toggle => Some(String::from("enabled")), ThinkingCapability::Levels(levels) => self .default_reasoning_effort @@ -317,7 +317,7 @@ impl Model { }, ThinkingImplementation::RequestParameter => { let request_thinking = match self.effective_thinking_capability() { - ThinkingCapability::Disabled => None, + ThinkingCapability::Unsupported => None, ThinkingCapability::Toggle => normalized_selection .filter(|selection| selection == "enabled" || selection == "disabled"), ThinkingCapability::Levels(_) => normalized_selection.map(|selection| { @@ -462,7 +462,7 @@ mod tests { display_name: slug.into(), provider: ProviderWireApi::OpenAIChatCompletions, description: None, - thinking_capability: ThinkingCapability::Disabled, + thinking_capability: ThinkingCapability::Unsupported, default_reasoning_effort: Some(ReasoningEffort::Medium), thinking_implementation: None, base_instructions: String::new(), diff --git a/crates/protocol/src/thinking.rs b/crates/protocol/src/thinking.rs index 83f2022..f5f1010 100644 --- a/crates/protocol/src/thinking.rs +++ b/crates/protocol/src/thinking.rs @@ -48,9 +48,11 @@ use std::str::FromStr; use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; use serde_json::Value; -use strum_macros::{Display, EnumIter}; +use strum_macros::Display; +use strum_macros::EnumIter; /// Describes how a logical thinking selection should be applied to a request. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -117,6 +119,7 @@ pub struct ResolvedThinkingRequest { #[serde(rename_all = "lowercase")] #[strum(serialize_all = "lowercase")] pub enum ReasoningEffort { + // GPT thinking reason effor: [none, minimal, low, medium, high, xhigh] None, Minimal, Low, @@ -124,6 +127,8 @@ pub enum ReasoningEffort { Medium, High, XHigh, + // DeepSeek V4 thinking reason effort: [high, max] + Max, } impl FromStr for ReasoningEffort { @@ -144,6 +149,7 @@ impl ReasoningEffort { Self::Medium => "Medium", Self::High => "High", Self::XHigh => "XHigh", + Self::Max => "Max", } } @@ -155,6 +161,7 @@ impl ReasoningEffort { Self::Medium => "Balanced speed and deliberation", Self::High => "More deliberate for harder tasks", Self::XHigh => "Most deliberate, highest effort", + Self::Max => "Most deliberate, highest effort", } } } @@ -168,6 +175,7 @@ fn effort_rank(effort: ReasoningEffort) -> i32 { ReasoningEffort::Medium => 3, ReasoningEffort::High => 4, ReasoningEffort::XHigh => 5, + ReasoningEffort::Max => 5, } } @@ -212,7 +220,7 @@ pub struct ThinkingPreset { #[serde(rename_all = "lowercase")] pub enum ThinkingCapability { /// Model thinking cannot be controlled. - Disabled, + Unsupported, /// Model thinking can be toggled on and off. Toggle, /// Multiple effort levels can be selected for thinking. @@ -222,7 +230,7 @@ pub enum ThinkingCapability { impl ThinkingCapability { pub fn options(&self) -> Vec { match self { - ThinkingCapability::Disabled => Vec::new(), + ThinkingCapability::Unsupported => Vec::new(), ThinkingCapability::Toggle => vec![ ThinkingPreset { label: "Off".to_string(), diff --git a/crates/provider/src/openai/reasoning_effort.rs b/crates/provider/src/openai/reasoning_effort.rs index a3a23d3..fc043de 100644 --- a/crates/provider/src/openai/reasoning_effort.rs +++ b/crates/provider/src/openai/reasoning_effort.rs @@ -1,7 +1,8 @@ use std::fmt; use std::str::FromStr; -use serde::{Deserialize, Serialize}; +use serde::Deserialize; +use serde::Serialize; /// OpenAI reasoning-effort levels supported by reasoning models. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] @@ -13,6 +14,7 @@ pub enum OpenAIReasoningEffort { Medium, High, XHigh, + Max, } impl fmt::Display for OpenAIReasoningEffort { @@ -24,6 +26,7 @@ impl fmt::Display for OpenAIReasoningEffort { OpenAIReasoningEffort::Medium => "medium", OpenAIReasoningEffort::High => "high", OpenAIReasoningEffort::XHigh => "xhigh", + OpenAIReasoningEffort::Max => "max", }) } } @@ -39,6 +42,7 @@ impl FromStr for OpenAIReasoningEffort { "medium" => Ok(OpenAIReasoningEffort::Medium), "high" => Ok(OpenAIReasoningEffort::High), "xhigh" => Ok(OpenAIReasoningEffort::XHigh), + "max" => Ok(OpenAIReasoningEffort::Max), other => Err(format!("invalid OpenAI reasoning effort: {other}")), } } diff --git a/crates/provider/src/openai/shared.rs b/crates/provider/src/openai/shared.rs index cf34c3d..6f0133b 100644 --- a/crates/provider/src/openai/shared.rs +++ b/crates/provider/src/openai/shared.rs @@ -1,9 +1,13 @@ -use devo_protocol::{RequestRole, ToolDefinition}; -use serde_json::{Value, json}; +use devo_protocol::RequestRole; +use devo_protocol::ToolDefinition; +use serde_json::Value; +use serde_json::json; use tracing::warn; -use super::capabilities::{OpenAIReasoningMode, OpenAIRequestProfile}; -use super::{OpenAIReasoningEffort, OpenAIRole}; +use super::OpenAIReasoningEffort; +use super::OpenAIRole; +use super::capabilities::OpenAIReasoningMode; +use super::capabilities::OpenAIRequestProfile; pub(crate) fn request_role(role: &str) -> OpenAIRole { match role.parse::() { @@ -33,6 +37,7 @@ pub(crate) fn reasoning_effort(thinking: Option<&str>) -> Option Some(OpenAIReasoningEffort::Medium), "high" => Some(OpenAIReasoningEffort::High), "xhigh" => Some(OpenAIReasoningEffort::XHigh), + "max" => Some(OpenAIReasoningEffort::Max), _ => None, } } diff --git a/crates/tui/src/chatwidget.rs b/crates/tui/src/chatwidget.rs index bedcbfb..096f070 100644 --- a/crates/tui/src/chatwidget.rs +++ b/crates/tui/src/chatwidget.rs @@ -322,7 +322,7 @@ impl ChatWidget { .as_ref() .map(|model| model.slug.as_str()) .unwrap_or("unknown"); - let thinking = self.thinking_selection.as_deref().unwrap_or("default"); + let thinking = self.thinking_selection.as_deref().unwrap_or("unsupported"); let tokens = format!( "{} in / {} out", Self::format_token_count(self.total_input_tokens), @@ -784,7 +784,7 @@ impl ChatWidget { None, )); } - self.set_status_message(format!("Active session: {session_id}")); + self.set_status_message("Session switched"); } WorkerEvent::SessionRenamed { session_id, title } => { self.add_to_history(history_cell::new_info_event( @@ -797,7 +797,7 @@ impl ChatWidget { session_id: _, title, } => { - self.set_status_message(format!("Session titled: {title}")); + self.set_status_message(format!("Session: {title}")); } WorkerEvent::InputHistoryLoaded { direction: _, text } => { self.bottom_pane.restore_input_from_history(text); @@ -1259,6 +1259,7 @@ impl ChatWidget { Some(ReasoningEffort::Medium) => "medium", Some(ReasoningEffort::High) => "high", Some(ReasoningEffort::XHigh) => "xhigh", + Some(ReasoningEffort::Max) => "max", } } @@ -1270,6 +1271,7 @@ impl ChatWidget { ReasoningEffort::Medium => "Medium", ReasoningEffort::High => "High", ReasoningEffort::XHigh => "Extra high", + ReasoningEffort::Max => "max", } } @@ -1278,14 +1280,14 @@ impl ChatWidget { implementation: Option<&ThinkingImplementation>, default_reasoning_effort: Option, ) -> Option<&'static str> { - if matches!(capability, ThinkingCapability::Disabled) + if matches!(capability, ThinkingCapability::Unsupported) || matches!(implementation, Some(ThinkingImplementation::Disabled)) { return None; } match capability { - ThinkingCapability::Disabled => None, + ThinkingCapability::Unsupported => None, ThinkingCapability::Toggle => Some("thinking"), ThinkingCapability::Levels(levels) => default_reasoning_effort .or_else(|| levels.first().copied()) @@ -1445,7 +1447,7 @@ impl ChatWidget { self.picker_mode = Some(PickerMode::Thinking); let entries = self.thinking_entries(); if entries.is_empty() { - self.set_status_message("No thinking options available"); + self.set_status_message("Thinking Unsupported"); return; } let model_entries = entries diff --git a/crates/tui/src/exec_cell/mod.rs b/crates/tui/src/exec_cell/mod.rs index 8622519..393df90 100644 --- a/crates/tui/src/exec_cell/mod.rs +++ b/crates/tui/src/exec_cell/mod.rs @@ -1,5 +1,6 @@ mod model; mod render; +mod spinner; pub(crate) use model::CommandOutput; pub(crate) use render::OutputLinesParams; diff --git a/crates/tui/src/exec_cell/render.rs b/crates/tui/src/exec_cell/render.rs index d82cb26..52fbef9 100644 --- a/crates/tui/src/exec_cell/render.rs +++ b/crates/tui/src/exec_cell/render.rs @@ -3,12 +3,12 @@ use std::time::Instant; use super::model::CommandOutput; use super::model::ExecCall; use super::model::ExecCell; +use crate::exec_cell::spinner::unicode_spinner; use crate::exec_command::strip_bash_lc_and_escape; use crate::history_cell::HistoryCell; use crate::render::highlight::highlight_bash_to_lines; use crate::render::line_utils::prefix_lines; use crate::render::line_utils::push_owned_lines; -use crate::shimmer::shimmer_spans; use crate::wrapping::RtOptions; use crate::wrapping::adaptive_wrap_line; use crate::wrapping::adaptive_wrap_lines; @@ -226,17 +226,16 @@ pub(crate) fn truncated_tool_output_preview( pub(crate) fn spinner(start_time: Option, animations_enabled: bool) -> Span<'static> { if !animations_enabled { - return "•".dim(); + return Span::from("•").dim(); } - let elapsed = start_time.map(|st| st.elapsed()).unwrap_or_default(); if supports_color::on_cached(supports_color::Stream::Stdout) .map(|level| level.has_16m) .unwrap_or(false) { - shimmer_spans("•")[0].clone() + unicode_spinner(start_time) } else { - let blink_on = (elapsed.as_millis() / 600).is_multiple_of(2); - if blink_on { "•".into() } else { "◦".dim() } + let frame = crate::exec_cell::spinner::spinner_frame(start_time); + Span::from(frame).dim() } } diff --git a/crates/tui/src/exec_cell/spinner.rs b/crates/tui/src/exec_cell/spinner.rs new file mode 100644 index 0000000..66d72ea --- /dev/null +++ b/crates/tui/src/exec_cell/spinner.rs @@ -0,0 +1,31 @@ +use ratatui::prelude::Stylize; +use ratatui::text::Span; +use std::time::Instant; + +/// Spinner frames for the unicode spinner animation. +pub(super) const SPINNER_FRAMES: &[&str] = &["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; + +/// Spinner animation interval in milliseconds. +pub(super) const SPINNER_INTERVAL_MS: u128 = 80; + +/// Returns a unicode spinner frame based on elapsed time. +pub(super) fn spinner_frame(start_time: Option) -> &'static str { + let elapsed = start_time.map(|st| st.elapsed()).unwrap_or_default(); + let frame_index = (elapsed.as_millis() / SPINNER_INTERVAL_MS) as usize; + SPINNER_FRAMES[frame_index % SPINNER_FRAMES.len()] +} + +/// Renders a unicode spinner with shimmer effect for true-color terminals. +pub(super) fn unicode_spinner(start_time: Option) -> Span<'static> { + let frame = spinner_frame(start_time); + + if supports_color::on_cached(supports_color::Stream::Stdout) + .map(|level| level.has_16m) + .unwrap_or(false) + { + let shimmer = crate::shimmer::shimmer_spans(frame); + shimmer[0].clone() + } else { + Span::from(frame).dim() + } +} diff --git a/crates/tui/src/history_cell.rs b/crates/tui/src/history_cell.rs index 454e2d4..30ee751 100644 --- a/crates/tui/src/history_cell.rs +++ b/crates/tui/src/history_cell.rs @@ -1089,7 +1089,7 @@ impl HeaderHistoryCell { } fn reasoning_label(&self) -> Option<&'static str> { - if matches!(self.thinking_capability, ThinkingCapability::Disabled) + if matches!(self.thinking_capability, ThinkingCapability::Unsupported) || matches!( self.thinking_implementation, Some(ThinkingImplementation::Disabled) @@ -1110,8 +1110,9 @@ impl HeaderHistoryCell { ReasoningEffort::Medium => "medium", ReasoningEffort::High => "high", ReasoningEffort::XHigh => "xhigh", + ReasoningEffort::Max => "max", }), - ThinkingCapability::Disabled => None, + ThinkingCapability::Unsupported => None, } } }