@sciol/xyzen 0.2.0 → 0.2.2
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/components/base/LoadingSpinner.d.ts +2 -1
- package/dist/components/base/Modal.d.ts +2 -1
- package/dist/components/layouts/XyzenAgent.d.ts +1 -0
- package/dist/components/layouts/components/ChatBubble.d.ts +1 -8
- package/dist/components/layouts/components/LoadingMessage.d.ts +5 -0
- package/dist/components/layouts/components/ToolCallCard.d.ts +9 -0
- package/dist/components/modals/ToolTestModal.d.ts +10 -0
- package/dist/configs/index.d.ts +1 -1
- package/dist/service/mcpService.d.ts +1 -0
- package/dist/service/xyzenService.d.ts +22 -1
- package/dist/store/slices/chatSlice.d.ts +2 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/slices/mcpSlice.d.ts +1 -0
- package/dist/store/slices/mcpToolSlice.d.ts +36 -0
- package/dist/store/types.d.ts +18 -3
- package/dist/xyzen.es.js +16560 -15358
- package/dist/xyzen.umd.js +68 -62
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface LoadingSpinnerProps {
|
|
2
2
|
size?: "sm" | "md" | "lg";
|
|
3
3
|
className?: string;
|
|
4
|
+
centered?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare function LoadingSpinner({ size, className, }: LoadingSpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function LoadingSpinner({ size, className, centered, }: LoadingSpinnerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -4,6 +4,7 @@ interface ModalProps {
|
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
title: string;
|
|
6
6
|
children: ReactNode;
|
|
7
|
+
maxWidth?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare function Modal({ isOpen, onClose, title, children }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function Modal({ isOpen, onClose, title, children, maxWidth, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
+
import { Message } from '../../../store/types';
|
|
1
2
|
import { default as React } from 'react';
|
|
2
|
-
export interface Message {
|
|
3
|
-
id: string;
|
|
4
|
-
role: "user" | "assistant" | "system" | "tool";
|
|
5
|
-
content: string;
|
|
6
|
-
created_at: string;
|
|
7
|
-
avatar?: string;
|
|
8
|
-
isCurrentUser?: boolean;
|
|
9
|
-
}
|
|
10
3
|
interface ChatBubbleProps {
|
|
11
4
|
message: Message;
|
|
12
5
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToolCall } from '../../../store/types';
|
|
2
|
+
interface ToolCallCardProps {
|
|
3
|
+
toolCall: ToolCall;
|
|
4
|
+
className?: string;
|
|
5
|
+
onConfirm?: (toolCallId: string) => void;
|
|
6
|
+
onCancel?: (toolCallId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export default function ToolCallCard({ toolCall, className, onConfirm, onCancel, }: ToolCallCardProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { McpServer } from '../../types/mcp';
|
|
2
|
+
interface ToolTestModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
server: McpServer;
|
|
6
|
+
toolName: string;
|
|
7
|
+
toolDescription?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ToolTestModal: React.FC<ToolTestModalProps>;
|
|
10
|
+
export {};
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const DEFAULT_BACKEND_URL
|
|
1
|
+
export declare const DEFAULT_BACKEND_URL: any;
|
|
@@ -3,15 +3,36 @@ interface StatusChangePayload {
|
|
|
3
3
|
connected: boolean;
|
|
4
4
|
error: string | null;
|
|
5
5
|
}
|
|
6
|
+
interface MessageEvent {
|
|
7
|
+
type: "message" | "loading" | "streaming_start" | "streaming_chunk" | "streaming_end" | "message_saved" | "tool_call_request" | "tool_call_response" | "error";
|
|
8
|
+
data: Message | {
|
|
9
|
+
id: string;
|
|
10
|
+
content?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
stream_id?: string;
|
|
13
|
+
db_id?: string;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
arguments?: Record<string, unknown>;
|
|
18
|
+
status?: string;
|
|
19
|
+
timestamp?: number;
|
|
20
|
+
toolCallId?: string;
|
|
21
|
+
confirmed?: boolean;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
6
24
|
type ServiceCallback<T> = (payload: T) => void;
|
|
25
|
+
type MessageEventCallback = (event: MessageEvent) => void;
|
|
7
26
|
declare class XyzenService {
|
|
8
27
|
private ws;
|
|
9
28
|
private onMessageCallback;
|
|
29
|
+
private onMessageEventCallback;
|
|
10
30
|
private onStatusChangeCallback;
|
|
11
31
|
private backendUrl;
|
|
12
32
|
setBackendUrl(url: string): void;
|
|
13
|
-
connect(sessionId: string, topicId: string, onMessage: ServiceCallback<Message>, onStatusChange: ServiceCallback<StatusChangePayload
|
|
33
|
+
connect(sessionId: string, topicId: string, onMessage: ServiceCallback<Message>, onStatusChange: ServiceCallback<StatusChangePayload>, onMessageEvent?: MessageEventCallback): void;
|
|
14
34
|
sendMessage(message: string): void;
|
|
35
|
+
sendStructuredMessage(data: Record<string, unknown>): void;
|
|
15
36
|
disconnect(): void;
|
|
16
37
|
}
|
|
17
38
|
declare const xyzenService: XyzenService;
|
|
@@ -14,6 +14,8 @@ export interface ChatSlice {
|
|
|
14
14
|
sendMessage: (message: string) => void;
|
|
15
15
|
createDefaultChannel: (agentId?: string) => Promise<void>;
|
|
16
16
|
updateTopicName: (topicId: string, newName: string) => Promise<void>;
|
|
17
|
+
confirmToolCall: (channelId: string, toolCallId: string) => void;
|
|
18
|
+
cancelToolCall: (channelId: string, toolCallId: string) => void;
|
|
17
19
|
}
|
|
18
20
|
export declare const createChatSlice: StateCreator<XyzenState, [
|
|
19
21
|
["zustand/immer", never]
|
|
@@ -4,6 +4,7 @@ import { XyzenState } from '../types';
|
|
|
4
4
|
export interface McpSlice {
|
|
5
5
|
mcpServers: McpServer[];
|
|
6
6
|
fetchMcpServers: () => Promise<void>;
|
|
7
|
+
refreshMcpServers: () => Promise<void>;
|
|
7
8
|
addMcpServer: (server: McpServerCreate) => Promise<void>;
|
|
8
9
|
editMcpServer: (id: string, server: Partial<McpServerCreate>) => Promise<void>;
|
|
9
10
|
removeMcpServer: (id: string) => Promise<void>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { McpServer } from '../../types/mcp';
|
|
2
|
+
import { StateCreator } from 'zustand';
|
|
3
|
+
import { XyzenState } from '../types';
|
|
4
|
+
export interface McpToolState {
|
|
5
|
+
toolTestModal: {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
server?: McpServer;
|
|
8
|
+
toolName?: string;
|
|
9
|
+
toolDescription?: string;
|
|
10
|
+
};
|
|
11
|
+
toolExecutionHistory: ToolExecution[];
|
|
12
|
+
}
|
|
13
|
+
export interface ToolExecution {
|
|
14
|
+
id: string;
|
|
15
|
+
serverId: string;
|
|
16
|
+
toolName: string;
|
|
17
|
+
parameters: Record<string, unknown>;
|
|
18
|
+
result?: unknown;
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
executionTime: number;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
}
|
|
24
|
+
export interface McpToolActions {
|
|
25
|
+
openToolTestModal: (server: McpServer, toolName: string, toolDescription?: string) => void;
|
|
26
|
+
closeToolTestModal: () => void;
|
|
27
|
+
addToolExecution: (execution: Omit<ToolExecution, "id" | "timestamp">) => void;
|
|
28
|
+
clearToolExecutionHistory: () => void;
|
|
29
|
+
getToolExecutionHistory: (serverId?: string, toolName?: string) => ToolExecution[];
|
|
30
|
+
}
|
|
31
|
+
export interface McpToolSlice extends McpToolState, McpToolActions {
|
|
32
|
+
}
|
|
33
|
+
export declare const createMcpToolSlice: StateCreator<XyzenState, [
|
|
34
|
+
["zustand/immer", never]
|
|
35
|
+
], [
|
|
36
|
+
], McpToolSlice>;
|
package/dist/store/types.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { AgentSlice, AuthSlice, ChatSlice, LoadingSlice, McpSlice, ProviderSlice, UiSlice } from './slices';
|
|
1
|
+
import { AgentSlice, AuthSlice, ChatSlice, LoadingSlice, McpSlice, McpToolSlice, ProviderSlice, UiSlice } from './slices';
|
|
2
|
+
export interface ToolCall {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
arguments: Record<string, unknown>;
|
|
7
|
+
status: "pending" | "waiting_confirmation" | "executing" | "completed" | "failed";
|
|
8
|
+
result?: string;
|
|
9
|
+
error?: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
}
|
|
2
12
|
export interface Message {
|
|
3
13
|
id: string;
|
|
4
14
|
content: string;
|
|
@@ -6,13 +16,17 @@ export interface Message {
|
|
|
6
16
|
created_at: string;
|
|
7
17
|
sender?: "user" | "assistant" | "system";
|
|
8
18
|
timestamp?: string;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
isStreaming?: boolean;
|
|
21
|
+
toolCalls?: ToolCall[];
|
|
22
|
+
isToolCalling?: boolean;
|
|
9
23
|
}
|
|
10
24
|
export interface ChatChannel {
|
|
11
25
|
id: string;
|
|
12
26
|
sessionId: string;
|
|
13
27
|
title: string;
|
|
14
28
|
messages: Message[];
|
|
15
|
-
|
|
29
|
+
agentId?: string;
|
|
16
30
|
connected: boolean;
|
|
17
31
|
error: string | null;
|
|
18
32
|
}
|
|
@@ -39,6 +53,7 @@ export interface SessionResponse {
|
|
|
39
53
|
id: string;
|
|
40
54
|
name: string;
|
|
41
55
|
user_id: string;
|
|
56
|
+
agent_id?: string;
|
|
42
57
|
topics: TopicResponse[];
|
|
43
58
|
}
|
|
44
|
-
export type XyzenState = UiSlice & ChatSlice & AgentSlice & McpSlice & ProviderSlice & AuthSlice & LoadingSlice;
|
|
59
|
+
export type XyzenState = UiSlice & ChatSlice & AgentSlice & McpSlice & McpToolSlice & ProviderSlice & AuthSlice & LoadingSlice;
|