@silicaclaw/cli 2026.3.19-9 → 2026.3.20-10
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/CHANGELOG.md +182 -0
- package/DEMO_GUIDE.md +1 -1
- package/INSTALL.md +53 -13
- package/README.md +106 -23
- package/VERSION +1 -1
- package/apps/local-console/dist/apps/local-console/src/server.d.ts +180 -14
- package/apps/local-console/dist/apps/local-console/src/server.js +1499 -267
- package/apps/local-console/dist/config/silicaclaw-defaults.json +19 -0
- package/apps/local-console/dist/packages/core/src/index.d.ts +2 -0
- package/apps/local-console/dist/packages/core/src/index.js +2 -0
- package/apps/local-console/dist/packages/core/src/privateCrypto.d.ts +17 -0
- package/apps/local-console/dist/packages/core/src/privateCrypto.js +40 -0
- package/apps/local-console/dist/packages/core/src/privateMessage.d.ts +23 -0
- package/apps/local-console/dist/packages/core/src/privateMessage.js +74 -0
- package/apps/local-console/dist/packages/core/src/profile.js +2 -0
- package/apps/local-console/dist/packages/core/src/publicProfileSummary.d.ts +4 -0
- package/apps/local-console/dist/packages/core/src/publicProfileSummary.js +3 -0
- package/apps/local-console/dist/packages/core/src/socialConfig.js +9 -5
- package/apps/local-console/dist/packages/core/src/types.d.ts +40 -0
- package/apps/local-console/dist/packages/network/src/realPreview.js +6 -2
- package/apps/local-console/dist/packages/network/src/relayPreview.d.ts +12 -0
- package/apps/local-console/dist/packages/network/src/relayPreview.js +116 -10
- package/apps/local-console/dist/packages/network/src/transport/udpLanBroadcastTransport.js +2 -1
- package/apps/local-console/dist/packages/network/src/types.d.ts +4 -0
- package/apps/local-console/dist/packages/network/src/webrtcPreview.js +5 -1
- package/apps/local-console/dist/packages/storage/config/silicaclaw-defaults.json +19 -0
- package/apps/local-console/dist/packages/storage/src/repos.d.ts +13 -1
- package/apps/local-console/dist/packages/storage/src/repos.js +19 -1
- package/apps/local-console/dist/packages/storage/src/socialRuntimeRepo.js +8 -4
- package/apps/local-console/public/app/app.js +486 -12
- package/apps/local-console/public/app/events.js +61 -2
- package/apps/local-console/public/app/network.js +176 -35
- package/apps/local-console/public/app/overview.js +75 -53
- package/apps/local-console/public/app/shell.js +18 -34
- package/apps/local-console/public/app/social.js +495 -93
- package/apps/local-console/public/app/styles.css +309 -15
- package/apps/local-console/public/app/template.js +182 -51
- package/apps/local-console/public/app/translations.js +476 -266
- package/apps/local-console/src/server.ts +1669 -271
- package/apps/public-explorer/dist/apps/public-explorer/src/server.d.ts +1 -0
- package/apps/public-explorer/dist/apps/public-explorer/src/server.js +41 -0
- package/apps/public-explorer/dist/config/silicaclaw-defaults.json +19 -0
- package/apps/public-explorer/public/app/app.js +22 -2
- package/apps/public-explorer/public/app/template.js +4 -4
- package/apps/public-explorer/public/app/translations.js +29 -29
- package/apps/public-explorer/src/server.ts +11 -1
- package/config/silicaclaw-defaults.json +19 -0
- package/dist/apps/local-console/src/server.d.ts +1 -0
- package/dist/apps/local-console/src/server.js +555 -0
- package/docs/NEW_USER_INSTALL.md +14 -10
- package/docs/NEW_USER_OPERATIONS.md +9 -9
- package/docs/OPENCLAW_BRIDGE.md +22 -7
- package/docs/OPENCLAW_BRIDGE_ZH.md +21 -6
- package/docs/RELEASE_CHECKLIST.md +95 -0
- package/node_modules/@silicaclaw/core/dist/config/silicaclaw-defaults.json +19 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/crypto.d.ts +6 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/crypto.js +50 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/directory.d.ts +17 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/directory.js +145 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/identity.d.ts +2 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/identity.js +18 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/index.d.ts +14 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/index.js +30 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/indexing.d.ts +6 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/indexing.js +43 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/presence.d.ts +4 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/presence.js +23 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/privateCrypto.d.ts +17 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/privateCrypto.js +40 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/privateMessage.d.ts +23 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/privateMessage.js +74 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/profile.d.ts +4 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/profile.js +41 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/publicProfileSummary.d.ts +74 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/publicProfileSummary.js +106 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialConfig.d.ts +100 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialConfig.js +300 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialMessage.d.ts +19 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialMessage.js +69 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialResolver.d.ts +46 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialResolver.js +237 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialTemplate.d.ts +2 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/socialTemplate.js +90 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/types.d.ts +99 -0
- package/node_modules/@silicaclaw/core/dist/packages/core/src/types.js +2 -0
- package/node_modules/@silicaclaw/core/src/index.ts +2 -0
- package/node_modules/@silicaclaw/core/src/privateCrypto.ts +57 -0
- package/node_modules/@silicaclaw/core/src/privateMessage.ts +101 -0
- package/node_modules/@silicaclaw/core/src/profile.ts +2 -0
- package/node_modules/@silicaclaw/core/src/publicProfileSummary.ts +7 -0
- package/node_modules/@silicaclaw/core/src/socialConfig.ts +7 -5
- package/node_modules/@silicaclaw/core/src/types.ts +44 -0
- package/node_modules/@silicaclaw/network/dist/config/silicaclaw-defaults.json +19 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/messageEnvelope.d.ts +28 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/messageEnvelope.js +36 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/peerDiscovery.d.ts +43 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/peerDiscovery.js +2 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/topicCodec.d.ts +4 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/topicCodec.js +2 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/transport.d.ts +36 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/abstractions/transport.js +2 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/codec/jsonMessageEnvelopeCodec.d.ts +5 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/codec/jsonMessageEnvelopeCodec.js +24 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/codec/jsonTopicCodec.d.ts +5 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/codec/jsonTopicCodec.js +12 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/discovery/heartbeatPeerDiscovery.d.ts +28 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/discovery/heartbeatPeerDiscovery.js +144 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/index.d.ts +14 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/index.js +30 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/localEventBus.d.ts +9 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/localEventBus.js +47 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/mock.d.ts +8 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/mock.js +24 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/realPreview.d.ts +105 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/realPreview.js +331 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/relayPreview.d.ts +178 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/relayPreview.js +548 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/transport/udpLanBroadcastTransport.d.ts +23 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/transport/udpLanBroadcastTransport.js +154 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/types.d.ts +10 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/types.js +2 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/webrtcPreview.d.ts +163 -0
- package/node_modules/@silicaclaw/network/dist/packages/network/src/webrtcPreview.js +848 -0
- package/node_modules/@silicaclaw/network/src/realPreview.ts +3 -2
- package/node_modules/@silicaclaw/network/src/relayPreview.ts +125 -12
- package/node_modules/@silicaclaw/network/src/transport/udpLanBroadcastTransport.ts +2 -1
- package/node_modules/@silicaclaw/network/src/types.ts +2 -0
- package/node_modules/@silicaclaw/network/src/webrtcPreview.ts +2 -1
- package/node_modules/@silicaclaw/storage/config/silicaclaw-defaults.json +19 -0
- package/node_modules/@silicaclaw/storage/dist/config/silicaclaw-defaults.json +19 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/crypto.d.ts +6 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/crypto.js +50 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/directory.d.ts +17 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/directory.js +145 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/identity.d.ts +2 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/identity.js +18 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/index.d.ts +14 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/index.js +30 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/indexing.d.ts +6 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/indexing.js +43 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/presence.d.ts +4 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/presence.js +23 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/privateCrypto.d.ts +17 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/privateCrypto.js +40 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/privateMessage.d.ts +23 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/privateMessage.js +74 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/profile.d.ts +4 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/profile.js +41 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/publicProfileSummary.d.ts +74 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/publicProfileSummary.js +106 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialConfig.d.ts +100 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialConfig.js +300 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialMessage.d.ts +19 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialMessage.js +69 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialResolver.d.ts +46 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialResolver.js +237 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialTemplate.d.ts +2 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/socialTemplate.js +90 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/types.d.ts +99 -0
- package/node_modules/@silicaclaw/storage/dist/packages/core/src/types.js +2 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/config/silicaclaw-defaults.json +19 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/index.d.ts +3 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/index.js +19 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/jsonRepo.d.ts +7 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/jsonRepo.js +29 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/repos.d.ts +73 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/repos.js +85 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/socialRuntimeRepo.d.ts +5 -0
- package/node_modules/@silicaclaw/storage/dist/packages/storage/src/socialRuntimeRepo.js +57 -0
- package/node_modules/@silicaclaw/storage/dist/socialRuntimeRepo.js +8 -4
- package/node_modules/@silicaclaw/storage/src/repos.ts +31 -1
- package/node_modules/@silicaclaw/storage/src/socialRuntimeRepo.ts +5 -4
- package/node_modules/@silicaclaw/storage/tsconfig.json +1 -6
- package/openclaw-skills/silicaclaw-bridge-setup/SKILL.md +165 -0
- package/openclaw-skills/silicaclaw-bridge-setup/VERSION +1 -0
- package/openclaw-skills/silicaclaw-bridge-setup/agents/openai.yaml +6 -0
- package/openclaw-skills/silicaclaw-bridge-setup/manifest.json +27 -0
- package/openclaw-skills/silicaclaw-bridge-setup/references/owner-dialogue-cheatsheet-zh.md +58 -0
- package/openclaw-skills/silicaclaw-bridge-setup/references/runtime-setup.md +43 -0
- package/openclaw-skills/silicaclaw-bridge-setup/references/troubleshooting.md +24 -0
- package/openclaw-skills/silicaclaw-broadcast/SKILL.md +150 -0
- package/openclaw-skills/silicaclaw-broadcast/VERSION +1 -1
- package/openclaw-skills/silicaclaw-broadcast/agents/openai.yaml +2 -2
- package/openclaw-skills/silicaclaw-broadcast/manifest.json +4 -3
- package/openclaw-skills/silicaclaw-broadcast/references/owner-dialogue-cheatsheet-zh.md +81 -0
- package/openclaw-skills/silicaclaw-network-config/SKILL.md +158 -0
- package/openclaw-skills/silicaclaw-network-config/VERSION +1 -0
- package/openclaw-skills/silicaclaw-network-config/agents/openai.yaml +6 -0
- package/openclaw-skills/silicaclaw-network-config/manifest.json +27 -0
- package/openclaw-skills/silicaclaw-network-config/references/network-modes.md +22 -0
- package/openclaw-skills/silicaclaw-network-config/references/owner-dialogue-cheatsheet-zh.md +47 -0
- package/openclaw-skills/silicaclaw-network-config/references/public-discovery.md +22 -0
- package/openclaw-skills/silicaclaw-owner-push/SKILL.md +235 -0
- package/openclaw-skills/silicaclaw-owner-push/VERSION +1 -0
- package/openclaw-skills/silicaclaw-owner-push/agents/openai.yaml +6 -0
- package/openclaw-skills/silicaclaw-owner-push/manifest.json +30 -0
- package/openclaw-skills/silicaclaw-owner-push/references/owner-dialogue-cheatsheet-zh.md +87 -0
- package/openclaw-skills/silicaclaw-owner-push/references/push-routing-policy.md +43 -0
- package/openclaw-skills/silicaclaw-owner-push/references/runtime-setup.md +44 -0
- package/openclaw-skills/silicaclaw-owner-push/scripts/owner-push-forwarder.mjs +356 -0
- package/openclaw-skills/silicaclaw-owner-push/scripts/send-to-owner-via-openclaw.mjs +69 -0
- package/package.json +5 -1
- package/packages/core/dist/config/silicaclaw-defaults.json +19 -0
- package/packages/core/dist/packages/core/src/crypto.d.ts +6 -0
- package/packages/core/dist/packages/core/src/crypto.js +50 -0
- package/packages/core/dist/packages/core/src/directory.d.ts +17 -0
- package/packages/core/dist/packages/core/src/directory.js +145 -0
- package/packages/core/dist/packages/core/src/identity.d.ts +2 -0
- package/packages/core/dist/packages/core/src/identity.js +18 -0
- package/packages/core/dist/packages/core/src/index.d.ts +14 -0
- package/packages/core/dist/packages/core/src/index.js +30 -0
- package/packages/core/dist/packages/core/src/indexing.d.ts +6 -0
- package/packages/core/dist/packages/core/src/indexing.js +43 -0
- package/packages/core/dist/packages/core/src/presence.d.ts +4 -0
- package/packages/core/dist/packages/core/src/presence.js +23 -0
- package/packages/core/dist/packages/core/src/privateCrypto.d.ts +17 -0
- package/packages/core/dist/packages/core/src/privateCrypto.js +40 -0
- package/packages/core/dist/packages/core/src/privateMessage.d.ts +23 -0
- package/packages/core/dist/packages/core/src/privateMessage.js +74 -0
- package/packages/core/dist/packages/core/src/profile.d.ts +4 -0
- package/packages/core/dist/packages/core/src/profile.js +41 -0
- package/packages/core/dist/packages/core/src/publicProfileSummary.d.ts +74 -0
- package/packages/core/dist/packages/core/src/publicProfileSummary.js +106 -0
- package/packages/core/dist/packages/core/src/socialConfig.d.ts +100 -0
- package/packages/core/dist/packages/core/src/socialConfig.js +300 -0
- package/packages/core/dist/packages/core/src/socialMessage.d.ts +19 -0
- package/packages/core/dist/packages/core/src/socialMessage.js +69 -0
- package/packages/core/dist/packages/core/src/socialResolver.d.ts +46 -0
- package/packages/core/dist/packages/core/src/socialResolver.js +237 -0
- package/packages/core/dist/packages/core/src/socialTemplate.d.ts +2 -0
- package/packages/core/dist/packages/core/src/socialTemplate.js +90 -0
- package/packages/core/dist/packages/core/src/types.d.ts +99 -0
- package/packages/core/dist/packages/core/src/types.js +2 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/privateCrypto.ts +57 -0
- package/packages/core/src/privateMessage.ts +101 -0
- package/packages/core/src/profile.ts +2 -0
- package/packages/core/src/publicProfileSummary.ts +7 -0
- package/packages/core/src/socialConfig.ts +7 -5
- package/packages/core/src/types.ts +44 -0
- package/packages/network/dist/config/silicaclaw-defaults.json +19 -0
- package/packages/network/dist/packages/network/src/abstractions/messageEnvelope.d.ts +28 -0
- package/packages/network/dist/packages/network/src/abstractions/messageEnvelope.js +36 -0
- package/packages/network/dist/packages/network/src/abstractions/peerDiscovery.d.ts +43 -0
- package/packages/network/dist/packages/network/src/abstractions/peerDiscovery.js +2 -0
- package/packages/network/dist/packages/network/src/abstractions/topicCodec.d.ts +4 -0
- package/packages/network/dist/packages/network/src/abstractions/topicCodec.js +2 -0
- package/packages/network/dist/packages/network/src/abstractions/transport.d.ts +36 -0
- package/packages/network/dist/packages/network/src/abstractions/transport.js +2 -0
- package/packages/network/dist/packages/network/src/codec/jsonMessageEnvelopeCodec.d.ts +5 -0
- package/packages/network/dist/packages/network/src/codec/jsonMessageEnvelopeCodec.js +24 -0
- package/packages/network/dist/packages/network/src/codec/jsonTopicCodec.d.ts +5 -0
- package/packages/network/dist/packages/network/src/codec/jsonTopicCodec.js +12 -0
- package/packages/network/dist/packages/network/src/discovery/heartbeatPeerDiscovery.d.ts +28 -0
- package/packages/network/dist/packages/network/src/discovery/heartbeatPeerDiscovery.js +144 -0
- package/packages/network/dist/packages/network/src/index.d.ts +14 -0
- package/packages/network/dist/packages/network/src/index.js +30 -0
- package/packages/network/dist/packages/network/src/localEventBus.d.ts +9 -0
- package/packages/network/dist/packages/network/src/localEventBus.js +47 -0
- package/packages/network/dist/packages/network/src/mock.d.ts +8 -0
- package/packages/network/dist/packages/network/src/mock.js +24 -0
- package/packages/network/dist/packages/network/src/realPreview.d.ts +105 -0
- package/packages/network/dist/packages/network/src/realPreview.js +331 -0
- package/packages/network/dist/packages/network/src/relayPreview.d.ts +178 -0
- package/packages/network/dist/packages/network/src/relayPreview.js +548 -0
- package/packages/network/dist/packages/network/src/transport/udpLanBroadcastTransport.d.ts +23 -0
- package/packages/network/dist/packages/network/src/transport/udpLanBroadcastTransport.js +154 -0
- package/packages/network/dist/packages/network/src/types.d.ts +10 -0
- package/packages/network/dist/packages/network/src/types.js +2 -0
- package/packages/network/dist/packages/network/src/webrtcPreview.d.ts +163 -0
- package/packages/network/dist/packages/network/src/webrtcPreview.js +848 -0
- package/packages/network/src/realPreview.ts +3 -2
- package/packages/network/src/relayPreview.ts +125 -12
- package/packages/network/src/transport/udpLanBroadcastTransport.ts +2 -1
- package/packages/network/src/types.ts +2 -0
- package/packages/network/src/webrtcPreview.ts +2 -1
- package/packages/storage/config/silicaclaw-defaults.json +19 -0
- package/packages/storage/dist/config/silicaclaw-defaults.json +19 -0
- package/packages/storage/dist/packages/core/src/crypto.d.ts +6 -0
- package/packages/storage/dist/packages/core/src/crypto.js +50 -0
- package/packages/storage/dist/packages/core/src/directory.d.ts +17 -0
- package/packages/storage/dist/packages/core/src/directory.js +145 -0
- package/packages/storage/dist/packages/core/src/identity.d.ts +2 -0
- package/packages/storage/dist/packages/core/src/identity.js +18 -0
- package/packages/storage/dist/packages/core/src/index.d.ts +14 -0
- package/packages/storage/dist/packages/core/src/index.js +30 -0
- package/packages/storage/dist/packages/core/src/indexing.d.ts +6 -0
- package/packages/storage/dist/packages/core/src/indexing.js +43 -0
- package/packages/storage/dist/packages/core/src/presence.d.ts +4 -0
- package/packages/storage/dist/packages/core/src/presence.js +23 -0
- package/packages/storage/dist/packages/core/src/privateCrypto.d.ts +17 -0
- package/packages/storage/dist/packages/core/src/privateCrypto.js +40 -0
- package/packages/storage/dist/packages/core/src/privateMessage.d.ts +23 -0
- package/packages/storage/dist/packages/core/src/privateMessage.js +74 -0
- package/packages/storage/dist/packages/core/src/profile.d.ts +4 -0
- package/packages/storage/dist/packages/core/src/profile.js +41 -0
- package/packages/storage/dist/packages/core/src/publicProfileSummary.d.ts +74 -0
- package/packages/storage/dist/packages/core/src/publicProfileSummary.js +106 -0
- package/packages/storage/dist/packages/core/src/socialConfig.d.ts +100 -0
- package/packages/storage/dist/packages/core/src/socialConfig.js +300 -0
- package/packages/storage/dist/packages/core/src/socialMessage.d.ts +19 -0
- package/packages/storage/dist/packages/core/src/socialMessage.js +69 -0
- package/packages/storage/dist/packages/core/src/socialResolver.d.ts +46 -0
- package/packages/storage/dist/packages/core/src/socialResolver.js +237 -0
- package/packages/storage/dist/packages/core/src/socialTemplate.d.ts +2 -0
- package/packages/storage/dist/packages/core/src/socialTemplate.js +90 -0
- package/packages/storage/dist/packages/core/src/types.d.ts +99 -0
- package/packages/storage/dist/packages/core/src/types.js +2 -0
- package/packages/storage/dist/packages/storage/config/silicaclaw-defaults.json +19 -0
- package/packages/storage/dist/packages/storage/src/index.d.ts +3 -0
- package/packages/storage/dist/packages/storage/src/index.js +19 -0
- package/packages/storage/dist/packages/storage/src/jsonRepo.d.ts +7 -0
- package/packages/storage/dist/packages/storage/src/jsonRepo.js +29 -0
- package/packages/storage/dist/packages/storage/src/repos.d.ts +73 -0
- package/packages/storage/dist/packages/storage/src/repos.js +85 -0
- package/packages/storage/dist/packages/storage/src/socialRuntimeRepo.d.ts +5 -0
- package/packages/storage/dist/packages/storage/src/socialRuntimeRepo.js +57 -0
- package/packages/storage/dist/socialRuntimeRepo.js +8 -4
- package/packages/storage/src/repos.ts +31 -1
- package/packages/storage/src/socialRuntimeRepo.ts +5 -4
- package/packages/storage/tsconfig.json +1 -6
- package/scripts/functional-check.mjs +35 -6
- package/scripts/install-openclaw-skill.mjs +9 -2
- package/scripts/openclaw-bridge-adapter.mjs +3 -1
- package/scripts/openclaw-bridge-client.mjs +3 -1
- package/scripts/openclaw-runtime-demo.mjs +3 -1
- package/scripts/quickstart.sh +14 -10
- package/scripts/release-pack.mjs +59 -1
- package/scripts/silicaclaw-cli.mjs +166 -51
- package/scripts/silicaclaw-gateway.mjs +410 -84
- package/scripts/validate-openclaw-skill.mjs +98 -21
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ports": {
|
|
3
|
+
"local_console": 4310,
|
|
4
|
+
"public_explorer": 4311,
|
|
5
|
+
"openclaw_gateway": 18789,
|
|
6
|
+
"network_default": 44123
|
|
7
|
+
},
|
|
8
|
+
"network": {
|
|
9
|
+
"default_mode": "global-preview",
|
|
10
|
+
"default_namespace": "silicaclaw.preview",
|
|
11
|
+
"global_preview": {
|
|
12
|
+
"relay_url": "https://relay.silicaclaw.com",
|
|
13
|
+
"room": "silicaclaw-global-preview"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"bridge": {
|
|
17
|
+
"api_base": "http://localhost:4310"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -4,6 +4,8 @@ export * from "./identity";
|
|
|
4
4
|
export * from "./profile";
|
|
5
5
|
export * from "./presence";
|
|
6
6
|
export * from "./socialMessage";
|
|
7
|
+
export * from "./privateCrypto";
|
|
8
|
+
export * from "./privateMessage";
|
|
7
9
|
export * from "./indexing";
|
|
8
10
|
export * from "./directory";
|
|
9
11
|
export * from "./publicProfileSummary";
|
|
@@ -20,6 +20,8 @@ __exportStar(require("./identity"), exports);
|
|
|
20
20
|
__exportStar(require("./profile"), exports);
|
|
21
21
|
__exportStar(require("./presence"), exports);
|
|
22
22
|
__exportStar(require("./socialMessage"), exports);
|
|
23
|
+
__exportStar(require("./privateCrypto"), exports);
|
|
24
|
+
__exportStar(require("./privateMessage"), exports);
|
|
23
25
|
__exportStar(require("./indexing"), exports);
|
|
24
26
|
__exportStar(require("./directory"), exports);
|
|
25
27
|
__exportStar(require("./publicProfileSummary"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PrivateEncryptionKeyPair } from "./types";
|
|
2
|
+
export declare function createPrivateEncryptionKeyPair(now?: number): PrivateEncryptionKeyPair;
|
|
3
|
+
export declare function encryptPrivatePayload(input: {
|
|
4
|
+
plaintext: string;
|
|
5
|
+
recipient_public_key: string;
|
|
6
|
+
sender_keypair?: PrivateEncryptionKeyPair | null;
|
|
7
|
+
}): {
|
|
8
|
+
ciphertext: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
sender_encryption_public_key: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function decryptPrivatePayload(input: {
|
|
13
|
+
ciphertext: string;
|
|
14
|
+
nonce: string;
|
|
15
|
+
sender_encryption_public_key: string;
|
|
16
|
+
recipient_private_key: string;
|
|
17
|
+
}): string | null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createPrivateEncryptionKeyPair = createPrivateEncryptionKeyPair;
|
|
7
|
+
exports.encryptPrivatePayload = encryptPrivatePayload;
|
|
8
|
+
exports.decryptPrivatePayload = decryptPrivatePayload;
|
|
9
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
10
|
+
const crypto_1 = require("./crypto");
|
|
11
|
+
function createPrivateEncryptionKeyPair(now = Date.now()) {
|
|
12
|
+
const pair = tweetnacl_1.default.box.keyPair();
|
|
13
|
+
return {
|
|
14
|
+
public_key: (0, crypto_1.toBase64)(pair.publicKey),
|
|
15
|
+
private_key: (0, crypto_1.toBase64)(pair.secretKey),
|
|
16
|
+
created_at: now,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function encryptPrivatePayload(input) {
|
|
20
|
+
const sender = input.sender_keypair || createPrivateEncryptionKeyPair();
|
|
21
|
+
const nonce = tweetnacl_1.default.randomBytes(tweetnacl_1.default.box.nonceLength);
|
|
22
|
+
const message = Buffer.from(String(input.plaintext || ""), "utf8");
|
|
23
|
+
const ciphertext = tweetnacl_1.default.box(new Uint8Array(message), nonce, (0, crypto_1.fromBase64)(input.recipient_public_key), (0, crypto_1.fromBase64)(sender.private_key));
|
|
24
|
+
return {
|
|
25
|
+
ciphertext: (0, crypto_1.toBase64)(ciphertext),
|
|
26
|
+
nonce: (0, crypto_1.toBase64)(nonce),
|
|
27
|
+
sender_encryption_public_key: sender.public_key,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function decryptPrivatePayload(input) {
|
|
31
|
+
try {
|
|
32
|
+
const opened = tweetnacl_1.default.box.open((0, crypto_1.fromBase64)(input.ciphertext), (0, crypto_1.fromBase64)(input.nonce), (0, crypto_1.fromBase64)(input.sender_encryption_public_key), (0, crypto_1.fromBase64)(input.recipient_private_key));
|
|
33
|
+
if (!opened)
|
|
34
|
+
return null;
|
|
35
|
+
return Buffer.from(opened).toString("utf8");
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AgentIdentity, PrivateMessageReceiptRecord, PrivateMessageRecord } from "./types";
|
|
2
|
+
export declare function signPrivateMessage(input: {
|
|
3
|
+
identity: AgentIdentity;
|
|
4
|
+
message_id: string;
|
|
5
|
+
conversation_id: string;
|
|
6
|
+
to_agent_id: string;
|
|
7
|
+
sender_encryption_public_key: string;
|
|
8
|
+
recipient_encryption_public_key: string;
|
|
9
|
+
ciphertext: string;
|
|
10
|
+
nonce: string;
|
|
11
|
+
created_at?: number;
|
|
12
|
+
}): PrivateMessageRecord;
|
|
13
|
+
export declare function verifyPrivateMessage(record: PrivateMessageRecord): boolean;
|
|
14
|
+
export declare function signPrivateMessageReceipt(input: {
|
|
15
|
+
identity: AgentIdentity;
|
|
16
|
+
receipt_id: string;
|
|
17
|
+
message_id: string;
|
|
18
|
+
conversation_id: string;
|
|
19
|
+
to_agent_id: string;
|
|
20
|
+
status: "received" | "read";
|
|
21
|
+
created_at?: number;
|
|
22
|
+
}): PrivateMessageReceiptRecord;
|
|
23
|
+
export declare function verifyPrivateMessageReceipt(record: PrivateMessageReceiptRecord): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signPrivateMessage = signPrivateMessage;
|
|
4
|
+
exports.verifyPrivateMessage = verifyPrivateMessage;
|
|
5
|
+
exports.signPrivateMessageReceipt = signPrivateMessageReceipt;
|
|
6
|
+
exports.verifyPrivateMessageReceipt = verifyPrivateMessageReceipt;
|
|
7
|
+
const crypto_1 = require("./crypto");
|
|
8
|
+
function unsignedPrivateMessage(record) {
|
|
9
|
+
const { signature: _signature, ...rest } = record;
|
|
10
|
+
return rest;
|
|
11
|
+
}
|
|
12
|
+
function unsignedPrivateMessageReceipt(record) {
|
|
13
|
+
const { signature: _signature, ...rest } = record;
|
|
14
|
+
return rest;
|
|
15
|
+
}
|
|
16
|
+
function signPrivateMessage(input) {
|
|
17
|
+
const payload = {
|
|
18
|
+
type: "private.message",
|
|
19
|
+
message_id: input.message_id,
|
|
20
|
+
conversation_id: input.conversation_id,
|
|
21
|
+
from_agent_id: input.identity.agent_id,
|
|
22
|
+
to_agent_id: input.to_agent_id,
|
|
23
|
+
sender_public_key: input.identity.public_key,
|
|
24
|
+
sender_encryption_public_key: input.sender_encryption_public_key,
|
|
25
|
+
recipient_encryption_public_key: input.recipient_encryption_public_key,
|
|
26
|
+
cipher_scheme: "nacl-box-v1",
|
|
27
|
+
ciphertext: input.ciphertext,
|
|
28
|
+
nonce: input.nonce,
|
|
29
|
+
created_at: input.created_at ?? Date.now(),
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...payload,
|
|
33
|
+
signature: (0, crypto_1.signPayload)(payload, input.identity.private_key),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function verifyPrivateMessage(record) {
|
|
37
|
+
try {
|
|
38
|
+
if ((0, crypto_1.hashPublicKey)((0, crypto_1.fromBase64)(record.sender_public_key)) !== record.from_agent_id) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return (0, crypto_1.verifyPayload)(unsignedPrivateMessage(record), record.signature, record.sender_public_key);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function signPrivateMessageReceipt(input) {
|
|
48
|
+
const payload = {
|
|
49
|
+
type: "private.message.receipt",
|
|
50
|
+
receipt_id: input.receipt_id,
|
|
51
|
+
message_id: input.message_id,
|
|
52
|
+
conversation_id: input.conversation_id,
|
|
53
|
+
from_agent_id: input.identity.agent_id,
|
|
54
|
+
to_agent_id: input.to_agent_id,
|
|
55
|
+
sender_public_key: input.identity.public_key,
|
|
56
|
+
status: input.status,
|
|
57
|
+
created_at: input.created_at ?? Date.now(),
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
...payload,
|
|
61
|
+
signature: (0, crypto_1.signPayload)(payload, input.identity.private_key),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function verifyPrivateMessageReceipt(record) {
|
|
65
|
+
try {
|
|
66
|
+
if ((0, crypto_1.hashPublicKey)((0, crypto_1.fromBase64)(record.sender_public_key)) !== record.from_agent_id) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return (0, crypto_1.verifyPayload)(unsignedPrivateMessageReceipt(record), record.signature, record.sender_public_key);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -15,6 +15,7 @@ function signProfile(input, identity) {
|
|
|
15
15
|
bio: input.bio,
|
|
16
16
|
tags: input.tags,
|
|
17
17
|
avatar_url: input.avatar_url,
|
|
18
|
+
private_encryption_public_key: input.private_encryption_public_key,
|
|
18
19
|
public_enabled: input.public_enabled,
|
|
19
20
|
updated_at: Date.now(),
|
|
20
21
|
};
|
|
@@ -34,6 +35,7 @@ function createDefaultProfileInput(agentId) {
|
|
|
34
35
|
bio: "",
|
|
35
36
|
tags: [],
|
|
36
37
|
avatar_url: "",
|
|
38
|
+
private_encryption_public_key: "",
|
|
37
39
|
public_enabled: false,
|
|
38
40
|
};
|
|
39
41
|
}
|
|
@@ -7,9 +7,11 @@ export type ProfileVisibility = {
|
|
|
7
7
|
};
|
|
8
8
|
export type PublicProfileSummary = {
|
|
9
9
|
agent_id: string;
|
|
10
|
+
is_self: boolean;
|
|
10
11
|
display_name: string;
|
|
11
12
|
bio: string;
|
|
12
13
|
avatar_url?: string;
|
|
14
|
+
private_encryption_public_key?: string;
|
|
13
15
|
public_enabled: boolean;
|
|
14
16
|
updated_at: number;
|
|
15
17
|
online: boolean;
|
|
@@ -30,6 +32,7 @@ export type PublicProfileSummary = {
|
|
|
30
32
|
display_name: string;
|
|
31
33
|
bio: string;
|
|
32
34
|
avatar_url?: string;
|
|
35
|
+
private_encryption_public_key?: string;
|
|
33
36
|
tags: string[];
|
|
34
37
|
public_enabled: boolean;
|
|
35
38
|
profile_version: string;
|
|
@@ -57,6 +60,7 @@ export type PublicProfileSummary = {
|
|
|
57
60
|
export declare function deriveCapabilitiesSummary(tags: string[]): string[];
|
|
58
61
|
export declare function buildPublicProfileSummary(args: {
|
|
59
62
|
profile: PublicProfile;
|
|
63
|
+
is_self?: boolean;
|
|
60
64
|
online: boolean;
|
|
61
65
|
last_seen_at: number | null;
|
|
62
66
|
network_mode?: string;
|
|
@@ -53,9 +53,11 @@ function buildPublicProfileSummary(args) {
|
|
|
53
53
|
].filter((field) => Boolean(field));
|
|
54
54
|
return {
|
|
55
55
|
agent_id: args.profile.agent_id,
|
|
56
|
+
is_self: Boolean(args.is_self),
|
|
56
57
|
display_name: args.profile.display_name,
|
|
57
58
|
bio: args.profile.bio,
|
|
58
59
|
avatar_url: args.profile.avatar_url,
|
|
60
|
+
private_encryption_public_key: args.profile.private_encryption_public_key,
|
|
59
61
|
public_enabled: args.profile.public_enabled,
|
|
60
62
|
updated_at: args.profile.updated_at,
|
|
61
63
|
online: args.online,
|
|
@@ -76,6 +78,7 @@ function buildPublicProfileSummary(args) {
|
|
|
76
78
|
display_name: args.profile.display_name,
|
|
77
79
|
bio: args.profile.bio,
|
|
78
80
|
avatar_url: args.profile.avatar_url,
|
|
81
|
+
private_encryption_public_key: args.profile.private_encryption_public_key,
|
|
79
82
|
tags,
|
|
80
83
|
public_enabled: args.profile.public_enabled,
|
|
81
84
|
profile_version: args.profile_version ?? "v1",
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.parseFrontmatterObject = parseFrontmatterObject;
|
|
4
7
|
exports.extractFrontmatter = extractFrontmatter;
|
|
5
8
|
exports.normalizeSocialConfig = normalizeSocialConfig;
|
|
6
9
|
exports.getDefaultSocialConfig = getDefaultSocialConfig;
|
|
7
10
|
exports.generateDefaultSocialMdTemplate = generateDefaultSocialMdTemplate;
|
|
11
|
+
const silicaclaw_defaults_json_1 = __importDefault(require("../../../config/silicaclaw-defaults.json"));
|
|
8
12
|
const DEFAULT_SOCIAL_CONFIG = {
|
|
9
13
|
enabled: true,
|
|
10
14
|
public_enabled: false,
|
|
@@ -15,13 +19,13 @@ const DEFAULT_SOCIAL_CONFIG = {
|
|
|
15
19
|
tags: [],
|
|
16
20
|
},
|
|
17
21
|
network: {
|
|
18
|
-
mode:
|
|
19
|
-
namespace:
|
|
22
|
+
mode: silicaclaw_defaults_json_1.default.network.default_mode,
|
|
23
|
+
namespace: silicaclaw_defaults_json_1.default.network.default_namespace,
|
|
20
24
|
adapter: "relay-preview",
|
|
21
|
-
port:
|
|
22
|
-
signaling_url:
|
|
25
|
+
port: silicaclaw_defaults_json_1.default.ports.network_default,
|
|
26
|
+
signaling_url: silicaclaw_defaults_json_1.default.network.global_preview.relay_url,
|
|
23
27
|
signaling_urls: [],
|
|
24
|
-
room:
|
|
28
|
+
room: silicaclaw_defaults_json_1.default.network.global_preview.room,
|
|
25
29
|
seed_peers: [],
|
|
26
30
|
bootstrap_hints: [],
|
|
27
31
|
},
|
|
@@ -4,12 +4,18 @@ export type AgentIdentity = {
|
|
|
4
4
|
private_key: string;
|
|
5
5
|
created_at: number;
|
|
6
6
|
};
|
|
7
|
+
export type PrivateEncryptionKeyPair = {
|
|
8
|
+
public_key: string;
|
|
9
|
+
private_key: string;
|
|
10
|
+
created_at: number;
|
|
11
|
+
};
|
|
7
12
|
export type PublicProfile = {
|
|
8
13
|
agent_id: string;
|
|
9
14
|
display_name: string;
|
|
10
15
|
bio: string;
|
|
11
16
|
tags: string[];
|
|
12
17
|
avatar_url?: string;
|
|
18
|
+
private_encryption_public_key?: string;
|
|
13
19
|
public_enabled: boolean;
|
|
14
20
|
updated_at: number;
|
|
15
21
|
signature: string;
|
|
@@ -51,6 +57,40 @@ export type SocialMessageObservationRecord = {
|
|
|
51
57
|
observed_at: number;
|
|
52
58
|
signature: string;
|
|
53
59
|
};
|
|
60
|
+
export type PrivateMessageRecord = {
|
|
61
|
+
type: "private.message";
|
|
62
|
+
message_id: string;
|
|
63
|
+
conversation_id: string;
|
|
64
|
+
from_agent_id: string;
|
|
65
|
+
to_agent_id: string;
|
|
66
|
+
sender_public_key: string;
|
|
67
|
+
sender_encryption_public_key: string;
|
|
68
|
+
recipient_encryption_public_key: string;
|
|
69
|
+
cipher_scheme: "nacl-box-v1";
|
|
70
|
+
ciphertext: string;
|
|
71
|
+
nonce: string;
|
|
72
|
+
created_at: number;
|
|
73
|
+
signature: string;
|
|
74
|
+
};
|
|
75
|
+
export type PrivateMessageReceiptRecord = {
|
|
76
|
+
type: "private.message.receipt";
|
|
77
|
+
receipt_id: string;
|
|
78
|
+
message_id: string;
|
|
79
|
+
conversation_id: string;
|
|
80
|
+
from_agent_id: string;
|
|
81
|
+
to_agent_id: string;
|
|
82
|
+
sender_public_key: string;
|
|
83
|
+
status: "received" | "read";
|
|
84
|
+
created_at: number;
|
|
85
|
+
signature: string;
|
|
86
|
+
};
|
|
87
|
+
export type PrivateConversationSummary = {
|
|
88
|
+
conversation_id: string;
|
|
89
|
+
peer_agent_id: string;
|
|
90
|
+
last_message_at: number | null;
|
|
91
|
+
last_message_preview: string;
|
|
92
|
+
unread_count: number;
|
|
93
|
+
};
|
|
54
94
|
export type DirectoryState = {
|
|
55
95
|
profiles: Record<string, PublicProfile>;
|
|
56
96
|
presence: Record<string, number>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.RealNetworkAdapterPreview = void 0;
|
|
4
7
|
const crypto_1 = require("crypto");
|
|
@@ -7,6 +10,7 @@ const jsonMessageEnvelopeCodec_1 = require("./codec/jsonMessageEnvelopeCodec");
|
|
|
7
10
|
const jsonTopicCodec_1 = require("./codec/jsonTopicCodec");
|
|
8
11
|
const udpLanBroadcastTransport_1 = require("./transport/udpLanBroadcastTransport");
|
|
9
12
|
const heartbeatPeerDiscovery_1 = require("./discovery/heartbeatPeerDiscovery");
|
|
13
|
+
const silicaclaw_defaults_json_1 = __importDefault(require("../../../config/silicaclaw-defaults.json"));
|
|
10
14
|
class RealNetworkAdapterPreview {
|
|
11
15
|
started = false;
|
|
12
16
|
peerId;
|
|
@@ -46,7 +50,7 @@ class RealNetworkAdapterPreview {
|
|
|
46
50
|
};
|
|
47
51
|
constructor(options = {}) {
|
|
48
52
|
this.peerId = options.peerId ?? `peer-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
|
|
49
|
-
this.namespace = this.normalizeNamespace(options.namespace ??
|
|
53
|
+
this.namespace = this.normalizeNamespace(options.namespace ?? silicaclaw_defaults_json_1.default.network.default_namespace);
|
|
50
54
|
this.transport = options.transport ?? new udpLanBroadcastTransport_1.UdpLanBroadcastTransport();
|
|
51
55
|
this.envelopeCodec = options.envelopeCodec ?? new jsonMessageEnvelopeCodec_1.JsonMessageEnvelopeCodec();
|
|
52
56
|
this.topicCodec = options.topicCodec ?? new jsonTopicCodec_1.JsonTopicCodec();
|
|
@@ -315,7 +319,7 @@ class RealNetworkAdapterPreview {
|
|
|
315
319
|
}
|
|
316
320
|
normalizeNamespace(namespace) {
|
|
317
321
|
const normalized = namespace.trim();
|
|
318
|
-
return normalized.length > 0 ? normalized :
|
|
322
|
+
return normalized.length > 0 ? normalized : silicaclaw_defaults_json_1.default.network.default_namespace;
|
|
319
323
|
}
|
|
320
324
|
errorMessage(error) {
|
|
321
325
|
if (error instanceof Error) {
|
|
@@ -22,6 +22,10 @@ type RelayPeer = {
|
|
|
22
22
|
last_seen_at: number;
|
|
23
23
|
messages_seen: number;
|
|
24
24
|
reconnect_attempts: number;
|
|
25
|
+
meta?: {
|
|
26
|
+
signal_queue_size?: number;
|
|
27
|
+
relay_queue_size?: number;
|
|
28
|
+
};
|
|
25
29
|
};
|
|
26
30
|
type RelayDiagnostics = {
|
|
27
31
|
adapter: "relay-preview";
|
|
@@ -126,6 +130,7 @@ export declare class RelayPreviewAdapter implements NetworkAdapter {
|
|
|
126
130
|
private started;
|
|
127
131
|
private poller;
|
|
128
132
|
private handlers;
|
|
133
|
+
private directHandlers;
|
|
129
134
|
private peers;
|
|
130
135
|
private seenMessageIds;
|
|
131
136
|
private activeEndpoint;
|
|
@@ -150,10 +155,16 @@ export declare class RelayPreviewAdapter implements NetworkAdapter {
|
|
|
150
155
|
stop(): Promise<void>;
|
|
151
156
|
publish(topic: string, data: any): Promise<void>;
|
|
152
157
|
subscribe(topic: string, handler: (data: any) => void): void;
|
|
158
|
+
sendDirect(peerId: string, topic: string, data: any): Promise<void>;
|
|
159
|
+
subscribeDirect(topic: string, handler: (data: any, meta?: {
|
|
160
|
+
peerId?: string;
|
|
161
|
+
}) => void): void;
|
|
153
162
|
getDiagnostics(): RelayDiagnostics;
|
|
154
163
|
private pollOnce;
|
|
155
164
|
private refreshPeers;
|
|
156
165
|
private onEnvelope;
|
|
166
|
+
private onDirectEnvelope;
|
|
167
|
+
private dispatchEnvelope;
|
|
157
168
|
private recordDiscovery;
|
|
158
169
|
private joinRoom;
|
|
159
170
|
private maybeRefreshJoin;
|
|
@@ -162,5 +173,6 @@ export declare class RelayPreviewAdapter implements NetworkAdapter {
|
|
|
162
173
|
private requestJson;
|
|
163
174
|
private updatePeersFromList;
|
|
164
175
|
private scheduleNextPoll;
|
|
176
|
+
private ensurePollingAlive;
|
|
165
177
|
}
|
|
166
178
|
export {};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.RelayPreviewAdapter = void 0;
|
|
4
7
|
const crypto_1 = require("crypto");
|
|
5
8
|
const messageEnvelope_1 = require("./abstractions/messageEnvelope");
|
|
6
9
|
const jsonMessageEnvelopeCodec_1 = require("./codec/jsonMessageEnvelopeCodec");
|
|
7
10
|
const jsonTopicCodec_1 = require("./codec/jsonTopicCodec");
|
|
11
|
+
const silicaclaw_defaults_json_1 = __importDefault(require("../../../config/silicaclaw-defaults.json"));
|
|
8
12
|
function dedupe(values) {
|
|
9
13
|
return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean)));
|
|
10
14
|
}
|
|
@@ -27,6 +31,7 @@ class RelayPreviewAdapter {
|
|
|
27
31
|
started = false;
|
|
28
32
|
poller = null;
|
|
29
33
|
handlers = new Map();
|
|
34
|
+
directHandlers = new Map();
|
|
30
35
|
peers = new Map();
|
|
31
36
|
seenMessageIds = new Set();
|
|
32
37
|
activeEndpoint = "";
|
|
@@ -77,13 +82,15 @@ class RelayPreviewAdapter {
|
|
|
77
82
|
};
|
|
78
83
|
constructor(options = {}) {
|
|
79
84
|
this.peerId = options.peerId ?? `peer-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
|
|
80
|
-
this.namespace =
|
|
85
|
+
this.namespace =
|
|
86
|
+
String(options.namespace || silicaclaw_defaults_json_1.default.network.default_namespace).trim() || silicaclaw_defaults_json_1.default.network.default_namespace;
|
|
81
87
|
this.signalingEndpoints = dedupe((options.signalingUrls && options.signalingUrls.length > 0
|
|
82
88
|
? options.signalingUrls
|
|
83
89
|
: [options.signalingUrl || "http://localhost:4510"]));
|
|
84
90
|
this.activeEndpoint = this.signalingEndpoints[0] || "http://localhost:4510";
|
|
85
91
|
this.activeEndpointIndex = 0;
|
|
86
|
-
this.room =
|
|
92
|
+
this.room =
|
|
93
|
+
String(options.room || silicaclaw_defaults_json_1.default.network.global_preview.room).trim() || silicaclaw_defaults_json_1.default.network.global_preview.room;
|
|
87
94
|
this.seedPeers = dedupe(options.seedPeers || []);
|
|
88
95
|
this.bootstrapHints = dedupe(options.bootstrapHints || []);
|
|
89
96
|
this.bootstrapSources = dedupe(options.bootstrapSources || []);
|
|
@@ -103,7 +110,6 @@ class RelayPreviewAdapter {
|
|
|
103
110
|
try {
|
|
104
111
|
await this.joinRoom("start");
|
|
105
112
|
this.started = true;
|
|
106
|
-
await this.refreshPeers();
|
|
107
113
|
await this.pollOnce();
|
|
108
114
|
this.scheduleNextPoll(this.pollIntervalMs);
|
|
109
115
|
this.recordDiscovery("signaling_connected", { endpoint: this.activeEndpoint });
|
|
@@ -160,6 +166,42 @@ class RelayPreviewAdapter {
|
|
|
160
166
|
}
|
|
161
167
|
this.handlers.get(key)?.add(handler);
|
|
162
168
|
}
|
|
169
|
+
async sendDirect(peerId, topic, data) {
|
|
170
|
+
if (!this.started)
|
|
171
|
+
return;
|
|
172
|
+
const targetPeerId = String(peerId || "").trim();
|
|
173
|
+
if (!targetPeerId)
|
|
174
|
+
return;
|
|
175
|
+
await this.maybeRefreshJoin("direct_send");
|
|
176
|
+
const envelope = {
|
|
177
|
+
version: 1,
|
|
178
|
+
message_id: (0, crypto_1.randomUUID)(),
|
|
179
|
+
topic: `${this.namespace}:${topic}`,
|
|
180
|
+
source_peer_id: this.peerId,
|
|
181
|
+
timestamp: Date.now(),
|
|
182
|
+
payload: this.topicCodec.encode(topic, data),
|
|
183
|
+
};
|
|
184
|
+
const raw = this.envelopeCodec.encode(envelope);
|
|
185
|
+
if (raw.length > this.maxMessageBytes) {
|
|
186
|
+
this.stats.dropped_oversized += 1;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
await this.post("/direct/send", {
|
|
190
|
+
room: this.room,
|
|
191
|
+
from_peer_id: this.peerId,
|
|
192
|
+
to_peer_id: targetPeerId,
|
|
193
|
+
envelope,
|
|
194
|
+
});
|
|
195
|
+
this.lastPublishAt = Date.now();
|
|
196
|
+
this.signalingMessagesSentTotal += 1;
|
|
197
|
+
}
|
|
198
|
+
subscribeDirect(topic, handler) {
|
|
199
|
+
const key = `${this.namespace}:${topic}`;
|
|
200
|
+
if (!this.directHandlers.has(key)) {
|
|
201
|
+
this.directHandlers.set(key, new Set());
|
|
202
|
+
}
|
|
203
|
+
this.directHandlers.get(key)?.add(handler);
|
|
204
|
+
}
|
|
163
205
|
getDiagnostics() {
|
|
164
206
|
const peerItems = Array.from(this.peers.values()).sort((a, b) => b.last_seen_at - a.last_seen_at);
|
|
165
207
|
return {
|
|
@@ -229,6 +271,15 @@ class RelayPreviewAdapter {
|
|
|
229
271
|
this.signalingMessagesReceivedTotal += 1;
|
|
230
272
|
this.onEnvelope(message?.envelope);
|
|
231
273
|
}
|
|
274
|
+
let directMessages = Array.isArray(payload?.direct_messages) ? payload.direct_messages : null;
|
|
275
|
+
if (!directMessages) {
|
|
276
|
+
const directPayload = await this.get(`/direct/poll?room=${encodeURIComponent(this.room)}&peer_id=${encodeURIComponent(this.peerId)}`);
|
|
277
|
+
directMessages = Array.isArray(directPayload?.messages) ? directPayload.messages : [];
|
|
278
|
+
}
|
|
279
|
+
for (const message of directMessages) {
|
|
280
|
+
this.signalingMessagesReceivedTotal += 1;
|
|
281
|
+
this.onDirectEnvelope(message?.envelope, { peerId: String(message?.from_peer_id || "") || undefined });
|
|
282
|
+
}
|
|
232
283
|
if (Array.isArray(payload?.peers)) {
|
|
233
284
|
this.updatePeersFromList(payload.peers);
|
|
234
285
|
}
|
|
@@ -252,10 +303,18 @@ class RelayPreviewAdapter {
|
|
|
252
303
|
const payload = await this.get(`/peers?room=${encodeURIComponent(this.room)}`);
|
|
253
304
|
this.lastPeerRefreshAt = Date.now();
|
|
254
305
|
this.stats.peers_refresh_succeeded += 1;
|
|
255
|
-
const
|
|
256
|
-
|
|
306
|
+
const peerItems = Array.isArray(payload?.peer_details) && payload.peer_details.length
|
|
307
|
+
? payload.peer_details
|
|
308
|
+
: Array.isArray(payload?.peers) ? payload.peers : [];
|
|
309
|
+
this.updatePeersFromList(peerItems);
|
|
257
310
|
}
|
|
258
311
|
onEnvelope(envelope) {
|
|
312
|
+
this.dispatchEnvelope(envelope, this.handlers);
|
|
313
|
+
}
|
|
314
|
+
onDirectEnvelope(envelope, meta) {
|
|
315
|
+
this.dispatchEnvelope(envelope, this.directHandlers, meta);
|
|
316
|
+
}
|
|
317
|
+
dispatchEnvelope(envelope, handlersByTopic, meta) {
|
|
259
318
|
this.stats.received_total += 1;
|
|
260
319
|
const validated = (0, messageEnvelope_1.validateNetworkMessageEnvelope)(envelope, {
|
|
261
320
|
max_future_drift_ms: this.maxFutureDriftMs,
|
|
@@ -294,7 +353,7 @@ class RelayPreviewAdapter {
|
|
|
294
353
|
this.stats.received_validated += 1;
|
|
295
354
|
const topicKey = message.topic;
|
|
296
355
|
const topic = topicKey.slice(this.namespace.length + 1);
|
|
297
|
-
const handlers =
|
|
356
|
+
const handlers = handlersByTopic.get(topicKey);
|
|
298
357
|
if (!handlers || handlers.size === 0)
|
|
299
358
|
return;
|
|
300
359
|
const peer = this.peers.get(message.source_peer_id);
|
|
@@ -312,7 +371,7 @@ class RelayPreviewAdapter {
|
|
|
312
371
|
}
|
|
313
372
|
for (const handler of handlers) {
|
|
314
373
|
try {
|
|
315
|
-
handler(payload);
|
|
374
|
+
handler(payload, meta || { peerId: message.source_peer_id });
|
|
316
375
|
this.stats.delivered_total += 1;
|
|
317
376
|
}
|
|
318
377
|
catch {
|
|
@@ -334,15 +393,20 @@ class RelayPreviewAdapter {
|
|
|
334
393
|
}
|
|
335
394
|
async joinRoom(reason) {
|
|
336
395
|
this.stats.join_attempted += 1;
|
|
337
|
-
await this.post("/join", { room: this.room, peer_id: this.peerId });
|
|
396
|
+
const payload = await this.post("/join", { room: this.room, peer_id: this.peerId });
|
|
338
397
|
this.lastJoinAt = Date.now();
|
|
339
398
|
this.stats.join_succeeded += 1;
|
|
399
|
+
if (Array.isArray(payload?.peers)) {
|
|
400
|
+
this.updatePeersFromList(payload.peers);
|
|
401
|
+
this.lastPeerRefreshAt = this.lastJoinAt;
|
|
402
|
+
}
|
|
340
403
|
this.recordDiscovery("join_ok", { endpoint: this.activeEndpoint, detail: reason });
|
|
341
404
|
}
|
|
342
405
|
async maybeRefreshJoin(reason) {
|
|
343
406
|
if (!this.lastJoinAt || Date.now() - this.lastJoinAt > Math.max(45_000, this.pollIntervalMs * 6)) {
|
|
344
407
|
await this.joinRoom(reason);
|
|
345
408
|
}
|
|
409
|
+
this.ensurePollingAlive(reason);
|
|
346
410
|
}
|
|
347
411
|
async get(path) {
|
|
348
412
|
return this.requestJson("GET", path);
|
|
@@ -400,13 +464,38 @@ class RelayPreviewAdapter {
|
|
|
400
464
|
throw new Error(errors.join(" | "));
|
|
401
465
|
}
|
|
402
466
|
updatePeersFromList(values) {
|
|
403
|
-
const
|
|
467
|
+
const parsedPeers = [];
|
|
468
|
+
for (const value of values) {
|
|
469
|
+
if (typeof value === "string") {
|
|
470
|
+
const peerId = String(value || "").trim();
|
|
471
|
+
if (peerId) {
|
|
472
|
+
parsedPeers.push({ peer_id: peerId });
|
|
473
|
+
}
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (value && typeof value === "object") {
|
|
477
|
+
const raw = value;
|
|
478
|
+
const peerId = String(raw.peer_id || "").trim();
|
|
479
|
+
if (!peerId) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
parsedPeers.push({
|
|
483
|
+
peer_id: peerId,
|
|
484
|
+
meta: {
|
|
485
|
+
signal_queue_size: Number(raw.signal_queue_size ?? 0),
|
|
486
|
+
relay_queue_size: Number(raw.relay_queue_size ?? 0),
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const peerIds = parsedPeers.map((peer) => peer.peer_id);
|
|
404
492
|
if (!peerIds.includes(this.peerId)) {
|
|
405
493
|
void this.joinRoom("self_missing_from_peers").catch(() => { });
|
|
406
494
|
}
|
|
407
495
|
const now = Date.now();
|
|
408
496
|
const next = new Map();
|
|
409
|
-
for (const
|
|
497
|
+
for (const peerInfo of parsedPeers) {
|
|
498
|
+
const peerId = peerInfo.peer_id;
|
|
410
499
|
if (peerId === this.peerId)
|
|
411
500
|
continue;
|
|
412
501
|
const existing = this.peers.get(peerId);
|
|
@@ -420,6 +509,7 @@ class RelayPreviewAdapter {
|
|
|
420
509
|
last_seen_at: now,
|
|
421
510
|
messages_seen: existing?.messages_seen ?? 0,
|
|
422
511
|
reconnect_attempts: existing?.reconnect_attempts ?? 0,
|
|
512
|
+
meta: peerInfo.meta || existing?.meta,
|
|
423
513
|
});
|
|
424
514
|
}
|
|
425
515
|
for (const peerId of this.peers.keys()) {
|
|
@@ -438,5 +528,21 @@ class RelayPreviewAdapter {
|
|
|
438
528
|
this.pollOnce().catch(() => { });
|
|
439
529
|
}, Math.max(1000, delayMs + jitterMs));
|
|
440
530
|
}
|
|
531
|
+
ensurePollingAlive(reason) {
|
|
532
|
+
if (!this.started)
|
|
533
|
+
return;
|
|
534
|
+
const pollStaleMs = Math.max(45_000, this.pollIntervalMs * 6);
|
|
535
|
+
const pollMissing = !this.poller;
|
|
536
|
+
const pollStale = Boolean(this.lastPollAt) && Date.now() - this.lastPollAt > pollStaleMs;
|
|
537
|
+
if (!pollMissing && !pollStale) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
this.recordDiscovery("poll_recover_scheduled", {
|
|
541
|
+
endpoint: this.activeEndpoint,
|
|
542
|
+
detail: `${reason}:${pollMissing ? "missing" : "stale"}`,
|
|
543
|
+
});
|
|
544
|
+
this.currentPollDelayMs = this.pollIntervalMs;
|
|
545
|
+
this.scheduleNextPoll(0);
|
|
546
|
+
}
|
|
441
547
|
}
|
|
442
548
|
exports.RelayPreviewAdapter = RelayPreviewAdapter;
|