refactor: replace agent-control MCP with labels system and Paseo MCP

This commit is contained in:
Mohamed Boudra
2026-01-29 11:31:15 +07:00
parent dfda6daeed
commit c015fdbef1
40 changed files with 171 additions and 797 deletions
+44
View File
@@ -82,6 +82,10 @@ export interface AgentLsOptions extends CommandOptions {
status?: string
/** Filter by specific cwd (overrides default cwd filtering) */
cwd?: string
/** Filter by labels (key=value format) */
label?: string[]
/** Filter to UI agents only (equivalent to --label ui=true) */
ui?: boolean
}
/**
@@ -145,6 +149,46 @@ export async function runLsCommand(
})
}
// Label filtering:
// Parse --label flags and --ui flag
// --ui is equivalent to --label ui=true
// By default (no --ui flag), show background agents (those WITHOUT ui=true)
const labelFilters: Record<string, string> = {}
if (options.label) {
for (const labelStr of options.label) {
const eqIndex = labelStr.indexOf('=')
if (eqIndex !== -1) {
const key = labelStr.slice(0, eqIndex)
const value = labelStr.slice(eqIndex + 1)
labelFilters[key] = value
}
}
}
// Add ui=true filter if --ui flag is set
if (options.ui) {
labelFilters['ui'] = 'true'
}
// Apply label filtering
if (Object.keys(labelFilters).length > 0) {
// Filter to agents that have ALL specified labels (AND semantics)
agents = agents.filter((a) => {
const agentLabels = (a as any).labels as Record<string, string> | undefined
for (const [key, value] of Object.entries(labelFilters)) {
if (!agentLabels || agentLabels[key] !== value) {
return false
}
}
return true
})
} else {
// Default: show background agents only (those without ui=true)
agents = agents.filter((a) => {
const agentLabels = (a as any).labels as Record<string, string> | undefined
return !agentLabels || agentLabels['ui'] !== 'true'
})
}
await client.close()
// Sort agents: running first, then idle, then others; within each group, most recent first