@marketrix.ai/widget 3.8.242 → 3.8.246
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/chat/TaskStatusIcon.d.ts +6 -0
- package/dist/src/components/navigation/MessengerShell.d.ts +1 -1
- package/dist/src/components/views/ChatView.d.ts +1 -1
- package/dist/src/context/ChatContext.d.ts +4 -4
- package/dist/src/context/sseReducer.d.ts +2 -2
- package/dist/src/hooks/useWidget.d.ts +2 -2
- package/dist/src/sdk/contract.d.ts +0 -2
- package/dist/src/sdk/contracts/widget.d.ts +0 -5
- package/dist/src/sdk/index.d.ts +0 -2
- package/dist/src/services/ApiService.d.ts +2 -2
- package/dist/src/services/ChatService.d.ts +2 -2
- package/dist/src/services/StorageService.d.ts +4 -4
- package/dist/src/types/index.d.ts +3 -14
- package/dist/src/utils/chat.d.ts +2 -2
- package/dist/widget.mjs +62 -62
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/src/components/chat/SimulationStatusIcon.d.ts +0 -6
|
@@ -6,7 +6,7 @@ export interface MessengerShellProps {
|
|
|
6
6
|
isMinimized: boolean;
|
|
7
7
|
messages: ChatMessage[];
|
|
8
8
|
currentMode: InstructionType;
|
|
9
|
-
|
|
9
|
+
isTaskRunning?: boolean;
|
|
10
10
|
activeView: WidgetView;
|
|
11
11
|
onClose: () => void;
|
|
12
12
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
@@ -5,7 +5,7 @@ export interface ChatViewProps {
|
|
|
5
5
|
config: MarketrixConfig;
|
|
6
6
|
messages: ChatMessage[];
|
|
7
7
|
currentMode: InstructionType;
|
|
8
|
-
|
|
8
|
+
isTaskRunning?: boolean;
|
|
9
9
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
10
10
|
onSetMode: (mode: InstructionType) => void;
|
|
11
11
|
onAddMessage: (message: ChatMessage) => void;
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
import type { UIStateActions } from './UIStateContext';
|
|
4
4
|
export interface SimulationState {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
activeTaskId: string | null;
|
|
6
|
+
isTaskRunning: boolean;
|
|
7
7
|
}
|
|
8
8
|
export interface ChatState {
|
|
9
9
|
messages: ChatMessage[];
|
|
@@ -18,8 +18,8 @@ export interface ChatActions {
|
|
|
18
18
|
}
|
|
19
19
|
export interface SimulationActions {
|
|
20
20
|
setTaskState: (payload: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
activeTaskId: string | null;
|
|
22
|
+
isTaskRunning: boolean;
|
|
23
23
|
}) => void;
|
|
24
24
|
stopTask: () => Promise<void>;
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { WidgetEvent } from '../sdk';
|
|
2
2
|
import type { ChatMessage, InstructionType } from '../types';
|
|
3
3
|
export interface SseSimulationState {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
activeTaskId: string | null;
|
|
5
|
+
isTaskRunning: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface SseState {
|
|
8
8
|
messages: ChatMessage[];
|
|
@@ -13,8 +13,8 @@ interface UseWidgetActions {
|
|
|
13
13
|
setError: (error: string | undefined) => void;
|
|
14
14
|
clearError: () => void;
|
|
15
15
|
setTaskState: (payload: {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
activeTaskId: string | null;
|
|
17
|
+
isTaskRunning: boolean;
|
|
18
18
|
}) => void;
|
|
19
19
|
addMessage: (message: ChatMessage) => void;
|
|
20
20
|
updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
@@ -399,7 +399,6 @@ export declare const widgetContract: {
|
|
|
399
399
|
args: Record<string, unknown>;
|
|
400
400
|
mode?: "show" | "do" | undefined;
|
|
401
401
|
explanation?: string | undefined;
|
|
402
|
-
state_version?: number | undefined;
|
|
403
402
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
404
403
|
type: "registered";
|
|
405
404
|
chat_id: string;
|
|
@@ -431,6 +430,5 @@ export declare const widgetContract: {
|
|
|
431
430
|
args: Record<string, unknown>;
|
|
432
431
|
mode?: "show" | "do" | undefined;
|
|
433
432
|
explanation?: string | undefined;
|
|
434
|
-
state_version?: number | undefined;
|
|
435
433
|
}, unknown, void>>, Record<never, never>, Record<never, never>>;
|
|
436
434
|
};
|
|
@@ -255,7 +255,6 @@ export declare const WidgetEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
255
255
|
do: "do";
|
|
256
256
|
}>>;
|
|
257
257
|
explanation: z.ZodOptional<z.ZodString>;
|
|
258
|
-
state_version: z.ZodOptional<z.ZodNumber>;
|
|
259
258
|
}, z.core.$strip>], "type">;
|
|
260
259
|
export type WidgetEvent = z.infer<typeof WidgetEventSchema>;
|
|
261
260
|
/** Widget → Server commands. */
|
|
@@ -730,7 +729,6 @@ export declare const widgetStream: import("@orpc/contract").ContractProcedureBui
|
|
|
730
729
|
args: Record<string, unknown>;
|
|
731
730
|
mode?: "show" | "do" | undefined;
|
|
732
731
|
explanation?: string | undefined;
|
|
733
|
-
state_version?: number | undefined;
|
|
734
732
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
735
733
|
type: "registered";
|
|
736
734
|
chat_id: string;
|
|
@@ -762,7 +760,6 @@ export declare const widgetStream: import("@orpc/contract").ContractProcedureBui
|
|
|
762
760
|
args: Record<string, unknown>;
|
|
763
761
|
mode?: "show" | "do" | undefined;
|
|
764
762
|
explanation?: string | undefined;
|
|
765
|
-
state_version?: number | undefined;
|
|
766
763
|
}, unknown, void>>, Record<never, never>, Record<never, never>>;
|
|
767
764
|
export declare const widgetMessage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
768
765
|
chat_id: z.ZodString;
|
|
@@ -1241,7 +1238,6 @@ export declare const widgetRoutes: {
|
|
|
1241
1238
|
args: Record<string, unknown>;
|
|
1242
1239
|
mode?: "show" | "do" | undefined;
|
|
1243
1240
|
explanation?: string | undefined;
|
|
1244
|
-
state_version?: number | undefined;
|
|
1245
1241
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
1246
1242
|
type: "registered";
|
|
1247
1243
|
chat_id: string;
|
|
@@ -1273,7 +1269,6 @@ export declare const widgetRoutes: {
|
|
|
1273
1269
|
args: Record<string, unknown>;
|
|
1274
1270
|
mode?: "show" | "do" | undefined;
|
|
1275
1271
|
explanation?: string | undefined;
|
|
1276
|
-
state_version?: number | undefined;
|
|
1277
1272
|
}, unknown, void>>, Record<never, never>, Record<never, never>>;
|
|
1278
1273
|
widgetMessage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1279
1274
|
chat_id: z.ZodString;
|
package/dist/src/sdk/index.d.ts
CHANGED
|
@@ -404,7 +404,6 @@ export declare const sdk: {
|
|
|
404
404
|
args: Record<string, unknown>;
|
|
405
405
|
mode?: "show" | "do" | undefined;
|
|
406
406
|
explanation?: string | undefined;
|
|
407
|
-
state_version?: number | undefined;
|
|
408
407
|
}, unknown, void>, import("@orpc/shared").AsyncIteratorClass<{
|
|
409
408
|
type: "registered";
|
|
410
409
|
chat_id: string;
|
|
@@ -436,7 +435,6 @@ export declare const sdk: {
|
|
|
436
435
|
args: Record<string, unknown>;
|
|
437
436
|
mode?: "show" | "do" | undefined;
|
|
438
437
|
explanation?: string | undefined;
|
|
439
|
-
state_version?: number | undefined;
|
|
440
438
|
}, unknown, void>>, Record<never, never>>;
|
|
441
439
|
} & {
|
|
442
440
|
setAuthToken: (token: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MarketrixConfig, MessageDispatchRequest
|
|
1
|
+
import type { MarketrixConfig, MessageDispatchRequest } from '../types';
|
|
2
2
|
export declare class ApiService {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config: MarketrixConfig);
|
|
@@ -7,6 +7,6 @@ export declare class ApiService {
|
|
|
7
7
|
private getUserId;
|
|
8
8
|
logWidgetQuestion(question: string, mode: string): Promise<void>;
|
|
9
9
|
/** Fire-and-forget send over the typed stream; the reply arrives asynchronously as a chat/response event. */
|
|
10
|
-
messageDispatch(request: MessageDispatchRequest): Promise<
|
|
10
|
+
messageDispatch(request: MessageDispatchRequest): Promise<void>;
|
|
11
11
|
updateConfig(newConfig: Partial<MarketrixConfig>): void;
|
|
12
12
|
}
|
|
@@ -2,8 +2,8 @@ import type { ChatMessage, InstructionType } from '../types';
|
|
|
2
2
|
/** Widget state persisted to / restored from localStorage; React context is the runtime source of truth. */
|
|
3
3
|
export interface ChatSnapshot {
|
|
4
4
|
messages: ChatMessage[];
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
isTaskRunning: boolean;
|
|
6
|
+
activeTaskId: string | null;
|
|
7
7
|
currentMode: InstructionType;
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
isMinimized: boolean;
|
|
@@ -13,8 +13,8 @@ type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
|
|
|
13
13
|
export interface MarketrixChatContext {
|
|
14
14
|
chat_id: string | null;
|
|
15
15
|
messages: StoredMessage[];
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
isTaskRunning: boolean;
|
|
17
|
+
activeTaskId: string | null;
|
|
18
18
|
currentMode: InstructionType;
|
|
19
19
|
isOpen: boolean;
|
|
20
20
|
isMinimized: boolean;
|
|
@@ -39,8 +39,8 @@ declare class StorageService {
|
|
|
39
39
|
setChatId(chatId: string | null): void;
|
|
40
40
|
getMessages(): StoredMessage[];
|
|
41
41
|
setMessages(messages: StoredMessage[]): void;
|
|
42
|
-
getChatState(): Pick<MarketrixChatContext, '
|
|
43
|
-
setChatState(state: Partial<Pick<MarketrixChatContext, '
|
|
42
|
+
getChatState(): Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>;
|
|
43
|
+
setChatState(state: Partial<Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>>): void;
|
|
44
44
|
getConfig(): MarketrixConfig | null;
|
|
45
45
|
setConfig(config: MarketrixConfig | null): void;
|
|
46
46
|
clear(): void;
|
|
@@ -30,7 +30,7 @@ export interface ChatMessage {
|
|
|
30
30
|
isPlaceholder?: boolean;
|
|
31
31
|
placeholderState?: 'thinking' | 'waiting-for-user';
|
|
32
32
|
parts?: MessagePart[];
|
|
33
|
-
|
|
33
|
+
taskStatus?: 'ongoing' | 'done' | 'failed' | 'stopped';
|
|
34
34
|
}
|
|
35
35
|
export interface MessagePart {
|
|
36
36
|
type: 'text' | 'progress';
|
|
@@ -52,26 +52,15 @@ export interface WidgetState {
|
|
|
52
52
|
currentMode: InstructionType;
|
|
53
53
|
agentAvailable: boolean;
|
|
54
54
|
error?: string;
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
activeTaskId: string | null;
|
|
56
|
+
isTaskRunning: boolean;
|
|
57
57
|
activeView: WidgetView;
|
|
58
58
|
}
|
|
59
59
|
export interface MessageDispatchRequest {
|
|
60
60
|
message?: string;
|
|
61
61
|
mode?: InstructionType;
|
|
62
|
-
mtxId?: string;
|
|
63
|
-
mtxKey?: string;
|
|
64
|
-
application_id?: number;
|
|
65
|
-
question?: string;
|
|
66
62
|
requestId?: string;
|
|
67
63
|
}
|
|
68
|
-
export interface MessageDispatchResponse {
|
|
69
|
-
messageId: string;
|
|
70
|
-
response: string;
|
|
71
|
-
mode: InstructionType;
|
|
72
|
-
timestamp: Date;
|
|
73
|
-
task_id?: string;
|
|
74
|
-
}
|
|
75
64
|
export type WidgetPosition = WidgetSettingsData['widget_position'];
|
|
76
65
|
export type AddWidgetConfig = ({
|
|
77
66
|
settings: WidgetSettingsData;
|
package/dist/src/utils/chat.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function hasThinkingMarker(content: string): boolean;
|
|
|
5
5
|
export declare function addThinkingMarker(content: string): string;
|
|
6
6
|
export interface FindMessageOptions {
|
|
7
7
|
messages: ChatMessage[];
|
|
8
|
-
|
|
8
|
+
isTaskRunning: boolean;
|
|
9
9
|
currentMode: InstructionType;
|
|
10
10
|
requireContent?: boolean;
|
|
11
11
|
}
|
|
@@ -17,6 +17,6 @@ export declare const WAIT_FOR_USER_TOOLS: Set<string>;
|
|
|
17
17
|
export declare function addProgressLine(message: ChatMessage, browserToolName: string, explanation: string): ChatMessage;
|
|
18
18
|
export declare function markProgressLineComplete(message: ChatMessage, browserToolName?: string): ChatMessage;
|
|
19
19
|
export declare function markProgressLineFailed(message: ChatMessage, browserToolName: string, error: string): ChatMessage;
|
|
20
|
-
export declare function updateThinkingMarker(message: ChatMessage,
|
|
20
|
+
export declare function updateThinkingMarker(message: ChatMessage, isTaskRunning: boolean, currentMode: 'show' | 'tell' | 'do', isWaitingForUser?: boolean): ChatMessage;
|
|
21
21
|
export declare const TOOL_NAME_MAPPING: Record<string, string>;
|
|
22
22
|
export declare function getFriendlyToolName(browserToolName: string): string;
|