lightclawbot 1.0.0 → 1.0.2
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 +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/src/channel.d.ts +11 -0
- package/dist/src/channel.d.ts.map +1 -0
- package/dist/src/channel.js +255 -0
- package/dist/src/channel.js.map +1 -0
- package/dist/src/config.d.ts +86 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +188 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/dedup.d.ts +7 -0
- package/dist/src/dedup.d.ts.map +1 -0
- package/dist/src/dedup.js +51 -0
- package/dist/src/dedup.js.map +1 -0
- package/dist/src/download-tool.d.ts +32 -0
- package/dist/src/download-tool.d.ts.map +1 -0
- package/dist/src/download-tool.js +147 -0
- package/dist/src/download-tool.js.map +1 -0
- package/dist/src/file-storage.d.ts +74 -0
- package/dist/src/file-storage.d.ts.map +1 -0
- package/dist/src/file-storage.js +161 -0
- package/dist/src/file-storage.js.map +1 -0
- package/dist/src/gateway.d.ts +16 -0
- package/dist/src/gateway.d.ts.map +1 -0
- package/dist/src/gateway.js +252 -0
- package/dist/src/gateway.js.map +1 -0
- package/dist/src/history/cron-utils.d.ts +76 -0
- package/dist/src/history/cron-utils.d.ts.map +1 -0
- package/dist/src/history/cron-utils.js +291 -0
- package/dist/src/history/cron-utils.js.map +1 -0
- package/dist/src/history/index.d.ts +20 -0
- package/dist/src/history/index.d.ts.map +1 -0
- package/dist/src/history/index.js +24 -0
- package/dist/src/history/index.js.map +1 -0
- package/dist/src/history/message-parser.d.ts +52 -0
- package/dist/src/history/message-parser.d.ts.map +1 -0
- package/dist/src/history/message-parser.js +243 -0
- package/dist/src/history/message-parser.js.map +1 -0
- package/dist/src/history/session-reader.d.ts +58 -0
- package/dist/src/history/session-reader.d.ts.map +1 -0
- package/dist/src/history/session-reader.js +287 -0
- package/dist/src/history/session-reader.js.map +1 -0
- package/dist/src/history/session-store.d.ts +38 -0
- package/dist/src/history/session-store.d.ts.map +1 -0
- package/dist/src/history/session-store.js +131 -0
- package/dist/src/history/session-store.js.map +1 -0
- package/dist/src/history/text-processing.d.ts +41 -0
- package/dist/src/history/text-processing.d.ts.map +1 -0
- package/dist/src/history/text-processing.js +130 -0
- package/dist/src/history/text-processing.js.map +1 -0
- package/dist/src/history/types.d.ts +134 -0
- package/dist/src/history/types.d.ts.map +1 -0
- package/dist/src/history/types.js +7 -0
- package/dist/src/history/types.js.map +1 -0
- package/dist/src/inbound.d.ts +18 -0
- package/dist/src/inbound.d.ts.map +1 -0
- package/dist/src/inbound.js +332 -0
- package/dist/src/inbound.js.map +1 -0
- package/dist/src/media.d.ts +12 -0
- package/dist/src/media.d.ts.map +1 -0
- package/dist/src/media.js +87 -0
- package/dist/src/media.js.map +1 -0
- package/dist/src/outbound.d.ts +28 -0
- package/dist/src/outbound.d.ts.map +1 -0
- package/dist/src/outbound.js +172 -0
- package/dist/src/outbound.js.map +1 -0
- package/dist/src/runtime.d.ts +4 -0
- package/dist/src/runtime.d.ts.map +1 -0
- package/dist/src/runtime.js +11 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/session-history.d.ts +88 -0
- package/dist/src/session-history.d.ts.map +1 -0
- package/dist/src/session-history.js +598 -0
- package/dist/src/session-history.js.map +1 -0
- package/dist/src/socket-handlers.d.ts +21 -0
- package/dist/src/socket-handlers.d.ts.map +1 -0
- package/dist/src/socket-handlers.js +121 -0
- package/dist/src/socket-handlers.js.map +1 -0
- package/dist/src/socket-registry.d.ts +53 -0
- package/dist/src/socket-registry.d.ts.map +1 -0
- package/dist/src/socket-registry.js +111 -0
- package/dist/src/socket-registry.js.map +1 -0
- package/dist/src/types.d.ts +102 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +10 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/upload-tool.d.ts +27 -0
- package/dist/src/upload-tool.d.ts.map +1 -0
- package/dist/src/upload-tool.js +148 -0
- package/dist/src/upload-tool.js.map +1 -0
- package/node_modules/@socket.io/component-emitter/LICENSE +24 -0
- package/node_modules/@socket.io/component-emitter/Readme.md +79 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +176 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.js +169 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/package.json +28 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/engine.io-client/LICENSE +22 -0
- package/node_modules/engine.io-client/README.md +331 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +14 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +38 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +67 -0
- package/node_modules/engine.io-client/build/cjs/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/cjs/globals.js +26 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.js +97 -0
- package/node_modules/engine.io-client/build/cjs/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/index.js +32 -0
- package/node_modules/engine.io-client/build/cjs/package.json +10 -0
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/cjs/socket.js +765 -0
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/cjs/transport.js +153 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.js +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +60 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +285 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +44 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.js +165 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.js +136 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +68 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +94 -0
- package/node_modules/engine.io-client/build/cjs/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/cjs/util.js +65 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/index.js +15 -0
- package/node_modules/engine.io-client/build/esm/package.json +10 -0
- package/node_modules/engine.io-client/build/esm/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm/socket.js +727 -0
- package/node_modules/engine.io-client/build/esm/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm/transport.js +142 -0
- package/node_modules/engine.io-client/build/esm/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +271 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.js +145 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.js +125 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.js +80 -0
- package/node_modules/engine.io-client/build/esm/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm/util.js +59 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/index.js +15 -0
- package/node_modules/engine.io-client/build/esm-debug/package.json +10 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.js +756 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.js +145 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +276 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +158 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +128 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +87 -0
- package/node_modules/engine.io-client/build/esm-debug/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm-debug/util.js +59 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.js +3064 -0
- package/node_modules/engine.io-client/dist/engine.io.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -0
- package/node_modules/engine.io-client/node_modules/ws/LICENSE +20 -0
- package/node_modules/engine.io-client/node_modules/ws/README.md +548 -0
- package/node_modules/engine.io-client/node_modules/ws/browser.js +8 -0
- package/node_modules/engine.io-client/node_modules/ws/index.js +13 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/constants.js +18 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +550 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +1388 -0
- package/node_modules/engine.io-client/node_modules/ws/package.json +69 -0
- package/node_modules/engine.io-client/node_modules/ws/wrapper.mjs +8 -0
- package/node_modules/engine.io-client/package.json +95 -0
- package/node_modules/engine.io-parser/LICENSE +22 -0
- package/node_modules/engine.io-parser/Readme.md +158 -0
- package/node_modules/engine.io-parser/build/cjs/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/cjs/commons.js +19 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +48 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +66 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.js +59 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +72 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.js +38 -0
- package/node_modules/engine.io-parser/build/cjs/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/cjs/index.js +164 -0
- package/node_modules/engine.io-parser/build/cjs/package.json +8 -0
- package/node_modules/engine.io-parser/build/esm/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/esm/commons.js +14 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +43 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +62 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.js +55 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +68 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.js +33 -0
- package/node_modules/engine.io-parser/build/esm/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/esm/index.js +156 -0
- package/node_modules/engine.io-parser/build/esm/package.json +8 -0
- package/node_modules/engine.io-parser/package.json +46 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/socket.io-client/LICENSE +21 -0
- package/node_modules/socket.io-client/README.md +29 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +69 -0
- package/node_modules/socket.io-client/build/cjs/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/cjs/index.js +76 -0
- package/node_modules/socket.io-client/build/cjs/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/cjs/manager.js +416 -0
- package/node_modules/socket.io-client/build/cjs/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/on.js +9 -0
- package/node_modules/socket.io-client/build/cjs/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/cjs/socket.js +909 -0
- package/node_modules/socket.io-client/build/cjs/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/cjs/url.js +69 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm/index.js +58 -0
- package/node_modules/socket.io-client/build/esm/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm/manager.js +367 -0
- package/node_modules/socket.io-client/build/esm/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/on.js +6 -0
- package/node_modules/socket.io-client/build/esm/package.json +5 -0
- package/node_modules/socket.io-client/build/esm/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm/socket.js +880 -0
- package/node_modules/socket.io-client/build/esm/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm/url.js +59 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm-debug/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm-debug/index.js +62 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.js +386 -0
- package/node_modules/socket.io-client/build/esm-debug/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/on.js +6 -0
- package/node_modules/socket.io-client/build/esm-debug/package.json +5 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.js +902 -0
- package/node_modules/socket.io-client/build/esm-debug/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm-debug/url.js +63 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.js +4955 -0
- package/node_modules/socket.io-client/dist/socket.io.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +1 -0
- package/node_modules/socket.io-client/package.json +101 -0
- package/node_modules/socket.io-parser/LICENSE +20 -0
- package/node_modules/socket.io-parser/Readme.md +81 -0
- package/node_modules/socket.io-parser/build/cjs/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/cjs/binary.js +87 -0
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/cjs/index.js +359 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.js +54 -0
- package/node_modules/socket.io-parser/build/cjs/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm/index.js +348 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.js +353 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm-debug/package.json +3 -0
- package/node_modules/socket.io-parser/package.json +44 -0
- package/node_modules/xmlhttprequest-ssl/LICENSE +22 -0
- package/node_modules/xmlhttprequest-ssl/README.md +67 -0
- package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +689 -0
- package/node_modules/xmlhttprequest-ssl/package.json +40 -0
- package/openclaw.plugin.json +17 -0
- package/package.json +43 -23
- package/skills/lightclaw-cron/SKILL.md +381 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAUtD;AASD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAWjE;AAQD,wBAAgB,aAAa,IAAI,MAAM,CAKtC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — 消息去重 & 节流 & ID 生成
|
|
3
|
+
*/
|
|
4
|
+
import { DEDUP_TTL, DEDUP_MAX_SIZE, HISTORY_THROTTLE_MS, HISTORY_THROTTLE_MAX_SIZE, } from "./config.js";
|
|
5
|
+
// ============================================================
|
|
6
|
+
// 消息去重
|
|
7
|
+
// ============================================================
|
|
8
|
+
const recentMessageIds = new Map();
|
|
9
|
+
export function isDuplicate(messageId) {
|
|
10
|
+
const now = Date.now();
|
|
11
|
+
if (recentMessageIds.size > DEDUP_MAX_SIZE) {
|
|
12
|
+
for (const [id, ts] of recentMessageIds) {
|
|
13
|
+
if (now - ts > DEDUP_TTL)
|
|
14
|
+
recentMessageIds.delete(id);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (recentMessageIds.has(messageId))
|
|
18
|
+
return true;
|
|
19
|
+
recentMessageIds.set(messageId, now);
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// ============================================================
|
|
23
|
+
// History 请求节流(per-user,防止短时间内重复拉取)
|
|
24
|
+
// ============================================================
|
|
25
|
+
/** userId → 上次处理 history 请求的时间戳 */
|
|
26
|
+
const historyRequestThrottle = new Map();
|
|
27
|
+
export function isHistoryRequestThrottled(userId) {
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
const last = historyRequestThrottle.get(userId);
|
|
30
|
+
if (last && now - last < HISTORY_THROTTLE_MS)
|
|
31
|
+
return true;
|
|
32
|
+
historyRequestThrottle.set(userId, now);
|
|
33
|
+
if (historyRequestThrottle.size > HISTORY_THROTTLE_MAX_SIZE) {
|
|
34
|
+
for (const [id, ts] of historyRequestThrottle) {
|
|
35
|
+
if (now - ts > HISTORY_THROTTLE_MS * 5)
|
|
36
|
+
historyRequestThrottle.delete(id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// ============================================================
|
|
42
|
+
// 生成消息 ID
|
|
43
|
+
// ============================================================
|
|
44
|
+
let msgCounter = 0;
|
|
45
|
+
export function generateMsgId() {
|
|
46
|
+
const ts = Date.now().toString(36);
|
|
47
|
+
const rand = Math.random().toString(36).substring(2, 8);
|
|
48
|
+
const seq = (msgCounter++).toString(36);
|
|
49
|
+
return `${ts}-${rand}-${seq}`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.js","sourceRoot":"","sources":["../../src/dedup.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM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BAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,IAAI,UAAU,GAAG,CAAC,CAAC;AAEnB,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,OAAO,GAAG,EAAE,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — 文件下载工具
|
|
3
|
+
*
|
|
4
|
+
* 注册为 OpenClaw Agent Tool,允许 AI:
|
|
5
|
+
* 1. 获取之前上传文件的公网下载链接
|
|
6
|
+
* 2. 将 COS 上的文件下载到本地工作目录
|
|
7
|
+
*
|
|
8
|
+
* 工具名: lightclaw_get_file_url
|
|
9
|
+
*/
|
|
10
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
11
|
+
export declare const DOWNLOAD_TOOL_NAME = "lightclaw_get_file_url";
|
|
12
|
+
export declare const downloadToolSchema: {
|
|
13
|
+
type: "object";
|
|
14
|
+
properties: {
|
|
15
|
+
action: {
|
|
16
|
+
type: "string";
|
|
17
|
+
enum: string[];
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
filePath: {
|
|
21
|
+
type: "string";
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
localDir: {
|
|
25
|
+
type: "string";
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: readonly ["action", "filePath"];
|
|
30
|
+
};
|
|
31
|
+
export declare function registerDownloadTool(api: OpenClawPluginApi): void;
|
|
32
|
+
//# sourceMappingURL=download-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-tool.d.ts","sourceRoot":"","sources":["../../src/download-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,qBAAqB,CAAC;AAc3E,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAE3D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;CA0B9B,CAAC;AAmBF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI,CA2GjE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — 文件下载工具
|
|
3
|
+
*
|
|
4
|
+
* 注册为 OpenClaw Agent Tool,允许 AI:
|
|
5
|
+
* 1. 获取之前上传文件的公网下载链接
|
|
6
|
+
* 2. 将 COS 上的文件下载到本地工作目录
|
|
7
|
+
*
|
|
8
|
+
* 工具名: lightclaw_get_file_url
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { getFileDownloadUrl, downloadFileFromCos, uploadFileToCos, } from "./file-storage.js";
|
|
13
|
+
import { formatFileSize } from "./media.js";
|
|
14
|
+
import { resolveAccount } from "./config.js";
|
|
15
|
+
// ============================================================
|
|
16
|
+
// 工具参数 schema
|
|
17
|
+
// ============================================================
|
|
18
|
+
export const DOWNLOAD_TOOL_NAME = "lightclaw_get_file_url";
|
|
19
|
+
export const downloadToolSchema = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
action: {
|
|
23
|
+
type: "string",
|
|
24
|
+
enum: ["get_url", "download_to_local", "upload_and_get_url"],
|
|
25
|
+
description: "Action to perform: " +
|
|
26
|
+
"'get_url' — get the public download URL for a previously uploaded file (by COS filePath); " +
|
|
27
|
+
"'download_to_local' — download a file from COS to local directory; " +
|
|
28
|
+
"'upload_and_get_url' — upload a local file and return its public download URL.",
|
|
29
|
+
},
|
|
30
|
+
filePath: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "For 'get_url' and 'download_to_local': the COS file path (e.g. '2026-03-06/report.pdf'). " +
|
|
33
|
+
"For 'upload_and_get_url': the local file path to upload.",
|
|
34
|
+
},
|
|
35
|
+
localDir: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "For 'download_to_local' only: the local directory to save the downloaded file. " +
|
|
38
|
+
"Defaults to the current working directory if not specified.",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
required: ["action", "filePath"],
|
|
42
|
+
};
|
|
43
|
+
// ============================================================
|
|
44
|
+
// 辅助:从 api.config 动态解析出 FileStorageConfig
|
|
45
|
+
// ============================================================
|
|
46
|
+
function resolveStorageConfig(api, defaultAccountId) {
|
|
47
|
+
if (!api.config)
|
|
48
|
+
return {};
|
|
49
|
+
const account = resolveAccount(api.config, defaultAccountId);
|
|
50
|
+
return { apiKey: account.apiKey };
|
|
51
|
+
}
|
|
52
|
+
// ============================================================
|
|
53
|
+
// 工具注册(飞书工厂函数模式)
|
|
54
|
+
// ============================================================
|
|
55
|
+
export function registerDownloadTool(api) {
|
|
56
|
+
api.registerTool((ctx) => {
|
|
57
|
+
const defaultAccountId = ctx.agentAccountId;
|
|
58
|
+
return {
|
|
59
|
+
name: DOWNLOAD_TOOL_NAME,
|
|
60
|
+
description: "Manage files on Tencent COS cloud storage. " +
|
|
61
|
+
"Actions: " +
|
|
62
|
+
"(1) 'get_url' — get a public download URL for a file already uploaded to COS (by its COS filePath); " +
|
|
63
|
+
"(2) 'download_to_local' — download a COS file back to the local filesystem for further processing; " +
|
|
64
|
+
"(3) 'upload_and_get_url' — upload a single local file to COS and return its public download URL. " +
|
|
65
|
+
"Note: For batch uploading files to share with users, prefer lightclaw_upload_file instead.",
|
|
66
|
+
parameters: downloadToolSchema,
|
|
67
|
+
async execute(_toolCallId, params) {
|
|
68
|
+
// 每次 execute 时动态解析 apiKey
|
|
69
|
+
const storageConfig = resolveStorageConfig(api, defaultAccountId);
|
|
70
|
+
const { action, filePath, localDir } = params;
|
|
71
|
+
if (!filePath || typeof filePath !== "string") {
|
|
72
|
+
return {
|
|
73
|
+
content: [{ type: "text", text: "Error: filePath is required." }],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
switch (action) {
|
|
78
|
+
case "get_url": {
|
|
79
|
+
const url = getFileDownloadUrl(filePath);
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text: `Download URL: ${url}` }],
|
|
82
|
+
details: { action, filePath, url },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
case "download_to_local": {
|
|
86
|
+
const result = await downloadFileFromCos(filePath, storageConfig);
|
|
87
|
+
const targetDir = localDir || process.cwd();
|
|
88
|
+
// 确保目录存在
|
|
89
|
+
if (!fs.existsSync(targetDir)) {
|
|
90
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
91
|
+
}
|
|
92
|
+
const targetPath = path.join(targetDir, result.fileName);
|
|
93
|
+
fs.writeFileSync(targetPath, result.buffer);
|
|
94
|
+
return {
|
|
95
|
+
content: [{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: `File downloaded to: ${targetPath} (${formatFileSize(result.buffer.length)}, ${result.contentType})`,
|
|
98
|
+
}],
|
|
99
|
+
details: {
|
|
100
|
+
action,
|
|
101
|
+
filePath,
|
|
102
|
+
localPath: targetPath,
|
|
103
|
+
size: result.buffer.length,
|
|
104
|
+
contentType: result.contentType,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
case "upload_and_get_url": {
|
|
109
|
+
if (!fs.existsSync(filePath)) {
|
|
110
|
+
return {
|
|
111
|
+
content: [{ type: "text", text: `Error: local file not found: ${filePath}` }],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const uploadResult = await uploadFileToCos(filePath, storageConfig);
|
|
115
|
+
return {
|
|
116
|
+
content: [{
|
|
117
|
+
type: "text",
|
|
118
|
+
text: `File uploaded. Download URL: ${uploadResult.url}`,
|
|
119
|
+
}],
|
|
120
|
+
details: {
|
|
121
|
+
action,
|
|
122
|
+
localPath: filePath,
|
|
123
|
+
cosFilePath: uploadResult.filePath,
|
|
124
|
+
url: uploadResult.url,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
default:
|
|
129
|
+
return {
|
|
130
|
+
content: [{
|
|
131
|
+
type: "text",
|
|
132
|
+
text: `Error: unknown action '${action}'. Use 'get_url', 'download_to_local', or 'upload_and_get_url'.`,
|
|
133
|
+
}],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: "text", text: `Error: ${errMsg}` }],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}, { name: DOWNLOAD_TOOL_NAME });
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=download-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download-tool.js","sourceRoot":"","sources":["../../src/download-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,GAEhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE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M,iEAAiE;qCACxG,CAAC;6BACH,CAAC;oBACN,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAChE,OAAO;wBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;qBACtD,CAAC;gBACJ,CAAC;YACH,CAAC;SACyB,CAAC;IAC/B,CAAC,EACD,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — 文件存储服务
|
|
3
|
+
*
|
|
4
|
+
* 通过远程 AI-Server 的 cosmanager 接口实现文件的上传和下载,
|
|
5
|
+
* 使得 openclaw 工作目录下的本地文件可以通过公网 URL 访问。
|
|
6
|
+
*
|
|
7
|
+
* 上传接口:POST https://lightai.tencentcloud.com/cosmanager/uploadFile
|
|
8
|
+
* 下载接口:GET https://lightai.tencentcloud.com/cosmanager/getFileStream?filePath=xxx
|
|
9
|
+
*/
|
|
10
|
+
export interface FileStorageConfig {
|
|
11
|
+
/** 认证 API Key(可选,用于服务端鉴权) */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface UploadResult {
|
|
15
|
+
/** 文件的公网可访问 URL */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** COS 上存储的文件路径 */
|
|
18
|
+
filePath?: string;
|
|
19
|
+
/** 是否上传成功 */
|
|
20
|
+
isUploaded: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface DownloadResult {
|
|
23
|
+
/** 文件内容 Buffer */
|
|
24
|
+
buffer: Buffer;
|
|
25
|
+
/** 文件名 */
|
|
26
|
+
fileName: string;
|
|
27
|
+
/** MIME 类型 */
|
|
28
|
+
contentType: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 上传本地文件到 COS
|
|
32
|
+
*
|
|
33
|
+
* @param localPath - 本地文件的绝对路径
|
|
34
|
+
* @param config - 文件存储配置
|
|
35
|
+
* @param customFileName - 自定义文件名(可选,默认使用原文件名)
|
|
36
|
+
* @returns 上传结果,包含公网 URL
|
|
37
|
+
*/
|
|
38
|
+
export declare function uploadFileToCos(localPath: string, config?: FileStorageConfig, customFileName?: string): Promise<UploadResult>;
|
|
39
|
+
/**
|
|
40
|
+
* 上传 Buffer 数据到 COS
|
|
41
|
+
*
|
|
42
|
+
* @param buffer - 文件内容
|
|
43
|
+
* @param fileName - 文件名
|
|
44
|
+
* @param mimeType - MIME 类型
|
|
45
|
+
* @param config - 文件存储配置
|
|
46
|
+
* @returns 上传结果,包含公网 URL
|
|
47
|
+
*/
|
|
48
|
+
export declare function uploadBufferToCos(buffer: Buffer, fileName: string, mimeType: string, config?: FileStorageConfig): Promise<UploadResult>;
|
|
49
|
+
/**
|
|
50
|
+
* 获取文件的公网下载 URL
|
|
51
|
+
*
|
|
52
|
+
* @param filePath - COS 上的文件路径(如 "2026-03-06/report.pdf")
|
|
53
|
+
* @param config - 文件存储配置
|
|
54
|
+
* @returns 公网下载 URL
|
|
55
|
+
*/
|
|
56
|
+
export declare function getFileDownloadUrl(filePath: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* 从 COS 下载文件内容
|
|
59
|
+
*
|
|
60
|
+
* @param filePath - COS 上的文件路径
|
|
61
|
+
* @param config - 文件存储配置
|
|
62
|
+
* @returns 下载结果,包含 Buffer 和文件信息
|
|
63
|
+
*/
|
|
64
|
+
export declare function downloadFileFromCos(filePath: string, config?: FileStorageConfig): Promise<DownloadResult>;
|
|
65
|
+
/**
|
|
66
|
+
* 上传本地文件并返回公网下载 URL
|
|
67
|
+
* 这是一个便捷方法,组合了上传 + 获取 URL
|
|
68
|
+
*
|
|
69
|
+
* @param localPath - 本地文件路径
|
|
70
|
+
* @param config - 文件存储配置
|
|
71
|
+
* @returns 公网可访问的下载 URL
|
|
72
|
+
*/
|
|
73
|
+
export declare function uploadAndGetPublicUrl(localPath: string, config?: FileStorageConfig): Promise<string>;
|
|
74
|
+
//# sourceMappingURL=file-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../src/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa;IACb,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,iBAAsB,EAC9B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,YAAY,CAAC,CAwDvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,YAAY,CAAC,CAuCvB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,cAAc,CAAC,CAwBzB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — 文件存储服务
|
|
3
|
+
*
|
|
4
|
+
* 通过远程 AI-Server 的 cosmanager 接口实现文件的上传和下载,
|
|
5
|
+
* 使得 openclaw 工作目录下的本地文件可以通过公网 URL 访问。
|
|
6
|
+
*
|
|
7
|
+
* 上传接口:POST https://lightai.tencentcloud.com/cosmanager/uploadFile
|
|
8
|
+
* 下载接口:GET https://lightai.tencentcloud.com/cosmanager/getFileStream?filePath=xxx
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from "node:fs";
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { guessMimeByExt } from "./media.js";
|
|
13
|
+
import { COS_BASE_URL, API_PATH_UPLOAD, API_PATH_DOWNLOAD, UPLOAD_TIMEOUT, buildAuthHeaders, } from "./config.js";
|
|
14
|
+
// ============================================================
|
|
15
|
+
// 核心方法
|
|
16
|
+
// ============================================================
|
|
17
|
+
/**
|
|
18
|
+
* 上传本地文件到 COS
|
|
19
|
+
*
|
|
20
|
+
* @param localPath - 本地文件的绝对路径
|
|
21
|
+
* @param config - 文件存储配置
|
|
22
|
+
* @param customFileName - 自定义文件名(可选,默认使用原文件名)
|
|
23
|
+
* @returns 上传结果,包含公网 URL
|
|
24
|
+
*/
|
|
25
|
+
export async function uploadFileToCos(localPath, config = {}, customFileName) {
|
|
26
|
+
// 验证文件存在
|
|
27
|
+
if (!fs.existsSync(localPath)) {
|
|
28
|
+
throw new Error(`File not found: ${localPath}`);
|
|
29
|
+
}
|
|
30
|
+
const stat = fs.statSync(localPath);
|
|
31
|
+
if (!stat.isFile()) {
|
|
32
|
+
throw new Error(`Not a regular file: ${localPath}`);
|
|
33
|
+
}
|
|
34
|
+
const fileName = customFileName || path.basename(localPath);
|
|
35
|
+
const fileBuffer = fs.readFileSync(localPath);
|
|
36
|
+
const ext = path.extname(fileName).toLowerCase();
|
|
37
|
+
const mimeType = guessMimeByExt(ext);
|
|
38
|
+
// 构建日期目录路径
|
|
39
|
+
const datePart = new Date().toISOString().split("T")[0];
|
|
40
|
+
const filePath = `${datePart}/${fileName}`;
|
|
41
|
+
// 使用 fetch + FormData 上传
|
|
42
|
+
const { Blob: NodeBlob } = await import("node:buffer");
|
|
43
|
+
const blob = new NodeBlob([fileBuffer], { type: mimeType });
|
|
44
|
+
const formData = new FormData();
|
|
45
|
+
formData.append("file", blob, fileName);
|
|
46
|
+
formData.append("filePath", filePath);
|
|
47
|
+
const headers = buildAuthHeaders(config.apiKey ?? "");
|
|
48
|
+
const controller = new AbortController();
|
|
49
|
+
const timeoutId = setTimeout(() => controller.abort(), UPLOAD_TIMEOUT);
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetch(`${COS_BASE_URL}${API_PATH_UPLOAD}`, {
|
|
52
|
+
method: "POST",
|
|
53
|
+
body: formData,
|
|
54
|
+
headers,
|
|
55
|
+
signal: controller.signal,
|
|
56
|
+
});
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
const text = await response.text().catch(() => "");
|
|
59
|
+
throw new Error(`Upload failed (HTTP ${response.status}): ${text}`);
|
|
60
|
+
}
|
|
61
|
+
const result = (await response.json());
|
|
62
|
+
if (result.code === 0 && result.data?.uploaded) {
|
|
63
|
+
return { url: `${COS_BASE_URL}/cosmanager/getFileStream?filePath=${filePath}`, filePath, isUploaded: true };
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`Upload failed (HTTP ${response.status}): ${result.data}`);
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
clearTimeout(timeoutId);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 上传 Buffer 数据到 COS
|
|
73
|
+
*
|
|
74
|
+
* @param buffer - 文件内容
|
|
75
|
+
* @param fileName - 文件名
|
|
76
|
+
* @param mimeType - MIME 类型
|
|
77
|
+
* @param config - 文件存储配置
|
|
78
|
+
* @returns 上传结果,包含公网 URL
|
|
79
|
+
*/
|
|
80
|
+
export async function uploadBufferToCos(buffer, fileName, mimeType, config = {}) {
|
|
81
|
+
const datePart = new Date().toISOString().split("T")[0];
|
|
82
|
+
const filePath = `${datePart}/${fileName}`;
|
|
83
|
+
const { Blob: NodeBlob } = await import("node:buffer");
|
|
84
|
+
const blob = new NodeBlob([new Uint8Array(buffer)], { type: mimeType });
|
|
85
|
+
const formData = new FormData();
|
|
86
|
+
formData.append("file", blob, fileName);
|
|
87
|
+
formData.append("filePath", filePath);
|
|
88
|
+
const headers = buildAuthHeaders(config.apiKey ?? "");
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
const timeoutId = setTimeout(() => controller.abort(), UPLOAD_TIMEOUT);
|
|
91
|
+
try {
|
|
92
|
+
const response = await fetch(`${COS_BASE_URL}${API_PATH_UPLOAD}`, {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: formData,
|
|
95
|
+
headers,
|
|
96
|
+
signal: controller.signal,
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
const text = await response.text().catch(() => "");
|
|
100
|
+
throw new Error(`Upload failed (HTTP ${response.status}): ${text}`);
|
|
101
|
+
}
|
|
102
|
+
const result = (await response.json());
|
|
103
|
+
if (result.code === 0 && result.data?.uploaded) {
|
|
104
|
+
return { url: `${COS_BASE_URL}/cosmanager/getFileStream?filePath=${filePath}`, filePath, isUploaded: true };
|
|
105
|
+
}
|
|
106
|
+
throw new Error(`Upload failed (HTTP ${response.status}): ${result.data}`);
|
|
107
|
+
}
|
|
108
|
+
finally {
|
|
109
|
+
clearTimeout(timeoutId);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 获取文件的公网下载 URL
|
|
114
|
+
*
|
|
115
|
+
* @param filePath - COS 上的文件路径(如 "2026-03-06/report.pdf")
|
|
116
|
+
* @param config - 文件存储配置
|
|
117
|
+
* @returns 公网下载 URL
|
|
118
|
+
*/
|
|
119
|
+
export function getFileDownloadUrl(filePath) {
|
|
120
|
+
return `${COS_BASE_URL}${API_PATH_DOWNLOAD}?filePath=${encodeURIComponent(filePath)}`;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 从 COS 下载文件内容
|
|
124
|
+
*
|
|
125
|
+
* @param filePath - COS 上的文件路径
|
|
126
|
+
* @param config - 文件存储配置
|
|
127
|
+
* @returns 下载结果,包含 Buffer 和文件信息
|
|
128
|
+
*/
|
|
129
|
+
export async function downloadFileFromCos(filePath, config = {}) {
|
|
130
|
+
const url = filePath.startsWith("http") ? filePath : `${COS_BASE_URL}${API_PATH_DOWNLOAD}?filePath=${encodeURIComponent(filePath)}`;
|
|
131
|
+
const headers = buildAuthHeaders(config.apiKey ?? "");
|
|
132
|
+
const controller = new AbortController();
|
|
133
|
+
const timeoutId = setTimeout(() => controller.abort(), UPLOAD_TIMEOUT);
|
|
134
|
+
try {
|
|
135
|
+
const response = await fetch(url, { headers, signal: controller.signal });
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
const text = await response.text().catch(() => "");
|
|
138
|
+
throw new Error(`Download failed (HTTP ${response.status}): ${text}`);
|
|
139
|
+
}
|
|
140
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
141
|
+
const contentType = response.headers.get("content-type") || "application/octet-stream";
|
|
142
|
+
const fileName = filePath.split("/").pop() || "file";
|
|
143
|
+
return { buffer, fileName, contentType };
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
clearTimeout(timeoutId);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 上传本地文件并返回公网下载 URL
|
|
151
|
+
* 这是一个便捷方法,组合了上传 + 获取 URL
|
|
152
|
+
*
|
|
153
|
+
* @param localPath - 本地文件路径
|
|
154
|
+
* @param config - 文件存储配置
|
|
155
|
+
* @returns 公网可访问的下载 URL
|
|
156
|
+
*/
|
|
157
|
+
export async function uploadAndGetPublicUrl(localPath, config = {}) {
|
|
158
|
+
const result = await uploadFileToCos(localPath, config);
|
|
159
|
+
return result.url || '';
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=file-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-storage.js","sourceRoot":"","sources":["../../src/file-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AA6BrB,+DAA+D;AAC/D,OAAO;AACP,+DAA+D;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,SAAiB,EACjB,SAA4B,EAAE,EAC9B,cAAuB;IAEvB,SAAS;IACT,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,mBAAmB,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CA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AAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QACzD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,0BAA0B,CAAC;QACvF,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC;QAErD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAAiB,EACjB,SAA4B,EAAE;IAE9B,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LightClaw — Socket.IO Gateway
|
|
3
|
+
*
|
|
4
|
+
* 连接编排层:
|
|
5
|
+
* 1. 管理 Socket.IO 连接生命周期(连接/断开/重连/防重入)
|
|
6
|
+
* 2. 维护消息队列,串行处理入站消息
|
|
7
|
+
* 3. 提供 socket emit 抽象供子模块使用
|
|
8
|
+
*
|
|
9
|
+
* 消息处理逻辑 → inbound.ts
|
|
10
|
+
* 事件监听绑定 → socket-handlers.ts
|
|
11
|
+
* 去重/节流/ID → dedup.ts
|
|
12
|
+
* 媒体文件处理 → media.ts
|
|
13
|
+
*/
|
|
14
|
+
import type { GatewayContext } from "./types.js";
|
|
15
|
+
export declare function startGateway(ctx: GatewayContext): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,YAAY,CAAC;AAuFpB,wBAAsB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4NrE"}
|