Direct bridge to the Language Server via ConnectRPC.

Discovers the LS port and CSRF token from the LS process CLI args, then makes authenticated HTTPS POST calls to the LS endpoints.

const ls = new LSBridge(commandBridge);
await ls.initialize();

// Create a headless cascade
const cascadeId = await ls.createCascade({
text: 'Analyze test coverage',
model: Models.GEMINI_FLASH,
});

// Send follow-up
await ls.sendMessage({ cascadeId, text: 'Focus on edge cases' });

// Switch UI to it
await ls.focusCascade(cascadeId);

Constructors

Accessors

Methods

  • Cancel a running cascade invocation.

    Parameters

    • cascadeId: string

    Returns Promise<void>

  • Switch the UI to show a specific cascade conversation.

    Parameters

    • cascadeId: string

    Returns Promise<void>

  • Get details of a specific conversation.

    Parameters

    • cascadeId: string

    Returns Promise<any>

  • Get trajectory descriptions (lighter than full trajectories). Returns { trajectories: [...] }.

    Returns Promise<any>

  • Discover the Language Server port and CSRF token. Must be called before other methods.

    Discovery chain:

    1. Parse LS process CLI arguments (--port, --csrf_token)
    2. Fallback: getDiagnostics console logs (port only)
    3. Manual: call setConnection() after initialize() returns false

    Returns Promise<boolean>

  • Make a raw RPC call to any LS method.

    Parameters

    • method: string

      RPC method name (e.g. 'StartCascade')

    • payload: any

      JSON payload

    Returns Promise<any>

  • Manually set the LS connection parameters.

    Use this when auto-discovery fails (e.g., non-standard install, or you've discovered the port/token through other means like lsof).

    Parameters

    • port: number

      LS port number

    • csrfToken: string

      CSRF token from LS process CLI args

    • useTls: boolean = false

      Whether to use HTTPS (default: false, extension_server uses HTTP)

    Returns void

    const ls = new LSBridge(commandBridge);
    const ok = await ls.initialize();
    if (!ok) {
    // Manual fallback: get port and csrf from your own discovery
    ls.setConnection(54321, 'abc123-csrf-token');
    }
  • Star (pin) or unstar a conversation.

    This sets the starred field in ConversationAnnotations.

    Parameters

    • cascadeId: string

      Conversation ID

    • starred: boolean

      true to star, false to unstar

    Returns Promise<void>

  • Set a custom title for a conversation.

    This sets the title field in ConversationAnnotations. When set, this title should be displayed instead of the auto-generated summary from the LLM.

    Parameters

    • cascadeId: string

      Conversation ID

    • title: string

      Custom title to set

    Returns Promise<void>

  • Native conversation annotations (verified from jetski_cortex.proto).

    ConversationAnnotations protobuf fields:

    • title (string) — custom user title, overrides auto-summary
    • tags (string[]) — tags/labels
    • archived (bool) — archive status
    • starred (bool) — pinned/starred
    • last_user_view_time (Timestamp)

    Parameters

    • cascadeId: string

      Conversation ID

    • annotations: IConversationAnnotations

      Partial annotation fields to set

    • merge: boolean = true

      If true, merge with existing annotations (default: true)

    Returns Promise<void>