feat: add agent delete command and bulk tab close operations

This commit is contained in:
Mohamed Boudra
2026-03-07 12:32:49 +07:00
parent 6b51088f39
commit 1d1c7058f1
21 changed files with 783 additions and 86 deletions
+4 -7
View File
@@ -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}`)
}