@vectorx/agent-simulator 1.0.0 → 1.1.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/app.d.ts +1 -1
- package/lib/app.js +4 -4
- package/lib/config/api.config.d.ts +0 -1
- package/lib/config/api.config.js +3 -2
- package/lib/config/app.config.d.ts +2 -1
- package/lib/config/app.config.js +0 -1
- package/lib/config/upload.config.d.ts +0 -1
- package/lib/config/upload.config.js +0 -1
- package/lib/container/container.d.ts +0 -1
- package/lib/container/container.js +4 -2
- package/lib/container/identifiers.d.ts +0 -1
- package/lib/container/identifiers.js +0 -1
- package/lib/container/index.d.ts +0 -1
- package/lib/container/index.js +0 -1
- package/lib/container/types.d.ts +9 -1
- package/lib/container/types.js +0 -1
- package/lib/controllers/agent.controller.d.ts +6 -3
- package/lib/controllers/agent.controller.js +17 -3
- package/lib/controllers/auth.controller.d.ts +4 -5
- package/lib/controllers/auth.controller.js +3 -4
- package/lib/controllers/simulator.controller.d.ts +2 -3
- package/lib/controllers/simulator.controller.js +1 -2
- package/lib/controllers/upload.controller.d.ts +1 -2
- package/lib/controllers/upload.controller.js +5 -2
- package/lib/index.d.ts +1 -2
- package/lib/index.js +0 -1
- package/lib/middleware/cors.middleware.d.ts +0 -1
- package/lib/middleware/cors.middleware.js +0 -1
- package/lib/middleware/error.middleware.d.ts +3 -4
- package/lib/middleware/error.middleware.js +2 -3
- package/lib/middleware/proxy.middleware.d.ts +1 -2
- package/lib/middleware/proxy.middleware.js +0 -1
- package/lib/middleware/upload.middleware.d.ts +0 -1
- package/lib/middleware/upload.middleware.js +0 -1
- package/lib/routes/agent.d.ts +0 -1
- package/lib/routes/agent.js +2 -1
- package/lib/routes/auth.d.ts +0 -1
- package/lib/routes/auth.js +0 -1
- package/lib/routes/index.d.ts +0 -1
- package/lib/routes/index.js +0 -1
- package/lib/routes/simulator.d.ts +0 -1
- package/lib/routes/simulator.js +0 -1
- package/lib/routes/upload.d.ts +0 -1
- package/lib/routes/upload.js +0 -1
- package/lib/services/agent.service.d.ts +15 -2
- package/lib/services/agent.service.js +34 -8
- package/lib/services/auth.service.d.ts +1 -2
- package/lib/services/auth.service.js +5 -6
- package/lib/services/simulator.service.d.ts +0 -1
- package/lib/services/simulator.service.js +0 -1
- package/lib/services/upload.service.d.ts +0 -1
- package/lib/services/upload.service.js +0 -1
- package/lib/simulator.d.ts +11 -1
- package/lib/simulator.js +90 -6
- package/lib/utils/env-helper.d.ts +0 -1
- package/lib/utils/env-helper.js +0 -1
- package/lib/utils/logger.d.ts +0 -1
- package/lib/utils/logger.js +0 -1
- package/lib/utils/request.d.ts +0 -1
- package/lib/utils/request.js +6 -2
- package/lib/utils/url-parser.d.ts +0 -1
- package/lib/utils/url-parser.js +1 -2
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +0 -1
- package/lib/webview-ui/Agent.d.ts +0 -1
- package/lib/webview-ui/Agent.js +0 -1
- package/lib/webview-ui/App.d.ts +0 -1
- package/lib/webview-ui/App.js +176 -34
- package/lib/webview-ui/ErrorBoundary.d.ts +0 -1
- package/lib/webview-ui/ErrorBoundary.js +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts +1 -2
- package/lib/webview-ui/components/AsyncTaskBlock.js +16 -5
- package/lib/webview-ui/components/AuthIndicator.d.ts +1 -2
- package/lib/webview-ui/components/AuthIndicator.js +0 -1
- package/lib/webview-ui/components/ErrorCard.d.ts +1 -2
- package/lib/webview-ui/components/ErrorCard.js +7 -5
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +1 -2
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +4 -3
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts +1 -2
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +1 -2
- package/lib/webview-ui/components/MarkdownRenderer.d.ts +1 -2
- package/lib/webview-ui/components/MarkdownRenderer.js +3 -8
- package/lib/webview-ui/components/MessageRenderer.d.ts +1 -2
- package/lib/webview-ui/components/MessageRenderer.js +48 -5
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts +2 -2
- package/lib/webview-ui/components/MultimodalFileRenderer.js +97 -40
- package/lib/webview-ui/components/ThinkingBlock.d.ts +2 -3
- package/lib/webview-ui/components/ThinkingBlock.js +0 -1
- package/lib/webview-ui/components/ToolUseBlock.d.ts +1 -2
- package/lib/webview-ui/components/ToolUseBlock.js +1 -2
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts +1 -2
- package/lib/webview-ui/components/ToolUseBlockHeader.js +1 -2
- package/lib/webview-ui/components/UploadPreview.d.ts +1 -2
- package/lib/webview-ui/components/UploadPreview.js +0 -1
- package/lib/webview-ui/components/WelcomeModule.d.ts +0 -1
- package/lib/webview-ui/components/WelcomeModule.js +46 -16
- package/lib/webview-ui/components/index.d.ts +0 -1
- package/lib/webview-ui/components/index.js +0 -1
- package/lib/webview-ui/config/cos-config.d.ts +0 -1
- package/lib/webview-ui/config/cos-config.js +0 -1
- package/lib/webview-ui/config/http-config.d.ts +0 -1
- package/lib/webview-ui/config/http-config.js +0 -1
- package/lib/webview-ui/constants.d.ts +0 -1
- package/lib/webview-ui/constants.js +0 -1
- package/lib/webview-ui/contexts/AgentContext.d.ts +1 -2
- package/lib/webview-ui/contexts/AgentContext.js +0 -1
- package/lib/webview-ui/contexts/AuthContext.d.ts +2 -2
- package/lib/webview-ui/contexts/AuthContext.js +0 -1
- package/lib/webview-ui/contexts/ThemeContext.d.ts +2 -2
- package/lib/webview-ui/contexts/ThemeContext.js +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.d.ts +4 -2
- package/lib/webview-ui/hooks/useAgentStatus.js +31 -5
- package/lib/webview-ui/hooks/useUploader.d.ts +0 -1
- package/lib/webview-ui/hooks/useUploader.js +5 -2
- package/lib/webview-ui/hooks/useUserAvatar.d.ts +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.js +0 -1
- package/lib/webview-ui/index.d.ts +1 -1
- package/lib/webview-ui/index.js +1 -1
- package/lib/webview-ui/services/agent-service.d.ts +14 -1
- package/lib/webview-ui/services/agent-service.js +7 -1
- package/lib/webview-ui/services/index.d.ts +0 -1
- package/lib/webview-ui/services/index.js +0 -1
- package/lib/webview-ui/services/logger-service.d.ts +0 -1
- package/lib/webview-ui/services/logger-service.js +0 -1
- package/lib/webview-ui/styles/copilot.d.ts +0 -1
- package/lib/webview-ui/styles/copilot.js +80 -22
- package/lib/webview-ui/styles/workarea.d.ts +0 -1
- package/lib/webview-ui/styles/workarea.js +7 -2
- package/lib/webview-ui/types.d.ts +11 -2
- package/lib/webview-ui/types.js +0 -1
- package/lib/webview-ui/utils/cos.d.ts +0 -1
- package/lib/webview-ui/utils/cos.js +4 -3
- package/lib/webview-ui/utils/env-helper.d.ts +6 -1
- package/lib/webview-ui/utils/env-helper.js +16 -2
- package/lib/webview-ui/utils/http-client.d.ts +1 -2
- package/lib/webview-ui/utils/http-client.js +0 -1
- package/lib/webview-ui/utils/markdownHighlight.d.ts +3 -0
- package/lib/webview-ui/utils/markdownHighlight.js +75 -0
- package/lib/webview-ui/utils/stream-text-handler.d.ts +0 -1
- package/lib/webview-ui/utils/stream-text-handler.js +6 -3
- package/lib/webview-ui/utils/upload.d.ts +0 -1
- package/lib/webview-ui/utils/upload.js +5 -2
- package/lib/webview-ui/widgets/BubbleComponents.d.ts +1 -2
- package/lib/webview-ui/widgets/BubbleComponents.js +1 -2
- package/lib/webview-ui/widgets/ChatInput.d.ts +1 -2
- package/lib/webview-ui/widgets/ChatInput.js +63 -90
- package/lib/webview-ui/widgets/LogPanel.d.ts +2 -3
- package/lib/webview-ui/widgets/LogPanel.js +5 -2
- package/lib/webview-ui/widgets/SystemLogs.d.ts +1 -2
- package/lib/webview-ui/widgets/SystemLogs.js +26 -9
- package/lib/webview-ui/widgets/ToolBar.d.ts +4 -3
- package/lib/webview-ui/widgets/ToolBar.js +6 -4
- package/lib/webview-ui/widgets/WebSocketDebugger.d.ts +6 -0
- package/lib/webview-ui/widgets/WebSocketDebugger.js +226 -0
- package/lib/webview-ui/widgets/index.d.ts +0 -1
- package/lib/webview-ui/widgets/index.js +0 -1
- package/package.json +9 -7
- package/public/assets/main.js +193 -166
- package/public/assets/style.css +1 -1
- package/lib/app.d.ts.map +0 -1
- package/lib/app.js.map +0 -1
- package/lib/config/api.config.d.ts.map +0 -1
- package/lib/config/api.config.js.map +0 -1
- package/lib/config/app.config.d.ts.map +0 -1
- package/lib/config/app.config.js.map +0 -1
- package/lib/config/upload.config.d.ts.map +0 -1
- package/lib/config/upload.config.js.map +0 -1
- package/lib/container/container.d.ts.map +0 -1
- package/lib/container/container.js.map +0 -1
- package/lib/container/identifiers.d.ts.map +0 -1
- package/lib/container/identifiers.js.map +0 -1
- package/lib/container/index.d.ts.map +0 -1
- package/lib/container/index.js.map +0 -1
- package/lib/container/types.d.ts.map +0 -1
- package/lib/container/types.js.map +0 -1
- package/lib/controllers/agent.controller.d.ts.map +0 -1
- package/lib/controllers/agent.controller.js.map +0 -1
- package/lib/controllers/auth.controller.d.ts.map +0 -1
- package/lib/controllers/auth.controller.js.map +0 -1
- package/lib/controllers/simulator.controller.d.ts.map +0 -1
- package/lib/controllers/simulator.controller.js.map +0 -1
- package/lib/controllers/upload.controller.d.ts.map +0 -1
- package/lib/controllers/upload.controller.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/middleware/cors.middleware.d.ts.map +0 -1
- package/lib/middleware/cors.middleware.js.map +0 -1
- package/lib/middleware/error.middleware.d.ts.map +0 -1
- package/lib/middleware/error.middleware.js.map +0 -1
- package/lib/middleware/proxy.middleware.d.ts.map +0 -1
- package/lib/middleware/proxy.middleware.js.map +0 -1
- package/lib/middleware/upload.middleware.d.ts.map +0 -1
- package/lib/middleware/upload.middleware.js.map +0 -1
- package/lib/routes/agent.d.ts.map +0 -1
- package/lib/routes/agent.js.map +0 -1
- package/lib/routes/auth.d.ts.map +0 -1
- package/lib/routes/auth.js.map +0 -1
- package/lib/routes/index.d.ts.map +0 -1
- package/lib/routes/index.js.map +0 -1
- package/lib/routes/simulator.d.ts.map +0 -1
- package/lib/routes/simulator.js.map +0 -1
- package/lib/routes/upload.d.ts.map +0 -1
- package/lib/routes/upload.js.map +0 -1
- package/lib/services/agent.service.d.ts.map +0 -1
- package/lib/services/agent.service.js.map +0 -1
- package/lib/services/auth.service.d.ts.map +0 -1
- package/lib/services/auth.service.js.map +0 -1
- package/lib/services/simulator.service.d.ts.map +0 -1
- package/lib/services/simulator.service.js.map +0 -1
- package/lib/services/upload.service.d.ts.map +0 -1
- package/lib/services/upload.service.js.map +0 -1
- package/lib/simulator.d.ts.map +0 -1
- package/lib/simulator.js.map +0 -1
- package/lib/utils/env-helper.d.ts.map +0 -1
- package/lib/utils/env-helper.js.map +0 -1
- package/lib/utils/logger.d.ts.map +0 -1
- package/lib/utils/logger.js.map +0 -1
- package/lib/utils/request.d.ts.map +0 -1
- package/lib/utils/request.js.map +0 -1
- package/lib/utils/url-parser.d.ts.map +0 -1
- package/lib/utils/url-parser.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
- package/lib/webview-ui/Agent.d.ts.map +0 -1
- package/lib/webview-ui/Agent.js.map +0 -1
- package/lib/webview-ui/App.d.ts.map +0 -1
- package/lib/webview-ui/App.js.map +0 -1
- package/lib/webview-ui/ErrorBoundary.d.ts.map +0 -1
- package/lib/webview-ui/ErrorBoundary.js.map +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/AsyncTaskBlock.js.map +0 -1
- package/lib/webview-ui/components/AuthIndicator.d.ts.map +0 -1
- package/lib/webview-ui/components/AuthIndicator.js.map +0 -1
- package/lib/webview-ui/components/ErrorCard.d.ts.map +0 -1
- package/lib/webview-ui/components/ErrorCard.js.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts.map +0 -1
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js.map +0 -1
- package/lib/webview-ui/components/MarkdownRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MarkdownRenderer.js.map +0 -1
- package/lib/webview-ui/components/MessageRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MessageRenderer.js.map +0 -1
- package/lib/webview-ui/components/MultimodalFileRenderer.d.ts.map +0 -1
- package/lib/webview-ui/components/MultimodalFileRenderer.js.map +0 -1
- package/lib/webview-ui/components/ThinkingBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/ThinkingBlock.js.map +0 -1
- package/lib/webview-ui/components/ToolUseBlock.d.ts.map +0 -1
- package/lib/webview-ui/components/ToolUseBlock.js.map +0 -1
- package/lib/webview-ui/components/ToolUseBlockHeader.d.ts.map +0 -1
- package/lib/webview-ui/components/ToolUseBlockHeader.js.map +0 -1
- package/lib/webview-ui/components/UploadPreview.d.ts.map +0 -1
- package/lib/webview-ui/components/UploadPreview.js.map +0 -1
- package/lib/webview-ui/components/WelcomeModule.d.ts.map +0 -1
- package/lib/webview-ui/components/WelcomeModule.js.map +0 -1
- package/lib/webview-ui/components/index.d.ts.map +0 -1
- package/lib/webview-ui/components/index.js.map +0 -1
- package/lib/webview-ui/config/cos-config.d.ts.map +0 -1
- package/lib/webview-ui/config/cos-config.js.map +0 -1
- package/lib/webview-ui/config/http-config.d.ts.map +0 -1
- package/lib/webview-ui/config/http-config.js.map +0 -1
- package/lib/webview-ui/constants.d.ts.map +0 -1
- package/lib/webview-ui/constants.js.map +0 -1
- package/lib/webview-ui/contexts/AgentContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/AgentContext.js.map +0 -1
- package/lib/webview-ui/contexts/AuthContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/AuthContext.js.map +0 -1
- package/lib/webview-ui/contexts/ThemeContext.d.ts.map +0 -1
- package/lib/webview-ui/contexts/ThemeContext.js.map +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useAgentStatus.js.map +0 -1
- package/lib/webview-ui/hooks/useUploader.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useUploader.js.map +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.d.ts.map +0 -1
- package/lib/webview-ui/hooks/useUserAvatar.js.map +0 -1
- package/lib/webview-ui/index.d.ts.map +0 -1
- package/lib/webview-ui/index.js.map +0 -1
- package/lib/webview-ui/services/agent-service.d.ts.map +0 -1
- package/lib/webview-ui/services/agent-service.js.map +0 -1
- package/lib/webview-ui/services/index.d.ts.map +0 -1
- package/lib/webview-ui/services/index.js.map +0 -1
- package/lib/webview-ui/services/logger-service.d.ts.map +0 -1
- package/lib/webview-ui/services/logger-service.js.map +0 -1
- package/lib/webview-ui/styles/copilot.d.ts.map +0 -1
- package/lib/webview-ui/styles/copilot.js.map +0 -1
- package/lib/webview-ui/styles/workarea.d.ts.map +0 -1
- package/lib/webview-ui/styles/workarea.js.map +0 -1
- package/lib/webview-ui/types.d.ts.map +0 -1
- package/lib/webview-ui/types.js.map +0 -1
- package/lib/webview-ui/utils/cos.d.ts.map +0 -1
- package/lib/webview-ui/utils/cos.js.map +0 -1
- package/lib/webview-ui/utils/env-helper.d.ts.map +0 -1
- package/lib/webview-ui/utils/env-helper.js.map +0 -1
- package/lib/webview-ui/utils/http-client.d.ts.map +0 -1
- package/lib/webview-ui/utils/http-client.js.map +0 -1
- package/lib/webview-ui/utils/stream-text-handler.d.ts.map +0 -1
- package/lib/webview-ui/utils/stream-text-handler.js.map +0 -1
- package/lib/webview-ui/utils/upload.d.ts.map +0 -1
- package/lib/webview-ui/utils/upload.js.map +0 -1
- package/lib/webview-ui/widgets/BubbleComponents.d.ts.map +0 -1
- package/lib/webview-ui/widgets/BubbleComponents.js.map +0 -1
- package/lib/webview-ui/widgets/ChatInput.d.ts.map +0 -1
- package/lib/webview-ui/widgets/ChatInput.js.map +0 -1
- package/lib/webview-ui/widgets/LogPanel.d.ts.map +0 -1
- package/lib/webview-ui/widgets/LogPanel.js.map +0 -1
- package/lib/webview-ui/widgets/SystemLogs.d.ts.map +0 -1
- package/lib/webview-ui/widgets/SystemLogs.js.map +0 -1
- package/lib/webview-ui/widgets/ToolBar.d.ts.map +0 -1
- package/lib/webview-ui/widgets/ToolBar.js.map +0 -1
- package/lib/webview-ui/widgets/index.d.ts.map +0 -1
- package/lib/webview-ui/widgets/index.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import type React from "react";
|
|
2
2
|
import type { AgentSimulatorInfo } from "../services/agent-service";
|
|
3
3
|
interface AgentContextValue {
|
|
4
4
|
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
@@ -10,4 +10,3 @@ interface AgentProviderProps {
|
|
|
10
10
|
export declare const AgentProvider: React.FC<AgentProviderProps>;
|
|
11
11
|
export declare function useAgentInfo(): AgentContextValue;
|
|
12
12
|
export {};
|
|
13
|
-
//# sourceMappingURL=AgentContext.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
2
3
|
import { type LoginInfo } from "../services/agent-service";
|
|
3
4
|
interface AuthContextType {
|
|
4
5
|
isLoggedIn: boolean;
|
|
@@ -14,4 +15,3 @@ interface AuthProviderProps {
|
|
|
14
15
|
export declare const AuthProvider: React.FC<AuthProviderProps>;
|
|
15
16
|
export declare const useAuth: () => AuthContextType;
|
|
16
17
|
export {};
|
|
17
|
-
//# sourceMappingURL=AuthContext.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
2
3
|
interface ThemeContextType {
|
|
3
4
|
isDark: boolean;
|
|
4
5
|
}
|
|
@@ -9,4 +10,3 @@ interface ThemeProviderProps {
|
|
|
9
10
|
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
10
11
|
export declare const useThemeHook: () => ThemeContextType;
|
|
11
12
|
export {};
|
|
12
|
-
//# sourceMappingURL=ThemeContext.d.ts.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { type AgentSimulatorInfo } from "../services/agent-service";
|
|
1
|
+
import { type AgentSimulatorInfo, type FunctionMeta } from "../services/agent-service";
|
|
2
2
|
export type DebugStatusType = "normal" | "stopped" | "error" | "connecting" | "timeout";
|
|
3
|
+
export type FunctionMode = "agent" | "websocket";
|
|
3
4
|
interface UseAgentStatusReturn {
|
|
4
5
|
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
5
6
|
debugStatus: DebugStatusType;
|
|
6
7
|
isConnecting: boolean;
|
|
7
8
|
error: string | null;
|
|
8
9
|
retryConnection: () => void;
|
|
10
|
+
functionMode: FunctionMode;
|
|
11
|
+
functionMeta: FunctionMeta | null;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
14
|
* Agent 状态管理 Hook
|
|
@@ -14,4 +17,3 @@ interface UseAgentStatusReturn {
|
|
|
14
17
|
*/
|
|
15
18
|
export declare const useAgentStatus: (pollInterval?: number) => UseAgentStatusReturn;
|
|
16
19
|
export {};
|
|
17
|
-
//# sourceMappingURL=useAgentStatus.d.ts.map
|
|
@@ -13,6 +13,8 @@ const useAgentStatus = (pollInterval = 5000) => {
|
|
|
13
13
|
const [debugStatus, setDebugStatus] = (0, react_1.useState)("connecting");
|
|
14
14
|
const [isConnecting, setIsConnecting] = (0, react_1.useState)(true);
|
|
15
15
|
const [error, setError] = (0, react_1.useState)(null);
|
|
16
|
+
const [functionMode, setFunctionMode] = (0, react_1.useState)("agent");
|
|
17
|
+
const [functionMeta, setFunctionMeta] = (0, react_1.useState)(null);
|
|
16
18
|
const pollTimerRef = (0, react_1.useRef)(null);
|
|
17
19
|
const timeoutRef = (0, react_1.useRef)(null);
|
|
18
20
|
/**
|
|
@@ -44,6 +46,21 @@ const useAgentStatus = (pollInterval = 5000) => {
|
|
|
44
46
|
setError(err instanceof Error ? err.message : "检查 Agent 状态失败");
|
|
45
47
|
}
|
|
46
48
|
}, []);
|
|
49
|
+
/**
|
|
50
|
+
* 获取函数能力元数据,自动识别是否为 WebSocket 函数
|
|
51
|
+
*/
|
|
52
|
+
const fetchFunctionMeta = (0, react_1.useCallback)(async () => {
|
|
53
|
+
try {
|
|
54
|
+
const meta = await agent_service_1.apiService.getFunctionMeta();
|
|
55
|
+
setFunctionMeta(meta);
|
|
56
|
+
const hasWebSocket = meta.functions?.some((fn) => fn.features?.websocket);
|
|
57
|
+
setFunctionMode(hasWebSocket ? "websocket" : "agent");
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
setFunctionMeta(null);
|
|
61
|
+
setFunctionMode("agent");
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
47
64
|
/**
|
|
48
65
|
* 设置连接超时
|
|
49
66
|
*/
|
|
@@ -87,9 +104,9 @@ const useAgentStatus = (pollInterval = 5000) => {
|
|
|
87
104
|
setDebugStatus("connecting");
|
|
88
105
|
setError(null);
|
|
89
106
|
startTimeout();
|
|
90
|
-
await Promise.all([fetchAgentInfo(), fetchAgentStatus()]);
|
|
107
|
+
await Promise.all([fetchAgentInfo(), fetchAgentStatus(), fetchFunctionMeta()]);
|
|
91
108
|
clearTimeoutRef();
|
|
92
|
-
}, [fetchAgentInfo, fetchAgentStatus, startTimeout, clearTimeoutRef]);
|
|
109
|
+
}, [fetchAgentInfo, fetchAgentStatus, fetchFunctionMeta, startTimeout, clearTimeoutRef]);
|
|
93
110
|
/**
|
|
94
111
|
* 初始化
|
|
95
112
|
*/
|
|
@@ -98,20 +115,29 @@ const useAgentStatus = (pollInterval = 5000) => {
|
|
|
98
115
|
setDebugStatus("connecting");
|
|
99
116
|
setError(null);
|
|
100
117
|
startTimeout();
|
|
101
|
-
Promise.all([fetchAgentInfo(), fetchAgentStatus()]).then(clearTimeoutRef);
|
|
118
|
+
Promise.all([fetchAgentInfo(), fetchAgentStatus(), fetchFunctionMeta()]).then(clearTimeoutRef);
|
|
102
119
|
startPolling();
|
|
103
120
|
return () => {
|
|
104
121
|
stopPolling();
|
|
105
122
|
clearTimeoutRef();
|
|
106
123
|
};
|
|
107
|
-
}, [
|
|
124
|
+
}, [
|
|
125
|
+
fetchAgentInfo,
|
|
126
|
+
fetchAgentStatus,
|
|
127
|
+
fetchFunctionMeta,
|
|
128
|
+
startPolling,
|
|
129
|
+
stopPolling,
|
|
130
|
+
startTimeout,
|
|
131
|
+
clearTimeoutRef,
|
|
132
|
+
]);
|
|
108
133
|
return {
|
|
109
134
|
agentSimulatorInfo,
|
|
110
135
|
debugStatus,
|
|
111
136
|
isConnecting,
|
|
112
137
|
error,
|
|
113
138
|
retryConnection,
|
|
139
|
+
functionMode,
|
|
140
|
+
functionMeta,
|
|
114
141
|
};
|
|
115
142
|
};
|
|
116
143
|
exports.useAgentStatus = useAgentStatus;
|
|
117
|
-
//# sourceMappingURL=useAgentStatus.js.map
|
|
@@ -98,7 +98,11 @@ function useUploader(options) {
|
|
|
98
98
|
})
|
|
99
99
|
.catch((e) => {
|
|
100
100
|
const error = e instanceof Error ? e : new Error(e?.message || "上传失败");
|
|
101
|
-
const errorItem = {
|
|
101
|
+
const errorItem = {
|
|
102
|
+
...temp,
|
|
103
|
+
status: "error",
|
|
104
|
+
errorMessage: error.message,
|
|
105
|
+
};
|
|
102
106
|
callbacks?.onError?.(error, errorItem);
|
|
103
107
|
antd_1.message.error(`${file.name} 上传失败: ${error.message}`);
|
|
104
108
|
return errorItem;
|
|
@@ -129,4 +133,3 @@ function useUploader(options) {
|
|
|
129
133
|
};
|
|
130
134
|
return { uploadFiles, cancelTask, pauseTask, resumeTask };
|
|
131
135
|
}
|
|
132
|
-
//# sourceMappingURL=useUploader.js.map
|
package/lib/webview-ui/index.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.App = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const client_1 = __importDefault(require("react-dom/client"));
|
|
9
9
|
const App_1 = __importDefault(require("./App"));
|
|
10
|
+
require("highlight.js/styles/foundation.min.css");
|
|
10
11
|
require("./styles.css"); // 导入样式
|
|
11
12
|
const rootElement = document.getElementById("root");
|
|
12
13
|
if (!rootElement)
|
|
@@ -14,4 +15,3 @@ if (!rootElement)
|
|
|
14
15
|
client_1.default.createRoot(rootElement).render((0, jsx_runtime_1.jsx)(App_1.default, {}));
|
|
15
16
|
var App_2 = require("./App");
|
|
16
17
|
Object.defineProperty(exports, "App", { enumerable: true, get: function () { return __importDefault(App_2).default; } });
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -25,6 +25,16 @@ export interface AgentStatus {
|
|
|
25
25
|
baseUrl: string;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
export interface FunctionFeatures {
|
|
29
|
+
websocket: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface FunctionMetaItem {
|
|
32
|
+
name: string;
|
|
33
|
+
features: FunctionFeatures;
|
|
34
|
+
}
|
|
35
|
+
export interface FunctionMeta {
|
|
36
|
+
functions: FunctionMetaItem[];
|
|
37
|
+
}
|
|
28
38
|
export interface LoginInfo {
|
|
29
39
|
secret_id: string;
|
|
30
40
|
cli_token: string;
|
|
@@ -58,6 +68,10 @@ declare class ApiService {
|
|
|
58
68
|
* 获取 Agent 状态
|
|
59
69
|
*/
|
|
60
70
|
getAgentStatus(): Promise<AgentStatus>;
|
|
71
|
+
/**
|
|
72
|
+
* 获取函数能力元数据(检测 WebSocket 等特性)
|
|
73
|
+
*/
|
|
74
|
+
getFunctionMeta(): Promise<FunctionMeta>;
|
|
61
75
|
/**
|
|
62
76
|
* 获取认证状态
|
|
63
77
|
*/
|
|
@@ -121,4 +135,3 @@ declare class ApiService {
|
|
|
121
135
|
}
|
|
122
136
|
export declare const apiService: ApiService;
|
|
123
137
|
export {};
|
|
124
|
-
//# sourceMappingURL=agent-service.d.ts.map
|
|
@@ -20,6 +20,13 @@ class ApiService {
|
|
|
20
20
|
const data = await http_client_1.httpClient.get(`/api/agent/info/status`);
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取函数能力元数据(检测 WebSocket 等特性)
|
|
25
|
+
*/
|
|
26
|
+
async getFunctionMeta() {
|
|
27
|
+
const data = await http_client_1.httpClient.get(`/api/agent/meta`);
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
23
30
|
/**
|
|
24
31
|
* 获取认证状态
|
|
25
32
|
*/
|
|
@@ -77,4 +84,3 @@ class ApiService {
|
|
|
77
84
|
}
|
|
78
85
|
}
|
|
79
86
|
exports.apiService = new ApiService();
|
|
80
|
-
//# sourceMappingURL=agent-service.js.map
|
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./agent-service"), exports);
|
|
18
18
|
__exportStar(require("./logger-service"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -28,6 +28,10 @@ exports.useCopilotStyle = (0, antd_style_1.createStyles)(({ token, css }) => {
|
|
|
28
28
|
overflow: auto;
|
|
29
29
|
padding-block: 16px;
|
|
30
30
|
flex: 1;
|
|
31
|
+
|
|
32
|
+
.embed-ide & {
|
|
33
|
+
padding-block: 8px;
|
|
34
|
+
}
|
|
31
35
|
`,
|
|
32
36
|
chatWelcome: css `
|
|
33
37
|
margin-inline: 16px;
|
|
@@ -54,24 +58,40 @@ exports.useCopilotStyle = (0, antd_style_1.createStyles)(({ token, css }) => {
|
|
|
54
58
|
font-size: 18px;
|
|
55
59
|
color: ${token.colorText} !important;
|
|
56
60
|
`,
|
|
61
|
+
/* 使用 & 使选择器作用于挂载该 class 的同一 div(即 .markdown-content 容器),否则 .markdown-content table 无法匹配 */
|
|
57
62
|
markdownContent: css `
|
|
58
|
-
|
|
63
|
+
& {
|
|
59
64
|
will-change: contents;
|
|
60
65
|
contain: content;
|
|
66
|
+
line-height: 1.65;
|
|
67
|
+
}
|
|
61
68
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
/* 段落:适度段间距与行高,避免挤在一起 */
|
|
70
|
+
p {
|
|
71
|
+
margin: 0 0 0.85em;
|
|
72
|
+
line-height: 1.65;
|
|
73
|
+
}
|
|
74
|
+
p:last-child {
|
|
75
|
+
margin-bottom: 0;
|
|
76
|
+
}
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
/* 优化代码块样式 */
|
|
79
|
+
pre {
|
|
80
|
+
background: ${token.colorBgTextHover};
|
|
81
|
+
padding: 12px;
|
|
82
|
+
border-radius: 6px;
|
|
83
|
+
margin: 10px 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* 优化列表样式:列表块与列表项留出间距 */
|
|
87
|
+
ul, ol {
|
|
88
|
+
padding-left: 20px;
|
|
89
|
+
margin: 10px 0;
|
|
90
|
+
}
|
|
91
|
+
li {
|
|
92
|
+
margin-bottom: 0.35em;
|
|
93
|
+
line-height: 1.6;
|
|
94
|
+
}
|
|
75
95
|
|
|
76
96
|
/* 优化引用样式 */
|
|
77
97
|
blockquote {
|
|
@@ -91,29 +111,67 @@ exports.useCopilotStyle = (0, antd_style_1.createStyles)(({ token, css }) => {
|
|
|
91
111
|
}
|
|
92
112
|
}
|
|
93
113
|
|
|
94
|
-
/*
|
|
114
|
+
/* 优化标题样式:层级清晰、段前段后留白 */
|
|
95
115
|
h1, h2, h3, h4, h5, h6 {
|
|
96
|
-
margin:
|
|
116
|
+
margin: 1em 0 0.5em;
|
|
97
117
|
font-weight: 600;
|
|
118
|
+
color: ${token.colorTextHeading};
|
|
119
|
+
line-height: 1.4;
|
|
120
|
+
}
|
|
121
|
+
h1:first-child, h2:first-child, h3:first-child,
|
|
122
|
+
h4:first-child, h5:first-child, h6:first-child {
|
|
123
|
+
margin-top: 0;
|
|
124
|
+
}
|
|
125
|
+
h1 { font-size: 1.25em; }
|
|
126
|
+
h2 { font-size: 1.15em; }
|
|
127
|
+
h3 { font-size: 1.05em; }
|
|
128
|
+
h4, h5, h6 { font-size: 1em; }
|
|
129
|
+
|
|
130
|
+
/* 分割线:细线、主题色,不突兀 */
|
|
131
|
+
hr {
|
|
132
|
+
border: none;
|
|
133
|
+
border-top: 1px solid ${token.colorBorderSecondary};
|
|
134
|
+
margin: 14px 0;
|
|
98
135
|
}
|
|
99
136
|
|
|
100
|
-
/*
|
|
137
|
+
/* 表格:圆角、浅边框、表头与斑马纹 */
|
|
101
138
|
table {
|
|
102
139
|
border-collapse: collapse;
|
|
103
140
|
width: 100%;
|
|
104
|
-
margin:
|
|
141
|
+
margin: 10px 0;
|
|
142
|
+
border-radius: 8px;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
font-size: inherit;
|
|
145
|
+
box-sizing: border-box;
|
|
105
146
|
|
|
106
147
|
th, td {
|
|
107
|
-
|
|
108
|
-
|
|
148
|
+
padding: 8px 12px;
|
|
149
|
+
text-align: left;
|
|
150
|
+
border: 1px solid ${token.colorBorderSecondary};
|
|
151
|
+
box-sizing: border-box;
|
|
152
|
+
word-wrap: break-word;
|
|
153
|
+
overflow-wrap: break-word;
|
|
109
154
|
}
|
|
110
155
|
|
|
111
|
-
th {
|
|
156
|
+
thead th {
|
|
157
|
+
background: ${token.colorBgTextHover};
|
|
158
|
+
font-weight: 600;
|
|
159
|
+
color: ${token.colorTextHeading};
|
|
160
|
+
border-bottom: 1px solid ${token.colorBorder};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
tbody td {
|
|
164
|
+
background: ${token.colorBgContainer};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
tbody tr:nth-child(even) td {
|
|
168
|
+
background: ${token.colorBgLayout};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
tbody tr:hover td {
|
|
112
172
|
background: ${token.colorBgTextHover};
|
|
113
173
|
}
|
|
114
174
|
}
|
|
115
|
-
}
|
|
116
175
|
`,
|
|
117
176
|
};
|
|
118
177
|
});
|
|
119
|
-
//# sourceMappingURL=copilot.js.map
|
|
@@ -6,11 +6,17 @@ exports.useWorkareaStyle = (0, antd_style_1.createStyles)(({ token, css }) => {
|
|
|
6
6
|
return {
|
|
7
7
|
copilotWrapper: css `
|
|
8
8
|
max-width: 800px;
|
|
9
|
-
min-width:
|
|
9
|
+
min-width: 0;
|
|
10
10
|
width: 100%;
|
|
11
11
|
height: 100vh;
|
|
12
12
|
display: flex;
|
|
13
13
|
margin: 0 auto;
|
|
14
|
+
|
|
15
|
+
/* 嵌入 IDE 时去掉最大宽度限制,充满面板 */
|
|
16
|
+
&.embed-ide {
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
14
20
|
`,
|
|
15
21
|
workarea: css `
|
|
16
22
|
flex: 1;
|
|
@@ -70,4 +76,3 @@ exports.useWorkareaStyle = (0, antd_style_1.createStyles)(({ token, css }) => {
|
|
|
70
76
|
`,
|
|
71
77
|
};
|
|
72
78
|
});
|
|
73
|
-
//# sourceMappingURL=workarea.js.map
|
|
@@ -12,10 +12,17 @@ export interface MultimodalFile {
|
|
|
12
12
|
fileSource?: "standard" | "openai";
|
|
13
13
|
fileId?: string;
|
|
14
14
|
purpose?: string;
|
|
15
|
+
metadata?: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
/** 消息内单段内容 */
|
|
18
|
+
export interface MessagePart {
|
|
19
|
+
type: "text" | "image" | "video" | "audio";
|
|
20
|
+
content: string;
|
|
21
|
+
metadata?: Record<string, any>;
|
|
15
22
|
}
|
|
16
23
|
export interface ChatMessage {
|
|
17
24
|
id: string;
|
|
18
|
-
type: "function_call" | "function_call_response" | "knowledge_base_search" | "knowledge_base_search_response" | "async_task" | "image" | "video" | "answer" | "thinking" | "timeout" | "interrupted" | "uiDiscard" | "error";
|
|
25
|
+
type: "composite" | "function_call" | "function_call_response" | "knowledge_base_search" | "knowledge_base_search_response" | "async_task" | "image" | "video" | "audio" | "answer" | "thinking" | "timeout" | "interrupted" | "uiDiscard" | "error";
|
|
19
26
|
content: string;
|
|
20
27
|
isThinking?: boolean;
|
|
21
28
|
isTimeout?: boolean;
|
|
@@ -40,6 +47,9 @@ export interface ChatMessage {
|
|
|
40
47
|
[key: string]: any;
|
|
41
48
|
}>;
|
|
42
49
|
files?: MultimodalFile[];
|
|
50
|
+
/** 多段内容(存在时按顺序渲染,兼容图文混排、多图等) */
|
|
51
|
+
parts?: MessagePart[];
|
|
52
|
+
metadata?: Record<string, any>;
|
|
43
53
|
}
|
|
44
54
|
export interface ChatHistoryProps {
|
|
45
55
|
messages: ChatMessage[];
|
|
@@ -62,4 +72,3 @@ export interface MessageProps {
|
|
|
62
72
|
message: ChatMessage;
|
|
63
73
|
onRetry?: (messageId: string) => void;
|
|
64
74
|
}
|
|
65
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/webview-ui/types.js
CHANGED
|
@@ -16,14 +16,16 @@ class Uploader {
|
|
|
16
16
|
this.getToken = args.getToken;
|
|
17
17
|
this.enableResume = args.enableResume;
|
|
18
18
|
}
|
|
19
|
-
getPermit(
|
|
19
|
+
getPermit(_file, fileInfo, _fileFormat, persistentOps, persistentNotifyUrl) {
|
|
20
20
|
return this.getToken().then(({ uploadTempPermits, uploadLimitPolicy }) => {
|
|
21
21
|
const fileType = fileInfo.type;
|
|
22
22
|
const fileSize = fileInfo.size;
|
|
23
23
|
if (uploadLimitPolicy) {
|
|
24
24
|
const { fileTypes, maxSize } = uploadLimitPolicy;
|
|
25
25
|
if (fileTypes?.length &&
|
|
26
|
-
!fileTypes
|
|
26
|
+
!fileTypes
|
|
27
|
+
.reduce((a, c) => [...a, ...c.split("/")], [])
|
|
28
|
+
.some((f) => fileType.endsWith(f))) {
|
|
27
29
|
throw new Error(`文件类型 ${fileType} 不在可上传的文件类型 ${fileTypes.join(", ")} 中。`);
|
|
28
30
|
}
|
|
29
31
|
if (maxSize !== undefined && fileSize > maxSize) {
|
|
@@ -110,4 +112,3 @@ class Uploader {
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
exports.Uploader = Uploader;
|
|
113
|
-
//# sourceMappingURL=cos.js.map
|
|
@@ -3,4 +3,9 @@
|
|
|
3
3
|
* 判断当前是否运行在 IDE(Electron)环境中
|
|
4
4
|
*/
|
|
5
5
|
export declare const isIDE: () => boolean;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* 判断当前是否以嵌入模式运行在 Web IDE 中(通过 iframe 嵌入)。
|
|
8
|
+
* 当使用 `rcb agent dev --use-ide` 时,模拟器会以 iframe 形式嵌入到 Web IDE 的右侧面板,
|
|
9
|
+
* 此时 URL 会携带 `embed=ide` 参数。
|
|
10
|
+
*/
|
|
11
|
+
export declare const isEmbeddedInIde: () => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIDE = void 0;
|
|
3
|
+
exports.isEmbeddedInIde = exports.isIDE = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 前端环境判断工具
|
|
6
6
|
* 判断当前是否运行在 IDE(Electron)环境中
|
|
@@ -10,4 +10,18 @@ const isIDE = () => {
|
|
|
10
10
|
return typeof require === "function";
|
|
11
11
|
};
|
|
12
12
|
exports.isIDE = isIDE;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 判断当前是否以嵌入模式运行在 Web IDE 中(通过 iframe 嵌入)。
|
|
15
|
+
* 当使用 `rcb agent dev --use-ide` 时,模拟器会以 iframe 形式嵌入到 Web IDE 的右侧面板,
|
|
16
|
+
* 此时 URL 会携带 `embed=ide` 参数。
|
|
17
|
+
*/
|
|
18
|
+
const isEmbeddedInIde = () => {
|
|
19
|
+
try {
|
|
20
|
+
const params = new URLSearchParams(window.location.search);
|
|
21
|
+
return params.get("embed") === "ide";
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.isEmbeddedInIde = isEmbeddedInIde;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
1
|
+
import { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from "axios";
|
|
2
2
|
export interface HttpClientConfig {
|
|
3
3
|
baseURL?: string;
|
|
4
4
|
timeout?: number;
|
|
@@ -41,4 +41,3 @@ export declare class HttpClient {
|
|
|
41
41
|
}
|
|
42
42
|
export declare const httpClient: HttpClient;
|
|
43
43
|
export type { AxiosRequestConfig, AxiosResponse };
|
|
44
|
-
//# sourceMappingURL=http-client.d.ts.map
|