fix: default agent config, timestamps display, and tests #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Merge shuvcode-dev into integration with fixes for default agent configuration and TUI improvements.
Changes
Fixes
default_agentconfiguration in agent selection (fixes Default agent does not apply in shuvcode #255)Features
showTimestampspreference is enabledTests
default_agentconfiguration:default:trueon specified agentbuildagent when invalid agent specifiedbuildagent when no config presentDocumentation
Breaking Changes
None
Testing
Existing tests cover changes. All 8 agent tests pass.
Greptile Summary
This PR fixes the default agent configuration not being respected in the TUI, adds timestamp display for assistant messages, and includes comprehensive test coverage for the default agent feature. The core fix is a single-line change that properly respects the
defaultproperty set byAgent.state()when initializing the current agent in the TUI context, aligning with upstream opencode behavior and the server-sideAgent.defaultAgent()function.Key Changes:
defaultproperty instead of always using the first agentshowTimestampspreference is enabledAll changes are minimal, focused, and follow existing code patterns. Tests validate the default agent logic at both the configuration level and the public API level.
Confidence Score: 5/5
Important Files Changed
defaultproperty set by Agent.state() whendefault_agentconfig is present. Falls back to first agent if no default is found. This aligns with the server-sideAgent.defaultAgent()function.showTimestampspreference is enabled. Uses existingLocale.todayTimeOrDateTime()utility method to format timestamps. Follows existing pattern for conditional display withShowcomponent and proper muted text styling.Sequence Diagram
sequenceDiagram participant User participant Config as opencode.json participant Agent as Agent.state() participant TUI as TUI Context participant LocalContext as local.tsx User->>Config: Set default_agent: "orchestrator" Config->>Agent: Load configuration Agent->>Agent: Mark orchestrator with default: true Agent->>TUI: Emit agent list with default property TUI->>LocalContext: Initialize agent store LocalContext->>LocalContext: Find agent with default: true LocalContext->>LocalContext: Use orchestrator as current agent LocalContext->>TUI: Display orchestrator as selected agent TUI->>User: Show TUI with orchestrator selected Note over LocalContext: Fallback: If no default found, use agents()[0]