@sciol/xyzen 0.3.10 → 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 (49) hide show
  1. package/dist/app/AppSide.d.ts +3 -1
  2. package/dist/app/auth/AuthErrorScreen.d.ts +6 -0
  3. package/dist/components/animate-ui/components/animate/tabs.d.ts +12 -0
  4. package/dist/components/animate-ui/components/buttons/button.d.ts +2 -2
  5. package/dist/components/animate-ui/components/buttons/flip.d.ts +10 -0
  6. package/dist/components/animate-ui/components/buttons/github-stars.d.ts +1 -1
  7. package/dist/components/animate-ui/components/radix/progress.d.ts +4 -0
  8. package/dist/components/animate-ui/primitives/animate/github-stars.d.ts +1 -2
  9. package/dist/components/animate-ui/primitives/animate/tabs.d.ts +51 -0
  10. package/dist/components/animate-ui/primitives/buttons/flip.d.ts +18 -0
  11. package/dist/components/animate-ui/primitives/effects/highlight.d.ts +1 -2
  12. package/dist/components/animate-ui/primitives/headless/checkbox.d.ts +1 -2
  13. package/dist/components/animate-ui/primitives/radix/dropdown-menu.d.ts +1 -3
  14. package/dist/components/animate-ui/primitives/radix/progress.d.ts +292 -0
  15. package/dist/components/features/NeedAuthBadge.d.ts +1 -0
  16. package/dist/components/features/ToggleSidePanelShortcutHint.d.ts +1 -0
  17. package/dist/components/layouts/XyzenAgent.d.ts +0 -26
  18. package/dist/components/modals/EditAgentModal.d.ts +1 -1
  19. package/dist/components/ui/button.d.ts +2 -2
  20. package/dist/configs/common.d.ts +4 -0
  21. package/dist/configs/index.d.ts +2 -0
  22. package/dist/constants/defaultMcps.d.ts +32 -0
  23. package/dist/core/auth.d.ts +19 -0
  24. package/dist/hooks/useAuth.d.ts +5 -9
  25. package/dist/hooks/useWorkShopChat.d.ts +1 -1
  26. package/dist/hooks/useXyzenChat.d.ts +1 -1
  27. package/dist/marketplace/components/SmitheryServerDetail.d.ts +7 -0
  28. package/dist/marketplace/hooks/useSmitheryMcp.d.ts +29 -0
  29. package/dist/marketplace/index.d.ts +3 -0
  30. package/dist/marketplace/services/smitheryService.d.ts +6 -0
  31. package/dist/marketplace/types/smithery.d.ts +64 -0
  32. package/dist/service/authService.d.ts +8 -24
  33. package/dist/service/http/client.d.ts +1 -0
  34. package/dist/service/mcpService.d.ts +1 -0
  35. package/dist/store/slices/agentSlice.d.ts +18 -1
  36. package/dist/store/slices/{authSlice.d.ts → authSlice/index.d.ts} +4 -4
  37. package/dist/store/slices/index.d.ts +1 -1
  38. package/dist/store/slices/mcpSlice.d.ts +1 -0
  39. package/dist/store/slices/{uiSlice.d.ts → uiSlice/index.d.ts} +2 -1
  40. package/dist/store/slices/uiSlice/types.d.ts +6 -0
  41. package/dist/store/types.d.ts +0 -1
  42. package/dist/types/agents.d.ts +60 -0
  43. package/dist/types/mcp.d.ts +17 -2
  44. package/dist/utils/__tests__/auth.test.d.ts +1 -0
  45. package/dist/utils/auth.d.ts +17 -0
  46. package/dist/xyzen.css +1 -1
  47. package/dist/xyzen.es.js +47144 -46177
  48. package/dist/xyzen.umd.js +153 -139
  49. package/package.json +5 -3
