feat: add desktop agent workbench

This commit is contained in:
boos
2026-06-26 13:08:00 +08:00
parent bc99c678f9
commit 424aaa9b1f
28 changed files with 1247 additions and 71 deletions
@@ -0,0 +1,44 @@
# Desktop Agent Workbench Integration Design
## Scope
This deliverable adds the desktop UI shell and local interactions for Agent Workbench, and connects Agent mode to the existing desktop Agent command path. It intentionally avoids new Rust commands, database tables, billing, and remote media generation until the page contract is stable.
## Frontend Boundaries
- `types/index.ts` owns the `PageKey` addition.
- `components/layout/Sidebar.tsx` owns navigation entry placement.
- `components/layout/ContentArea.tsx` owns routing from `PageKey` to page component.
- `pages/AgentWorkbenchPage.tsx` owns the creator composer, local attachment state, mode state, model selection, Agent handoff, and placeholder result/status for media modes.
- `stores/providerStore.ts` remains the source of provider/model data. The page reads `providers` and calls `fetchProviders`; it does not duplicate provider fetching logic.
- `stores/conversationStore.ts` remains the source for conversation creation and Agent streaming. The Workbench reuses `createConversation`, `updateConversation`, and `sendAgentMessage`.
- `stores/skillStore.ts` remains the source for skill installation/listing. The Workbench reuses `loadSkills`, `installSkill`, and `toggleSkill` for third-party skills.
- `lib/browserMock.ts` mirrors skill install/list/toggle enough for browser preview.
- `i18n/locales/*.json` owns navigation labels. The first page UI can use Chinese literal copy to match current product direction, but nav should use locale keys.
## Data Flow
Provider store -> enabled providers -> enabled chat models -> AgentWorkbenchPage model options -> selected provider/model or custom model fallback.
File input -> browser `File` objects -> base64 `AttachmentInput` payload -> local attachment chips -> existing Agent attachment persistence during `agent_query`.
Mode selector -> local `creationMode` -> mode label/model controls/result copy.
Agent submit -> create conversation -> set `mode: "agent"` -> upsert Agent session via `agent_update_session` -> `sendAgentMessage` -> Chat page streaming display.
Non-Agent submit -> local result/status card. No external side effects yet.
Skills menu -> detect `jianying-editor` -> if missing install `luoluoluo22/jianying-editor-skill` via existing `install_skill` command -> if disabled enable it -> insert `请使用 jianying-editor Skill 自动创建剪映草稿:` into the prompt -> Agent submit loads enabled skills in the backend and can invoke the skill tool.
## Compatibility
Existing pages and settings should be unaffected. Adding a `PageKey` requires exhaustive switch and sidebar updates in the same change.
## Follow-up Hooks
Future work can replace the non-Agent local submit handler with:
- BoosAPI `/api/agent/models` for remote model catalog.
- BoosAPI `/api/jimeng/*` for image/video generation.
- Tauri file staging command for persistent uploads.
- A dedicated JianYing setup/status panel for Python dependency checks, JianYing draft path detection, and platform/version warnings.