guideai-app 0.5.0 → 0.5.1
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/GuideAI.js +1 -1
- package/dist/GuideAI.js.map +1 -1
- package/dist/components/AnimatedSettingsItem.d.ts +1 -1
- package/dist/components/Microphone.d.ts +1 -1
- package/dist/components/SettingsMenu.d.ts +1 -1
- package/dist/components/TranscriptBox.d.ts +2 -1
- package/dist/components/TranscriptTextInput.d.ts +2 -1
- package/dist/components/TranscriptToggle.d.ts +1 -1
- package/dist/hooks/useWebRTC.d.ts +8 -0
- package/dist/types/GuideAI.types.d.ts +6 -0
- package/dist/utils/api.d.ts +12 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/dataChannel.d.ts +15 -0
- package/dist/utils/highlightThenClick.d.ts +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/toolRegistry.d.ts +33 -0
- package/dist/utils/webrtcConnection.d.ts +6 -1
- package/dist/visualContext/debug-overlay.d.ts +1 -1
- package/dist/visualContext/index.d.ts +1 -1
- package/package.json +8 -2
|
@@ -5,5 +5,5 @@ interface AnimatedSettingsItemProps {
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
React: typeof import('react');
|
|
7
7
|
}
|
|
8
|
-
declare const AnimatedSettingsItem: ({ visible, gap, isLast, children, React }: AnimatedSettingsItemProps) => import("react").JSX.Element;
|
|
8
|
+
declare const AnimatedSettingsItem: ({ visible, gap, isLast, children, React, }: AnimatedSettingsItemProps) => import("react").JSX.Element;
|
|
9
9
|
export default AnimatedSettingsItem;
|
|
@@ -15,5 +15,5 @@ interface MicrophoneProps {
|
|
|
15
15
|
isMuted: boolean;
|
|
16
16
|
React: typeof import('react');
|
|
17
17
|
}
|
|
18
|
-
declare const Microphone: ({ componentRef, baseStyles, hasInteracted, popupPosition, showOnboarding, handleOnboardingComplete, handleOnboardingClose, isConnecting, status, handleToggleConversation, showTranscript, hasMic, isMuted, React }: MicrophoneProps) => import("react").JSX.Element;
|
|
18
|
+
declare const Microphone: ({ componentRef, baseStyles, hasInteracted, popupPosition, showOnboarding, handleOnboardingComplete, handleOnboardingClose, isConnecting, status, handleToggleConversation, showTranscript, hasMic, isMuted, React, }: MicrophoneProps) => import("react").JSX.Element;
|
|
19
19
|
export default Microphone;
|
|
@@ -12,5 +12,5 @@ interface SettingsMenuProps {
|
|
|
12
12
|
micPosition?: MicButtonPosition;
|
|
13
13
|
React: typeof import('react');
|
|
14
14
|
}
|
|
15
|
-
declare const SettingsMenu: ({ handleResetChat, hasMic, isMuted, handleToggleMute, showTranscript, handleToggleTranscript, showSettings, setShowSettings, transcriptPosition, micPosition, React }: SettingsMenuProps) => import("react").JSX.Element;
|
|
15
|
+
declare const SettingsMenu: ({ handleResetChat, hasMic, isMuted, handleToggleMute, showTranscript, handleToggleTranscript, showSettings, setShowSettings, transcriptPosition, micPosition, React, }: SettingsMenuProps) => import("react").JSX.Element;
|
|
16
16
|
export default SettingsMenu;
|
|
@@ -22,10 +22,11 @@ interface TranscriptBoxProps {
|
|
|
22
22
|
showSettings?: boolean;
|
|
23
23
|
setShowSettings?: (value: boolean) => void;
|
|
24
24
|
isDataChannelOpen?: boolean;
|
|
25
|
+
isResponseActive?: boolean;
|
|
25
26
|
React: typeof import('react');
|
|
26
27
|
}
|
|
27
28
|
declare const TranscriptBox: {
|
|
28
|
-
({ allMessages, showTranscript, handleCloseTranscript, handleToggleTranscript, showTextInput, textInput, setTextInput, handleTextSubmit, handleTextKeyPress, textPlaceholder, micPosition, transcriptPosition, hasMic, isMuted, handleToggleMute, isConversationActive, handleResetChat, showSettings, setShowSettings, isDataChannelOpen, React }: TranscriptBoxProps): import("react").JSX.Element | null;
|
|
29
|
+
({ allMessages, showTranscript, handleCloseTranscript: _handleCloseTranscript, handleToggleTranscript, showTextInput, textInput, setTextInput, handleTextSubmit, handleTextKeyPress, textPlaceholder, micPosition, transcriptPosition, hasMic, isMuted, handleToggleMute, isConversationActive: _isConversationActive, handleResetChat, showSettings, setShowSettings, isDataChannelOpen, isResponseActive, React, }: TranscriptBoxProps): import("react").JSX.Element | null;
|
|
29
30
|
displayName: string;
|
|
30
31
|
};
|
|
31
32
|
export default TranscriptBox;
|
|
@@ -5,7 +5,8 @@ interface TranscriptTextInputProps {
|
|
|
5
5
|
handleTextKeyPress?: (event: React.KeyboardEvent) => void;
|
|
6
6
|
textPlaceholder?: string;
|
|
7
7
|
isDataChannelOpen?: boolean;
|
|
8
|
+
isResponseActive?: boolean;
|
|
8
9
|
React: typeof import('react');
|
|
9
10
|
}
|
|
10
|
-
declare const TranscriptTextInput: ({ textInput, setTextInput, handleTextSubmit, handleTextKeyPress, textPlaceholder, isDataChannelOpen, React }: TranscriptTextInputProps) => import("react").JSX.Element;
|
|
11
|
+
declare const TranscriptTextInput: ({ textInput, setTextInput, handleTextSubmit, handleTextKeyPress, textPlaceholder, isDataChannelOpen, isResponseActive, React, }: TranscriptTextInputProps) => import("react").JSX.Element;
|
|
11
12
|
export default TranscriptTextInput;
|
|
@@ -3,5 +3,5 @@ interface TranscriptToggleProps {
|
|
|
3
3
|
handleToggleTranscript?: () => void;
|
|
4
4
|
React: typeof import('react');
|
|
5
5
|
}
|
|
6
|
-
declare const TranscriptToggle: ({ showTranscript, handleToggleTranscript, React }: TranscriptToggleProps) => import("react").JSX.Element;
|
|
6
|
+
declare const TranscriptToggle: ({ showTranscript, handleToggleTranscript, React, }: TranscriptToggleProps) => import("react").JSX.Element;
|
|
7
7
|
export default TranscriptToggle;
|
|
@@ -8,6 +8,11 @@ import { ConversationManager } from '../utils/conversationManager';
|
|
|
8
8
|
import type { RecordingStatus } from '../types/GuideAI.types';
|
|
9
9
|
import type { GuideAIEnvironment } from '../types/GuideAI.types';
|
|
10
10
|
import type { StoredMessage } from '../utils/messageStorage';
|
|
11
|
+
export type PropTools = Record<string, {
|
|
12
|
+
description: string;
|
|
13
|
+
parameters: object;
|
|
14
|
+
execute: (args: Record<string, unknown>) => Promise<unknown>;
|
|
15
|
+
}>;
|
|
11
16
|
export interface UseWebRTCParams {
|
|
12
17
|
hooks: {
|
|
13
18
|
useRef: <T>(initialValue: T) => {
|
|
@@ -18,6 +23,7 @@ export interface UseWebRTCParams {
|
|
|
18
23
|
organizationKey: string;
|
|
19
24
|
environment: GuideAIEnvironment;
|
|
20
25
|
setIsDataChannelOpen: (open: boolean) => void;
|
|
26
|
+
setIsResponseActive: (active: boolean) => void;
|
|
21
27
|
setIsConnecting: (connecting: boolean) => void;
|
|
22
28
|
setStatus: (status: RecordingStatus) => void;
|
|
23
29
|
handleHighlightThenClick: (out: any) => Promise<boolean>;
|
|
@@ -38,6 +44,8 @@ export interface UseWebRTCParams {
|
|
|
38
44
|
current: ConversationManager | null;
|
|
39
45
|
};
|
|
40
46
|
onMessageLogged: () => void;
|
|
47
|
+
/** Optional tools from component prop: Record<functionName, { description, parameters, execute }> */
|
|
48
|
+
tools?: PropTools;
|
|
41
49
|
}
|
|
42
50
|
export declare function useWebRTC(params: UseWebRTCParams): {
|
|
43
51
|
peerConnectionRef: {
|
|
@@ -38,6 +38,12 @@ export interface GuideAIProps {
|
|
|
38
38
|
placeholder?: string;
|
|
39
39
|
};
|
|
40
40
|
visualContext?: VisualContextConfig;
|
|
41
|
+
/** Custom tools: Record<functionName, { description, parameters, execute }> - always custom handler */
|
|
42
|
+
tools?: Record<string, {
|
|
43
|
+
description: string;
|
|
44
|
+
parameters: object;
|
|
45
|
+
execute: (args: Record<string, unknown>) => Promise<unknown>;
|
|
46
|
+
}>;
|
|
41
47
|
}
|
|
42
48
|
export type TranscriptPosition = 'right' | 'left';
|
|
43
49
|
export type PopupPosition = 'above' | 'below' | 'above-left' | 'above-right' | 'above-center' | 'below-left' | 'below-right' | 'below-center';
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -11,15 +11,27 @@ export interface Workflow {
|
|
|
11
11
|
createdAt?: string;
|
|
12
12
|
updatedAt?: string;
|
|
13
13
|
}
|
|
14
|
+
export interface PropToolDefinition {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
parameters: object;
|
|
18
|
+
}
|
|
14
19
|
export interface InitializeWebRTCPayload {
|
|
15
20
|
sdp: string;
|
|
16
21
|
organizationKey: string;
|
|
17
22
|
user?: string;
|
|
18
23
|
conversationId?: string;
|
|
24
|
+
/** Prop tools to sync to library (server creates if not exist, unpublished) */
|
|
25
|
+
propTools?: PropToolDefinition[];
|
|
26
|
+
}
|
|
27
|
+
export interface ToolFromServer {
|
|
28
|
+
toolConfig: object;
|
|
29
|
+
functionConfig: object;
|
|
19
30
|
}
|
|
20
31
|
export interface InitializeWebRTCResponse {
|
|
21
32
|
answerSdp: string;
|
|
22
33
|
id: string;
|
|
34
|
+
tools?: ToolFromServer[];
|
|
23
35
|
}
|
|
24
36
|
export declare const initializeWebRTC: (endpoint: string, payload: InitializeWebRTCPayload) => Promise<InitializeWebRTCResponse>;
|
|
25
37
|
export declare const logMessage: (messageData: MessageData, conversationId: string | null, organizationKey: string, user?: string, environment?: GuideAIEnvironment) => Promise<void>;
|
|
@@ -5,7 +5,7 @@ export declare const GUIDE_AI_API_BASE_LOCAL = "http://localhost:3000/api";
|
|
|
5
5
|
export declare const getApiBaseUrl: (environment?: "development" | "production" | "local") => string;
|
|
6
6
|
export declare const GUIDE_AI_API_BASE = "https://app.getguide.ai/api";
|
|
7
7
|
export declare const OPENAI_REALTIME_BASE = "https://api.openai.com/v1/realtime/calls";
|
|
8
|
-
export type ElementInteractionType =
|
|
8
|
+
export type ElementInteractionType = 'HIGHLIGHT' | 'HOVERANDCLICK';
|
|
9
9
|
export declare const UI_LAYOUT: {
|
|
10
10
|
/** Mic/icon wrapper size - matches .guideai-icon-wrapper */
|
|
11
11
|
readonly micButtonSize: 50;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StoredMessage } from './messageStorage';
|
|
2
|
+
import { type ToolWithConfig } from './toolRegistry';
|
|
2
3
|
import { ConversationManager } from './conversationManager';
|
|
3
4
|
export type RecordingStatus = 'idle' | 'recording' | 'active' | 'processing' | 'playing';
|
|
4
5
|
export declare const IGNORE_MESSAGE_TYPES: string[];
|
|
@@ -13,6 +14,7 @@ export interface DataChannelCallbacks {
|
|
|
13
14
|
onDataChannelClose: (pc: RTCPeerConnection) => void;
|
|
14
15
|
onDataChannelError: (event: Event) => void;
|
|
15
16
|
onDataChannelMessageError: (message: any) => void;
|
|
17
|
+
setIsResponseActive: (active: boolean) => void;
|
|
16
18
|
updateStreamingMessage: (delta: string) => void;
|
|
17
19
|
/** Reset streaming state when a new response starts (call on response.created) */
|
|
18
20
|
resetStreamingMessage?: () => void;
|
|
@@ -28,6 +30,14 @@ export interface DataChannelCallbacks {
|
|
|
28
30
|
export interface DataChannelConfig {
|
|
29
31
|
audioStream: MediaStream | null;
|
|
30
32
|
callbacks: DataChannelCallbacks;
|
|
33
|
+
/** Tools from server (initialize response). If undefined = old server, use built-in. If [] = new server, no tools. */
|
|
34
|
+
tools?: ToolWithConfig[];
|
|
35
|
+
/** Prop tools: Record<functionName, { description, parameters, execute }> - always custom handler */
|
|
36
|
+
propTools?: Record<string, {
|
|
37
|
+
description: string;
|
|
38
|
+
parameters: object;
|
|
39
|
+
execute: (args: Record<string, unknown>) => Promise<unknown>;
|
|
40
|
+
}>;
|
|
31
41
|
}
|
|
32
42
|
export declare const BUFFERED_AMOUNT_THRESHOLD = 65536;
|
|
33
43
|
export declare class DataChannelManager {
|
|
@@ -36,7 +46,12 @@ export declare class DataChannelManager {
|
|
|
36
46
|
private callbacks;
|
|
37
47
|
private audioStream;
|
|
38
48
|
private sendQueue;
|
|
49
|
+
private toolsConfig;
|
|
50
|
+
private serverToolsReceived;
|
|
51
|
+
private propTools?;
|
|
39
52
|
constructor(config: DataChannelConfig);
|
|
53
|
+
/** Set tools from server (call after initialize, before channel opens) */
|
|
54
|
+
setTools(tools: ToolWithConfig[]): void;
|
|
40
55
|
/**
|
|
41
56
|
* Create a new data channel on the peer connection
|
|
42
57
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ToolInput } from
|
|
1
|
+
import { ToolInput } from './elementInteractions';
|
|
2
2
|
export declare const highlightThenClick: (out: ToolInput, isHighlighting: boolean, setIsHighlighting: (highlighting: boolean) => void) => Promise<boolean>;
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type Component = 'GuideAI' | 'API' | 'TranscriptBox' | 'Onboarding' | 'VisualContext' | 'MessageStorage' | 'DataChannel' | 'ConversationManager' | 'LocalStorageHelper' | 'WebRTCConnection';
|
|
1
|
+
type Component = 'GuideAI' | 'API' | 'TranscriptBox' | 'Onboarding' | 'VisualContext' | 'MessageStorage' | 'DataChannel' | 'ConversationManager' | 'LocalStorageHelper' | 'WebRTCConnection' | 'ToolRegistry';
|
|
2
2
|
declare class Logger {
|
|
3
3
|
private static formatMessage;
|
|
4
4
|
private static checkLoggingEnabled;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool execution registry.
|
|
3
|
+
* Maps function names to handlers for built-in types and api_call.
|
|
4
|
+
* No eval - only registered handlers or HTTP fetch for api_call.
|
|
5
|
+
*/
|
|
6
|
+
export type ToolHandler = (args: Record<string, unknown>, callbacks: {
|
|
7
|
+
handleHighlightThenClick: (out: any) => Promise<boolean>;
|
|
8
|
+
handleHoverThenClick: (out: any) => Promise<boolean>;
|
|
9
|
+
handleHover: (out: any) => Promise<boolean>;
|
|
10
|
+
handleGoToAElmLink: (linkText: string, delay?: number) => Promise<boolean>;
|
|
11
|
+
}) => Promise<unknown>;
|
|
12
|
+
export interface ToolWithConfig {
|
|
13
|
+
toolConfig: {
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
parameters?: object;
|
|
18
|
+
};
|
|
19
|
+
functionConfig: {
|
|
20
|
+
handlerType: string;
|
|
21
|
+
url?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Execute a tool by name using server-provided tools config and callbacks.
|
|
26
|
+
* Returns the result for function_call_output.
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeTool(name: string, args: string, toolsConfig: ToolWithConfig[], callbacks: {
|
|
29
|
+
handleHighlightThenClick: (out: any) => Promise<boolean>;
|
|
30
|
+
handleHoverThenClick: (out: any) => Promise<boolean>;
|
|
31
|
+
handleHover: (out: any) => Promise<boolean>;
|
|
32
|
+
handleGoToAElmLink: (linkText: string, delay?: number) => Promise<boolean>;
|
|
33
|
+
}, propHandlers?: Record<string, (args: Record<string, unknown>) => Promise<unknown>>): Promise<unknown>;
|
|
@@ -16,11 +16,16 @@ export interface WebRTCConnectionConfig {
|
|
|
16
16
|
audioStream: MediaStream | null;
|
|
17
17
|
/** Initialize endpoint URL (e.g. /api/initialize) - returns { id, answerSdp } */
|
|
18
18
|
initializeEndpoint: string;
|
|
19
|
-
/** Payload for initialize (organizationKey, user, conversationId */
|
|
19
|
+
/** Payload for initialize (organizationKey, user, conversationId, propTools) */
|
|
20
20
|
initializePayload: {
|
|
21
21
|
organizationKey: string;
|
|
22
22
|
user?: string;
|
|
23
23
|
conversationId?: string | null;
|
|
24
|
+
propTools?: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
parameters: object;
|
|
28
|
+
}[];
|
|
24
29
|
};
|
|
25
30
|
/** Called when session data is received (id) */
|
|
26
31
|
onSessionData?: (data: InitializeSessionData) => void;
|
|
@@ -6,5 +6,5 @@ interface DebugOverlayProps {
|
|
|
6
6
|
onToggleGallery?: () => void;
|
|
7
7
|
showGallery?: boolean;
|
|
8
8
|
}
|
|
9
|
-
export declare const DebugOverlay: ({ React, frames, latencyMs, onToggleGallery, showGallery }: DebugOverlayProps) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
9
|
+
export declare const DebugOverlay: ({ React, frames, latencyMs, onToggleGallery, showGallery, }: DebugOverlayProps) => import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
10
10
|
export {};
|
|
@@ -8,5 +8,5 @@ export { VisualContextScheduler } from './VisualContextScheduler';
|
|
|
8
8
|
export { DebugOverlay } from './debug-overlay';
|
|
9
9
|
export { useVisualContext } from './useVisualContext';
|
|
10
10
|
export { createDefaultScreenshotProvider, getDefaultScreenshotProvider } from './defaultProvider';
|
|
11
|
-
export type { ScreenshotResponse, ScreenshotFrame, ScreenshotDetail, ScreenshotOptions, ScreenshotProvider, VisualContextConfig } from './types';
|
|
11
|
+
export type { ScreenshotResponse, ScreenshotFrame, ScreenshotDetail, ScreenshotOptions, ScreenshotProvider, VisualContextConfig, } from './types';
|
|
12
12
|
export { MAX_IMAGE_MESSAGE_BYTES } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "guideai-app",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "AI-powered guide component for React applications",
|
|
5
5
|
"main": "dist/GuideAI.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dev": "npm run watch",
|
|
23
23
|
"serve:local": "npm run build:dev && npx serve -l 8080 dist",
|
|
24
24
|
"prepare": "npm run build",
|
|
25
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
25
26
|
"test": "jest",
|
|
26
27
|
"test:watch": "jest --watch",
|
|
27
28
|
"test:coverage": "jest --coverage"
|
|
@@ -44,10 +45,15 @@
|
|
|
44
45
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^10.0.1",
|
|
47
49
|
"@testing-library/jest-dom": "^6.9.1",
|
|
48
50
|
"@testing-library/react": "^16.3.0",
|
|
49
51
|
"@types/jest": "^30.0.0",
|
|
50
52
|
"@types/react": "^18.2.0",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
54
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
55
|
+
"eslint": "^10.0.1",
|
|
56
|
+
"eslint-config-prettier": "^10.1.8",
|
|
51
57
|
"javascript-obfuscator": "^4.1.0",
|
|
52
58
|
"jest": "^30.2.0",
|
|
53
59
|
"jest-circus": "^30.2.0",
|
|
@@ -62,4 +68,4 @@
|
|
|
62
68
|
"webpack": "^5.98.0",
|
|
63
69
|
"webpack-cli": "^6.0.1"
|
|
64
70
|
}
|
|
65
|
-
}
|
|
71
|
+
}
|