Search documentation

Search documentation

Core SDK@pillar-ai/sdk

Events

Subscribe to SDK lifecycle and interaction events.

typescript
import Pillar from '@pillar-ai/sdk'

Methods

Pillar.on()

Subscribe to SDK events

typescript
on(event: K, callback: (data: PillarEvents[K]) => void): () => void

Parameters

event
requiredK
No description.
callback
required(data: PillarEvents[K]) => void
No description.

Returns

() => void

Types

PillarEvents

interface
typescript
interface PillarEvents {
ready: void;
error: Error;
"panel:open": void;
"panel:close": void;
"panel:navigate": { view: string; params?: Record<string, string> };
"article:view": { articleSlug: string };
"search:query": { query: string };
"chat:message": { message: string };
"textSelection:shown": { text: string };
"textSelection:click": { text: string };
// Context events
"context:change": { context: Context };
"profile:change": { profile: UserProfile };
"action:report": { action: string; metadata?: Record<string, unknown> };
// User identity events
"user:identified": {
userId: string;
profile?: {
name?: string;
email?: string;
metadata?: Record<string, unknown>;
};
};
"user:logout": Record<string, never>;
// Query action events - for actions that return data to the agent
"action:result": { actionName: string; result: unknown; toolCallId?: string };
// Task events - for AI-suggested actions
"task:execute": TaskExecutePayload;
"task:complete": {
id?: string;
name: string;
success: boolean;
data?: Record<string, unknown>;
};
// Workflow events - for multi-step sequences
"workflow:start": Workflow;
"workflow:step:active": { workflow: Workflow; step: WorkflowStep };
"workflow:step:complete": {
workflow: Workflow;
step: WorkflowStep;
success: boolean;
};
"workflow:step:skip": { workflow: Workflow; step: WorkflowStep };
"workflow:complete": Workflow;
"workflow:cancel": Workflow;
// Theme events
"theme:change": { theme: ResolvedThemeConfig };
// Text selection feature toggle
"textSelection:change": { enabled: boolean };
// DOM scanning events
"dom:scanned": CompactScanResult;
"domScanning:change": { enabled: boolean };
// Suggestions events - for page-aware suggestion sorting
"suggestions:updated": {
suggestions: Array<{ id: string; text: string }>;
route: string;
};
// Sidebar tab click events - for triggering custom actions on non-assistant tabs
// Customers use this to integrate their own support systems (Intercom, Zendesk, etc.)
"sidebar:click": { tabId: string; label: string };
/** @deprecated Use 'sidebar:click' instead. Will be removed in next major version. */
"support:request": { tabId: string };
}

Properties

ready
requiredvoid
No description.
error
requiredError
No description.
"panel:open"
requiredvoid
No description.
"panel:close"
requiredvoid
No description.
"panel:navigate"
required{ view: string; params?: Record<string, string> }
No description.
"article:view"
required{ articleSlug: string }
No description.
"search:query"
required{ query: string }
No description.
"chat:message"
required{ message: string }
No description.
"textSelection:shown"
required{ text: string }
No description.
"textSelection:click"
required{ text: string }
No description.
"context:change"
required{ context: Context }
No description.
"profile:change"
required{ profile: UserProfile }
No description.
"action:report"
required{ action: string; metadata?: Record<string, unknown> }
No description.
"user:identified"
required{ userId: string; profile?: { name?: string; email?: string; metadata?: Record<string, unknown>; }; }
No description.
"user:logout"
requiredRecord<string, never>
No description.
"action:result"
required{ actionName: string; result: unknown; toolCallId?: string }
No description.
"task:execute"
requiredTaskExecutePayload
No description.
"task:complete"
required{ id?: string; name: string; success: boolean; data?: Record<string, unknown>; }
No description.
"workflow:start"
requiredWorkflow
No description.
"workflow:step:active"
required{ workflow: Workflow; step: WorkflowStep }
No description.
"workflow:step:complete"
required{ workflow: Workflow; step: WorkflowStep; success: boolean; }
No description.
"workflow:step:skip"
required{ workflow: Workflow; step: WorkflowStep }
No description.
"workflow:complete"
requiredWorkflow
No description.
"workflow:cancel"
requiredWorkflow
No description.
"theme:change"
required{ theme: ResolvedThemeConfig }
No description.
"textSelection:change"
required{ enabled: boolean }
No description.
"dom:scanned"
requiredCompactScanResult
No description.
"domScanning:change"
required{ enabled: boolean }
No description.
"suggestions:updated"
required{ suggestions: Array<{ id: string; text: string }>; route: string; }
No description.
"sidebar:click"
required{ tabId: string; label: string }
No description.

Deprecated

"support:request"
required{ tabId: string }
Deprecated.