Skip to main content

Lifecycle

FunctionDescription
initSidenet(options)Initialize the sidebar (async, call once)
destroySidenet()Remove sidebar completely (async, returns Promise)

Visibility

FunctionDescription
toggleSidenet()Toggle sidebar visibility
openSidenet()Open the sidebar
closeSidenet()Close the sidebar
getSidenetState()Returns { isOpen: boolean, isInitialized: boolean }
triggerKeyboardShortcut()Programmatically trigger the shortcut action

Send Message Programmatically

FunctionDescription
sendMessage(text, options?)Send a message programmatically (async)
await sendMessage('Analyze this code', {
  agentVersionId: 'agent-123',          // Optional: use specific agent
  openSidebar: true,                    // Optional: auto-open sidebar (default: true)
  prompt: 'Respond as a senior staff engineer.', // Optional: one-shot system prompt for this send only
});

Options

FieldTypeDescription
agentVersionIdstringRoute this message to a specific agent version.
openSidebarbooleanAuto-open the sidebar before sending. Defaults to true.
promptstringOne-shot system prompt prepended to this single request only — same semantics as text.suggestions[].prompt. Cleared automatically after the message is sent, so follow-up messages revert to the agent’s normal behaviour.
sendMessage() always starts a new thread for the programmatic message — the active thread is reset before sending. Thread titles are auto-generated by the backend after streaming completes.

Get Agents

FunctionDescription
getAgents(copilotId, apiKey, orgId)Fetch available subagents (async)
import { getAgents } from 'sidenetai-sdk';

// Same three values you pass to initSidenet — handy for building a
// custom picker before the sidebar is mounted.
const agents = await getAgents('copilot-456', 'sk_...', 'org-123');