Skip to content

feat: add listSessions support to client and session#12

Open
varin-nair-factory wants to merge 2 commits intomainfrom
vn/add-list-sessions
Open

feat: add listSessions support to client and session#12
varin-nair-factory wants to merge 2 commits intomainfrom
vn/add-list-sessions

Conversation

@varin-nair-factory
Copy link
Copy Markdown
Contributor

@varin-nair-factory varin-nair-factory commented Apr 13, 2026

Description

Add listSessions() method to DroidClient and DroidSession, enabling programmatic session listing with cursor-based pagination via the droid.list_sessions JSON-RPC method.

Changes

  • src/schemas: Add ListSessionsRequestParamsSchema, SessionInfoSchema, ListSessionsResultSchema, request/response schemas, re-export from barrel
  • src/client.ts: Add listSessions(params?) method to DroidClient — skips _ensureSession() so it works before session init
  • src/session.ts: Add listSessions(params?) method to DroidSession
  • Tests: Schema validation tests, client send/parse tests (with and without params, no session required), session delegation test, throws-after-close guards

Usage

// From a session
const session = await createSession({ cwd: "/my/project" });
const { sessions, nextCursor } = await session.listSessions({ cwd: "/my/project" });

// From a client (no session required)
const client = new DroidClient({ transport });
const result = await client.listSessions();

Key Design Decisions

  • No session required: listSessions skips _ensureSession() so it works before initializeSession or loadSession
  • Optional cwd filter: when provided, scopes to that project; when omitted, returns all sessions
  • Cursor-based pagination: nextCursor in the response for paginating through large session lists

Related CLI PR

https://github.com/Factory-AI/factory-mono/pull/12082

Related Issue

part of FAC-18627

@varin-nair-factory varin-nair-factory self-assigned this Apr 13, 2026
Base automatically changed from vn/add-rename-session to main April 14, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant