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:
44
examples/p2p_ping_pong.nyash
Normal file
44
examples/p2p_ping_pong.nyash
Normal file
@ -0,0 +1,44 @@
|
||||
// 📡 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")
|
||||
26
examples/p2p_self_ping.nyash
Normal file
26
examples/p2p_self_ping.nyash
Normal file
@ -0,0 +1,26 @@
|
||||
// 📡 P2P Self Ping Smoke
|
||||
// Purpose: Minimal, deterministic P2PBox demo without external timing.
|
||||
// Shows send(to=self) loopback traces and universal methods.
|
||||
|
||||
print("🚀 P2P Self Ping Smoke Start")
|
||||
|
||||
// Create node 'alice' on inprocess transport
|
||||
alice = new P2PBox("alice", "inprocess")
|
||||
|
||||
// Show basic info
|
||||
print("node=" + alice.getNodeId() + ", transport=" + alice.getTransportType())
|
||||
|
||||
// Create an IntentBox and send to self
|
||||
msg = new IntentBox("ping", "{}")
|
||||
res = alice.send("alice", msg)
|
||||
print("send result=" + res.toString())
|
||||
|
||||
// Read back last received traces (populated for self-loop)
|
||||
print("last.from=" + alice.getLastFrom())
|
||||
print("last.intent=" + alice.getLastIntentName())
|
||||
|
||||
// Show debug helpers
|
||||
print("nodes=" + alice.debugNodes())
|
||||
print("bus=" + alice.debugBusId())
|
||||
|
||||
print("✅ P2P Self Ping Smoke Done")
|
||||
Reference in New Issue
Block a user