Skip to content

Feature Request: Add loadSession support #64

@seflless

Description

@seflless

I tried to use loadSession. Didn't realize loading a session with a sessionId isn't supported. What's the reasoning there? I know the Claude Code SDK doesn't provide a way to fetch sessions, but they do provide session IDs you can hold on to when you create a new session, so it should be possible to implement.

The error I see logged when I try running:

const sessionId = '0199634b-0342-7728-ba6f-b2b2544f037e';
  const sessionResult = await connection.loadSession({
    sessionId,
    cwd,
    mcpServers: [],
  });

Error

Error handling request {
  jsonrpc: '2.0',
  id: 1,
  method: 'session/load',
  params: {
    sessionId: '0199634b-0342-7728-ba6f-b2b2544f037e',
    cwd: '/Users/francoislaberge',
    mcpServers: []
  }
} {
  code: -32601,
  message: 'Method not found',
  data: { method: 'session/load' }
}
node:internal/process/promises:392
      new UnhandledPromiseRejection(reason);
      ^

UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".
    at throwUnhandledRejectionsMode (node:internal/process/promises:392:7)
    at processPromiseRejections (node:internal/process/promises:475:17)
    at processTicksAndRejections (node:internal/process/task_queues:106:32) {
  code: 'ERR_UNHANDLED_REJECTION'
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions