@vdoninja/ninja-p2p 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.agents/skills/ninja-p2p/SKILL.md +102 -2
  2. package/.claude/skills/ninja-p2p/SKILL.md +209 -130
  3. package/.codex/skills/ninja-p2p/SKILL.md +102 -2
  4. package/CHANGELOG.md +113 -0
  5. package/README.md +1077 -775
  6. package/dashboard.html +370 -50
  7. package/dist/agent-state.js +9 -0
  8. package/dist/cli-lib.d.ts +40 -0
  9. package/dist/cli-lib.js +165 -2
  10. package/dist/cli.d.ts +2 -0
  11. package/dist/cli.js +501 -10
  12. package/dist/demo.d.ts +37 -0
  13. package/dist/demo.js +186 -0
  14. package/dist/doctor.d.ts +52 -0
  15. package/dist/doctor.js +219 -0
  16. package/dist/file-transfer.d.ts +15 -2
  17. package/dist/file-transfer.js +249 -15
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/message-bus.d.ts +15 -0
  21. package/dist/message-bus.js +32 -3
  22. package/dist/peer-registry.js +7 -0
  23. package/dist/protocol.d.ts +78 -1
  24. package/dist/protocol.js +42 -6
  25. package/dist/shared-folders.js +20 -1
  26. package/dist/social-stream.d.ts +100 -0
  27. package/dist/social-stream.js +254 -0
  28. package/dist/swarm-manager.d.ts +164 -0
  29. package/dist/swarm-manager.js +957 -0
  30. package/dist/swarm-session.d.ts +197 -0
  31. package/dist/swarm-session.js +465 -0
  32. package/dist/swarm-wire.d.ts +48 -0
  33. package/dist/swarm-wire.js +86 -0
  34. package/dist/swarm.d.ts +258 -0
  35. package/dist/swarm.js +694 -0
  36. package/dist/vdo-bridge.d.ts +62 -1
  37. package/dist/vdo-bridge.js +273 -23
  38. package/dist/vdoninja-sdk-types.d.ts +75 -0
  39. package/dist/vdoninja-sdk-types.js +10 -0
  40. package/dist/wake.d.ts +83 -0
  41. package/dist/wake.js +206 -0
  42. package/docs/protocol-and-reliability.md +231 -38
  43. package/docs/sdk-wishlist.md +236 -0
  44. package/docs/security.md +197 -0
  45. package/docs/social-stream-bridge.md +390 -0
  46. package/package.json +125 -116
