@pillar-ai/sdk 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -12
  3. package/dist/actions/types.d.ts +30 -0
  4. package/dist/api/client.d.ts +63 -32
  5. package/dist/api/mcp-client.d.ts +46 -23
  6. package/dist/cli/sync.js +2 -0
  7. package/dist/components/Button/EdgeTrigger.d.ts +18 -0
  8. package/dist/components/Cards/ConfirmActionCard.d.ts +0 -4
  9. package/dist/components/Cards/index.d.ts +1 -1
  10. package/dist/components/DevTools/index.d.ts +1 -1
  11. package/dist/components/PagePilot/PagePilotBanner.d.ts +7 -0
  12. package/dist/components/PagePilot/PagePilotManager.d.ts +42 -0
  13. package/dist/components/PagePilot/index.d.ts +6 -0
  14. package/dist/components/PagePilot/styles.d.ts +6 -0
  15. package/dist/components/Panel/Header.d.ts +4 -5
  16. package/dist/components/Panel/Panel.d.ts +10 -4
  17. package/dist/components/Panel/PanelContent.d.ts +1 -2
  18. package/dist/components/Panel/TaskButton.d.ts +0 -4
  19. package/dist/components/Panel/UnifiedChatInput.d.ts +7 -3
  20. package/dist/components/Panel/WorkflowChecklist.d.ts +0 -1
  21. package/dist/components/Panel/index.d.ts +2 -3
  22. package/dist/components/Panel/styles.d.ts +2 -2
  23. package/dist/components/Progress/ProgressGroup.d.ts +20 -0
  24. package/dist/components/Progress/ProgressRow.d.ts +9 -5
  25. package/dist/components/Progress/ProgressStack.d.ts +14 -5
  26. package/dist/components/Progress/ReasoningDisclosure.d.ts +6 -10
  27. package/dist/components/Progress/index.d.ts +1 -1
  28. package/dist/components/TextSelection/index.d.ts +0 -1
  29. package/dist/components/index.d.ts +2 -1
  30. package/dist/core/Pillar.d.ts +27 -6
  31. package/dist/core/config.d.ts +15 -3
  32. package/dist/index.d.ts +2 -2
  33. package/dist/pillar.esm.js +1 -1
  34. package/dist/store/chat.d.ts +103 -16
  35. package/dist/store/index.d.ts +1 -0
  36. package/dist/store/pagePilot.d.ts +56 -0
  37. package/dist/store/panel.d.ts +9 -0
  38. package/dist/store/suggestions.d.ts +2 -2
  39. package/dist/styles/panel-styles.d.ts +6 -0
  40. package/dist/styles/theme.d.ts +13 -0
  41. package/dist/types/dom-scanner.d.ts +23 -0
  42. package/dist/utils/dom-scanner.d.ts +41 -2
  43. package/dist/utils/markdown-components.d.ts +0 -1
  44. package/dist/utils/preact-markdown.d.ts +0 -1
  45. package/package.json +10 -7
  46. package/src/actions/types.ts +33 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pillar, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pillar-ai/sdk
2
2
 
