(self, from_agent: str, to_agent: str, content: str,
msg_type: str = "message", metadata: dict = None)
| 343 | Teaching version: no file locking; real CC uses proper-lockfile.""" |
| 344 | |
| 345 | def send(self, from_agent: str, to_agent: str, content: str, |
| 346 | msg_type: str = "message", metadata: dict = None): |
| 347 | msg = {"from": from_agent, "to": to_agent, |
| 348 | "content": content, "type": msg_type, |
| 349 | "ts": time.time(), "metadata": metadata or {}} |
| 350 | inbox = MAILBOX_DIR / f"{to_agent}.jsonl" |
| 351 | with open(inbox, "a") as f: |
| 352 | f.write(json.dumps(msg) + "\n") |
| 353 | print(f" \033[33m[bus] {from_agent} → {to_agent}: " |
| 354 | f"({msg_type}) {content[:50]}\033[0m") |
| 355 | |
| 356 | def read_inbox(self, agent: str) -> list[dict]: |
| 357 | inbox = MAILBOX_DIR / f"{agent}.jsonl" |
no outgoing calls
no test coverage detected