lightclawbot 1.1.2 → 1.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/index.js +38 -31
- package/dist/setup-entry.js +32 -0
- package/dist/src/channel.js +301 -257
- package/dist/src/channel.setup.js +16 -0
- package/dist/src/config.js +31 -124
- package/dist/src/dedup.js +0 -1
- package/dist/src/download-tool.js +0 -1
- package/dist/src/file-storage.js +2 -2
- package/dist/src/gateway.js +226 -178
- package/dist/src/history/cron-utils.js +0 -1
- package/dist/src/history/index.js +0 -1
- package/dist/src/history/message-parser.js +0 -1
- package/dist/src/history/session-reader.js +3 -1
- package/dist/src/history/session-store.js +0 -1
- package/dist/src/history/text-processing.js +0 -1
- package/dist/src/history/types.js +0 -1
- package/dist/src/inbound.js +183 -234
- package/dist/src/media.js +0 -1
- package/dist/src/messaging.js +65 -0
- package/dist/src/outbound.js +131 -45
- package/dist/src/runtime.js +29 -11
- package/dist/src/setup-core.js +27 -0
- package/dist/src/shared.js +141 -0
- package/dist/src/socket/handlers.js +72 -49
- package/dist/src/socket/index.js +0 -1
- package/dist/src/socket/native-socket.js +385 -0
- package/dist/src/socket/registry.js +0 -1
- package/dist/src/socket/reliable-emitter.js +188 -50
- package/dist/src/streaming/delta-tracker.js +140 -0
- package/dist/src/streaming/index.js +12 -0
- package/dist/src/streaming/stream-reply-sink.js +387 -0
- package/dist/src/streaming/types.js +4 -0
- package/dist/src/tools.js +13 -0
- package/dist/src/types.js +23 -2
- package/dist/src/upload-tool.js +0 -1
- package/dist/src/utils/account.js +73 -0
- package/dist/src/utils/common.js +48 -0
- package/dist/src/utils/index.js +2 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/constants.js +1 -0
- package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/permessage-deflate.js +6 -6
- package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/websocket-server.js +10 -6
- package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/websocket.js +19 -14
- package/node_modules/{engine.io-client/node_modules/ws → ws}/package.json +4 -3
- package/node_modules/ws/wrapper.mjs +21 -0
- package/openclaw.plugin.json +0 -7
- package/package.json +8 -5
- package/dist/index.d.ts +0 -24
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/public/data/scripts/manifest.json +0 -11
- package/dist/public/data/scripts/preflight.9af62b39.sh +0 -191
- package/dist/public/data/scripts/preflight.sh +0 -191
- package/dist/src/channel.d.ts +0 -11
- package/dist/src/channel.d.ts.map +0 -1
- package/dist/src/channel.js.map +0 -1
- package/dist/src/config.d.ts +0 -129
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js.map +0 -1
- package/dist/src/dedup.d.ts +0 -12
- package/dist/src/dedup.d.ts.map +0 -1
- package/dist/src/dedup.js.map +0 -1
- package/dist/src/download-tool.d.ts +0 -32
- package/dist/src/download-tool.d.ts.map +0 -1
- package/dist/src/download-tool.js.map +0 -1
- package/dist/src/file-storage.d.ts +0 -74
- package/dist/src/file-storage.d.ts.map +0 -1
- package/dist/src/file-storage.js.map +0 -1
- package/dist/src/format-urls.d.ts +0 -26
- package/dist/src/format-urls.d.ts.map +0 -1
- package/dist/src/format-urls.js +0 -53
- package/dist/src/format-urls.js.map +0 -1
- package/dist/src/gateway.d.ts +0 -16
- package/dist/src/gateway.d.ts.map +0 -1
- package/dist/src/gateway.js.map +0 -1
- package/dist/src/history/cron-utils.d.ts +0 -76
- package/dist/src/history/cron-utils.d.ts.map +0 -1
- package/dist/src/history/cron-utils.js.map +0 -1
- package/dist/src/history/index.d.ts +0 -20
- package/dist/src/history/index.d.ts.map +0 -1
- package/dist/src/history/index.js.map +0 -1
- package/dist/src/history/message-parser.d.ts +0 -52
- package/dist/src/history/message-parser.d.ts.map +0 -1
- package/dist/src/history/message-parser.js.map +0 -1
- package/dist/src/history/session-reader.d.ts +0 -58
- package/dist/src/history/session-reader.d.ts.map +0 -1
- package/dist/src/history/session-reader.js.map +0 -1
- package/dist/src/history/session-store.d.ts +0 -42
- package/dist/src/history/session-store.d.ts.map +0 -1
- package/dist/src/history/session-store.js.map +0 -1
- package/dist/src/history/text-processing.d.ts +0 -41
- package/dist/src/history/text-processing.d.ts.map +0 -1
- package/dist/src/history/text-processing.js.map +0 -1
- package/dist/src/history/types.d.ts +0 -134
- package/dist/src/history/types.d.ts.map +0 -1
- package/dist/src/history/types.js.map +0 -1
- package/dist/src/inbound.d.ts +0 -18
- package/dist/src/inbound.d.ts.map +0 -1
- package/dist/src/inbound.js.map +0 -1
- package/dist/src/media.d.ts +0 -12
- package/dist/src/media.d.ts.map +0 -1
- package/dist/src/media.js.map +0 -1
- package/dist/src/outbound.d.ts +0 -28
- package/dist/src/outbound.d.ts.map +0 -1
- package/dist/src/outbound.js.map +0 -1
- package/dist/src/runtime.d.ts +0 -4
- package/dist/src/runtime.d.ts.map +0 -1
- package/dist/src/runtime.js.map +0 -1
- package/dist/src/socket/handlers.d.ts +0 -26
- package/dist/src/socket/handlers.d.ts.map +0 -1
- package/dist/src/socket/handlers.js.map +0 -1
- package/dist/src/socket/index.d.ts +0 -11
- package/dist/src/socket/index.d.ts.map +0 -1
- package/dist/src/socket/index.js.map +0 -1
- package/dist/src/socket/registry.d.ts +0 -59
- package/dist/src/socket/registry.d.ts.map +0 -1
- package/dist/src/socket/registry.js.map +0 -1
- package/dist/src/socket/reliable-emitter.d.ts +0 -79
- package/dist/src/socket/reliable-emitter.d.ts.map +0 -1
- package/dist/src/socket/reliable-emitter.js.map +0 -1
- package/dist/src/types.d.ts +0 -112
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js.map +0 -1
- package/dist/src/upload-tool.d.ts +0 -27
- package/dist/src/upload-tool.d.ts.map +0 -1
- package/dist/src/upload-tool.js.map +0 -1
- package/node_modules/@socket.io/component-emitter/LICENSE +0 -24
- package/node_modules/@socket.io/component-emitter/Readme.md +0 -79
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +0 -179
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +0 -176
- package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +0 -4
- package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +0 -179
- package/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -169
- package/node_modules/@socket.io/component-emitter/lib/esm/package.json +0 -4
- package/node_modules/@socket.io/component-emitter/package.json +0 -28
- package/node_modules/debug/LICENSE +0 -20
- package/node_modules/debug/README.md +0 -481
- package/node_modules/debug/package.json +0 -64
- package/node_modules/debug/src/browser.js +0 -272
- package/node_modules/debug/src/common.js +0 -292
- package/node_modules/debug/src/index.js +0 -10
- package/node_modules/debug/src/node.js +0 -263
- package/node_modules/engine.io-client/LICENSE +0 -22
- package/node_modules/engine.io-client/README.md +0 -331
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +0 -3
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +0 -4
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +0 -1
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +0 -14
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +0 -15
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +0 -38
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +0 -1
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +0 -67
- package/node_modules/engine.io-client/build/cjs/globals.d.ts +0 -4
- package/node_modules/engine.io-client/build/cjs/globals.js +0 -26
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +0 -21
- package/node_modules/engine.io-client/build/cjs/globals.node.js +0 -97
- package/node_modules/engine.io-client/build/cjs/index.d.ts +0 -15
- package/node_modules/engine.io-client/build/cjs/index.js +0 -32
- package/node_modules/engine.io-client/build/cjs/package.json +0 -10
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +0 -482
- package/node_modules/engine.io-client/build/cjs/socket.js +0 -765
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +0 -106
- package/node_modules/engine.io-client/build/cjs/transport.js +0 -153
- package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +0 -8
- package/node_modules/engine.io-client/build/cjs/transports/index.js +0 -11
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +0 -15
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +0 -60
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +0 -108
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +0 -285
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +0 -11
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +0 -44
- package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +0 -52
- package/node_modules/engine.io-client/build/cjs/transports/polling.js +0 -165
- package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +0 -36
- package/node_modules/engine.io-client/build/cjs/transports/websocket.js +0 -136
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +0 -14
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +0 -68
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +0 -18
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +0 -94
- package/node_modules/engine.io-client/build/cjs/util.d.ts +0 -7
- package/node_modules/engine.io-client/build/cjs/util.js +0 -65
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +0 -3
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +0 -2
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +0 -1
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -11
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -34
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +0 -1
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -64
- package/node_modules/engine.io-client/build/esm/globals.d.ts +0 -4
- package/node_modules/engine.io-client/build/esm/globals.js +0 -22
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +0 -21
- package/node_modules/engine.io-client/build/esm/globals.node.js +0 -91
- package/node_modules/engine.io-client/build/esm/index.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm/index.js +0 -15
- package/node_modules/engine.io-client/build/esm/package.json +0 -10
- package/node_modules/engine.io-client/build/esm/socket.d.ts +0 -482
- package/node_modules/engine.io-client/build/esm/socket.js +0 -727
- package/node_modules/engine.io-client/build/esm/transport.d.ts +0 -106
- package/node_modules/engine.io-client/build/esm/transport.js +0 -142
- package/node_modules/engine.io-client/build/esm/transports/index.d.ts +0 -8
- package/node_modules/engine.io-client/build/esm/transports/index.js +0 -8
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +0 -56
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +0 -108
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -271
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +0 -11
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -17
- package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +0 -52
- package/node_modules/engine.io-client/build/esm/transports/polling.js +0 -145
- package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +0 -36
- package/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -125
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +0 -14
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -41
- package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +0 -18
- package/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -80
- package/node_modules/engine.io-client/build/esm/util.d.ts +0 -7
- package/node_modules/engine.io-client/build/esm/util.js +0 -59
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -3
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +0 -2
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +0 -1
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +0 -11
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +0 -34
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +0 -1
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +0 -64
- package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +0 -4
- package/node_modules/engine.io-client/build/esm-debug/globals.js +0 -22
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +0 -21
- package/node_modules/engine.io-client/build/esm-debug/globals.node.js +0 -91
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm-debug/index.js +0 -15
- package/node_modules/engine.io-client/build/esm-debug/package.json +0 -10
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +0 -482
- package/node_modules/engine.io-client/build/esm-debug/socket.js +0 -756
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +0 -106
- package/node_modules/engine.io-client/build/esm-debug/transport.js +0 -145
- package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +0 -8
- package/node_modules/engine.io-client/build/esm-debug/transports/index.js +0 -8
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +0 -15
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +0 -56
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +0 -108
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +0 -276
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +0 -11
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +0 -17
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +0 -52
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +0 -158
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +0 -36
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +0 -128
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +0 -14
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +0 -41
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +0 -18
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +0 -87
- package/node_modules/engine.io-client/build/esm-debug/util.d.ts +0 -7
- package/node_modules/engine.io-client/build/esm-debug/util.js +0 -59
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +0 -7
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +0 -1
- package/node_modules/engine.io-client/dist/engine.io.js +0 -3064
- package/node_modules/engine.io-client/dist/engine.io.js.map +0 -1
- package/node_modules/engine.io-client/dist/engine.io.min.js +0 -7
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +0 -1
- package/node_modules/engine.io-client/node_modules/ws/index.js +0 -13
- package/node_modules/engine.io-client/node_modules/ws/wrapper.mjs +0 -8
- package/node_modules/engine.io-client/package.json +0 -95
- package/node_modules/engine.io-parser/LICENSE +0 -22
- package/node_modules/engine.io-parser/Readme.md +0 -158
- package/node_modules/engine.io-parser/build/cjs/commons.d.ts +0 -14
- package/node_modules/engine.io-parser/build/cjs/commons.js +0 -19
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +0 -2
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +0 -48
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +0 -2
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +0 -66
- package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +0 -2
- package/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -59
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +0 -4
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +0 -72
- package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +0 -3
- package/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -38
- package/node_modules/engine.io-parser/build/cjs/index.d.ts +0 -9
- package/node_modules/engine.io-parser/build/cjs/index.js +0 -164
- package/node_modules/engine.io-parser/build/cjs/package.json +0 -8
- package/node_modules/engine.io-parser/build/esm/commons.d.ts +0 -14
- package/node_modules/engine.io-parser/build/esm/commons.js +0 -14
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +0 -2
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +0 -43
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +0 -2
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +0 -62
- package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +0 -2
- package/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -55
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +0 -4
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +0 -68
- package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +0 -3
- package/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -33
- package/node_modules/engine.io-parser/build/esm/index.d.ts +0 -9
- package/node_modules/engine.io-parser/build/esm/index.js +0 -156
- package/node_modules/engine.io-parser/build/esm/package.json +0 -8
- package/node_modules/engine.io-parser/package.json +0 -46
- package/node_modules/ms/index.js +0 -162
- package/node_modules/ms/license.md +0 -21
- package/node_modules/ms/package.json +0 -38
- package/node_modules/ms/readme.md +0 -59
- package/node_modules/socket.io-client/LICENSE +0 -21
- package/node_modules/socket.io-client/README.md +0 -29
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +0 -2
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +0 -4
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +0 -12
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +0 -69
- package/node_modules/socket.io-client/build/cjs/index.d.ts +0 -29
- package/node_modules/socket.io-client/build/cjs/index.js +0 -76
- package/node_modules/socket.io-client/build/cjs/manager.d.ts +0 -295
- package/node_modules/socket.io-client/build/cjs/manager.js +0 -416
- package/node_modules/socket.io-client/build/cjs/on.d.ts +0 -2
- package/node_modules/socket.io-client/build/cjs/on.js +0 -9
- package/node_modules/socket.io-client/build/cjs/socket.d.ts +0 -593
- package/node_modules/socket.io-client/build/cjs/socket.js +0 -909
- package/node_modules/socket.io-client/build/cjs/url.d.ts +0 -33
- package/node_modules/socket.io-client/build/cjs/url.js +0 -69
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +0 -2
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +0 -2
- package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +0 -12
- package/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -66
- package/node_modules/socket.io-client/build/esm/index.d.ts +0 -29
- package/node_modules/socket.io-client/build/esm/index.js +0 -58
- package/node_modules/socket.io-client/build/esm/manager.d.ts +0 -295
- package/node_modules/socket.io-client/build/esm/manager.js +0 -367
- package/node_modules/socket.io-client/build/esm/on.d.ts +0 -2
- package/node_modules/socket.io-client/build/esm/on.js +0 -6
- package/node_modules/socket.io-client/build/esm/package.json +0 -5
- package/node_modules/socket.io-client/build/esm/socket.d.ts +0 -593
- package/node_modules/socket.io-client/build/esm/socket.js +0 -880
- package/node_modules/socket.io-client/build/esm/url.d.ts +0 -33
- package/node_modules/socket.io-client/build/esm/url.js +0 -59
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -2
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +0 -2
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +0 -12
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +0 -66
- package/node_modules/socket.io-client/build/esm-debug/index.d.ts +0 -29
- package/node_modules/socket.io-client/build/esm-debug/index.js +0 -62
- package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +0 -295
- package/node_modules/socket.io-client/build/esm-debug/manager.js +0 -386
- package/node_modules/socket.io-client/build/esm-debug/on.d.ts +0 -2
- package/node_modules/socket.io-client/build/esm-debug/on.js +0 -6
- package/node_modules/socket.io-client/build/esm-debug/package.json +0 -5
- package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +0 -593
- package/node_modules/socket.io-client/build/esm-debug/socket.js +0 -902
- package/node_modules/socket.io-client/build/esm-debug/url.d.ts +0 -33
- package/node_modules/socket.io-client/build/esm-debug/url.js +0 -63
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js +0 -7
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +0 -1
- package/node_modules/socket.io-client/dist/socket.io.js +0 -4955
- package/node_modules/socket.io-client/dist/socket.io.js.map +0 -1
- package/node_modules/socket.io-client/dist/socket.io.min.js +0 -7
- package/node_modules/socket.io-client/dist/socket.io.min.js.map +0 -1
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +0 -7
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +0 -1
- package/node_modules/socket.io-client/package.json +0 -101
- package/node_modules/socket.io-parser/LICENSE +0 -20
- package/node_modules/socket.io-parser/Readme.md +0 -81
- package/node_modules/socket.io-parser/build/cjs/binary.d.ts +0 -20
- package/node_modules/socket.io-parser/build/cjs/binary.js +0 -87
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +0 -101
- package/node_modules/socket.io-parser/build/cjs/index.js +0 -367
- package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +0 -7
- package/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -54
- package/node_modules/socket.io-parser/build/cjs/package.json +0 -3
- package/node_modules/socket.io-parser/build/esm/binary.d.ts +0 -20
- package/node_modules/socket.io-parser/build/esm/binary.js +0 -83
- package/node_modules/socket.io-parser/build/esm/index.d.ts +0 -101
- package/node_modules/socket.io-parser/build/esm/index.js +0 -356
- package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +0 -7
- package/node_modules/socket.io-parser/build/esm/is-binary.js +0 -50
- package/node_modules/socket.io-parser/build/esm/package.json +0 -3
- package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +0 -20
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +0 -83
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +0 -101
- package/node_modules/socket.io-parser/build/esm-debug/index.js +0 -361
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +0 -7
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +0 -50
- package/node_modules/socket.io-parser/build/esm-debug/package.json +0 -3
- package/node_modules/socket.io-parser/package.json +0 -44
- package/node_modules/xmlhttprequest-ssl/LICENSE +0 -22
- package/node_modules/xmlhttprequest-ssl/README.md +0 -67
- package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -689
- package/node_modules/xmlhttprequest-ssl/package.json +0 -40
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/LICENSE +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/README.md +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/browser.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/buffer-util.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/event-target.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/extension.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/limiter.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/receiver.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/sender.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/stream.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/subprotocol.js +0 -0
- /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/validation.js +0 -0
|
@@ -11,7 +11,7 @@ const extension = require('./extension');
|
|
|
11
11
|
const PerMessageDeflate = require('./permessage-deflate');
|
|
12
12
|
const subprotocol = require('./subprotocol');
|
|
13
13
|
const WebSocket = require('./websocket');
|
|
14
|
-
const { GUID, kWebSocket } = require('./constants');
|
|
14
|
+
const { CLOSE_TIMEOUT, GUID, kWebSocket } = require('./constants');
|
|
15
15
|
|
|
16
16
|
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
17
17
|
|
|
@@ -38,6 +38,9 @@ class WebSocketServer extends EventEmitter {
|
|
|
38
38
|
* pending connections
|
|
39
39
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
40
40
|
* track clients
|
|
41
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
42
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
43
|
+
* called
|
|
41
44
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
42
45
|
* @param {String} [options.host] The hostname where to bind the server
|
|
43
46
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
@@ -67,6 +70,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
67
70
|
perMessageDeflate: false,
|
|
68
71
|
handleProtocols: null,
|
|
69
72
|
clientTracking: true,
|
|
73
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
70
74
|
verifyClient: null,
|
|
71
75
|
noServer: false,
|
|
72
76
|
backlog: null, // use default (511 as implemented in net.js)
|
|
@@ -289,11 +293,11 @@ class WebSocketServer extends EventEmitter {
|
|
|
289
293
|
this.options.perMessageDeflate &&
|
|
290
294
|
secWebSocketExtensions !== undefined
|
|
291
295
|
) {
|
|
292
|
-
const perMessageDeflate = new PerMessageDeflate(
|
|
293
|
-
this.options.perMessageDeflate,
|
|
294
|
-
true,
|
|
295
|
-
this.options.maxPayload
|
|
296
|
-
);
|
|
296
|
+
const perMessageDeflate = new PerMessageDeflate({
|
|
297
|
+
...this.options.perMessageDeflate,
|
|
298
|
+
isServer: true,
|
|
299
|
+
maxPayload: this.options.maxPayload
|
|
300
|
+
});
|
|
297
301
|
|
|
298
302
|
try {
|
|
299
303
|
const offers = extension.parse(secWebSocketExtensions);
|
|
@@ -18,6 +18,7 @@ const { isBlob } = require('./validation');
|
|
|
18
18
|
|
|
19
19
|
const {
|
|
20
20
|
BINARY_TYPES,
|
|
21
|
+
CLOSE_TIMEOUT,
|
|
21
22
|
EMPTY_BUFFER,
|
|
22
23
|
GUID,
|
|
23
24
|
kForOnEventAttribute,
|
|
@@ -32,7 +33,6 @@ const {
|
|
|
32
33
|
const { format, parse } = require('./extension');
|
|
33
34
|
const { toBuffer } = require('./buffer-util');
|
|
34
35
|
|
|
35
|
-
const closeTimeout = 30 * 1000;
|
|
36
36
|
const kAborted = Symbol('kAborted');
|
|
37
37
|
const protocolVersions = [8, 13];
|
|
38
38
|
const readyStates = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED'];
|
|
@@ -88,6 +88,7 @@ class WebSocket extends EventEmitter {
|
|
|
88
88
|
initAsClient(this, address, protocols, options);
|
|
89
89
|
} else {
|
|
90
90
|
this._autoPong = options.autoPong;
|
|
91
|
+
this._closeTimeout = options.closeTimeout;
|
|
91
92
|
this._isServer = true;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
@@ -629,6 +630,8 @@ module.exports = WebSocket;
|
|
|
629
630
|
* times in the same tick
|
|
630
631
|
* @param {Boolean} [options.autoPong=true] Specifies whether or not to
|
|
631
632
|
* automatically send a pong in response to a ping
|
|
633
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
|
|
634
|
+
* for the closing handshake to finish after `websocket.close()` is called
|
|
632
635
|
* @param {Function} [options.finishRequest] A function which can be used to
|
|
633
636
|
* customize the headers of each http request before it is sent
|
|
634
637
|
* @param {Boolean} [options.followRedirects=false] Whether or not to follow
|
|
@@ -655,6 +658,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
655
658
|
const opts = {
|
|
656
659
|
allowSynchronousEvents: true,
|
|
657
660
|
autoPong: true,
|
|
661
|
+
closeTimeout: CLOSE_TIMEOUT,
|
|
658
662
|
protocolVersion: protocolVersions[1],
|
|
659
663
|
maxPayload: 100 * 1024 * 1024,
|
|
660
664
|
skipUTF8Validation: false,
|
|
@@ -673,6 +677,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
673
677
|
};
|
|
674
678
|
|
|
675
679
|
websocket._autoPong = opts.autoPong;
|
|
680
|
+
websocket._closeTimeout = opts.closeTimeout;
|
|
676
681
|
|
|
677
682
|
if (!protocolVersions.includes(opts.protocolVersion)) {
|
|
678
683
|
throw new RangeError(
|
|
@@ -688,7 +693,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
688
693
|
} else {
|
|
689
694
|
try {
|
|
690
695
|
parsedUrl = new URL(address);
|
|
691
|
-
} catch
|
|
696
|
+
} catch {
|
|
692
697
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
693
698
|
}
|
|
694
699
|
}
|
|
@@ -750,11 +755,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
750
755
|
opts.timeout = opts.handshakeTimeout;
|
|
751
756
|
|
|
752
757
|
if (opts.perMessageDeflate) {
|
|
753
|
-
perMessageDeflate = new PerMessageDeflate(
|
|
754
|
-
opts.perMessageDeflate
|
|
755
|
-
false,
|
|
756
|
-
opts.maxPayload
|
|
757
|
-
);
|
|
758
|
+
perMessageDeflate = new PerMessageDeflate({
|
|
759
|
+
...opts.perMessageDeflate,
|
|
760
|
+
isServer: false,
|
|
761
|
+
maxPayload: opts.maxPayload
|
|
762
|
+
});
|
|
758
763
|
opts.headers['Sec-WebSocket-Extensions'] = format({
|
|
759
764
|
[PerMessageDeflate.extensionName]: perMessageDeflate.offer()
|
|
760
765
|
});
|
|
@@ -1290,7 +1295,7 @@ function senderOnError(err) {
|
|
|
1290
1295
|
function setCloseTimer(websocket) {
|
|
1291
1296
|
websocket._closeTimer = setTimeout(
|
|
1292
1297
|
websocket._socket.destroy.bind(websocket._socket),
|
|
1293
|
-
|
|
1298
|
+
websocket._closeTimeout
|
|
1294
1299
|
);
|
|
1295
1300
|
}
|
|
1296
1301
|
|
|
@@ -1308,23 +1313,23 @@ function socketOnClose() {
|
|
|
1308
1313
|
|
|
1309
1314
|
websocket._readyState = WebSocket.CLOSING;
|
|
1310
1315
|
|
|
1311
|
-
let chunk;
|
|
1312
|
-
|
|
1313
1316
|
//
|
|
1314
1317
|
// The close frame might not have been received or the `'end'` event emitted,
|
|
1315
1318
|
// for example, if the socket was destroyed due to an error. Ensure that the
|
|
1316
1319
|
// `receiver` stream is closed after writing any remaining buffered data to
|
|
1317
1320
|
// it. If the readable side of the socket is in flowing mode then there is no
|
|
1318
|
-
// buffered data as everything has been already written
|
|
1319
|
-
//
|
|
1320
|
-
//
|
|
1321
|
+
// buffered data as everything has been already written. If instead, the
|
|
1322
|
+
// socket is paused, any possible buffered data will be read as a single
|
|
1323
|
+
// chunk.
|
|
1321
1324
|
//
|
|
1322
1325
|
if (
|
|
1323
1326
|
!this._readableState.endEmitted &&
|
|
1324
1327
|
!websocket._closeFrameReceived &&
|
|
1325
1328
|
!websocket._receiver._writableState.errorEmitted &&
|
|
1326
|
-
|
|
1329
|
+
this._readableState.length !== 0
|
|
1327
1330
|
) {
|
|
1331
|
+
const chunk = this.read(this._readableState.length);
|
|
1332
|
+
|
|
1328
1333
|
websocket._receiver.write(chunk);
|
|
1329
1334
|
}
|
|
1330
1335
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ws",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.20.0",
|
|
4
4
|
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"HyBi",
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
+
"@eslint/js": "^10.0.1",
|
|
58
59
|
"benchmark": "^2.1.4",
|
|
59
60
|
"bufferutil": "^4.0.1",
|
|
60
|
-
"eslint": "^
|
|
61
|
+
"eslint": "^10.0.1",
|
|
61
62
|
"eslint-config-prettier": "^10.0.1",
|
|
62
63
|
"eslint-plugin-prettier": "^5.0.0",
|
|
63
|
-
"globals": "^
|
|
64
|
+
"globals": "^17.0.0",
|
|
64
65
|
"mocha": "^8.4.0",
|
|
65
66
|
"nyc": "^15.0.0",
|
|
66
67
|
"prettier": "^3.0.0",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import createWebSocketStream from './lib/stream.js';
|
|
2
|
+
import extension from './lib/extension.js';
|
|
3
|
+
import PerMessageDeflate from './lib/permessage-deflate.js';
|
|
4
|
+
import Receiver from './lib/receiver.js';
|
|
5
|
+
import Sender from './lib/sender.js';
|
|
6
|
+
import subprotocol from './lib/subprotocol.js';
|
|
7
|
+
import WebSocket from './lib/websocket.js';
|
|
8
|
+
import WebSocketServer from './lib/websocket-server.js';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
createWebSocketStream,
|
|
12
|
+
extension,
|
|
13
|
+
PerMessageDeflate,
|
|
14
|
+
Receiver,
|
|
15
|
+
Sender,
|
|
16
|
+
subprotocol,
|
|
17
|
+
WebSocket,
|
|
18
|
+
WebSocketServer
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default WebSocket;
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "lightclawbot",
|
|
3
|
-
"name": "LightClawBot Channel",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"description": "LightClawBot channel plugin with message support, cron jobs, and proactive messaging",
|
|
6
3
|
"channels": ["lightclawbot"],
|
|
7
4
|
"skills": ["./skills"],
|
|
8
|
-
"capabilities": {
|
|
9
|
-
"proactiveMessaging": true,
|
|
10
|
-
"cronJobs": true
|
|
11
|
-
},
|
|
12
5
|
"configSchema": {
|
|
13
6
|
"type": "object",
|
|
14
7
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightclawbot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.0",
|
|
4
4
|
"description": "LightClawBot channel plugin with message support, cron jobs, and proactive messaging",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -8,10 +8,12 @@
|
|
|
8
8
|
"openclaw.plugin.json",
|
|
9
9
|
"skills"
|
|
10
10
|
],
|
|
11
|
+
"socketType": "ws",
|
|
11
12
|
"openclaw": {
|
|
12
13
|
"extensions": [
|
|
13
14
|
"./dist/index.js"
|
|
14
15
|
],
|
|
16
|
+
"setupEntry": "./dist/setup-entry.js",
|
|
15
17
|
"channel": {
|
|
16
18
|
"id": "lightclawbot",
|
|
17
19
|
"label": "LightClawBot",
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
"scripts": {
|
|
29
|
-
"build": "tsc",
|
|
31
|
+
"build": "rm -rf dist && tsc",
|
|
30
32
|
"typecheck": "tsc --noEmit",
|
|
31
33
|
"prepublishOnly": "npm run build",
|
|
32
34
|
"deploy": "node scripts/deploy.cjs"
|
|
@@ -39,18 +41,19 @@
|
|
|
39
41
|
"lightclaw",
|
|
40
42
|
"lightclawbot",
|
|
41
43
|
"websocket",
|
|
42
|
-
"
|
|
44
|
+
"ws"
|
|
43
45
|
],
|
|
44
46
|
"dependencies": {
|
|
45
|
-
"
|
|
47
|
+
"ws": "^8.18.0"
|
|
46
48
|
},
|
|
47
49
|
"bundledDependencies": [
|
|
48
|
-
"
|
|
50
|
+
"ws"
|
|
49
51
|
],
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"openclaw": ">=2026.3.22"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
56
|
+
"@types/ws": "^8.18.1",
|
|
54
57
|
"openclaw": "*",
|
|
55
58
|
"typescript": "^5.7.0"
|
|
56
59
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
-
declare const plugin: {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
configSchema: import("openclaw/plugin-sdk/core").OpenClawPluginConfigSchema;
|
|
7
|
-
register(api: OpenClawPluginApi): void;
|
|
8
|
-
};
|
|
9
|
-
export default plugin;
|
|
10
|
-
export { myAssistantPlugin } from "./src/channel.js";
|
|
11
|
-
export { setAssistantRuntime, getAssistantRuntime } from "./src/runtime.js";
|
|
12
|
-
export * from "./src/types.js";
|
|
13
|
-
export * from "./src/config.js";
|
|
14
|
-
export * from "./src/gateway.js";
|
|
15
|
-
export * from "./src/dedup.js";
|
|
16
|
-
export * from "./src/media.js";
|
|
17
|
-
export * from "./src/inbound.js";
|
|
18
|
-
export * from "./src/socket/index.js";
|
|
19
|
-
export * from "./src/outbound.js";
|
|
20
|
-
export * from "./src/history/index.js";
|
|
21
|
-
export * from "./src/file-storage.js";
|
|
22
|
-
export * from "./src/upload-tool.js";
|
|
23
|
-
export * from "./src/download-tool.js";
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAQlE,QAAA,MAAM,MAAM;;;;;kBAKI,iBAAiB;CAQhC,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,iEAAiE;AAEjE,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,iCAAiC;IAC9C,YAAY,EAAE,uBAAuB,EAAE;IACvC,QAAQ,CAAC,GAAsB;QAC7B,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjC,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;QAEnD,uDAAuD;QACvD,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACxB,6BAA6B;IAC/B,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# ========== lightclawbot 插件前置检查脚本 ==========
|
|
4
|
-
# 用途:快速判断 lightclawbot 插件是否可用
|
|
5
|
-
# 特点:
|
|
6
|
-
# 1. 减少文件 I/O 次数(一次读取配置文件,复用解析结果)
|
|
7
|
-
# 2. 与 OpenClaw 源码逻辑保持一致(plugins.enabled/deny/allow/entries)
|
|
8
|
-
# 3. 支持传参指定插件 ID
|
|
9
|
-
#
|
|
10
|
-
# 输出:最后一行固定为 RESULT:{...} JSON,供前端解析
|
|
11
|
-
# - 可用: RESULT:{"status":"ok","version":"x.y.z"}
|
|
12
|
-
# - 缺 openclaw:RESULT:{"status":"need_openclaw","reason":"...","desc":"..."}
|
|
13
|
-
# - 需要安装/配置:RESULT:{"status":"need_install","reason":"...","desc":"..."}
|
|
14
|
-
# - reason: 固定错误码(前端用于判断分支)
|
|
15
|
-
# - desc: 检测命令的实际输出(可选,用于排查问题)
|
|
16
|
-
#
|
|
17
|
-
# 使用方式:
|
|
18
|
-
# 本地执行: bash preflight.sh [plugin_id]
|
|
19
|
-
# CDN 执行: bash <(curl -fsSL https://your-cdn.com/preflight.sh) [plugin_id]
|
|
20
|
-
# 默认检查: lightclawbot
|
|
21
|
-
|
|
22
|
-
# ---------- 配置 ----------
|
|
23
|
-
id="${1:-lightclawbot}" # 支持传参指定插件 ID
|
|
24
|
-
cfg="$HOME/.openclaw/openclaw.json"
|
|
25
|
-
plugin_dir="$HOME/.openclaw/extensions/${id}"
|
|
26
|
-
|
|
27
|
-
# ---------- 加载 nvm 环境 ----------
|
|
28
|
-
# bash xxx.sh 启动的是非交互式 shell,不会自动 source ~/.bashrc,
|
|
29
|
-
# 如果用户通过 nvm 安装 node,脚本中的 node / openclaw 命令都找不到。
|
|
30
|
-
# 提前加载 nvm,让后续所有步骤都能使用 nvm 管理的 node。
|
|
31
|
-
export NVM_DIR="$HOME/.nvm"
|
|
32
|
-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
33
|
-
|
|
34
|
-
# ---------- 工具函数 ----------
|
|
35
|
-
result_exit() {
|
|
36
|
-
local status="$1"
|
|
37
|
-
local reason="$2"
|
|
38
|
-
local desc="${3:-}"
|
|
39
|
-
local exit_code="${4:-1}"
|
|
40
|
-
# 转义 desc 中的特殊字符,保证输出合法 JSON
|
|
41
|
-
desc="${desc//\\/\\\\}"
|
|
42
|
-
desc="${desc//\"/\\\"}"
|
|
43
|
-
desc="${desc//$'\n'/\\n}"
|
|
44
|
-
desc="${desc//$'\r'/}"
|
|
45
|
-
if [ -n "$desc" ]; then
|
|
46
|
-
echo "RESULT:{\"status\":\"${status}\",\"reason\":\"${reason}\",\"desc\":\"${desc}\"}"
|
|
47
|
-
else
|
|
48
|
-
echo "RESULT:{\"status\":\"${status}\",\"reason\":\"${reason}\"}"
|
|
49
|
-
fi
|
|
50
|
-
exit "$exit_code"
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
result_ok() {
|
|
54
|
-
echo "RESULT:{\"status\":\"ok\",\"version\":\"${1}\"}"
|
|
55
|
-
exit 0
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# ---------- 1. 检查配置文件是否存在 ----------
|
|
59
|
-
|
|
60
|
-
if [ ! -f "$cfg" ]; then
|
|
61
|
-
result_exit "error" "config_not_found" "$(ls "$cfg" 2>&1)"
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
# ---------- 2. 验证配置文件 JSON 格式 ----------
|
|
65
|
-
# openclaw 通过即 node 可用,用 node 做一次轻量校验
|
|
66
|
-
|
|
67
|
-
json_check_output=$(node -e "JSON.parse(require('fs').readFileSync(process.argv[1],'utf8'))" "$cfg" 2>&1)
|
|
68
|
-
if [ $? -ne 0 ]; then
|
|
69
|
-
result_exit "error" "config_json_invalid" "$json_check_output"
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# ---------- 3. 检查 openclaw 是否可用 ----------
|
|
73
|
-
|
|
74
|
-
if ! command -v openclaw &>/dev/null; then
|
|
75
|
-
oc_which_output=$(which openclaw 2>&1) || true
|
|
76
|
-
result_exit "error" "openclaw_not_available" "${oc_which_output:-openclaw not found in PATH=${PATH}}"
|
|
77
|
-
fi
|
|
78
|
-
|
|
79
|
-
# ---------- 3a. 检查 openclaw 版本是否满足最低要求 ----------
|
|
80
|
-
|
|
81
|
-
min_version="2026.2.3"
|
|
82
|
-
# 兼容多种输出格式:
|
|
83
|
-
# "OpenClaw 2026.3.24 (cff6dc9)" → 2026.3.24
|
|
84
|
-
# "2026.2.3" → 2026.2.3
|
|
85
|
-
oc_version_output=$(openclaw -v 2>&1)
|
|
86
|
-
current_version=$(echo "$oc_version_output" | head -1 | sed 's/[()]//g' | grep -oE '[0-9]{4}\.[0-9]+\.[0-9]+' | head -1)
|
|
87
|
-
|
|
88
|
-
if [ -z "$current_version" ]; then
|
|
89
|
-
result_exit "error" "openclaw_version_unknown" "$oc_version_output"
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
# 比较版本号:将 a.b.c 转为数值后逐段比较
|
|
93
|
-
version_lt() {
|
|
94
|
-
local IFS='.'
|
|
95
|
-
local i a=($1) b=($2)
|
|
96
|
-
for ((i = 0; i < 3; i++)); do
|
|
97
|
-
if (( ${a[i]:-0} < ${b[i]:-0} )); then return 0; fi
|
|
98
|
-
if (( ${a[i]:-0} > ${b[i]:-0} )); then return 1; fi
|
|
99
|
-
done
|
|
100
|
-
return 1 # 相等时不算小于
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if version_lt "$current_version" "$min_version"; then
|
|
104
|
-
result_exit "error" "openclaw_version_too_old" "current: ${current_version}, required: >=${min_version}"
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
# ---------- 3b. 检查 Gateway 是否可用 ----------
|
|
108
|
-
|
|
109
|
-
gateway_output=$(openclaw gateway health --json 2>&1)
|
|
110
|
-
if [ $? -ne 0 ]; then
|
|
111
|
-
result_exit "need_install" "gateway_not_healthy" "$gateway_output"
|
|
112
|
-
fi
|
|
113
|
-
|
|
114
|
-
# ---------- 4. 检查插件目录是否已安装 ----------
|
|
115
|
-
|
|
116
|
-
if [ ! -d "$plugin_dir" ] || [ ! -f "$plugin_dir/package.json" ]; then
|
|
117
|
-
result_exit "need_install" "plugin_not_installed" "$(ls -la "$plugin_dir/package.json" 2>&1)"
|
|
118
|
-
fi
|
|
119
|
-
|
|
120
|
-
# ---------- 5. 单次 node 调用完成所有配置项检查 ----------
|
|
121
|
-
# 一次启动 V8,顺序执行全部校验
|
|
122
|
-
# 通过环境变量安全传参,避免 shell 注入风险
|
|
123
|
-
# 输出格式:RESULT:{...} 与 bash 工具函数保持一致
|
|
124
|
-
|
|
125
|
-
PREFLIGHT_CFG="$cfg" PREFLIGHT_ID="$id" PREFLIGHT_PLUGIN_DIR="$plugin_dir" \
|
|
126
|
-
node -e '
|
|
127
|
-
const fs = require("fs");
|
|
128
|
-
const cfgPath = process.env.PREFLIGHT_CFG;
|
|
129
|
-
const pluginId = process.env.PREFLIGHT_ID;
|
|
130
|
-
const pluginDir = process.env.PREFLIGHT_PLUGIN_DIR;
|
|
131
|
-
|
|
132
|
-
function fail(status, reason, desc) {
|
|
133
|
-
const obj = { status, reason };
|
|
134
|
-
if (desc !== undefined) obj.desc = String(desc);
|
|
135
|
-
console.log("RESULT:" + JSON.stringify(obj));
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const cfg = JSON.parse(fs.readFileSync(cfgPath, "utf8"));
|
|
140
|
-
|
|
141
|
-
// 5a. 全局插件系统检查(plugins.enabled 默认 true,仅显式 false 禁用)
|
|
142
|
-
if (cfg.plugins?.enabled === false) {
|
|
143
|
-
fail("need_install", "plugins_globally_disabled", "plugins.enabled = " + JSON.stringify(cfg.plugins?.enabled));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 5b. deny 黑名单(优先级高于 allow,与 OpenClaw 源码一致)
|
|
147
|
-
if (Array.isArray(cfg.plugins?.deny) && cfg.plugins.deny.includes(pluginId)) {
|
|
148
|
-
fail("need_install", "plugin_in_denylist", "plugins.deny = " + JSON.stringify(cfg.plugins.deny));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 5c. plugins.entries 启用状态
|
|
152
|
-
if (cfg.plugins?.entries?.[pluginId]?.enabled !== true) {
|
|
153
|
-
fail("need_install", "plugin_not_enabled", "plugins.entries." + pluginId + ".enabled = " + JSON.stringify(cfg.plugins?.entries?.[pluginId]?.enabled));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// 5d. allow 白名单(非空时必须在列表中)
|
|
157
|
-
const allow = cfg.plugins?.allow;
|
|
158
|
-
if (Array.isArray(allow) && allow.length > 0 && !allow.includes(pluginId)) {
|
|
159
|
-
fail("need_install", "plugin_not_in_allowlist", "plugins.allow = " + JSON.stringify(allow));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 5e. plugins.installs 安装记录(可选,仅警告,默认不阻塞)
|
|
163
|
-
// 如需严格检查,取消下面的注释:
|
|
164
|
-
// if (!cfg.plugins?.installs?.[pluginId]) {
|
|
165
|
-
// fail("need_install", "plugin_install_record_missing", "plugins.installs." + pluginId + " = " + JSON.stringify(cfg.plugins?.installs?.[pluginId]));
|
|
166
|
-
// }
|
|
167
|
-
|
|
168
|
-
// 5f. channels 启用状态
|
|
169
|
-
if (cfg.channels?.[pluginId]?.enabled !== true) {
|
|
170
|
-
fail("need_install", "channel_not_enabled", "channels." + pluginId + ".enabled = " + JSON.stringify(cfg.channels?.[pluginId]?.enabled));
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// 5g. channels apiKeys 配置
|
|
174
|
-
const apiKeys = cfg.channels?.[pluginId]?.apiKeys;
|
|
175
|
-
if (!Array.isArray(apiKeys) || apiKeys.length === 0) {
|
|
176
|
-
fail("need_install", "apikeys_empty", "channels." + pluginId + ".apiKeys = " + JSON.stringify(apiKeys));
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// 5h. 读取插件版本
|
|
180
|
-
let version = "unknown";
|
|
181
|
-
try {
|
|
182
|
-
const pkg = JSON.parse(fs.readFileSync(pluginDir + "/package.json", "utf8"));
|
|
183
|
-
version = pkg.version || "unknown";
|
|
184
|
-
} catch (e) {}
|
|
185
|
-
|
|
186
|
-
// 全部通过
|
|
187
|
-
console.log("RESULT:" + JSON.stringify({ status: "ok", version }));
|
|
188
|
-
'
|
|
189
|
-
|
|
190
|
-
# 将 node 的退出码传递给 bash
|
|
191
|
-
exit $?
|