diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-15 02:22:05 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-15 02:22:05 +0200 |
| commit | adda9613fad48a68239e2dbd93321818a835c286 (patch) | |
| tree | 8835fd2ac3e203d3f3110bc45617c79eb982cd0d /packages/meshbay-cli/tests/fake_node.py | |
| parent | 419af660eeb8a4403e37a63c54a15586d04d5a8e (diff) | |
| download | meshbay-adda9613fad48a68239e2dbd93321818a835c286.tar.gz | |
feat(cli): chat --follow
chat GROUP --follow prints the last messages, then each one the node pushes,
until Ctrl+C (exit 130). The connection is pinged every half minute; one
that closes, fails or stops answering is opened again, and what was said
meanwhile is read from the history. Each message is printed once, by its
(device, nonce) pair, which the node stores once. With --json, one object
per line. The man page lists it, with an example, and its FILES now names
the device keys kept for the Tier 2 check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-cli/tests/fake_node.py')
| -rw-r--r-- | packages/meshbay-cli/tests/fake_node.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/meshbay-cli/tests/fake_node.py b/packages/meshbay-cli/tests/fake_node.py index 8f4356b..b4e64ff 100644 --- a/packages/meshbay-cli/tests/fake_node.py +++ b/packages/meshbay-cli/tests/fake_node.py @@ -76,6 +76,7 @@ class FakeNode: "pk_x25519": self.identity.pk_x, "added_by_pk": "", "add_sig": "", "add_nonce": "", "add_ts": 0}] self.members: dict[str, Identity] = {} # sender → the device it signs with + self.unresponsive = False # pings go unanswered, as a dead link's self.admin_ops: dict[str, dict] = {} def add(self, path: str, name: str, data: bytes, uploader_id: str = "") -> dict: @@ -273,6 +274,11 @@ class FakeChannel: return {"type": "chat_keys_resp", "group_id": GROUP_ID, **seal(n.gek, PURPOSE_CHAT_KEYS, "chat_keys_resp", GROUP_ID, payload)} + def _ping(self, msg): + if self.node.unresponsive: + return {"type": "error", "detail": "no answer"} + return {"type": "pong", "token": msg.get("token")} + def _group_roster_req(self, msg): n = self.node return {"type": "group_roster_resp", "group_id": GROUP_ID, |