@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.
- 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/actions/index.d.ts +1 -1
- package/dist/actions/types.d.ts +0 -89
- 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 +62 -43
- 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/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 +57 -38
- 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 +2 -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 +3 -2
- 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,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,7 +2,7 @@
|
|
|
2
2
|
* Main Pillar SDK Class
|
|
3
3
|
* Entry point for all SDK functionality
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
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
|
-
|
|
46
|
-
|
|
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
|
|
444
|
+
* Define a tool with co-located metadata and handler.
|
|
443
445
|
*
|
|
444
|
-
* This is the recommended way to register
|
|
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 -
|
|
452
|
-
* @returns Unsubscribe function that removes the
|
|
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.
|
|
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
|
|
474
|
+
* // Later: unsub() to remove the tool
|
|
473
475
|
*/
|
|
474
|
-
|
|
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
|
|
480
|
+
* Register a tool definition at runtime.
|
|
477
481
|
*
|
|
478
|
-
* @deprecated Use `
|
|
482
|
+
* @deprecated Use `defineTool()` instead, which co-locates metadata and handler.
|
|
479
483
|
*
|
|
480
|
-
* This is primarily for demos and development. In production,
|
|
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
|
|
484
|
-
* 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
|
|
485
489
|
* value is sent back to the agent.
|
|
486
490
|
*
|
|
487
|
-
* @param
|
|
491
|
+
* @param tool - Tool definition with name and properties
|
|
488
492
|
*
|
|
489
493
|
* @example
|
|
490
|
-
* pillar.
|
|
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
|
|
509
|
+
* Get a registered tool definition by name.
|
|
502
510
|
*
|
|
503
|
-
* @param name -
|
|
504
|
-
* @returns
|
|
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
|
|
518
|
+
* Get handler for a tool, checking all registration systems.
|
|
509
519
|
*
|
|
510
520
|
* Lookup order:
|
|
511
|
-
* 1. Code-first
|
|
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
|
-
* -
|
|
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
|
|
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(
|
|
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
|
|
575
|
+
* Signal that a tool has completed.
|
|
566
576
|
*
|
|
567
|
-
* For simple
|
|
568
|
-
* For wizard
|
|
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
|
|
572
|
-
* @param success - Whether the
|
|
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.
|
|
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
|
|
704
|
+
* Send tool result back to the agent.
|
|
693
705
|
*
|
|
694
|
-
* Called automatically for
|
|
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
|
|
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
|
|
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
|
|
722
|
+
* Query tools are expected to return data that the agent can use
|
|
709
723
|
* for further reasoning.
|
|
710
724
|
*
|
|
711
|
-
* @param
|
|
712
|
-
* @param args - Arguments for the
|
|
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[];
|
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";
|