@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,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSocialConfigSearchPaths = getSocialConfigSearchPaths;
|
|
4
|
+
exports.findSocialMd = findSocialMd;
|
|
5
|
+
exports.loadSocialConfig = loadSocialConfig;
|
|
6
|
+
exports.findOpenClawIdentity = findOpenClawIdentity;
|
|
7
|
+
exports.findOpenClawProfile = findOpenClawProfile;
|
|
8
|
+
exports.resolveIdentityWithSocial = resolveIdentityWithSocial;
|
|
9
|
+
exports.resolveProfileInputWithSocial = resolveProfileInputWithSocial;
|
|
10
|
+
exports.ensureDefaultSocialMd = ensureDefaultSocialMd;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const os_1 = require("os");
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const crypto_1 = require("./crypto");
|
|
15
|
+
const socialConfig_1 = require("./socialConfig");
|
|
16
|
+
function getSocialConfigSearchPaths(rootDir = process.cwd(), homeDir = (0, os_1.homedir)()) {
|
|
17
|
+
return [
|
|
18
|
+
(0, path_1.resolve)(rootDir, "social.md"),
|
|
19
|
+
(0, path_1.resolve)(rootDir, ".openclaw", "social.md"),
|
|
20
|
+
(0, path_1.resolve)(homeDir, ".openclaw", "social.md"),
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
function findSocialMd(rootDir = process.cwd()) {
|
|
24
|
+
const candidates = getSocialConfigSearchPaths(rootDir);
|
|
25
|
+
for (const path of candidates) {
|
|
26
|
+
if (!(0, fs_1.existsSync)(path))
|
|
27
|
+
continue;
|
|
28
|
+
return {
|
|
29
|
+
found: true,
|
|
30
|
+
source_path: path,
|
|
31
|
+
content: (0, fs_1.readFileSync)(path, "utf8"),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
found: false,
|
|
36
|
+
source_path: null,
|
|
37
|
+
content: null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function loadSocialConfig(rootDir = process.cwd()) {
|
|
41
|
+
const lookup = findSocialMd(rootDir);
|
|
42
|
+
if (!lookup.found || !lookup.content || !lookup.source_path) {
|
|
43
|
+
return {
|
|
44
|
+
config: (0, socialConfig_1.normalizeSocialConfig)({}),
|
|
45
|
+
meta: {
|
|
46
|
+
found: false,
|
|
47
|
+
source_path: null,
|
|
48
|
+
parse_error: null,
|
|
49
|
+
loaded_at: Date.now(),
|
|
50
|
+
},
|
|
51
|
+
raw_frontmatter: null,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const frontmatter = (0, socialConfig_1.extractFrontmatter)(lookup.content);
|
|
56
|
+
if (!frontmatter) {
|
|
57
|
+
return {
|
|
58
|
+
config: (0, socialConfig_1.normalizeSocialConfig)({}),
|
|
59
|
+
meta: {
|
|
60
|
+
found: true,
|
|
61
|
+
source_path: lookup.source_path,
|
|
62
|
+
parse_error: "frontmatter_not_found",
|
|
63
|
+
loaded_at: Date.now(),
|
|
64
|
+
},
|
|
65
|
+
raw_frontmatter: null,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const parsed = (0, socialConfig_1.parseFrontmatterObject)(frontmatter);
|
|
69
|
+
return {
|
|
70
|
+
config: (0, socialConfig_1.normalizeSocialConfig)(parsed),
|
|
71
|
+
meta: {
|
|
72
|
+
found: true,
|
|
73
|
+
source_path: lookup.source_path,
|
|
74
|
+
parse_error: null,
|
|
75
|
+
loaded_at: Date.now(),
|
|
76
|
+
},
|
|
77
|
+
raw_frontmatter: parsed,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
return {
|
|
82
|
+
config: (0, socialConfig_1.normalizeSocialConfig)({}),
|
|
83
|
+
meta: {
|
|
84
|
+
found: true,
|
|
85
|
+
source_path: lookup.source_path,
|
|
86
|
+
parse_error: error instanceof Error ? error.message : "social_parse_failed",
|
|
87
|
+
loaded_at: Date.now(),
|
|
88
|
+
},
|
|
89
|
+
raw_frontmatter: null,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function readJson(path) {
|
|
94
|
+
if (!(0, fs_1.existsSync)(path))
|
|
95
|
+
return null;
|
|
96
|
+
try {
|
|
97
|
+
return JSON.parse((0, fs_1.readFileSync)(path, "utf8"));
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function normalizeIdentity(input) {
|
|
104
|
+
if (typeof input !== "object" || input === null) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const value = input;
|
|
108
|
+
if (typeof value.public_key !== "string" || typeof value.private_key !== "string") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
let agentId = typeof value.agent_id === "string" ? value.agent_id : "";
|
|
112
|
+
if (!agentId) {
|
|
113
|
+
try {
|
|
114
|
+
agentId = (0, crypto_1.hashPublicKey)((0, crypto_1.fromBase64)(value.public_key));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
agent_id: agentId,
|
|
122
|
+
public_key: value.public_key,
|
|
123
|
+
private_key: value.private_key,
|
|
124
|
+
created_at: Number.isFinite(value.created_at) ? Number(value.created_at) : Date.now(),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function findOpenClawIdentity(rootDir = process.cwd(), homeDir = (0, os_1.homedir)()) {
|
|
128
|
+
const candidates = [
|
|
129
|
+
(0, path_1.resolve)(rootDir, ".openclaw", "identity.json"),
|
|
130
|
+
(0, path_1.resolve)(rootDir, "identity.json"),
|
|
131
|
+
(0, path_1.resolve)(homeDir, ".openclaw", "identity.json"),
|
|
132
|
+
];
|
|
133
|
+
for (const path of candidates) {
|
|
134
|
+
const parsed = readJson(path);
|
|
135
|
+
const identity = normalizeIdentity(parsed);
|
|
136
|
+
if (identity) {
|
|
137
|
+
return {
|
|
138
|
+
identity,
|
|
139
|
+
source_path: path,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
identity: null,
|
|
145
|
+
source_path: null,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function findOpenClawProfile(rootDir = process.cwd(), homeDir = (0, os_1.homedir)()) {
|
|
149
|
+
const candidates = [
|
|
150
|
+
(0, path_1.resolve)(rootDir, ".openclaw", "profile.json"),
|
|
151
|
+
(0, path_1.resolve)(rootDir, "profile.json"),
|
|
152
|
+
(0, path_1.resolve)(homeDir, ".openclaw", "profile.json"),
|
|
153
|
+
];
|
|
154
|
+
for (const path of candidates) {
|
|
155
|
+
const parsed = readJson(path);
|
|
156
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
157
|
+
continue;
|
|
158
|
+
const profile = parsed;
|
|
159
|
+
return {
|
|
160
|
+
source_path: path,
|
|
161
|
+
profile: {
|
|
162
|
+
display_name: typeof profile.display_name === "string" ? profile.display_name : "",
|
|
163
|
+
bio: typeof profile.bio === "string" ? profile.bio : "",
|
|
164
|
+
avatar_url: typeof profile.avatar_url === "string" ? profile.avatar_url : "",
|
|
165
|
+
tags: Array.isArray(profile.tags)
|
|
166
|
+
? profile.tags.map((tag) => String(tag).trim()).filter(Boolean)
|
|
167
|
+
: [],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
profile: null,
|
|
173
|
+
source_path: null,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function resolveIdentityWithSocial(args) {
|
|
177
|
+
const { socialConfig, existingIdentity, generatedIdentity } = args;
|
|
178
|
+
if (socialConfig.openclaw.bind_existing_identity) {
|
|
179
|
+
const openclaw = findOpenClawIdentity(args.rootDir ?? process.cwd());
|
|
180
|
+
if (openclaw.identity) {
|
|
181
|
+
return {
|
|
182
|
+
identity: openclaw.identity,
|
|
183
|
+
source: "openclaw-existing",
|
|
184
|
+
openclaw_source_path: openclaw.source_path,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (existingIdentity) {
|
|
189
|
+
return {
|
|
190
|
+
identity: existingIdentity,
|
|
191
|
+
source: "silicaclaw-existing",
|
|
192
|
+
openclaw_source_path: null,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
identity: generatedIdentity,
|
|
197
|
+
source: "silicaclaw-generated",
|
|
198
|
+
openclaw_source_path: null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function resolveProfileInputWithSocial(args) {
|
|
202
|
+
const { socialConfig, agentId, existingProfile } = args;
|
|
203
|
+
const openclawProfile = socialConfig.openclaw.use_openclaw_profile_if_available
|
|
204
|
+
? findOpenClawProfile(args.rootDir ?? process.cwd()).profile
|
|
205
|
+
: null;
|
|
206
|
+
const baseDisplayName = existingProfile?.display_name || "";
|
|
207
|
+
const baseBio = existingProfile?.bio || "";
|
|
208
|
+
const baseAvatarUrl = existingProfile?.avatar_url || "";
|
|
209
|
+
const baseTags = existingProfile?.tags || [];
|
|
210
|
+
// Preserve values saved from local-console first; only fall back to social/openclaw defaults
|
|
211
|
+
// when local profile fields are empty.
|
|
212
|
+
const displayName = baseDisplayName || socialConfig.identity.display_name || openclawProfile?.display_name || "";
|
|
213
|
+
const bio = baseBio || socialConfig.identity.bio || openclawProfile?.bio || "";
|
|
214
|
+
const avatarUrl = baseAvatarUrl || socialConfig.identity.avatar_url || openclawProfile?.avatar_url || "";
|
|
215
|
+
const tags = baseTags.length > 0
|
|
216
|
+
? baseTags
|
|
217
|
+
: socialConfig.identity.tags.length > 0
|
|
218
|
+
? socialConfig.identity.tags
|
|
219
|
+
: openclawProfile?.tags || [];
|
|
220
|
+
return {
|
|
221
|
+
agent_id: agentId,
|
|
222
|
+
display_name: displayName,
|
|
223
|
+
bio,
|
|
224
|
+
avatar_url: avatarUrl,
|
|
225
|
+
tags,
|
|
226
|
+
public_enabled: existingProfile?.public_enabled ?? socialConfig.public_enabled,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function ensureDefaultSocialMd(rootDir = process.cwd(), options = {}) {
|
|
230
|
+
const targetPath = (0, path_1.resolve)(rootDir, "social.md");
|
|
231
|
+
if ((0, fs_1.existsSync)(targetPath)) {
|
|
232
|
+
return { path: targetPath, created: false };
|
|
233
|
+
}
|
|
234
|
+
(0, fs_1.mkdirSync)(rootDir, { recursive: true });
|
|
235
|
+
(0, fs_1.writeFileSync)(targetPath, (0, socialConfig_1.generateDefaultSocialMdTemplate)(options), "utf8");
|
|
236
|
+
return { path: targetPath, created: true };
|
|
237
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSocialMdTemplate = generateSocialMdTemplate;
|
|
4
|
+
function asBool(value, fallback) {
|
|
5
|
+
return typeof value === "boolean" ? value : fallback;
|
|
6
|
+
}
|
|
7
|
+
function asString(value, fallback) {
|
|
8
|
+
return typeof value === "string" ? value : fallback;
|
|
9
|
+
}
|
|
10
|
+
function asStringArray(value, fallback) {
|
|
11
|
+
if (!Array.isArray(value))
|
|
12
|
+
return fallback;
|
|
13
|
+
return value.map((item) => String(item).trim()).filter(Boolean);
|
|
14
|
+
}
|
|
15
|
+
function yamlString(input) {
|
|
16
|
+
return JSON.stringify(input ?? "");
|
|
17
|
+
}
|
|
18
|
+
function yamlStringList(values, indent = " ") {
|
|
19
|
+
if (!values.length) {
|
|
20
|
+
return `${indent}[]`;
|
|
21
|
+
}
|
|
22
|
+
return values.map((value) => `${indent}- ${yamlString(value)}`).join("\n");
|
|
23
|
+
}
|
|
24
|
+
function generateSocialMdTemplate(runtimeConfig) {
|
|
25
|
+
const enabled = asBool(runtimeConfig?.enabled, true);
|
|
26
|
+
const publicEnabled = asBool(runtimeConfig?.public_enabled, false);
|
|
27
|
+
const profile = runtimeConfig?.resolved_profile ?? null;
|
|
28
|
+
const network = runtimeConfig?.resolved_network ?? null;
|
|
29
|
+
const discovery = runtimeConfig?.resolved_discovery ?? null;
|
|
30
|
+
const visibility = runtimeConfig?.visibility ?? null;
|
|
31
|
+
const openclaw = runtimeConfig?.openclaw ?? null;
|
|
32
|
+
const displayName = asString(profile?.display_name, "");
|
|
33
|
+
const bio = asString(profile?.bio, "");
|
|
34
|
+
const tags = asStringArray(profile?.tags, ["openclaw", "local-first"]);
|
|
35
|
+
const mode = network?.mode === "local" || network?.mode === "lan" || network?.mode === "global-preview"
|
|
36
|
+
? network.mode
|
|
37
|
+
: "global-preview";
|
|
38
|
+
const discoverable = asBool(discovery?.discoverable, true);
|
|
39
|
+
const allowProfileBroadcast = asBool(discovery?.allow_profile_broadcast, true);
|
|
40
|
+
const allowPresenceBroadcast = asBool(discovery?.allow_presence_broadcast, true);
|
|
41
|
+
const allowMessageBroadcast = asBool(discovery?.allow_message_broadcast, true);
|
|
42
|
+
const showDisplayName = asBool(visibility?.show_display_name, true);
|
|
43
|
+
const showBio = asBool(visibility?.show_bio, true);
|
|
44
|
+
const showTags = asBool(visibility?.show_tags, true);
|
|
45
|
+
const showAgentId = asBool(visibility?.show_agent_id, true);
|
|
46
|
+
const showLastSeen = asBool(visibility?.show_last_seen, true);
|
|
47
|
+
const showCapabilitiesSummary = asBool(visibility?.show_capabilities_summary, true);
|
|
48
|
+
const bindExistingIdentity = asBool(openclaw?.bind_existing_identity, true);
|
|
49
|
+
const useOpenClawProfile = asBool(openclaw?.use_openclaw_profile_if_available, true);
|
|
50
|
+
return `---
|
|
51
|
+
enabled: ${enabled}
|
|
52
|
+
public_enabled: ${publicEnabled}
|
|
53
|
+
|
|
54
|
+
identity:
|
|
55
|
+
display_name: ${yamlString(displayName)}
|
|
56
|
+
bio: ${yamlString(bio)}
|
|
57
|
+
tags:
|
|
58
|
+
${yamlStringList(tags.map((tag) => asString(tag, "")), " ")}
|
|
59
|
+
|
|
60
|
+
network:
|
|
61
|
+
mode: ${yamlString(mode)}
|
|
62
|
+
|
|
63
|
+
discovery:
|
|
64
|
+
discoverable: ${discoverable}
|
|
65
|
+
allow_profile_broadcast: ${allowProfileBroadcast}
|
|
66
|
+
allow_presence_broadcast: ${allowPresenceBroadcast}
|
|
67
|
+
allow_message_broadcast: ${allowMessageBroadcast}
|
|
68
|
+
|
|
69
|
+
visibility:
|
|
70
|
+
show_display_name: ${showDisplayName}
|
|
71
|
+
show_bio: ${showBio}
|
|
72
|
+
show_tags: ${showTags}
|
|
73
|
+
show_agent_id: ${showAgentId}
|
|
74
|
+
show_last_seen: ${showLastSeen}
|
|
75
|
+
show_capabilities_summary: ${showCapabilitiesSummary}
|
|
76
|
+
|
|
77
|
+
openclaw:
|
|
78
|
+
bind_existing_identity: ${bindExistingIdentity}
|
|
79
|
+
use_openclaw_profile_if_available: ${useOpenClawProfile}
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
# Social
|
|
83
|
+
|
|
84
|
+
Generated from current SilicaClaw runtime state.
|
|
85
|
+
|
|
86
|
+
- Save as \`social.md\` in your OpenClaw workspace.
|
|
87
|
+
- This export does not auto-overwrite any existing file.
|
|
88
|
+
- Advanced network fields are intentionally hidden in template and resolved in runtime.
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type AgentIdentity = {
|
|
2
|
+
agent_id: string;
|
|
3
|
+
public_key: string;
|
|
4
|
+
private_key: string;
|
|
5
|
+
created_at: number;
|
|
6
|
+
};
|
|
7
|
+
export type PrivateEncryptionKeyPair = {
|
|
8
|
+
public_key: string;
|
|
9
|
+
private_key: string;
|
|
10
|
+
created_at: number;
|
|
11
|
+
};
|
|
12
|
+
export type PublicProfile = {
|
|
13
|
+
agent_id: string;
|
|
14
|
+
display_name: string;
|
|
15
|
+
bio: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
avatar_url?: string;
|
|
18
|
+
private_encryption_public_key?: string;
|
|
19
|
+
public_enabled: boolean;
|
|
20
|
+
updated_at: number;
|
|
21
|
+
signature: string;
|
|
22
|
+
};
|
|
23
|
+
export type SignedProfileRecord = {
|
|
24
|
+
type: "profile";
|
|
25
|
+
profile: PublicProfile;
|
|
26
|
+
};
|
|
27
|
+
export type PresenceRecord = {
|
|
28
|
+
type: "presence";
|
|
29
|
+
agent_id: string;
|
|
30
|
+
timestamp: number;
|
|
31
|
+
signature: string;
|
|
32
|
+
};
|
|
33
|
+
export type IndexRefRecord = {
|
|
34
|
+
type: "index";
|
|
35
|
+
key: string;
|
|
36
|
+
agent_id: string;
|
|
37
|
+
};
|
|
38
|
+
export type SocialMessageRecord = {
|
|
39
|
+
type: "social.message";
|
|
40
|
+
message_id: string;
|
|
41
|
+
agent_id: string;
|
|
42
|
+
public_key: string;
|
|
43
|
+
display_name: string;
|
|
44
|
+
topic: string;
|
|
45
|
+
body: string;
|
|
46
|
+
created_at: number;
|
|
47
|
+
signature: string;
|
|
48
|
+
};
|
|
49
|
+
export type SocialMessageObservationRecord = {
|
|
50
|
+
type: "social.message.observation";
|
|
51
|
+
observation_id: string;
|
|
52
|
+
message_id: string;
|
|
53
|
+
observed_agent_id: string;
|
|
54
|
+
observer_agent_id: string;
|
|
55
|
+
observer_public_key: string;
|
|
56
|
+
observer_display_name: string;
|
|
57
|
+
observed_at: number;
|
|
58
|
+
signature: string;
|
|
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
|
+
};
|
|
94
|
+
export type DirectoryState = {
|
|
95
|
+
profiles: Record<string, PublicProfile>;
|
|
96
|
+
presence: Record<string, number>;
|
|
97
|
+
index: Record<string, string[]>;
|
|
98
|
+
};
|
|
99
|
+
export type ProfileInput = Omit<PublicProfile, "signature" | "updated_at">;
|
|
@@ -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";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import nacl from "tweetnacl";
|
|
2
|
+
import { fromBase64, toBase64 } from "./crypto";
|
|
3
|
+
import { PrivateEncryptionKeyPair } from "./types";
|
|
4
|
+
|
|
5
|
+
export function createPrivateEncryptionKeyPair(now = Date.now()): PrivateEncryptionKeyPair {
|
|
6
|
+
const pair = nacl.box.keyPair();
|
|
7
|
+
return {
|
|
8
|
+
public_key: toBase64(pair.publicKey),
|
|
9
|
+
private_key: toBase64(pair.secretKey),
|
|
10
|
+
created_at: now,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function encryptPrivatePayload(input: {
|
|
15
|
+
plaintext: string;
|
|
16
|
+
recipient_public_key: string;
|
|
17
|
+
sender_keypair?: PrivateEncryptionKeyPair | null;
|
|
18
|
+
}): {
|
|
19
|
+
ciphertext: string;
|
|
20
|
+
nonce: string;
|
|
21
|
+
sender_encryption_public_key: string;
|
|
22
|
+
} {
|
|
23
|
+
const sender = input.sender_keypair || createPrivateEncryptionKeyPair();
|
|
24
|
+
const nonce = nacl.randomBytes(nacl.box.nonceLength);
|
|
25
|
+
const message = Buffer.from(String(input.plaintext || ""), "utf8");
|
|
26
|
+
const ciphertext = nacl.box(
|
|
27
|
+
new Uint8Array(message),
|
|
28
|
+
nonce,
|
|
29
|
+
fromBase64(input.recipient_public_key),
|
|
30
|
+
fromBase64(sender.private_key),
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
ciphertext: toBase64(ciphertext),
|
|
34
|
+
nonce: toBase64(nonce),
|
|
35
|
+
sender_encryption_public_key: sender.public_key,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function decryptPrivatePayload(input: {
|
|
40
|
+
ciphertext: string;
|
|
41
|
+
nonce: string;
|
|
42
|
+
sender_encryption_public_key: string;
|
|
43
|
+
recipient_private_key: string;
|
|
44
|
+
}): string | null {
|
|
45
|
+
try {
|
|
46
|
+
const opened = nacl.box.open(
|
|
47
|
+
fromBase64(input.ciphertext),
|
|
48
|
+
fromBase64(input.nonce),
|
|
49
|
+
fromBase64(input.sender_encryption_public_key),
|
|
50
|
+
fromBase64(input.recipient_private_key),
|
|
51
|
+
);
|
|
52
|
+
if (!opened) return null;
|
|
53
|
+
return Buffer.from(opened).toString("utf8");
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentIdentity,
|
|
3
|
+
PrivateMessageReceiptRecord,
|
|
4
|
+
PrivateMessageRecord,
|
|
5
|
+
} from "./types";
|
|
6
|
+
import { fromBase64, hashPublicKey, signPayload, verifyPayload } from "./crypto";
|
|
7
|
+
|
|
8
|
+
function unsignedPrivateMessage(
|
|
9
|
+
record: PrivateMessageRecord
|
|
10
|
+
): Omit<PrivateMessageRecord, "signature"> {
|
|
11
|
+
const { signature: _signature, ...rest } = record;
|
|
12
|
+
return rest;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function unsignedPrivateMessageReceipt(
|
|
16
|
+
record: PrivateMessageReceiptRecord
|
|
17
|
+
): Omit<PrivateMessageReceiptRecord, "signature"> {
|
|
18
|
+
const { signature: _signature, ...rest } = record;
|
|
19
|
+
return rest;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function signPrivateMessage(input: {
|
|
23
|
+
identity: AgentIdentity;
|
|
24
|
+
message_id: string;
|
|
25
|
+
conversation_id: string;
|
|
26
|
+
to_agent_id: string;
|
|
27
|
+
sender_encryption_public_key: string;
|
|
28
|
+
recipient_encryption_public_key: string;
|
|
29
|
+
ciphertext: string;
|
|
30
|
+
nonce: string;
|
|
31
|
+
created_at?: number;
|
|
32
|
+
}): PrivateMessageRecord {
|
|
33
|
+
const payload: Omit<PrivateMessageRecord, "signature"> = {
|
|
34
|
+
type: "private.message",
|
|
35
|
+
message_id: input.message_id,
|
|
36
|
+
conversation_id: input.conversation_id,
|
|
37
|
+
from_agent_id: input.identity.agent_id,
|
|
38
|
+
to_agent_id: input.to_agent_id,
|
|
39
|
+
sender_public_key: input.identity.public_key,
|
|
40
|
+
sender_encryption_public_key: input.sender_encryption_public_key,
|
|
41
|
+
recipient_encryption_public_key: input.recipient_encryption_public_key,
|
|
42
|
+
cipher_scheme: "nacl-box-v1",
|
|
43
|
+
ciphertext: input.ciphertext,
|
|
44
|
+
nonce: input.nonce,
|
|
45
|
+
created_at: input.created_at ?? Date.now(),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
...payload,
|
|
50
|
+
signature: signPayload(payload, input.identity.private_key),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function verifyPrivateMessage(record: PrivateMessageRecord): boolean {
|
|
55
|
+
try {
|
|
56
|
+
if (hashPublicKey(fromBase64(record.sender_public_key)) !== record.from_agent_id) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return verifyPayload(unsignedPrivateMessage(record), record.signature, record.sender_public_key);
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function signPrivateMessageReceipt(input: {
|
|
66
|
+
identity: AgentIdentity;
|
|
67
|
+
receipt_id: string;
|
|
68
|
+
message_id: string;
|
|
69
|
+
conversation_id: string;
|
|
70
|
+
to_agent_id: string;
|
|
71
|
+
status: "received" | "read";
|
|
72
|
+
created_at?: number;
|
|
73
|
+
}): PrivateMessageReceiptRecord {
|
|
74
|
+
const payload: Omit<PrivateMessageReceiptRecord, "signature"> = {
|
|
75
|
+
type: "private.message.receipt",
|
|
76
|
+
receipt_id: input.receipt_id,
|
|
77
|
+
message_id: input.message_id,
|
|
78
|
+
conversation_id: input.conversation_id,
|
|
79
|
+
from_agent_id: input.identity.agent_id,
|
|
80
|
+
to_agent_id: input.to_agent_id,
|
|
81
|
+
sender_public_key: input.identity.public_key,
|
|
82
|
+
status: input.status,
|
|
83
|
+
created_at: input.created_at ?? Date.now(),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
...payload,
|
|
88
|
+
signature: signPayload(payload, input.identity.private_key),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function verifyPrivateMessageReceipt(record: PrivateMessageReceiptRecord): boolean {
|
|
93
|
+
try {
|
|
94
|
+
if (hashPublicKey(fromBase64(record.sender_public_key)) !== record.from_agent_id) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return verifyPayload(unsignedPrivateMessageReceipt(record), record.signature, record.sender_public_key);
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -13,6 +13,7 @@ export function signProfile(input: ProfileInput, identity: AgentIdentity): Publi
|
|
|
13
13
|
bio: input.bio,
|
|
14
14
|
tags: input.tags,
|
|
15
15
|
avatar_url: input.avatar_url,
|
|
16
|
+
private_encryption_public_key: input.private_encryption_public_key,
|
|
16
17
|
public_enabled: input.public_enabled,
|
|
17
18
|
updated_at: Date.now(),
|
|
18
19
|
};
|
|
@@ -34,6 +35,7 @@ export function createDefaultProfileInput(agentId: string): ProfileInput {
|
|
|
34
35
|
bio: "",
|
|
35
36
|
tags: [],
|
|
36
37
|
avatar_url: "",
|
|
38
|
+
private_encryption_public_key: "",
|
|
37
39
|
public_enabled: false,
|
|
38
40
|
};
|
|
39
41
|
}
|
|
@@ -10,9 +10,11 @@ export type ProfileVisibility = {
|
|
|
10
10
|
|
|
11
11
|
export type PublicProfileSummary = {
|
|
12
12
|
agent_id: string;
|
|
13
|
+
is_self: boolean;
|
|
13
14
|
display_name: string;
|
|
14
15
|
bio: string;
|
|
15
16
|
avatar_url?: string;
|
|
17
|
+
private_encryption_public_key?: string;
|
|
16
18
|
public_enabled: boolean;
|
|
17
19
|
updated_at: number;
|
|
18
20
|
online: boolean;
|
|
@@ -33,6 +35,7 @@ export type PublicProfileSummary = {
|
|
|
33
35
|
display_name: string;
|
|
34
36
|
bio: string;
|
|
35
37
|
avatar_url?: string;
|
|
38
|
+
private_encryption_public_key?: string;
|
|
36
39
|
tags: string[];
|
|
37
40
|
public_enabled: boolean;
|
|
38
41
|
profile_version: string;
|
|
@@ -73,6 +76,7 @@ export function deriveCapabilitiesSummary(tags: string[]): string[] {
|
|
|
73
76
|
|
|
74
77
|
export function buildPublicProfileSummary(args: {
|
|
75
78
|
profile: PublicProfile;
|
|
79
|
+
is_self?: boolean;
|
|
76
80
|
online: boolean;
|
|
77
81
|
last_seen_at: number | null;
|
|
78
82
|
network_mode?: string;
|
|
@@ -130,9 +134,11 @@ export function buildPublicProfileSummary(args: {
|
|
|
130
134
|
|
|
131
135
|
return {
|
|
132
136
|
agent_id: args.profile.agent_id,
|
|
137
|
+
is_self: Boolean(args.is_self),
|
|
133
138
|
display_name: args.profile.display_name,
|
|
134
139
|
bio: args.profile.bio,
|
|
135
140
|
avatar_url: args.profile.avatar_url,
|
|
141
|
+
private_encryption_public_key: args.profile.private_encryption_public_key,
|
|
136
142
|
public_enabled: args.profile.public_enabled,
|
|
137
143
|
updated_at: args.profile.updated_at,
|
|
138
144
|
online: args.online,
|
|
@@ -153,6 +159,7 @@ export function buildPublicProfileSummary(args: {
|
|
|
153
159
|
display_name: args.profile.display_name,
|
|
154
160
|
bio: args.profile.bio,
|
|
155
161
|
avatar_url: args.profile.avatar_url,
|
|
162
|
+
private_encryption_public_key: args.profile.private_encryption_public_key,
|
|
156
163
|
tags,
|
|
157
164
|
public_enabled: args.profile.public_enabled,
|
|
158
165
|
profile_version: args.profile_version ?? "v1",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import defaults from "../../../config/silicaclaw-defaults.json";
|
|
2
|
+
|
|
1
3
|
export type SocialIdentityConfig = {
|
|
2
4
|
display_name: string;
|
|
3
5
|
bio: string;
|
|
@@ -105,13 +107,13 @@ const DEFAULT_SOCIAL_CONFIG: SocialConfig = {
|
|
|
105
107
|
tags: [],
|
|
106
108
|
},
|
|
107
109
|
network: {
|
|
108
|
-
mode:
|
|
109
|
-
namespace:
|
|
110
|
+
mode: defaults.network.default_mode as SocialNetworkMode,
|
|
111
|
+
namespace: defaults.network.default_namespace,
|
|
110
112
|
adapter: "relay-preview",
|
|
111
|
-
port:
|
|
112
|
-
signaling_url:
|
|
113
|
+
port: defaults.ports.network_default,
|
|
114
|
+
signaling_url: defaults.network.global_preview.relay_url,
|
|
113
115
|
signaling_urls: [],
|
|
114
|
-
room:
|
|
116
|
+
room: defaults.network.global_preview.room,
|
|
115
117
|
seed_peers: [],
|
|
116
118
|
bootstrap_hints: [],
|
|
117
119
|
},
|