@jingyi0605/codingns 0.7.3 → 0.8.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/README.md +6 -0
- package/bin/codingns.mjs +747 -28
- package/bin/office-mcp-server.mjs +620 -0
- package/dist/public/assets/{AdaptiveButlerPage-CgBX49t-.js → AdaptiveButlerPage-BsgVNRAa.js} +1 -1
- package/dist/public/assets/{App-tXOqoHNl.js → App-tPcbyRdS.js} +3 -3
- package/dist/public/assets/{BootstrapPage-DoRMz87R.js → BootstrapPage--MDOigQi.js} +1 -1
- package/dist/public/assets/{ConversationPage-DXR6Hp4O.js → ConversationPage-BBss5ED8.js} +6 -6
- package/dist/public/assets/{DesktopDetachPreviewPage-Cyk-ZYCk.js → DesktopDetachPreviewPage-CB8DoqwU.js} +1 -1
- package/dist/public/assets/{DesktopWindowPage-DNVNK3hs.js → DesktopWindowPage-GtIx5m8K.js} +1 -1
- package/dist/public/assets/FileContextPanel-BcM7AIT4.js +1 -0
- package/dist/public/assets/{GitSidebar-Cr3Z9OUI.js → GitSidebar-CMtkaxuI.js} +2 -2
- package/dist/public/assets/{MobileCreateSessionSheet-DMW0V6GJ.js → MobileCreateSessionSheet-CrFY41_8.js} +1 -1
- package/dist/public/assets/{MobileTopHeaderFrame-CkdnZ_MU.js → MobileTopHeaderFrame-DGVOzXyg.js} +1 -1
- package/dist/public/assets/{MobileWorkspaceSwitcherHeader-KIbqBYJN.js → MobileWorkspaceSwitcherHeader-DLkACTnQ.js} +1 -1
- package/dist/public/assets/{RelayConnectEntryPage-DIRBH3hw.js → RelayConnectEntryPage-0MPPjxtQ.js} +1 -1
- package/dist/public/assets/{ServerSettingsModal-C-9RxdWP.js → ServerSettingsModal-vgOhwus4.js} +1 -1
- package/dist/public/assets/{SessionIndexPage-bRlIydRA.js → SessionIndexPage-KK626Ra9.js} +1 -1
- package/dist/public/assets/{SettingsPage-CMEt4ua9.js → SettingsPage-B3edBJIo.js} +2 -2
- package/dist/public/assets/{TerminalManagerPanel-2bi9wVhT.js → TerminalManagerPanel-BxlhZp8c.js} +1 -1
- package/dist/public/assets/{TerminalPage-DayZz2Tf.js → TerminalPage-B6Rdhylx.js} +1 -1
- package/dist/public/assets/{TerminalRuntimeFallbackModal-DgwYcp-Y.js → TerminalRuntimeFallbackModal-BVLfrpSa.js} +1 -1
- package/dist/public/assets/{ToolFilesPage-YvnP_FXW.js → ToolFilesPage-N_gwwUjD.js} +1 -1
- package/dist/public/assets/{ToolGitPage-GMcQKtV9.js → ToolGitPage-DOcuuWM1.js} +1 -1
- package/dist/public/assets/{ToolProcessesPage-DFIQ7BCd.js → ToolProcessesPage-D-FfJ7Re.js} +1 -1
- package/dist/public/assets/{ToolsHomePage-CSilFzXR.js → ToolsHomePage-CHfPxd20.js} +1 -1
- package/dist/public/assets/{WorkbenchLandingPage-1VtToSz9.js → WorkbenchLandingPage-CTTnfovY.js} +1 -1
- package/dist/public/assets/WorkbenchLayout-CbpJg0g1.js +244 -0
- package/dist/public/assets/{WorkbenchModal-BWXYSXmC.js → WorkbenchModal-Bt_1fYmM.js} +1 -1
- package/dist/public/assets/WorkbenchShellRoute-B4XB8SwG.css +1 -0
- package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +1 -0
- package/dist/public/assets/{WorkspaceDebugDetailPage-Ux8_Q7la.js → WorkspaceDebugDetailPage-s7yuDIxR.js} +1 -1
- package/dist/public/assets/{WorkspaceDetailPage-B402p99m.js → WorkspaceDetailPage-Cf-gVpqK.js} +1 -1
- package/dist/public/assets/{WorkspaceHomePage-D2pob6HI.js → WorkspaceHomePage-COf6I8sT.js} +1 -1
- package/dist/public/assets/{client-runtime-manager-C5D76ewj.js → client-runtime-manager-DGdKvYzx.js} +1 -1
- package/dist/public/assets/file-tree-icon-BeHqeru9.js +590 -0
- package/dist/public/assets/index-CcaQt50x.css +1 -0
- package/dist/public/assets/index-CuzMc7q2.js +42 -0
- package/dist/public/assets/{login-direct-candidate-resolver-wXSaB0i7.js → login-direct-candidate-resolver-DEP_xCmR.js} +1 -1
- package/dist/public/assets/{model-switch-api-CPtou49j.js → model-switch-api-c6kcbBGm.js} +1 -1
- package/dist/public/assets/{preferences-service-CdaK7zA8.js → preferences-service-CV6Ih0BG.js} +1 -1
- package/dist/public/assets/{realtime-client-BjQazYsK.js → realtime-client-CRCx5xBt.js} +1 -1
- package/dist/public/assets/{relay-entry-BwE5nw0l.js → relay-entry-C751A-Sm.js} +1 -1
- package/dist/public/assets/{terminal-runtime-meta-C-Lbyx2i.js → terminal-runtime-meta-CRAVR-8G.js} +1 -1
- package/dist/public/assets/{useRegisteredDebugTemplates-BM7-c-gx.js → useRegisteredDebugTemplates-D6YtNS0r.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +3 -0
- package/dist/server/config/env.js +67 -1
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/config/opencode-base-url-resolver.d.ts +3 -2
- package/dist/server/config/opencode-base-url-resolver.js +64 -24
- package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
- package/dist/server/middlewares/auth-guard.js +4 -0
- package/dist/server/middlewares/auth-guard.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +168 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +205 -4
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +296 -2
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +872 -3
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/auth/auth-service.d.ts +21 -1
- package/dist/server/modules/auth/auth-service.js +64 -0
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/browser-runtime/browser-profile-service.d.ts +26 -0
- package/dist/server/modules/browser-runtime/browser-profile-service.js +85 -0
- package/dist/server/modules/browser-runtime/browser-profile-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +69 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js +83 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +56 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.js +215 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.d.ts +65 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.js +432 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.d.ts +7 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.js +21 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.d.ts +55 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.js +2 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +31 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.js +55 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.d.ts +19 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js +219 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js.map +1 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.d.ts +15 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js +33 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.d.ts +16 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.js +272 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.js.map +1 -0
- package/dist/server/modules/butler/butler-auth-service.js +4 -0
- package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js +1 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.d.ts +1 -0
- package/dist/server/modules/butler/butler-session-summary-service.js +5 -3
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.js +23 -0
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
- package/dist/server/modules/channels/wechat-claw-client.d.ts +51 -0
- package/dist/server/modules/channels/wechat-claw-client.js +245 -0
- package/dist/server/modules/channels/wechat-claw-client.js.map +1 -0
- package/dist/server/modules/debug-target/debug-target-service.d.ts +2 -0
- package/dist/server/modules/debug-target/debug-target-service.js +14 -0
- package/dist/server/modules/debug-target/debug-target-service.js.map +1 -1
- package/dist/server/modules/document-runtime/document-docx-fallback-renderer.py +139 -0
- package/dist/server/modules/document-runtime/document-export-executor.d.ts +50 -0
- package/dist/server/modules/document-runtime/document-export-executor.js +827 -0
- package/dist/server/modules/document-runtime/document-export-executor.js.map +1 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.d.ts +127 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.js +131 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.js.map +1 -0
- package/dist/server/modules/document-runtime/document-runtime-service.d.ts +125 -0
- package/dist/server/modules/document-runtime/document-runtime-service.js +706 -0
- package/dist/server/modules/document-runtime/document-runtime-service.js.map +1 -0
- package/dist/server/modules/office/office-controller.d.ts +77 -0
- package/dist/server/modules/office/office-controller.js +174 -0
- package/dist/server/modules/office/office-controller.js.map +1 -0
- package/dist/server/modules/office/office-preview-link-service.d.ts +27 -0
- package/dist/server/modules/office/office-preview-link-service.js +121 -0
- package/dist/server/modules/office/office-preview-link-service.js.map +1 -0
- package/dist/server/modules/office/office-service.d.ts +67 -0
- package/dist/server/modules/office/office-service.js +359 -0
- package/dist/server/modules/office/office-service.js.map +1 -0
- package/dist/server/modules/opencli/opencli-bridge-skill-service.js +38 -14
- package/dist/server/modules/opencli/opencli-bridge-skill-service.js.map +1 -1
- package/dist/server/modules/opencli/opencli-install-discovery.d.ts +4 -0
- package/dist/server/modules/opencli/opencli-install-discovery.js +94 -0
- package/dist/server/modules/opencli/opencli-install-discovery.js.map +1 -1
- package/dist/server/modules/opencli/opencli-runtime-builder.js +29 -0
- package/dist/server/modules/opencli/opencli-runtime-builder.js.map +1 -1
- package/dist/server/modules/opencli/opencli-runtime-guard.d.ts +2 -0
- package/dist/server/modules/opencli/opencli-runtime-guard.js +5 -0
- package/dist/server/modules/opencli/opencli-runtime-guard.js.map +1 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.d.ts +70 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.js +83 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.js.map +1 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.d.ts +80 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.js +327 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.js.map +1 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.d.ts +41 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.js +478 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.js.map +1 -0
- package/dist/server/modules/presentation/presentation-controller.d.ts +22 -0
- package/dist/server/modules/presentation/presentation-controller.js +59 -0
- package/dist/server/modules/presentation/presentation-controller.js.map +1 -0
- package/dist/server/modules/presentation/presentation-export-task-service.d.ts +24 -0
- package/dist/server/modules/presentation/presentation-export-task-service.js +137 -0
- package/dist/server/modules/presentation/presentation-export-task-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-export-types.d.ts +12 -0
- package/dist/server/modules/presentation/presentation-export-types.js +2 -0
- package/dist/server/modules/presentation/presentation-export-types.js.map +1 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.d.ts +20 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.js +29 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.d.ts +20 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.js +64 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-renderer.d.ts +21 -0
- package/dist/server/modules/presentation/presentation-renderer.js +208 -0
- package/dist/server/modules/presentation/presentation-renderer.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +3 -3
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -1
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +6 -1
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +2 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.d.ts +1 -0
- package/dist/server/modules/sessions/session-controller.js +59 -4
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.js +17 -5
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +5 -1
- package/dist/server/modules/sessions/session-live-runtime-service.js +86 -8
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-config-service.d.ts +25 -1
- package/dist/server/modules/sessions/session-provider-config-service.js +54 -5
- package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
- package/dist/server/modules/sessions/workspace-office-mcp-config.d.ts +14 -0
- package/dist/server/modules/sessions/workspace-office-mcp-config.js +54 -0
- package/dist/server/modules/sessions/workspace-office-mcp-config.js.map +1 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.d.ts +27 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.js +109 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.js.map +1 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +50 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +332 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +5 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -1
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +67 -0
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/agents/openai.yaml +4 -0
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/references/cli-workflow.md +133 -0
- package/dist/server/modules/skills/skill-controller.d.ts +7 -0
- package/dist/server/modules/skills/skill-controller.js +7 -0
- package/dist/server/modules/skills/skill-controller.js.map +1 -1
- package/dist/server/modules/skills/skill-manager-service.d.ts +61 -0
- package/dist/server/modules/skills/skill-manager-service.js +218 -0
- package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
- package/dist/server/modules/skills/skill-name-policy.js +2 -1
- package/dist/server/modules/skills/skill-name-policy.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-client.d.ts +1 -0
- package/dist/server/modules/tasks/task-helper-client.js +45 -9
- package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +5 -0
- package/dist/server/modules/tasks/task-types.js +6 -1
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js +2 -1
- package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js.map +1 -1
- package/dist/server/modules/terminal/runtime/node-pty-loader.d.ts +5 -0
- package/dist/server/modules/terminal/runtime/node-pty-loader.js +68 -0
- package/dist/server/modules/terminal/runtime/node-pty-loader.js.map +1 -0
- package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js +2 -1
- package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js.map +1 -1
- package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js +6 -9
- package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js.map +1 -1
- package/dist/server/modules/terminal/runtime/pty-runtime-manager.js +6 -9
- package/dist/server/modules/terminal/runtime/pty-runtime-manager.js.map +1 -1
- package/dist/server/routes/assistant.d.ts +2 -1
- package/dist/server/routes/assistant.js +20 -1
- package/dist/server/routes/assistant.js.map +1 -1
- package/dist/server/routes/browser-runtime.d.ts +3 -0
- package/dist/server/routes/browser-runtime.js +14 -0
- package/dist/server/routes/browser-runtime.js.map +1 -0
- package/dist/server/routes/document-runtime.d.ts +3 -0
- package/dist/server/routes/document-runtime.js +18 -0
- package/dist/server/routes/document-runtime.js.map +1 -0
- package/dist/server/routes/office.d.ts +3 -0
- package/dist/server/routes/office.js +16 -0
- package/dist/server/routes/office.js.map +1 -0
- package/dist/server/routes/ops-runtime.d.ts +3 -0
- package/dist/server/routes/ops-runtime.js +13 -0
- package/dist/server/routes/ops-runtime.js.map +1 -0
- package/dist/server/routes/presentation.d.ts +3 -0
- package/dist/server/routes/presentation.js +5 -0
- package/dist/server/routes/presentation.js.map +1 -0
- package/dist/server/routes/skills.js +1 -0
- package/dist/server/routes/skills.js.map +1 -1
- package/dist/server/server/create-server.d.ts +36 -0
- package/dist/server/server/create-server.js +215 -4
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/server/release-manifest-sync.d.ts +1 -0
- package/dist/server/server/release-manifest-sync.js +2 -2
- package/dist/server/server/release-manifest-sync.js.map +1 -1
- package/dist/server/server/start-host.js +1 -1
- package/dist/server/server/start-host.js.map +1 -1
- package/dist/server/storage/repositories/auth-token-repository.js +22 -6
- package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
- package/dist/server/storage/repositories/browser-profile-repository.d.ts +18 -0
- package/dist/server/storage/repositories/browser-profile-repository.js +134 -0
- package/dist/server/storage/repositories/browser-profile-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-comment-repository.d.ts +10 -0
- package/dist/server/storage/repositories/document-comment-repository.js +118 -0
- package/dist/server/storage/repositories/document-comment-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-repository.d.ts +16 -0
- package/dist/server/storage/repositories/document-repository.js +109 -0
- package/dist/server/storage/repositories/document-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-revision-repository.d.ts +10 -0
- package/dist/server/storage/repositories/document-revision-repository.js +79 -0
- package/dist/server/storage/repositories/document-revision-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-template-repository.d.ts +13 -0
- package/dist/server/storage/repositories/document-template-repository.js +244 -0
- package/dist/server/storage/repositories/document-template-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-approval-repository.d.ts +11 -0
- package/dist/server/storage/repositories/office-approval-repository.js +109 -0
- package/dist/server/storage/repositories/office-approval-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-artifact-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-artifact-repository.js +89 -0
- package/dist/server/storage/repositories/office-artifact-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-audit-event-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-audit-event-repository.js +54 -0
- package/dist/server/storage/repositories/office-audit-event-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-connector-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-connector-repository.js +97 -0
- package/dist/server/storage/repositories/office-connector-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-receipt-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-receipt-repository.js +48 -0
- package/dist/server/storage/repositories/office-receipt-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.js +60 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-task-repository.d.ts +19 -0
- package/dist/server/storage/repositories/office-task-repository.js +199 -0
- package/dist/server/storage/repositories/office-task-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-task-step-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-task-step-repository.js +110 -0
- package/dist/server/storage/repositories/office-task-step-repository.js.map +1 -0
- package/dist/server/storage/repositories/ops-target-repository.d.ts +16 -0
- package/dist/server/storage/repositories/ops-target-repository.js +119 -0
- package/dist/server/storage/repositories/ops-target-repository.js.map +1 -0
- package/dist/server/storage/repositories/session-binding-repository.d.ts +4 -0
- package/dist/server/storage/repositories/session-binding-repository.js +70 -69
- package/dist/server/storage/repositories/session-binding-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-changed-file-repository.d.ts +6 -0
- package/dist/server/storage/repositories/session-changed-file-repository.js +44 -43
- package/dist/server/storage/repositories/session-changed-file-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-fork-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-fork-repository.js +42 -41
- package/dist/server/storage/repositories/session-fork-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-index-repository.d.ts +5 -0
- package/dist/server/storage/repositories/session-index-repository.js +153 -152
- package/dist/server/storage/repositories/session-index-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +7 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js +91 -90
- package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-origin-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-message-origin-repository.js +25 -24
- package/dist/server/storage/repositories/session-message-origin-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-state-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-state-repository.js +35 -34
- package/dist/server/storage/repositories/session-state-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-status-snapshot-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-status-snapshot-repository.js +25 -24
- package/dist/server/storage/repositories/session-status-snapshot-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +123 -1
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +300 -1
- package/dist/server/types/domain.d.ts +205 -1
- package/package.json +14 -7
- package/scripts/postinstall.mjs +170 -36
- package/dist/public/assets/FileContextPanel-xGTYDclT.js +0 -1
- package/dist/public/assets/WorkbenchLayout-DScHaza9.js +0 -244
- package/dist/public/assets/WorkbenchShellRoute-DN6LdrqC.js +0 -1
- package/dist/public/assets/WorkbenchShellRoute-DhQo_0vu.css +0 -1
- package/dist/public/assets/file-tree-icon-lfU9Ag77.js +0 -3
- package/dist/public/assets/index-CFYXCsyx.css +0 -1
- package/dist/public/assets/index-NGxWr8Ix.js +0 -42
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +0 -42
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +0 -346
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +0 -80
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/index.d.ts +0 -18
- package/node_modules/@codingns/session-sync-core/dist/index.js +0 -19
- package/node_modules/@codingns/session-sync-core/dist/index.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +0 -18
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +0 -659
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +0 -11
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +0 -72
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +0 -67
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +0 -752
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +0 -48
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +0 -1184
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +0 -11
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +0 -105
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +0 -84
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +0 -2436
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +0 -47
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +0 -1480
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +0 -33
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +0 -684
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +0 -9
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +0 -17
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +0 -8
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +0 -48
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +0 -373
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +0 -61
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +0 -1191
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +0 -27
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +0 -415
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +0 -7
- package/node_modules/@codingns/session-sync-core/dist/registry.js +0 -22
- package/node_modules/@codingns/session-sync-core/dist/registry.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +0 -24
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +0 -329
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +0 -30
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +0 -939
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +0 -16
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +0 -70
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +0 -2571
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +0 -21
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +0 -561
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +0 -38
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +0 -911
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +0 -15
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +0 -16
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +0 -37
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +0 -963
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +0 -21
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +0 -168
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +0 -152
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +0 -2
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/services.d.ts +0 -28
- package/node_modules/@codingns/session-sync-core/dist/services.js +0 -148
- package/node_modules/@codingns/session-sync-core/dist/services.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +0 -6
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +0 -9
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +0 -198
- package/node_modules/@codingns/session-sync-core/dist/types.js +0 -2
- package/node_modules/@codingns/session-sync-core/dist/types.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/package.json +0 -33
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { AppError } from "../../shared/errors/app-error.js";
|
|
5
|
+
import { createId } from "../../shared/utils/id.js";
|
|
6
|
+
import { nowIso } from "../../shared/utils/time.js";
|
|
7
|
+
import { TaskCancelledError } from "../tasks/task-types.js";
|
|
8
|
+
export class SshOpsExecutor {
|
|
9
|
+
config;
|
|
10
|
+
officeTaskRepository;
|
|
11
|
+
officeTaskStepRepository;
|
|
12
|
+
officeArtifactRepository;
|
|
13
|
+
officeReceiptRepository;
|
|
14
|
+
officeAuditEventRepository;
|
|
15
|
+
artifactRoot;
|
|
16
|
+
constructor(config, officeTaskRepository, officeTaskStepRepository, officeArtifactRepository, officeReceiptRepository, officeAuditEventRepository) {
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.officeTaskRepository = officeTaskRepository;
|
|
19
|
+
this.officeTaskStepRepository = officeTaskStepRepository;
|
|
20
|
+
this.officeArtifactRepository = officeArtifactRepository;
|
|
21
|
+
this.officeReceiptRepository = officeReceiptRepository;
|
|
22
|
+
this.officeAuditEventRepository = officeAuditEventRepository;
|
|
23
|
+
this.artifactRoot = path.join(path.dirname(config.databasePath), "office-artifacts");
|
|
24
|
+
}
|
|
25
|
+
async execute(input) {
|
|
26
|
+
const task = this.markTaskRunning(input.task);
|
|
27
|
+
const parsed = parseSshTaskPayload(task.inputJson);
|
|
28
|
+
const resolved = resolveSshTaskInput(parsed);
|
|
29
|
+
const step = this.createStep(task, resolved);
|
|
30
|
+
const startedStep = this.startStep(step);
|
|
31
|
+
try {
|
|
32
|
+
ensureNotCancelled(input.runContext);
|
|
33
|
+
const result = await this.runSshCommand(task, startedStep, resolved, input.runContext);
|
|
34
|
+
this.finishStep(startedStep, JSON.stringify({
|
|
35
|
+
exitCode: result.exitCode,
|
|
36
|
+
signal: result.signal,
|
|
37
|
+
durationMs: result.durationMs
|
|
38
|
+
}));
|
|
39
|
+
const receipt = this.createReceipt(task, resolved, result);
|
|
40
|
+
const nextTask = this.markTaskSucceeded(task, result);
|
|
41
|
+
return {
|
|
42
|
+
task: nextTask,
|
|
43
|
+
step: startedStep,
|
|
44
|
+
receipt,
|
|
45
|
+
stdoutArtifact: result.stdoutArtifact,
|
|
46
|
+
stderrArtifact: result.stderrArtifact
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : "SSH 运维任务执行失败";
|
|
51
|
+
this.failStep(startedStep, message);
|
|
52
|
+
this.markTaskFailed(task, message);
|
|
53
|
+
if (error instanceof AppError) {
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
throw new AppError({
|
|
57
|
+
statusCode: error instanceof TaskCancelledError ? 409 : 500,
|
|
58
|
+
errorCode: error instanceof TaskCancelledError ? "OPS_SSH_TASK_CANCELLED" : "OPS_SSH_TASK_EXECUTION_FAILED",
|
|
59
|
+
detail: message
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async runSshCommand(task, step, resolved, runContext) {
|
|
64
|
+
const commandScript = buildRemoteCommandScript(resolved);
|
|
65
|
+
const sshArgs = buildSshArgs(resolved, commandScript);
|
|
66
|
+
const spawnEnv = {
|
|
67
|
+
...process.env,
|
|
68
|
+
...resolved.env
|
|
69
|
+
};
|
|
70
|
+
const startedAt = Date.now();
|
|
71
|
+
const child = spawn("ssh", sshArgs, {
|
|
72
|
+
env: spawnEnv,
|
|
73
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
74
|
+
});
|
|
75
|
+
let stdout = "";
|
|
76
|
+
let stderr = "";
|
|
77
|
+
let timedOut = false;
|
|
78
|
+
let settled = false;
|
|
79
|
+
child.stdout.setEncoding("utf8");
|
|
80
|
+
child.stdout.on("data", (chunk) => {
|
|
81
|
+
stdout += chunk;
|
|
82
|
+
});
|
|
83
|
+
child.stderr.setEncoding("utf8");
|
|
84
|
+
child.stderr.on("data", (chunk) => {
|
|
85
|
+
stderr += chunk;
|
|
86
|
+
});
|
|
87
|
+
const timeout = setTimeout(() => {
|
|
88
|
+
timedOut = true;
|
|
89
|
+
child.kill("SIGTERM");
|
|
90
|
+
}, resolved.timeoutMs);
|
|
91
|
+
const cancelListener = () => {
|
|
92
|
+
child.kill("SIGTERM");
|
|
93
|
+
};
|
|
94
|
+
runContext?.signal.addEventListener("abort", cancelListener, { once: true });
|
|
95
|
+
try {
|
|
96
|
+
const exit = await new Promise((resolve, reject) => {
|
|
97
|
+
child.once("error", reject);
|
|
98
|
+
child.once("close", (code, signal) => {
|
|
99
|
+
settled = true;
|
|
100
|
+
resolve({ code: code ?? -1, signal });
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
ensureNotCancelled(runContext);
|
|
104
|
+
if (timedOut) {
|
|
105
|
+
throw new AppError({
|
|
106
|
+
statusCode: 504,
|
|
107
|
+
errorCode: "OPS_SSH_TASK_TIMEOUT",
|
|
108
|
+
detail: `SSH 命令执行超时,超过 ${resolved.timeoutMs}ms`
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (exit.code !== 0) {
|
|
112
|
+
const stderrMessage = stderr.trim();
|
|
113
|
+
throw new AppError({
|
|
114
|
+
statusCode: 500,
|
|
115
|
+
errorCode: "OPS_SSH_TASK_COMMAND_FAILED",
|
|
116
|
+
detail: stderrMessage || `SSH 命令退出码 ${exit.code}`
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const stdoutArtifact = stdout.trim().length > 0
|
|
120
|
+
? this.createTextArtifact(task, step, "command_log", "stdout.log", stdout, "text/plain")
|
|
121
|
+
: null;
|
|
122
|
+
const stderrArtifact = stderr.trim().length > 0
|
|
123
|
+
? this.createTextArtifact(task, step, "command_log", "stderr.log", stderr, "text/plain")
|
|
124
|
+
: null;
|
|
125
|
+
return {
|
|
126
|
+
exitCode: exit.code,
|
|
127
|
+
signal: exit.signal,
|
|
128
|
+
durationMs: Date.now() - startedAt,
|
|
129
|
+
stdoutArtifact,
|
|
130
|
+
stderrArtifact
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
clearTimeout(timeout);
|
|
135
|
+
runContext?.signal.removeEventListener("abort", cancelListener);
|
|
136
|
+
if (!settled && child.exitCode === null) {
|
|
137
|
+
child.kill("SIGTERM");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
createStep(task, resolved) {
|
|
142
|
+
const timestamp = nowIso();
|
|
143
|
+
return this.officeTaskStepRepository.create({
|
|
144
|
+
id: createId(),
|
|
145
|
+
taskId: task.id,
|
|
146
|
+
stepSeq: 1,
|
|
147
|
+
stepType: "ssh_execute",
|
|
148
|
+
title: `执行 SSH 命令:${resolved.commands[0]}`,
|
|
149
|
+
inputJson: JSON.stringify({
|
|
150
|
+
host: resolved.host,
|
|
151
|
+
port: resolved.port,
|
|
152
|
+
username: resolved.username,
|
|
153
|
+
workspacePath: resolved.workspacePath,
|
|
154
|
+
commandCount: resolved.commands.length,
|
|
155
|
+
timeoutMs: resolved.timeoutMs
|
|
156
|
+
}),
|
|
157
|
+
outputJson: null,
|
|
158
|
+
status: "pending",
|
|
159
|
+
retryCount: 0,
|
|
160
|
+
startedAt: null,
|
|
161
|
+
finishedAt: null,
|
|
162
|
+
errorMessage: null,
|
|
163
|
+
createdAt: timestamp,
|
|
164
|
+
updatedAt: timestamp
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
startStep(step) {
|
|
168
|
+
const timestamp = nowIso();
|
|
169
|
+
return this.officeTaskStepRepository.update({
|
|
170
|
+
...step,
|
|
171
|
+
status: "running",
|
|
172
|
+
startedAt: timestamp,
|
|
173
|
+
updatedAt: timestamp
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
finishStep(step, outputJson) {
|
|
177
|
+
const timestamp = nowIso();
|
|
178
|
+
const next = this.officeTaskStepRepository.update({
|
|
179
|
+
...step,
|
|
180
|
+
status: "succeeded",
|
|
181
|
+
outputJson,
|
|
182
|
+
finishedAt: timestamp,
|
|
183
|
+
updatedAt: timestamp
|
|
184
|
+
});
|
|
185
|
+
this.officeAuditEventRepository.create({
|
|
186
|
+
id: createId(),
|
|
187
|
+
taskId: step.taskId,
|
|
188
|
+
stepId: step.id,
|
|
189
|
+
eventKind: "task_updated",
|
|
190
|
+
actorKind: "connector",
|
|
191
|
+
actorId: "ops.ssh",
|
|
192
|
+
summary: "SSH 步骤执行完成",
|
|
193
|
+
payloadJson: outputJson,
|
|
194
|
+
createdAt: timestamp
|
|
195
|
+
});
|
|
196
|
+
return next;
|
|
197
|
+
}
|
|
198
|
+
failStep(step, errorMessage) {
|
|
199
|
+
const timestamp = nowIso();
|
|
200
|
+
return this.officeTaskStepRepository.update({
|
|
201
|
+
...step,
|
|
202
|
+
status: "failed",
|
|
203
|
+
errorMessage,
|
|
204
|
+
finishedAt: timestamp,
|
|
205
|
+
updatedAt: timestamp
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
createTextArtifact(task, step, kind, fileName, content, contentType) {
|
|
209
|
+
const targetDir = this.ensureArtifactDir(task.id);
|
|
210
|
+
const artifactId = createId();
|
|
211
|
+
const storagePath = path.join(targetDir, `${artifactId}-${fileName}`);
|
|
212
|
+
fs.writeFileSync(storagePath, content, "utf8");
|
|
213
|
+
const artifact = this.officeArtifactRepository.create({
|
|
214
|
+
id: artifactId,
|
|
215
|
+
taskId: task.id,
|
|
216
|
+
stepId: step.id,
|
|
217
|
+
kind,
|
|
218
|
+
name: fileName,
|
|
219
|
+
storagePath,
|
|
220
|
+
contentType,
|
|
221
|
+
metadataJson: JSON.stringify({
|
|
222
|
+
size: Buffer.byteLength(content),
|
|
223
|
+
stepSeq: step.stepSeq
|
|
224
|
+
}),
|
|
225
|
+
createdAt: nowIso()
|
|
226
|
+
});
|
|
227
|
+
this.officeAuditEventRepository.create({
|
|
228
|
+
id: createId(),
|
|
229
|
+
taskId: task.id,
|
|
230
|
+
stepId: step.id,
|
|
231
|
+
eventKind: "artifact_created",
|
|
232
|
+
actorKind: "connector",
|
|
233
|
+
actorId: "ops.ssh",
|
|
234
|
+
summary: `生成 SSH 执行产物:${artifact.name}`,
|
|
235
|
+
payloadJson: JSON.stringify({ artifactId: artifact.id, kind: artifact.kind }),
|
|
236
|
+
createdAt: artifact.createdAt
|
|
237
|
+
});
|
|
238
|
+
return artifact;
|
|
239
|
+
}
|
|
240
|
+
createReceipt(task, resolved, result) {
|
|
241
|
+
return this.officeReceiptRepository.create({
|
|
242
|
+
id: createId(),
|
|
243
|
+
taskId: task.id,
|
|
244
|
+
stepId: null,
|
|
245
|
+
receiptType: "ssh_execution",
|
|
246
|
+
summary: "SSH 运维任务执行完成",
|
|
247
|
+
payloadJson: JSON.stringify({
|
|
248
|
+
host: resolved.host,
|
|
249
|
+
port: resolved.port,
|
|
250
|
+
username: resolved.username,
|
|
251
|
+
workspacePath: resolved.workspacePath,
|
|
252
|
+
commandCount: resolved.commands.length,
|
|
253
|
+
exitCode: result.exitCode,
|
|
254
|
+
signal: result.signal,
|
|
255
|
+
durationMs: result.durationMs,
|
|
256
|
+
stdoutArtifactId: result.stdoutArtifact?.id ?? null,
|
|
257
|
+
stderrArtifactId: result.stderrArtifact?.id ?? null
|
|
258
|
+
}),
|
|
259
|
+
createdAt: nowIso()
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
markTaskRunning(task) {
|
|
263
|
+
const timestamp = nowIso();
|
|
264
|
+
const next = this.officeTaskRepository.update({
|
|
265
|
+
...task,
|
|
266
|
+
status: "running",
|
|
267
|
+
startedAt: task.startedAt ?? timestamp,
|
|
268
|
+
finishedAt: null,
|
|
269
|
+
updatedAt: timestamp
|
|
270
|
+
});
|
|
271
|
+
this.officeAuditEventRepository.create({
|
|
272
|
+
id: createId(),
|
|
273
|
+
taskId: task.id,
|
|
274
|
+
stepId: null,
|
|
275
|
+
eventKind: "task_started",
|
|
276
|
+
actorKind: "connector",
|
|
277
|
+
actorId: "ops.ssh",
|
|
278
|
+
summary: "SSH 运维任务开始执行",
|
|
279
|
+
payloadJson: null,
|
|
280
|
+
createdAt: timestamp
|
|
281
|
+
});
|
|
282
|
+
return next;
|
|
283
|
+
}
|
|
284
|
+
markTaskSucceeded(task, result) {
|
|
285
|
+
const timestamp = nowIso();
|
|
286
|
+
const next = this.officeTaskRepository.update({
|
|
287
|
+
...task,
|
|
288
|
+
status: "succeeded",
|
|
289
|
+
finishedAt: timestamp,
|
|
290
|
+
updatedAt: timestamp
|
|
291
|
+
});
|
|
292
|
+
this.officeAuditEventRepository.create({
|
|
293
|
+
id: createId(),
|
|
294
|
+
taskId: task.id,
|
|
295
|
+
stepId: null,
|
|
296
|
+
eventKind: "task_finished",
|
|
297
|
+
actorKind: "connector",
|
|
298
|
+
actorId: "ops.ssh",
|
|
299
|
+
summary: "SSH 运维任务执行成功",
|
|
300
|
+
payloadJson: JSON.stringify({
|
|
301
|
+
status: "succeeded",
|
|
302
|
+
exitCode: result.exitCode,
|
|
303
|
+
durationMs: result.durationMs
|
|
304
|
+
}),
|
|
305
|
+
createdAt: timestamp
|
|
306
|
+
});
|
|
307
|
+
return next;
|
|
308
|
+
}
|
|
309
|
+
markTaskFailed(task, reason) {
|
|
310
|
+
const timestamp = nowIso();
|
|
311
|
+
const next = this.officeTaskRepository.update({
|
|
312
|
+
...task,
|
|
313
|
+
status: "failed",
|
|
314
|
+
finishedAt: timestamp,
|
|
315
|
+
updatedAt: timestamp
|
|
316
|
+
});
|
|
317
|
+
this.officeAuditEventRepository.create({
|
|
318
|
+
id: createId(),
|
|
319
|
+
taskId: task.id,
|
|
320
|
+
stepId: null,
|
|
321
|
+
eventKind: "task_finished",
|
|
322
|
+
actorKind: "connector",
|
|
323
|
+
actorId: "ops.ssh",
|
|
324
|
+
summary: "SSH 运维任务执行失败",
|
|
325
|
+
payloadJson: JSON.stringify({
|
|
326
|
+
status: "failed",
|
|
327
|
+
reason
|
|
328
|
+
}),
|
|
329
|
+
createdAt: timestamp
|
|
330
|
+
});
|
|
331
|
+
return next;
|
|
332
|
+
}
|
|
333
|
+
ensureArtifactDir(taskId) {
|
|
334
|
+
const targetDir = path.join(this.artifactRoot, taskId);
|
|
335
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
336
|
+
return targetDir;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function parseSshTaskPayload(raw) {
|
|
340
|
+
try {
|
|
341
|
+
return JSON.parse(raw);
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
throw new AppError({
|
|
345
|
+
statusCode: 400,
|
|
346
|
+
errorCode: "INVALID_OPS_SSH_TASK_INPUT",
|
|
347
|
+
detail: "SSH 运维任务输入格式不合法"
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function resolveSshTaskInput(payload) {
|
|
352
|
+
const config = payload.config;
|
|
353
|
+
const commandSpec = payload.commandSpec;
|
|
354
|
+
if (!config || typeof config !== "object") {
|
|
355
|
+
throw new AppError({
|
|
356
|
+
statusCode: 400,
|
|
357
|
+
errorCode: "INVALID_OPS_SSH_TASK_INPUT",
|
|
358
|
+
detail: "SSH 运维任务缺少目标配置"
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
const commands = Array.isArray(commandSpec?.commands)
|
|
362
|
+
? commandSpec.commands.map((item) => (typeof item === "string" ? item.trim() : "")).filter((item) => item.length > 0)
|
|
363
|
+
: [];
|
|
364
|
+
if (commandSpec?.command && typeof commandSpec.command === "string" && commandSpec.command.trim()) {
|
|
365
|
+
commands.unshift(commandSpec.command.trim());
|
|
366
|
+
}
|
|
367
|
+
const uniqueCommands = [...new Set(commands)];
|
|
368
|
+
if (uniqueCommands.length === 0) {
|
|
369
|
+
throw new AppError({
|
|
370
|
+
statusCode: 400,
|
|
371
|
+
errorCode: "INVALID_OPS_SSH_TASK_INPUT",
|
|
372
|
+
detail: "SSH 运维任务必须提供 command 或 commands"
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
const host = typeof config.host === "string" ? config.host.trim() : "";
|
|
376
|
+
const username = typeof config.username === "string" ? config.username.trim() : "";
|
|
377
|
+
if (!host || !username) {
|
|
378
|
+
throw new AppError({
|
|
379
|
+
statusCode: 400,
|
|
380
|
+
errorCode: "INVALID_OPS_SSH_TASK_INPUT",
|
|
381
|
+
detail: "SSH 运维目标必须包含 host 和 username"
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const port = typeof config.port === "number" && Number.isFinite(config.port) && config.port > 0
|
|
385
|
+
? Math.trunc(config.port)
|
|
386
|
+
: 22;
|
|
387
|
+
const timeoutMs = typeof commandSpec?.timeoutMs === "number" && Number.isFinite(commandSpec.timeoutMs) && commandSpec.timeoutMs > 0
|
|
388
|
+
? Math.min(Math.trunc(commandSpec.timeoutMs), 300_000)
|
|
389
|
+
: 60_000;
|
|
390
|
+
return {
|
|
391
|
+
host,
|
|
392
|
+
port,
|
|
393
|
+
username,
|
|
394
|
+
privateKeyPath: normalizeOptionalText(config.privateKeyPath),
|
|
395
|
+
strictHostKeyChecking: normalizeStrictHostKeyChecking(config.strictHostKeyChecking),
|
|
396
|
+
knownHostsPath: normalizeOptionalText(config.knownHostsPath),
|
|
397
|
+
jumpHost: normalizeOptionalText(config.jumpHost),
|
|
398
|
+
workspacePath: normalizeOptionalText(commandSpec?.cwd) ?? normalizeOptionalText(config.workspacePath),
|
|
399
|
+
timeoutMs,
|
|
400
|
+
commands: uniqueCommands,
|
|
401
|
+
env: {
|
|
402
|
+
...normalizeEnvMap(config.env),
|
|
403
|
+
...normalizeEnvMap(commandSpec?.env)
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function buildRemoteCommandScript(input) {
|
|
408
|
+
const parts = ["set -e"];
|
|
409
|
+
if (input.workspacePath) {
|
|
410
|
+
parts.push(`cd ${shellEscape(input.workspacePath)}`);
|
|
411
|
+
}
|
|
412
|
+
for (const [key, value] of Object.entries(input.env)) {
|
|
413
|
+
parts.push(`export ${key}=${shellEscape(value)}`);
|
|
414
|
+
}
|
|
415
|
+
parts.push(...input.commands);
|
|
416
|
+
return parts.join(" && ");
|
|
417
|
+
}
|
|
418
|
+
function buildSshArgs(input, commandScript) {
|
|
419
|
+
const args = [
|
|
420
|
+
"-p",
|
|
421
|
+
String(input.port),
|
|
422
|
+
"-o",
|
|
423
|
+
`StrictHostKeyChecking=${input.strictHostKeyChecking}`,
|
|
424
|
+
"-o",
|
|
425
|
+
"BatchMode=yes",
|
|
426
|
+
"-o",
|
|
427
|
+
"ServerAliveInterval=15",
|
|
428
|
+
"-o",
|
|
429
|
+
"ServerAliveCountMax=3"
|
|
430
|
+
];
|
|
431
|
+
if (input.knownHostsPath) {
|
|
432
|
+
args.push("-o", `UserKnownHostsFile=${input.knownHostsPath}`);
|
|
433
|
+
}
|
|
434
|
+
if (input.privateKeyPath) {
|
|
435
|
+
args.push("-i", input.privateKeyPath);
|
|
436
|
+
}
|
|
437
|
+
if (input.jumpHost) {
|
|
438
|
+
args.push("-J", input.jumpHost);
|
|
439
|
+
}
|
|
440
|
+
args.push(`${input.username}@${input.host}`, commandScript);
|
|
441
|
+
return args;
|
|
442
|
+
}
|
|
443
|
+
function normalizeOptionalText(value) {
|
|
444
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
445
|
+
}
|
|
446
|
+
function normalizeStrictHostKeyChecking(value) {
|
|
447
|
+
if (value === "yes" || value === "no" || value === "accept-new") {
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
return "accept-new";
|
|
451
|
+
}
|
|
452
|
+
function normalizeEnvMap(value) {
|
|
453
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
454
|
+
return {};
|
|
455
|
+
}
|
|
456
|
+
const result = {};
|
|
457
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
458
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
if (typeof entry === "string") {
|
|
462
|
+
result[key] = entry;
|
|
463
|
+
}
|
|
464
|
+
else if (typeof entry === "number" || typeof entry === "boolean") {
|
|
465
|
+
result[key] = String(entry);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
function shellEscape(value) {
|
|
471
|
+
return `'${value.replace(/'/g, `'\"'\"'`)}'`;
|
|
472
|
+
}
|
|
473
|
+
function ensureNotCancelled(runContext) {
|
|
474
|
+
if (runContext?.signal.aborted) {
|
|
475
|
+
throw new TaskCancelledError("SSH 运维任务已取消");
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
//# sourceMappingURL=ssh-ops-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-ops-executor.js","sourceRoot":"","sources":["../../../../src/modules/ops-runtime/ssh-ops-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAOpD,OAAO,EAAE,kBAAkB,EAAuB,MAAM,wBAAwB,CAAC;AA6CjF,MAAM,OAAO,cAAc;IAIN;IACA;IACA;IACA;IACA;IACA;IARF,YAAY,CAAS;IAEtC,YACmB,MAAkB,EAClB,oBAA0C,EAC1C,wBAAkD,EAClD,wBAAkD,EAClD,uBAAgD,EAChD,0BAAsD;QALtD,WAAM,GAAN,MAAM,CAAY;QAClB,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,4BAAuB,GAAvB,uBAAuB,CAAyB;QAChD,+BAA0B,GAA1B,0BAA0B,CAA4B;QAEvE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,O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C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FastifyReply, FastifyRequest } from "fastify";
|
|
2
|
+
import type { PresentationExportTaskService } from "./presentation-export-task-service.js";
|
|
3
|
+
interface CreatePresentationExportBody {
|
|
4
|
+
workspaceId?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
htmlContent?: string;
|
|
7
|
+
format?: "pdf" | "pptx";
|
|
8
|
+
}
|
|
9
|
+
interface PresentationExportTaskParams {
|
|
10
|
+
taskId: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class PresentationController {
|
|
13
|
+
private readonly presentationExportTaskService;
|
|
14
|
+
constructor(presentationExportTaskService: PresentationExportTaskService);
|
|
15
|
+
readonly createExportTask: (request: FastifyRequest<{
|
|
16
|
+
Body: CreatePresentationExportBody;
|
|
17
|
+
}>, reply: FastifyReply) => Promise<void>;
|
|
18
|
+
readonly getExportTask: (request: FastifyRequest<{
|
|
19
|
+
Params: PresentationExportTaskParams;
|
|
20
|
+
}>, reply: FastifyReply) => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AppError } from "../../shared/errors/app-error.js";
|
|
2
|
+
export class PresentationController {
|
|
3
|
+
presentationExportTaskService;
|
|
4
|
+
constructor(presentationExportTaskService) {
|
|
5
|
+
this.presentationExportTaskService = presentationExportTaskService;
|
|
6
|
+
}
|
|
7
|
+
createExportTask = async (request, reply) => {
|
|
8
|
+
ensureAuthenticated(request);
|
|
9
|
+
const workspaceId = request.body?.workspaceId?.trim() ?? "";
|
|
10
|
+
const sourcePath = request.body?.path?.trim() ?? "";
|
|
11
|
+
const htmlContent = request.body?.htmlContent ?? "";
|
|
12
|
+
const format = request.body?.format === "pptx" ? "pptx" : "pdf";
|
|
13
|
+
if (!workspaceId) {
|
|
14
|
+
throw new AppError({
|
|
15
|
+
statusCode: 400,
|
|
16
|
+
errorCode: "WORKSPACE_ID_REQUIRED",
|
|
17
|
+
detail: "导出文件时缺少工作区 ID",
|
|
18
|
+
field: "workspaceId"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!sourcePath) {
|
|
22
|
+
throw new AppError({
|
|
23
|
+
statusCode: 400,
|
|
24
|
+
errorCode: "PRESENTATION_SOURCE_PATH_REQUIRED",
|
|
25
|
+
detail: "导出文件时缺少源文件路径",
|
|
26
|
+
field: "path"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (typeof htmlContent !== "string") {
|
|
30
|
+
throw new AppError({
|
|
31
|
+
statusCode: 400,
|
|
32
|
+
errorCode: "PRESENTATION_HTML_REQUIRED",
|
|
33
|
+
detail: "导出文件时缺少 HTML 内容",
|
|
34
|
+
field: "htmlContent"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
reply.status(202).send(await this.presentationExportTaskService.createExportTask({
|
|
38
|
+
workspaceId,
|
|
39
|
+
path: sourcePath,
|
|
40
|
+
htmlContent,
|
|
41
|
+
format
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
getExportTask = async (request, reply) => {
|
|
45
|
+
ensureAuthenticated(request);
|
|
46
|
+
reply.send(this.presentationExportTaskService.getTask(request.params.taskId));
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function ensureAuthenticated(request) {
|
|
50
|
+
if (request.auth?.user.userId) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
throw new AppError({
|
|
54
|
+
statusCode: 401,
|
|
55
|
+
errorCode: "UNAUTHORIZED",
|
|
56
|
+
detail: "当前请求缺少有效登录态"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=presentation-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation-controller.js","sourceRoot":"","sources":["../../../../src/modules/presentation/presentation-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAc5D,MAAM,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,IAAI,CAAC,MAAM,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,CAAC;YAC/E,WAAW;YACX,IAAI,EAAE,UAAU;YAChB,WAAW;YACX,MAAM;SACP,CAAC,CAAC,CAAC;IACN,CAAC,CAAC;IAEO,aAAa,GAAG,KAAK,EAC5B,OAAiE,EACjE,KAAmB,EACJ,EAAE;QACjB,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAChF,CAAC,CAAC;CACH;AAED,SAAS,mBAAmB,CAAC,OAAuB;IAClD,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,QAAQ,CAAC;QACjB,UAAU,EAAE,GAAG;QACf,SAAS,EAAE,cAAc;QACzB,MAAM,EAAE,aAAa;KACtB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { FileAccessGuard } from "../file/file-access-guard.js";
|
|
2
|
+
import type { TaskManager } from "../tasks/task-manager.js";
|
|
3
|
+
import type { PresentationPdfExportTaskDto } from "./presentation-export-types.js";
|
|
4
|
+
import type { PresentationPdfExportService } from "./presentation-pdf-export-service.js";
|
|
5
|
+
import type { PresentationPptxExportService } from "./presentation-pptx-export-service.js";
|
|
6
|
+
interface CreatePresentationPdfExportInput {
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
path: string;
|
|
9
|
+
htmlContent: string;
|
|
10
|
+
format: "pdf" | "pptx";
|
|
11
|
+
}
|
|
12
|
+
export declare class PresentationExportTaskService {
|
|
13
|
+
private readonly taskManager;
|
|
14
|
+
private readonly presentationPdfExportService;
|
|
15
|
+
private readonly presentationPptxExportService;
|
|
16
|
+
private readonly fileAccessGuard;
|
|
17
|
+
private readonly taskRecordById;
|
|
18
|
+
constructor(taskManager: TaskManager, presentationPdfExportService: PresentationPdfExportService, presentationPptxExportService: PresentationPptxExportService, fileAccessGuard: FileAccessGuard);
|
|
19
|
+
createExportTask(input: CreatePresentationPdfExportInput): Promise<PresentationPdfExportTaskDto>;
|
|
20
|
+
getTask(taskId: string): PresentationPdfExportTaskDto;
|
|
21
|
+
private registerTask;
|
|
22
|
+
private toTaskDto;
|
|
23
|
+
}
|
|
24
|
+
export {};
|