@spscommerce/max 0.12.0 → 0.13.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/lib/api-service.d.ts +8 -1
- package/lib/components/AgentMessage.d.ts +2 -2
- package/lib/components/ToolApprovalPrompt.d.ts +13 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/hooks/useMaxChat.d.ts +2 -1
- package/lib/index.js +8624 -8402
- package/lib/index.umd.cjs +112 -112
- package/lib/models/Chat.d.ts +16 -1
- package/lib/models/Conversation.d.ts +12 -0
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/lib/api-service.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export declare class AgentApiService {
|
|
|
8
8
|
private readonly axios;
|
|
9
9
|
private token;
|
|
10
10
|
private socket;
|
|
11
|
+
private socketAwaitingApproval;
|
|
11
12
|
constructor(env: string, token?: string | null);
|
|
12
13
|
setToken(token?: string | null): void;
|
|
13
14
|
getSocket(): WebSocket | null;
|
|
15
|
+
private detachSocket;
|
|
14
16
|
fetchConversationMessages: (conversationId: string, options?: {
|
|
15
17
|
cursor?: string;
|
|
16
18
|
limit?: number;
|
|
@@ -20,5 +22,10 @@ export declare class AgentApiService {
|
|
|
20
22
|
deleteConversation: (conversationId: string) => Promise<void>;
|
|
21
23
|
postFeedback: (messageId: string, score: string, comment: string) => Promise<void>;
|
|
22
24
|
fetchUsageStatus: (userId: string) => Promise<UsageStatus>;
|
|
23
|
-
postChat(message: string, currentAppName: string, currentConversationId: string | null, agentContext: AdditionalContext, currentUrl: string, appInitiated: boolean, userTimezone: string | null): Promise<
|
|
25
|
+
postChat(message: string, currentAppName: string, currentConversationId: string | null, agentContext: AdditionalContext, currentUrl: string, appInitiated: boolean, userTimezone: string | null): Promise<number>;
|
|
26
|
+
respondToApproval(decisions: Array<{
|
|
27
|
+
tool_call_id: string;
|
|
28
|
+
type: "approve" | "reject";
|
|
29
|
+
}>, conversationId: string | null): void;
|
|
30
|
+
private openSocket;
|
|
24
31
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ChatMessage } from "../models/Chat";
|
|
3
3
|
import { Message } from "../models/Conversation";
|
|
4
4
|
interface AgentMessageProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
-
message?:
|
|
6
|
+
message?: ChatMessage;
|
|
7
7
|
sendFeedback?: (messageId: string, score: string, comment: string) => void;
|
|
8
8
|
fetchMessagePair?: (messageId: string) => Promise<Message | undefined>;
|
|
9
9
|
handleSendMessage?: (message: string | undefined) => Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ToolApprovalStatus } from "../models/Chat";
|
|
3
|
+
interface ToolApprovalPromptProps {
|
|
4
|
+
toolName: string;
|
|
5
|
+
toolInput?: Record<string, unknown>;
|
|
6
|
+
status: ToolApprovalStatus;
|
|
7
|
+
source: "live" | "history";
|
|
8
|
+
onApprove: () => void;
|
|
9
|
+
onReject: () => void;
|
|
10
|
+
onRetry?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function ToolApprovalPrompt({ toolName, toolInput, status, onApprove, onReject, onRetry, }: ToolApprovalPromptProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -23,7 +23,8 @@ export declare function useMaxChat(agentApi: AgentApiService, context: Additiona
|
|
|
23
23
|
fetchConversationList: () => Promise<void>;
|
|
24
24
|
sendFeedback: (messageId: string, score: string, comment: string) => Promise<void>;
|
|
25
25
|
fetchMessagePair: (messageId: string) => Promise<Message | undefined>;
|
|
26
|
-
retrySendMessage: () => Promise<void>;
|
|
26
|
+
retrySendMessage: (messageOverride?: string) => Promise<void>;
|
|
27
|
+
respondToToolApproval: (toolCallId: string, approved: boolean, conversationId?: string) => void;
|
|
27
28
|
messageHasBeenSent: boolean;
|
|
28
29
|
fetchUsageStatus: () => Promise<import("../models/UsageStatus").UserStatus | undefined>;
|
|
29
30
|
doesUserHaveAgentPerms: () => boolean;
|