Files
hakorune/examples/p2p_ping_pong.nyash
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

45 lines
1.1 KiB
Plaintext

// 📡 P2P Two-Node Ping-Pong (InProcess)
// Uses MethodBox handlers to wire reply path.
print("🚀 P2P Two-Node Ping-Pong Start")
// Nodes
alice = new P2PBox("alice", "inprocess")
bob = new P2PBox("bob", "inprocess")
// Service box to hold node reference and implement handlers
box PingService {
init { node, name }
onPing(intent, sender) {
print("[" + me.name + "] recv " + intent.getName() + " from " + sender)
// reply pong back
reply = new IntentBox("pong", "{}")
me.node.send(sender, reply)
}
onPong(intent, sender) {
print("[" + me.name + "] recv " + intent.getName() + " from " + sender)
}
}
// Wire handlers
svcBob = new PingService()
svcBob.node = bob
svcBob.name = "bob"
bob.on("ping", new MethodBox(svcBob, "onPing"))
svcAlice = new PingService()
svcAlice.node = alice
svcAlice.name = "alice"
alice.on("pong", new MethodBox(svcAlice, "onPong"))
// Kick ping
alice.send("bob", new IntentBox("ping", "{}"))
// Show traces for determinism
print("alice.last=" + alice.getLastIntentName())
print("bob.last=" + bob.getLastIntentName())
print("✅ P2P Two-Node Ping-Pong Done")