Files
hakorune/docs/reference/boxes-system/p2p_box.md
Moe Charm 6eda81f5db 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>
2025-08-26 20:30:07 +09:00

1.4 KiB

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.