feat(tool-config): add categories, interfaces, and config management

Add support for tool categories, interface types, and per-tool configuration.

Backend:
- Add category and interfaces fields to ToolType model
- Create ToolConfig model for storing tool-specific settings
- Add tool_configs API endpoints (CRUD)
- Update built-in tool types with categories and interfaces:
  - code-server: editor, [web]
  - jupyter-notebook: notebook, [web]
  - opencode: ai-assistant, [terminal]
- Update instance API to include tool type interfaces
- Create Alembic migrations 0008 and 0009

Frontend:
- Update ToolType and Session interfaces with new fields
- Conditionally show Open/Terminal buttons based on tool interfaces
- Add API client for tool configs

OpenSpec: tool-config-management change created and implemented.
This commit is contained in:
Fusion
2026-05-20 11:03:09 +02:00
parent 74b5d0dc8c
commit 63ae706dd0
17 changed files with 539 additions and 17 deletions
@@ -0,0 +1,46 @@
## ADDED Requirements
### Requirement: Tool configs can be stored per user
The system SHALL allow users to store configuration values for tool types.
#### Scenario: Save global config
- **WHEN** a user saves a config value for a tool type
- **THEN** the config is stored with user_id and tool_type_id
- **AND** it is available for all future instances of that tool
#### Scenario: Save project-specific config
- **WHEN** a user saves a config value with a project_id
- **THEN** the config is scoped to that project
- **AND** it overrides global config for that project
### Requirement: Configs support env and file types
The system SHALL support environment variable configs and file-based configs.
#### Scenario: Env config
- **WHEN** a config has type "env"
- **THEN** it is injected as an environment variable when starting the container
#### Scenario: File config
- **WHEN** a config has type "file"
- **THEN** it is written to a file in the container
- **AND** the file path is configurable
### Requirement: Tool types have categories and interfaces
The system SHALL categorize tool types and declare their interfaces.
#### Scenario: Web interface tool
- **WHEN** a tool type has interface "web"
- **THEN** the UI shows an "Open" button
#### Scenario: Terminal interface tool
- **WHEN** a tool type has interface "terminal"
- **THEN** the UI shows a "Terminal" button
### Requirement: OpenCode is available as built-in tool
The system SHALL include OpenCode as a built-in tool type with terminal interface.
#### Scenario: Create OpenCode instance
- **WHEN** a user creates an OpenCode instance
- **THEN** it starts a container with opencode installed
- **AND** the repo is mounted at /workspace
- **AND** the user can access it via terminal