@@ -39,7 +39,7 @@ export declare function useWorkShopChat(config: WorkShopChatConfig): {
39
39
  inputHeight: number;
40
40
  sendBlocked: boolean;
41
41
  currentChannel: import('../store/types').ChatChannel | null;
42
- currentAgent: import('../components/layouts/XyzenAgent').Agent | null | undefined;
42
+ currentAgent: import('../types/agents').Agent | null | undefined;
43
43
  messages: Message[];
44
44
  connected: boolean;
45
45
  error: string | null;
@@ -39,7 +39,7 @@ export declare function useXyzenChat(config: XyzenChatConfig): {
39
39
  inputHeight: number;
40
40
  sendBlocked: boolean;
41
41
  currentChannel: import('../store/types').ChatChannel | null;
42
- currentAgent: import('../components/layouts/XyzenAgent').Agent | null | undefined;
42
+ currentAgent: import('../types/agents').Agent | null | undefined;
43
43
  messages: Message[];
44
44
  connected: boolean;
45
45
  error: string | null;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ interface Props {
3
+ id: string;
4
+ onBack?: () => void;
5
+ }
6
+ declare const SmitheryServerDetail: React.FC<Props>;
7
+ export default SmitheryServerDetail;
@@ -0,0 +1,29 @@
1
+ import { SmitheryServerDetail, SmitheryServersListResponse } from '../types/smithery';
2
+ export declare const useSmitheryServers: (page?: number, pageSize?: number, q?: string, profile?: string) => {
3
+ servers: import('..').SmitheryServerItem[];
4
+ pagination: import('..').SmitheryPagination | undefined;
5
+ loading: boolean;
6
+ error: string | null;
7
+ isError: boolean;
8
+ refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SmitheryServersListResponse, Error>>;
9
+ };
10
+ export declare const useSmitheryInfiniteServers: (pageSize?: number, q?: string, profile?: string) => {
11
+ servers: import('..').SmitheryServerItem[];
12
+ totalCount: number;
13
+ totalPages: number;
14
+ pageCount: number;
15
+ loading: boolean;
16
+ isFetchingNextPage: boolean;
17
+ hasNextPage: boolean;
18
+ fetchNextPage: (options?: import('@tanstack/query-core').FetchNextPageOptions) => Promise<import('@tanstack/query-core').InfiniteQueryObserverResult<import('@tanstack/query-core').InfiniteData<SmitheryServersListResponse, unknown>, Error>>;
19
+ refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<import('@tanstack/query-core').InfiniteData<SmitheryServersListResponse, unknown>, Error>>;
20
+ error: string | null;
21
+ isError: boolean;
22
+ };
23
+ export declare const useSmitheryServerDetail: (id?: string) => {
24
+ detail: SmitheryServerDetail | null;
25
+ loading: boolean;
26
+ error: string | null;
27
+ isError: boolean;
28
+ refetch: (options?: import('@tanstack/query-core').RefetchOptions) => Promise<import('@tanstack/query-core').QueryObserverResult<SmitheryServerDetail, Error>>;
29
+ };
@@ -3,8 +3,11 @@
3
3
  * 统一导出 marketplace 模块的所有功能
4
4
  */
5
5
  export * from './types/bohrium';
6
+ export * from './types/smithery';
6
7
  export { bohriumService } from './services/bohriumService';
8
+ export { smitheryService } from './services/smitheryService';
7
9
  export { useBohriumAppDetail, useBohriumAppList, useBohriumAuth, useMcpActivation, } from './hooks/useBohriumMcp';
10
+ export { useSmitheryInfiniteServers, useSmitheryServers, } from './hooks/useSmitheryMcp';
8
11
  export { default as McpActivationProgress } from './components/McpActivationProgress';
9
12
  export { default as McpServerCard } from './components/McpServerCard';
10
13
  export { default as McpServerDetail } from './components/McpServerDetail';
@@ -0,0 +1,6 @@
1
+ import { SmitheryServersListResponse, SmitheryServersQuery } from '../types/smithery';
2
+ export declare class SmitheryService {
3
+ listServers(params?: SmitheryServersQuery): Promise<SmitheryServersListResponse>;
4
+ getServer(id: string): Promise<import('..').SmitheryServerDetail>;
5
+ }
6
+ export declare const smitheryService: SmitheryService;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Smithery Marketplace Types
3
+ * Maps the Smithery Registry OpenAPI shapes used by our UI
4
+ */
5
+ export interface SmitheryServerItem {
6
+ qualifiedName: string;
7
+ displayName: string | null;
8
+ description: string | null;
9
+ iconUrl: string | null;
10
+ verified: boolean;
11
+ useCount: number;
12
+ remote: boolean;
13
+ createdAt: string;
14
+ homepage: string;
15
+ }
16
+ export interface SmitheryPagination {
17
+ currentPage: number;
18
+ pageSize: number;
19
+ totalPages: number;
20
+ totalCount: number;
21
+ }
22
+ export interface SmitheryServersListResponse {
23
+ servers: SmitheryServerItem[];
24
+ pagination: SmitheryPagination;
25
+ }
26
+ export interface SmitheryServersQuery {
27
+ q?: string;
28
+ profile?: string;
29
+ page?: number;
30
+ pageSize?: number;
31
+ }
32
+ export interface SmitheryToolAnnotations {
33
+ readOnlyHint?: boolean;
34
+ idempotentHint?: boolean;
35
+ destructiveHint?: boolean;
36
+ [key: string]: unknown;
37
+ }
38
+ export interface SmitheryTool {
39
+ name: string;
40
+ description: string | null;
41
+ inputSchema: Record<string, unknown>;
42
+ annotations?: SmitheryToolAnnotations;
43
+ }
44
+ export interface SmitheryConnection {
45
+ type: string;
46
+ deploymentUrl?: string;
47
+ url?: string;
48
+ configSchema?: Record<string, unknown>;
49
+ }
50
+ export interface SmitherySecurityInfo {
51
+ scanPassed: boolean;
52
+ [key: string]: unknown;
53
+ }
54
+ export interface SmitheryServerDetail {
55
+ qualifiedName: string;
56
+ displayName: string;
57
+ description: string;
58
+ iconUrl: string | null;
59
+ remote: boolean;
60
+ deploymentUrl: string | null;
61
+ connections: SmitheryConnection[];
62
+ security: SmitherySecurityInfo | null;
63
+ tools: SmitheryTool[] | null;
64
+ }
@@ -3,6 +3,13 @@ export interface AuthStatus {
3
3
  provider?: string;
4
4
  message: string;
5
5
  }
6
+ export interface AuthProviderConfig {
7
+ provider: string;
8
+ issuer?: string;
9
+ audience?: string;
10
+ jwks_uri?: string;
11
+ algorithm?: string;
12
+ }
6
13
  export interface UserInfo {
7
14
  id: string;
8
15
  username: string;
@@ -17,37 +24,14 @@ export interface AuthValidationResponse {
17
24
  error_message?: string;
18
25
  error_code?: string;
19
26
  }
20
- export declare enum AuthState {
21
- NOT_CONFIGURED = "not_configured",
22
- NOT_AUTHENTICATED = "not_authenticated",
23
- AUTHENTICATED = "authenticated",
24
- ERROR = "error"
25
- }
26
- export interface AuthResult {
27
- state: AuthState;
28
- user?: UserInfo;
29
- message: string;
30
- provider?: string;
31
- }
32
27
  declare class AuthService {
33
28
  private static readonly TOKEN_KEY;
34
- private static readonly COOKIE_TOKEN_KEY;
35
- private authCheckPromise;
36
- private listeners;
37
29
  getToken(): string | null;
38
- private getCookie;
39
30
  setToken(token: string): void;
40
31
  removeToken(): void;
41
- addAuthStateListener(listener: (result: AuthResult) => void): void;
42
- removeAuthStateListener(listener: (result: AuthResult) => void): void;
43
- private notifyListeners;
44
32
  getAuthStatus(): Promise<AuthStatus>;
45
33
  validateToken(token?: string): Promise<AuthValidationResponse>;
46
- getCurrentUser(): Promise<UserInfo | null>;
47
- checkAuthState(force?: boolean): Promise<AuthResult>;
48
- private _performAuthCheck;
49
- autoLogin(): Promise<AuthResult>;
50
- login(token: string): Promise<AuthResult>;
34
+ getAuthConfig(): Promise<AuthProviderConfig>;
51
35
  logout(): void;
52
36
  }
53
37
  export declare const authService: AuthService;
@@ -0,0 +1 @@
1
+ export {};
@@ -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,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;