@pillar-ai/sdk 0.1.13 → 0.1.14

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 (53) hide show
  1. package/README.md +46 -44
  2. package/dist/actions/types.d.ts +9 -3
  3. package/dist/api/client.d.ts +91 -16
  4. package/dist/api/mcp-client.d.ts +105 -91
  5. package/dist/cli/sync.js +70 -13
  6. package/dist/components/DebugPanel/DebugPanel.d.ts +25 -0
  7. package/dist/components/DebugPanel/index.d.ts +2 -0
  8. package/dist/components/DevTools/index.d.ts +5 -0
  9. package/dist/components/DevTools/styles.d.ts +5 -0
  10. package/dist/components/Panel/Header.d.ts +1 -1
  11. package/dist/components/Panel/HistoryDropdown.d.ts +10 -0
  12. package/dist/components/Panel/TaskButton.d.ts +4 -14
  13. package/dist/components/Panel/styles.d.ts +1 -1
  14. package/dist/components/Plan/InlinePlanView.d.ts +1 -1
  15. package/dist/components/Plan/PlanDocument.d.ts +18 -0
  16. package/dist/components/Plan/PlanStepItem.d.ts +1 -1
  17. package/dist/components/Plan/PlanView.d.ts +1 -1
  18. package/dist/components/Plan/index.d.ts +1 -0
  19. package/dist/components/Progress/ProgressRow.d.ts +6 -2
  20. package/dist/components/Progress/ProgressStack.d.ts +15 -0
  21. package/dist/components/Progress/ReasoningDisclosure.d.ts +20 -0
  22. package/dist/components/Progress/index.d.ts +2 -0
  23. package/dist/components/Views/HomeView.d.ts +3 -0
  24. package/dist/components/Views/ResumePrompt.d.ts +22 -0
  25. package/dist/components/Views/index.d.ts +1 -0
  26. package/dist/components/shared/icons.d.ts +24 -0
  27. package/dist/components/shared/index.d.ts +1 -0
  28. package/dist/core/Pillar.d.ts +304 -70
  29. package/dist/core/config.d.ts +134 -4
  30. package/dist/core/events.d.ts +55 -70
  31. package/dist/core/plan-executor.d.ts +29 -0
  32. package/dist/core/plan.d.ts +6 -0
  33. package/dist/hooks/index.d.ts +5 -0
  34. package/dist/hooks/useDebouncedValue.d.ts +22 -0
  35. package/dist/hooks/useInlineCard.d.ts +35 -0
  36. package/dist/hooks/usePillarInstance.d.ts +30 -0
  37. package/dist/index.d.ts +11 -9
  38. package/dist/pillar.esm.js +1 -1
  39. package/dist/store/chat.d.ts +94 -17
  40. package/dist/store/index.d.ts +1 -0
  41. package/dist/store/session-persistence.d.ts +62 -0
  42. package/dist/store/suggestions.d.ts +58 -0
  43. package/dist/types/dom-scanner.d.ts +46 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/user-context.d.ts +32 -1
  46. package/dist/utils/debug.d.ts +150 -0
  47. package/dist/utils/dom-scanner.d.ts +44 -0
  48. package/dist/utils/markdown-components.d.ts +53 -0
  49. package/dist/utils/preact-markdown.d.ts +17 -0
  50. package/dist/utils/route-observer.d.ts +67 -0
  51. package/package.json +1 -1
  52. package/src/actions/types.ts +10 -2
  53. package/dist/utils/markdown.d.ts +0 -9
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Route Observer
3
+ * Detects SPA navigation and notifies when the route changes.
4
+ *
5
+ * Supports:
6
+ * - pushState/replaceState (React Router, Vue Router, etc.)
7
+ * - popstate (browser back/forward)
8
+ * - hashchange (hash-based routing)
9
+ */
10
+ export interface RouteInfo {
11
+ pathname: string;
12
+ search: string;
13
+ hash: string;
14
+ url: string;
15
+ title: string;
16
+ }
17
+ export type RouteChangeCallback = (route: RouteInfo) => void;
18
+ export interface RouteObserverOptions {
19
+ /** Debounce rapid route changes (ms). Default: 100 */
20
+ debounceMs?: number;
21
+ }
22
+ export declare class RouteObserver {
23
+ private _callback;
24
+ private _debounceMs;
25
+ private _debounceTimer;
26
+ private _lastRoute;
27
+ private _running;
28
+ private _originalPushState;
29
+ private _originalReplaceState;
30
+ constructor(options?: RouteObserverOptions);
31
+ /**
32
+ * Whether the observer is currently running.
33
+ */
34
+ get running(): boolean;
35
+ /**
36
+ * Register a callback for route changes.
37
+ */
38
+ onRouteChange(callback: RouteChangeCallback): void;
39
+ /**
40
+ * Start observing route changes.
41
+ */
42
+ start(): void;
43
+ /**
44
+ * Stop observing route changes.
45
+ */
46
+ stop(): void;
47
+ /**
48
+ * Get the current route info.
49
+ */
50
+ getCurrentRoute(): RouteInfo;
51
+ /**
52
+ * Patch history.pushState and history.replaceState to detect navigation.
53
+ */
54
+ private _patchHistory;
55
+ /**
56
+ * Restore original history methods.
57
+ */
58
+ private _restoreHistory;
59
+ /**
60
+ * Handle route change (with debouncing).
61
+ */
62
+ private _handleRouteChange;
63
+ /**
64
+ * Get current URL for comparison.
65
+ */
66
+ private _getCurrentUrl;
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pillar-ai/sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Pillar Embedded Help SDK - Add contextual help and AI chat to your application",
5
5
  "type": "module",
6
6
  "main": "./dist/pillar.esm.js",
@@ -32,6 +32,7 @@
32
32
  * - open_modal: Open a modal or dialog
33
33
  * - fill_form: Fill form fields with data
34
34
  * - trigger_action: Trigger a custom action
35
+ * - query: Fetch data from the client and return to the agent (implies returns: true)
35
36
  * - copy_text: Copy text to clipboard
36
37
  * - external_link: Open an external URL
37
38
  * - start_tutorial: Start a tutorial/walkthrough
@@ -42,6 +43,7 @@ export type ActionType =
42
43
  | 'open_modal'
43
44
  | 'fill_form'
44
45
  | 'trigger_action'
46
+ | 'query'
45
47
  | 'copy_text'
46
48
  | 'external_link'
47
49
  | 'start_tutorial'
@@ -194,7 +196,7 @@ export interface ActionDefinition<TData = Record<string, unknown>> {
194
196
  *
195
197
  * Action names should be snake_case identifiers.
196
198
  */
197
- export type ActionDefinitions = Record<string, ActionDefinition<any>>;
199
+ export type ActionDefinitions = Record<string, ActionDefinition<unknown>>;
198
200
 
199
201
  /**
200
202
  * Metadata for a single action in the manifest (no handler).
@@ -319,7 +321,7 @@ export interface SyncActionDefinition<TData = Record<string, unknown>> {
319
321
  *
320
322
  * Use this type for your actions file that gets synced via CI/CD.
321
323
  */
322
- export type SyncActionDefinitions = Record<string, SyncActionDefinition<any>>;
324
+ export type SyncActionDefinitions = Record<string, SyncActionDefinition<unknown>>;
323
325
 
324
326
  // ============================================================================
325
327
  // Type Utilities for Type-Safe onTask
@@ -360,6 +362,11 @@ export interface CopyTextData {
360
362
  text?: string;
361
363
  }
362
364
 
365
+ export interface QueryActionData {
366
+ /** Query parameters passed to the handler */
367
+ [key: string]: unknown;
368
+ }
369
+
363
370
  /**
364
371
  * Maps action types to their default data shapes.
365
372
  * Used for automatic type inference in onTask handlers.
@@ -367,6 +374,7 @@ export interface CopyTextData {
367
374
  export interface ActionTypeDataMap {
368
375
  navigate: NavigateActionData;
369
376
  trigger_action: TriggerActionData;
377
+ query: QueryActionData;
370
378
  inline_ui: InlineUIData;
371
379
  external_link: ExternalLinkData;
372
380
  copy_text: CopyTextData;
@@ -1,9 +0,0 @@
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;