3
- Cursor for your product — Embed an AI co-pilot that executes tasks, not just answers questions.
3
+ [Pillar](https://trypillar.com) is an open-source product copilot SDK for SaaS and web apps embed an AI assistant that executes tasks, not just answers questions. [GitHub](https://github.com/pillarhq/pillar) · [Docs](https://trypillar.com/docs)
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@pillar-ai/sdk)](https://www.npmjs.com/package/@pillar-ai/sdk)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@pillar-ai/sdk)](https://www.npmjs.com/package/@pillar-ai/sdk)
@@ -9,13 +9,21 @@ Cursor for your product — Embed an AI co-pilot that executes tasks, not just a
9
9
 
10
10
  ## What is Pillar?
11
11
 
12
- Pillar is an embedded AI co-pilot that helps users complete tasks, not just answer questions. Users say what they want, and Pillar uses your UI to make it happen — navigating pages, pre-filling forms, and calling your APIs.
12
+ Pillar is a product copilot for SaaS and web applications. Users say what they want, and Pillar uses your UI to make it happen — navigating pages, pre-filling forms, and calling your APIs.
13
13
 
14
- **How it works:**
14
+ A CRM user could ask:
15
15
 
16
- 1. User asks: *"Export this to CSV"* or *"Turn off email notifications"*
17
- 2. Pillar understands intent and chains actions
18
- 3. Your code executes with the user's session
16
+ > "Close the Walmart deal as won in Salesforce and notify implementation"
17
+
18
+ An analytics user could ask:
19
+
20
+ > "Add a weekly signups chart to my Amplitude dashboard"
21
+
22
+ Or an HR user:
23
+
24
+ > "How do I change my direct deposit in Rippling?"
25
+
26
+ Pillar understands the intent, builds a multi-step plan, and executes it client-side with the user's session.
19
27
 
20
28
  ## Features
21
29
 
@@ -50,11 +58,9 @@ yarn add @pillar-ai/sdk
50
58
 
51
59
  ### 1. Get Your Product Key
52
60
 
53
- First, register your product in the [Pillar app](https://app.trypillar.com):
54
-
55
- 1. Sign up or log in at [app.trypillar.com](https://app.trypillar.com)
56
- 2. Create a new product
57
- 3. Copy your **Product Key** from the settings page
61
+ > **⚠️ Beta Onboarding:** Cloud access is currently manual while we learn from early teams. Join the waitlist at [trypillar.com](https://trypillar.com), and we will reach out to onboard you.
62
+ >
63
+ > By default, you'll get an engineer from Pillar to help with setup. If you prefer onboarding without engineering support, include that in your waitlist request and we will support that too.
58
64
 
59
65
  ### 2. Initialize the SDK
60
66
 
@@ -63,7 +69,7 @@ import { Pillar } from "@pillar-ai/sdk";
63
69
 
64
70
  // Initialize and get the instance
65
71
  const pillar = await Pillar.init({
66
- productKey: "your-product-key", // From Pillar app
72
+ productKey: "your-product-key", // Provided during onboarding
67
73
  });
68
74
 
69
75
  // Now you can use instance methods
@@ -157,6 +157,18 @@ export interface ActionDefinition<TData = Record<string, unknown>> {
157
157
  * @default false
158
158
  */
159
159
  returns?: boolean;
160
+ /**
161
+ * Concrete examples of valid parameter objects for the AI to reference.
162
+ *
163
+ * Each example should have a `description` explaining the scenario
164
+ * and a `parameters` object matching the `dataSchema`.
165
+ * Useful for complex schemas where the AI benefits from seeing
166
+ * what a correct call looks like.
167
+ */
168
+ parameterExamples?: Array<{
169
+ description: string;
170
+ parameters: Record<string, unknown>;
171
+ }>;
160
172
  /**
161
173
  * Handler function executed when the action is triggered.
162
174
  *
@@ -189,6 +201,10 @@ export interface ActionManifestEntry {
189
201
  data_schema?: ActionDataSchema;
190
202
  default_data?: Record<string, unknown>;
191
203
  required_context?: Record<string, unknown>;
204
+ parameter_examples?: Array<{
205
+ description: string;
206
+ parameters: Record<string, unknown>;
207
+ }>;
192
208
  }
193
209
  /**
194
210
  * Action manifest - synced to server during CI/CD.
@@ -216,6 +232,11 @@ export interface ActionManifest {
216
232
  * Action definitions (without handlers).
217
233
  */
218
234
  actions: ActionManifestEntry[];
235
+ /**
236
+ * Custom agent guidance synced alongside actions.
237
+ * Injected into the AI agent's prompt as product_guidance.
238
+ */
239
+ agentGuidance?: string;
219
240
  }
220
241
  /**
221
242
  * Client info set during SDK initialization.
@@ -270,6 +291,15 @@ export interface SyncActionDefinition<TData = Record<string, unknown>> {
270
291
  * If true, the handler's return value is sent back to the agent.
271
292
  */
272
293
  returns?: boolean;
294
+ /**
295
+ * Concrete examples of valid parameter objects for the AI to reference.
296
+ * Each example should have a `description` and a `parameters` object
297
+ * matching the `dataSchema`.
298
+ */
299
+ parameterExamples?: Array<{
300
+ description: string;
301
+ parameters: Record<string, unknown>;
302
+ }>;
273
303
  }
274
304
  /**
275
305
  * Map of action name to sync definition (no handlers).
@@ -2,13 +2,13 @@
2
2
  * API Client for Pillar SDK
3
3
  * Handles all communication with the Pillar backend
4
4
  */
5
- import type { TaskButtonData } from '../components/Panel/TaskButton';
6
- import type { ResolvedConfig } from '../core/config';
7
- import type { Context, Suggestion, UserProfile } from '../core/context';
8
- import type { Workflow } from '../core/workflow';
9
- import type { UserContextItem } from '../types/user-context';
10
- import type { ActionRequest, ChatImage, ImageUploadResponse } from './mcp-client';
11
- import { MCPClient } from './mcp-client';
5
+ import type { TaskButtonData } from "../components/Panel/TaskButton";
6
+ import type { ResolvedConfig } from "../core/config";
7
+ import type { Context, Suggestion, UserProfile } from "../core/context";
8
+ import type { Workflow } from "../core/workflow";
9
+ import type { UserContextItem } from "../types/user-context";
10
+ import type { ActionRequest, ChatImage, ImageUploadResponse } from "./mcp-client";
11
+ import { MCPClient } from "./mcp-client";
12
12
  export interface ArticleSummary {
13
13
  id: string;
14
14
  title: string;
@@ -17,7 +17,7 @@ export interface ArticleSummary {
17
17
  category_name?: string;
18
18
  }
19
19
  export interface ChatMessage {
20
- role: 'user' | 'assistant';
20
+ role: "user" | "assistant";
21
21
  content: string;
22
22
  }
23
23
  export interface SuggestedQuestion {
@@ -53,7 +53,7 @@ export interface ProgressEvent {
53
53
  kind: string;
54
54
  id?: string;
55
55
  label?: string;
56
- status?: 'active' | 'done' | 'error';
56
+ status?: "active" | "done" | "error";
57
57
  text?: string;
58
58
  children?: ProgressChild[];
59
59
  metadata?: Record<string, unknown>;
@@ -67,7 +67,7 @@ export interface ProgressEvent {
67
67
  export interface ServerEmbedConfig {
68
68
  panel?: {
69
69
  enabled?: boolean;
70
- position?: 'left' | 'right';
70
+ position?: "left" | "right";
71
71
  width?: number;
72
72
  };
73
73
  floatingButton?: {
@@ -91,16 +91,45 @@ export interface ConversationSummary {
91
91
  lastMessageAt: string | null;
92
92
  messageCount: number;
93
93
  }
94
+ /**
95
+ * Display step in the agent's timeline.
96
+ * This is a human-readable timeline that includes thinking, tool decisions, and tool results.
97
+ * Used for UI display of the agent's reasoning process.
98
+ */
99
+ export interface DisplayStep {
100
+ step_type: "thinking" | "tool_decision" | "parallel_tool_decision" | "tool_result" | "token_summary" | "step_start" | "generating" | "narration";
101
+ iteration?: number;
102
+ timestamp_ms?: number;
103
+ content?: string;
104
+ tool?: string;
105
+ tools?: Array<{
106
+ tool: string;
107
+ arguments: Record<string, unknown>;
108
+ }>;
109
+ arguments?: Record<string, unknown>;
110
+ success?: boolean;
111
+ reasoning?: string;
112
+ label?: string;
113
+ [key: string]: unknown;
114
+ }
115
+ /**
116
+ * Message in conversation history.
117
+ * Contains display-oriented fields for UI rendering.
118
+ * LLM-native fields (llm_message) are kept server-side for conversation replay.
119
+ */
120
+ export interface HistoryMessage {
121
+ id: string;
122
+ role: "user" | "assistant";
123
+ content: string;
124
+ timestamp: string | null;
125
+ display_trace?: DisplayStep[];
126
+ images?: ChatImage[];
127
+ }
94
128
  /**
95
129
  * Full conversation with messages.
96
130
  */
97
131
  export interface ConversationDetail extends ConversationSummary {
98
- messages: Array<{
99
- id: string;
100
- role: 'user' | 'assistant';
101
- content: string;
102
- timestamp: string | null;
103
- }>;
132
+ messages: HistoryMessage[];
104
133
  }
105
134
  export declare class APIClient {
106
135
  private config;
@@ -158,13 +187,22 @@ export declare class APIClient {
158
187
  * @returns Promise with signed URL and expiration
159
188
  */
160
189
  uploadImage(file: File): Promise<ImageUploadResponse>;
161
- chat(message: string, history?: ChatMessage[], onChunk?: (chunk: string) => void, articleSlug?: string, existingConversationId?: string | null, onActions?: (actions: TaskButtonData[]) => void, userContext?: UserContextItem[], images?: ChatImage[], onProgress?: (progress: ProgressEvent) => void, onConversationStarted?: (conversationId: string, messageId?: string) => void, onActionRequest?: (request: ActionRequest) => Promise<void>): Promise<ChatResponse>;
162
- /**
163
- * Legacy chat method using the old /ai/chat/ endpoint.
164
- * @deprecated Use chat() which uses the MCP protocol.
165
- */
166
- chatLegacy(message: string, history?: ChatMessage[], onChunk?: (chunk: string) => void, articleSlug?: string, existingConversationId?: string | null): Promise<ChatResponse>;
167
- private handleStreamingChat;
190
+ chat(opts: {
191
+ message: string;
192
+ history?: ChatMessage[];
193
+ onChunk?: (chunk: string) => void;
194
+ articleSlug?: string;
195
+ existingConversationId?: string | null;
196
+ onActions?: (actions: TaskButtonData[]) => void;
197
+ userContext?: UserContextItem[];
198
+ images?: ChatImage[];
199
+ onProgress?: (progress: ProgressEvent) => void;
200
+ onConversationStarted?: (conversationId: string, assistantMessageId?: string) => void;
201
+ onActionRequest?: (request: ActionRequest) => Promise<void>;
202
+ signal?: AbortSignal;
203
+ onRequestId?: (requestId: number) => void;
204
+ resume?: boolean;
205
+ }): Promise<ChatResponse>;
168
206
  /**
169
207
  * Submit feedback on an AI assistant message.
170
208
  * Fire-and-forget - errors are logged but don't throw.
@@ -173,7 +211,7 @@ export declare class APIClient {
173
211
  * @param feedback - 'up' for helpful, 'down' for not helpful
174
212
  * @param comment - Optional comment explaining the feedback
175
213
  */
176
- submitFeedback(messageId: string, feedback: 'up' | 'down', comment?: string): Promise<void>;
214
+ submitFeedback(messageId: string, feedback: "up" | "down", comment?: string): Promise<void>;
177
215
  /**
178
216
  * Confirm task execution result.
179
217
  * Called by the SDK after a customer's task handler completes.
@@ -183,7 +221,7 @@ export declare class APIClient {
183
221
  * @param status - 'success' or 'failure'
184
222
  * @param details - Optional execution details
185
223
  */
186
- confirmTaskExecution(taskId: string, status: 'success' | 'failure', details?: {
224
+ confirmTaskExecution(taskId: string, status: "success" | "failure", details?: {
187
225
  error?: string;
188
226
  duration_ms?: number;
189
227
  session_id?: string;
@@ -195,13 +233,6 @@ export declare class APIClient {
195
233
  * Returns relevant articles, videos, and actions.
196
234
  */
197
235
  getSuggestions(ctx: Context, userProfile: UserProfile): Promise<Suggestion[]>;
198
- /**
199
- * Chat with enhanced context.
200
- * Includes product context and user profile for better responses.
201
- *
202
- * Note: Context is passed to the MCP ask tool as additional arguments.
203
- */
204
- chatWithContext(message: string, history: ChatMessage[] | undefined, ctx: Context, userProfile: UserProfile, onChunk?: (chunk: string) => void, existingConversationId?: string | null, onActions?: (actions: TaskButtonData[]) => void): Promise<ChatResponse>;
205
236
  /**
206
237
  * Identify the current user after login.
207
238
  * Links the anonymous visitor to the authenticated user ID, enabling
@@ -8,7 +8,7 @@ import type { TaskButtonData } from '../components/Panel/TaskButton';
8
8
  import type { ResolvedConfig } from '../core/config';
9
9
  import type { UserContextItem } from '../types/user-context';
10
10
  import { type LogEntry } from '../utils/debug';
11
- import type { ArticleSummary } from './client';
11
+ import type { ArticleSummary, DisplayStep } from './client';
12
12
  /** MCP Tool result content */
13
13
  interface ToolResultContent {
14
14
  type: 'text' | 'image' | 'resource';
@@ -57,6 +57,27 @@ export interface ActionRequest {
57
57
  /** Unique ID for this specific tool invocation (for result correlation) */
58
58
  tool_call_id?: string;
59
59
  }
60
+ /** Token usage data from the agentic loop (sent after each LLM iteration) */
61
+ export interface TokenUsage {
62
+ /** Input tokens for this iteration */
63
+ prompt_tokens: number;
64
+ /** Output tokens for this iteration */
65
+ completion_tokens: number;
66
+ /** Cumulative prompt tokens across all iterations */
67
+ total_prompt_tokens: number;
68
+ /** Cumulative completion tokens across all iterations */
69
+ total_completion_tokens: number;
70
+ /** Current total tokens in context */
71
+ total_used: number;
72
+ /** Maximum context window for the model */
73
+ context_window: number;
74
+ /** Current context occupancy percentage (0-100) */
75
+ occupancy_pct: number;
76
+ /** Name of the model in use */
77
+ model_name: string;
78
+ /** Current iteration number (0-indexed) */
79
+ iteration: number;
80
+ }
60
81
  /** Streaming callbacks for tool calls */
61
82
  export interface StreamCallbacks {
62
83
  /** Called for each text token */
@@ -69,8 +90,8 @@ export interface StreamCallbacks {
69
90
  onRegisteredActions?: (actions: Record<string, unknown>[]) => void;
70
91
  /** Called on error */
71
92
  onError?: (error: string) => void;
72
- /** Called when conversation_started event is received (early conversation_id) */
73
- onConversationStarted?: (conversationId: string, messageId?: string) => void;
93
+ /** Called when conversation_started event is received (confirms conversation tracking) */
94
+ onConversationStarted?: (conversationId: string, assistantMessageId?: string) => void;
74
95
  /** Called when stream is complete */
75
96
  onComplete?: (conversationId?: string, queryLogId?: string) => void;
76
97
  /** Called for progress updates (search, query, generating, thinking, etc.) */
@@ -89,8 +110,12 @@ export interface StreamCallbacks {
89
110
  progress_id?: string;
90
111
  message?: string;
91
112
  }) => void;
113
+ /** Called immediately with the request ID (for cancellation support) */
114
+ onRequestId?: (requestId: number) => void;
92
115
  /** Called when agent requests action execution (unified handler) */
93
116
  onActionRequest?: (request: ActionRequest) => Promise<void>;
117
+ /** Called when token usage is updated (after each LLM iteration) */
118
+ onTokenUsage?: (usage: TokenUsage) => void;
94
119
  }
95
120
  /** Image for chat requests (from upload-image endpoint) */
96
121
  export interface ChatImage {
@@ -98,10 +123,13 @@ export interface ChatImage {
98
123
  url: string;
99
124
  /** Detail level for image analysis. 'low' is faster and cheaper. */
100
125
  detail?: 'low' | 'high';
126
+ /** GCS storage path for URL refresh on history load */
127
+ path?: string;
101
128
  }
102
129
  /** Response from image upload endpoint */
103
130
  export interface ImageUploadResponse {
104
131
  url: string;
132
+ path: string;
105
133
  expires_at: string;
106
134
  }
107
135
  export declare class MCPClient {
@@ -174,7 +202,20 @@ export declare class MCPClient {
174
202
  /** Registered actions from previous turns (for dynamic action tools) */
175
203
  registeredActions?: Record<string, unknown>[];
176
204
  signal?: AbortSignal;
205
+ /** Conversation ID - generated client-side, always provided */
206
+ conversationId?: string;
207
+ /** Resume an interrupted session (sends empty query, loads state server-side) */
208
+ resume?: boolean;
177
209
  }): Promise<ToolResult>;
210
+ /**
211
+ * Cancel an active streaming request.
212
+ *
213
+ * Sends a notifications/cancel JSON-RPC request to the backend, which
214
+ * signals the StreamRegistry to stop the LLM stream and cease billing.
215
+ *
216
+ * @param requestId - The JSON-RPC request ID of the stream to cancel
217
+ */
218
+ cancelStream(requestId: number | string): Promise<void>;
178
219
  /**
179
220
  * Send action result back to the agent.
180
221
  *
@@ -214,21 +255,6 @@ export declare class MCPClient {
214
255
  * @returns Session status with resumption details, or null if not resumable
215
256
  */
216
257
  getConversationStatus(conversationId: string): Promise<ConversationStatus | null>;
217
- /**
218
- * Resume an interrupted conversation.
219
- *
220
- * Returns a streaming response that continues the conversation
221
- * from where it was interrupted.
222
- *
223
- * @param conversationId - The conversation to resume
224
- * @param userContext - Optional current page context
225
- * @param callbacks - Streaming callbacks
226
- */
227
- resumeConversation(conversationId: string, userContext: Record<string, unknown> | undefined, callbacks: StreamCallbacks): Promise<void>;
228
- /**
229
- * Handle events from the resume stream.
230
- */
231
- private handleResumeStreamEvent;
232
258
  }
233
259
  /**
234
260
  * Conversation status for session resumption.
@@ -239,11 +265,8 @@ export interface ConversationStatus {
239
265
  elapsed_ms?: number;
240
266
  user_message?: string;
241
267
  partial_response?: string;
242
- summary?: string;
243
- accomplished?: Array<{
244
- action: string;
245
- result_summary: string;
246
- }>;
268
+ display_trace?: DisplayStep[];
269
+ registered_actions?: Record<string, unknown>[];
247
270
  }
248
271
  /**
249
272
  * Convert ActionData from MCP response to TaskButtonData for UI rendering.
package/dist/cli/sync.js CHANGED
@@ -181,6 +181,8 @@ function buildManifest(actions, platform, version, gitSha, agentGuidance) {
181
181
  entry.default_data = definition.defaultData;
182
182
  if (definition.requiredContext)
183
183
  entry.required_context = definition.requiredContext;
184
+ if (definition.parameterExamples?.length)
185
+ entry.parameter_examples = definition.parameterExamples;
184
186
  entries.push(entry);
185
187
  }
186
188
  const manifest = {
@@ -26,6 +26,12 @@ export declare class EdgeTrigger {
26
26
  private unsubscribeActiveTab;
27
27
  private themeObserver;
28
28
  private currentTheme;
29
+ private _isResizing;
30
+ private _resizeStartX;
31
+ private _resizeStartWidth;
32
+ private _resizeRafId;
33
+ private _boundHandleResizeMove;
34
+ private _boundHandleResizeEnd;
29
35
  constructor(config: ResolvedConfig, events: EventEmitter, onClick: () => void, rootContainer?: HTMLElement | null);
30
36
  /**
31
37
  * Handle tab click - sets active tab and opens panel
@@ -75,5 +81,17 @@ export declare class EdgeTrigger {
75
81
  * Destroy the trigger
76
82
  */
77
83
  destroy(): void;
84
+ /**
85
+ * Handle resize start from mouse or touch event on the drag handle
86
+ */
87
+ private handleResizeStart;
88
+ /**
89
+ * Handle resize move - throttled via requestAnimationFrame
90
+ */
91
+ private handleResizeMove;
92
+ /**
93
+ * Handle resize end - save final width and clean up
94
+ */
95
+ private handleResizeEnd;
78
96
  private render;
79
97
  }
@@ -17,7 +17,3 @@ export declare function createDefaultConfirmCard(action: TaskButtonData, callbac
17
17
  * Uses custom renderer if registered, otherwise uses default.
18
18
  */
19
19
  export declare function createConfirmActionCard(action: TaskButtonData, onConfirm: (data?: Record<string, unknown>) => void, onCancel: () => void): HTMLDivElement;
20
- /**
21
- * CSS styles for ConfirmActionCard.
22
- */
23
- export declare const CONFIRM_CARD_STYLES = "\n/* Confirm Action Card */\n.pillar-confirm-card-wrapper {\n margin-top: 12px;\n}\n\n.pillar-confirm-card {\n background: var(--pillar-bg-secondary, #f9fafb);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 12px;\n overflow: hidden;\n}\n\n.pillar-confirm-card__content {\n padding: 16px;\n}\n\n.pillar-confirm-card__header {\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--pillar-text-primary, #111827);\n}\n\n.pillar-confirm-card__data {\n background: var(--pillar-bg-primary, #ffffff);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__data-row {\n display: flex;\n gap: 8px;\n font-size: 13px;\n margin-bottom: 4px;\n}\n\n.pillar-confirm-card__data-row:last-child {\n margin-bottom: 0;\n}\n\n.pillar-confirm-card__data-key {\n color: var(--pillar-text-secondary, #6b7280);\n flex-shrink: 0;\n}\n\n.pillar-confirm-card__data-value {\n color: var(--pillar-text-primary, #111827);\n word-break: break-word;\n}\n\n.pillar-confirm-card__actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n}\n\n.pillar-confirm-card__btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n}\n\n.pillar-confirm-card__btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.pillar-confirm-card__btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-confirm-card__btn--primary {\n background: var(--pillar-primary, #2563eb);\n color: #ffffff;\n border-color: var(--pillar-primary, #2563eb);\n}\n\n.pillar-confirm-card__btn--primary:hover:not(:disabled) {\n background: var(--pillar-primary-hover, #1d4ed8);\n border-color: var(--pillar-primary-hover, #1d4ed8);\n}\n\n.pillar-confirm-card__btn--secondary {\n background: var(--pillar-bg-primary, #ffffff);\n color: var(--pillar-text-secondary, #6b7280);\n border-color: var(--pillar-border, #e5e7eb);\n}\n\n.pillar-confirm-card__btn--secondary:hover:not(:disabled) {\n background: var(--pillar-bg-secondary, #f9fafb);\n}\n\n.pillar-confirm-card__success {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 16px;\n color: #059669;\n font-weight: 500;\n}\n\n.pillar-confirm-card__success-icon svg {\n width: 20px;\n height: 20px;\n}\n\n.pillar-confirm-card__error {\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n color: #dc2626;\n font-size: 13px;\n}\n\n.pillar-confirm-card__spinner {\n display: inline-flex;\n animation: pillar-spin 1s linear infinite;\n}\n\n@keyframes pillar-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n";
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Components for rendering interactive cards in chat responses.
5
5
  */
6
- export { createConfirmActionCard, createDefaultConfirmCard, CONFIRM_CARD_STYLES, } from './ConfirmActionCard';
6
+ export { createConfirmActionCard, createDefaultConfirmCard, } from './ConfirmActionCard';
@@ -2,4 +2,4 @@
2
2
  * DevTools Components
3
3
  * Development tools for debugging and previewing Pillar SDK features
4
4
  */
5
- export { DEVTOOLS_STYLES } from './styles';
5
+ export { default as devtoolsCSS } from './devtools.css';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Page Pilot Banner Component
3
+ * Shows "Page being piloted by Agent" with stop button during interact_with_page actions.
4
+ * When a destructive action is detected, shows a confirmation variant with Allow/Deny buttons.
5
+ */
6
+ import { h } from 'preact';
7
+ export declare function PagePilotBanner(): h.JSX.Element | null;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Page Pilot Manager
3
+ * Manages the "Page being piloted by Agent" banner, rendering it outside Shadow DOM
4
+ * so it appears above all other content on the page.
5
+ */
6
+ export declare class PagePilotManager {
7
+ private container;
8
+ private stylesInjected;
9
+ private unsubscribe;
10
+ private themeObserver;
11
+ private primaryColor;
12
+ /**
13
+ * Detect the current theme from the document
14
+ * Checks for .dark class (next-themes) or data-theme attribute
15
+ */
16
+ private detectThemeFromDOM;
17
+ /**
18
+ * Apply theme mode to container element
19
+ */
20
+ private applyTheme;
21
+ /**
22
+ * Set up observer to watch for theme changes on documentElement
23
+ */
24
+ private setupThemeObserver;
25
+ /**
26
+ * Initialize the page pilot manager
27
+ * @param primaryColor - Optional primary color from theme config to override the default
28
+ */
29
+ init(primaryColor?: string): void;
30
+ /**
31
+ * Update the primary color used by the banner
32
+ */
33
+ setPrimaryColor(color: string): void;
34
+ /**
35
+ * Destroy the page pilot manager
36
+ */
37
+ destroy(): void;
38
+ /**
39
+ * Render the banner component
40
+ */
41
+ private render;
42
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Page Pilot Components
3
+ * Banner and manager for displaying "Page being piloted by Agent" indicator
4
+ */
5
+ export { PagePilotBanner } from './PagePilotBanner';
6
+ export { PagePilotManager } from './PagePilotManager';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Page Pilot Banner CSS Styles
3
+ * Injected into the document head (outside Shadow DOM)
4
+ * Uses the same CSS variables as the Pillar panel for consistent theming
5
+ */
6
+ export declare const PAGE_PILOT_STYLES = "\n/* Pillar Page Pilot Banner Styles */\n\n/* Define CSS variables at the container level (same as panel) */\n#pillar-page-pilot-container {\n /* Core colors - Light mode (default) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-text: #1a1a1a;\n --pillar-text-secondary: #374151;\n --pillar-border: #e5e7eb;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n --pillar-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --pillar-radius-lg: 8px;\n --pillar-radius-md: 6px;\n --pillar-transition-fast: 0.15s ease;\n}\n\n/* Dark mode - Auto-detect from system preference */\n@media (prefers-color-scheme: dark) {\n #pillar-page-pilot-container:not([data-theme=\"light\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n }\n}\n\n/* Dark mode - Manual override via html class or data attribute */\nhtml.dark #pillar-page-pilot-container,\n[data-theme=\"dark\"] #pillar-page-pilot-container,\n#pillar-page-pilot-container[data-theme=\"dark\"] {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n}\n\n@keyframes pillar-pulse {\n 0%, 100% {\n opacity: 1;\n transform: scale(1);\n }\n 50% {\n opacity: 0.6;\n transform: scale(1.1);\n }\n}\n\n@keyframes pillar-banner-fade-in {\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n._pillar-page-pilot-banner {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 99999;\n font-family: var(--pillar-font-family);\n display: flex;\n justify-content: center;\n pointer-events: none;\n animation: pillar-banner-fade-in 0.2s ease-out;\n}\n\n/* Viewport outline \u2014 3px border on left, right, bottom; top handled by tab shape */\n._pillar-page-pilot-banner::before {\n content: '';\n position: fixed;\n inset: 0;\n border: 3px solid var(--pillar-primary);\n border-top: none;\n pointer-events: none;\n z-index: 99998;\n}\n\n/* Top border segments on either side of the tab */\n._pillar-page-pilot-banner::after {\n content: '';\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: var(--pillar-primary);\n pointer-events: none;\n z-index: 99997;\n}\n\n._pillar-page-pilot-banner__content {\n position: relative;\n z-index: 99999;\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 6px 20px;\n background: var(--pillar-primary);\n color: #ffffff;\n border-bottom-left-radius: var(--pillar-radius-lg);\n border-bottom-right-radius: var(--pillar-radius-lg);\n pointer-events: auto;\n}\n\n._pillar-page-pilot-banner__indicator {\n width: 8px;\n height: 8px;\n background: #ffffff;\n border-radius: 50%;\n animation: pillar-pulse 1.5s ease-in-out infinite;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__text {\n font-size: 13px;\n font-weight: 500;\n color: #ffffff;\n white-space: nowrap;\n}\n\n._pillar-page-pilot-banner__stop {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 5px 10px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__stop:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__stop:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__stop-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n}\n\n._pillar-page-pilot-banner__stop-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Confirmation variant \u2014 amber/warning theme */\n._pillar-page-pilot-banner--confirm ._pillar-page-pilot-banner__content {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::before {\n border-color: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::after {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner__warning-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__warning-icon svg {\n width: 100%;\n height: 100%;\n}\n\n._pillar-page-pilot-banner__deny {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__deny:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__deny:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__allow {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 600;\n color: #d97706;\n background: #ffffff;\n border: 1px solid rgba(255, 255, 255, 0.8);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__allow:hover {\n background: #fef3c7;\n}\n\n._pillar-page-pilot-banner__allow:active {\n transform: scale(0.97);\n}\n";
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * Panel Header Component
3
- * Navigation header with back, home, history, and close buttons
3
+ * Navigation header with back, home, history, and close buttons.
4
+ * In mobile mode, the header doubles as a drag handle: swipe down to dismiss.
4
5
  */
5
- import { h } from 'preact';
6
- import { type ViewType } from '../../store/router';
6
+ import { type ViewType } from "../../store/router";
7
7
  interface HeaderProps {
8
8
  currentView: ViewType;
9
- customTitle?: string;
10
9
  /** Hide back and home navigation buttons */
11
10
  hideNavigation?: boolean;
12
11
  }
13
- export declare function Header({ currentView, customTitle, hideNavigation }: HeaderProps): h.JSX.Element;
12
+ export declare function Header({ currentView, hideNavigation }: HeaderProps): import("preact").JSX.Element;
14
13
  export {};
@@ -2,9 +2,9 @@
2
2
  * Panel Container Component
3
3
  * Shadow DOM container for the help panel with Preact rendering
4
4
  */
5
- import type { APIClient } from '../../api/client';
6
- import type { ResolvedConfig } from '../../core/config';
7
- import type { EventEmitter } from '../../core/events';
5
+ import type { APIClient } from "../../api/client";
6
+ import type { ResolvedConfig } from "../../core/config";
7
+ import type { EventEmitter } from "../../core/events";
8
8
  export declare class Panel {
9
9
  private config;
10
10
  private api;
@@ -54,6 +54,12 @@ export declare class Panel {
54
54
  */
55
55
  destroy(): void;
56
56
  private subscribeToState;
57
+ /**
58
+ * Toggle backdrop visibility using inline styles.
59
+ * The backdrop is created with inline styles, so we must toggle via
60
+ * inline styles too (class-based overrides lose to inline specificity).
61
+ */
62
+ private setBackdropVisible;
57
63
  private applyPushModeStyles;
58
64
  private removePushModeStyles;
59
65
  /**
@@ -101,5 +107,5 @@ export declare class Panel {
101
107
  /**
102
108
  * Update the theme at runtime
103
109
  */
104
- setTheme(themeConfig: Partial<ResolvedConfig['theme']>): void;
110
+ setTheme(themeConfig: Partial<ResolvedConfig["theme"]>): void;
105
111
  }
@@ -2,5 +2,4 @@
2
2
  * Panel Content Component
3
3
  * Main panel layout with header, content, and chat input
4
4
  */
5
- import { h } from 'preact';
6
- export declare function PanelContent(): h.JSX.Element;
5
+ export declare function PanelContent(): import("preact").JSX.Element;
@@ -42,8 +42,4 @@ export declare function createTaskButton(props: TaskButtonProps): HTMLButtonElem
42
42
  * Create a container with multiple task buttons.
43
43
  */
44
44
  export declare function createTaskButtonGroup(tasks: TaskButtonData[]): HTMLDivElement;
45
- /**
46
- * CSS styles for TaskButton (to be added to PANEL_STYLES).
47
- */
48
- export declare const TASK_BUTTON_STYLES = "\n/* Task Button Component */\n.pillar-task-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n text-decoration: none;\n}\n\n.pillar-task-btn__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.pillar-task-btn__icon svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-task-btn__label {\n white-space: nowrap;\n}\n\n/* Primary variant (default) */\n.pillar-task-btn--primary {\n background: #2563eb;\n color: #ffffff;\n border-color: #2563eb;\n}\n\n.pillar-task-btn--primary:hover {\n background: #1d4ed8;\n border-color: #1d4ed8;\n}\n\n/* Default variant */\n.pillar-task-btn--default {\n background: #f3f4f6;\n color: #1a1a1a;\n border-color: #e5e7eb;\n}\n\n.pillar-task-btn--default:hover {\n background: #e5e7eb;\n}\n\n/* Secondary variant */\n.pillar-task-btn--secondary {\n background: #eff6ff;\n color: #2563eb;\n border-color: #dbeafe;\n}\n\n.pillar-task-btn--secondary:hover {\n background: #dbeafe;\n}\n\n/* Outline variant */\n.pillar-task-btn--outline {\n background: transparent;\n color: #2563eb;\n border-color: #2563eb;\n}\n\n.pillar-task-btn--outline:hover {\n background: #eff6ff;\n}\n\n/* Ghost variant */\n.pillar-task-btn--ghost {\n background: transparent;\n color: #6b7280;\n border-color: transparent;\n}\n\n.pillar-task-btn--ghost:hover {\n background: #f3f4f6;\n color: #1a1a1a;\n}\n\n/* Active state for inline_ui buttons with expanded card */\n.pillar-task-btn--active {\n background: #1d4ed8;\n border-color: #1d4ed8;\n}\n\n/* Task button group */\n.pillar-task-btn-group {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 12px;\n}\n\n/* Inline card container for inline_ui actions */\n.pillar-task-btn-inline-card {\n margin-top: 12px;\n animation: pillar-slide-down 0.15s ease-out;\n}\n\n@keyframes pillar-slide-down {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Task suggestion card in chat */\n.pillar-task-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 12px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n border-radius: 12px;\n margin-top: 12px;\n}\n\n.pillar-task-suggestion__header {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: #6b7280;\n}\n\n.pillar-task-suggestion__header svg {\n width: 14px;\n height: 14px;\n}\n\n.pillar-task-suggestion__description {\n font-size: 13px;\n color: #374151;\n}\n";
49
45
  export {};