Repository navigation
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
There was a problem hiding this comment.
The fix works. I ran serve from source on the base and on this branch, with a project-local primary agent in .opencode/agents/reviewer.md, and called GET /api/agent. On the base, no agent carries native. With this PR, the built-in agents return native: true and reviewer returns native: false. While the server was running I added a second agent file and a config entry overriding build. After the automatic reload, the new agent was native: false and the overridden build stayed native: true. The core and app tests that cover this pass, and tsc is clean for schema, core, app and client. I didn't drive the web or desktop composer itself; the step from the agent list to the picker is covered by the app's unit tests.
Public API: one addition, an optional native: boolean on Agent.Info, so GET /api/agent and GET /api/agent/:id responses and the generated client AgentInfo type gain it. This is backwards compatible: nothing is removed or renamed, and existing clients can ignore the field.
One point that doesn't block this: agents added through a plugin's agent.transform leave native unset. The app only treats native === false as custom, so a primary agent added by a plugin still won't make the picker appear on its own, even though the schema comment groups plugins with config. If plugin agents should count as custom, they need native = false too. Otherwise the comment could say they are left unset.
There was a problem hiding this comment.
The new push rebases the same commit onto a newer dev; the change itself is identical. I checked it again on the new head. GET /api/agent from a source serve returns native: true for the built-in agents and native: false for a project-local primary agent, the core and app tests that cover this pass, and tsc is clean for schema and core.
Public API: unchanged since the last review. The only addition is an optional native on Agent.Info, in the /api/agent responses and the client AgentInfo type. It is backwards compatible.
Nothing new to raise.
Issue for this PR
Closes #50269
Related: #57812, #59642
Type of change
What does this PR do?
Restores the built-in/custom agent distinction on the public agent API.
V1 carried
nativeon every agent:truefor built-in agents andfalsefor agents defined in config. V2 dropped the field from the publicAgent.Info, so the app'shasCustomAgent()check (native === false) always returnedfalse. A custom primary agent therefore never auto-revealed the composer agent picker, and users with the default "Show agent" setting had no way to select it.packages/schema/src/agent.ts: add optionalnativetoAgent.Info.packages/core/src/plugin/agent.tsandpackages/core/src/plugin/plan.ts: mark all built-in agents asnative = true.packages/core/src/config/plugin/agent.ts: mark newly created config agents asnative = false. Overrides of a built-in agent keep the built-in value, matching V1.packages/app/src/runtime/server/global-sync/utils.ts: forwardnativethroughnormalizeAgentList, which previously dropped it.packages/client/src/promise/generated/types.ts: regenerated from the schema.The hidden-by-default product behavior is unchanged: the picker still requires Settings → General → Show agent, but it now appears automatically when a custom primary agent exists, as it did before V2.
How did you verify your code works?
packages/core:bun test test/config/agent.test.ts test/plugin/plan.test.ts— 51 pass / 0 fail. The new cases assert a built-in override staysnative: true, a config-defined agent isnative: false, and the Plan agent isnative: true.packages/app:bun test --conditions=solid --isolate --preload ../ui/test/solid-jsx.ts --preload ./happydom.ts src/runtime/server/global-sync/utils.test.ts src/providers/models/agent.test.ts— 14 pass / 0 fail. The adapter case now assertsnativereaches the UI model.packages/schema:bun test— 89 pass / 0 fail.www,posts,patchmark) fail only on this Windows machine because Device Guard blocks their freshly installedastro/tscshims; running them throughbunxpasses (astro check0 errors in both Astro packages,tsc --noEmit0 errors in patchmark).oxlintreports 0 errors, theast-grepscan passes, and the SDK docs check reports 0 problems.No manual desktop/web QA was performed; the verification above covers each propagation step from the agent service through the generated client types to the app adapter.
Visual
Screenshots / recordings
Not applicable: schema field, core agent flags, and client type propagation. No visual changes.
Checklist
Added by the opencode bot (AI-generated).
Related: #57812, #59642, #48810
Public API: adds optional
nativeto Agent.Info, returned by GET /api/agent and in the client AgentInfo type (backwards compatible)