@xyit/wellspring 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +829 -2
- package/dist/agent/pending-asks.d.ts +20 -0
- package/dist/agent/pending-asks.js +70 -0
- package/dist/agent/pending-asks.js.map +1 -0
- package/dist/agent/task-registry.d.ts +14 -0
- package/dist/agent/task-registry.js +80 -0
- package/dist/agent/task-registry.js.map +1 -0
- package/dist/agent/tool-context.d.ts +30 -0
- package/dist/agent/tool-context.js +10 -0
- package/dist/agent/tool-context.js.map +1 -0
- package/dist/agent/usage.d.ts +40 -0
- package/dist/agent/usage.js +122 -0
- package/dist/agent/usage.js.map +1 -0
- package/dist/api/host/agent.d.ts +165 -0
- package/dist/api/host/agent.js +5 -0
- package/dist/api/host/agent.js.map +1 -0
- package/dist/api/host/events.d.ts +2 -0
- package/dist/api/host/events.js +6 -0
- package/dist/api/host/events.js.map +1 -0
- package/dist/api/host/exec.d.ts +36 -0
- package/dist/api/host/exec.js +10 -0
- package/dist/api/host/exec.js.map +1 -0
- package/dist/api/host/fs.d.ts +24 -0
- package/dist/api/host/fs.js +7 -0
- package/dist/api/host/fs.js.map +1 -0
- package/dist/api/host/hooks.d.ts +210 -0
- package/dist/api/host/hooks.js +401 -0
- package/dist/api/host/hooks.js.map +1 -0
- package/dist/api/host/host.d.ts +36 -0
- package/dist/api/host/host.js +53 -0
- package/dist/api/host/host.js.map +1 -0
- package/dist/api/host/http.d.ts +58 -0
- package/dist/api/host/http.js +6 -0
- package/dist/api/host/http.js.map +1 -0
- package/dist/api/host/index.d.ts +15 -0
- package/dist/api/host/index.js +20 -0
- package/dist/api/host/index.js.map +1 -0
- package/dist/api/host/models.d.ts +65 -0
- package/dist/api/host/models.js +8 -0
- package/dist/api/host/models.js.map +1 -0
- package/dist/api/host/network.d.ts +22 -0
- package/dist/api/host/network.js +7 -0
- package/dist/api/host/network.js.map +1 -0
- package/dist/api/host/plugin.d.ts +138 -0
- package/dist/api/host/plugin.js +6 -0
- package/dist/api/host/plugin.js.map +1 -0
- package/dist/api/host/plugins.d.ts +45 -0
- package/dist/api/host/plugins.js +6 -0
- package/dist/api/host/plugins.js.map +1 -0
- package/dist/api/host/pty.d.ts +55 -0
- package/dist/api/host/pty.js +21 -0
- package/dist/api/host/pty.js.map +1 -0
- package/dist/api/host/session.d.ts +5 -0
- package/dist/api/host/session.js +52 -0
- package/dist/api/host/session.js.map +1 -0
- package/dist/api/host/version.d.ts +2 -0
- package/dist/api/host/version.js +3 -0
- package/dist/api/host/version.js.map +1 -0
- package/dist/api/host/workspace.d.ts +38 -0
- package/dist/api/host/workspace.js +9 -0
- package/dist/api/host/workspace.js.map +1 -0
- package/dist/api/plugin/http-client.d.ts +42 -0
- package/dist/api/plugin/http-client.js +364 -0
- package/dist/api/plugin/http-client.js.map +1 -0
- package/dist/api/plugin/http-protocol.d.ts +152 -0
- package/dist/api/plugin/http-protocol.js +49 -0
- package/dist/api/plugin/http-protocol.js.map +1 -0
- package/dist/api/result/result.d.ts +16 -0
- package/dist/api/result/result.js +43 -0
- package/dist/api/result/result.js.map +1 -0
- package/dist/commands/agent-turn.d.ts +63 -0
- package/dist/commands/agent-turn.js +687 -0
- package/dist/commands/agent-turn.js.map +1 -0
- package/dist/commands/ask-prompt.d.ts +6 -0
- package/dist/commands/ask-prompt.js +49 -0
- package/dist/commands/ask-prompt.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +283 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/conversation.d.ts +51 -0
- package/dist/commands/conversation.js +630 -0
- package/dist/commands/conversation.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +77 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/exec-approval.d.ts +3 -0
- package/dist/commands/exec-approval.js +80 -0
- package/dist/commands/exec-approval.js.map +1 -0
- package/dist/commands/help.d.ts +2 -0
- package/dist/commands/help.js +35 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/key.d.ts +2 -0
- package/dist/commands/key.js +226 -0
- package/dist/commands/key.js.map +1 -0
- package/dist/commands/plugin.d.ts +2 -0
- package/dist/commands/plugin.js +188 -0
- package/dist/commands/plugin.js.map +1 -0
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.js +167 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/shared.d.ts +35 -0
- package/dist/commands/shared.js +66 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/start.d.ts +2 -0
- package/dist/commands/start.js +75 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/stop.d.ts +2 -0
- package/dist/commands/stop.js +24 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/commands/version.d.ts +2 -0
- package/dist/commands/version.js +33 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/config/codes.d.ts +13 -0
- package/dist/config/codes.js +15 -0
- package/dist/config/codes.js.map +1 -0
- package/dist/config/credentials.d.ts +67 -0
- package/dist/config/credentials.js +214 -0
- package/dist/config/credentials.js.map +1 -0
- package/dist/config/defaults.d.ts +5 -0
- package/dist/config/defaults.js +31 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +10 -0
- package/dist/config/loader.js +68 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/providers.d.ts +30 -0
- package/dist/config/providers.js +97 -0
- package/dist/config/providers.js.map +1 -0
- package/dist/config/types.d.ts +75 -0
- package/dist/config/types.js +4 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validate.d.ts +4 -0
- package/dist/config/validate.js +391 -0
- package/dist/config/validate.js.map +1 -0
- package/dist/display/markdown.d.ts +7 -0
- package/dist/display/markdown.js +116 -0
- package/dist/display/markdown.js.map +1 -0
- package/dist/display/tool-label.d.ts +6 -0
- package/dist/display/tool-label.js +81 -0
- package/dist/display/tool-label.js.map +1 -0
- package/dist/event/event.d.ts +27 -0
- package/dist/event/event.js +152 -0
- package/dist/event/event.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +308 -0
- package/dist/index.js.map +1 -0
- package/dist/input/codes.d.ts +15 -0
- package/dist/input/codes.js +20 -0
- package/dist/input/codes.js.map +1 -0
- package/dist/input/commands.d.ts +10 -0
- package/dist/input/commands.js +65 -0
- package/dist/input/commands.js.map +1 -0
- package/dist/input/help.d.ts +8 -0
- package/dist/input/help.js +51 -0
- package/dist/input/help.js.map +1 -0
- package/dist/input/index.d.ts +6 -0
- package/dist/input/index.js +10 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/parse-options.d.ts +11 -0
- package/dist/input/parse-options.js +51 -0
- package/dist/input/parse-options.js.map +1 -0
- package/dist/input/parse.d.ts +3 -0
- package/dist/input/parse.js +119 -0
- package/dist/input/parse.js.map +1 -0
- package/dist/input/types.d.ts +17 -0
- package/dist/input/types.js +2 -0
- package/dist/input/types.js.map +1 -0
- package/dist/logger/elog4js.d.ts +65 -0
- package/dist/logger/elog4js.js +305 -0
- package/dist/logger/elog4js.js.map +1 -0
- package/dist/logger/logger.d.ts +37 -0
- package/dist/logger/logger.js +196 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +6 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/openai.d.ts +117 -0
- package/dist/network/openai.js +443 -0
- package/dist/network/openai.js.map +1 -0
- package/dist/network/proxy.d.ts +9 -0
- package/dist/network/proxy.js +72 -0
- package/dist/network/proxy.js.map +1 -0
- package/dist/network/web.d.ts +34 -0
- package/dist/network/web.js +152 -0
- package/dist/network/web.js.map +1 -0
- package/dist/platform/clipboard.d.ts +15 -0
- package/dist/platform/clipboard.js +82 -0
- package/dist/platform/clipboard.js.map +1 -0
- package/dist/platform/exec.d.ts +28 -0
- package/dist/platform/exec.js +95 -0
- package/dist/platform/exec.js.map +1 -0
- package/dist/platform/file.d.ts +38 -0
- package/dist/platform/file.js +197 -0
- package/dist/platform/file.js.map +1 -0
- package/dist/platform/index.d.ts +7 -0
- package/dist/platform/index.js +12 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/notification.d.ts +14 -0
- package/dist/platform/notification.js +82 -0
- package/dist/platform/notification.js.map +1 -0
- package/dist/platform/open-external.d.ts +10 -0
- package/dist/platform/open-external.js +105 -0
- package/dist/platform/open-external.js.map +1 -0
- package/dist/platform/os.d.ts +20 -0
- package/dist/platform/os.js +86 -0
- package/dist/platform/os.js.map +1 -0
- package/dist/platform/path.d.ts +32 -0
- package/dist/platform/path.js +154 -0
- package/dist/platform/path.js.map +1 -0
- package/dist/plugin/access-guard.d.ts +1 -0
- package/dist/plugin/access-guard.js +40 -0
- package/dist/plugin/access-guard.js.map +1 -0
- package/dist/plugin/agent-service.d.ts +25 -0
- package/dist/plugin/agent-service.js +809 -0
- package/dist/plugin/agent-service.js.map +1 -0
- package/dist/plugin/agent-tools.d.ts +12 -0
- package/dist/plugin/agent-tools.js +31 -0
- package/dist/plugin/agent-tools.js.map +1 -0
- package/dist/plugin/capabilities.d.ts +26 -0
- package/dist/plugin/capabilities.js +192 -0
- package/dist/plugin/capabilities.js.map +1 -0
- package/dist/plugin/console-guard.d.ts +2 -0
- package/dist/plugin/console-guard.js +52 -0
- package/dist/plugin/console-guard.js.map +1 -0
- package/dist/plugin/data-access.d.ts +15 -0
- package/dist/plugin/data-access.js +57 -0
- package/dist/plugin/data-access.js.map +1 -0
- package/dist/plugin/fs.d.ts +3 -0
- package/dist/plugin/fs.js +93 -0
- package/dist/plugin/fs.js.map +1 -0
- package/dist/plugin/host-alias.d.ts +2 -0
- package/dist/plugin/host-alias.js +57 -0
- package/dist/plugin/host-alias.js.map +1 -0
- package/dist/plugin/index.d.ts +7 -0
- package/dist/plugin/index.js +11 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/install.d.ts +12 -0
- package/dist/plugin/install.js +114 -0
- package/dist/plugin/install.js.map +1 -0
- package/dist/plugin/loader.d.ts +45 -0
- package/dist/plugin/loader.js +739 -0
- package/dist/plugin/loader.js.map +1 -0
- package/dist/plugin/manage.d.ts +31 -0
- package/dist/plugin/manage.js +265 -0
- package/dist/plugin/manage.js.map +1 -0
- package/dist/plugin/models-service.d.ts +15 -0
- package/dist/plugin/models-service.js +317 -0
- package/dist/plugin/models-service.js.map +1 -0
- package/dist/plugin/network-service.d.ts +10 -0
- package/dist/plugin/network-service.js +87 -0
- package/dist/plugin/network-service.js.map +1 -0
- package/dist/plugin/paths.d.ts +6 -0
- package/dist/plugin/paths.js +15 -0
- package/dist/plugin/paths.js.map +1 -0
- package/dist/plugin/registry.d.ts +17 -0
- package/dist/plugin/registry.js +82 -0
- package/dist/plugin/registry.js.map +1 -0
- package/dist/plugin/runtime.d.ts +9 -0
- package/dist/plugin/runtime.js +43 -0
- package/dist/plugin/runtime.js.map +1 -0
- package/dist/plugin/scaffold.d.ts +13 -0
- package/dist/plugin/scaffold.js +126 -0
- package/dist/plugin/scaffold.js.map +1 -0
- package/dist/plugin/state.d.ts +6 -0
- package/dist/plugin/state.js +38 -0
- package/dist/plugin/state.js.map +1 -0
- package/dist/plugin/zip.d.ts +7 -0
- package/dist/plugin/zip.js +138 -0
- package/dist/plugin/zip.js.map +1 -0
- package/dist/sandbox/audit.d.ts +12 -0
- package/dist/sandbox/audit.js +20 -0
- package/dist/sandbox/audit.js.map +1 -0
- package/dist/sandbox/backends/bwrap.d.ts +28 -0
- package/dist/sandbox/backends/bwrap.js +197 -0
- package/dist/sandbox/backends/bwrap.js.map +1 -0
- package/dist/sandbox/backends/direct.d.ts +7 -0
- package/dist/sandbox/backends/direct.js +32 -0
- package/dist/sandbox/backends/direct.js.map +1 -0
- package/dist/sandbox/bridge-state.d.ts +13 -0
- package/dist/sandbox/bridge-state.js +12 -0
- package/dist/sandbox/bridge-state.js.map +1 -0
- package/dist/sandbox/index.d.ts +5 -0
- package/dist/sandbox/index.js +6 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/manager.d.ts +8 -0
- package/dist/sandbox/manager.js +325 -0
- package/dist/sandbox/manager.js.map +1 -0
- package/dist/sandbox/memory-limit.d.ts +44 -0
- package/dist/sandbox/memory-limit.js +193 -0
- package/dist/sandbox/memory-limit.js.map +1 -0
- package/dist/sandbox/plugin-client.d.ts +80 -0
- package/dist/sandbox/plugin-client.js +1601 -0
- package/dist/sandbox/plugin-client.js.map +1 -0
- package/dist/sandbox/plugin-host.d.ts +1 -0
- package/dist/sandbox/plugin-host.js +1001 -0
- package/dist/sandbox/plugin-host.js.map +1 -0
- package/dist/sandbox/protocol.d.ts +43 -0
- package/dist/sandbox/protocol.js +96 -0
- package/dist/sandbox/protocol.js.map +1 -0
- package/dist/sandbox/rpc-timeouts.d.ts +28 -0
- package/dist/sandbox/rpc-timeouts.js +15 -0
- package/dist/sandbox/rpc-timeouts.js.map +1 -0
- package/dist/sandbox/supervisor.d.ts +31 -0
- package/dist/sandbox/supervisor.js +114 -0
- package/dist/sandbox/supervisor.js.map +1 -0
- package/dist/sandbox/types.d.ts +124 -0
- package/dist/sandbox/types.js +17 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/service/control.d.ts +32 -0
- package/dist/service/control.js +117 -0
- package/dist/service/control.js.map +1 -0
- package/dist/session/compress.d.ts +3 -0
- package/dist/session/compress.js +42 -0
- package/dist/session/compress.js.map +1 -0
- package/dist/session/index.d.ts +4 -0
- package/dist/session/index.js +8 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/registry.d.ts +4 -0
- package/dist/session/registry.js +12 -0
- package/dist/session/registry.js.map +1 -0
- package/dist/session/replay.d.ts +10 -0
- package/dist/session/replay.js +109 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/session.d.ts +40 -0
- package/dist/session/session.js +108 -0
- package/dist/session/session.js.map +1 -0
- package/dist/session/store.d.ts +58 -0
- package/dist/session/store.js +382 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/types.d.ts +56 -0
- package/dist/session/types.js +3 -0
- package/dist/session/types.js.map +1 -0
- package/dist/workspace/index.d.ts +7 -0
- package/dist/workspace/index.js +17 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/registry.d.ts +25 -0
- package/dist/workspace/registry.js +293 -0
- package/dist/workspace/registry.js.map +1 -0
- package/package.json +73 -5
- package/scripts/build-node-pty.mjs +55 -0
- package/scripts/rewrite-dts.mjs +36 -0
- package/scripts/verify-sandbox.ts +98 -0
- package/src/agent/pending-asks.ts +88 -0
- package/src/agent/task-registry.ts +108 -0
- package/src/agent/tool-context.ts +47 -0
- package/src/agent/usage.ts +170 -0
- package/src/api/host/agent.ts +162 -0
- package/src/api/host/events.ts +7 -0
- package/src/api/host/exec.ts +47 -0
- package/src/api/host/fs.ts +33 -0
- package/src/api/host/hooks.ts +635 -0
- package/src/api/host/host.ts +99 -0
- package/src/api/host/http.ts +79 -0
- package/src/api/host/index.ts +20 -0
- package/src/api/host/models.ts +81 -0
- package/src/api/host/network.ts +32 -0
- package/src/api/host/plugin.ts +158 -0
- package/src/api/host/plugins.ts +55 -0
- package/src/api/host/pty.ts +73 -0
- package/src/api/host/session.ts +61 -0
- package/src/api/host/version.ts +2 -0
- package/src/api/host/workspace.ts +51 -0
- package/src/api/plugin/http-client.ts +492 -0
- package/src/api/plugin/http-protocol.ts +231 -0
- package/src/api/result/result.ts +52 -0
- package/src/commands/agent-turn.ts +817 -0
- package/src/commands/ask-prompt.ts +52 -0
- package/src/commands/config.ts +306 -0
- package/src/commands/conversation.ts +777 -0
- package/src/commands/doctor.ts +92 -0
- package/src/commands/exec-approval.ts +91 -0
- package/src/commands/help.ts +41 -0
- package/src/commands/key.ts +281 -0
- package/src/commands/plugin.ts +218 -0
- package/src/commands/session.ts +179 -0
- package/src/commands/shared.ts +103 -0
- package/src/commands/start.ts +88 -0
- package/src/commands/stop.ts +24 -0
- package/src/commands/version.ts +40 -0
- package/src/config/codes.ts +17 -0
- package/src/config/credentials.ts +302 -0
- package/src/config/defaults.ts +32 -0
- package/src/config/index.ts +10 -0
- package/src/config/loader.ts +80 -0
- package/src/config/providers.ts +133 -0
- package/src/config/types.ts +88 -0
- package/src/config/validate.ts +458 -0
- package/src/display/markdown.ts +137 -0
- package/src/display/tool-label.ts +87 -0
- package/src/event/event.ts +171 -0
- package/src/index.ts +344 -0
- package/src/input/codes.ts +21 -0
- package/src/input/commands.ts +76 -0
- package/src/input/help.ts +60 -0
- package/src/input/index.ts +10 -0
- package/src/input/parse-options.ts +66 -0
- package/src/input/parse.ts +138 -0
- package/src/input/types.ts +19 -0
- package/src/logger/elog4js.ts +366 -0
- package/src/logger/logger.ts +251 -0
- package/src/network/index.ts +6 -0
- package/src/network/openai.ts +571 -0
- package/src/network/proxy.ts +80 -0
- package/src/network/web.ts +206 -0
- package/src/platform/clipboard.ts +107 -0
- package/src/platform/exec.ts +128 -0
- package/src/platform/file.ts +235 -0
- package/src/platform/index.ts +12 -0
- package/src/platform/notification.ts +108 -0
- package/src/platform/open-external.ts +132 -0
- package/src/platform/os.ts +101 -0
- package/src/platform/path.ts +214 -0
- package/src/plugin/access-guard.ts +46 -0
- package/src/plugin/agent-service.ts +969 -0
- package/src/plugin/agent-tools.ts +43 -0
- package/src/plugin/capabilities.ts +240 -0
- package/src/plugin/console-guard.ts +66 -0
- package/src/plugin/data-access.ts +70 -0
- package/src/plugin/fs.ts +109 -0
- package/src/plugin/host-alias.ts +61 -0
- package/src/plugin/index.ts +11 -0
- package/src/plugin/install.ts +149 -0
- package/src/plugin/loader.ts +952 -0
- package/src/plugin/manage.ts +329 -0
- package/src/plugin/models-service.ts +383 -0
- package/src/plugin/network-service.ts +102 -0
- package/src/plugin/paths.ts +19 -0
- package/src/plugin/registry.ts +103 -0
- package/src/plugin/runtime.ts +57 -0
- package/src/plugin/scaffold.ts +152 -0
- package/src/plugin/state.ts +52 -0
- package/src/plugin/zip.ts +156 -0
- package/src/sandbox/audit.ts +38 -0
- package/src/sandbox/backends/bwrap.ts +251 -0
- package/src/sandbox/backends/direct.ts +43 -0
- package/src/sandbox/bridge-state.ts +29 -0
- package/src/sandbox/index.ts +5 -0
- package/src/sandbox/manager.ts +406 -0
- package/src/sandbox/memory-limit.ts +245 -0
- package/src/sandbox/plugin-client.ts +1881 -0
- package/src/sandbox/plugin-host.ts +1282 -0
- package/src/sandbox/protocol.ts +142 -0
- package/src/sandbox/pty-bridge.py +154 -0
- package/src/sandbox/rpc-timeouts.ts +43 -0
- package/src/sandbox/supervisor.ts +172 -0
- package/src/sandbox/types.ts +149 -0
- package/src/service/control.ts +155 -0
- package/src/session/compress.ts +47 -0
- package/src/session/index.ts +8 -0
- package/src/session/registry.ts +17 -0
- package/src/session/replay.ts +132 -0
- package/src/session/session.ts +134 -0
- package/src/session/store.ts +468 -0
- package/src/session/types.ts +61 -0
- package/src/workspace/index.ts +21 -0
- package/src/workspace/registry.ts +356 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 插件脚手架:生成可加载的最小插件目录。
|
|
3
|
+
*/
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
|
+
import { ensureDir, removePath, statIfExists, writeJsonAtomic, writeTextAtomic, } from "../platform/file.js";
|
|
6
|
+
import { PLUGIN_NAME } from "./paths.js";
|
|
7
|
+
/** 插件名 → 合法命令名;名字不适用时回落到 hello */
|
|
8
|
+
export function commandNameOf(pluginName) {
|
|
9
|
+
let slug = pluginName
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.replace(/[^a-z0-9-]+/g, "-")
|
|
12
|
+
.replace(/-+/g, "-")
|
|
13
|
+
.replace(/^-+|-+$/g, "");
|
|
14
|
+
if (!/^[a-z][a-z0-9-]*$/.test(slug) || slug.length < 2) {
|
|
15
|
+
slug = "hello";
|
|
16
|
+
}
|
|
17
|
+
return slug.slice(0, 32).replace(/-+$/, "");
|
|
18
|
+
}
|
|
19
|
+
function template(pluginName, commandName) {
|
|
20
|
+
return [
|
|
21
|
+
'import { onMessage, onInit, onShutdown } from "wellspring/api/host/index.ts"',
|
|
22
|
+
'import type { WellspringPlugin } from "wellspring/api/host/index.ts"',
|
|
23
|
+
"",
|
|
24
|
+
"// 钩子可以放在模块顶层;平台在 import 时会把它们归属到当前插件",
|
|
25
|
+
"onMessage(({ phase, prompt }) => {",
|
|
26
|
+
' if (phase === "before") prompt.push("你是一个运行在 Wellspring 里的助手")',
|
|
27
|
+
"})",
|
|
28
|
+
"",
|
|
29
|
+
"export function setup() {",
|
|
30
|
+
" onInit(() => {",
|
|
31
|
+
" // wellspring start 时触发",
|
|
32
|
+
" })",
|
|
33
|
+
" onShutdown(() => {",
|
|
34
|
+
" // wellspring start 关闭时触发",
|
|
35
|
+
" })",
|
|
36
|
+
"",
|
|
37
|
+
" const plugin = {",
|
|
38
|
+
` id: ${JSON.stringify(pluginName)},`,
|
|
39
|
+
` name: ${JSON.stringify(pluginName)},`,
|
|
40
|
+
' version: "0.1.0",',
|
|
41
|
+
' status: "ok",',
|
|
42
|
+
" deps: [],",
|
|
43
|
+
" commands: [",
|
|
44
|
+
" {",
|
|
45
|
+
` name: ${JSON.stringify(commandName)},`,
|
|
46
|
+
` summary: ${JSON.stringify(`${pluginName} 示例命令`)},`,
|
|
47
|
+
" run: (ctx) => {",
|
|
48
|
+
' ctx.output.info("argv=" + ctx.argv.join(","))',
|
|
49
|
+
" return 0",
|
|
50
|
+
" },",
|
|
51
|
+
" },",
|
|
52
|
+
" ],",
|
|
53
|
+
" } satisfies WellspringPlugin",
|
|
54
|
+
"",
|
|
55
|
+
" return plugin",
|
|
56
|
+
"}",
|
|
57
|
+
"",
|
|
58
|
+
].join("\n");
|
|
59
|
+
}
|
|
60
|
+
function readmeTemplate(pluginName, commandName) {
|
|
61
|
+
return [
|
|
62
|
+
`# ${pluginName}`,
|
|
63
|
+
"",
|
|
64
|
+
"## 开发",
|
|
65
|
+
"",
|
|
66
|
+
"编辑器 / tsc 解析 `wellspring/api/host/index.ts` 需要先把 Wellspring 链接进来:",
|
|
67
|
+
"",
|
|
68
|
+
"```bash",
|
|
69
|
+
"pnpm link /path/to/Wellspring",
|
|
70
|
+
"pnpm add -D typescript @types/node # 如果还没有",
|
|
71
|
+
"pnpm exec tsc --noEmit",
|
|
72
|
+
"```",
|
|
73
|
+
"",
|
|
74
|
+
"运行时不需要链接:通过 `wellspring plugin link <this-dir>` 加载时,平台会解析宿主 API。",
|
|
75
|
+
"",
|
|
76
|
+
"## 加载",
|
|
77
|
+
"",
|
|
78
|
+
"```bash",
|
|
79
|
+
`wellspring plugin link \"$PWD\"`,
|
|
80
|
+
"wellspring plugin list",
|
|
81
|
+
`wellspring ${commandName}`,
|
|
82
|
+
"```",
|
|
83
|
+
"",
|
|
84
|
+
].join("\n");
|
|
85
|
+
}
|
|
86
|
+
export async function scaffoldPlugin(options) {
|
|
87
|
+
const name = options.name.trim();
|
|
88
|
+
if (!PLUGIN_NAME.test(name)) {
|
|
89
|
+
throw new Error(`插件名不合法:${name}`);
|
|
90
|
+
}
|
|
91
|
+
const parentDir = resolve(options.parentDir ?? process.cwd());
|
|
92
|
+
const dir = join(parentDir, name);
|
|
93
|
+
const existing = await statIfExists(dir);
|
|
94
|
+
if (existing !== null) {
|
|
95
|
+
if (options.force !== true) {
|
|
96
|
+
throw new Error(`目录已存在:${dir}`);
|
|
97
|
+
}
|
|
98
|
+
await removePath(dir);
|
|
99
|
+
}
|
|
100
|
+
await ensureDir(dir);
|
|
101
|
+
const commandName = commandNameOf(name);
|
|
102
|
+
await writeJsonAtomic(join(dir, "package.json"), {
|
|
103
|
+
name,
|
|
104
|
+
version: "0.1.0",
|
|
105
|
+
type: "module",
|
|
106
|
+
main: "index.ts",
|
|
107
|
+
wellspring: { apiVersion: 1 },
|
|
108
|
+
});
|
|
109
|
+
await writeTextAtomic(join(dir, "index.ts"), template(name, commandName));
|
|
110
|
+
await writeJsonAtomic(join(dir, "tsconfig.json"), {
|
|
111
|
+
compilerOptions: {
|
|
112
|
+
target: "ES2024",
|
|
113
|
+
module: "NodeNext",
|
|
114
|
+
moduleResolution: "NodeNext",
|
|
115
|
+
strict: true,
|
|
116
|
+
noEmit: true,
|
|
117
|
+
allowImportingTsExtensions: true,
|
|
118
|
+
skipLibCheck: true,
|
|
119
|
+
types: ["node"],
|
|
120
|
+
},
|
|
121
|
+
include: ["index.ts"],
|
|
122
|
+
});
|
|
123
|
+
await writeTextAtomic(join(dir, "README.md"), readmeTemplate(name, commandName));
|
|
124
|
+
return { dir, commandName };
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=scaffold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../src/plugin/scaffold.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACH,SAAS,EACT,UAAU,EACV,YAAY,EACZ,eAAe,EACf,eAAe,GAClB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAcxC,kCAAkC;AAClC,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC5C,IAAI,IAAI,GAAG,UAAU;SAChB,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAC5B,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrD,IAAI,GAAG,OAAO,CAAA;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AA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,UAAU;YAClB,gBAAgB,EAAE,UAAU;YAC5B,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,0BAA0B,EAAE,IAAI;YAChC,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,CAAC,MAAM,CAAC;SAClB;QACD,OAAO,EAAE,CAAC,UAAU,CAAC;KACxB,CAAC,CAAA;IACF,MAAM,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAA;IAChF,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ResolvedPaths } from "../platform/path.js";
|
|
2
|
+
export declare function pluginStateFile(paths?: ResolvedPaths): string;
|
|
3
|
+
/** 读取被禁用的插件目录名集合 */
|
|
4
|
+
export declare function readPluginState(paths?: ResolvedPaths): Promise<ReadonlySet<string>>;
|
|
5
|
+
/** 设置插件启用/禁用,返回是否发生变化 */
|
|
6
|
+
export declare function setPluginEnabled(name: string, enabled: boolean, paths?: ResolvedPaths): Promise<boolean>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 插件启用状态:<dataDir>/plugins-state.json。
|
|
3
|
+
* 以插件目录名为 key,禁用后 loader 不再 import 该插件。
|
|
4
|
+
*/
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { readJsonIfExists, writeJsonAtomic } from "../platform/file.js";
|
|
7
|
+
import { getPaths } from "../platform/path.js";
|
|
8
|
+
export function pluginStateFile(paths = getPaths()) {
|
|
9
|
+
return join(paths.dataDir, "plugins-state.json");
|
|
10
|
+
}
|
|
11
|
+
/** 读取被禁用的插件目录名集合 */
|
|
12
|
+
export async function readPluginState(paths = getPaths()) {
|
|
13
|
+
const value = await readJsonIfExists(pluginStateFile(paths));
|
|
14
|
+
if (value === null || !Array.isArray(value.disabled)) {
|
|
15
|
+
return new Set();
|
|
16
|
+
}
|
|
17
|
+
return new Set(value.disabled.filter((item) => typeof item === "string"));
|
|
18
|
+
}
|
|
19
|
+
/** 设置插件启用/禁用,返回是否发生变化 */
|
|
20
|
+
export async function setPluginEnabled(name, enabled, paths = getPaths()) {
|
|
21
|
+
const disabled = new Set(await readPluginState(paths));
|
|
22
|
+
const had = disabled.has(name);
|
|
23
|
+
if (enabled) {
|
|
24
|
+
disabled.delete(name);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
disabled.add(name);
|
|
28
|
+
}
|
|
29
|
+
if (had === !enabled) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
await writeJsonAtomic(pluginStateFile(paths), {
|
|
33
|
+
version: 1,
|
|
34
|
+
disabled: [...disabled].sort(),
|
|
35
|
+
});
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/plugin/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAsB,MAAM,qBAAqB,CAAA;AAOlE,MAAM,UAAU,eAAe,CAAC,KAAK,GAAkB,QAAQ,EAAE;IAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAA;AACpD,CAAC;AAED,oBAAoB;AACpB,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,KAAK,GAAkB,QAAQ,EAAE;IAEjC,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAkB,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;IAC7E,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,OAAO,IAAI,GAAG,EAAE,CAAA;IACpB,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAA;AAC7F,CAAC;AAED,yBAAyB;AACzB,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,IAAY,EACZ,OAAgB,EAChB,KAAK,GAAkB,QAAQ,EAAE;IAEjC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;IACtD,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,OAAO,EAAE,CAAC;QACV,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;SAAM,CAAC;QACJ,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,IAAI,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,MAAM,eAAe,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;QAC1C,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE;KACjC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 最小 ZIP 读取器,只服务本地插件安装。
|
|
3
|
+
* 支持 store/deflate 两种压缩方式,拒绝加密、ZIP64、符号链接与路径穿越。
|
|
4
|
+
*/
|
|
5
|
+
import { inflateRawSync } from "node:zlib";
|
|
6
|
+
import { ensureDir, writeBytesAtomic } from "../platform/file.js";
|
|
7
|
+
import { dirname, resolve, sep } from "node:path";
|
|
8
|
+
const EOCD_SIGNATURE = 0x06054b50;
|
|
9
|
+
const CENTRAL_SIGNATURE = 0x02014b50;
|
|
10
|
+
const LOCAL_SIGNATURE = 0x04034b50;
|
|
11
|
+
const MAX_ENTRIES = 10_000;
|
|
12
|
+
const MAX_ENTRY_BYTES = 100 * 1024 * 1024;
|
|
13
|
+
const MAX_TOTAL_BYTES = 200 * 1024 * 1024;
|
|
14
|
+
function fail(message) {
|
|
15
|
+
throw new Error(`zip 包非法:${message}`);
|
|
16
|
+
}
|
|
17
|
+
function validateName(name) {
|
|
18
|
+
if (name === "" || name.startsWith("/") || name.includes("\\") || /^[A-Za-z]:/.test(name)) {
|
|
19
|
+
fail(`非法路径:${name}`);
|
|
20
|
+
}
|
|
21
|
+
for (const segment of name.split("/")) {
|
|
22
|
+
if (segment === ".." || segment === ".") {
|
|
23
|
+
fail(`非法路径:${name}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function findEocd(buffer) {
|
|
28
|
+
const minimum = Math.max(0, buffer.length - 65_557);
|
|
29
|
+
for (let offset = buffer.length - 22; offset >= minimum; offset -= 1) {
|
|
30
|
+
if (buffer.readUInt32LE(offset) === EOCD_SIGNATURE) {
|
|
31
|
+
return offset;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return fail("找不到中央目录");
|
|
35
|
+
}
|
|
36
|
+
export function readZip(buffer) {
|
|
37
|
+
if (buffer.length < 22) {
|
|
38
|
+
fail("文件过短");
|
|
39
|
+
}
|
|
40
|
+
const eocd = findEocd(buffer);
|
|
41
|
+
const entries = buffer.readUInt16LE(eocd + 10);
|
|
42
|
+
const centralOffset = buffer.readUInt32LE(eocd + 16);
|
|
43
|
+
if (entries > MAX_ENTRIES) {
|
|
44
|
+
fail("文件条目过多");
|
|
45
|
+
}
|
|
46
|
+
if (centralOffset === 0xffffffff) {
|
|
47
|
+
fail("不支持 ZIP64");
|
|
48
|
+
}
|
|
49
|
+
const result = [];
|
|
50
|
+
let total = 0;
|
|
51
|
+
let offset = centralOffset;
|
|
52
|
+
for (let index = 0; index < entries; index += 1) {
|
|
53
|
+
if (offset + 46 > buffer.length || buffer.readUInt32LE(offset) !== CENTRAL_SIGNATURE) {
|
|
54
|
+
fail("中央目录损坏");
|
|
55
|
+
}
|
|
56
|
+
const flags = buffer.readUInt16LE(offset + 8);
|
|
57
|
+
const method = buffer.readUInt16LE(offset + 10);
|
|
58
|
+
const compressedSize = buffer.readUInt32LE(offset + 20);
|
|
59
|
+
const uncompressedSize = buffer.readUInt32LE(offset + 24);
|
|
60
|
+
const nameLength = buffer.readUInt16LE(offset + 28);
|
|
61
|
+
const extraLength = buffer.readUInt16LE(offset + 30);
|
|
62
|
+
const commentLength = buffer.readUInt16LE(offset + 32);
|
|
63
|
+
const externalAttributes = buffer.readUInt32LE(offset + 38);
|
|
64
|
+
const localOffset = buffer.readUInt32LE(offset + 42);
|
|
65
|
+
const name = buffer.subarray(offset + 46, offset + 46 + nameLength).toString("utf8");
|
|
66
|
+
offset += 46 + nameLength + extraLength + commentLength;
|
|
67
|
+
validateName(name);
|
|
68
|
+
if ((flags & 0x1) !== 0) {
|
|
69
|
+
fail(`不支持加密条目:${name}`);
|
|
70
|
+
}
|
|
71
|
+
if (compressedSize === 0xffffffff || uncompressedSize === 0xffffffff) {
|
|
72
|
+
fail("不支持 ZIP64 条目");
|
|
73
|
+
}
|
|
74
|
+
if (uncompressedSize > MAX_ENTRY_BYTES) {
|
|
75
|
+
fail(`单文件过大:${name}`);
|
|
76
|
+
}
|
|
77
|
+
total += uncompressedSize;
|
|
78
|
+
if (total > MAX_TOTAL_BYTES) {
|
|
79
|
+
fail("解压后总大小超限");
|
|
80
|
+
}
|
|
81
|
+
if (name.endsWith("/")) {
|
|
82
|
+
result.push({ name, data: Buffer.alloc(0) });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (((externalAttributes >>> 16) & 0o170000) === 0o120000) {
|
|
86
|
+
fail(`不支持符号链接:${name}`);
|
|
87
|
+
}
|
|
88
|
+
if (localOffset + 30 > buffer.length ||
|
|
89
|
+
buffer.readUInt32LE(localOffset) !== LOCAL_SIGNATURE) {
|
|
90
|
+
fail(`本地文件头损坏:${name}`);
|
|
91
|
+
}
|
|
92
|
+
const localNameLength = buffer.readUInt16LE(localOffset + 26);
|
|
93
|
+
const localExtraLength = buffer.readUInt16LE(localOffset + 28);
|
|
94
|
+
const dataStart = localOffset + 30 + localNameLength + localExtraLength;
|
|
95
|
+
const end = dataStart + compressedSize;
|
|
96
|
+
if (end > buffer.length) {
|
|
97
|
+
fail(`数据越界:${name}`);
|
|
98
|
+
}
|
|
99
|
+
const compressed = buffer.subarray(dataStart, end);
|
|
100
|
+
let data;
|
|
101
|
+
if (method === 0) {
|
|
102
|
+
data = Buffer.from(compressed);
|
|
103
|
+
}
|
|
104
|
+
else if (method === 8) {
|
|
105
|
+
try {
|
|
106
|
+
data = inflateRawSync(compressed);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
fail(`解压失败:${name}(${error instanceof Error ? error.message : String(error)})`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
fail(`不支持的压缩方式 ${method}:${name}`);
|
|
114
|
+
}
|
|
115
|
+
if (data.length !== uncompressedSize) {
|
|
116
|
+
fail(`解压大小不符:${name}`);
|
|
117
|
+
}
|
|
118
|
+
result.push({ name, data });
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
/** 解压到目标目录;调用方负责临时目录与清理 */
|
|
123
|
+
export async function extractZip(buffer, destination) {
|
|
124
|
+
const root = resolve(destination);
|
|
125
|
+
for (const entry of readZip(buffer)) {
|
|
126
|
+
const target = resolve(root, entry.name);
|
|
127
|
+
if (target !== root && !target.startsWith(`${root}${sep}`)) {
|
|
128
|
+
fail(`路径穿越:${entry.name}`);
|
|
129
|
+
}
|
|
130
|
+
if (entry.name.endsWith("/")) {
|
|
131
|
+
await ensureDir(target);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
await ensureDir(dirname(target));
|
|
135
|
+
await writeBytesAtomic(target, entry.data);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=zip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/plugin/zip.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,cAAc,GAAG,UAAU,CAAA;AACjC,MAAM,iBAAiB,GAAG,UAAU,CAAA;AACpC,MAAM,eAAe,GAAG,UAAU,CAAA;AAClC,MAAM,WAAW,GAAG,MAAM,CAAA;AAC1B,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AACzC,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAOzC,SAAS,IAAI,CAAC,OAAe;IACzB,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,EAAE,CAAC,CAAA;AACzC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAC9B,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxF,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IACxB,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACpC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,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CAAA;QACxC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QAC9B,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,SAAS,CAAC,MAAM,CAAC,CAAA;YACvB,SAAQ;QACZ,CAAC;QACD,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QAChC,MAAM,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9C,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedPaths } from "../platform/path.js";
|
|
2
|
+
export interface SandboxAuditEvent {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly sandboxId: string;
|
|
5
|
+
readonly pluginId?: string;
|
|
6
|
+
readonly backend?: string;
|
|
7
|
+
readonly decision?: "allowed" | "denied";
|
|
8
|
+
readonly reason?: string;
|
|
9
|
+
readonly [key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function auditSandbox(paths: ResolvedPaths, event: SandboxAuditEvent): void;
|
|
12
|
+
export declare function flushSandboxAudit(): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* sandbox 审计日志:<logDir>/sandbox-audit.log,JSONL。
|
|
3
|
+
*/
|
|
4
|
+
import { appendFile } from "node:fs/promises";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { ensureDir } from "../platform/file.js";
|
|
7
|
+
let queue = Promise.resolve();
|
|
8
|
+
export function auditSandbox(paths, event) {
|
|
9
|
+
const file = join(paths.logDir, "sandbox-audit.log");
|
|
10
|
+
queue = queue
|
|
11
|
+
.then(async () => {
|
|
12
|
+
await ensureDir(dirname(file));
|
|
13
|
+
await appendFile(file, `${JSON.stringify({ time: new Date().toISOString(), ...event })}\n`);
|
|
14
|
+
})
|
|
15
|
+
.catch(() => undefined);
|
|
16
|
+
}
|
|
17
|
+
export async function flushSandboxAudit() {
|
|
18
|
+
await queue;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/sandbox/audit.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAa/C,IAAI,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,KAAwB;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;IACpD,KAAK,GAAG,KAAK;SACR,IAAI,CAAC,KAAK,IAAI,EAAE;QACb,MAAM,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9B,MAAM,UAAU,CACZ,IAAI,EACJ,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,IAAI,CACtE,CAAA;IACL,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACnC,MAAM,KAAK,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentLaunchInput, LaunchSpec, PluginLaunchInput, SandboxBackend, SandboxBackendStatus } from "../types.js";
|
|
2
|
+
/** 沙箱内挂载 Node 运行时的目录 */
|
|
3
|
+
export declare const NODE_ROOT = "/opt/wellspring";
|
|
4
|
+
export interface NodeRuntimeLayout {
|
|
5
|
+
/** 可整体挂载的 Node 前缀(含 bin/npm 与 lib/node_modules);只有裸二进制时为 null */
|
|
6
|
+
readonly prefix: string | null;
|
|
7
|
+
/** 沙箱内的 node 路径 */
|
|
8
|
+
readonly nodePath: string;
|
|
9
|
+
/** PATH 里的目录 */
|
|
10
|
+
readonly pathEntry: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 找到当前 node 的安装前缀。
|
|
14
|
+
*
|
|
15
|
+
* 只 bind 单个 node 二进制会丢掉同目录的 npm/npx(npm 在 lib/node_modules/npm 里),
|
|
16
|
+
* 所以优先把整个前缀挂到 /opt/wellspring;找不到 npm 的发行版才退回裸二进制。
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveNodeRuntime(execPath?: string, exists?: (path: string) => boolean): NodeRuntimeLayout;
|
|
19
|
+
/** 纯函数,方便单测 */
|
|
20
|
+
export declare function buildBwrapLaunch(input: AgentLaunchInput): LaunchSpec;
|
|
21
|
+
/** 纯函数:插件 profile 的 bwrap launch spec */
|
|
22
|
+
export declare function buildBwrapPluginLaunch(input: PluginLaunchInput): LaunchSpec;
|
|
23
|
+
export declare class BwrapBackend implements SandboxBackend {
|
|
24
|
+
readonly name = "bwrap";
|
|
25
|
+
probe(): Promise<SandboxBackendStatus>;
|
|
26
|
+
buildAgentLaunch(input: AgentLaunchInput): LaunchSpec;
|
|
27
|
+
buildPluginLaunch(input: PluginLaunchInput): LaunchSpec;
|
|
28
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Linux bwrap 后端。
|
|
3
|
+
* 由 bwrap 提供 mount / PID / network namespace;Node permission model 作为第二层。
|
|
4
|
+
*/
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
8
|
+
const SYSTEM_DIRS = ["/usr", "/bin", "/sbin", "/lib", "/lib64", "/lib32"];
|
|
9
|
+
/** 沙箱内挂载 Node 运行时的目录 */
|
|
10
|
+
export const NODE_ROOT = "/opt/wellspring";
|
|
11
|
+
function existingSystemDirs() {
|
|
12
|
+
return SYSTEM_DIRS.filter((dir) => existsSync(dir));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 找到当前 node 的安装前缀。
|
|
16
|
+
*
|
|
17
|
+
* 只 bind 单个 node 二进制会丢掉同目录的 npm/npx(npm 在 lib/node_modules/npm 里),
|
|
18
|
+
* 所以优先把整个前缀挂到 /opt/wellspring;找不到 npm 的发行版才退回裸二进制。
|
|
19
|
+
*/
|
|
20
|
+
export function resolveNodeRuntime(execPath = process.execPath, exists = existsSync) {
|
|
21
|
+
const prefix = resolve(dirname(execPath), "..");
|
|
22
|
+
const hasNpm = exists(join(prefix, "bin", "npm")) ||
|
|
23
|
+
exists(join(prefix, "lib", "node_modules", "npm")) ||
|
|
24
|
+
exists(join(prefix, "share", "nodejs", "npm"));
|
|
25
|
+
if (hasNpm) {
|
|
26
|
+
return {
|
|
27
|
+
prefix,
|
|
28
|
+
nodePath: `${NODE_ROOT}/bin/node`,
|
|
29
|
+
pathEntry: `${NODE_ROOT}/bin`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
prefix: null,
|
|
34
|
+
nodePath: `${NODE_ROOT}/node`,
|
|
35
|
+
pathEntry: NODE_ROOT,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function nodeRuntimeMount(runtime, execPath) {
|
|
39
|
+
if (runtime.prefix !== null) {
|
|
40
|
+
return ["--dir", NODE_ROOT, "--ro-bind", runtime.prefix, NODE_ROOT];
|
|
41
|
+
}
|
|
42
|
+
return ["--dir", NODE_ROOT, "--ro-bind", execPath, `${NODE_ROOT}/node`];
|
|
43
|
+
}
|
|
44
|
+
function insideWorkspace(workspaceDir, cwd) {
|
|
45
|
+
const root = resolve(workspaceDir);
|
|
46
|
+
const target = resolve(cwd);
|
|
47
|
+
if (target !== root && !target.startsWith(`${root}${sep}`)) {
|
|
48
|
+
throw new Error(`cwd 不在 workspace 内:${cwd}`);
|
|
49
|
+
}
|
|
50
|
+
const rel = relative(root, target);
|
|
51
|
+
return rel === "" ? "/workspace" : `/workspace/${rel.split(sep).join("/")}`;
|
|
52
|
+
}
|
|
53
|
+
/** 纯函数,方便单测 */
|
|
54
|
+
export function buildBwrapLaunch(input) {
|
|
55
|
+
const args = [
|
|
56
|
+
"--unshare-all",
|
|
57
|
+
"--die-with-parent",
|
|
58
|
+
"--new-session",
|
|
59
|
+
"--clearenv",
|
|
60
|
+
"--cap-drop",
|
|
61
|
+
"ALL",
|
|
62
|
+
"--proc",
|
|
63
|
+
"/proc",
|
|
64
|
+
"--dev",
|
|
65
|
+
"/dev",
|
|
66
|
+
"--tmpfs",
|
|
67
|
+
"/tmp",
|
|
68
|
+
];
|
|
69
|
+
if (input.network === true) {
|
|
70
|
+
args.push("--share-net");
|
|
71
|
+
}
|
|
72
|
+
for (const dir of existingSystemDirs()) {
|
|
73
|
+
args.push("--ro-bind-try", dir, dir);
|
|
74
|
+
}
|
|
75
|
+
// DNS、CA 证书与用户解析
|
|
76
|
+
args.push("--ro-bind-try", "/etc", "/etc");
|
|
77
|
+
// systemd-resolved 的 resolv.conf 指向 /run;先建目标目录再尝试绑定
|
|
78
|
+
if (existsSync("/run/systemd/resolve")) {
|
|
79
|
+
args.push("--dir", "/run", "--dir", "/run/systemd", "--dir", "/run/systemd/resolve");
|
|
80
|
+
args.push("--ro-bind-try", "/run/systemd/resolve", "/run/systemd/resolve");
|
|
81
|
+
}
|
|
82
|
+
const nodeRuntime = resolveNodeRuntime();
|
|
83
|
+
args.push(...nodeRuntimeMount(nodeRuntime, process.execPath));
|
|
84
|
+
const workspaceBind = input.access === "workspace-write" ? "--bind" : "--ro-bind";
|
|
85
|
+
args.push(workspaceBind, resolve(input.workspaceDir), "/workspace");
|
|
86
|
+
args.push("--bind", resolve(input.scratchDir), "/scratch");
|
|
87
|
+
args.push("--chdir", insideWorkspace(input.workspaceDir, input.cwd));
|
|
88
|
+
const env = { ...input.env };
|
|
89
|
+
env["PATH"] = `${nodeRuntime.pathEntry}:${env["PATH"] ?? "/usr/bin:/bin"}`;
|
|
90
|
+
/*
|
|
91
|
+
* 不再限制 RLIMIT_AS(虚拟地址空间会直接打死 V8 / JVM / Go)。
|
|
92
|
+
* 物理内存由 SandboxManager 挂 cgroup v2 memory.max;这里只留 V8 堆上限,
|
|
93
|
+
* 且对所有命令生效,npx / npm 派生的 node 子进程也能继承。
|
|
94
|
+
*/
|
|
95
|
+
env["NODE_OPTIONS"] =
|
|
96
|
+
`${env["NODE_OPTIONS"] ?? ""} --max-old-space-size=${input.limits.memoryMB}`.trim();
|
|
97
|
+
for (const [key, value] of Object.entries(env)) {
|
|
98
|
+
args.push("--setenv", key, value);
|
|
99
|
+
}
|
|
100
|
+
args.push("--");
|
|
101
|
+
// prlimit 自身在 /usr/bin;只留文件描述符与进程数上限,超时交给 supervisor 的 wall timeout
|
|
102
|
+
const prlimitArgs = ["--nofile=256", `--nproc=${input.limits.pids}`];
|
|
103
|
+
args.push("/usr/bin/prlimit", ...prlimitArgs, "--", input.command, ...input.argv);
|
|
104
|
+
return {
|
|
105
|
+
command: "bwrap",
|
|
106
|
+
args,
|
|
107
|
+
cwd: resolve(input.workspaceDir),
|
|
108
|
+
env: { ...input.env },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** 纯函数:插件 profile 的 bwrap launch spec */
|
|
112
|
+
export function buildBwrapPluginLaunch(input) {
|
|
113
|
+
const args = [
|
|
114
|
+
"--unshare-all",
|
|
115
|
+
"--die-with-parent",
|
|
116
|
+
"--new-session",
|
|
117
|
+
"--clearenv",
|
|
118
|
+
"--cap-drop",
|
|
119
|
+
"ALL",
|
|
120
|
+
"--proc",
|
|
121
|
+
"/proc",
|
|
122
|
+
"--dev",
|
|
123
|
+
"/dev",
|
|
124
|
+
"--tmpfs",
|
|
125
|
+
"/tmp",
|
|
126
|
+
];
|
|
127
|
+
for (const dir of existingSystemDirs()) {
|
|
128
|
+
args.push("--ro-bind-try", dir, dir);
|
|
129
|
+
}
|
|
130
|
+
const nodeRuntime = resolveNodeRuntime();
|
|
131
|
+
args.push(...nodeRuntimeMount(nodeRuntime, process.execPath));
|
|
132
|
+
args.push("--ro-bind", resolve(input.pluginDir), "/plugin");
|
|
133
|
+
args.push("--ro-bind", resolve(input.hostSdkDir), "/host");
|
|
134
|
+
args.push("--chdir", "/plugin");
|
|
135
|
+
const env = { ...input.env };
|
|
136
|
+
env["PATH"] = `${nodeRuntime.pathEntry}:${env["PATH"] ?? "/usr/bin:/bin"}`;
|
|
137
|
+
env["NODE_OPTIONS"] =
|
|
138
|
+
`${env["NODE_OPTIONS"] ?? ""} --max-old-space-size=${input.limits.memoryMB}`.trim();
|
|
139
|
+
for (const [key, value] of Object.entries(env)) {
|
|
140
|
+
args.push("--setenv", key, value);
|
|
141
|
+
}
|
|
142
|
+
args.push("--");
|
|
143
|
+
args.push("/usr/bin/prlimit", "--nofile=256", `--nproc=${input.limits.pids}`, "--", nodeRuntime.nodePath, "--permission", "--allow-fs-read=/plugin", "--allow-fs-read=/host", "/host/src/sandbox/plugin-host.ts");
|
|
144
|
+
return {
|
|
145
|
+
command: "bwrap",
|
|
146
|
+
args,
|
|
147
|
+
cwd: resolve(input.pluginDir),
|
|
148
|
+
env: { ...input.env },
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export class BwrapBackend {
|
|
152
|
+
name = "bwrap";
|
|
153
|
+
async probe() {
|
|
154
|
+
if (!existsSync("/usr/bin/bwrap")) {
|
|
155
|
+
return {
|
|
156
|
+
available: false,
|
|
157
|
+
backend: this.name,
|
|
158
|
+
reason: "找不到 bwrap",
|
|
159
|
+
version: null,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const result = spawnSync("bwrap", [
|
|
163
|
+
"--unshare-all",
|
|
164
|
+
"--die-with-parent",
|
|
165
|
+
"--ro-bind",
|
|
166
|
+
"/",
|
|
167
|
+
"/",
|
|
168
|
+
"--dev",
|
|
169
|
+
"/dev",
|
|
170
|
+
"--proc",
|
|
171
|
+
"/proc",
|
|
172
|
+
"--",
|
|
173
|
+
"/bin/true",
|
|
174
|
+
], { timeout: 3_000, encoding: "utf8" });
|
|
175
|
+
if (result.status !== 0) {
|
|
176
|
+
return {
|
|
177
|
+
available: false,
|
|
178
|
+
backend: this.name,
|
|
179
|
+
reason: (result.stderr ?? "").trim() || "bwrap 无法创建 namespace",
|
|
180
|
+
version: null,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
available: true,
|
|
185
|
+
backend: this.name,
|
|
186
|
+
reason: null,
|
|
187
|
+
version: null,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
buildAgentLaunch(input) {
|
|
191
|
+
return buildBwrapLaunch(input);
|
|
192
|
+
}
|
|
193
|
+
buildPluginLaunch(input) {
|
|
194
|
+
return buildBwrapPluginLaunch(input);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=bwrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bwrap.js","sourceRoot":"","sources":["../../../src/sandbox/backends/bwrap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAUjE,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,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ACH,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,IAAI,CAAC,IAAI;gBAClB,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,IAAI;aAChB,CAAA;QACL,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CACpB,OAAO,EACP;YACI,eAAe;YACf,mBAAmB;YACnB,WAAW;YACX,GAAG;YACH,GAAG;YACH,OAAO;YACP,MAAM;YACN,QAAQ;YACR,OAAO;YACP,IAAI;YACJ,WAAW;SACd,EACD,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvC,CAAA;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO;gBACH,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,IAAI,CAAC,IAAI;gBAClB,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,sBAAsB;gBAC9D,OAAO,EAAE,IAAI;aAChB,CAAA;QACL,CAAC;QACD,OAAO;YACH,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;SAChB,CAAA;IACL,CAAC;IAED,gBAAgB,CAAC,KAAuB;QACpC,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,iBAAiB,CAAC,KAAwB;QACtC,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;CACJ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentLaunchInput, LaunchSpec, PluginLaunchInput, SandboxBackend, SandboxBackendStatus } from "../types.js";
|
|
2
|
+
export declare class DirectBackend implements SandboxBackend {
|
|
3
|
+
readonly name = "direct";
|
|
4
|
+
probe(): Promise<SandboxBackendStatus>;
|
|
5
|
+
buildAgentLaunch(input: AgentLaunchInput): LaunchSpec;
|
|
6
|
+
buildPluginLaunch(input: PluginLaunchInput): LaunchSpec;
|
|
7
|
+
}
|