feat: Major documentation reorganization and unified Box design updates
## Documentation & Organization - Moved copilot_issues.txt → 00_MASTER_ROADMAP.md (phases folder) - Created Phase 9.79b.1 & 9.79b.2 plans for unified Box implementation - Updated unified-box-design-deep-analysis.md with ChatGPT5 insights - Added P2P documentation and examples (ping-pong, self-ping) ## Code Updates - P2PBox: Reverted to original error state for demonstration - VM: Enhanced BoxCall dispatch for unified approach - Updated box factory, interpreter calls, and transport layer ## Cleanup & Privacy - Removed private/ and private_test/ from git tracking - Added private folders to .gitignore for security - Cleaned root directory: moved backups, removed temp files - Moved consultation files to docs/archive/consultations/ ## Other Improvements - Added object literal syntax improvement idea - Updated CLAUDE.md with master roadmap reference - Updated CURRENT_TASK.md with latest progress 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
39
docs/reference/boxes-system/p2p_box.md
Normal file
39
docs/reference/boxes-system/p2p_box.md
Normal file
@ -0,0 +1,39 @@
|
||||
# P2PBox - Modern P2P Node (InProcess)
|
||||
|
||||
Status: Experimental (Phase 9.79a)
|
||||
|
||||
## Overview
|
||||
- Structured messaging with `IntentBox(name, payload)`
|
||||
- Local in-process routing via `MessageBus`
|
||||
- Deterministic smoke demo available without timers
|
||||
|
||||
## API
|
||||
- `new P2PBox(nodeId: String, transport: String)`
|
||||
- `send(to: String|Box, intent: IntentBox) -> ResultBox`
|
||||
- `on(name: String, handler: MethodRef) -> ResultBox`
|
||||
- `onOnce(name: String, handler: MethodRef) -> ResultBox`
|
||||
- `off(name: String) -> ResultBox`
|
||||
- `getNodeId() -> String`
|
||||
- `isReachable(nodeId: String) -> Bool`
|
||||
- `getTransportType() -> String`
|
||||
- `debugNodes() -> String` (inprocess only)
|
||||
- `debugBusId() -> String` (inprocess only)
|
||||
- `getLastFrom() -> String` (loopback trace)
|
||||
- `getLastIntentName() -> String` (loopback trace)
|
||||
|
||||
Notes:
|
||||
- Handlers currently accept a method reference (`MethodBox`) rather than an inline function literal.
|
||||
- For quick loopback smoke without handlers, send to self and read `getLast*()`.
|
||||
|
||||
## Quick Smoke (No Handlers)
|
||||
```
|
||||
alice = new P2PBox("alice", "inprocess")
|
||||
msg = new IntentBox("ping", { })
|
||||
res = alice.send("alice", msg)
|
||||
print("last.from=" + alice.getLastFrom())
|
||||
print("last.intent=" + alice.getLastIntentName())
|
||||
```
|
||||
|
||||
## Two-Node Ping-Pong (Concept)
|
||||
This is covered in unit tests; handler wiring uses `MethodBox` internally. A higher-level sugar for method references will arrive in later phases.
|
||||
|
||||
Reference in New Issue
Block a user