@pillar-ai/sdk 0.1.19 → 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.
- package/dist/actions/definitions/analytics.d.ts +18 -0
- package/dist/actions/definitions/content.d.ts +40 -0
- package/dist/actions/definitions/index.d.ts +26 -0
- package/dist/actions/definitions/navigation.d.ts +65 -0
- package/dist/actions/definitions/settings.d.ts +162 -0
- package/dist/actions/definitions/sources.d.ts +44 -0
- package/dist/actions/definitions/support.d.ts +15 -0
- package/dist/actions/definitions/team.d.ts +120 -0
- package/dist/api/ag-ui-adapter.d.ts +76 -0
- package/dist/api/ag-ui-bridge.d.ts +49 -0
- package/dist/api/ag-ui-client.d.ts +102 -0
- package/dist/api/ag-ui-handler.d.ts +89 -0
- package/dist/api/mcp-client.d.ts +46 -24
- package/dist/cli/sync.js +253 -174
- package/dist/components/Button/FloatingButton.d.ts +46 -0
- package/dist/components/PagePilot/styles.d.ts +1 -1
- package/dist/components/Panel/TabNavigation.d.ts +16 -0
- package/dist/components/Panel/styles.d.ts +1 -1
- package/dist/components/Progress/AGUIProgress.d.ts +15 -0
- package/dist/components/Progress/ErrorRow.d.ts +12 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Tooltips/Tooltip.d.ts +46 -0
- package/dist/components/Tooltips/TooltipManager.d.ts +41 -0
- package/dist/components/Tooltips/index.d.ts +6 -0
- package/dist/components/Tooltips/styles.d.ts +5 -0
- package/dist/components/Views/ArticleChatView.d.ts +10 -0
- package/dist/components/Views/ArticleView.d.ts +10 -0
- package/dist/components/Views/CategoryView.d.ts +11 -0
- package/dist/components/Views/HelpCenterArticles.d.ts +17 -0
- package/dist/components/Views/SearchView.d.ts +10 -0
- package/dist/components/Views/SupportView.d.ts +15 -0
- package/dist/components/shared/ArticleCard.d.ts +17 -0
- package/dist/components/shared/CategoryCard.d.ts +17 -0
- package/dist/content/extensions/AccordionNode.d.ts +10 -0
- package/dist/content/extensions/CalloutNode.d.ts +11 -0
- package/dist/content/extensions/index.d.ts +5 -0
- package/dist/content/index.d.ts +5 -0
- package/dist/content/renderer.d.ts +24 -0
- package/dist/core/Pillar.d.ts +85 -28
- package/dist/core/config.d.ts +1 -1
- package/dist/core/events.d.ts +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/pillar.esm.js +1 -1
- package/dist/store/chat.d.ts +12 -0
- package/dist/store/tooltips.d.ts +21 -0
- package/dist/tools/index.d.ts +27 -0
- package/dist/tools/registry.d.ts +106 -0
- package/dist/tools/types.d.ts +564 -0
- package/dist/utils/helpdesk.d.ts +33 -0
- package/dist/utils/markdown.d.ts +9 -0
- package/dist/utils/resilient-fetch.d.ts +25 -0
- package/package.json +12 -3
- package/src/actions/types.ts +0 -524
|
@@ -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;
|
package/dist/core/Pillar.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Main Pillar SDK Class
|
|
3
3
|
* Entry point for all SDK functionality
|
|
4
4
|
*/
|
|
5
|
+
import { type ToolSchema } from "../tools";
|
|
5
6
|
import { type PillarConfig, type ResolvedConfig, type ThemeConfig } from "./config";
|
|
6
7
|
import { type Context, type Suggestion, type UserProfile } from "./context";
|
|
7
8
|
import { type CardRenderer, type PillarEvents, type TaskExecutePayload } from "./events";
|
|
@@ -41,7 +42,10 @@ export declare class Pillar {
|
|
|
41
42
|
private _getStoredExternalUserId;
|
|
42
43
|
private _taskHandlers;
|
|
43
44
|
private _anyTaskHandler;
|
|
44
|
-
|
|
45
|
+
_registeredTools: Map<string, Record<string, unknown>>;
|
|
46
|
+
/** @deprecated Use _registeredTools instead */
|
|
47
|
+
get _registeredActions(): Map<string, Record<string, unknown>>;
|
|
48
|
+
private _definedTools;
|
|
45
49
|
private _cardRenderers;
|
|
46
50
|
private _debugPanelContainer;
|
|
47
51
|
private _routeObserver;
|
|
@@ -437,47 +441,91 @@ export declare class Pillar {
|
|
|
437
441
|
*/
|
|
438
442
|
onTask(taskName: string, handler: (data: Record<string, unknown>) => void): () => void;
|
|
439
443
|
/**
|
|
440
|
-
*
|
|
444
|
+
* Define a tool with co-located metadata and handler.
|
|
441
445
|
*
|
|
442
|
-
* This is
|
|
446
|
+
* This is the recommended way to register tools. The metadata
|
|
447
|
+
* (name, description, inputSchema) is discoverable by the CLI scanner
|
|
448
|
+
* (`npx pillar-sync --scan ./src`) and the handler runs client-side.
|
|
449
|
+
*
|
|
450
|
+
* If `execute` returns a value, it is automatically sent back to the
|
|
451
|
+
* agent — no explicit `returns: true` flag needed.
|
|
452
|
+
*
|
|
453
|
+
* @param schema - Tool schema with metadata and execute handler
|
|
454
|
+
* @returns Unsubscribe function that removes the tool
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* const unsub = pillar.defineTool({
|
|
458
|
+
* name: 'add_to_cart',
|
|
459
|
+
* description: 'Add a product to the shopping cart',
|
|
460
|
+
* inputSchema: {
|
|
461
|
+
* type: 'object',
|
|
462
|
+
* properties: {
|
|
463
|
+
* productId: { type: 'string' },
|
|
464
|
+
* quantity: { type: 'number' },
|
|
465
|
+
* },
|
|
466
|
+
* required: ['productId', 'quantity'],
|
|
467
|
+
* },
|
|
468
|
+
* execute: async ({ productId, quantity }) => {
|
|
469
|
+
* await cartApi.add(productId, quantity);
|
|
470
|
+
* return { content: [{ type: 'text', text: 'Added to cart' }] };
|
|
471
|
+
* },
|
|
472
|
+
* });
|
|
473
|
+
*
|
|
474
|
+
* // Later: unsub() to remove the tool
|
|
475
|
+
*/
|
|
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;
|
|
479
|
+
/**
|
|
480
|
+
* Register a tool definition at runtime.
|
|
481
|
+
*
|
|
482
|
+
* @deprecated Use `defineTool()` instead, which co-locates metadata and handler.
|
|
483
|
+
*
|
|
484
|
+
* This is primarily for demos and development. In production, tools
|
|
443
485
|
* should be synced via the `pillar-sync` CLI during CI/CD.
|
|
444
486
|
*
|
|
445
|
-
* The
|
|
446
|
-
* handlers. For
|
|
487
|
+
* The tool definition is stored locally and can be used by `onTask`
|
|
488
|
+
* handlers. For tools with `returnsData: true`, the handler's return
|
|
447
489
|
* value is sent back to the agent.
|
|
448
490
|
*
|
|
449
|
-
* @param
|
|
491
|
+
* @param tool - Tool definition with name and properties
|
|
450
492
|
*
|
|
451
493
|
* @example
|
|
452
|
-
* pillar.
|
|
494
|
+
* pillar.registerTool({
|
|
453
495
|
* name: 'list_datasets',
|
|
454
496
|
* description: 'List available datasets',
|
|
455
497
|
* type: 'query',
|
|
456
498
|
* returnsData: true,
|
|
457
499
|
* });
|
|
458
500
|
*/
|
|
501
|
+
registerTool(tool: {
|
|
502
|
+
name: string;
|
|
503
|
+
} & Record<string, unknown>): void;
|
|
504
|
+
/** @deprecated Use registerTool instead */
|
|
459
505
|
registerAction(action: {
|
|
460
506
|
name: string;
|
|
461
507
|
} & Record<string, unknown>): void;
|
|
462
508
|
/**
|
|
463
|
-
* Get a registered
|
|
509
|
+
* Get a registered tool definition by name.
|
|
464
510
|
*
|
|
465
|
-
* @param name -
|
|
466
|
-
* @returns
|
|
511
|
+
* @param name - Tool name
|
|
512
|
+
* @returns Tool definition or undefined
|
|
467
513
|
*/
|
|
514
|
+
getRegisteredTool(name: string): Record<string, unknown> | undefined;
|
|
515
|
+
/** @deprecated Use getRegisteredTool instead */
|
|
468
516
|
getRegisteredAction(name: string): Record<string, unknown> | undefined;
|
|
469
517
|
/**
|
|
470
|
-
* Get handler for
|
|
518
|
+
* Get handler for a tool, checking all registration systems.
|
|
471
519
|
*
|
|
472
520
|
* Lookup order:
|
|
473
|
-
* 1. Code-first
|
|
521
|
+
* 1. Code-first tool registry (synced via pillar-sync CLI) - handler in definition
|
|
474
522
|
* 2. Task handlers (registered via onTask at runtime)
|
|
475
523
|
*
|
|
476
524
|
* This is the recommended pattern:
|
|
477
|
-
* -
|
|
525
|
+
* - Tool definitions synced to server via CLI (so AI knows what's possible)
|
|
478
526
|
* - Handlers registered at runtime via onTask (client-side execution)
|
|
479
527
|
*
|
|
480
|
-
* @param
|
|
528
|
+
* @param toolName - Tool name to look up
|
|
481
529
|
* @returns Handler function or undefined if not found
|
|
482
530
|
*
|
|
483
531
|
* @example
|
|
@@ -486,7 +534,7 @@ export declare class Pillar {
|
|
|
486
534
|
* const result = await handler({ limit: 10 });
|
|
487
535
|
* }
|
|
488
536
|
*/
|
|
489
|
-
getHandler(
|
|
537
|
+
getHandler(toolName: string): ((data: Record<string, unknown>) => unknown) | undefined;
|
|
490
538
|
/**
|
|
491
539
|
* Register a catch-all handler for any task.
|
|
492
540
|
* Useful for logging, analytics, or handling unknown tasks.
|
|
@@ -524,20 +572,22 @@ export declare class Pillar {
|
|
|
524
572
|
*/
|
|
525
573
|
completeTask(taskName: string, success?: boolean, data?: Record<string, unknown>): void;
|
|
526
574
|
/**
|
|
527
|
-
* Signal that
|
|
575
|
+
* Signal that a tool has completed.
|
|
528
576
|
*
|
|
529
|
-
* For simple
|
|
530
|
-
* For wizard
|
|
577
|
+
* For simple tools, this emits the completion event.
|
|
578
|
+
* For wizard tools (modals, multi-step flows), call this when the user
|
|
531
579
|
* finishes the flow.
|
|
532
580
|
*
|
|
533
|
-
* @param
|
|
534
|
-
* @param success - Whether the
|
|
581
|
+
* @param toolName - The tool identifier
|
|
582
|
+
* @param success - Whether the tool completed successfully (default: true)
|
|
535
583
|
* @param data - Optional result data
|
|
536
584
|
*
|
|
537
585
|
* @example
|
|
538
586
|
* // In your wizard completion handler:
|
|
539
|
-
* pillar.
|
|
587
|
+
* pillar.completeTool('add_source', true, { sourceId: source.id });
|
|
540
588
|
*/
|
|
589
|
+
completeTool(toolName: string, success?: boolean, data?: Record<string, unknown>): Promise<void>;
|
|
590
|
+
/** @deprecated Use completeTool instead */
|
|
541
591
|
completeAction(actionName: string, success?: boolean, data?: Record<string, unknown>): Promise<void>;
|
|
542
592
|
/**
|
|
543
593
|
* Confirm task execution result.
|
|
@@ -651,29 +701,36 @@ export declare class Pillar {
|
|
|
651
701
|
*/
|
|
652
702
|
private _executeWorkflowStep;
|
|
653
703
|
/**
|
|
654
|
-
* Send
|
|
704
|
+
* Send tool result back to the agent.
|
|
655
705
|
*
|
|
656
|
-
* Called automatically for
|
|
706
|
+
* Called automatically for tools with `returns: true` after their
|
|
657
707
|
* handler completes. The result is sent to the agent for further reasoning.
|
|
658
708
|
*
|
|
659
|
-
* @param
|
|
709
|
+
* @param toolName - The name of the tool that was executed
|
|
660
710
|
* @param result - The result data to send back to the agent
|
|
661
711
|
* @param toolCallId - Unique ID for this specific tool invocation (for result correlation)
|
|
662
712
|
* @returns Promise that resolves when the result is delivered
|
|
663
713
|
* @internal
|
|
664
714
|
*/
|
|
715
|
+
sendToolResult(toolName: string, result: unknown, toolCallId?: string): Promise<void>;
|
|
716
|
+
/** @deprecated Use sendToolResult instead */
|
|
665
717
|
sendActionResult(actionName: string, result: unknown, toolCallId?: string): Promise<void>;
|
|
666
718
|
/**
|
|
667
|
-
* Execute a query
|
|
719
|
+
* Execute a query tool and send the result back to the agent.
|
|
668
720
|
*
|
|
669
721
|
* This is called when the agent sends a `query_request` event.
|
|
670
|
-
* Query
|
|
722
|
+
* Query tools are expected to return data that the agent can use
|
|
671
723
|
* for further reasoning.
|
|
672
724
|
*
|
|
673
|
-
* @param
|
|
674
|
-
* @param args - Arguments for the
|
|
725
|
+
* @param toolName - The name of the tool to execute
|
|
726
|
+
* @param args - Arguments for the tool
|
|
675
727
|
* @param schema - Optional schema for parameter validation
|
|
676
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 */
|
|
677
734
|
executeQueryAction(actionName: string, args?: Record<string, unknown>, schema?: {
|
|
678
735
|
properties?: Record<string, unknown>;
|
|
679
736
|
required?: string[];
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pillar SDK Configuration Types
|
|
3
3
|
*/
|
|
4
|
-
import type { Platform } from '../
|
|
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. */
|
package/dist/core/events.d.ts
CHANGED
|
@@ -164,7 +164,13 @@ export interface PillarEvents {
|
|
|
164
164
|
};
|
|
165
165
|
/** User logged out. */
|
|
166
166
|
"user:logout": Record<string, never>;
|
|
167
|
-
/** Query
|
|
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,
|
|
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
|
|
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";
|