fix: remove stub commands, add workflow delete, fix policy create options
- Remove all legacy stub commands (agent-create-stub, plugin-install-stub, workflow-create-stub, policy-create-stub, system-status-stub, etc.) from agos.py — real API commands come exclusively from command_surface.py - Add `workflow delete` command (DELETE /workflows/:id, 204) - Fix `policy create`: add --effect, --action, --resource options; update default priority to 20 (minimum valid caller band); fix conditions payload - Add description to `integration` command group - Sync command_surface.py to match agos repo (canonical source) Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
166
cli/agos.py
166
cli/agos.py
@@ -1072,196 +1072,30 @@ def agent():
|
||||
pass
|
||||
|
||||
|
||||
@agent.command()
|
||||
@click.option('--name', required=True, help='Agent name')
|
||||
@click.option('--description', help='Agent description')
|
||||
@click.option('--model', default='gpt-4', help='LLM model')
|
||||
def agent_create_stub(name, description, model):
|
||||
"""Create a new agent"""
|
||||
console.print(f"[bold blue]Creating agent: {name}[/bold blue]")
|
||||
console.print("[yellow]Note: Full agent creation requires API implementation[/yellow]")
|
||||
console.print(f" Name: {name}")
|
||||
console.print(f" Description: {description or 'N/A'}")
|
||||
console.print(f" Model: {model}")
|
||||
|
||||
|
||||
@agent.command()
|
||||
def agent_list_stub():
|
||||
"""List all agents"""
|
||||
console.print("[bold blue]Listing agents...[/bold blue]")
|
||||
console.print("[yellow]Note: Full agent listing requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@agent.command()
|
||||
@click.argument('agent_id')
|
||||
def agent_start_stub(agent_id):
|
||||
"""Start an agent"""
|
||||
console.print(f"[bold blue]Starting agent: {agent_id}[/bold blue]")
|
||||
console.print("[yellow]Note: Full agent start requires runtime implementation[/yellow]")
|
||||
|
||||
|
||||
@agent.command()
|
||||
@click.argument('agent_id')
|
||||
def agent_stop_stub(agent_id):
|
||||
"""Stop an agent"""
|
||||
console.print(f"[bold blue]Stopping agent: {agent_id}[/bold blue]")
|
||||
console.print("[yellow]Note: Full agent stop requires runtime implementation[/yellow]")
|
||||
|
||||
|
||||
@agent.command()
|
||||
@click.argument('agent_id')
|
||||
@click.confirmation_option(prompt='Are you sure you want to delete this agent?')
|
||||
def agent_delete_stub(agent_id):
|
||||
"""Delete an agent"""
|
||||
console.print(f"[bold red]Deleting agent: {agent_id}[/bold red]")
|
||||
console.print("[yellow]Note: Full agent deletion requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@cli.group()
|
||||
def plugin():
|
||||
"""Plugin management commands"""
|
||||
pass
|
||||
|
||||
|
||||
@plugin.command()
|
||||
@click.argument('plugin_name')
|
||||
def plugin_install_stub(plugin_name):
|
||||
"""Install a plugin"""
|
||||
console.print(f"[bold blue]Installing plugin: {plugin_name}[/bold blue]")
|
||||
console.print("[yellow]Note: Full plugin install requires implementation[/yellow]")
|
||||
|
||||
|
||||
@plugin.command()
|
||||
def plugin_list_stub():
|
||||
"""List installed plugins"""
|
||||
console.print("[bold blue]Listing plugins...[/bold blue]")
|
||||
console.print("[yellow]Note: Full plugin listing requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@plugin.command()
|
||||
@click.argument('query')
|
||||
def plugin_search_stub(query):
|
||||
"""Search marketplace for plugins"""
|
||||
console.print(f"[bold blue]Searching for: {query}[/bold blue]")
|
||||
console.print("[yellow]Note: Full search requires marketplace API[/yellow]")
|
||||
|
||||
|
||||
@plugin.command()
|
||||
@click.argument('plugin_id')
|
||||
@click.confirmation_option(prompt='Are you sure you want to uninstall this plugin?')
|
||||
def plugin_uninstall_stub(plugin_id):
|
||||
"""Uninstall a plugin"""
|
||||
console.print(f"[bold red]Uninstalling plugin: {plugin_id}[/bold red]")
|
||||
console.print("[yellow]Note: Full uninstall requires implementation[/yellow]")
|
||||
|
||||
|
||||
@cli.group()
|
||||
def workflow():
|
||||
"""Workflow management commands"""
|
||||
pass
|
||||
|
||||
|
||||
@workflow.command()
|
||||
@click.option('--name', required=True, help='Workflow name')
|
||||
@click.option('--file', type=click.Path(exists=True), help='Workflow definition file')
|
||||
def workflow_create_stub(name, file):
|
||||
"""Create a new workflow"""
|
||||
console.print(f"[bold blue]Creating workflow: {name}[/bold blue]")
|
||||
if file:
|
||||
console.print(f" From file: {file}")
|
||||
console.print("[yellow]Note: Full workflow creation requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@workflow.command()
|
||||
@click.argument('workflow_id')
|
||||
def workflow_run_stub(workflow_id):
|
||||
"""Execute a workflow"""
|
||||
console.print(f"[bold blue]Running workflow: {workflow_id}[/bold blue]")
|
||||
console.print("[yellow]Note: Full workflow execution requires runtime[/yellow]")
|
||||
|
||||
|
||||
@workflow.command()
|
||||
@click.argument('workflow_id')
|
||||
def workflow_status_stub(workflow_id):
|
||||
"""Check workflow status"""
|
||||
console.print(f"[bold blue]Checking status of workflow: {workflow_id}[/bold blue]")
|
||||
console.print("[yellow]Note: Full status check requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@cli.group()
|
||||
def policy():
|
||||
"""Policy management commands"""
|
||||
pass
|
||||
|
||||
|
||||
@policy.command()
|
||||
@click.option('--name', required=True, help='Policy name')
|
||||
@click.option('--type', 'policy_type', required=True,
|
||||
type=click.Choice(['filesystem', 'network', 'resource']))
|
||||
@click.option('--effect', required=True,
|
||||
type=click.Choice(['allow', 'deny', 'require_approval']))
|
||||
def policy_create_stub(name, policy_type, effect):
|
||||
"""Create a new policy"""
|
||||
console.print(f"[bold blue]Creating policy: {name}[/bold blue]")
|
||||
console.print(f" Type: {policy_type}")
|
||||
console.print(f" Effect: {effect}")
|
||||
console.print("[yellow]Note: Full policy creation requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@policy.command()
|
||||
def policy_list_stub():
|
||||
"""List all policies"""
|
||||
console.print("[bold blue]Listing policies...[/bold blue]")
|
||||
console.print("[yellow]Note: Full policy listing requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@policy.command()
|
||||
@click.argument('policy_id')
|
||||
@click.confirmation_option(prompt='Are you sure you want to delete this policy?')
|
||||
def policy_delete_stub(policy_id):
|
||||
"""Delete a policy"""
|
||||
console.print(f"[bold red]Deleting policy: {policy_id}[/bold red]")
|
||||
console.print("[yellow]Note: Full policy deletion requires API implementation[/yellow]")
|
||||
|
||||
|
||||
@cli.group()
|
||||
def system():
|
||||
"""System operations"""
|
||||
pass
|
||||
|
||||
|
||||
@system.command()
|
||||
def system_status_stub():
|
||||
"""Show system status"""
|
||||
console.print("[bold blue]System Status[/bold blue]")
|
||||
|
||||
table = Table(title="AGOS Status")
|
||||
table.add_column("Component", style="cyan")
|
||||
table.add_column("Status", style="green")
|
||||
|
||||
table.add_row("Database", "✓ Connected")
|
||||
table.add_row("Runtime", "⚠ Not Started")
|
||||
table.add_row("API Server", "⚠ Not Started")
|
||||
table.add_row("Plugin System", "✓ Ready")
|
||||
|
||||
console.print(table)
|
||||
|
||||
|
||||
@system.command()
|
||||
@click.option('--lines', default=50, help='Number of log lines to show')
|
||||
def system_logs_stub(lines):
|
||||
"""Show system logs"""
|
||||
console.print(f"[bold blue]Showing last {lines} log lines...[/bold blue]")
|
||||
console.print("[yellow]Note: Full log viewing requires implementation[/yellow]")
|
||||
|
||||
|
||||
@system.command()
|
||||
def system_metrics_stub():
|
||||
"""Show system metrics"""
|
||||
console.print("[bold blue]System Metrics[/bold blue]")
|
||||
console.print("[yellow]Note: Full metrics require observability implementation[/yellow]")
|
||||
|
||||
|
||||
@cli.group()
|
||||
def doc():
|
||||
"""Documentation search and browse commands"""
|
||||
|
||||
@@ -851,6 +851,17 @@ def install_api_commands(
|
||||
_show_target(resolved_api_url)
|
||||
console.print(Panel.fit(f"Started workflow execution {payload['id']} for workflow {payload['workflow_id']}.", title='Workflow Running'))
|
||||
|
||||
@workflow_group.command(name='delete')
|
||||
@click.argument('workflow_id')
|
||||
@click.confirmation_option(prompt='Are you sure you want to delete this workflow?')
|
||||
@api_url_option
|
||||
def workflow_delete_command(workflow_id: str, api_url: Optional[str]):
|
||||
correlation_id = f'cli_workflow_delete_{int(time.time() * 1000)}'
|
||||
resolved_api_url = _resolve_api_url(api_url)
|
||||
_request_api('DELETE', f'/workflows/{workflow_id}', correlation_id, api_url=resolved_api_url, expected_status=(204,))
|
||||
_show_target(resolved_api_url)
|
||||
console.print(Panel.fit(f'Workflow {workflow_id} has been deleted.', title='Workflow Deleted'))
|
||||
|
||||
@workflow_group.command(name='status')
|
||||
@click.argument('workflow_id')
|
||||
@click.option('--limit', default=20, type=int)
|
||||
@@ -1027,22 +1038,32 @@ def install_api_commands(
|
||||
@policy_group.command(name='create')
|
||||
@click.option('--name', required=True)
|
||||
@click.option('--type', 'policy_type', required=True)
|
||||
@click.option('--effect', default='allow', show_default=True,
|
||||
type=click.Choice(['allow', 'deny', 'review', 'require_approval']),
|
||||
help='Policy effect')
|
||||
@click.option('--description', default=None)
|
||||
@click.option('--conditions-json', default='{}')
|
||||
@click.option('--priority', default=0, type=int)
|
||||
@click.option('--action', default='*', show_default=True, help='Action pattern (e.g. * or read)')
|
||||
@click.option('--resource', default='*', show_default=True, help='Resource pattern (e.g. * or /data/*)')
|
||||
@click.option('--conditions-json', default=None, help='Extra conditions as JSON object')
|
||||
@click.option('--priority', default=20, type=int, show_default=True,
|
||||
help='Priority (10-99 for user-created policies)')
|
||||
@click.option('--enabled/--disabled', default=True)
|
||||
@click.option('--owner-id', default=None)
|
||||
@click.option('--agent-id', default=None)
|
||||
@api_url_option
|
||||
@json_output_option
|
||||
def policy_create_command(name: str, policy_type: str, description: Optional[str], conditions_json: str, priority: int, enabled: bool, owner_id: Optional[str], agent_id: Optional[str], api_url: Optional[str], json_output: bool):
|
||||
def policy_create_command(name: str, policy_type: str, effect: str, description: Optional[str], action: str, resource: str, conditions_json: Optional[str], priority: int, enabled: bool, owner_id: Optional[str], agent_id: Optional[str], api_url: Optional[str], json_output: bool):
|
||||
correlation_id = f'cli_policy_create_{int(time.time() * 1000)}'
|
||||
resolved_api_url = _resolve_api_url(api_url)
|
||||
conditions = _parse_json_arg(conditions_json, 'conditions-json') if conditions_json else {}
|
||||
body = {
|
||||
'name': name,
|
||||
'description': description,
|
||||
'policy_type': policy_type,
|
||||
'conditions': _parse_json_arg(conditions_json, 'conditions-json'),
|
||||
'effect': effect,
|
||||
'action': action,
|
||||
'resource': resource,
|
||||
'conditions': conditions,
|
||||
'priority': priority,
|
||||
'enabled': enabled,
|
||||
'owner_id': owner_id,
|
||||
@@ -1068,6 +1089,7 @@ def install_api_commands(
|
||||
|
||||
@click.group(name='integration')
|
||||
def integration_group():
|
||||
"""Integration catalog and instance management commands"""
|
||||
pass
|
||||
|
||||
cli.add_command(integration_group)
|
||||
|
||||
Reference in New Issue
Block a user