@vectorx/agent-simulator 0.0.0-beta-20251112071234

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 (303) hide show
  1. package/README.md +76 -0
  2. package/bin/agent.js +55 -0
  3. package/lib/app.d.ts +43 -0
  4. package/lib/app.d.ts.map +1 -0
  5. package/lib/app.js +99 -0
  6. package/lib/app.js.map +1 -0
  7. package/lib/config/api.config.d.ts +2 -0
  8. package/lib/config/api.config.d.ts.map +1 -0
  9. package/lib/config/api.config.js +13 -0
  10. package/lib/config/api.config.js.map +1 -0
  11. package/lib/config/app.config.d.ts +22 -0
  12. package/lib/config/app.config.d.ts.map +1 -0
  13. package/lib/config/app.config.js +18 -0
  14. package/lib/config/app.config.js.map +1 -0
  15. package/lib/config/upload.config.d.ts +6 -0
  16. package/lib/config/upload.config.d.ts.map +1 -0
  17. package/lib/config/upload.config.js +10 -0
  18. package/lib/config/upload.config.js.map +1 -0
  19. package/lib/container/container.d.ts +6 -0
  20. package/lib/container/container.d.ts.map +1 -0
  21. package/lib/container/container.js +34 -0
  22. package/lib/container/container.js.map +1 -0
  23. package/lib/container/identifiers.d.ts +14 -0
  24. package/lib/container/identifiers.d.ts.map +1 -0
  25. package/lib/container/identifiers.js +20 -0
  26. package/lib/container/identifiers.js.map +1 -0
  27. package/lib/container/index.d.ts +4 -0
  28. package/lib/container/index.d.ts.map +1 -0
  29. package/lib/container/index.js +20 -0
  30. package/lib/container/index.js.map +1 -0
  31. package/lib/container/types.d.ts +48 -0
  32. package/lib/container/types.d.ts.map +1 -0
  33. package/lib/container/types.js +3 -0
  34. package/lib/container/types.js.map +1 -0
  35. package/lib/controllers/agent.controller.d.ts +19 -0
  36. package/lib/controllers/agent.controller.d.ts.map +1 -0
  37. package/lib/controllers/agent.controller.js +102 -0
  38. package/lib/controllers/agent.controller.js.map +1 -0
  39. package/lib/controllers/auth.controller.d.ts +23 -0
  40. package/lib/controllers/auth.controller.d.ts.map +1 -0
  41. package/lib/controllers/auth.controller.js +132 -0
  42. package/lib/controllers/auth.controller.js.map +1 -0
  43. package/lib/controllers/simulator.controller.d.ts +11 -0
  44. package/lib/controllers/simulator.controller.d.ts.map +1 -0
  45. package/lib/controllers/simulator.controller.js +44 -0
  46. package/lib/controllers/simulator.controller.js.map +1 -0
  47. package/lib/controllers/upload.controller.d.ts +8 -0
  48. package/lib/controllers/upload.controller.d.ts.map +1 -0
  49. package/lib/controllers/upload.controller.js +44 -0
  50. package/lib/controllers/upload.controller.js.map +1 -0
  51. package/lib/index.d.ts +7 -0
  52. package/lib/index.d.ts.map +1 -0
  53. package/lib/index.js +18 -0
  54. package/lib/index.js.map +1 -0
  55. package/lib/middleware/cors.middleware.d.ts +7 -0
  56. package/lib/middleware/cors.middleware.d.ts.map +1 -0
  57. package/lib/middleware/cors.middleware.js +14 -0
  58. package/lib/middleware/cors.middleware.js.map +1 -0
  59. package/lib/middleware/error.middleware.d.ts +8 -0
  60. package/lib/middleware/error.middleware.d.ts.map +1 -0
  61. package/lib/middleware/error.middleware.js +33 -0
  62. package/lib/middleware/error.middleware.js.map +1 -0
  63. package/lib/middleware/proxy.middleware.d.ts +3 -0
  64. package/lib/middleware/proxy.middleware.d.ts.map +1 -0
  65. package/lib/middleware/proxy.middleware.js +21 -0
  66. package/lib/middleware/proxy.middleware.js.map +1 -0
  67. package/lib/middleware/upload.middleware.d.ts +10 -0
  68. package/lib/middleware/upload.middleware.d.ts.map +1 -0
  69. package/lib/middleware/upload.middleware.js +27 -0
  70. package/lib/middleware/upload.middleware.js.map +1 -0
  71. package/lib/routes/agent.d.ts +3 -0
  72. package/lib/routes/agent.d.ts.map +1 -0
  73. package/lib/routes/agent.js +19 -0
  74. package/lib/routes/agent.js.map +1 -0
  75. package/lib/routes/auth.d.ts +3 -0
  76. package/lib/routes/auth.d.ts.map +1 -0
  77. package/lib/routes/auth.js +20 -0
  78. package/lib/routes/auth.js.map +1 -0
  79. package/lib/routes/index.d.ts +3 -0
  80. package/lib/routes/index.d.ts.map +1 -0
  81. package/lib/routes/index.js +19 -0
  82. package/lib/routes/index.js.map +1 -0
  83. package/lib/routes/simulator.d.ts +3 -0
  84. package/lib/routes/simulator.d.ts.map +1 -0
  85. package/lib/routes/simulator.js +14 -0
  86. package/lib/routes/simulator.js.map +1 -0
  87. package/lib/routes/upload.d.ts +3 -0
  88. package/lib/routes/upload.d.ts.map +1 -0
  89. package/lib/routes/upload.js +13 -0
  90. package/lib/routes/upload.js.map +1 -0
  91. package/lib/services/agent.service.d.ts +49 -0
  92. package/lib/services/agent.service.d.ts.map +1 -0
  93. package/lib/services/agent.service.js +147 -0
  94. package/lib/services/agent.service.js.map +1 -0
  95. package/lib/services/auth.service.d.ts +55 -0
  96. package/lib/services/auth.service.d.ts.map +1 -0
  97. package/lib/services/auth.service.js +124 -0
  98. package/lib/services/auth.service.js.map +1 -0
  99. package/lib/services/simulator.service.d.ts +23 -0
  100. package/lib/services/simulator.service.d.ts.map +1 -0
  101. package/lib/services/simulator.service.js +49 -0
  102. package/lib/services/simulator.service.js.map +1 -0
  103. package/lib/services/upload.service.d.ts +32 -0
  104. package/lib/services/upload.service.d.ts.map +1 -0
  105. package/lib/services/upload.service.js +61 -0
  106. package/lib/services/upload.service.js.map +1 -0
  107. package/lib/simulator.d.ts +27 -0
  108. package/lib/simulator.d.ts.map +1 -0
  109. package/lib/simulator.js +79 -0
  110. package/lib/simulator.js.map +1 -0
  111. package/lib/utils/logger.d.ts +8 -0
  112. package/lib/utils/logger.d.ts.map +1 -0
  113. package/lib/utils/logger.js +28 -0
  114. package/lib/utils/logger.js.map +1 -0
  115. package/lib/utils/request.d.ts +11 -0
  116. package/lib/utils/request.d.ts.map +1 -0
  117. package/lib/utils/request.js +36 -0
  118. package/lib/utils/request.js.map +1 -0
  119. package/lib/utils/url-parser.d.ts +14 -0
  120. package/lib/utils/url-parser.d.ts.map +1 -0
  121. package/lib/utils/url-parser.js +25 -0
  122. package/lib/utils/url-parser.js.map +1 -0
  123. package/lib/utils.d.ts +6 -0
  124. package/lib/utils.d.ts.map +1 -0
  125. package/lib/utils.js +12 -0
  126. package/lib/utils.js.map +1 -0
  127. package/lib/webview-ui/Agent.d.ts +5 -0
  128. package/lib/webview-ui/Agent.d.ts.map +1 -0
  129. package/lib/webview-ui/Agent.js +24 -0
  130. package/lib/webview-ui/Agent.js.map +1 -0
  131. package/lib/webview-ui/App.d.ts +3 -0
  132. package/lib/webview-ui/App.d.ts.map +1 -0
  133. package/lib/webview-ui/App.js +775 -0
  134. package/lib/webview-ui/App.js.map +1 -0
  135. package/lib/webview-ui/ErrorBoundary.d.ts +19 -0
  136. package/lib/webview-ui/ErrorBoundary.d.ts.map +1 -0
  137. package/lib/webview-ui/ErrorBoundary.js +54 -0
  138. package/lib/webview-ui/ErrorBoundary.js.map +1 -0
  139. package/lib/webview-ui/components/AsyncTaskBlock.d.ts +13 -0
  140. package/lib/webview-ui/components/AsyncTaskBlock.d.ts.map +1 -0
  141. package/lib/webview-ui/components/AsyncTaskBlock.js +179 -0
  142. package/lib/webview-ui/components/AsyncTaskBlock.js.map +1 -0
  143. package/lib/webview-ui/components/AuthIndicator.d.ts +3 -0
  144. package/lib/webview-ui/components/AuthIndicator.d.ts.map +1 -0
  145. package/lib/webview-ui/components/AuthIndicator.js +17 -0
  146. package/lib/webview-ui/components/AuthIndicator.js.map +1 -0
  147. package/lib/webview-ui/components/ErrorCard.d.ts +11 -0
  148. package/lib/webview-ui/components/ErrorCard.d.ts.map +1 -0
  149. package/lib/webview-ui/components/ErrorCard.js +18 -0
  150. package/lib/webview-ui/components/ErrorCard.js.map +1 -0
  151. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +20 -0
  152. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.d.ts.map +1 -0
  153. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +45 -0
  154. package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js.map +1 -0
  155. package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts +9 -0
  156. package/lib/webview-ui/components/KnowledgeBaseSearchResult.d.ts.map +1 -0
  157. package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +31 -0
  158. package/lib/webview-ui/components/KnowledgeBaseSearchResult.js.map +1 -0
  159. package/lib/webview-ui/components/MarkdownRenderer.d.ts +7 -0
  160. package/lib/webview-ui/components/MarkdownRenderer.d.ts.map +1 -0
  161. package/lib/webview-ui/components/MarkdownRenderer.js +28 -0
  162. package/lib/webview-ui/components/MarkdownRenderer.js.map +1 -0
  163. package/lib/webview-ui/components/MessageRenderer.d.ts +7 -0
  164. package/lib/webview-ui/components/MessageRenderer.d.ts.map +1 -0
  165. package/lib/webview-ui/components/MessageRenderer.js +33 -0
  166. package/lib/webview-ui/components/MessageRenderer.js.map +1 -0
  167. package/lib/webview-ui/components/MultimodalFileRenderer.d.ts +20 -0
  168. package/lib/webview-ui/components/MultimodalFileRenderer.d.ts.map +1 -0
  169. package/lib/webview-ui/components/MultimodalFileRenderer.js +216 -0
  170. package/lib/webview-ui/components/MultimodalFileRenderer.js.map +1 -0
  171. package/lib/webview-ui/components/ThinkingBlock.d.ts +8 -0
  172. package/lib/webview-ui/components/ThinkingBlock.d.ts.map +1 -0
  173. package/lib/webview-ui/components/ThinkingBlock.js +75 -0
  174. package/lib/webview-ui/components/ThinkingBlock.js.map +1 -0
  175. package/lib/webview-ui/components/ToolUseBlock.d.ts +10 -0
  176. package/lib/webview-ui/components/ToolUseBlock.d.ts.map +1 -0
  177. package/lib/webview-ui/components/ToolUseBlock.js +14 -0
  178. package/lib/webview-ui/components/ToolUseBlock.js.map +1 -0
  179. package/lib/webview-ui/components/ToolUseBlockHeader.d.ts +10 -0
  180. package/lib/webview-ui/components/ToolUseBlockHeader.d.ts.map +1 -0
  181. package/lib/webview-ui/components/ToolUseBlockHeader.js +31 -0
  182. package/lib/webview-ui/components/ToolUseBlockHeader.js.map +1 -0
  183. package/lib/webview-ui/components/UploadPreview.d.ts +6 -0
  184. package/lib/webview-ui/components/UploadPreview.d.ts.map +1 -0
  185. package/lib/webview-ui/components/UploadPreview.js +12 -0
  186. package/lib/webview-ui/components/UploadPreview.js.map +1 -0
  187. package/lib/webview-ui/components/WelcomeModule.d.ts +10 -0
  188. package/lib/webview-ui/components/WelcomeModule.d.ts.map +1 -0
  189. package/lib/webview-ui/components/WelcomeModule.js +161 -0
  190. package/lib/webview-ui/components/WelcomeModule.js.map +1 -0
  191. package/lib/webview-ui/components/index.d.ts +14 -0
  192. package/lib/webview-ui/components/index.d.ts.map +1 -0
  193. package/lib/webview-ui/components/index.js +30 -0
  194. package/lib/webview-ui/components/index.js.map +1 -0
  195. package/lib/webview-ui/config/cos-config.d.ts +41 -0
  196. package/lib/webview-ui/config/cos-config.d.ts.map +1 -0
  197. package/lib/webview-ui/config/cos-config.js +83 -0
  198. package/lib/webview-ui/config/cos-config.js.map +1 -0
  199. package/lib/webview-ui/config/http-config.d.ts +8 -0
  200. package/lib/webview-ui/config/http-config.d.ts.map +1 -0
  201. package/lib/webview-ui/config/http-config.js +36 -0
  202. package/lib/webview-ui/config/http-config.js.map +1 -0
  203. package/lib/webview-ui/constants.d.ts +18 -0
  204. package/lib/webview-ui/constants.d.ts.map +1 -0
  205. package/lib/webview-ui/constants.js +25 -0
  206. package/lib/webview-ui/constants.js.map +1 -0
  207. package/lib/webview-ui/contexts/AgentContext.d.ts +13 -0
  208. package/lib/webview-ui/contexts/AgentContext.d.ts.map +1 -0
  209. package/lib/webview-ui/contexts/AgentContext.js +19 -0
  210. package/lib/webview-ui/contexts/AgentContext.js.map +1 -0
  211. package/lib/webview-ui/contexts/AuthContext.d.ts +17 -0
  212. package/lib/webview-ui/contexts/AuthContext.d.ts.map +1 -0
  213. package/lib/webview-ui/contexts/AuthContext.js +79 -0
  214. package/lib/webview-ui/contexts/AuthContext.js.map +1 -0
  215. package/lib/webview-ui/contexts/ThemeContext.d.ts +12 -0
  216. package/lib/webview-ui/contexts/ThemeContext.d.ts.map +1 -0
  217. package/lib/webview-ui/contexts/ThemeContext.js +21 -0
  218. package/lib/webview-ui/contexts/ThemeContext.js.map +1 -0
  219. package/lib/webview-ui/hooks/useAgentStatus.d.ts +17 -0
  220. package/lib/webview-ui/hooks/useAgentStatus.d.ts.map +1 -0
  221. package/lib/webview-ui/hooks/useAgentStatus.js +117 -0
  222. package/lib/webview-ui/hooks/useAgentStatus.js.map +1 -0
  223. package/lib/webview-ui/hooks/useUploader.d.ts +19 -0
  224. package/lib/webview-ui/hooks/useUploader.d.ts.map +1 -0
  225. package/lib/webview-ui/hooks/useUploader.js +132 -0
  226. package/lib/webview-ui/hooks/useUploader.js.map +1 -0
  227. package/lib/webview-ui/hooks/useUserAvatar.d.ts +28 -0
  228. package/lib/webview-ui/hooks/useUserAvatar.d.ts.map +1 -0
  229. package/lib/webview-ui/hooks/useUserAvatar.js +74 -0
  230. package/lib/webview-ui/hooks/useUserAvatar.js.map +1 -0
  231. package/lib/webview-ui/index.d.ts +3 -0
  232. package/lib/webview-ui/index.d.ts.map +1 -0
  233. package/lib/webview-ui/index.js +17 -0
  234. package/lib/webview-ui/index.js.map +1 -0
  235. package/lib/webview-ui/services/agent-service.d.ts +124 -0
  236. package/lib/webview-ui/services/agent-service.d.ts.map +1 -0
  237. package/lib/webview-ui/services/agent-service.js +80 -0
  238. package/lib/webview-ui/services/agent-service.js.map +1 -0
  239. package/lib/webview-ui/services/index.d.ts +3 -0
  240. package/lib/webview-ui/services/index.d.ts.map +1 -0
  241. package/lib/webview-ui/services/index.js +19 -0
  242. package/lib/webview-ui/services/index.js.map +1 -0
  243. package/lib/webview-ui/services/logger-service.d.ts +46 -0
  244. package/lib/webview-ui/services/logger-service.d.ts.map +1 -0
  245. package/lib/webview-ui/services/logger-service.js +69 -0
  246. package/lib/webview-ui/services/logger-service.js.map +1 -0
  247. package/lib/webview-ui/styles/copilot.d.ts +14 -0
  248. package/lib/webview-ui/styles/copilot.d.ts.map +1 -0
  249. package/lib/webview-ui/styles/copilot.js +119 -0
  250. package/lib/webview-ui/styles/copilot.js.map +1 -0
  251. package/lib/webview-ui/styles/workarea.d.ts +11 -0
  252. package/lib/webview-ui/styles/workarea.d.ts.map +1 -0
  253. package/lib/webview-ui/styles/workarea.js +73 -0
  254. package/lib/webview-ui/styles/workarea.js.map +1 -0
  255. package/lib/webview-ui/types.d.ts +65 -0
  256. package/lib/webview-ui/types.d.ts.map +1 -0
  257. package/lib/webview-ui/types.js +3 -0
  258. package/lib/webview-ui/types.js.map +1 -0
  259. package/lib/webview-ui/utils/cos.d.ts +65 -0
  260. package/lib/webview-ui/utils/cos.d.ts.map +1 -0
  261. package/lib/webview-ui/utils/cos.js +113 -0
  262. package/lib/webview-ui/utils/cos.js.map +1 -0
  263. package/lib/webview-ui/utils/http-client.d.ts +44 -0
  264. package/lib/webview-ui/utils/http-client.d.ts.map +1 -0
  265. package/lib/webview-ui/utils/http-client.js +101 -0
  266. package/lib/webview-ui/utils/http-client.js.map +1 -0
  267. package/lib/webview-ui/utils/stream-text-handler.d.ts +4 -0
  268. package/lib/webview-ui/utils/stream-text-handler.d.ts.map +1 -0
  269. package/lib/webview-ui/utils/stream-text-handler.js +54 -0
  270. package/lib/webview-ui/utils/stream-text-handler.js.map +1 -0
  271. package/lib/webview-ui/utils/upload.d.ts +8 -0
  272. package/lib/webview-ui/utils/upload.d.ts.map +1 -0
  273. package/lib/webview-ui/utils/upload.js +22 -0
  274. package/lib/webview-ui/utils/upload.js.map +1 -0
  275. package/lib/webview-ui/widgets/BubbleComponents.d.ts +8 -0
  276. package/lib/webview-ui/widgets/BubbleComponents.d.ts.map +1 -0
  277. package/lib/webview-ui/widgets/BubbleComponents.js +62 -0
  278. package/lib/webview-ui/widgets/BubbleComponents.js.map +1 -0
  279. package/lib/webview-ui/widgets/ChatInput.d.ts +27 -0
  280. package/lib/webview-ui/widgets/ChatInput.d.ts.map +1 -0
  281. package/lib/webview-ui/widgets/ChatInput.js +203 -0
  282. package/lib/webview-ui/widgets/ChatInput.js.map +1 -0
  283. package/lib/webview-ui/widgets/LogPanel.d.ts +15 -0
  284. package/lib/webview-ui/widgets/LogPanel.d.ts.map +1 -0
  285. package/lib/webview-ui/widgets/LogPanel.js +59 -0
  286. package/lib/webview-ui/widgets/LogPanel.js.map +1 -0
  287. package/lib/webview-ui/widgets/SystemLogs.d.ts +30 -0
  288. package/lib/webview-ui/widgets/SystemLogs.d.ts.map +1 -0
  289. package/lib/webview-ui/widgets/SystemLogs.js +460 -0
  290. package/lib/webview-ui/widgets/SystemLogs.js.map +1 -0
  291. package/lib/webview-ui/widgets/ToolBar.d.ts +18 -0
  292. package/lib/webview-ui/widgets/ToolBar.d.ts.map +1 -0
  293. package/lib/webview-ui/widgets/ToolBar.js +90 -0
  294. package/lib/webview-ui/widgets/ToolBar.js.map +1 -0
  295. package/lib/webview-ui/widgets/index.d.ts +6 -0
  296. package/lib/webview-ui/widgets/index.d.ts.map +1 -0
  297. package/lib/webview-ui/widgets/index.js +22 -0
  298. package/lib/webview-ui/widgets/index.js.map +1 -0
  299. package/package.json +92 -0
  300. package/public/assets/index-j_rEEDWU.js +93 -0
  301. package/public/assets/main.js +603 -0
  302. package/public/assets/style.css +1 -0
  303. package/public/index.html +15 -0
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAgentRoutes = void 0;
4
+ const express_1 = require("express");
5
+ const identifiers_1 = require("../container/identifiers");
6
+ const upload_middleware_1 = require("../middleware/upload.middleware");
7
+ const createAgentRoutes = (container) => {
8
+ const router = (0, express_1.Router)();
9
+ const agentController = container.get(identifiers_1.CONTROLLER_IDENTIFIERS.AgentController);
10
+ // 获取Agent信息
11
+ router.get("/info/get", agentController.getAgentInfo);
12
+ // 获取Agent状态
13
+ router.get("/info/status", agentController.getAgentStatus);
14
+ // 上传文件(使用 multipart/form-data 接收,元数据和文件都在 body 里)
15
+ router.post("/upload-openai-file", upload_middleware_1.uploadSingleFile, agentController.uploadFile);
16
+ return router;
17
+ };
18
+ exports.createAgentRoutes = createAgentRoutes;
19
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/routes/agent.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,0DAAkE;AAElE,uEAAmE;AAE5D,MAAM,iBAAiB,GAAG,CAAC,SAAoB,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IACxB,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAmB,oCAAsB,CAAC,eAAe,CAAC,CAAC;IAEhG,YAAY;IACZ,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAEtD,YAAY;IACZ,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAE3D,kDAAkD;IAClD,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,oCAAgB,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B"}
@@ -0,0 +1,3 @@
1
+ import type { Container } from "inversify";
2
+ export declare const createAuthRoutes: (container: Container) => import("express-serve-static-core").Router;
3
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/routes/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,eAAO,MAAM,gBAAgB,GAAI,WAAW,SAAS,+CAiBpD,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuthRoutes = void 0;
4
+ const express_1 = require("express");
5
+ const identifiers_1 = require("../container/identifiers");
6
+ const createAuthRoutes = (container) => {
7
+ const router = (0, express_1.Router)();
8
+ const authController = container.get(identifiers_1.CONTROLLER_IDENTIFIERS.AuthController);
9
+ // 获取认证状态
10
+ router.get("/status", authController.getAuthStatus);
11
+ // 获取登录信息
12
+ router.get("/login-info", authController.getLoginInfo);
13
+ // 检查是否已登录
14
+ router.get("/has-login", authController.hasLogin);
15
+ // 检查登录状态(调用下游服务)
16
+ router.post("/check", authController.checkLoginStatus);
17
+ return router;
18
+ };
19
+ exports.createAuthRoutes = createAuthRoutes;
20
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/routes/auth.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,0DAAkE;AAG3D,MAAM,gBAAgB,GAAG,CAAC,SAAoB,EAAE,EAAE;IACvD,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IACxB,MAAM,cAAc,GAAG,SAAS,CAAC,GAAG,CAAkB,oCAAsB,CAAC,cAAc,CAAC,CAAC;IAE7F,SAAS;IACT,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAEpD,SAAS;IACT,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAEvD,UAAU;IACV,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAElD,iBAAiB;IACjB,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAEvD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjBW,QAAA,gBAAgB,oBAiB3B"}
@@ -0,0 +1,3 @@
1
+ import type { Container } from "inversify";
2
+ export declare const createRoutes: (container: Container) => import("express-serve-static-core").Router;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM3C,eAAO,MAAM,YAAY,GAAI,WAAW,SAAS,+CAUhD,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRoutes = void 0;
4
+ const express_1 = require("express");
5
+ const agent_1 = require("./agent");
6
+ const auth_1 = require("./auth");
7
+ const simulator_1 = require("./simulator");
8
+ const upload_1 = require("./upload");
9
+ const createRoutes = (container) => {
10
+ const router = (0, express_1.Router)();
11
+ // 注册路由
12
+ router.use("/agent", (0, agent_1.createAgentRoutes)(container));
13
+ router.use("/simulator", (0, simulator_1.createSimulatorRoutes)(container));
14
+ router.use("/auth", (0, auth_1.createAuthRoutes)(container));
15
+ router.use("/upload", (0, upload_1.createUploadRoutes)(container));
16
+ return router;
17
+ };
18
+ exports.createRoutes = createRoutes;
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,mCAA4C;AAC5C,iCAA0C;AAC1C,2CAAoD;AACpD,qCAA8C;AAEvC,MAAM,YAAY,GAAG,CAAC,SAAoB,EAAE,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,OAAO;IACP,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,yBAAiB,EAAC,SAAS,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAA,iCAAqB,EAAC,SAAS,CAAC,CAAC,CAAC;IAC3D,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,uBAAgB,EAAC,SAAS,CAAC,CAAC,CAAC;IACjD,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,IAAA,2BAAkB,EAAC,SAAS,CAAC,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAVW,QAAA,YAAY,gBAUvB"}
@@ -0,0 +1,3 @@
1
+ import type { Container } from "inversify";
2
+ export declare const createSimulatorRoutes: (container: Container) => import("express-serve-static-core").Router;
3
+ //# sourceMappingURL=simulator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../src/routes/simulator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,eAAO,MAAM,qBAAqB,GAAI,WAAW,SAAS,+CAQzD,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSimulatorRoutes = void 0;
4
+ const express_1 = require("express");
5
+ const identifiers_1 = require("../container/identifiers");
6
+ const createSimulatorRoutes = (container) => {
7
+ const router = (0, express_1.Router)();
8
+ const simulatorController = container.get(identifiers_1.CONTROLLER_IDENTIFIERS.SimulatorController);
9
+ // 获取模拟器状态
10
+ router.get("/status", simulatorController.getSimulatorStatus);
11
+ return router;
12
+ };
13
+ exports.createSimulatorRoutes = createSimulatorRoutes;
14
+ //# sourceMappingURL=simulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulator.js","sourceRoot":"","sources":["../../src/routes/simulator.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,0DAAkE;AAG3D,MAAM,qBAAqB,GAAG,CAAC,SAAoB,EAAE,EAAE;IAC5D,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IACxB,MAAM,mBAAmB,GAAG,SAAS,CAAC,GAAG,CAAuB,oCAAsB,CAAC,mBAAmB,CAAC,CAAC;IAE5G,UAAU;IACV,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;IAE9D,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC"}
@@ -0,0 +1,3 @@
1
+ import type { Container } from "inversify";
2
+ export declare const createUploadRoutes: (container: Container) => import("express-serve-static-core").Router;
3
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/routes/upload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,eAAO,MAAM,kBAAkB,GAAI,WAAW,SAAS,+CAOtD,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createUploadRoutes = void 0;
4
+ const express_1 = require("express");
5
+ const identifiers_1 = require("../container/identifiers");
6
+ const createUploadRoutes = (container) => {
7
+ const router = (0, express_1.Router)();
8
+ const uploadController = container.get(identifiers_1.CONTROLLER_IDENTIFIERS.UploadController);
9
+ router.get("/token", uploadController.getToken);
10
+ return router;
11
+ };
12
+ exports.createUploadRoutes = createUploadRoutes;
13
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/routes/upload.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,0DAAkE;AAG3D,MAAM,kBAAkB,GAAG,CAAC,SAAoB,EAAE,EAAE;IACzD,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IACxB,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAoB,oCAAsB,CAAC,gBAAgB,CAAC,CAAC;IAEnG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B"}
@@ -0,0 +1,49 @@
1
+ import type { IAgentService } from "../container/types";
2
+ export interface AgentInfo {
3
+ agent_icon: string;
4
+ agent_id: string;
5
+ agent_name: string;
6
+ }
7
+ export interface AgentSimulatorInfo {
8
+ agentInfo: AgentInfo;
9
+ agentServerUrl: string;
10
+ }
11
+ export interface AgentStatus {
12
+ status: "normal" | "error";
13
+ health?: any;
14
+ message?: string;
15
+ timestamp: number;
16
+ agentServerUrl: string;
17
+ parsedUrl: {
18
+ hostname: string;
19
+ port: string;
20
+ baseUrl: string;
21
+ };
22
+ }
23
+ export declare class AgentService implements IAgentService {
24
+ private parsedServerUrl;
25
+ constructor(context: any);
26
+ /**
27
+ * 获取Agent信息
28
+ */
29
+ getAgentInfo(): Promise<AgentSimulatorInfo>;
30
+ /**
31
+ * 获取Agent状态
32
+ */
33
+ getAgentStatus(): Promise<AgentStatus>;
34
+ /**
35
+ * 上传文件到云函数
36
+ * 使用 multipart/form-data 格式传输,对齐 OpenAI 文件上传标准
37
+ */
38
+ uploadFile(params: {
39
+ filename: string;
40
+ fileContent: Buffer;
41
+ purpose?: string;
42
+ mimeType?: string;
43
+ }): Promise<any>;
44
+ /**
45
+ * 转换后端数据为AgentSimulatorInfo格式
46
+ */
47
+ private transformToAgentSimulatorInfo;
48
+ }
49
+ //# sourceMappingURL=agent.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.service.d.ts","sourceRoot":"","sources":["../../src/services/agent.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,qBACa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,eAAe,CAAyC;gBAE/B,OAAO,EAAE,GAAG;IAI7C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAqBjD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IA+C5C;;;OAGG;IACG,UAAU,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,GAAG,CAAC;IAgChB;;OAEG;IACH,OAAO,CAAC,6BAA6B;CAUtC"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AgentService = void 0;
19
+ const form_data_1 = __importDefault(require("form-data"));
20
+ const inversify_1 = require("inversify");
21
+ const node_fetch_1 = __importDefault(require("node-fetch"));
22
+ const container_1 = require("../container");
23
+ const url_parser_1 = require("../utils/url-parser");
24
+ let AgentService = class AgentService {
25
+ constructor(context) {
26
+ this.parsedServerUrl = (0, url_parser_1.parseAgentServerUrl)(context.agentServerUrl);
27
+ }
28
+ /**
29
+ * 获取Agent信息
30
+ */
31
+ async getAgentInfo() {
32
+ const healthUrl = `${this.parsedServerUrl.fullUrl}/info`;
33
+ const response = await (0, node_fetch_1.default)(healthUrl);
34
+ if (!response.ok) {
35
+ throw new Error(`无法连接到后端服务: ${response.status} ${response.statusText}`);
36
+ }
37
+ const resData = await response.json();
38
+ if (resData.code !== 0) {
39
+ throw new Error(`后端服务返回错误: ${resData.message || "未知错误"}`);
40
+ }
41
+ const { agent_info } = resData.data;
42
+ if (!agent_info) {
43
+ throw new Error("后端服务返回的数据中缺少 agent_info 字段");
44
+ }
45
+ return this.transformToAgentSimulatorInfo(agent_info);
46
+ }
47
+ /**
48
+ * 获取Agent状态
49
+ */
50
+ async getAgentStatus() {
51
+ try {
52
+ // 调用后端服务的 /health 接口检查状态
53
+ const healthUrl = `${this.parsedServerUrl.fullUrl}/health`;
54
+ const response = await (0, node_fetch_1.default)(healthUrl);
55
+ if (response.ok) {
56
+ const healthData = await response.json();
57
+ return {
58
+ status: "normal",
59
+ health: healthData,
60
+ timestamp: Date.now(),
61
+ agentServerUrl: this.parsedServerUrl.fullUrl,
62
+ parsedUrl: {
63
+ hostname: this.parsedServerUrl.hostname,
64
+ port: this.parsedServerUrl.port,
65
+ baseUrl: this.parsedServerUrl.baseUrl,
66
+ },
67
+ };
68
+ }
69
+ else {
70
+ return {
71
+ status: "error",
72
+ message: `后端服务响应异常: ${response.status}`,
73
+ timestamp: Date.now(),
74
+ agentServerUrl: this.parsedServerUrl.fullUrl,
75
+ parsedUrl: {
76
+ hostname: this.parsedServerUrl.hostname,
77
+ port: this.parsedServerUrl.port,
78
+ baseUrl: this.parsedServerUrl.baseUrl,
79
+ },
80
+ };
81
+ }
82
+ }
83
+ catch (error) {
84
+ return {
85
+ status: "error",
86
+ message: `无法连接到后端服务: ${error instanceof Error ? error.message : "未知错误"}`,
87
+ timestamp: Date.now(),
88
+ agentServerUrl: this.parsedServerUrl.fullUrl,
89
+ parsedUrl: {
90
+ hostname: this.parsedServerUrl.hostname,
91
+ port: this.parsedServerUrl.port,
92
+ baseUrl: this.parsedServerUrl.baseUrl,
93
+ },
94
+ };
95
+ }
96
+ }
97
+ /**
98
+ * 上传文件到云函数
99
+ * 使用 multipart/form-data 格式传输,对齐 OpenAI 文件上传标准
100
+ */
101
+ async uploadFile(params) {
102
+ const uploadUrl = `${this.parsedServerUrl.fullUrl}/upload-openai-file`;
103
+ // 使用 form-data 创建标准的 multipart/form-data
104
+ const formData = new form_data_1.default();
105
+ formData.append("file", params.fileContent, {
106
+ filename: params.filename,
107
+ contentType: params.mimeType || "application/octet-stream",
108
+ });
109
+ formData.append("purpose", params.purpose || "file-extract");
110
+ // 发送 multipart/form-data 到云函数
111
+ const response = await (0, node_fetch_1.default)(uploadUrl, {
112
+ method: "POST",
113
+ headers: {
114
+ ...formData.getHeaders(),
115
+ },
116
+ body: formData,
117
+ });
118
+ if (!response.ok) {
119
+ throw new Error(`文件上传失败: ${response.status} ${response.statusText}`);
120
+ }
121
+ const resData = await response.json();
122
+ if (resData.code !== 0) {
123
+ throw new Error(`文件上传失败: ${resData.message || "未知错误"}`);
124
+ }
125
+ return resData.data;
126
+ }
127
+ /**
128
+ * 转换后端数据为AgentSimulatorInfo格式
129
+ */
130
+ transformToAgentSimulatorInfo(agentInfo) {
131
+ return {
132
+ agentInfo: {
133
+ agent_icon: agentInfo.agent_icon,
134
+ agent_id: agentInfo.agent_id,
135
+ agent_name: agentInfo.agent_name,
136
+ },
137
+ agentServerUrl: this.parsedServerUrl.fullUrl,
138
+ };
139
+ }
140
+ };
141
+ exports.AgentService = AgentService;
142
+ exports.AgentService = AgentService = __decorate([
143
+ (0, inversify_1.injectable)(),
144
+ __param(0, (0, inversify_1.inject)(container_1.APP_CONTEXT)),
145
+ __metadata("design:paramtypes", [Object])
146
+ ], AgentService);
147
+ //# sourceMappingURL=agent.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.service.js","sourceRoot":"","sources":["../../src/services/agent.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0DAAiC;AACjC,yCAA+C;AAC/C,4DAA+B;AAC/B,4CAA2C;AAE3C,oDAA0D;AA2BnD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAGvB,YAAiC,OAAY;QAC3C,IAAI,CAAC,eAAe,GAAG,IAAA,gCAAmB,EAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,OAAO,CAAC;QAEzD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,aAAa,OAAO,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,U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AAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,CAAC,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;OAEG;IACK,6BAA6B,CAAC,SAAc;QAClD,OAAO;YACL,SAAS,EAAE;gBACT,UAAU,EAAE,SAAS,CAAC,UAAU;gBAChC,QAAQ,EAAE,SAAS,CAAC,QAAQ;gBAC5B,UAAU,EAAE,SAAS,CAAC,UAAU;aACjC;YACD,cAAc,EAAE,IAAI,CAAC,eAAe,CAAC,OAAO;SAC7C,CAAC;IACJ,CAAC;CACF,CAAA;AAvIY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,sBAAU,GAAE;IAIE,WAAA,IAAA,kBAAM,EAAC,uBAAW,CAAC,CAAA;;GAHrB,YAAY,CAuIxB"}
@@ -0,0 +1,55 @@
1
+ import type { IAuthService } from "../container/types";
2
+ /**
3
+ * 认证相关类型定义
4
+ */
5
+ export interface LoginInfo {
6
+ secret_id: string;
7
+ cli_token: string;
8
+ create_at: number;
9
+ expire_in_sec: number;
10
+ }
11
+ export interface CheckStatusRequest {
12
+ secret_id: string;
13
+ nonce: string;
14
+ cli_token: string;
15
+ }
16
+ export interface CheckStatusResponse {
17
+ code: number;
18
+ msg: string;
19
+ data: LoginInfo;
20
+ }
21
+ export interface AuthStatus {
22
+ isLoggedIn: boolean;
23
+ loginInfo: LoginInfo | null;
24
+ expireTime?: string;
25
+ isExpired: boolean;
26
+ }
27
+ /**
28
+ * 获取 cli 登录信息
29
+ */
30
+ export declare class AuthService implements IAuthService {
31
+ private readonly configDir;
32
+ private readonly configFile;
33
+ constructor();
34
+ /**
35
+ * 检查是否已登录
36
+ */
37
+ hasLogin(): boolean;
38
+ /**
39
+ * 获取登录信息
40
+ */
41
+ getLoginInfo(): Promise<LoginInfo | null>;
42
+ /**
43
+ * 获取认证状态
44
+ */
45
+ getAuthStatus(): Promise<AuthStatus>;
46
+ /**
47
+ * 检查登录状态(调用下游服务)
48
+ */
49
+ check(params: {
50
+ secret_id: string;
51
+ nonce: string;
52
+ cli_token: string;
53
+ }): Promise<any>;
54
+ }
55
+ //# sourceMappingURL=auth.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD;;GAEG;AAEH,MAAM,WAAW,SAAS;IAExB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAElB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IAEjC,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;IAEd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AACD;;GAEG;AACH,qBACa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;;IAOpC;;OAEG;IACI,QAAQ,IAAI,OAAO;IAI1B;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAsB/C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAsB1C;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CAQ3F"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.AuthService = void 0;
46
+ const fs = __importStar(require("fs"));
47
+ const os = __importStar(require("os"));
48
+ const path = __importStar(require("path"));
49
+ const inversify_1 = require("inversify");
50
+ /**
51
+ * 获取 cli 登录信息
52
+ */
53
+ let AuthService = class AuthService {
54
+ constructor() {
55
+ this.configDir = path.join(os.homedir(), ".rcb");
56
+ this.configFile = path.join(this.configDir, "config.json");
57
+ }
58
+ /**
59
+ * 检查是否已登录
60
+ */
61
+ hasLogin() {
62
+ return fs.existsSync(this.configFile) && fs.statSync(this.configFile).isFile();
63
+ }
64
+ /**
65
+ * 获取登录信息
66
+ */
67
+ async getLoginInfo() {
68
+ try {
69
+ if (!fs.existsSync(this.configFile)) {
70
+ return null;
71
+ }
72
+ const content = fs.readFileSync(this.configFile, "utf-8");
73
+ const loginInfo = JSON.parse(content);
74
+ // 检查是否过期
75
+ const expireTime = new Date(loginInfo.create_at + loginInfo.expire_in_sec * 1000);
76
+ if (expireTime < new Date()) {
77
+ console.error("登录信息已过期,请重新登录");
78
+ return null;
79
+ }
80
+ return loginInfo;
81
+ }
82
+ catch (error) {
83
+ return null;
84
+ }
85
+ }
86
+ /**
87
+ * 获取认证状态
88
+ */
89
+ async getAuthStatus() {
90
+ const loginInfo = await this.getLoginInfo();
91
+ if (!loginInfo) {
92
+ return {
93
+ isLoggedIn: false,
94
+ loginInfo: null,
95
+ isExpired: false,
96
+ };
97
+ }
98
+ const expireTime = new Date(loginInfo.create_at + loginInfo.expire_in_sec * 1000);
99
+ const isExpired = expireTime < new Date();
100
+ return {
101
+ isLoggedIn: true,
102
+ loginInfo,
103
+ expireTime: expireTime.toLocaleString("zh-CN"),
104
+ isExpired,
105
+ };
106
+ }
107
+ /**
108
+ * 检查登录状态(调用下游服务)
109
+ */
110
+ async check(params) {
111
+ // 这里可以调用下游服务进行验证
112
+ // 暂时返回模拟数据
113
+ return {
114
+ isValid: true,
115
+ message: "验证成功",
116
+ };
117
+ }
118
+ };
119
+ exports.AuthService = AuthService;
120
+ exports.AuthService = AuthService = __decorate([
121
+ (0, inversify_1.injectable)(),
122
+ __metadata("design:paramtypes", [])
123
+ ], AuthService);
124
+ //# sourceMappingURL=auth.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,yCAAuC;AAsCvC;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IAItB;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAA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OAAO,EAAE,IAAI;YACb,OAAO,EAAE,MAAM;SAChB,CAAC;IACJ,CAAC;CACF,CAAA;AA7EY,kCAAW;sBAAX,WAAW;IADvB,IAAA,sBAAU,GAAE;;GACA,WAAW,CA6EvB"}
@@ -0,0 +1,23 @@
1
+ import type { ISimulatorService } from "../container/types";
2
+ export interface SimulatorStatus {
3
+ status: "running" | "stopped";
4
+ port: number;
5
+ agentServerUrl: string;
6
+ agentStatus: "normal" | "stopped" | "error";
7
+ timestamp: number;
8
+ }
9
+ export declare class SimulatorService implements ISimulatorService {
10
+ private port;
11
+ private agentServerUrl;
12
+ private agentStatus;
13
+ constructor(context: any);
14
+ /**
15
+ * 获取模拟器状态
16
+ */
17
+ getSimulatorStatus(): SimulatorStatus;
18
+ /**
19
+ * 更新Agent状态
20
+ */
21
+ updateAgentStatus(status: "normal" | "stopped" | "error"): void;
22
+ }
23
+ //# sourceMappingURL=simulator.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulator.service.d.ts","sourceRoot":"","sources":["../../src/services/simulator.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBACa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAiC;gBAEnB,OAAO,EAAE,GAAG;IAM7C;;OAEG;IACH,kBAAkB,IAAI,eAAe;IAUrC;;OAEG;IACH,iBAAiB,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI;CAGhE"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SimulatorService = void 0;
16
+ const inversify_1 = require("inversify");
17
+ const container_1 = require("../container");
18
+ let SimulatorService = class SimulatorService {
19
+ constructor(context) {
20
+ this.port = context.config.port;
21
+ this.agentServerUrl = context.agentServerUrl;
22
+ this.agentStatus = "normal";
23
+ }
24
+ /**
25
+ * 获取模拟器状态
26
+ */
27
+ getSimulatorStatus() {
28
+ return {
29
+ status: "running",
30
+ port: this.port,
31
+ agentServerUrl: this.agentServerUrl,
32
+ agentStatus: this.agentStatus,
33
+ timestamp: Date.now(),
34
+ };
35
+ }
36
+ /**
37
+ * 更新Agent状态
38
+ */
39
+ updateAgentStatus(status) {
40
+ this.agentStatus = status;
41
+ }
42
+ };
43
+ exports.SimulatorService = SimulatorService;
44
+ exports.SimulatorService = SimulatorService = __decorate([
45
+ (0, inversify_1.injectable)(),
46
+ __param(0, (0, inversify_1.inject)(container_1.APP_CONTEXT)),
47
+ __metadata("design:paramtypes", [Object])
48
+ ], SimulatorService);
49
+ //# sourceMappingURL=simulator.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulator.service.js","sourceRoot":"","sources":["../../src/services/simulator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAA+C;AAC/C,4CAA2C;AAYpC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAK3B,YAAiC,OAAY;QAC3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,MAAsC;QACtD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;CACF,CAAA;AA9BY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;IAME,WAAA,IAAA,kBAAM,EAAC,uBAAW,CAAC,CAAA;;GALrB,gBAAgB,CA8B5B"}