feat: add agent delete command and bulk tab close operations
This commit is contained in:
@@ -12,7 +12,7 @@ export interface StopResult {
|
||||
export const stopSchema: OutputSchema<StopResult> = {
|
||||
// For quiet mode, output the stopped agent IDs (one per line)
|
||||
idField: (item) => item.agentIds.join('\n'),
|
||||
columns: [{ header: 'STOPPED', field: 'stoppedCount' }],
|
||||
columns: [{ header: 'INTERRUPTED', field: 'stoppedCount' }],
|
||||
}
|
||||
|
||||
export interface AgentStopOptions extends CommandOptions {
|
||||
@@ -83,18 +83,15 @@ export async function runStopCommand(
|
||||
agents = [fetchResult.agent]
|
||||
}
|
||||
|
||||
// Stop each agent
|
||||
// Interrupt each running agent. Idle agents are a no-op.
|
||||
for (const agent of agents) {
|
||||
try {
|
||||
// Cancel if running
|
||||
if (agent.status === 'running') {
|
||||
await client.cancelAgent(agent.id)
|
||||
stoppedIds.push(agent.id)
|
||||
}
|
||||
// Delete the agent
|
||||
await client.deleteAgent(agent.id)
|
||||
stoppedIds.push(agent.id)
|
||||
} catch (err) {
|
||||
// Continue stopping other agents even if one fails
|
||||
// Continue interrupting other agents even if one fails
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
console.error(`Warning: Failed to stop agent ${agent.id.slice(0, 7)}: ${message}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user