@sciol/xyzen 0.3.9 → 0.3.11

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.
Files changed (52) hide show
  1. package/README.md +154 -77
  2. package/dist/app/AppSide.d.ts +3 -1
  3. package/dist/app/auth/AuthErrorScreen.d.ts +6 -0
  4. package/dist/components/animate-ui/components/animate/tabs.d.ts +12 -0
  5. package/dist/components/animate-ui/components/buttons/button.d.ts +2 -2
  6. package/dist/components/animate-ui/components/buttons/flip.d.ts +10 -0
  7. package/dist/components/animate-ui/components/buttons/github-stars.d.ts +1 -1
  8. package/dist/components/animate-ui/components/radix/progress.d.ts +4 -0
  9. package/dist/components/animate-ui/primitives/animate/github-stars.d.ts +1 -2
  10. package/dist/components/animate-ui/primitives/animate/tabs.d.ts +51 -0
  11. package/dist/components/animate-ui/primitives/buttons/flip.d.ts +18 -0
  12. package/dist/components/animate-ui/primitives/effects/highlight.d.ts +1 -2
  13. package/dist/components/animate-ui/primitives/headless/checkbox.d.ts +1 -2
  14. package/dist/components/animate-ui/primitives/radix/dropdown-menu.d.ts +1 -3
  15. package/dist/components/animate-ui/primitives/radix/progress.d.ts +292 -0
  16. package/dist/components/features/NeedAuthBadge.d.ts +1 -0
  17. package/dist/components/features/ToggleSidePanelShortcutHint.d.ts +1 -0
  18. package/dist/components/layouts/XyzenAgent.d.ts +0 -26
  19. package/dist/components/layouts/components/SessionHistory.d.ts +2 -1
  20. package/dist/components/modals/EditAgentModal.d.ts +1 -1
  21. package/dist/components/ui/button.d.ts +2 -2
  22. package/dist/configs/common.d.ts +4 -0
  23. package/dist/configs/index.d.ts +2 -0
  24. package/dist/constants/defaultMcps.d.ts +32 -0
  25. package/dist/core/auth.d.ts +19 -0
  26. package/dist/hooks/useAuth.d.ts +5 -9
  27. package/dist/hooks/useWorkShopChat.d.ts +1 -1
  28. package/dist/hooks/useXyzenChat.d.ts +1 -1
  29. package/dist/marketplace/components/SmitheryServerDetail.d.ts +7 -0
  30. package/dist/marketplace/hooks/useSmitheryMcp.d.ts +29 -0
  31. package/dist/marketplace/index.d.ts +3 -0
  32. package/dist/marketplace/services/smitheryService.d.ts +6 -0
  33. package/dist/marketplace/types/smithery.d.ts +64 -0
  34. package/dist/service/authService.d.ts +8 -24
  35. package/dist/service/http/client.d.ts +1 -0
  36. package/dist/service/mcpService.d.ts +1 -0
  37. package/dist/store/slices/agentSlice.d.ts +18 -1
  38. package/dist/store/slices/{authSlice.d.ts → authSlice/index.d.ts} +4 -4
  39. package/dist/store/slices/chatSlice.d.ts +15 -0
  40. package/dist/store/slices/index.d.ts +1 -1
  41. package/dist/store/slices/mcpSlice.d.ts +1 -0
  42. package/dist/store/slices/{uiSlice.d.ts → uiSlice/index.d.ts} +2 -1
  43. package/dist/store/slices/uiSlice/types.d.ts +6 -0
  44. package/dist/store/types.d.ts +0 -1
  45. package/dist/types/agents.d.ts +60 -0
  46. package/dist/types/mcp.d.ts +17 -2
  47. package/dist/utils/__tests__/auth.test.d.ts +1 -0
  48. package/dist/utils/auth.d.ts +17 -0
  49. package/dist/xyzen.css +1 -1
  50. package/dist/xyzen.es.js +47638 -46529
  51. package/dist/xyzen.umd.js +153 -139
  52. package/package.json +5 -3
