Skip to main content

AiSessionsApi

interface

The workspace's session catalog: create sessions, look them up, and manage their lifecycle. Reach for this when you need a session that is not the one you are running in. Inside a tool or slash command, prefer `ctx.session`, which is already the current session and keeps the parent-child lineage intact.

interface AiSessionsApi

Import

import { AiSessionsApi } from '@modular/sdk/view';

Members9

archive
(sessionId: string) => Promise<void>

Hide a session from the active list without deleting its history.

create
(config?: AiSessionConfig) => Promise<AiSessionHandle>

Start a new root session.

delete
(sessionId: string) => Promise<AiSessionDeleteResult>

Permanently delete a session and its history.

find
(sessionId: string) => Promise<AiSessionHandle | null>

Look up a session by id, returning `null` if it does not exist.

get
(sessionId: string) => Promise<AiSessionHandle>

Look up a session by id, rejecting if it does not exist.

list
() => Promise<readonly AiSessionMetadata[]>

Every session in the workspace, archived ones included.

observe
(listener: (sessions: readonly AiSessionMetadata[]) => void) => Disposable

Watch the catalog for additions, removals, and status changes.

rename
(sessionId: string, title: string) => Promise<void>

Set a session's display title.

unarchive
(sessionId: string) => Promise<void>

Return an archived session to the active list.

Notes

category
AI