@pillar-ai/sdk 0.1.21 → 0.1.22

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/dist/actions/definitions/analytics.d.ts +18 -0
  2. package/dist/actions/definitions/content.d.ts +40 -0
  3. package/dist/actions/definitions/index.d.ts +26 -0
  4. package/dist/actions/definitions/navigation.d.ts +65 -0
  5. package/dist/actions/definitions/settings.d.ts +162 -0
  6. package/dist/actions/definitions/sources.d.ts +44 -0
  7. package/dist/actions/definitions/support.d.ts +15 -0
  8. package/dist/actions/definitions/team.d.ts +120 -0
  9. package/dist/actions/index.d.ts +1 -1
  10. package/dist/actions/types.d.ts +0 -89
  11. package/dist/api/ag-ui-adapter.d.ts +76 -0
  12. package/dist/api/ag-ui-bridge.d.ts +49 -0
  13. package/dist/api/ag-ui-client.d.ts +102 -0
  14. package/dist/api/ag-ui-handler.d.ts +89 -0
  15. package/dist/api/mcp-client.d.ts +46 -24
  16. package/dist/cli/sync.js +62 -43
  17. package/dist/components/Button/FloatingButton.d.ts +46 -0
  18. package/dist/components/PagePilot/styles.d.ts +1 -1
  19. package/dist/components/Panel/TabNavigation.d.ts +16 -0
  20. package/dist/components/Panel/styles.d.ts +1 -1
  21. package/dist/components/Progress/AGUIProgress.d.ts +15 -0
  22. package/dist/components/Tooltips/Tooltip.d.ts +46 -0
  23. package/dist/components/Tooltips/TooltipManager.d.ts +41 -0
  24. package/dist/components/Tooltips/index.d.ts +6 -0
  25. package/dist/components/Tooltips/styles.d.ts +5 -0
  26. package/dist/components/Views/ArticleChatView.d.ts +10 -0
  27. package/dist/components/Views/ArticleView.d.ts +10 -0
  28. package/dist/components/Views/CategoryView.d.ts +11 -0
  29. package/dist/components/Views/HelpCenterArticles.d.ts +17 -0
  30. package/dist/components/Views/SearchView.d.ts +10 -0
  31. package/dist/components/Views/SupportView.d.ts +15 -0
  32. package/dist/components/shared/ArticleCard.d.ts +17 -0
  33. package/dist/components/shared/CategoryCard.d.ts +17 -0
  34. package/dist/content/extensions/AccordionNode.d.ts +10 -0
  35. package/dist/content/extensions/CalloutNode.d.ts +11 -0
  36. package/dist/content/extensions/index.d.ts +5 -0
  37. package/dist/content/index.d.ts +5 -0
  38. package/dist/content/renderer.d.ts +24 -0
  39. package/dist/core/Pillar.d.ts +57 -38
  40. package/dist/core/config.d.ts +1 -1
  41. package/dist/core/events.d.ts +7 -1
  42. package/dist/index.d.ts +2 -2
  43. package/dist/pillar.esm.js +1 -1
  44. package/dist/store/chat.d.ts +2 -0
  45. package/dist/store/tooltips.d.ts +21 -0
  46. package/dist/tools/index.d.ts +27 -0
  47. package/dist/tools/registry.d.ts +106 -0
  48. package/dist/tools/types.d.ts +564 -0
  49. package/dist/utils/helpdesk.d.ts +33 -0
  50. package/dist/utils/markdown.d.ts +9 -0
  51. package/dist/utils/resilient-fetch.d.ts +25 -0
  52. package/package.json +3 -2
  53. package/src/actions/types.ts +0 -622
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Category Card Component
3
+ * Displays a category list item
4
+ */
5
+ import { h } from 'preact';
6
+ import type { CategoryData } from '../../api/client';
7
+ interface CategoryCardProps {
8
+ category: CategoryData;
9
+ onClick: () => void;
10
+ }
11
+ export declare function CategoryCard({ category, onClick }: CategoryCardProps): h.JSX.Element;
12
+ interface CategoryListProps {
13
+ categories: CategoryData[];
14
+ onCategoryClick: (category: CategoryData) => void;
15
+ }
16
+ export declare function CategoryList({ categories, onCategoryClick }: CategoryListProps): h.JSX.Element;
17
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Accordion Node Extension for TipTap (vanilla - HTML rendering only)
3
+ * Used to render collapsible accordion blocks in article content
4
+ */
5
+ import { Node } from '@tiptap/core';
6
+ /**
7
+ * TipTap Accordion Node Extension (vanilla, no React)
8
+ * Renders accordion blocks using HTML details/summary elements
9
+ */
10
+ export declare const AccordionNode: Node<any, any>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Callout Node Extension for TipTap (vanilla - HTML rendering only)
3
+ * Used to render callout blocks in article content
4
+ */
5
+ import { Node } from '@tiptap/core';
6
+ export type CalloutType = 'info' | 'warning' | 'tip' | 'error' | 'success';
7
+ /**
8
+ * TipTap Callout Node Extension (vanilla, no React)
9
+ * Renders callout blocks with type-specific styling classes
10
+ */
11
+ export declare const CalloutNode: Node<any, any>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * TipTap Extensions for SDK content rendering
3
+ */
4
+ export { CalloutNode, type CalloutType } from './CalloutNode';
5
+ export { AccordionNode } from './AccordionNode';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Content rendering utilities for the SDK
3
+ */
4
+ export { renderArticleContent, renderTipTapContent, isJSONContent, } from './renderer';
5
+ export type { CalloutType } from './extensions';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * TipTap Content Renderer
3
+ * Converts TipTap JSON content to HTML for display in the SDK panel
4
+ */
5
+ import type { JSONContent } from '@tiptap/core';
6
+ /**
7
+ * Check if content is TipTap JSON format (has a 'type' property)
8
+ */
9
+ export declare function isJSONContent(content: unknown): content is JSONContent;
10
+ /**
11
+ * Render TipTap JSON content to HTML
12
+ *
13
+ * @param content - TipTap JSON content object
14
+ * @returns HTML string
15
+ */
16
+ export declare function renderTipTapContent(content: JSONContent): string;
17
+ /**
18
+ * Render article content to HTML
19
+ * Handles both TipTap JSON and legacy HTML string content
20
+ *
21
+ * @param content - TipTap JSON content or HTML string
22
+ * @returns HTML string
23
+ */
24
+ export declare function renderArticleContent(content: JSONContent | string | null | undefined): string;
@@ -2,7 +2,7 @@
2
2
  * Main Pillar SDK Class