@@ -5,5 +5,6 @@ export declare const mcpService: {
5
5
  updateMcpServer(id: string, server: McpServerUpdate): Promise<McpServer>;
6
6
  deleteMcpServer(id: string): Promise<void>;
7
7
  refreshMcpServers(): Promise<void>;
8
+ activateSmitheryServer(qualifiedName: string, profile?: string): Promise<McpServer>;
8
9
  getBuiltinMcpServers(): Promise<unknown[]>;
9
10
  };
@@ -1,4 +1,4 @@
1
- import { Agent } from '../../components/layouts/XyzenAgent';
1
+ import { Agent } from '../../types/agents';
2
2
  import { StateCreator } from 'zustand';
3
3
  import { XyzenState } from '../types';
4
4
  export interface AgentSlice {
@@ -17,6 +17,8 @@ export interface AgentSlice {
17
17
  fetchSystemAgents: () => Promise<void>;
18
18
  getSystemChatAgent: () => Promise<Agent>;
19
19
  getSystemWorkshopAgent: () => Promise<Agent>;
20
+ syncSystemAgentMcps: () => Promise<void>;
21
+ isCreatingAgent: boolean;
20
22
  createAgent: (agent: Omit<Agent, "id">) => Promise<void>;
21
23
  createGraphAgent: (graphAgent: GraphAgentCreate) => Promise<void>;
22
24
  updateAgent: (agent: Agent) => Promise<void>;
@@ -29,6 +31,21 @@ export interface AgentSlice {
29
31
  getRegularAgents: () => Agent[];
30
32
  getGraphAgents: () => Agent[];
31
33
  getSystemAgents: () => Agent[];
34
+ getAgentStats: () => {
35
+ total: number;
36
+ regular: number;
37
+ graph: number;
38
+ system: number;
39
+ regularAgents: {
40
+ id: string;
41
+ name: string;
42
+ }[];
43
+ graphAgents: {
44
+ id: string;
45
+ name: string;
46
+ is_published?: boolean;
47
+ }[];
48
+ };
32
49
  }
33
50
  export interface GraphAgentCreate {
34
51
  name: string;
@@ -1,12 +1,12 @@
1
1
  import { StateCreator } from 'zustand';
2
- import { User, XyzenState } from '../types';
2
+ import { User, XyzenState } from '../../types';
3
3
  export interface AuthSlice {
4
4
  user: User | null;
5
5
  token: string | null;
6
6
  status: "idle" | "loading" | "succeeded" | "failed";
7
- login: (token: string) => Promise<void>;
8
- logout: () => void;
9
- fetchUserByToken: () => Promise<void>;
7
+ setUser: (user: User | null) => void;
8
+ setToken: (token: string | null) => void;
9
+ setStatus: (status: "idle" | "loading" | "succeeded" | "failed") => void;
10
10
  }
11
11
  export declare const createAuthSlice: StateCreator<XyzenState, [
12
12
  ["zustand/immer", never]
@@ -5,6 +5,10 @@ export interface ChatSlice {
5
5
  chatHistory: ChatHistoryItem[];
6
6
  chatHistoryLoading: boolean;
7
7
  channels: Record<string, ChatChannel>;
8
+ activeWorkshopChannel: string | null;
9
+ workshopHistory: ChatHistoryItem[];
10
+ workshopHistoryLoading: boolean;
11
+ workshopChannels: Record<string, ChatChannel>;
8
12
  notification: {
9
13
  isOpen: boolean;
10
14
  title: string;
@@ -24,6 +28,17 @@ export interface ChatSlice {
24
28
  updateTopicName: (topicId: string, newName: string) => Promise<void>;
25
29
  deleteTopic: (topicId: string) => Promise<void>;
26
30
  clearSessionTopics: (sessionId: string) => Promise<void>;
31
+ setActiveWorkshopChannel: (channelUUID: string | null) => void;
32
+ fetchWorkshopHistory: () => Promise<void>;
33
+ togglePinWorkshopChat: (chatId: string) => void;
34
+ activateWorkshopChannel: (topicId: string) => Promise<void>;
35
+ connectToWorkshopChannel: (sessionId: string, topicId: string) => void;
36
+ disconnectFromWorkshopChannel: () => void;
37
+ sendWorkshopMessage: (message: string) => void;
38
+ createDefaultWorkshopChannel: (agentId?: string) => Promise<void>;
39
+ updateWorkshopTopicName: (topicId: string, newName: string) => Promise<void>;
40
+ deleteWorkshopTopic: (topicId: string) => Promise<void>;
41
+ clearWorkshopSessionTopics: (sessionId: string) => Promise<void>;
27
42
  confirmToolCall: (channelId: string, toolCallId: string) => void;
28
43
  cancelToolCall: (channelId: string, toolCallId: string) => void;
29
44
  showNotification: (title: string, message: string, type?: "info" | "warning" | "error" | "success", actionLabel?: string, onAction?: () => void) => void;
@@ -5,4 +5,4 @@ export * from './loadingSlice';
5
5
  export * from './mcpSlice';
6
6
  export * from './mcpToolSlice';
7
7
  export * from './providerSlice';
8
- export * from './uiSlice';
8
+ export * from './uiSlice/';
@@ -12,6 +12,7 @@ export interface McpSlice {
12
12
  refreshMcpServers: () => Promise<void>;
13
13
  addMcpServer: (server: McpServerCreate) => Promise<void>;
14
14
  quickAddBuiltinServer: (server: ExplorableMcpServer<BuiltinMcpData>) => Promise<void>;
15
+ activateSmitheryServer: (qualifiedName: string, profile?: string) => Promise<void>;
15
16
  editMcpServer: (id: string, server: McpServerUpdate) => Promise<void>;
16
17
  removeMcpServer: (id: string) => Promise<void>;
17
18
  updateMcpServerInList: (server: McpServer) => void;
@@ -1,5 +1,6 @@
1
1
  import { StateCreator } from 'zustand';
2
- import { Theme, XyzenState, LayoutStyle, UiSettingType } from '../types';
2
+ import { Theme, UiSettingType, XyzenState } from '../../types';
3
+ import { LayoutStyle } from './types';
3
4
  export type ActivityPanel = "chat" | "explorer" | "workshop";
4
5
  export interface UiSlice {
5
6
  backendUrl: string;
@@ -0,0 +1,6 @@
1
+ export declare const LAYOUT_STYLE: {
2
+ readonly Sidebar: "sidebar";
3
+ readonly Fullscreen: "fullscreen";
4
+ };
5
+ export type LayoutStyle = (typeof LAYOUT_STYLE)[keyof typeof LAYOUT_STYLE];
6
+ export declare const LAYOUT_STYLES: readonly LayoutStyle[];
@@ -49,7 +49,6 @@ export interface User {
49
49
  avatar: string;
50
50
  }
51
51
  export type Theme = "light" | "dark" | "system";
52
- export type LayoutStyle = "sidebar" | "fullscreen";
53
52
  export type UiSettingType = "theme" | "style";
54
53
  export interface TopicResponse {
55
54
  id: string;
@@ -0,0 +1,60 @@
1
+ export interface Agent {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ user_id: string;
6
+ created_at: string;
7
+ updated_at: string;
8
+ agent_type: "regular" | "graph" | "builtin" | "system";
9
+ prompt?: string;
10
+ mcp_servers?: {
11
+ id: string;
12
+ }[];
13
+ mcp_server_ids?: string[];
14
+ require_tool_confirmation?: boolean;
15
+ provider_id?: string | null;
16
+ avatar?: string | null;
17
+ tags?: string[] | null;
18
+ model?: string | null;
19
+ temperature?: number | null;
20
+ state_schema?: Record<string, unknown>;
21
+ is_active?: boolean;
22
+ is_published?: boolean;
23
+ is_official?: boolean;
24
+ node_count?: number;
25
+ edge_count?: number;
26
+ parent_agent_id?: string | null;
27
+ }
28
+ export interface RegularAgent extends Agent {
29
+ agent_type: "regular";
30
+ prompt?: string;
31
+ mcp_servers?: {
32
+ id: string;
33
+ }[];
34
+ mcp_server_ids?: string[];
35
+ require_tool_confirmation?: boolean;
36
+ provider_id?: string | null;
37
+ avatar?: string | null;
38
+ tags?: string[] | null;
39
+ model?: string | null;
40
+ temperature?: number | null;
41
+ }
42
+ export interface GraphAgent extends Agent {
43
+ agent_type: "graph";
44
+ state_schema: Record<string, unknown>;
45
+ is_active?: boolean;
46
+ is_published?: boolean;
47
+ is_official?: boolean;
48
+ node_count?: number;
49
+ edge_count?: number;
50
+ parent_agent_id?: string | null;
51
+ }
52
+ export interface SystemAgent extends Agent {
53
+ agent_type: "builtin" | "system";
54
+ prompt?: string;
55
+ model?: string | null;
56
+ temperature?: number | null;
57
+ }
58
+ export declare const isRegularAgent: (agent: Agent) => agent is RegularAgent;
59
+ export declare const isGraphAgent: (agent: Agent) => agent is GraphAgent;
60
+ export declare const isSystemAgent: (agent: Agent) => agent is SystemAgent;
@@ -48,16 +48,31 @@ export interface BohriumMcpData {
48
48
  /**
49
49
  * 可探索的 MCP Server(统一类型)
50
50
  */
51
- export interface ExplorableMcpServer<T = BuiltinMcpData | BohriumMcpData> {
51
+ /**
52
+ * Smithery MCP Server 数据(精简展示字段)
53
+ */
54
+ export interface SmitheryMcpData {
55
+ qualifiedName: string;
56
+ displayName: string | null;
57
+ description: string | null;
58
+ iconUrl: string | null;
59
+ verified: boolean;
60
+ useCount: number;
61
+ remote: boolean;
62
+ createdAt: string;
63
+ homepage: string;
64
+ }
65
+ export interface ExplorableMcpServer<T = BuiltinMcpData | BohriumMcpData | SmitheryMcpData> {
52
66
  id: string;
53
67
  name: string;
54
68
  description: string;
55
- source: "official" | "bohrium" | string;
69
+ source: "official" | "bohrium" | "smithery" | string;
56
70
  cover?: string;
57
71
  data: T;
58
72
  }
59
73
  export declare function isBuiltinMcp(server: ExplorableMcpServer): server is ExplorableMcpServer<BuiltinMcpData>;
60
74
  export declare function isBohriumMcp(server: ExplorableMcpServer): server is ExplorableMcpServer<BohriumMcpData>;
75
+ export declare function isSmitheryMcp(server: ExplorableMcpServer): server is ExplorableMcpServer<SmitheryMcpData>;
61
76
  /** @deprecated Use ExplorableMcpServer instead */
62
77
  export type BuiltinMcpServer = ExplorableMcpServer<BuiltinMcpData>;
63
78
  export type McpServerCreate = Omit<McpServer, "id" | "status" | "tools" | "user_id">;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export declare const ACCESS_TOKEN_KEY = "access_token";
2
+ /**
3
+ * Extract a cookie value by name from a cookie string (defaults to document.cookie if available).
4
+ * Pure: does not mutate any external state.
5
+ */
6
+ export declare function extractCookieValue(name: string, cookieString?: string): string | null;
7
+ /**
8
+ * Synchronize token from cookie to a provided storage-like target when local token absent.
9
+ * Returns the token if synchronized (or already present when allowExisting true), else null.
10
+ * Side effects are isolated to the provided storage interface (defaults to window.localStorage).
11
+ */
12
+ export declare function syncTokenFromCookie(cookieKey: string, options?: {
13
+ storageKey?: string;
14
+ storage?: Pick<Storage, "getItem" | "setItem">;
15
+ cookieString?: string;
16
+ allowExisting?: boolean;
17
+ }): string | null;