@pillar-ai/sdk 0.1.0

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 (114) hide show
  1. package/README.md +129 -0
  2. package/dist/actions/definitions/analytics.d.ts +18 -0
  3. package/dist/actions/definitions/content.d.ts +40 -0
  4. package/dist/actions/definitions/index.d.ts +26 -0
  5. package/dist/actions/definitions/navigation.d.ts +65 -0
  6. package/dist/actions/definitions/settings.d.ts +162 -0
  7. package/dist/actions/definitions/sources.d.ts +44 -0
  8. package/dist/actions/definitions/support.d.ts +15 -0
  9. package/dist/actions/definitions/team.d.ts +120 -0
  10. package/dist/actions/index.d.ts +33 -0
  11. package/dist/actions/registry.d.ts +110 -0
  12. package/dist/actions/types.d.ts +388 -0
  13. package/dist/api/client.d.ts +186 -0
  14. package/dist/api/mcp-client.d.ts +226 -0
  15. package/dist/button/FloatingButton.d.ts +44 -0
  16. package/dist/cli/sync.d.ts +2 -0
  17. package/dist/components/Button/EdgeTrigger.d.ts +78 -0
  18. package/dist/components/Button/FloatingButton.d.ts +46 -0
  19. package/dist/components/Button/index.d.ts +5 -0
  20. package/dist/components/Cards/ConfirmActionCard.d.ts +23 -0
  21. package/dist/components/Cards/index.d.ts +6 -0
  22. package/dist/components/Panel/ChatInput.d.ts +5 -0
  23. package/dist/components/Panel/ContextTag.d.ts +18 -0
  24. package/dist/components/Panel/Header.d.ts +14 -0
  25. package/dist/components/Panel/Panel.d.ts +104 -0
  26. package/dist/components/Panel/PanelContent.d.ts +6 -0
  27. package/dist/components/Panel/TaskButton.d.ts +59 -0
  28. package/dist/components/Panel/UnifiedChatInput.d.ts +23 -0
  29. package/dist/components/Panel/WorkflowChecklist.d.ts +9 -0
  30. package/dist/components/Panel/index.d.ts +13 -0
  31. package/dist/components/Panel/styles.d.ts +20 -0
  32. package/dist/components/Plan/InlinePlanView.d.ts +24 -0
  33. package/dist/components/Plan/PlanStepItem.d.ts +18 -0
  34. package/dist/components/Plan/PlanView.d.ts +10 -0
  35. package/dist/components/Plan/index.d.ts +8 -0
  36. package/dist/components/TextSelection/TextSelectionManager.d.ts +34 -0
  37. package/dist/components/TextSelection/TextSelectionPopover.d.ts +14 -0
  38. package/dist/components/TextSelection/index.d.ts +6 -0
  39. package/dist/components/TextSelection/styles.d.ts +5 -0
  40. package/dist/components/Tooltips/Tooltip.d.ts +46 -0
  41. package/dist/components/Tooltips/TooltipManager.d.ts +41 -0
  42. package/dist/components/Tooltips/index.d.ts +6 -0
  43. package/dist/components/Tooltips/styles.d.ts +5 -0
  44. package/dist/components/Views/ArticleChatView.d.ts +9 -0
  45. package/dist/components/Views/ArticleView.d.ts +10 -0
  46. package/dist/components/Views/CategoryView.d.ts +11 -0
  47. package/dist/components/Views/ChatView.d.ts +5 -0
  48. package/dist/components/Views/DeveloperView.d.ts +6 -0
  49. package/dist/components/Views/HomeView.d.ts +5 -0
  50. package/dist/components/Views/SearchView.d.ts +10 -0
  51. package/dist/components/Views/index.d.ts +5 -0
  52. package/dist/components/context.d.ts +21 -0
  53. package/dist/components/index.d.ts +9 -0
  54. package/dist/components/shared/ArticleCard.d.ts +17 -0
  55. package/dist/components/shared/CategoryCard.d.ts +17 -0
  56. package/dist/components/shared/Empty.d.ts +11 -0
  57. package/dist/components/shared/Loading.d.ts +6 -0
  58. package/dist/components/shared/MessageInputArea.d.ts +19 -0
  59. package/dist/components/shared/QuestionChip.d.ts +14 -0
  60. package/dist/components/shared/index.d.ts +7 -0
  61. package/dist/content/extensions/AccordionNode.d.ts +10 -0
  62. package/dist/content/extensions/CalloutNode.d.ts +11 -0
  63. package/dist/content/extensions/index.d.ts +5 -0
  64. package/dist/content/index.d.ts +5 -0
  65. package/dist/content/renderer.d.ts +24 -0
  66. package/dist/core/Pillar.d.ts +454 -0
  67. package/dist/core/config.d.ts +253 -0
  68. package/dist/core/context.d.ts +71 -0
  69. package/dist/core/events.d.ts +228 -0
  70. package/dist/core/plan-executor.d.ts +101 -0
  71. package/dist/core/plan.d.ts +155 -0
  72. package/dist/core/workflow.d.ts +89 -0
  73. package/dist/index.d.ts +32 -0
  74. package/dist/panel/Panel.d.ts +53 -0
  75. package/dist/panel/PanelUI.d.ts +43 -0
  76. package/dist/panel/components/ArticleCard.d.ts +10 -0
  77. package/dist/panel/components/CategoryCard.d.ts +10 -0
  78. package/dist/panel/components/ChatInput.d.ts +36 -0
  79. package/dist/panel/components/Header.d.ts +16 -0
  80. package/dist/panel/components/SearchInput.d.ts +11 -0
  81. package/dist/panel/styles.d.ts +5 -0
  82. package/dist/panel/views/ArticleView.d.ts +21 -0
  83. package/dist/panel/views/CategoryView.d.ts +20 -0
  84. package/dist/panel/views/ChatView.d.ts +30 -0
  85. package/dist/panel/views/HomeView.d.ts +18 -0
  86. package/dist/panel/views/SearchView.d.ts +22 -0
  87. package/dist/pillar.esm.js +10338 -0
  88. package/dist/pillar.esm.js.map +1 -0
  89. package/dist/pillar.js +10362 -0
  90. package/dist/pillar.js.map +1 -0
  91. package/dist/pillar.min.js +2 -0
  92. package/dist/pillar.min.js.map +1 -0
  93. package/dist/store/chat.d.ts +85 -0
  94. package/dist/store/context.d.ts +46 -0
  95. package/dist/store/developer.d.ts +19 -0
  96. package/dist/store/index.d.ts +10 -0
  97. package/dist/store/panel.d.ts +43 -0
  98. package/dist/store/plan-persistence.d.ts +47 -0
  99. package/dist/store/plan.d.ts +45 -0
  100. package/dist/store/router.d.ts +18 -0
  101. package/dist/store/tooltips.d.ts +21 -0
  102. package/dist/store/workflow.d.ts +48 -0
  103. package/dist/tooltips/Tooltip.d.ts +63 -0
  104. package/dist/tooltips/TooltipManager.d.ts +42 -0
  105. package/dist/tooltips/styles.d.ts +5 -0
  106. package/dist/types/index.d.ts +4 -0
  107. package/dist/types/user-context.d.ts +29 -0
  108. package/dist/utils/dom.d.ts +46 -0
  109. package/dist/utils/markdown.d.ts +9 -0
  110. package/dist/utils/positioning.d.ts +52 -0
  111. package/dist/utils/urlParams.d.ts +27 -0
  112. package/package.json +86 -0
  113. package/src/actions/types.ts +468 -0
  114. package/src/cli/sync.ts +477 -0
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Chat Store
3
+ * Signal-based state for chat messages and interaction
4
+ */
5
+ import type { ArticleSummary, ChatMessage } from '../api/client';
6
+ import type { ChatImage } from '../api/mcp-client';
7
+ import type { TaskButtonData } from '../components/Panel/TaskButton';
8
+ import type { UserContextItem } from '../types/user-context';
9
+ export type { ChatImage } from '../api/mcp-client';
10
+ export interface ActionStatus {
11
+ status: 'pending' | 'success' | 'failed';
12
+ completedAt?: number;
13
+ errorMessage?: string;
14
+ }
15
+ export interface StoredChatMessage extends ChatMessage {
16
+ id?: string;
17
+ feedback?: 'up' | 'down' | null;
18
+ actions?: TaskButtonData[];
19
+ sources?: ArticleSummary[];
20
+ actionStatus?: Record<string, ActionStatus>;
21
+ userContext?: UserContextItem[];
22
+ images?: ChatImage[];
23
+ }
24
+ export declare const messages: import("@preact/signals-core").Signal<StoredChatMessage[]>;
25
+ export declare const conversationId: import("@preact/signals-core").Signal<string | null>;
26
+ export declare const isLoading: import("@preact/signals-core").Signal<boolean>;
27
+ export interface ProgressStatus {
28
+ kind: 'search' | 'search_complete' | 'generating' | 'thinking' | null;
29
+ message?: string;
30
+ }
31
+ export declare const progressStatus: import("@preact/signals-core").Signal<ProgressStatus>;
32
+ export declare const isExpanded: import("@preact/signals-core").Signal<boolean>;
33
+ export declare const currentSources: import("@preact/signals-core").Signal<ArticleSummary[]>;
34
+ export declare const currentActions: import("@preact/signals-core").Signal<TaskButtonData[]>;
35
+ export declare const prefillText: import("@preact/signals-core").Signal<string>;
36
+ export declare const pendingMessage: import("@preact/signals-core").Signal<string | null>;
37
+ export declare const focusInputTrigger: import("@preact/signals-core").Signal<number>;
38
+ export declare const userContext: import("@preact/signals-core").Signal<import("../types").HighlightedTextContext[]>;
39
+ export declare const pendingUserContext: import("@preact/signals-core").Signal<import("../types").HighlightedTextContext[]>;
40
+ export type ImageUploadStatus = 'uploading' | 'ready' | 'error';
41
+ export interface PendingImage {
42
+ id: string;
43
+ file: File;
44
+ preview: string;
45
+ status: ImageUploadStatus;
46
+ url?: string;
47
+ error?: string;
48
+ }
49
+ export declare const pendingImages: import("@preact/signals-core").Signal<PendingImage[]>;
50
+ export declare const isUploadingImages: import("@preact/signals-core").ReadonlySignal<boolean>;
51
+ export declare const getReadyImages: () => ChatImage[];
52
+ export declare const addPendingImage: (image: PendingImage) => void;
53
+ export declare const updateImageStatus: (id: string, status: ImageUploadStatus, url?: string, error?: string) => void;
54
+ export declare const removePendingImage: (id: string) => void;
55
+ export declare const clearPendingImages: () => void;
56
+ export declare const hasMessages: import("@preact/signals-core").ReadonlySignal<boolean>;
57
+ export declare const addUserMessage: (content: string, userContext?: UserContextItem[], images?: ChatImage[]) => void;
58
+ export declare const addAssistantMessage: (content: string, messageId?: string) => void;
59
+ export declare const updateLastAssistantMessage: (content: string, messageId?: string, actions?: TaskButtonData[], sources?: ArticleSummary[]) => void;
60
+ export declare const setActionPending: (messageIndex: number, actionName: string) => void;
61
+ export declare const setActionComplete: (actionName: string, success: boolean, errorMessage?: string) => void;
62
+ export declare const updateMessageContent: (messageIndex: number, content: string) => void;
63
+ export declare const updateActionMessageContent: (actionName: string, content: string) => void;
64
+ export declare const setConversationId: (id: string) => void;
65
+ export declare const clearConversationId: () => void;
66
+ export declare const setMessageFeedback: (messageId: string, feedback: "up" | "down") => void;
67
+ export declare const setSources: (sources: ArticleSummary[]) => void;
68
+ export declare const setActions: (actions: TaskButtonData[]) => void;
69
+ export declare const clearActions: () => void;
70
+ export declare const setLoading: (loading: boolean) => void;
71
+ export declare const setProgressStatus: (status: ProgressStatus) => void;
72
+ export declare const clearProgressStatus: () => void;
73
+ export declare const expandChat: () => void;
74
+ export declare const collapseChat: () => void;
75
+ export declare const setPrefillText: (text: string) => void;
76
+ export declare const clearPrefillText: () => void;
77
+ export declare const setPendingMessage: (message: string) => void;
78
+ export declare const clearPendingMessage: () => void;
79
+ export declare const triggerInputFocus: () => void;
80
+ export declare const addUserContext: (item: Omit<UserContextItem, "id">) => void;
81
+ export declare const removeUserContext: (id: string) => void;
82
+ export declare const clearUserContext: () => void;
83
+ export declare const setPendingUserContext: (items: UserContextItem[]) => void;
84
+ export declare const clearPendingUserContext: () => void;
85
+ export declare const resetChat: () => void;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Context Store
3
+ * Signal-based state for product context and user profile
4
+ *
5
+ * Phase 3: Product Integration - Context-aware assistance
6
+ */
7
+ import type { ProductContext, UserProfile } from '../core/context';
8
+ export declare const productContext: import("@preact/signals-core").Signal<ProductContext>;
9
+ export declare const userProfile: import("@preact/signals-core").Signal<UserProfile>;
10
+ export declare const hasContext: import("@preact/signals-core").ReadonlySignal<boolean>;
11
+ export declare const hasError: import("@preact/signals-core").ReadonlySignal<boolean>;
12
+ /**
13
+ * Set the complete product context.
14
+ */
15
+ export declare const setProductContext: (context: ProductContext) => void;
16
+ /**
17
+ * Update specific product context fields.
18
+ */
19
+ export declare const updateContext: (updates: Partial<ProductContext>) => void;
20
+ /**
21
+ * Set user profile.
22
+ */
23
+ export declare const setUserProfile: (profile: UserProfile) => void;
24
+ /**
25
+ * Report a user action.
26
+ */
27
+ export declare const reportAction: (action: string) => void;
28
+ /**
29
+ * Set error state.
30
+ */
31
+ export declare const setErrorState: (code: string, message: string) => void;
32
+ /**
33
+ * Clear error state.
34
+ */
35
+ export declare const clearErrorState: () => void;
36
+ /**
37
+ * Get the full assistant context for API calls.
38
+ */
39
+ export declare const getAssistantContext: () => {
40
+ product: ProductContext;
41
+ user_profile: UserProfile;
42
+ };
43
+ /**
44
+ * Reset all context state.
45
+ */
46
+ export declare const resetContext: () => void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Developer Store
3
+ * Signal-based state for developer mode features
4
+ */
5
+ export declare const selectedAction: import("@preact/signals-core").Signal<string | null>;
6
+ export declare const actionData: import("@preact/signals-core").Signal<string>;
7
+ export declare const executionResult: import("@preact/signals-core").Signal<{
8
+ type: "success" | "error";
9
+ message: string;
10
+ } | null>;
11
+ export declare const isExecuting: import("@preact/signals-core").Signal<boolean>;
12
+ export declare const setSelectedAction: (actionName: string | null) => void;
13
+ export declare const setActionData: (data: string) => void;
14
+ export declare const setExecutionResult: (result: {
15
+ type: "success" | "error";
16
+ message: string;
17
+ } | null) => void;
18
+ export declare const setIsExecuting: (executing: boolean) => void;
19
+ export declare const resetDeveloperStore: () => void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Store Index
3
+ * Re-exports all signal stores
4
+ */
5
+ export * as panelStore from './panel';
6
+ export * as routerStore from './router';
7
+ export * as chatStore from './chat';
8
+ export * as tooltipsStore from './tooltips';
9
+ export * as contextStore from './context';
10
+ export * as workflowStore from './workflow';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Panel Store
3
+ * Signal-based state for panel open/close and configuration
4
+ */
5
+ import type { PanelPosition, PanelMode } from '../core/config';
6
+ export declare const isOpen: import("@preact/signals-core").Signal<boolean>;
7
+ export declare const activeTab: import("@preact/signals-core").Signal<string>;
8
+ export declare const position: import("@preact/signals-core").Signal<PanelPosition>;
9
+ export declare const mode: import("@preact/signals-core").Signal<PanelMode>;
10
+ export declare const width: import("@preact/signals-core").Signal<number>;
11
+ export declare const hoverBreakpoint: import("@preact/signals-core").Signal<number | false>;
12
+ export declare const hoverBackdrop: import("@preact/signals-core").Signal<boolean>;
13
+ export declare const viewportWidth: import("@preact/signals-core").Signal<number>;
14
+ /**
15
+ * Whether the panel is currently in hover mode based on viewport width
16
+ * Returns true when viewport is below hoverBreakpoint (and breakpoint is not disabled)
17
+ */
18
+ export declare const isHoverMode: import("@preact/signals-core").ReadonlySignal<boolean>;
19
+ /**
20
+ * The effective panel mode based on responsive breakpoint
21
+ * Returns 'overlay' when in hover mode (below breakpoint), otherwise returns configured mode
22
+ */
23
+ export declare const effectiveMode: import("@preact/signals-core").ReadonlySignal<PanelMode>;
24
+ export declare const panelClass: import("@preact/signals-core").ReadonlySignal<string>;
25
+ export declare const openPanel: () => void;
26
+ export declare const closePanel: () => void;
27
+ export declare const togglePanel: () => void;
28
+ export declare const setPosition: (pos: PanelPosition) => void;
29
+ export declare const setMode: (m: PanelMode) => void;
30
+ export declare const setWidth: (w: number) => void;
31
+ export declare const setHoverBreakpoint: (bp: number | false) => void;
32
+ export declare const setHoverBackdrop: (show: boolean) => void;
33
+ export declare const setActiveTab: (tabId: string) => void;
34
+ /**
35
+ * Initialize the viewport resize listener for responsive behavior
36
+ * Should be called once during SDK initialization
37
+ */
38
+ export declare const initViewportListener: () => void;
39
+ /**
40
+ * Clean up the viewport resize listener
41
+ */
42
+ export declare const destroyViewportListener: () => void;
43
+ export declare const resetPanel: () => void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Plan Persistence Module
3
+ *
4
+ * Handles localStorage persistence for active execution plans.
5
+ * Enables plan recovery when the page is refreshed or the user
6
+ * navigates away and returns.
7
+ */
8
+ import type { ExecutionPlan } from '../core/plan';
9
+ /**
10
+ * Save the active plan to localStorage.
11
+ *
12
+ * @param plan - The plan to persist
13
+ * @param siteId - The site ID for scoping
14
+ */
15
+ export declare function savePlan(plan: ExecutionPlan, siteId: string): void;
16
+ /**
17
+ * Load a saved plan from localStorage.
18
+ *
19
+ * @param siteId - The site ID for scoping
20
+ * @returns The saved plan or null if not found/invalid
21
+ */
22
+ export declare function loadSavedPlan(siteId: string): ExecutionPlan | null;
23
+ /**
24
+ * Clear any saved plan from localStorage.
25
+ *
26
+ * @param siteId - The site ID for scoping
27
+ */
28
+ export declare function clearSavedPlan(siteId: string): void;
29
+ /**
30
+ * Check if there's a saved plan without loading it.
31
+ *
32
+ * @param siteId - The site ID for scoping
33
+ * @returns true if a plan exists
34
+ */
35
+ export declare function hasSavedPlan(siteId: string): boolean;
36
+ /**
37
+ * Get metadata about the saved plan without full deserialization.
38
+ *
39
+ * @param siteId - The site ID for scoping
40
+ * @returns Plan metadata or null
41
+ */
42
+ export declare function getSavedPlanMetadata(siteId: string): {
43
+ planId: string;
44
+ goal: string;
45
+ storedAt: string;
46
+ status: string;
47
+ } | null;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Plan Store
3
+ * Signal-based state management for multi-step execution plans.
4
+ */
5
+ import type { ExecutionPlan, ExecutionStep } from '../core/plan';
6
+ /** Active execution plan (only one at a time) */
7
+ export declare const activePlan: import("@preact/signals-core").Signal<ExecutionPlan | null>;
8
+ /** Completed/cancelled plans for the session (for analytics/history) */
9
+ export declare const planHistory: import("@preact/signals-core").Signal<ExecutionPlan[]>;
10
+ /** Whether there's an active plan */
11
+ export declare const hasActivePlan: import("@preact/signals-core").ReadonlySignal<boolean>;
12
+ /** Current step of the active plan (first ready or executing step) */
13
+ export declare const currentPlanStep: import("@preact/signals-core").ReadonlySignal<ExecutionStep | null>;
14
+ /** Number of completed or skipped steps */
15
+ export declare const completedPlanStepsCount: import("@preact/signals-core").ReadonlySignal<number>;
16
+ /** Progress as a fraction (0-1) */
17
+ export declare const planProgress: import("@preact/signals-core").ReadonlySignal<number>;
18
+ /** Whether the plan is awaiting user to start it */
19
+ export declare const isPlanAwaitingStart: import("@preact/signals-core").ReadonlySignal<boolean>;
20
+ /**
21
+ * Set a new active plan.
22
+ * Replaces any existing active plan.
23
+ */
24
+ export declare function setPlan(plan: ExecutionPlan): void;
25
+ /**
26
+ * Update the active plan with new data from server.
27
+ */
28
+ export declare function updatePlan(plan: ExecutionPlan): void;
29
+ /**
30
+ * Update a specific step in the active plan.
31
+ */
32
+ export declare function updatePlanStep(stepId: string, updates: Partial<ExecutionStep>): void;
33
+ /**
34
+ * Clear the active plan.
35
+ * Optionally moves it to history.
36
+ */
37
+ export declare function clearPlan(addToHistory?: boolean): void;
38
+ /**
39
+ * Get a step by ID from the active plan.
40
+ */
41
+ export declare function getPlanStep(stepId: string): ExecutionStep | undefined;
42
+ /**
43
+ * Reset all plan state.
44
+ */
45
+ export declare function resetPlanStore(): void;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Router Store
3
+ * Signal-based state for panel navigation
4
+ */
5
+ export type ViewType = 'home' | 'chat';
6
+ export interface ViewState {
7
+ type: ViewType;
8
+ params?: Record<string, string>;
9
+ }
10
+ export declare const viewStack: import("@preact/signals-core").Signal<ViewState[]>;
11
+ export declare const currentView: import("@preact/signals-core").Signal<ViewState>;
12
+ export declare const canGoBack: import("@preact/signals-core").ReadonlySignal<boolean>;
13
+ export declare const isAtHome: import("@preact/signals-core").ReadonlySignal<boolean>;
14
+ export declare const navigate: (view: ViewType, params?: Record<string, string>) => void;
15
+ export declare const goBack: () => void;
16
+ export declare const goHome: () => void;
17
+ export declare const resetRouter: () => void;
18
+ export declare const navigateToChat: () => void;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Tooltips Store
3
+ * Signal-based state for tooltip visibility and data
4
+ */
5
+ import type { TooltipData } from '../api/client';
6
+ export interface TooltipInstance {
7
+ id: string;
8
+ data: TooltipData;
9
+ anchor: HTMLElement;
10
+ isVisible: boolean;
11
+ }
12
+ export declare const tooltips: import("@preact/signals-core").Signal<Map<string, TooltipInstance>>;
13
+ export declare const visibleTooltipId: import("@preact/signals-core").Signal<string | null>;
14
+ export declare const visibleTooltip: import("@preact/signals-core").ReadonlySignal<TooltipInstance | null>;
15
+ export declare const tooltipCount: import("@preact/signals-core").ReadonlySignal<number>;
16
+ export declare const registerTooltip: (id: string, data: TooltipData, anchor: HTMLElement) => void;
17
+ export declare const unregisterTooltip: (id: string) => void;
18
+ export declare const showTooltip: (id: string) => void;
19
+ export declare const hideTooltip: (id: string) => void;
20
+ export declare const hideAllTooltips: () => void;
21
+ export declare const resetTooltips: () => void;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Workflow Store
3
+ * Signal-based state management for multi-step workflows
4
+ */
5
+ import type { Workflow, WorkflowStep, WorkflowStepStatus } from '../core/workflow';
6
+ /** Active workflow (only one at a time) */
7
+ export declare const activeWorkflow: import("@preact/signals-core").Signal<Workflow | null>;
8
+ /** Completed/cancelled workflows for the session (for analytics/history) */
9
+ export declare const workflowHistory: import("@preact/signals-core").Signal<Workflow[]>;
10
+ /** Whether there's an active workflow */
11
+ export declare const hasActiveWorkflow: import("@preact/signals-core").ReadonlySignal<boolean>;
12
+ /** Current step of the active workflow */
13
+ export declare const currentStep: import("@preact/signals-core").ReadonlySignal<WorkflowStep | null>;
14
+ /** Number of completed steps */
15
+ export declare const completedStepsCount: import("@preact/signals-core").ReadonlySignal<number>;
16
+ /** Progress as a fraction (0-1) */
17
+ export declare const workflowProgress: import("@preact/signals-core").ReadonlySignal<number>;
18
+ /**
19
+ * Start a new workflow.
20
+ * Sets the first step to either 'active' or 'awaiting_initiation' based on auto_run.
21
+ */
22
+ export declare function startWorkflow(workflow: Workflow): void;
23
+ /**
24
+ * Update a step's status.
25
+ */
26
+ export declare function updateStepStatus(stepIndex: number, status: WorkflowStepStatus): void;
27
+ /**
28
+ * Advance to the next step in the workflow.
29
+ * Returns the next step, or null if workflow is complete.
30
+ */
31
+ export declare function advanceToNextStep(): WorkflowStep | null;
32
+ /**
33
+ * Complete the current workflow.
34
+ * Moves it to history and clears active workflow.
35
+ */
36
+ export declare function completeWorkflow(): Workflow | null;
37
+ /**
38
+ * Cancel the active workflow.
39
+ */
40
+ export declare function cancelWorkflow(): Workflow | null;
41
+ /**
42
+ * Get the current active step.
43
+ */
44
+ export declare function getCurrentStep(): WorkflowStep | null;
45
+ /**
46
+ * Reset all workflow state.
47
+ */
48
+ export declare function resetWorkflow(): void;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Individual Tooltip Component
3
+ * Handles rendering and positioning of a single tooltip
4
+ */
5
+ import type { TooltipData } from '../api/client';
6
+ import type { TooltipTrigger, TooltipPosition } from '../core/config';
7
+ export interface TooltipOptions {
8
+ trigger: TooltipTrigger;
9
+ position: TooltipPosition;
10
+ onLearnMore?: (articleSlug: string) => void;
11
+ onShow?: () => void;
12
+ onHide?: () => void;
13
+ }
14
+ export declare class Tooltip {
15
+ private id;
16
+ private data;
17
+ private anchor;
18
+ private options;
19
+ private element;
20
+ private arrow;
21
+ private iconElement;
22
+ private isVisible;
23
+ private hideTimeout;
24
+ constructor(data: TooltipData, anchor: HTMLElement, options: TooltipOptions);
25
+ /**
26
+ * Initialize the tooltip
27
+ */
28
+ init(): void;
29
+ /**
30
+ * Show the tooltip
31
+ */
32
+ show(): void;
33
+ /**
34
+ * Hide the tooltip
35
+ */
36
+ hide(): void;
37
+ /**
38
+ * Toggle tooltip visibility
39
+ */
40
+ toggle(): void;
41
+ /**
42
+ * Update tooltip position
43
+ */
44
+ updatePosition(): void;
45
+ /**
46
+ * Destroy the tooltip
47
+ */
48
+ destroy(): void;
49
+ private createElement;
50
+ private createIcon;
51
+ private bindEvents;
52
+ private unbindEvents;
53
+ private handleMouseEnter;
54
+ private handleTooltipMouseEnter;
55
+ private handleMouseLeave;
56
+ private handleClick;
57
+ private handleDocumentClick;
58
+ private handleFocus;
59
+ private handleBlur;
60
+ private handleKeyDown;
61
+ private handleScroll;
62
+ private handleResize;
63
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Tooltip Manager
3
+ * Scans DOM for tooltip elements and manages their lifecycle
4
+ */
5
+ import type { EventEmitter } from '../core/events';
6
+ import type { ResolvedConfig } from '../core/config';
7
+ import type { APIClient } from '../api/client';
8
+ export declare class TooltipManager {
9
+ private config;
10
+ private api;
11
+ private events;
12
+ private tooltips;
13
+ private tooltipData;
14
+ private observer;
15
+ private stylesInjected;
16
+ constructor(config: ResolvedConfig, api: APIClient, events: EventEmitter);
17
+ /**
18
+ * Initialize the tooltip manager
19
+ */
20
+ init(): Promise<void>;
21
+ /**
22
+ * Scan DOM for tooltip elements and initialize them
23
+ */
24
+ scan(): Promise<void>;
25
+ /**
26
+ * Show a specific tooltip
27
+ */
28
+ show(tooltipId: string): void;
29
+ /**
30
+ * Hide a specific tooltip
31
+ */
32
+ hide(tooltipId: string): void;
33
+ /**
34
+ * Destroy the tooltip manager
35
+ */
36
+ destroy(): void;
37
+ private createTooltip;
38
+ private setupObserver;
39
+ private handleRemovedElement;
40
+ private getElementKey;
41
+ private getTooltipDataForElement;
42
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tooltip CSS Styles
3
+ * Injected into the document head
4
+ */
5
+ export declare const TOOLTIP_STYLES = "\n/* Pillar Tooltip Styles */\n.pillar-tooltip {\n position: absolute;\n z-index: 99999;\n max-width: 320px;\n padding: 12px 16px;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n font-size: 14px;\n line-height: 1.5;\n color: #1a1a1a;\n background: #ffffff;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);\n pointer-events: auto;\n opacity: 0;\n transform: scale(0.95);\n transition: opacity 0.15s ease, transform 0.15s ease;\n}\n\n.pillar-tooltip.pillar-tooltip--visible {\n opacity: 1;\n transform: scale(1);\n}\n\n.pillar-tooltip__content {\n margin: 0;\n}\n\n.pillar-tooltip__content p {\n margin: 0 0 8px;\n}\n\n.pillar-tooltip__content p:last-child {\n margin-bottom: 0;\n}\n\n.pillar-tooltip__content a {\n color: #2563eb;\n text-decoration: none;\n}\n\n.pillar-tooltip__content a:hover {\n text-decoration: underline;\n}\n\n.pillar-tooltip__learn-more {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n margin-top: 12px;\n padding: 6px 12px;\n font-size: 13px;\n font-weight: 500;\n color: #2563eb;\n background: #eff6ff;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease;\n}\n\n.pillar-tooltip__learn-more:hover {\n background: #dbeafe;\n}\n\n.pillar-tooltip__learn-more svg {\n width: 14px;\n height: 14px;\n}\n\n/* Arrow */\n.pillar-tooltip__arrow {\n position: absolute;\n width: 12px;\n height: 12px;\n background: #ffffff;\n transform: rotate(45deg);\n box-shadow: -1px -1px 0 0 rgba(0, 0, 0, 0.05);\n}\n\n.pillar-tooltip--top .pillar-tooltip__arrow {\n bottom: -6px;\n box-shadow: 1px 1px 0 0 rgba(0, 0, 0, 0.05);\n}\n\n.pillar-tooltip--bottom .pillar-tooltip__arrow {\n top: -6px;\n}\n\n.pillar-tooltip--left .pillar-tooltip__arrow {\n right: -6px;\n box-shadow: 1px -1px 0 0 rgba(0, 0, 0, 0.05);\n}\n\n.pillar-tooltip--right .pillar-tooltip__arrow {\n left: -6px;\n box-shadow: -1px 1px 0 0 rgba(0, 0, 0, 0.05);\n}\n\n/* Tooltip Icon (for icon trigger) */\n.pillar-tooltip-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n margin-left: 4px;\n vertical-align: middle;\n color: #6b7280;\n cursor: help;\n transition: color 0.15s ease;\n}\n\n.pillar-tooltip-icon:hover {\n color: #2563eb;\n}\n\n.pillar-tooltip-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Close button */\n.pillar-tooltip__close {\n position: absolute;\n top: 8px;\n right: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n color: #9ca3af;\n background: none;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n transition: color 0.15s ease, background 0.15s ease;\n}\n\n.pillar-tooltip__close:hover {\n color: #1a1a1a;\n background: #f3f4f6;\n}\n\n.pillar-tooltip__close svg {\n width: 12px;\n height: 12px;\n}\n";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Type exports for Pillar SDK
3
+ */
4
+ export * from './user-context';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * User Context Types
3
+ * Discriminated union for different types of context items
4
+ * that can be attached to chat messages.
5
+ */
6
+ /** Base interface for all user context items */
7
+ interface BaseUserContext {
8
+ /** Unique identifier for this context item (for removal) */
9
+ id: string;
10
+ /** Discriminator field */
11
+ type: string;
12
+ }
13
+ /** Highlighted text context from text selection feature */
14
+ export interface HighlightedTextContext extends BaseUserContext {
15
+ type: 'highlighted_text';
16
+ /** The URL where the text was selected */
17
+ url_origin: string;
18
+ /** The selected text content */
19
+ text_content: string;
20
+ }
21
+ /** Union of all possible user context item types */
22
+ export type UserContextItem = HighlightedTextContext;
23
+ /** Generate a unique ID for a context item */
24
+ export declare function generateContextId(): string;
25
+ /** Type guard for highlighted text context */
26
+ export declare function isHighlightedTextContext(item: UserContextItem): item is HighlightedTextContext;
27
+ /** Get display label for a context item */
28
+ export declare function getContextDisplayLabel(item: UserContextItem): string;
29
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * DOM Utilities for Pillar SDK
3
+ */
4
+ /**
5
+ * Creates an HTML element with the given tag name and attributes
6
+ */
7
+ export declare function createElement<K extends keyof HTMLElementTagNameMap>(tag: K, attributes?: Record<string, string>, children?: (Node | string)[]): HTMLElementTagNameMap[K];
8
+ /**
9
+ * Safely inserts CSS into a Shadow DOM or document
10
+ */
11
+ export declare function injectStyles(container: ShadowRoot | Document, css: string, id?: string): HTMLStyleElement;
12
+ /**
13
+ * Gets the scrollable parent of an element
14
+ */
15
+ export declare function getScrollParent(element: Element): Element | null;
16
+ /**
17
+ * Gets the viewport dimensions
18
+ */
19
+ export declare function getViewportDimensions(): {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ /**
24
+ * Checks if an element is visible in the viewport
25
+ */
26
+ export declare function isElementInViewport(element: Element): boolean;
27
+ /**
28
+ * Waits for the DOM to be ready
29
+ */
30
+ export declare function domReady(): Promise<void>;
31
+ /**
32
+ * Escapes HTML special characters
33
+ */
34
+ export declare function escapeHtml(text: string): string;
35
+ /**
36
+ * Debounces a function
37
+ */
38
+ export declare function debounce<T extends unknown[]>(fn: (...args: T) => void, delay: number): (...args: T) => void;
39
+ /**
40
+ * Throttles a function
41
+ */
42
+ export declare function throttle<T extends unknown[]>(fn: (...args: T) => void, limit: number): (...args: T) => void;
43
+ /**
44
+ * Generates a unique ID
45
+ */
46
+ export declare function uniqueId(prefix?: string): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Markdown Renderer
3
+ * Uses marked library for parsing markdown to HTML
4
+ */
5
+ /**
6
+ * Render markdown content to HTML
7
+ * Used for AI chat responses
8
+ */
9
+ export declare function renderMarkdown(content: string): string;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Positioning utilities for tooltips and floating elements
3
+ */
4
+ export type Position = 'top' | 'bottom' | 'left' | 'right' | 'auto';
5
+ export type Alignment = 'start' | 'center' | 'end';
6
+ export interface Rect {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ export interface PositionResult {
13
+ x: number;
14
+ y: number;
15
+ position: Position;
16
+ arrowX?: number;
17
+ arrowY?: number;
18
+ }
19
+ interface PositionOptions {
20
+ position: Position;
21
+ alignment?: Alignment;
22
+ offset?: number;
23
+ padding?: number;
24
+ arrowSize?: number;
25
+ }
26
+ /**
27
+ * Gets the bounding rect of an element
28
+ */
29
+ export declare function getElementRect(element: Element): Rect;
30
+ /**
31
+ * Gets the viewport rect
32
+ */
33
+ export declare function getViewportRect(): Rect;
34
+ /**
35
+ * Calculates available space in each direction from an element
36
+ */
37
+ export declare function getAvailableSpace(anchor: Rect, viewport: Rect, padding?: number): Record<Position, number>;
38
+ /**
39
+ * Determines the best position for a floating element
40
+ */
41
+ export declare function getBestPosition(anchor: Rect, floating: {
42
+ width: number;
43
+ height: number;
44
+ }, options: PositionOptions): Position;
45
+ /**
46
+ * Calculates the position of a floating element relative to an anchor
47
+ */
48
+ export declare function calculatePosition(anchor: Rect, floating: {
49
+ width: number;
50
+ height: number;
51
+ }, options: PositionOptions): PositionResult;
52
+ export {};