@pillar-ai/sdk 0.1.28 → 0.1.30

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 (52) 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/client.d.ts +2 -0
  16. package/dist/cli/sync.js +15 -3
  17. package/dist/components/Button/EdgeTrigger.d.ts +5 -0
  18. package/dist/components/Button/FloatingButton.d.ts +46 -0
  19. package/dist/components/PagePilot/styles.d.ts +1 -1
  20. package/dist/components/Panel/Panel.d.ts +5 -0
  21. package/dist/components/Panel/TabNavigation.d.ts +16 -0
  22. package/dist/components/Panel/styles.d.ts +1 -1
  23. package/dist/components/Progress/AGUIProgress.d.ts +15 -0
  24. package/dist/components/Tooltips/Tooltip.d.ts +46 -0
  25. package/dist/components/Tooltips/TooltipManager.d.ts +41 -0
  26. package/dist/components/Tooltips/index.d.ts +6 -0
  27. package/dist/components/Tooltips/styles.d.ts +5 -0
  28. package/dist/components/Views/ArticleChatView.d.ts +10 -0
  29. package/dist/components/Views/ArticleView.d.ts +10 -0
  30. package/dist/components/Views/CategoryView.d.ts +11 -0
  31. package/dist/components/Views/HelpCenterArticles.d.ts +17 -0
  32. package/dist/components/Views/SearchView.d.ts +10 -0
  33. package/dist/components/Views/SupportView.d.ts +15 -0
  34. package/dist/components/context.d.ts +6 -2
  35. package/dist/components/index.d.ts +0 -1
  36. package/dist/components/shared/ArticleCard.d.ts +17 -0
  37. package/dist/components/shared/CategoryCard.d.ts +17 -0
  38. package/dist/content/extensions/AccordionNode.d.ts +10 -0
  39. package/dist/content/extensions/CalloutNode.d.ts +11 -0
  40. package/dist/content/extensions/index.d.ts +5 -0
  41. package/dist/content/index.d.ts +5 -0
  42. package/dist/content/renderer.d.ts +24 -0
  43. package/dist/core/Pillar.d.ts +0 -1
  44. package/dist/core/config.d.ts +48 -0
  45. package/dist/pillar.esm.js +1 -1
  46. package/dist/store/suggestions.d.ts +1 -1
  47. package/dist/store/tooltips.d.ts +21 -0
  48. package/dist/tools/types.d.ts +29 -14
  49. package/dist/utils/helpdesk.d.ts +33 -0
  50. package/dist/utils/markdown.d.ts +9 -0
  51. package/dist/utils/normalize-tool-result.d.ts +10 -0
  52. package/package.json +1 -1
@@ -23,7 +23,7 @@ export declare const hasSuggestions: import("@preact/signals-core").ReadonlySign
23
23
  export declare const hasPool: import("@preact/signals-core").ReadonlySignal<boolean>;
24
24
  /**
25
25
  * Sort suggestions by relevance to the current page.
26
- * Uses keyword matching between page context and suggestion text.
26
+ * First filters by path pattern, then scores by keyword matching.
27
27
  *
28
28
  * @param pool - Full pool of suggestions from backend
29
29
  * @param pathname - Current page pathname (e.g., '/dashboards/new')
@@ -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;
@@ -491,19 +491,18 @@ export interface ToolExecuteResult {
491
491
  * @example
492
492
  * ```ts
493
493
  * pillar.defineTool({
494
- * name: 'add_to_cart',
495
- * description: 'Add a product to the shopping cart',
496
- * inputSchema: {
494
+ * name: 'get_signing_secret',
495
+ * description: 'Retrieve the webhook signing secret',
496
+ * outputSchema: {
497
497
  * type: 'object',
498
498
  * properties: {
499
- * productId: { type: 'string', description: 'Product ID' },
500
- * quantity: { type: 'number', description: 'Quantity to add' },
499
+ * signing_secret: { type: 'string', sensitive: true },
500
+ * algorithm: { type: 'string' },
501
501
  * },
502
- * required: ['productId', 'quantity'],
503
502
  * },
504
- * execute: async ({ productId, quantity }) => {
505
- * await cartApi.add(productId, quantity);
506
- * return { content: [{ type: 'text', text: 'Added to cart' }] };
503
+ * execute: async () => {
504
+ * const secret = await api.getSigningSecret();
505
+ * return { signing_secret: secret.value, algorithm: 'HMAC-SHA256' };
507
506
  * },
508
507
  * });
509
508
  * ```
@@ -563,15 +562,31 @@ export interface ToolSchema<TInput = Record<string, unknown>> {
563
562
  * @default true
564
563
  */