3
3
  * Entry point for all SDK functionality
4
4
  */
5
- import { type ActionSchema } from "../actions";
5
+ import { type ToolSchema } from "../tools";
6
6
  import { type PillarConfig, type ResolvedConfig, type ThemeConfig } from "./config";
7
7
  import { type Context, type Suggestion, type UserProfile } from "./context";
8
8
  import { type CardRenderer, type PillarEvents, type TaskExecutePayload } from "./events";
@@ -42,8 +42,10 @@ export declare class Pillar {
42
42
  private _getStoredExternalUserId;
43
43
  private _taskHandlers;
44
44
  private _anyTaskHandler;
45
- _registeredActions: Map<string, Record<string, unknown>>;
46
- private _definedActions;
45
+ _registeredTools: Map<string, Record<string, unknown>>;
46
+ /** @deprecated Use _registeredTools instead */
47
+ get _registeredActions(): Map<string, Record<string, unknown>>;
48
+ private _definedTools;
47
49
  private _cardRenderers;
48
50
  private _debugPanelContainer;
49
51
  private _routeObserver;
@@ -439,20 +441,20 @@ export declare class Pillar {
439
441
  */
440
442
  onTask(taskName: string, handler: (data: Record<string, unknown>) => void): () => void;
441
443
  /**
442
- * Define an action with co-located metadata and handler.
444
+ * Define a tool with co-located metadata and handler.
443
445
  *
444
- * This is the recommended way to register actions. The metadata
446
+ * This is the recommended way to register tools. The metadata
445
447
  * (name, description, inputSchema) is discoverable by the CLI scanner
446
448
  * (`npx pillar-sync --scan ./src`) and the handler runs client-side.
447
449
  *
448
450
  * If `execute` returns a value, it is automatically sent back to the
449
451
  * agent — no explicit `returns: true` flag needed.
450
452
  *
451
- * @param schema - Action schema with metadata and execute handler
452
- * @returns Unsubscribe function that removes the action
453
+ * @param schema - Tool schema with metadata and execute handler
454
+ * @returns Unsubscribe function that removes the tool
453
455
  *
454
456
  * @example
455
- * const unsub = pillar.defineAction({
457
+ * const unsub = pillar.defineTool({
456
458
  * name: 'add_to_cart',
457
459
  * description: 'Add a product to the shopping cart',
458
460
  * inputSchema: {
@@ -469,53 +471,61 @@ export declare class Pillar {
469
471
  * },
470
472
  * });
471
473
  *
472
- * // Later: unsub() to remove the action
474
+ * // Later: unsub() to remove the tool
473
475
  */
474
- defineAction<TInput = Record<string, unknown>>(schema: ActionSchema<TInput>): () => void;
476
+ defineTool<TInput = Record<string, unknown>>(schema: ToolSchema<TInput>): () => void;
477
+ /** @deprecated Use defineTool instead */
478
+ defineAction<TInput = Record<string, unknown>>(schema: ToolSchema<TInput>): () => void;
475
479
  /**
476
- * Register an action definition at runtime.
480
+ * Register a tool definition at runtime.
477
481
  *
478
- * @deprecated Use `defineAction()` instead, which co-locates metadata and handler.
482
+ * @deprecated Use `defineTool()` instead, which co-locates metadata and handler.
479
483
  *
480
- * This is primarily for demos and development. In production, actions
484
+ * This is primarily for demos and development. In production, tools
481
485
  * should be synced via the `pillar-sync` CLI during CI/CD.
482
486
  *
483
- * The action definition is stored locally and can be used by `onTask`
484
- * handlers. For actions with `returnsData: true`, the handler's return
487
+ * The tool definition is stored locally and can be used by `onTask`
488
+ * handlers. For tools with `returnsData: true`, the handler's return
485
489
  * value is sent back to the agent.
486
490
  *
487
- * @param action - Action definition with name and properties
491
+ * @param tool - Tool definition with name and properties
488
492
  *
489
493
  * @example
490
- * pillar.registerAction({
494
+ * pillar.registerTool({
491
495
  * name: 'list_datasets',
492
496
  * description: 'List available datasets',
493
497
  * type: 'query',
494
498
  * returnsData: true,
495
499
  * });
496
500
  */
501
+ registerTool(tool: {
502
+ name: string;
503
+ } & Record<string, unknown>): void;
504
+ /** @deprecated Use registerTool instead */
497
505
  registerAction(action: {
498
506
  name: string;
499
507
  } & Record<string, unknown>): void;
500
508
  /**
501
- * Get a registered action definition by name.
509
+ * Get a registered tool definition by name.
502
510
  *
503
- * @param name - Action name
504
- * @returns Action definition or undefined
511
+ * @param name - Tool name
512
+ * @returns Tool definition or undefined
505
513
  */
514
+ getRegisteredTool(name: string): Record<string, unknown> | undefined;
515
+ /** @deprecated Use getRegisteredTool instead */
506
516
  getRegisteredAction(name: string): Record<string, unknown> | undefined;
507
517
  /**
508
- * Get handler for an action, checking all registration systems.
518
+ * Get handler for a tool, checking all registration systems.
509
519
  *
510
520
  * Lookup order:
511
- * 1. Code-first action registry (synced via pillar-sync CLI) - handler in definition
521
+ * 1. Code-first tool registry (synced via pillar-sync CLI) - handler in definition
512
522
  * 2. Task handlers (registered via onTask at runtime)
513
523
  *
514
524
  * This is the recommended pattern:
515
- * - Action definitions synced to server via CLI (so AI knows what's possible)
525
+ * - Tool definitions synced to server via CLI (so AI knows what's possible)
516
526
  * - Handlers registered at runtime via onTask (client-side execution)
517
527
  *
518
- * @param actionName - Action name to look up
528
+ * @param toolName - Tool name to look up
519
529
  * @returns Handler function or undefined if not found
520
530
  *
521
531
  * @example
@@ -524,7 +534,7 @@ export declare class Pillar {
524
534
  * const result = await handler({ limit: 10 });
525
535
  * }
526
536
  */
527
- getHandler(actionName: string): ((data: Record<string, unknown>) => unknown) | undefined;
537
+ getHandler(toolName: string): ((data: Record<string, unknown>) => unknown) | undefined;
528
538
  /**
529
539
  * Register a catch-all handler for any task.
530
540
  * Useful for logging, analytics, or handling unknown tasks.
@@ -562,20 +572,22 @@ export declare class Pillar {
562
572
  */
563
573
  completeTask(taskName: string, success?: boolean, data?: Record<string, unknown>): void;
564
574
  /**
565
- * Signal that an action has completed.
575
+ * Signal that a tool has completed.
566
576
  *
567
- * For simple actions, this emits the completion event.
568
- * For wizard actions (modals, multi-step flows), call this when the user
577
+ * For simple tools, this emits the completion event.
578
+ * For wizard tools (modals, multi-step flows), call this when the user
569
579
  * finishes the flow.
570
580
  *
571
- * @param actionName - The action identifier
572
- * @param success - Whether the action completed successfully (default: true)
581
+ * @param toolName - The tool identifier
582
+ * @param success - Whether the tool completed successfully (default: true)
573
583
  * @param data - Optional result data
574
584
  *
575
585
  * @example
576
586
  * // In your wizard completion handler:
577
- * pillar.completeAction('add_source', true, { sourceId: source.id });
587
+ * pillar.completeTool('add_source', true, { sourceId: source.id });
578
588
  */
589
+ completeTool(toolName: string, success?: boolean, data?: Record<string, unknown>): Promise<void>;
590
+ /** @deprecated Use completeTool instead */
579
591
  completeAction(actionName: string, success?: boolean, data?: Record<string, unknown>): Promise<void>;
580
592
  /**
581
593
  * Confirm task execution result.
@@ -689,29 +701,36 @@ export declare class Pillar {
689
701
  */
690
702
  private _executeWorkflowStep;
691
703
  /**
692
- * Send action result back to the agent.
704
+ * Send tool result back to the agent.
693
705
  *
694
- * Called automatically for actions with `returns: true` after their
706
+ * Called automatically for tools with `returns: true` after their
695
707
  * handler completes. The result is sent to the agent for further reasoning.
696
708
  *
697
- * @param actionName - The name of the action that was executed
709
+ * @param toolName - The name of the tool that was executed
698
710
  * @param result - The result data to send back to the agent
699
711
  * @param toolCallId - Unique ID for this specific tool invocation (for result correlation)
700
712
  * @returns Promise that resolves when the result is delivered
701
713
  * @internal
702
714
  */
715
+ sendToolResult(toolName: string, result: unknown, toolCallId?: string): Promise<void>;
716
+ /** @deprecated Use sendToolResult instead */
703
717
  sendActionResult(actionName: string, result: unknown, toolCallId?: string): Promise<void>;
704
718
  /**
705
- * Execute a query action and send the result back to the agent.
719
+ * Execute a query tool and send the result back to the agent.
706
720
  *
707
721
  * This is called when the agent sends a `query_request` event.
708
- * Query actions are expected to return data that the agent can use
722
+ * Query tools are expected to return data that the agent can use
709
723
  * for further reasoning.
710
724
  *
711
- * @param actionName - The name of the action to execute
712
- * @param args - Arguments for the action
725
+ * @param toolName - The name of the tool to execute
726
+ * @param args - Arguments for the tool
713
727
  * @param schema - Optional schema for parameter validation
714
728
  */
729
+ executeQueryTool(toolName: string, args?: Record<string, unknown>, schema?: {
730
+ properties?: Record<string, unknown>;
731
+ required?: string[];
732
+ }): Promise<void>;
733
+ /** @deprecated Use executeQueryTool instead */
715
734
  executeQueryAction(actionName: string, args?: Record<string, unknown>, schema?: {
716
735
  properties?: Record<string, unknown>;
717
736
  required?: string[];
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pillar SDK Configuration Types
3
3
  */
4
- import type { Platform } from '../actions/types';
4
+ import type { Platform } from '../tools/types';
5
5
  /** Which side of the screen the panel appears on. */
6
6
  export type PanelPosition = 'left' | 'right';
7
7
  /** How the panel interacts with page content: 'overlay' floats over it, 'push' shifts it aside. */
@@ -164,7 +164,13 @@ export interface PillarEvents {
164
164
  };
165
165
  /** User logged out. */
166
166
  "user:logout": Record<string, never>;
167
- /** Query action returned a result to the agent. */
167
+ /** Query tool returned a result to the agent. */
168
+ "tool:result": {
169
+ toolName: string;
170
+ result: unknown;
171
+ toolCallId?: string;
172
+ };
173
+ /** @deprecated Use tool:result instead */
168
174
  "action:result": {
169
175
  actionName: string;
170
176
  result: unknown;
package/dist/index.d.ts CHANGED
@@ -22,9 +22,9 @@ export { EventEmitter, type CardCallbacks, type CardRenderer, type PillarEvents,
22
22
  export { Pillar, type ChatContext, type PillarState } from "./core/Pillar";
23
23
  export { DEFAULT_SIDEBAR_TABS, type DOMScanningConfig, type EdgeTriggerConfig, type InteractionHighlightConfig, type MobileTriggerConfig, type MobileTriggerIcon, type MobileTriggerPosition, type MobileTriggerSize, type PanelConfig, type PanelMode, type PanelPosition, type PillarConfig, type ResolvedConfig, type ResolvedDOMScanningConfig, type ResolvedInteractionHighlightConfig, type ResolvedMobileTriggerConfig, type ResolvedPanelConfig, type ResolvedSuggestionsConfig, type ResolvedThemeConfig, type SidebarTabConfig, type SuggestionsConfig, type TextSelectionConfig, type ThemeColors, type ThemeConfig, type ThemeMode, type UrlParamsConfig, } from "./core/config";
24
24
  export { type AssistantContext, type Context, type Suggestion, type UserProfile, } from "./core/context";
25
- export { clearRegistry, getActionCount, getActionDefinition, getActionNames, getClientInfo, getHandler, getManifest, hasAction, setClientInfo, type ActionDataSchema, type ActionDataType, type ActionDefinition, type ActionDefinitions, type ActionManifest, type ActionManifestEntry, type ActionNames, type ActionType, type ActionTypeDataMap, type ClientInfo, type CopyTextData, type ExternalLinkData, type InlineUIData, type NavigateActionData, type Platform, type SyncActionDefinition, type SyncActionDefinitions, type TriggerActionData, type TypedOnTask, type TypedPillarMethods, type TypedTaskHandler, type ActionResult, type ActionSchema, } from "./actions";
25
+ export { clearRegistry, getToolCount, getToolDefinition, getToolNames, getClientInfo, getHandler, getManifest, hasTool, setClientInfo, type ToolDataSchema, type ToolDataSchemaProperty, type ToolDataType, type ToolDefinition, type ToolDefinitions, type ToolManifest, type ToolManifestEntry, type ToolNames, type ToolType, type ToolTypeDataMap, type ToolExecuteResult, type ToolSchema, type ClientInfo, type CopyTextData, type ExternalLinkData, type InlineUIData, type NavigateToolData, type TriggerToolData, type QueryToolData, type Platform, type SyncToolDefinition, type SyncToolDefinitions, type TypedOnTask, type TypedPillarMethods, type TypedTaskHandler, getActionCount, getActionDefinition, getActionNames, hasAction, type ActionDataSchema, type ActionDataSchemaProperty, type ActionDataType, type ActionDefinition, type ActionDefinitions, type ActionManifest, type ActionManifestEntry, type ActionNames, type ActionType, type ActionTypeDataMap, type ActionResult, type ActionSchema, type NavigateActionData, type TriggerActionData, type QueryActionData, type SyncActionDefinition, type SyncActionDefinitions, } from "./tools";
26
26
  export { APIClient, type ArticleSummary, type ChatMessage, type ChatResponse, type ProgressEvent, } from "./api/client";
27
- export { type ActionRequest, type ChatImage, type ImageUploadResponse, type TokenUsage, } from "./api/mcp-client";
27
+ export { type ToolRequest, type ToolData, type ChatImage, type ImageUploadResponse, type TokenUsage, toolToTaskButton, type ActionRequest, type ActionData, actionToTaskButton, } from "./api/mcp-client";
28
28
  export { DEFAULT_SCAN_OPTIONS, INTERACTABLE_ROLES, INTERACTABLE_TAGS, SKIP_TAGS, type CompactScanResult, type InteractionType, type ScanOptions, } from "./types/dom-scanner";
29
29
  export { buildSelectorFromRef, clearPillarRefs, isDestructiveElement, isInteractable, isRedacted, isValidPillarRef, scanPageDirect, } from "./utils/dom-scanner";
30
30
  export { generateContextId, getContextDisplayLabel, isDOMSnapshotContext, isHighlightedTextContext, type DOMSnapshotContext, type GenericContext, type HighlightedTextContext, type ProductContext, type UserContextItem, type UserProfileContext, } from "./types/user-context";