package/CHANGELOG.md ADDED
@@ -0,0 +1,113 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ The largest release so far. Agents can now be woken by incoming mail, files move
6
+ as a swarm rather than a single push, and live stream chat can be piped into a
7
+ room.
8
+
9
+ ### Agents that act while you are away
10
+
11
+ - **`--on-message <command>` wake hooks.** A turn-based agent only acts when
12
+ something hands it a turn, so a message could sit unread forever. A wake hook
13
+ is that turn. Bursts are coalesced into one run, runs never overlap, and wakes
14
+ are rate limited — verified live by pointing two agents at each other and
15
+ confirming the runaway stayed at its configured rate.
16
+ - **`ninja-p2p wait`** blocks until mail arrives, for driving the loop yourself.
17
+
18
+ ### Swarm file transfer
19
+
20
+ `ninja-p2p seed <file>` and `ninja-p2p fetch <name-or-id>` add a bulk,
21
+ multi-recipient path alongside the existing one-to-one `send-file` flow.
22
+
23
+ - Files are content-addressed by sha256 and every chunk is hashed individually,
24
+ so a peer serving corrupt data is caught per chunk and routed around.
25
+ - A partial downloader is already a source, so downloaders serve each other and
26
+ total throughput holds steady as they are added.
27
+ - Chunk bytes travel on a dedicated binary channel rather than base64 inside
28
+ JSON, which keeps bulk traffic from blocking control messages. Needs
29
+ `@vdoninja/sdk` 1.4.1+; older peers fall back automatically, per request, so
30
+ mixed rooms work.
31
+ - Interrupted downloads resume, verifying what is already on disk by hashing it.
32
+ - Concurrent downloads of one file are kept apart by destination and locked, so
33
+ they cannot overwrite each other.
34
+ - Large chunk-hash manifests are requested in verified, bounded pages instead
35
+ of eventually exceeding the data-channel message limit.
36
+ - Seeding and final verification stream from disk, keeping memory bounded for
37
+ large files.
38
+
39
+ Median 12.7 MB/s for one downloader on a local network; roughly 13 MB/s total
40
+ across three. The multi-downloader figure varies substantially run to run — see
41
+ the README for the spread.
42
+
43
+ ### Live stream chat
44
+
45
+ - **`ninja-p2p ssn --session <id>`** bridges Social Stream Ninja — Twitch,
46
+ YouTube, Kick and everything else it aggregates — into a room as events on the
47
+ `social` topic, with a `say` command to reply to every platform at once.
48
+ The guides start with `--read-only`; publishing is an explicit opt-in.
49
+
50
+ ### Getting started and diagnosis
51
+
52
+ - **`ninja-p2p demo`** runs a full live round trip between two peers and prints
53
+ a pass or fail per step.
54
+ - **`ninja-p2p doctor`** checks Node, the native WebRTC module, signalling
55
+ reachability, and running sidecars.
56
+
57
+ ### Fixes
58
+
59
+ - Exit codes were wrong on every successful run: `@roamhq/wrtc` crashes during
60
+ native teardown at process exit, so a CLI that had done its job correctly
61
+ returned 139. Shutdown now waits for real teardown and exits explicitly.
62
+ - Shared folder paths could be escaped with a symlink. Containment is now
63
+ checked against the resolved real path.
64
+ - Peers were told a version that was typed in by hand and had drifted from the
65
+ released one. It is read from `package.json` now.
66
+ - A disconnect no longer logs that a reconnect is coming when it is not.
67
+ - Swarm traffic is never retained or replayed: it was filling the message
68
+ history ring, evicting the conversation that history replay exists to serve.
69
+ - Peer-controlled transfer IDs can no longer reach filesystem paths. Simple
70
+ file offers and chunks now have strict shape, sender, and size validation,
71
+ never overwrite an existing destination, and do not pollute message history.
72
+ - Wire envelopes have bounded identity and routing fields, and an established
73
+ WebRTC connection cannot silently switch to another peer's stream ID.
74
+ - Empty swarm files finish correctly, fresh downloads claim their lock before
75
+ the first chunk, and an invalid completed part is discarded instead of
76
+ poisoning every retry.
77
+ - The Social Stream bridge now works on the documented Node 20 floor via its
78
+ explicit `ws` fallback.
79
+ - The SDK dependency floor is now 1.4.1, enabling its binary, backpressure, and
80
+ teardown surfaces. Its npm tarball advertises but omits the declaration file,
81
+ so a narrow local type shim remains until a registry release includes it.
82
+ - Wake subprocess errors no longer crash or permanently wedge the runner, and
83
+ peer text is bounded before entering the process environment.
84
+ - The dashboard observes rejected sends, applies real data-channel
85
+ backpressure, validates inbound transfers, and reports delivery
86
+ acknowledgements.
87
+ - History replay now returns only broadcasts and messages involving the
88
+ requester; a peer can no longer disclose unrelated direct-message history.
89
+ - The mobile dashboard keeps chat controls reachable during long conversations,
90
+ hides replayed control-message noise, and reports intentional disconnects
91
+ accurately.
92
+ - The full suite now closes swarm fixtures deterministically on the Node 20
93
+ support floor. A reusable live swarm validator covers both the 1.4.1 binary
94
+ lane and the 1.4.0 base64 fallback.
95
+
96
+ ### Documentation
97
+
98
+ - A landing page at the project site, with the operator dashboard moved
99
+ alongside it. Existing `?room=` links still work.
100
+ - New: the security model, the Social Stream bridge guide, and a protocol and
101
+ reliability document covering how transfer actually behaves, including what
102
+ was measured and deliberately not built.
103
+ - The README and bundled Codex/Claude skills now distinguish simple sends,
104
+ allowlisted shared folders, browser limits, and resumable swarm transfer.
105
+ - The library guide now documents the actual binary API (`sendBinaryTo` and the
106
+ `binary` event) instead of implying that `sendRaw` bypasses JSON.
107
+ - Product messaging now leads with the user outcome — separate AI tools working
108
+ as a team — and presents Social Stream Ninja as an important optional
109
+ co-host, moderation, research, and live-production use case.
110
+
111
+ ## 0.1.4 and earlier
112
+
113
+ See the git history.