Skip to main content
Session creation, discovery, attachment, branching and deletion operations scoped through an AgentClient.

Methods

continue()

Attach to the latest matching persisted session.

Parameters

options?
Optional working-directory filter.
cwd?
string

Returns

Promise<Session> The selected session handle.

Throws

If no matching session is available.

create()

Create and attach a fresh runtime session.

Parameters

options?
SessionCreateOptions Working directory, metadata and runtime policy.

Returns

Promise<Session> A session with a ready callback dispatcher.

Throws

Configuration or transport errors.

delete()

Delete a server session after releasing an active local handle.

Parameters

sessionId
string Session to delete.

Returns

Promise<void> Completion when deletion succeeds.

Throws

Transport or cleanup errors.

fork()

Branch a transcript into a new session and attach its SDK resources.

Parameters

sessionId
string Source session ID.
options?
Optional message boundary, metadata and runtime overrides.
messageId?
string
permission?
PermissionRuleset
runtimeConfig?
RuntimeConfig
title?
string

Returns

Promise<Session> The independent fork.

Throws

If the source or boundary is invalid.

get()

Attach to a persisted session without applying overrides. Reuses an active local handle.

Parameters

sessionId
string Existing runtime session ID.

Returns

Promise<Session> The attached session.

Throws

If the session cannot be located.

list()

List persisted session metadata matching optional filters.

Parameters

filter?
SessionListFilter Directory, tags and pagination filters.

Returns

Promise<Session[]> Matching session records.

Throws

Transport errors.

resume()

Attach and optionally apply runtime overrides before starting the local dispatcher. Active handles reject overrides.

Parameters

sessionId
string
options?
SessionResumeOptions

Returns

Promise<Session>