mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
MAESTRO: Implement Phase 4 - Add OpenCode agent definition with argument builders
Extended AgentConfig interface with new fields for dynamic CLI construction: - batchModePrefix: Args added before base args for batch mode (e.g., ['run']) - jsonOutputArgs: Args for JSON output format (e.g., ['--format', 'json']) - resumeArgs: Function to build resume args (e.g., ['--session', sessionId]) - readOnlyArgs: Args for read-only/plan mode (e.g., ['--agent', 'plan']) Updated OpenCode entry in AGENT_DEFINITIONS with all argument builders. Updated OpenCode capabilities based on verified investigation: - supportsImageInput: true (documented -f, --file flag) - supportsSessionStorage: true (~/.local/share/opencode/storage/) - supportsCostTracking: true (part.cost in events)
This commit is contained in:
@@ -186,22 +186,22 @@ export const AGENT_CAPABILITIES: Record<string, AgentCapabilities> = {
|
||||
* OpenCode - Open source coding assistant
|
||||
* https://github.com/opencode-ai/opencode
|
||||
*
|
||||
* NOTE: Some capabilities marked as false may be supported but are unverified.
|
||||
* Update this configuration after testing with the actual OpenCode CLI.
|
||||
* Verified capabilities based on CLI testing and documentation review.
|
||||
* See Auto Run Docs/OpenCode-Support.md for investigation details.
|
||||
*/
|
||||
'opencode': {
|
||||
supportsResume: true, // --session flag (sessionID in output)
|
||||
supportsReadOnlyMode: true, // --agent plan (plan mode)
|
||||
supportsJsonOutput: true, // --format json
|
||||
supportsSessionId: true, // sessionID in JSON output
|
||||
supportsImageInput: false, // Unverified - may be supported
|
||||
supportsSlashCommands: false, // Unverified - may be supported
|
||||
supportsSessionStorage: false, // Server-managed sessions
|
||||
supportsCostTracking: false, // May not apply to local/self-hosted
|
||||
supportsUsageStats: true, // part.tokens in output
|
||||
supportsBatchMode: true, // run subcommand
|
||||
supportsStreaming: true, // Streams JSON events
|
||||
supportsResultMessages: true, // step_finish event type
|
||||
supportsResume: true, // --session flag (sessionID in output) - Verified
|
||||
supportsReadOnlyMode: true, // --agent plan (plan mode) - Verified
|
||||
supportsJsonOutput: true, // --format json - Verified
|
||||
supportsSessionId: true, // sessionID in JSON output (camelCase) - Verified
|
||||
supportsImageInput: true, // -f, --file flag documented - Documented
|
||||
supportsSlashCommands: false, // Not investigated
|
||||
supportsSessionStorage: true, // ~/.local/share/opencode/storage/ (JSON files) - Verified
|
||||
supportsCostTracking: true, // part.cost in step_finish events - Verified
|
||||
supportsUsageStats: true, // part.tokens in step_finish events - Verified
|
||||
supportsBatchMode: true, // run subcommand (auto-approves all permissions) - Verified
|
||||
supportsStreaming: true, // Streams JSONL events - Verified
|
||||
supportsResultMessages: true, // step_finish with part.reason:"stop" - Verified
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface AgentConfig {
|
||||
name: string;
|
||||
binaryName: string;
|
||||
command: string;
|
||||
args: string[]; // Base args always included
|
||||
args: string[]; // Base args always included (excludes batch mode prefix)
|
||||
available: boolean;
|
||||
path?: string;
|
||||
customPath?: string; // User-specified custom path (shown in UI even if not available)
|
||||
@@ -31,6 +31,13 @@ export interface AgentConfig {
|
||||
configOptions?: AgentConfigOption[]; // Agent-specific configuration
|
||||
hidden?: boolean; // If true, agent is hidden from UI (internal use only)
|
||||
capabilities: AgentCapabilities; // Agent feature capabilities
|
||||
|
||||
// Argument builders for dynamic CLI construction
|
||||
// These are optional - agents that don't have them use hardcoded behavior
|
||||
batchModePrefix?: string[]; // Args added before base args for batch mode (e.g., ['run'] for OpenCode)
|
||||
jsonOutputArgs?: string[]; // Args for JSON output format (e.g., ['--format', 'json'])
|
||||
resumeArgs?: (sessionId: string) => string[]; // Function to build resume args
|
||||
readOnlyArgs?: string[]; // Args for read-only/plan mode (e.g., ['--agent', 'plan'])
|
||||
}
|
||||
|
||||
const AGENT_DEFINITIONS: Omit<AgentConfig, 'available' | 'path' | 'capabilities'>[] = [
|
||||
@@ -77,7 +84,13 @@ const AGENT_DEFINITIONS: Omit<AgentConfig, 'available' | 'path' | 'capabilities'
|
||||
name: 'OpenCode',
|
||||
binaryName: 'opencode',
|
||||
command: 'opencode',
|
||||
args: [],
|
||||
args: [], // Base args (none for OpenCode - batch mode uses 'run' subcommand)
|
||||
// OpenCode CLI argument builders
|
||||
// Batch mode: opencode run --format json [--session <id>] [--agent plan] "prompt"
|
||||
batchModePrefix: ['run'], // OpenCode uses 'run' subcommand for batch mode
|
||||
jsonOutputArgs: ['--format', 'json'], // JSON output format
|
||||
resumeArgs: (sessionId: string) => ['--session', sessionId], // Resume with session ID
|
||||
readOnlyArgs: ['--agent', 'plan'], // Read-only/plan mode
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user