565
564
  autoComplete?: boolean;
565
+ /**
566
+ * Context required for this tool to be available.
567
+ *
568
+ * When set, the tool is only offered to users whose current context
569
+ * (set via `pillar.setContext()`) matches every key/value pair.
570
+ *
571
+ * @example { userRole: 'admin' }
572
+ * @example { plan: 'enterprise', betaAccess: true }
573
+ */
574
+ requiredContext?: Record<string, unknown>;
566
575
  /**
567
576
  * Handler function executed when the AI invokes this tool.
568
577
  *
569
- * Can return:
570
- * - A `ToolExecuteResult` with MCP-style content blocks
571
- * - A plain object (SDK normalizes it for the agent)
572
- * - `void` if the tool has no return value
578
+ * Return a plain object matching the `outputSchema`. The SDK sends
579
+ * it directly to the backend with no wrapping — what you return is
580
+ * what the agent sees.
581
+ *
582
+ * To signal failure, throw an error. The SDK catches it and sends
583
+ * `{ success: false, error: message }` to the agent automatically.
584
+ *
585
+ * For backward compatibility the SDK also accepts the legacy
586
+ * `{ success, data }` envelope and unwraps it, but new tools should
587
+ * return flat data.
573
588
  */
574
- execute: (input: TInput) => Promise<ToolExecuteResult | unknown | void> | ToolExecuteResult | unknown | void;
589
+ execute: (input: TInput) => Promise<ToolExecuteResult | Record<string, unknown> | void> | ToolExecuteResult | Record<string, unknown> | void;
575
590
  /**
576
591
  * Whether to also register this tool with WebMCP (navigator.modelContext).
577
592
  *
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Help Desk Utilities
3
+ * Functions to trigger external help desk widgets (Intercom, Pylon, Zendesk, Freshdesk)
4
+ */
5
+ import type { HelpDeskProvider } from '../core/config';
6
+ declare global {
7
+ interface Window {
8
+ Intercom?: (command: string, ...args: unknown[]) => void;
9
+ Pylon?: (command: string, ...args: unknown[]) => void;
10
+ zE?: (widget: string, command: string, ...args: unknown[]) => void;
11
+ FreshworksWidget?: (command: string, ...args: unknown[]) => void;
12
+ }
13
+ }
14
+ /**
15
+ * Context to pass to help desk when escalating
16
+ */
17
+ export interface HelpDeskContext {
18
+ conversationSummary?: string;
19
+ currentPage?: string;
20
+ userId?: string;
21
+ }
22
+ /**
23
+ * Trigger the appropriate help desk widget based on provider
24
+ */
25
+ export declare function triggerHelpDesk(provider: HelpDeskProvider, context?: HelpDeskContext): boolean;
26
+ /**
27
+ * Open email client with optional subject and body
28
+ */
29
+ export declare function openEmail(emailAddress: string, subject?: string, body?: string): void;
30
+ /**
31
+ * Open a URL in a new tab
32
+ */
33
+ export declare function openUrl(url: string): void;
@@ -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,10 @@
1
+ /**
2
+ * Normalize a tool handler's return value into the payload sent to the backend.
3
+ *
4
+ * Accepted handler return shapes:
5
+ * { success: true, data: { ... } } → returns the data object
6
+ * { success: false, error: "..." } → forwarded as-is (backend reads error)
7
+ * { key: "val", ... } → passed through unchanged
8
+ * "string" / number / array → passed through unchanged
9
+ */
10
+ export declare function normalizeToolResult(raw: unknown): unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pillar-ai/sdk",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Product copilot SDK for SaaS and web apps — AI assistant that executes tasks, not just answers questions",
5
5
  "type": "module",
6
6
  "main": "./dist/pillar.esm.js",