@bridgeline-digital/hawkai-assistant 1.0.0-beta.0

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/main.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { Config } from './types';
2
+ export declare const initialize: (config: Config) => void;
3
+ export declare const setActorId: (value: string | undefined) => void;
4
+ export declare const setContext: (context: Record<string, unknown> | undefined) => void;
5
+ export declare const toggle: (open: boolean) => void;
6
+ export declare const sendMessage: (message?: string, files?: File[]) => Promise<void>;
7
+ export declare const clearChat: () => void;
@@ -0,0 +1,8 @@
1
+ export declare const loadSessionState: () => void;
2
+ export declare const getSessionId: () => string;
3
+ export declare const getActorId: () => string;
4
+ export declare const regenerateSessionId: () => void;
5
+ export declare const ensureSessionId: () => void;
6
+ export declare const setActorId: (value: string | undefined) => void;
7
+ export declare const getContext: () => Record<string, unknown> | undefined;
8
+ export declare const setContext: (value: Record<string, unknown> | undefined) => void;
@@ -0,0 +1,6 @@
1
+ import { Product, Tool } from '../types';
2
+ interface DisplayProductsInput {
3
+ products: Product[];
4
+ }
5
+ export declare const getDisplayProductsTool: () => Tool<DisplayProductsInput, string>;
6
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Tool } from '../types';
2
+ interface PageContextOutput {
3
+ url: string;
4
+ title: string;
5
+ description: string;
6
+ ogTitle: string;
7
+ h1: string;
8
+ mainContent: string;
9
+ structuredData: string;
10
+ }
11
+ export declare const getRetrievePageContextTool: () => Tool<Record<string, never>, PageContextOutput>;
12
+ export {};
@@ -0,0 +1,81 @@
1
+ export type ToolRenderStatus = 'pending' | 'success' | 'error';
2
+ export interface RenderToolData<TInput> {
3
+ input: TInput;
4
+ status: ToolRenderStatus | undefined;
5
+ }
6
+ export interface RenderToolHelpers {
7
+ sendMessage: (text: string) => Promise<void>;
8
+ }
9
+ export type RenderToolResult = import('preact').ComponentChild | HTMLElement | null;
10
+ export type AsyncRenderToolResult = RenderToolResult | Promise<RenderToolResult>;
11
+ export interface Tool<TInput, TOutput> {
12
+ name: string;
13
+ description: string;
14
+ inputSchema: {
15
+ type: 'object';
16
+ properties: Record<string, unknown>;
17
+ required?: string[];
18
+ };
19
+ execute: (input: TInput) => Promise<TOutput>;
20
+ render?: (data: RenderToolData<TInput>, helpers: RenderToolHelpers) => AsyncRenderToolResult;
21
+ }
22
+ export type AnyTool = Tool<any, any>;
23
+ export interface UiConfig {
24
+ open?: boolean;
25
+ display?: 'window' | 'drawer';
26
+ position?: 'left' | 'right';
27
+ theme?: 'light' | 'dark' | 'automatic';
28
+ allowFullScreen?: boolean;
29
+ allowFileUpload?: boolean;
30
+ logoUrl?: string;
31
+ heading?: string;
32
+ initialMessage?: string;
33
+ promptOptions?: string[];
34
+ placeholder?: string;
35
+ colors?: {
36
+ primary?: {
37
+ default: string;
38
+ hover: string;
39
+ };
40
+ };
41
+ styles?: string;
42
+ stylesheetUrl?: string;
43
+ }
44
+ export interface Product {
45
+ id: string;
46
+ title: string;
47
+ url: string;
48
+ imageUrl?: string;
49
+ price?: number;
50
+ salePrice?: number;
51
+ rating?: number;
52
+ brand?: string;
53
+ sku?: string;
54
+ description?: string;
55
+ }
56
+ export interface Config {
57
+ apiUrl: string;
58
+ accountId: string;
59
+ agentId: string;
60
+ actorId?: string;
61
+ context?: Record<string, unknown>;
62
+ addToCart?: (product: Product) => void;
63
+ tools?: AnyTool[];
64
+ ui?: UiConfig;
65
+ }
66
+ declare global {
67
+ interface HawkAINamespace {
68
+ Assistant: {
69
+ config: Config;
70
+ initialize: (config: Config) => void;
71
+ setActorId: (value: string | undefined) => void;
72
+ setContext: (context: Record<string, unknown> | undefined) => void;
73
+ toggle: (open: boolean) => void;
74
+ sendMessage: (message?: string, files?: File[]) => Promise<void>;
75
+ clearChat: () => void;
76
+ };
77
+ }
78
+ interface Window {
79
+ HawkAI: HawkAINamespace;
80
+ }
81
+ }
@@ -0,0 +1,28 @@
1
+ import { JSX } from 'preact';
2
+ export interface MarkdownClasses {
3
+ a: string;
4
+ blockquote: string;
5
+ code: string;
6
+ em: string;
7
+ h1: string;
8
+ h2: string;
9
+ h3: string;
10
+ h4: string;
11
+ h5: string;
12
+ h6: string;
13
+ hr: string;
14
+ li: string;
15
+ ol: string;
16
+ p: string;
17
+ pre: string;
18
+ strong: string;
19
+ table: string;
20
+ tbody: string;
21
+ td: string;
22
+ th: string;
23
+ thead: string;
24
+ tr: string;
25
+ ul: string;
26
+ }
27
+ export declare const DEFAULT_CLASSES: MarkdownClasses;
28
+ export declare const parseMarkdown: (content: string, classes?: Partial<MarkdownClasses>) => JSX.Element;
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@bridgeline-digital/hawkai-assistant",
3
+ "version": "1.0.0-beta.0",
4
+ "type": "module",
5
+ "packageManager": "pnpm@10.33.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "files": ["dist"],
10
+ "main": "./dist/hawkai-assistant.js",
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc -b && vite build && vite build --config vite.library.config.ts",
22
+ "preview": "vite preview",
23
+ "lint": "biome check --fix .",
24
+ "prepare": "husky || true",
25
+ "prepack": "pnpm build",
26
+ "version:bump-beta": "node scripts/bump-beta-version.js",
27
+ "version:finalize-stable": "node scripts/finalize-stable-version.js"
28
+ },
29
+ "lint-staged": {
30
+ "*.{ts,tsx,js,json}": ["biome check --write"]
31
+ },
32
+ "dependencies": {
33
+ "@heroicons/react": "^2.2.0",
34
+ "clsx": "^2.1.1",
35
+ "dompurify": "^3.4.5",
36
+ "eventsource-parser": "^3.0.8",
37
+ "marked": "^18.0.4",
38
+ "preact": "^10.29.2",
39
+ "uuid": "^14.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@biomejs/biome": "^2.4.15",
43
+ "@preact/preset-vite": "^2.10.5",
44
+ "@tailwindcss/vite": "^4.3.0",
45
+ "@types/dompurify": "^3.2.0",
46
+ "@types/node": "^24.12.4",
47
+ "husky": "^9.1.7",
48
+ "lint-staged": "^17.0.5",
49
+ "tailwindcss": "^4.3.0",
50
+ "typescript": "~6.0.3",
51
+ "vite": "^8.0.13",
52
+ "vite-plugin-dts": "^5.0.1"
53
+ }
54
+ }