@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
package/lib/app.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class App {
|
|
|
10
10
|
port: number;
|
|
11
11
|
agentServerUrl: string;
|
|
12
12
|
open?: boolean;
|
|
13
|
+
agentId?: string;
|
|
13
14
|
});
|
|
14
15
|
/**
|
|
15
16
|
* 设置中间件
|
|
@@ -40,4 +41,3 @@ export declare class App {
|
|
|
40
41
|
*/
|
|
41
42
|
getConfig(): import("./config/app.config").AppConfig;
|
|
42
43
|
}
|
|
43
|
-
//# sourceMappingURL=app.d.ts.map
|
package/lib/app.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.App = void 0;
|
|
7
7
|
require("reflect-metadata");
|
|
8
|
-
const
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const express_1 = __importDefault(require("express"));
|
|
10
10
|
const app_config_1 = require("./config/app.config");
|
|
11
11
|
const container_1 = require("./container/container");
|
|
@@ -21,6 +21,7 @@ class App {
|
|
|
21
21
|
config,
|
|
22
22
|
agentServerUrl: options.agentServerUrl,
|
|
23
23
|
parsedServerUrl,
|
|
24
|
+
agentId: options.agentId,
|
|
24
25
|
};
|
|
25
26
|
// 初始化 Inversify 依赖注入容器
|
|
26
27
|
this.container = (0, container_1.initializeContainer)(this.context);
|
|
@@ -41,7 +42,7 @@ class App {
|
|
|
41
42
|
// 注意:文件上传使用 multer 中间件处理,不需要在这里配置大的 limit
|
|
42
43
|
// multer 会在特定路由上处理 multipart/form-data 请求
|
|
43
44
|
// 静态文件服务
|
|
44
|
-
const publicPath =
|
|
45
|
+
const publicPath = node_path_1.default.resolve(__dirname, "../public");
|
|
45
46
|
this.app.use(express_1.default.static(publicPath));
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
@@ -58,7 +59,7 @@ class App {
|
|
|
58
59
|
return next();
|
|
59
60
|
}
|
|
60
61
|
// 返回React应用的index.html
|
|
61
|
-
res.sendFile(
|
|
62
|
+
res.sendFile(node_path_1.default.resolve(__dirname, "../public/index.html"));
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
@@ -96,4 +97,3 @@ class App {
|
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
exports.App = App;
|
|
99
|
-
//# sourceMappingURL=app.js.map
|
package/lib/config/api.config.js
CHANGED
|
@@ -8,6 +8,7 @@ const apiUrls = {
|
|
|
8
8
|
};
|
|
9
9
|
const env = process.env.AGENT_BUILD_ENV || "production";
|
|
10
10
|
function getBaseUrl() {
|
|
11
|
-
return apiUrls[env in apiUrls
|
|
11
|
+
return apiUrls[env in apiUrls
|
|
12
|
+
? env
|
|
13
|
+
: "development"];
|
|
12
14
|
}
|
|
13
|
-
//# sourceMappingURL=api.config.js.map
|
|
@@ -13,10 +13,11 @@ export interface AppContext {
|
|
|
13
13
|
config: AppConfig;
|
|
14
14
|
agentServerUrl: string;
|
|
15
15
|
parsedServerUrl: ReturnType<typeof import("../utils/url-parser").parseAgentServerUrl>;
|
|
16
|
+
/** Agent ID(来自 project.config.json),用于直接向 agentbase 查询 Agent 信息 */
|
|
17
|
+
agentId?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare const createAppConfig: (options: {
|
|
18
20
|
port: number;
|
|
19
21
|
agentServerUrl: string;
|
|
20
22
|
open?: boolean;
|
|
21
23
|
}) => AppConfig;
|
|
22
|
-
//# sourceMappingURL=app.config.d.ts.map
|
package/lib/config/app.config.js
CHANGED
|
@@ -22,7 +22,10 @@ container.bind(identifiers_1.SERVICE_IDENTIFIERS.AuthService).to(auth_service_1.
|
|
|
22
22
|
container.bind(identifiers_1.SERVICE_IDENTIFIERS.UploadService).to(upload_service_1.UploadService).inSingletonScope();
|
|
23
23
|
// 绑定控制器
|
|
24
24
|
container.bind(identifiers_1.CONTROLLER_IDENTIFIERS.AgentController).to(agent_controller_1.AgentController).inSingletonScope();
|
|
25
|
-
container
|
|
25
|
+
container
|
|
26
|
+
.bind(identifiers_1.CONTROLLER_IDENTIFIERS.SimulatorController)
|
|
27
|
+
.to(simulator_controller_1.SimulatorController)
|
|
28
|
+
.inSingletonScope();
|
|
26
29
|
container.bind(identifiers_1.CONTROLLER_IDENTIFIERS.AuthController).to(auth_controller_1.AuthController).inSingletonScope();
|
|
27
30
|
container.bind(identifiers_1.CONTROLLER_IDENTIFIERS.UploadController).to(upload_controller_1.UploadController).inSingletonScope();
|
|
28
31
|
// 初始化容器的函数
|
|
@@ -31,4 +34,3 @@ function initializeContainer(context) {
|
|
|
31
34
|
container.bind(identifiers_1.APP_CONTEXT).toConstantValue(context);
|
|
32
35
|
return container;
|
|
33
36
|
}
|
|
34
|
-
//# sourceMappingURL=container.js.map
|
package/lib/container/index.d.ts
CHANGED
package/lib/container/index.js
CHANGED
package/lib/container/types.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { Request, Response } from "express";
|
|
|
2
2
|
export interface IAgentService {
|
|
3
3
|
getAgentInfo(): Promise<any>;
|
|
4
4
|
getAgentStatus(): Promise<any>;
|
|
5
|
+
getFunctionMeta(): Promise<{
|
|
6
|
+
functions: Array<{
|
|
7
|
+
name: string;
|
|
8
|
+
features: {
|
|
9
|
+
websocket: boolean;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
}>;
|
|
5
13
|
uploadFile(params: {
|
|
6
14
|
filename: string;
|
|
7
15
|
fileContent: Buffer;
|
|
@@ -34,6 +42,7 @@ export interface IUploadController {
|
|
|
34
42
|
export interface IAgentController {
|
|
35
43
|
getAgentInfo(req: Request, res: Response): Promise<void>;
|
|
36
44
|
getAgentStatus(req: Request, res: Response): Promise<void>;
|
|
45
|
+
getFunctionMeta(req: Request, res: Response): Promise<void>;
|
|
37
46
|
uploadFile(req: Request, res: Response): Promise<void>;
|
|
38
47
|
}
|
|
39
48
|
export interface ISimulatorController {
|
|
@@ -45,4 +54,3 @@ export interface IAuthController {
|
|
|
45
54
|
hasLogin(req: Request, res: Response): Promise<void>;
|
|
46
55
|
checkLoginStatus(req: Request, res: Response): Promise<void>;
|
|
47
56
|
}
|
|
48
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/container/types.js
CHANGED
|
@@ -6,14 +6,17 @@ export declare class AgentController implements IAgentController {
|
|
|
6
6
|
/**
|
|
7
7
|
* 获取Agent信息
|
|
8
8
|
*/
|
|
9
|
-
getAgentInfo: (
|
|
9
|
+
getAgentInfo: (_req: Request, res: Response) => Promise<void>;
|
|
10
10
|
/**
|
|
11
11
|
* 获取Agent状态
|
|
12
12
|
*/
|
|
13
|
-
getAgentStatus: (
|
|
13
|
+
getAgentStatus: (_req: Request, res: Response) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* 获取函数能力元数据
|
|
16
|
+
*/
|
|
17
|
+
getFunctionMeta: (_req: Request, res: Response) => Promise<void>;
|
|
14
18
|
/**
|
|
15
19
|
* 上传文件(使用 multipart/form-data,对齐 OpenAI 标准)
|
|
16
20
|
*/
|
|
17
21
|
uploadFile: (req: Request, res: Response) => Promise<void>;
|
|
18
22
|
}
|
|
19
|
-
//# sourceMappingURL=agent.controller.d.ts.map
|
|
@@ -20,7 +20,7 @@ let AgentController = class AgentController {
|
|
|
20
20
|
/**
|
|
21
21
|
* 获取Agent信息
|
|
22
22
|
*/
|
|
23
|
-
this.getAgentInfo = async (
|
|
23
|
+
this.getAgentInfo = async (_req, res) => {
|
|
24
24
|
try {
|
|
25
25
|
const agentInfo = await this.agentService.getAgentInfo();
|
|
26
26
|
res.json(agentInfo);
|
|
@@ -35,7 +35,7 @@ let AgentController = class AgentController {
|
|
|
35
35
|
/**
|
|
36
36
|
* 获取Agent状态
|
|
37
37
|
*/
|
|
38
|
-
this.getAgentStatus = async (
|
|
38
|
+
this.getAgentStatus = async (_req, res) => {
|
|
39
39
|
try {
|
|
40
40
|
const status = await this.agentService.getAgentStatus();
|
|
41
41
|
res.json(status);
|
|
@@ -47,6 +47,21 @@ let AgentController = class AgentController {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* 获取函数能力元数据
|
|
52
|
+
*/
|
|
53
|
+
this.getFunctionMeta = async (_req, res) => {
|
|
54
|
+
try {
|
|
55
|
+
const meta = await this.agentService.getFunctionMeta();
|
|
56
|
+
res.json(meta);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error("获取函数元数据失败:", error);
|
|
60
|
+
res.status(500).json({
|
|
61
|
+
error: error instanceof Error ? error.message : `获取函数元数据失败: ${error}`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
50
65
|
/**
|
|
51
66
|
* 上传文件(使用 multipart/form-data,对齐 OpenAI 标准)
|
|
52
67
|
*/
|
|
@@ -99,4 +114,3 @@ exports.AgentController = AgentController = __decorate([
|
|
|
99
114
|
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.AgentService)),
|
|
100
115
|
__metadata("design:paramtypes", [Object])
|
|
101
116
|
], AgentController);
|
|
102
|
-
//# sourceMappingURL=agent.controller.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
1
|
+
import type { Request, Response } from "express";
|
|
2
2
|
import type { IAuthController, IAuthService } from "../container/types";
|
|
3
3
|
export declare class AuthController implements IAuthController {
|
|
4
4
|
private authService;
|
|
@@ -6,18 +6,17 @@ export declare class AuthController implements IAuthController {
|
|
|
6
6
|
/**
|
|
7
7
|
* 获取认证状态
|
|
8
8
|
*/
|
|
9
|
-
getAuthStatus: (
|
|
9
|
+
getAuthStatus: (_req: Request, res: Response) => Promise<void>;
|
|
10
10
|
/**
|
|
11
11
|
* 获取登录信息
|
|
12
12
|
*/
|
|
13
|
-
getLoginInfo: (
|
|
13
|
+
getLoginInfo: (_req: Request, res: Response) => Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* 检查是否已登录
|
|
16
16
|
*/
|
|
17
|
-
hasLogin: (
|
|
17
|
+
hasLogin: (_req: Request, res: Response) => Promise<void>;
|
|
18
18
|
/**
|
|
19
19
|
* 检查登录状态(调用下游服务)
|
|
20
20
|
*/
|
|
21
21
|
checkLoginStatus: (req: Request, res: Response) => Promise<void>;
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=auth.controller.d.ts.map
|
|
@@ -20,7 +20,7 @@ let AuthController = class AuthController {
|
|
|
20
20
|
/**
|
|
21
21
|
* 获取认证状态
|
|
22
22
|
*/
|
|
23
|
-
this.getAuthStatus = async (
|
|
23
|
+
this.getAuthStatus = async (_req, res) => {
|
|
24
24
|
try {
|
|
25
25
|
const authStatus = await this.authService.getAuthStatus();
|
|
26
26
|
res.json({
|
|
@@ -40,7 +40,7 @@ let AuthController = class AuthController {
|
|
|
40
40
|
/**
|
|
41
41
|
* 获取登录信息
|
|
42
42
|
*/
|
|
43
|
-
this.getLoginInfo = async (
|
|
43
|
+
this.getLoginInfo = async (_req, res) => {
|
|
44
44
|
try {
|
|
45
45
|
const loginInfo = await this.authService.getLoginInfo();
|
|
46
46
|
if (!loginInfo) {
|
|
@@ -68,7 +68,7 @@ let AuthController = class AuthController {
|
|
|
68
68
|
/**
|
|
69
69
|
* 检查是否已登录
|
|
70
70
|
*/
|
|
71
|
-
this.hasLogin = async (
|
|
71
|
+
this.hasLogin = async (_req, res) => {
|
|
72
72
|
try {
|
|
73
73
|
const isLoggedIn = this.authService.hasLogin();
|
|
74
74
|
res.json({
|
|
@@ -129,4 +129,3 @@ exports.AuthController = AuthController = __decorate([
|
|
|
129
129
|
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.AuthService)),
|
|
130
130
|
__metadata("design:paramtypes", [Object])
|
|
131
131
|
], AuthController);
|
|
132
|
-
//# sourceMappingURL=auth.controller.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
1
|
+
import type { Request, Response } from "express";
|
|
2
2
|
import type { ISimulatorController, ISimulatorService } from "../container/types";
|
|
3
3
|
export declare class SimulatorController implements ISimulatorController {
|
|
4
4
|
private simulatorService;
|
|
@@ -6,6 +6,5 @@ export declare class SimulatorController implements ISimulatorController {
|
|
|
6
6
|
/**
|
|
7
7
|
* 获取模拟器状态
|
|
8
8
|
*/
|
|
9
|
-
getSimulatorStatus: (
|
|
9
|
+
getSimulatorStatus: (_req: Request, res: Response) => void;
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=simulator.controller.d.ts.map
|
|
@@ -20,7 +20,7 @@ let SimulatorController = class SimulatorController {
|
|
|
20
20
|
/**
|
|
21
21
|
* 获取模拟器状态
|
|
22
22
|
*/
|
|
23
|
-
this.getSimulatorStatus = (
|
|
23
|
+
this.getSimulatorStatus = (_req, res) => {
|
|
24
24
|
try {
|
|
25
25
|
const status = this.simulatorService.getSimulatorStatus();
|
|
26
26
|
res.json(status);
|
|
@@ -41,4 +41,3 @@ exports.SimulatorController = SimulatorController = __decorate([
|
|
|
41
41
|
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.SimulatorService)),
|
|
42
42
|
__metadata("design:paramtypes", [Object])
|
|
43
43
|
], SimulatorController);
|
|
44
|
-
//# sourceMappingURL=simulator.controller.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
1
|
+
import type { Request, Response } from "express";
|
|
2
2
|
import type { IUploadController, IUploadService } from "../container/types";
|
|
3
3
|
export declare class UploadController implements IUploadController {
|
|
4
4
|
private readonly uploadService;
|
|
5
5
|
constructor(uploadService: IUploadService);
|
|
6
6
|
getToken: (_req: Request, res: Response) => Promise<void>;
|
|
7
7
|
}
|
|
8
|
-
//# sourceMappingURL=upload.controller.d.ts.map
|
|
@@ -30,7 +30,11 @@ let UploadController = class UploadController {
|
|
|
30
30
|
res.json({ code: 0, message: "ok", data });
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
|
-
res.status(500).json({
|
|
33
|
+
res.status(500).json({
|
|
34
|
+
code: 500,
|
|
35
|
+
message: error?.message || "获取上传Token失败",
|
|
36
|
+
data: null,
|
|
37
|
+
});
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
}
|
|
@@ -41,4 +45,3 @@ exports.UploadController = UploadController = __decorate([
|
|
|
41
45
|
__param(0, (0, inversify_1.inject)(identifiers_1.SERVICE_IDENTIFIERS.UploadService)),
|
|
42
46
|
__metadata("design:paramtypes", [Object])
|
|
43
47
|
], UploadController);
|
|
44
|
-
//# sourceMappingURL=upload.controller.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -3,5 +3,4 @@ export { App } from "./app";
|
|
|
3
3
|
export { Logger } from "./utils/logger";
|
|
4
4
|
export { AgentService } from "./services/agent.service";
|
|
5
5
|
export { SimulatorService } from "./services/simulator.service";
|
|
6
|
-
export { createAppConfig, type AppConfig, type AppContext } from "./config/app.config";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
6
|
+
export { createAppConfig, type AppConfig, type AppContext, } from "./config/app.config";
|
package/lib/index.js
CHANGED
|
@@ -15,4 +15,3 @@ Object.defineProperty(exports, "SimulatorService", { enumerable: true, get: func
|
|
|
15
15
|
// 配置导出
|
|
16
16
|
var app_config_1 = require("./config/app.config");
|
|
17
17
|
Object.defineProperty(exports, "createAppConfig", { enumerable: true, get: function () { return app_config_1.createAppConfig; } });
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from "express";
|
|
1
|
+
import type { NextFunction, Request, Response } from "express";
|
|
2
2
|
export interface AppError extends Error {
|
|
3
3
|
statusCode?: number;
|
|
4
4
|
isOperational?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const errorHandler: (err: AppError, req: Request, res: Response,
|
|
7
|
-
export declare const notFoundHandler: (
|
|
8
|
-
//# sourceMappingURL=error.middleware.d.ts.map
|
|
6
|
+
export declare const errorHandler: (err: AppError, req: Request, res: Response, _next: NextFunction) => void;
|
|
7
|
+
export declare const notFoundHandler: (_req: Request, res: Response) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.notFoundHandler = exports.errorHandler = void 0;
|
|
4
|
-
const errorHandler = (err, req, res,
|
|
4
|
+
const errorHandler = (err, req, res, _next) => {
|
|
5
5
|
const statusCode = err.statusCode || 500;
|
|
6
6
|
const message = err.message || "服务器内部错误";
|
|
7
7
|
console.error("Error:", {
|
|
@@ -20,7 +20,7 @@ const errorHandler = (err, req, res, next) => {
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
exports.errorHandler = errorHandler;
|
|
23
|
-
const notFoundHandler = (
|
|
23
|
+
const notFoundHandler = (_req, res) => {
|
|
24
24
|
res.status(404).json({
|
|
25
25
|
error: {
|
|
26
26
|
message: "未找到请求路径",
|
|
@@ -30,4 +30,3 @@ const notFoundHandler = (req, res) => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
exports.notFoundHandler = notFoundHandler;
|
|
33
|
-
//# sourceMappingURL=error.middleware.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { NextFunction, Request, Response } from "express";
|
|
1
|
+
import type { NextFunction, Request, Response } from "express";
|
|
2
2
|
export declare const createProxyMiddleware: (agentServerUrl: string) => (req: Request, res: Response, next: NextFunction) => void;
|
|
3
|
-
//# sourceMappingURL=proxy.middleware.d.ts.map
|
package/lib/routes/agent.d.ts
CHANGED
package/lib/routes/agent.js
CHANGED
|
@@ -11,9 +11,10 @@ const createAgentRoutes = (container) => {
|
|
|
11
11
|
router.get("/info/get", agentController.getAgentInfo);
|
|
12
12
|
// 获取Agent状态
|
|
13
13
|
router.get("/info/status", agentController.getAgentStatus);
|
|
14
|
+
// 获取函数能力元数据(WebSocket 等特性检测)
|
|
15
|
+
router.get("/meta", agentController.getFunctionMeta);
|
|
14
16
|
// 上传文件(使用 multipart/form-data 接收,元数据和文件都在 body 里)
|
|
15
17
|
router.post("/upload-openai-file", upload_middleware_1.uploadSingleFile, agentController.uploadFile);
|
|
16
18
|
return router;
|
|
17
19
|
};
|
|
18
20
|
exports.createAgentRoutes = createAgentRoutes;
|
|
19
|
-
//# sourceMappingURL=agent.js.map
|
package/lib/routes/auth.d.ts
CHANGED
package/lib/routes/auth.js
CHANGED
package/lib/routes/index.d.ts
CHANGED
package/lib/routes/index.js
CHANGED
package/lib/routes/simulator.js
CHANGED
package/lib/routes/upload.d.ts
CHANGED
package/lib/routes/upload.js
CHANGED
|
@@ -22,15 +22,29 @@ export interface AgentStatus {
|
|
|
22
22
|
}
|
|
23
23
|
export declare class AgentService implements IAgentService {
|
|
24
24
|
private parsedServerUrl;
|
|
25
|
+
private agentId?;
|
|
25
26
|
constructor(context: any);
|
|
26
27
|
/**
|
|
27
|
-
* 获取Agent
|
|
28
|
+
* 获取 Agent 信息。
|
|
29
|
+
* 直接请求 agentbase `/agent/info`,不经过开发者 Agent Server(rcb-ff),
|
|
30
|
+
* 避免开发者代码异常导致获取失败。
|
|
28
31
|
*/
|
|
29
32
|
getAgentInfo(): Promise<AgentSimulatorInfo>;
|
|
30
33
|
/**
|
|
31
34
|
* 获取Agent状态
|
|
32
35
|
*/
|
|
33
36
|
getAgentStatus(): Promise<AgentStatus>;
|
|
37
|
+
/**
|
|
38
|
+
* 获取函数能力元数据(用于检测函数是否支持 WebSocket 等特性)
|
|
39
|
+
*/
|
|
40
|
+
getFunctionMeta(): Promise<{
|
|
41
|
+
functions: Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
features: {
|
|
44
|
+
websocket: boolean;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
34
48
|
/**
|
|
35
49
|
* 上传文件到云函数
|
|
36
50
|
* 使用 multipart/form-data 格式传输,对齐 OpenAI 文件上传标准
|
|
@@ -46,4 +60,3 @@ export declare class AgentService implements IAgentService {
|
|
|
46
60
|
*/
|
|
47
61
|
private transformToAgentSimulatorInfo;
|
|
48
62
|
}
|
|
49
|
-
//# sourceMappingURL=agent.service.d.ts.map
|