@marketrix.ai/widget 3.8.456 → 3.8.458
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/src/components/base/IconButton.d.ts +1 -1
- package/dist/src/components/base/Stack.d.ts +3 -15
- package/dist/src/components/base/Text.d.ts +1 -3
- package/dist/src/components/base/icons.d.ts +0 -32
- package/dist/src/components/base/layoutProps.d.ts +0 -11
- package/dist/src/components/blocks/HeaderBar.d.ts +2 -2
- package/dist/src/components/blocks/WidgetFab.d.ts +2 -15
- package/dist/src/components/chat/MessageList.d.ts +3 -7
- package/dist/src/components/chat/SuggestedActions.d.ts +3 -9
- package/dist/src/components/chat/TaskStatusIcon.d.ts +4 -5
- package/dist/src/components/navigation/MessengerShell.d.ts +1 -21
- package/dist/src/components/views/ChatView.d.ts +6 -18
- package/dist/src/components/views/HomeView.d.ts +0 -3
- package/dist/src/context/ChatContext.d.ts +2 -13
- package/dist/src/context/UIStateContext.d.ts +2 -10
- package/dist/src/context/sseReducer.d.ts +4 -2
- package/dist/src/design-system/component-tokens.d.ts +1 -8
- package/dist/src/design-system/semantic-tokens.d.ts +2 -7
- package/dist/src/hooks/useResize.d.ts +1 -1
- package/dist/src/hooks/useWidget.d.ts +4 -11
- package/dist/src/sdk/contract.d.ts +0 -10
- package/dist/src/sdk/contracts/activityLog.d.ts +0 -30
- package/dist/src/sdk/contracts/entities.d.ts +0 -15
- package/dist/src/sdk/index.d.ts +0 -10
- package/dist/src/services/ApiService.d.ts +4 -3
- package/dist/src/services/BrowserToolService.d.ts +0 -4
- package/dist/src/services/ChatService.d.ts +5 -5
- package/dist/src/services/DomService.d.ts +3 -23
- package/dist/src/services/ShowModeService.d.ts +1 -2
- package/dist/src/services/StorageService.d.ts +4 -3
- package/dist/src/services/StreamClient.d.ts +0 -2
- package/dist/src/types/index.d.ts +3 -10
- package/dist/src/utils/bootstrap.d.ts +1 -2
- package/dist/src/utils/chat.d.ts +5 -8
- package/dist/src/utils/color.d.ts +0 -2
- package/dist/src/utils/suggestedActions.d.ts +2 -5
- package/dist/widget.mjs +62 -60
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@ export declare class ChatService {
|
|
|
6
6
|
persist(snapshot: ChatSnapshot): void;
|
|
7
7
|
}
|
|
8
8
|
export declare const chatService: ChatService;
|
|
9
|
-
export declare
|
|
10
|
-
export declare
|
|
11
|
-
export declare
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
9
|
+
export declare const createUserMessage: (content: string, mode?: InstructionType, idPrefix?: string) => ChatMessage;
|
|
10
|
+
export declare const createAgentMessage: (content: string) => ChatMessage;
|
|
11
|
+
export declare const createSystemMessage: (content: string, mode: InstructionType, sender: "user" | "agent", idPrefix: string) => ChatMessage;
|
|
12
|
+
export declare const createScreenAccessRequestMessage: (mode?: InstructionType) => ChatMessage;
|
|
13
|
+
export declare const createScreenshareMessage: (stream: MediaStream, mode?: InstructionType) => ChatMessage;
|
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
export interface ElementFingerprint {
|
|
2
|
-
tagName: string;
|
|
3
|
-
id: string | null;
|
|
4
|
-
textContent: string | null;
|
|
5
|
-
type: string | null;
|
|
6
|
-
role: string | null;
|
|
7
|
-
ariaLabel: string | null;
|
|
8
|
-
name: string | null;
|
|
9
|
-
href: string | null;
|
|
10
|
-
selector: string;
|
|
11
|
-
indexVersion: number;
|
|
12
|
-
}
|
|
13
1
|
export interface ValidatedElementResult {
|
|
14
2
|
element: HTMLElement | null;
|
|
15
3
|
error?: string;
|
|
16
4
|
}
|
|
17
5
|
export declare class DomService {
|
|
18
|
-
private
|
|
6
|
+
private index;
|
|
19
7
|
private elementToSequence;
|
|
20
|
-
private selectorMap;
|
|
21
|
-
private fingerprintMap;
|
|
22
|
-
private indexingInProgress;
|
|
23
|
-
private indexVersion;
|
|
24
8
|
private generateSelector;
|
|
25
|
-
private
|
|
26
|
-
private matchesFingerprint;
|
|
27
|
-
private validateElementAtIndex;
|
|
9
|
+
private staleReason;
|
|
28
10
|
private indexInteractableElements;
|
|
29
|
-
|
|
30
|
-
private isStackingContext;
|
|
31
|
-
private calculateGlobalZOrder;
|
|
11
|
+
/** `data-id` is the whole contract: the agent parses the snapshot for `[data-id]` and reads nothing else off it. */
|
|
32
12
|
getSnapshotHtml(): string;
|
|
33
13
|
getSequenceForElement(element: Element): number | undefined;
|
|
34
14
|
private clearIndex;
|
|
@@ -14,7 +14,6 @@ export declare class ShowModeService {
|
|
|
14
14
|
private rejectPromise;
|
|
15
15
|
private clickHandler;
|
|
16
16
|
private scrollHandler;
|
|
17
|
-
private mutationObserver;
|
|
18
17
|
private visibilityCheckInterval;
|
|
19
18
|
showToolAction(options: ShowModeOptions): Promise<boolean>;
|
|
20
19
|
cleanup(): void;
|
|
@@ -26,7 +25,7 @@ export declare class ShowModeService {
|
|
|
26
25
|
private updatePopupPosition;
|
|
27
26
|
private setupClickHandler;
|
|
28
27
|
private setupContinueButton;
|
|
29
|
-
|
|
28
|
+
/** checkElementInteractable's first test is `document.body.contains`, so this one watchdog also covers removal. */
|
|
30
29
|
private setupVisibilityMonitoring;
|
|
31
30
|
private failWithElementGone;
|
|
32
31
|
private escapeHtml;
|
|
@@ -2,15 +2,14 @@ import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
|
|
|
2
2
|
export type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
|
|
3
3
|
timestamp: string;
|
|
4
4
|
};
|
|
5
|
-
/** The
|
|
5
|
+
/** The durable half of the widget's React state. `isLoading` is deliberately absent — restoring it would
|
|
6
|
+
* leave the FAB glowing for a request that died with the previous page. */
|
|
6
7
|
export interface ChatSnapshot {
|
|
7
8
|
messages: ChatMessage[];
|
|
8
9
|
isTaskRunning: boolean;
|
|
9
10
|
activeTaskId: string | null;
|
|
10
11
|
currentMode: InstructionType;
|
|
11
12
|
isOpen: boolean;
|
|
12
|
-
isMinimized: boolean;
|
|
13
|
-
isLoading: boolean;
|
|
14
13
|
}
|
|
15
14
|
export type MarketrixChatContext = Omit<ChatSnapshot, 'messages'> & {
|
|
16
15
|
chat_id: string | null;
|
|
@@ -18,6 +17,8 @@ export type MarketrixChatContext = Omit<ChatSnapshot, 'messages'> & {
|
|
|
18
17
|
config: MarketrixConfig | null;
|
|
19
18
|
timestamp: number;
|
|
20
19
|
};
|
|
20
|
+
export declare function readLocal(key: string): string | null;
|
|
21
|
+
export declare function writeLocal(key: string, value: string): void;
|
|
21
22
|
declare class StorageService {
|
|
22
23
|
private context;
|
|
23
24
|
getContext(): MarketrixChatContext;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type WidgetCommand, type WidgetEvent } from '../sdk';
|
|
2
2
|
export type StreamStatus = 'disconnected' | 'connecting' | 'connected' | 'registered' | 'error';
|
|
3
3
|
export interface StreamClientCallbacks {
|
|
4
|
-
onStatusChange?: (status: StreamStatus) => void;
|
|
5
4
|
onMessage?: (event: WidgetEvent) => void;
|
|
6
5
|
onError?: (error: Error) => void;
|
|
7
6
|
}
|
|
@@ -30,7 +29,6 @@ export declare class StreamClient {
|
|
|
30
29
|
private consumeEvents;
|
|
31
30
|
disconnect(): void;
|
|
32
31
|
send(command: WidgetCommand): Promise<void>;
|
|
33
|
-
private setStatus;
|
|
34
32
|
private notifyError;
|
|
35
33
|
private handleMessage;
|
|
36
34
|
private scheduleReconnect;
|
|
@@ -25,13 +25,13 @@ export interface ChatMessage {
|
|
|
25
25
|
isSystemMessage?: boolean;
|
|
26
26
|
isPlaceholder?: boolean;
|
|
27
27
|
placeholderState?: 'thinking' | 'waiting-for-user';
|
|
28
|
-
parts
|
|
29
|
-
taskStatus?: '
|
|
28
|
+
parts: MessagePart[];
|
|
29
|
+
taskStatus?: 'done' | 'failed' | 'stopped';
|
|
30
30
|
}
|
|
31
31
|
export interface MessagePart {
|
|
32
32
|
type: 'text' | 'progress';
|
|
33
33
|
content: string;
|
|
34
|
-
status?: 'in_progress' | 'completed' | 'failed'
|
|
34
|
+
status?: 'in_progress' | 'completed' | 'failed';
|
|
35
35
|
browserToolName?: string;
|
|
36
36
|
/** chat/delta fragments accumulate into this part; the final chat/response replaces it. */
|
|
37
37
|
streaming?: boolean;
|
|
@@ -39,21 +39,14 @@ export interface MessagePart {
|
|
|
39
39
|
export type WidgetView = 'home' | 'chat';
|
|
40
40
|
export interface WidgetState {
|
|
41
41
|
isOpen: boolean;
|
|
42
|
-
isMinimized: boolean;
|
|
43
42
|
isLoading: boolean;
|
|
44
43
|
messages: ChatMessage[];
|
|
45
44
|
currentMode: InstructionType;
|
|
46
|
-
agentAvailable: boolean;
|
|
47
45
|
error?: string;
|
|
48
46
|
activeTaskId: string | null;
|
|
49
47
|
isTaskRunning: boolean;
|
|
50
48
|
activeView: WidgetView;
|
|
51
49
|
}
|
|
52
|
-
export interface MessageDispatchRequest {
|
|
53
|
-
message?: string;
|
|
54
|
-
mode?: InstructionType;
|
|
55
|
-
requestId?: string;
|
|
56
|
-
}
|
|
57
50
|
export type WidgetPosition = WidgetSettingsData['widget_position'];
|
|
58
51
|
export type AddWidgetConfig = ({
|
|
59
52
|
settings: WidgetSettingsData;
|
|
@@ -3,9 +3,8 @@ import type { MarketrixConfig } from '../types';
|
|
|
3
3
|
export declare const widgetState: {
|
|
4
4
|
instance: Root | null;
|
|
5
5
|
config: MarketrixConfig | null;
|
|
6
|
-
programmaticInit: boolean;
|
|
7
6
|
};
|
|
8
|
-
export declare const createWidgetContainer: (parentContainer?: HTMLElement
|
|
7
|
+
export declare const createWidgetContainer: (parentContainer?: HTMLElement) => {
|
|
9
8
|
container: HTMLElement;
|
|
10
9
|
shadowRoot: ShadowRoot;
|
|
11
10
|
mountEl: HTMLElement;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import type { ChatMessage, InstructionType } from '../types';
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export declare function hasThinkingMarker(content: string): boolean;
|
|
5
|
-
export declare function addThinkingMarker(content: string): string;
|
|
2
|
+
export declare const getModeDisplayName: (mode: InstructionType) => string;
|
|
3
|
+
export declare const formatMessageTime: (date: Date | undefined) => string;
|
|
6
4
|
export interface FindMessageOptions {
|
|
7
5
|
messages: ChatMessage[];
|
|
8
6
|
isTaskRunning: boolean;
|
|
9
7
|
currentMode: InstructionType;
|
|
10
|
-
requireContent?: boolean;
|
|
11
8
|
}
|
|
12
9
|
/** Ranked predicates: the first rank matching anything wins, and within it the newest message. */
|
|
13
|
-
export declare function findMessageForProgress({ messages, isTaskRunning, currentMode,
|
|
10
|
+
export declare function findMessageForProgress({ messages, isTaskRunning, currentMode, }: FindMessageOptions): {
|
|
14
11
|
index: number;
|
|
15
12
|
message: ChatMessage;
|
|
16
13
|
} | null;
|
|
17
14
|
export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
15
|
+
export declare function filterCancellationText(content: string): string;
|
|
18
16
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
19
|
-
export declare
|
|
17
|
+
export declare const markProgressLineComplete: (message: ChatMessage) => ChatMessage;
|
|
20
18
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
21
|
-
export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
|
|
22
19
|
/** Tool id -> the phrase shown in the activity log. Also the allowlist of tools the agent may call. */
|
|
23
20
|
export declare const BROWSER_TOOLS: Map<string, string>;
|
|
24
21
|
export declare function getFriendlyToolName(browserToolName: string): string;
|
|
@@ -6,5 +6,3 @@ export declare function hexToRgb(hex: string): {
|
|
|
6
6
|
export declare function getContrastingColor(color: string): string;
|
|
7
7
|
export declare function addOpacity(color: string, opacity: number): string;
|
|
8
8
|
export declare function darkenColor(color: string, amount: number): string;
|
|
9
|
-
export declare const formatMessageTime: (date: Date | undefined) => string;
|
|
10
|
-
export declare const getModeDisplayName: (mode: "show" | "tell" | "do") => string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { MarketrixConfig } from '../types';
|
|
1
|
+
import type { InstructionType, MarketrixConfig } from '../types';
|
|
3
2
|
export interface SuggestedActionItem {
|
|
4
3
|
id: string;
|
|
5
4
|
text: string;
|
|
6
|
-
|
|
7
|
-
type: 'tell' | 'show' | 'do';
|
|
8
|
-
isShow: boolean;
|
|
5
|
+
type: InstructionType;
|
|
9
6
|
}
|
|
10
7
|
export declare function getSuggestedActionsFromConfig(config: MarketrixConfig): SuggestedActionItem[];
|