@pillar-ai/sdk 0.1.8 → 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 (58) hide show
  1. package/README.md +118 -60
  2. package/dist/actions/index.d.ts +1 -1
  3. package/dist/actions/registry.d.ts +15 -27
  4. package/dist/actions/types.d.ts +20 -8
  5. package/dist/api/client.d.ts +91 -5
  6. package/dist/api/mcp-client.d.ts +105 -79
  7. package/dist/cli/sync.d.ts +0 -1
  8. package/dist/cli/sync.js +102 -14
  9. package/dist/components/DebugPanel/DebugPanel.d.ts +25 -0
  10. package/dist/components/DebugPanel/index.d.ts +2 -0
  11. package/dist/components/DevTools/index.d.ts +5 -0
  12. package/dist/components/DevTools/styles.d.ts +5 -0
  13. package/dist/components/Panel/Header.d.ts +1 -1
  14. package/dist/components/Panel/HistoryDropdown.d.ts +10 -0
  15. package/dist/components/Panel/Panel.d.ts +1 -0
  16. package/dist/components/Panel/TaskButton.d.ts +4 -14
  17. package/dist/components/Panel/styles.d.ts +1 -1
  18. package/dist/components/Plan/InlinePlanView.d.ts +1 -1
  19. package/dist/components/Plan/PlanDocument.d.ts +18 -0
  20. package/dist/components/Plan/PlanStepItem.d.ts +1 -1
  21. package/dist/components/Plan/PlanView.d.ts +1 -1
  22. package/dist/components/Plan/index.d.ts +1 -0
  23. package/dist/components/Progress/ProgressRow.d.ts +16 -0
  24. package/dist/components/Progress/ProgressStack.d.ts +15 -0
  25. package/dist/components/Progress/ReasoningDisclosure.d.ts +20 -0
  26. package/dist/components/Progress/index.d.ts +3 -0
  27. package/dist/components/Views/HomeView.d.ts +3 -0
  28. package/dist/components/Views/ResumePrompt.d.ts +22 -0
  29. package/dist/components/Views/index.d.ts +1 -0
  30. package/dist/components/index.d.ts +1 -0
  31. package/dist/components/shared/icons.d.ts +24 -0
  32. package/dist/components/shared/index.d.ts +1 -0
  33. package/dist/core/Pillar.d.ts +318 -80
  34. package/dist/core/config.d.ts +141 -3
  35. package/dist/core/events.d.ts +55 -70
  36. package/dist/core/plan-executor.d.ts +29 -0
  37. package/dist/core/plan.d.ts +6 -0
  38. package/dist/hooks/index.d.ts +5 -0
  39. package/dist/hooks/useDebouncedValue.d.ts +22 -0
  40. package/dist/hooks/useInlineCard.d.ts +35 -0
  41. package/dist/hooks/usePillarInstance.d.ts +30 -0
  42. package/dist/index.d.ts +14 -12
  43. package/dist/pillar.esm.js +1 -1
  44. package/dist/store/chat.d.ts +102 -4
  45. package/dist/store/index.d.ts +1 -0
  46. package/dist/store/session-persistence.d.ts +62 -0
  47. package/dist/store/suggestions.d.ts +58 -0
  48. package/dist/types/dom-scanner.d.ts +46 -0
  49. package/dist/types/index.d.ts +1 -0
  50. package/dist/types/user-context.d.ts +32 -1
  51. package/dist/utils/debug.d.ts +150 -0
  52. package/dist/utils/dom-scanner.d.ts +44 -0
  53. package/dist/utils/markdown-components.d.ts +53 -0
  54. package/dist/utils/preact-markdown.d.ts +17 -0
  55. package/dist/utils/route-observer.d.ts +67 -0
  56. package/package.json +1 -1
  57. package/src/actions/types.ts +21 -7
  58. 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.8",
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",
@@ -6,16 +6,22 @@
6
6
  *
7
7
  * @example
8
8
  * ```ts
9
- * import { defineActions } from '@pillar-ai/sdk/actions';
9
+ * // lib/pillar/actions/index.ts
10
+ * import type { SyncActionDefinitions } from '@pillar-ai/sdk';
10
11
  *
11
- * const actions = defineActions({
12
+ * export const actions = {
12
13
  * open_settings: {
13
14
  * description: 'Navigate to the settings page',
14
- * type: 'navigate',
15
+ * type: 'navigate' as const,
15
16
  * path: '/settings',
16
- * handler: () => router.push('/settings'),
17
+ * autoRun: true,
17
18
  * },
18
- * });
19
+ * } as const satisfies SyncActionDefinitions;
20
+ *
21
+ * export default actions;
22
+ *
23
+ * // Sync via CI/CD: npx pillar-sync --actions ./lib/pillar/actions/index.ts
24
+ * // Register handlers at runtime: pillar.onTask('open_settings', () => router.push('/settings'));
19
25
  * ```
20
26
  */
21
27
 
@@ -26,6 +32,7 @@
26
32
  * - open_modal: Open a modal or dialog
27
33
  * - fill_form: Fill form fields with data
28
34
  * - trigger_action: Trigger a custom action
35
+ * - query: Fetch data from the client and return to the agent (implies returns: true)
29
36
  * - copy_text: Copy text to clipboard
30
37
  * - external_link: Open an external URL
31
38
  * - start_tutorial: Start a tutorial/walkthrough
@@ -36,6 +43,7 @@ export type ActionType =
36
43
  | 'open_modal'
37
44
  | 'fill_form'
38
45
  | 'trigger_action'
46
+ | 'query'
39
47
  | 'copy_text'
40
48
  | 'external_link'
41
49
  | 'start_tutorial'
@@ -188,7 +196,7 @@ export interface ActionDefinition<TData = Record<string, unknown>> {
188
196
  *
189
197
  * Action names should be snake_case identifiers.
190
198
  */
191
- export type ActionDefinitions = Record<string, ActionDefinition<any>>;
199
+ export type ActionDefinitions = Record<string, ActionDefinition<unknown>>;
192
200
 
193
201
  /**
194
202
  * Metadata for a single action in the manifest (no handler).
@@ -313,7 +321,7 @@ export interface SyncActionDefinition<TData = Record<string, unknown>> {
313
321
  *
314
322
  * Use this type for your actions file that gets synced via CI/CD.
315
323
  */
316
- export type SyncActionDefinitions = Record<string, SyncActionDefinition<any>>;
324
+ export type SyncActionDefinitions = Record<string, SyncActionDefinition<unknown>>;
317
325
 
318
326
  // ============================================================================
319
327
  // Type Utilities for Type-Safe onTask
@@ -354,6 +362,11 @@ export interface CopyTextData {
354
362
  text?: string;
355
363
  }
356
364
 
365
+ export interface QueryActionData {
366
+ /** Query parameters passed to the handler */
367
+ [key: string]: unknown;
368
+ }
369
+
357
370
  /**
358
371
  * Maps action types to their default data shapes.
359
372
  * Used for automatic type inference in onTask handlers.
@@ -361,6 +374,7 @@ export interface CopyTextData {
361
374
  export interface ActionTypeDataMap {
362
375
  navigate: NavigateActionData;
363
376
  trigger_action: TriggerActionData;
377
+ query: QueryActionData;
364
378
  inline_ui: InlineUIData;
365
379
  external_link: ExternalLinkData;
366
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;