BREAKING EXPERIMENTAL: Holepunch-native hard migration (RPC core, shared storage, SDK v2)

BREAKING: All nodes must upgrade together. Legacy p2ns.core-request string
messages are rejected; invite/consensus control plane uses protomux-rpc
(invite.request, invite.ack, invite.relay*, consensus.*). Shared Corestore
namespaces are the default for plugin DBs and drives; USE_SHARED_CORESTORE_NAMESPACES=false
is debug-only. Admin plugin actions with params are validated before run.

EXPERIMENTAL: End-to-end RPC invite path reuses existing handlers via adapters;
invite wire still ships on the invite channel. Multi-peer invite/relay
integration tests are not in CI yet (core-rpc-smoke only).

SDK & channels:
- channel-rpc.js, sdk.channels.rpc (register/request/event)
- core-rpc.js for p2ns.core; action-params + plugin route validation
- sdk.db.getCore/reopen, sdk.state.getPeerChannelSnapshot,
  sdk.metrics.getHolepunchStats (schema v1)

Runtime:
- p2ns.js: RPC-first core invite/consensus; Hyperswarm firewall/reconnect
- channel-manager: required protomux-rpc per peer
- db-shared-namespace-migration; drive-manager shared namespaces
- proxy-server: invite.request RPC for joiners

Plugins: file.drop, global.profile, peer.directory, domain.consensus,
peer.visualize, example.plugin (RPC demo); peer.directory UI polish

Also: CI/smoke scripts, diagnostics hardening, plugin config schema validation,
admin action param modal, docs/RFCS, package-lock + engines.node >= 18
This commit is contained in:
Raven Scott
2026-05-28 10:51:19 -04:00
parent 4b783801c5
commit ea9124c429
49 changed files with 6576 additions and 215 deletions
+28
View File
@@ -1722,6 +1722,34 @@ const isConnected = sdk.channels.isPeerConnected('chat', peerId);
// Returns: boolean
```
### RPC channels (required for new plugins)
Protomux RPC is always enabled. Use typed methods instead of colon-delimited strings:
```javascript
sdk.channels.createChannel('sync', { encoding: 'json' });
sdk.channels.rpc.register('sync', {
'sync.push': async (payload) => {
// handle request, return JSON-serializable result
return { ok: true, received: payload };
}
});
const result = await sdk.channels.rpc.request('sync', peerId, 'sync.push', { id: 1 });
sdk.channels.rpc.event('sync', peerId, 'sync.notify', { id: 1 });
```
Core network invite/consensus uses `p2ns.core` RPC methods (`invite.request`, `invite.ack`, `consensus.removeDomain`, etc.) — see `includes/core/core-rpc.js`.
### Breaking migration notes (v2 channel contract)
- String control messages on `p2ns.core-request` are rejected; use RPC only.
- `USE_SHARED_CORESTORE_NAMESPACES` defaults to shared main Corestore (set `false` only for debugging).
- Admin actions with `params` are validated before execution (`string`, `number`, `boolean`).
- Use `sdk.state.getPeerChannelSnapshot()` instead of raw `peerChannels` Map shape.
- Use `sdk.metrics.getHolepunchStats()` for versioned Hypercore stats (`schemaVersion: 1`).
## Database Operations (HyperDB)
Provides HyperDB database access for plugins. See [HYPERDB.md](plugins/HYPERDB.md) for detailed documentation.