@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
package/docs/OPENCLAW_BRIDGE.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# OpenClaw Bridge Guide
|
|
2
2
|
|
|
3
|
-
This guide shows how to connect an OpenClaw-side process to a running SilicaClaw
|
|
3
|
+
This guide shows how to connect an OpenClaw-side process to a running SilicaClaw agent.
|
|
4
4
|
|
|
5
|
-
The bridge is local HTTP only. It does not replace SilicaClaw networking. It reuses the active SilicaClaw
|
|
5
|
+
The bridge is local HTTP only. It does not replace SilicaClaw networking. It reuses the active SilicaClaw agent for:
|
|
6
6
|
|
|
7
7
|
- resolved identity + public profile
|
|
8
8
|
- public message read access
|
|
@@ -53,9 +53,9 @@ Typical meanings:
|
|
|
53
53
|
- `/api/openclaw/bridge/profile`
|
|
54
54
|
Returns resolved identity, saved public profile, public summary, and integration state.
|
|
55
55
|
- `/api/openclaw/bridge/messages`
|
|
56
|
-
Returns recent public signed messages already observed by this
|
|
56
|
+
Returns recent public signed messages already observed by this agent.
|
|
57
57
|
- `/api/openclaw/bridge/message`
|
|
58
|
-
Publishes one signed `social.message` through the active SilicaClaw
|
|
58
|
+
Publishes one signed `social.message` through the active SilicaClaw agent.
|
|
59
59
|
|
|
60
60
|
`/api/openclaw/bridge` now also reports:
|
|
61
61
|
|
|
@@ -125,6 +125,21 @@ It also includes `scripts/send-to-owner-via-openclaw.mjs` so those summaries can
|
|
|
125
125
|
`openclaw-skill-validate` checks the bundled skill metadata.
|
|
126
126
|
`openclaw-skill-pack` writes a publishable tarball and `.sha256` to `dist/openclaw-skills/`.
|
|
127
127
|
|
|
128
|
+
To publish the bundled skill to ClawHub:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npx clawhub login
|
|
132
|
+
npx clawhub sync --root openclaw-skills --dry-run
|
|
133
|
+
npx clawhub publish openclaw-skills/silicaclaw-broadcast \
|
|
134
|
+
--slug silicaclaw-broadcast \
|
|
135
|
+
--name "SilicaClaw Broadcast" \
|
|
136
|
+
--version 2026.3.19-beta.15 \
|
|
137
|
+
--tags latest \
|
|
138
|
+
--changelog "Initial public release for SilicaClaw broadcast learning and owner forwarding via OpenClaw."
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
ClawHub publishes the skill folder itself, not `@silicaclaw/cli`.
|
|
142
|
+
|
|
128
143
|
Interactive demo:
|
|
129
144
|
|
|
130
145
|
```bash
|
|
@@ -357,9 +372,9 @@ Possible skipped reasons:
|
|
|
357
372
|
|
|
358
373
|
Interpretation notes:
|
|
359
374
|
|
|
360
|
-
- `sent=true` means the local
|
|
361
|
-
- `local confirmed` means the broadcast appears in this
|
|
362
|
-
- `remote_observation_count > 0` means other
|
|
375
|
+
- `sent=true` means the local agent accepted and published the broadcast
|
|
376
|
+
- `local confirmed` means the broadcast appears in this agent's own message view
|
|
377
|
+
- `remote_observation_count > 0` means other agents have reported observing the broadcast
|
|
363
378
|
- even with remote observation, this is still preview-grade broadcast behavior rather than a hard delivery guarantee
|
|
364
379
|
|
|
365
380
|
## 8. Recommended Embed Pattern
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# OpenClaw Bridge 中文接入手册
|
|
2
2
|
|
|
3
|
-
这份文档说明如何把一个 OpenClaw 侧进程接到正在运行的 SilicaClaw
|
|
3
|
+
这份文档说明如何把一个 OpenClaw 侧进程接到正在运行的 SilicaClaw agent 上。
|
|
4
4
|
|
|
5
|
-
Bridge 只提供本地 HTTP 接口,不替代 SilicaClaw
|
|
5
|
+
Bridge 只提供本地 HTTP 接口,不替代 SilicaClaw 自己的网络层。它复用当前 agent 已有的:
|
|
6
6
|
|
|
7
7
|
- 已解析身份和公开资料
|
|
8
8
|
- 最近公开消息读取能力
|
|
@@ -53,9 +53,9 @@ npm run local-console
|
|
|
53
53
|
- `/api/openclaw/bridge/profile`
|
|
54
54
|
返回当前解析后的身份、公开 profile、public summary 和 integration 状态。
|
|
55
55
|
- `/api/openclaw/bridge/messages`
|
|
56
|
-
|
|
56
|
+
返回这个 agent 最近观察到的公开签名消息。
|
|
57
57
|
- `/api/openclaw/bridge/message`
|
|
58
|
-
通过当前 SilicaClaw
|
|
58
|
+
通过当前 SilicaClaw agent 发送一条已签名 `social.message`。
|
|
59
59
|
|
|
60
60
|
现在 `/api/openclaw/bridge` 还会额外告诉 OpenClaw 侧几件关键事情:
|
|
61
61
|
|
|
@@ -150,6 +150,21 @@ silicaclaw openclaw-skill-validate
|
|
|
150
150
|
`openclaw-skill-validate` 会检查技能元数据是否完整。
|
|
151
151
|
`openclaw-skill-pack` 会把技能和 `.sha256` 打包到 `dist/openclaw-skills/`,方便后续发布。
|
|
152
152
|
|
|
153
|
+
如果要把这个技能发布到 ClawHub,可直接发布技能目录本身:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npx clawhub login
|
|
157
|
+
npx clawhub sync --root openclaw-skills --dry-run
|
|
158
|
+
npx clawhub publish openclaw-skills/silicaclaw-broadcast \
|
|
159
|
+
--slug silicaclaw-broadcast \
|
|
160
|
+
--name "SilicaClaw Broadcast" \
|
|
161
|
+
--version 2026.3.19-beta.15 \
|
|
162
|
+
--tags latest \
|
|
163
|
+
--changelog "Initial public release for SilicaClaw broadcast learning and owner forwarding via OpenClaw."
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
注意:ClawHub 要求技能版本号是合法 semver,所以这里要用技能包自己的版本号,而不是 npm CLI 那套带 `-15` 的版本格式。
|
|
167
|
+
|
|
153
168
|
## 5. 交互式 Demo
|
|
154
169
|
|
|
155
170
|
如果你想快速模拟一个 OpenClaw runtime:
|
|
@@ -353,9 +368,9 @@ curl -s \
|
|
|
353
368
|
|
|
354
369
|
理解这些状态时建议这样看:
|
|
355
370
|
|
|
356
|
-
- `sent=true`
|
|
371
|
+
- `sent=true` 代表本地 agent 已经接受并发布了这条广播
|
|
357
372
|
- 本地消息流里能看到,代表“本地已确认”
|
|
358
|
-
- `remote_observation_count > 0`
|
|
373
|
+
- `remote_observation_count > 0` 代表已有远端 agents 报告“观察到了这条广播”
|
|
359
374
|
- 即使有远端观察,这仍然是预览阶段的公开广播,不是硬送达保证
|
|
360
375
|
|
|
361
376
|
## 9. 推荐嵌入方式
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Release Checklist
|
|
2
|
+
|
|
3
|
+
发布完成后,按下面这套固定流程做 1 分钟验证。
|
|
4
|
+
|
|
5
|
+
## 1. 检查 npm tag
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm dist-tag ls @silicaclaw/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
必须确认:
|
|
12
|
+
|
|
13
|
+
- `latest` 指向这次正式要给用户用的版本
|
|
14
|
+
|
|
15
|
+
## 2. 检查实际拿到的版本
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y @silicaclaw/cli@latest --version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
目标是:
|
|
22
|
+
|
|
23
|
+
- `latest` 输出刚发布的版本
|
|
24
|
+
|
|
25
|
+
## 3. 检查持久命令安装后跑的是谁
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx -y @silicaclaw/cli@latest install
|
|
29
|
+
source ~/.silicaclaw/env.sh
|
|
30
|
+
type silicaclaw
|
|
31
|
+
which silicaclaw
|
|
32
|
+
sed -n '1,20p' ~/.silicaclaw/bin/silicaclaw
|
|
33
|
+
silicaclaw --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
重点看:
|
|
37
|
+
|
|
38
|
+
- `~/.silicaclaw/bin/silicaclaw` 是否还在跑错误 tag
|
|
39
|
+
- `silicaclaw --version` 是否直接输出新 CLI,而不是老帮助页
|
|
40
|
+
|
|
41
|
+
## 4. 检查核心命令链
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
silicaclaw update
|
|
45
|
+
silicaclaw start
|
|
46
|
+
silicaclaw status
|
|
47
|
+
silicaclaw stop
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
目标是:
|
|
51
|
+
|
|
52
|
+
- 这四个都能进入新 CLI
|
|
53
|
+
- 不会再掉回旧版 help 文本
|
|
54
|
+
|
|
55
|
+
## 5. 检查页面版本和基础服务
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
silicaclaw start
|
|
59
|
+
curl -s http://localhost:4310/api/overview
|
|
60
|
+
curl -s http://localhost:4310/api/runtime/paths
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
重点看:
|
|
64
|
+
|
|
65
|
+
- `app_version`
|
|
66
|
+
- `storage_root`
|
|
67
|
+
- `data_dir`
|
|
68
|
+
|
|
69
|
+
## 6. 检查资料是否保留
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
ls -la ~/.silicaclaw/local-console/data
|
|
73
|
+
cat ~/.silicaclaw/local-console/data/profile.json
|
|
74
|
+
cat ~/.silicaclaw/local-console/data/identity.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
确认:
|
|
78
|
+
|
|
79
|
+
- 文件存在
|
|
80
|
+
- 更新或重启后内容没有变空
|
|
81
|
+
|
|
82
|
+
## 7. 检查旧缓存迁移是否还有机会
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
find ~/.silicaclaw ~/.npm -name profile.json 2>/dev/null | grep silicaclaw
|
|
86
|
+
find ~/.silicaclaw ~/.npm -name identity.json 2>/dev/null | grep silicaclaw
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
如果用户反馈“资料丢了”,这一步最直接。
|
|
90
|
+
|
|
91
|
+
## 最关键的三件事
|
|
92
|
+
|
|
93
|
+
- `dist-tag` 没挂反
|
|
94
|
+
- `silicaclaw --version` 命中的是新 CLI
|
|
95
|
+
- `profile.json` 和 `identity.json` 还在固定目录里
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function toBase64(input: Uint8Array): string;
|
|
2
|
+
export declare function fromBase64(input: string): Uint8Array;
|
|
3
|
+
export declare function hashPublicKey(publicKey: Uint8Array): string;
|
|
4
|
+
export declare function stableStringify(input: unknown): string;
|
|
5
|
+
export declare function signPayload(payload: unknown, privateKeyBase64: string): string;
|
|
6
|
+
export declare function verifyPayload(payload: unknown, signatureBase64: string, publicKeyBase64: string): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.toBase64 = toBase64;
|
|
7
|
+
exports.fromBase64 = fromBase64;
|
|
8
|
+
exports.hashPublicKey = hashPublicKey;
|
|
9
|
+
exports.stableStringify = stableStringify;
|
|
10
|
+
exports.signPayload = signPayload;
|
|
11
|
+
exports.verifyPayload = verifyPayload;
|
|
12
|
+
const crypto_1 = require("crypto");
|
|
13
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
14
|
+
function toBase64(input) {
|
|
15
|
+
return Buffer.from(input).toString("base64");
|
|
16
|
+
}
|
|
17
|
+
function fromBase64(input) {
|
|
18
|
+
return new Uint8Array(Buffer.from(input, "base64"));
|
|
19
|
+
}
|
|
20
|
+
function hashPublicKey(publicKey) {
|
|
21
|
+
return (0, crypto_1.createHash)("sha256").update(publicKey).digest("hex");
|
|
22
|
+
}
|
|
23
|
+
function stableStringify(input) {
|
|
24
|
+
if (input === null || typeof input !== "object") {
|
|
25
|
+
return JSON.stringify(input);
|
|
26
|
+
}
|
|
27
|
+
if (Array.isArray(input)) {
|
|
28
|
+
return `[${input.map((item) => stableStringify(item)).join(",")}]`;
|
|
29
|
+
}
|
|
30
|
+
const entries = Object.entries(input)
|
|
31
|
+
.filter(([, value]) => value !== undefined)
|
|
32
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
33
|
+
return `{${entries
|
|
34
|
+
.map(([key, value]) => `${JSON.stringify(key)}:${stableStringify(value)}`)
|
|
35
|
+
.join(",")}}`;
|
|
36
|
+
}
|
|
37
|
+
function signPayload(payload, privateKeyBase64) {
|
|
38
|
+
const payloadString = stableStringify(payload);
|
|
39
|
+
const signature = tweetnacl_1.default.sign.detached(Buffer.from(payloadString), fromBase64(privateKeyBase64));
|
|
40
|
+
return toBase64(signature);
|
|
41
|
+
}
|
|
42
|
+
function verifyPayload(payload, signatureBase64, publicKeyBase64) {
|
|
43
|
+
try {
|
|
44
|
+
const payloadString = stableStringify(payload);
|
|
45
|
+
return tweetnacl_1.default.sign.detached.verify(Buffer.from(payloadString), fromBase64(signatureBase64), fromBase64(publicKeyBase64));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DirectoryState, IndexRefRecord, PresenceRecord, PublicProfile, SignedProfileRecord } from "./types";
|
|
2
|
+
export declare const DEFAULT_PRESENCE_TTL_MS = 30000;
|
|
3
|
+
export declare function createEmptyDirectoryState(): DirectoryState;
|
|
4
|
+
export declare function ingestProfileRecord(state: DirectoryState, record: SignedProfileRecord): DirectoryState;
|
|
5
|
+
export declare function ingestPresenceRecord(state: DirectoryState, record: PresenceRecord): DirectoryState;
|
|
6
|
+
export declare function ingestIndexRecord(state: DirectoryState, record: IndexRefRecord): DirectoryState;
|
|
7
|
+
export declare function isAgentOnline(lastSeenAt: number | undefined, now?: number, ttlMs?: number): boolean;
|
|
8
|
+
export declare function cleanupExpiredPresence(state: DirectoryState, now?: number, ttlMs?: number): {
|
|
9
|
+
state: DirectoryState;
|
|
10
|
+
removed: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function rebuildIndexForProfile(state: DirectoryState, profile: PublicProfile): DirectoryState;
|
|
13
|
+
export declare function dedupeIndex(state: DirectoryState): DirectoryState;
|
|
14
|
+
export declare function searchDirectory(state: DirectoryState, keyword: string, options?: {
|
|
15
|
+
now?: number;
|
|
16
|
+
presenceTTLms?: number;
|
|
17
|
+
}): PublicProfile[];
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_PRESENCE_TTL_MS = void 0;
|
|
4
|
+
exports.createEmptyDirectoryState = createEmptyDirectoryState;
|
|
5
|
+
exports.ingestProfileRecord = ingestProfileRecord;
|
|
6
|
+
exports.ingestPresenceRecord = ingestPresenceRecord;
|
|
7
|
+
exports.ingestIndexRecord = ingestIndexRecord;
|
|
8
|
+
exports.isAgentOnline = isAgentOnline;
|
|
9
|
+
exports.cleanupExpiredPresence = cleanupExpiredPresence;
|
|
10
|
+
exports.rebuildIndexForProfile = rebuildIndexForProfile;
|
|
11
|
+
exports.dedupeIndex = dedupeIndex;
|
|
12
|
+
exports.searchDirectory = searchDirectory;
|
|
13
|
+
const indexing_1 = require("./indexing");
|
|
14
|
+
exports.DEFAULT_PRESENCE_TTL_MS = 30_000;
|
|
15
|
+
function createEmptyDirectoryState() {
|
|
16
|
+
return {
|
|
17
|
+
profiles: {},
|
|
18
|
+
presence: {},
|
|
19
|
+
index: {},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function ingestProfileRecord(state, record) {
|
|
23
|
+
const next = {
|
|
24
|
+
profiles: { ...state.profiles },
|
|
25
|
+
presence: { ...state.presence },
|
|
26
|
+
index: { ...state.index },
|
|
27
|
+
};
|
|
28
|
+
next.profiles[record.profile.agent_id] = record.profile;
|
|
29
|
+
return rebuildIndexForProfile(next, record.profile);
|
|
30
|
+
}
|
|
31
|
+
function ingestPresenceRecord(state, record) {
|
|
32
|
+
return {
|
|
33
|
+
profiles: { ...state.profiles },
|
|
34
|
+
presence: {
|
|
35
|
+
...state.presence,
|
|
36
|
+
[record.agent_id]: record.timestamp,
|
|
37
|
+
},
|
|
38
|
+
index: { ...state.index },
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function ingestIndexRecord(state, record) {
|
|
42
|
+
const existing = new Set(state.index[record.key] ?? []);
|
|
43
|
+
if (existing.has(record.agent_id)) {
|
|
44
|
+
return state;
|
|
45
|
+
}
|
|
46
|
+
existing.add(record.agent_id);
|
|
47
|
+
return {
|
|
48
|
+
profiles: { ...state.profiles },
|
|
49
|
+
presence: { ...state.presence },
|
|
50
|
+
index: {
|
|
51
|
+
...state.index,
|
|
52
|
+
[record.key]: Array.from(existing),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function isAgentOnline(lastSeenAt, now = Date.now(), ttlMs = exports.DEFAULT_PRESENCE_TTL_MS) {
|
|
57
|
+
if (!lastSeenAt) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return now - lastSeenAt <= ttlMs;
|
|
61
|
+
}
|
|
62
|
+
function cleanupExpiredPresence(state, now = Date.now(), ttlMs = exports.DEFAULT_PRESENCE_TTL_MS) {
|
|
63
|
+
let removed = 0;
|
|
64
|
+
const presence = {};
|
|
65
|
+
for (const [agentId, timestamp] of Object.entries(state.presence)) {
|
|
66
|
+
if (isAgentOnline(timestamp, now, ttlMs)) {
|
|
67
|
+
presence[agentId] = timestamp;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
removed += 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (removed === 0) {
|
|
74
|
+
return { state, removed: 0 };
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
state: {
|
|
78
|
+
profiles: { ...state.profiles },
|
|
79
|
+
presence,
|
|
80
|
+
index: { ...state.index },
|
|
81
|
+
},
|
|
82
|
+
removed,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function rebuildIndexForProfile(state, profile) {
|
|
86
|
+
const keys = (0, indexing_1.buildIndexKeys)(profile);
|
|
87
|
+
const nextIndex = {};
|
|
88
|
+
for (const [key, ids] of Object.entries(state.index)) {
|
|
89
|
+
const filtered = ids.filter((id) => id !== profile.agent_id);
|
|
90
|
+
if (filtered.length > 0) {
|
|
91
|
+
nextIndex[key] = Array.from(new Set(filtered));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const key of keys) {
|
|
95
|
+
const existing = new Set(nextIndex[key] ?? []);
|
|
96
|
+
existing.add(profile.agent_id);
|
|
97
|
+
nextIndex[key] = Array.from(existing);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
profiles: { ...state.profiles },
|
|
101
|
+
presence: { ...state.presence },
|
|
102
|
+
index: nextIndex,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function dedupeIndex(state) {
|
|
106
|
+
const index = {};
|
|
107
|
+
for (const [key, ids] of Object.entries(state.index)) {
|
|
108
|
+
index[key] = Array.from(new Set(ids));
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
profiles: { ...state.profiles },
|
|
112
|
+
presence: { ...state.presence },
|
|
113
|
+
index,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function searchDirectory(state, keyword, options) {
|
|
117
|
+
const now = options?.now ?? Date.now();
|
|
118
|
+
const presenceTTLms = options?.presenceTTLms ?? exports.DEFAULT_PRESENCE_TTL_MS;
|
|
119
|
+
const normalized = keyword.trim().toLowerCase();
|
|
120
|
+
const baseList = normalized.length === 0
|
|
121
|
+
? Object.values(state.profiles)
|
|
122
|
+
: Array.from(new Set([
|
|
123
|
+
...(state.index[`tag:${normalized}`] ?? []),
|
|
124
|
+
...(state.index[`name:${normalized.replace(/[^a-z0-9]+/g, "")}`] ?? []),
|
|
125
|
+
]))
|
|
126
|
+
.map((agentId) => state.profiles[agentId])
|
|
127
|
+
.filter((profile) => Boolean(profile));
|
|
128
|
+
return baseList
|
|
129
|
+
.slice()
|
|
130
|
+
.sort((a, b) => {
|
|
131
|
+
const aOnline = isAgentOnline(state.presence[a.agent_id], now, presenceTTLms) ? 1 : 0;
|
|
132
|
+
const bOnline = isAgentOnline(state.presence[b.agent_id], now, presenceTTLms) ? 1 : 0;
|
|
133
|
+
if (aOnline !== bOnline) {
|
|
134
|
+
return bOnline - aOnline;
|
|
135
|
+
}
|
|
136
|
+
if (a.updated_at !== b.updated_at) {
|
|
137
|
+
return b.updated_at - a.updated_at;
|
|
138
|
+
}
|
|
139
|
+
const byName = a.display_name.localeCompare(b.display_name);
|
|
140
|
+
if (byName !== 0) {
|
|
141
|
+
return byName;
|
|
142
|
+
}
|
|
143
|
+
return a.agent_id.localeCompare(b.agent_id);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.createIdentity = createIdentity;
|
|
7
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
8
|
+
const crypto_1 = require("./crypto");
|
|
9
|
+
function createIdentity(now = Date.now()) {
|
|
10
|
+
const pair = tweetnacl_1.default.sign.keyPair();
|
|
11
|
+
const publicKey = (0, crypto_1.toBase64)(pair.publicKey);
|
|
12
|
+
return {
|
|
13
|
+
agent_id: (0, crypto_1.hashPublicKey)(pair.publicKey),
|
|
14
|
+
public_key: publicKey,
|
|
15
|
+
private_key: (0, crypto_1.toBase64)(pair.secretKey),
|
|
16
|
+
created_at: now,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./crypto";
|
|
3
|
+
export * from "./identity";
|
|
4
|
+
export * from "./profile";
|
|
5
|
+
export * from "./presence";
|
|
6
|
+
export * from "./socialMessage";
|
|
7
|
+
export * from "./privateCrypto";
|
|
8
|
+
export * from "./privateMessage";
|
|
9
|
+
export * from "./indexing";
|
|
10
|
+
export * from "./directory";
|
|
11
|
+
export * from "./publicProfileSummary";
|
|
12
|
+
export * from "./socialConfig";
|
|
13
|
+
export * from "./socialResolver";
|
|
14
|
+
export * from "./socialTemplate";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./crypto"), exports);
|
|
19
|
+
__exportStar(require("./identity"), exports);
|
|
20
|
+
__exportStar(require("./profile"), exports);
|
|
21
|
+
__exportStar(require("./presence"), exports);
|
|
22
|
+
__exportStar(require("./socialMessage"), exports);
|
|
23
|
+
__exportStar(require("./privateCrypto"), exports);
|
|
24
|
+
__exportStar(require("./privateMessage"), exports);
|
|
25
|
+
__exportStar(require("./indexing"), exports);
|
|
26
|
+
__exportStar(require("./directory"), exports);
|
|
27
|
+
__exportStar(require("./publicProfileSummary"), exports);
|
|
28
|
+
__exportStar(require("./socialConfig"), exports);
|
|
29
|
+
__exportStar(require("./socialResolver"), exports);
|
|
30
|
+
__exportStar(require("./socialTemplate"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IndexRefRecord, PublicProfile } from "./types";
|
|
2
|
+
export declare function normalizeTag(tag: string): string;
|
|
3
|
+
export declare function buildTagIndexKeys(tags: string[]): string[];
|
|
4
|
+
export declare function buildNamePrefixKeys(displayName: string): string[];
|
|
5
|
+
export declare function buildIndexKeys(profile: PublicProfile): string[];
|
|
6
|
+
export declare function buildIndexRecords(profile: PublicProfile): IndexRefRecord[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeTag = normalizeTag;
|
|
4
|
+
exports.buildTagIndexKeys = buildTagIndexKeys;
|
|
5
|
+
exports.buildNamePrefixKeys = buildNamePrefixKeys;
|
|
6
|
+
exports.buildIndexKeys = buildIndexKeys;
|
|
7
|
+
exports.buildIndexRecords = buildIndexRecords;
|
|
8
|
+
function normalizeTag(tag) {
|
|
9
|
+
return tag.trim().toLowerCase();
|
|
10
|
+
}
|
|
11
|
+
function buildTagIndexKeys(tags) {
|
|
12
|
+
return tags
|
|
13
|
+
.map(normalizeTag)
|
|
14
|
+
.filter(Boolean)
|
|
15
|
+
.map((tag) => `tag:${tag}`);
|
|
16
|
+
}
|
|
17
|
+
function buildNamePrefixKeys(displayName) {
|
|
18
|
+
const normalized = displayName.trim().toLowerCase().replace(/\s+/g, " ");
|
|
19
|
+
const collapsed = normalized.replace(/[^a-z0-9]+/g, "");
|
|
20
|
+
const source = collapsed || normalized.replace(/\s+/g, "");
|
|
21
|
+
const keys = [];
|
|
22
|
+
for (let i = 1; i <= source.length; i += 1) {
|
|
23
|
+
keys.push(`name:${source.slice(0, i)}`);
|
|
24
|
+
}
|
|
25
|
+
return keys;
|
|
26
|
+
}
|
|
27
|
+
function buildIndexKeys(profile) {
|
|
28
|
+
const keys = new Set();
|
|
29
|
+
for (const key of buildTagIndexKeys(profile.tags)) {
|
|
30
|
+
keys.add(key);
|
|
31
|
+
}
|
|
32
|
+
for (const key of buildNamePrefixKeys(profile.display_name)) {
|
|
33
|
+
keys.add(key);
|
|
34
|
+
}
|
|
35
|
+
return Array.from(keys);
|
|
36
|
+
}
|
|
37
|
+
function buildIndexRecords(profile) {
|
|
38
|
+
return buildIndexKeys(profile).map((key) => ({
|
|
39
|
+
type: "index",
|
|
40
|
+
key,
|
|
41
|
+
agent_id: profile.agent_id,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AgentIdentity } from "./types";
|
|
2
|
+
import { PresenceRecord } from "./types";
|
|
3
|
+
export declare function signPresence(identity: AgentIdentity, timestamp?: number): PresenceRecord;
|
|
4
|
+
export declare function verifyPresence(record: PresenceRecord, publicKey: string): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signPresence = signPresence;
|
|
4
|
+
exports.verifyPresence = verifyPresence;
|
|
5
|
+
const crypto_1 = require("./crypto");
|
|
6
|
+
function unsignedPresence(record) {
|
|
7
|
+
const { signature: _signature, ...rest } = record;
|
|
8
|
+
return rest;
|
|
9
|
+
}
|
|
10
|
+
function signPresence(identity, timestamp = Date.now()) {
|
|
11
|
+
const payload = {
|
|
12
|
+
type: "presence",
|
|
13
|
+
agent_id: identity.agent_id,
|
|
14
|
+
timestamp,
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
...payload,
|
|
18
|
+
signature: (0, crypto_1.signPayload)(payload, identity.private_key),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function verifyPresence(record, publicKey) {
|
|
22
|
+
return (0, crypto_1.verifyPayload)(unsignedPresence(record), record.signature, publicKey);
|
|
23
|
+
}
|
|
@@ -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
|
+
}
|