feat(cli): hide orchestrator sessions from `ao session ls` by default (#1088)

Orchestrator sessions are control-plane sessions that clutter the ls
output alongside worker sessions. Filter them out using the existing
`isOrchestratorSessionName()` helper. Add `--all` / `-a` flag to
include them when needed.

Closes #1088

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
adil 2026-04-10 00:53:10 +05:30
parent ba899f9c30
commit 0f4e2bcc3c
1 changed files with 10 additions and 2 deletions

View File

@ -35,8 +35,9 @@ export function registerSession(program: Command): void {
.command("ls")
.description("List all sessions")
.option("-p, --project <id>", "Filter by project ID")
.option("-a, --all", "Include orchestrator sessions")
.option("--json", "Output as JSON")
.action(async (opts: { project?: string; json?: boolean }) => {
.action(async (opts: { project?: string; all?: boolean; json?: boolean }) => {
const config = loadConfig();
if (opts.project && !config.projects[opts.project]) {
console.error(chalk.red(`Unknown project: ${opts.project}`));
@ -44,7 +45,14 @@ export function registerSession(program: Command): void {
}
const sm = await getSessionManager(config);
const sessions = await sm.list(opts.project);
const allSessions = await sm.list(opts.project);
// Filter out orchestrator sessions unless --all is passed
const sessions = opts.all
? allSessions
: allSessions.filter(
(s) => !isOrchestratorSessionName(config, s.id, s.projectId),
);
// Group sessions by project
const byProject = new Map<string, typeof sessions>();