T1 page by cursor: a state page continues from an opaque cursor in sequence order
mesh/state.page reads a state from an ordered watch starting after the cursor's sequence, never a replay of the bucket per page: each kept message once across the pages of a read, a key's older kept revisions included, at most 768 KB a page, next the opaque cursor, empty at the end. A value written after the read reached its bucket comes marked seen-again (the cursor carries that mark; the runner keeps nothing per read); a deleted key gets no entry. A state kept one bucket per node is read one node's bucket after another. Builds: design 47 H2 §779, H-A-254, H-A-382
This commit is contained in:
+18
-1
@@ -2,7 +2,8 @@
|
||||
# A tools bundle for the tool runner's whole test (design 47 H §774): MCP over stdio, no SDK. A tool `who`, the seat node-desk's verbs
|
||||
# `who` (answers at once) and `slow` (answers after three seconds), and a tool `reach` that asks the seat verb node-desk.fresh as the
|
||||
# bundle does, through the runtime's `mesh/ask`, and says what came back; a tool `hold`, which answers after the seconds it is given,
|
||||
# beside other calls (design 47 H2 §813 (12)).
|
||||
# beside other calls (design 47 H2 §813 (12)); a tool `page`, which reads one page of its state `pages` after the cursor it is given,
|
||||
# through the runtime's `mesh/state.page`, and says the keys, those seen again and the next cursor (design 47 H2 §779).
|
||||
import json, os, sys, threading, time
|
||||
|
||||
LOCK = threading.Lock()
|
||||
@@ -19,6 +20,7 @@ TOOLS = [
|
||||
{"name": "who", "description": "the module's own tool", "inputSchema": {"type": "object", "properties": {}}},
|
||||
{"name": "reach", "description": "asks the seat verb node-desk.fresh", "inputSchema": {"type": "object", "properties": {}}},
|
||||
{"name": "hold", "description": "answers after the seconds it is given, beside other calls", "inputSchema": {"type": "object", "properties": {"seconds": {"type": "number"}}}},
|
||||
{"name": "page", "description": "one page of the state pages after a cursor", "inputSchema": {"type": "object", "properties": {"cursor": {"type": "string"}}}},
|
||||
{"name": "node-desk.who", "description": "the seat's verb", "inputSchema": {"type": "object", "properties": {}}},
|
||||
{"name": "node-desk.slow", "description": "the seat's verb that answers late", "inputSchema": {"type": "object", "properties": {}}},
|
||||
]
|
||||
@@ -38,6 +40,21 @@ for line in sys.stdin:
|
||||
continue
|
||||
if name == "node-desk.slow":
|
||||
time.sleep(3)
|
||||
if name == "page":
|
||||
cursor = (p.get("arguments") or {}).get("cursor", "")
|
||||
say({"id": "p1", "method": "mesh/state.page", "params": {"state": "pages", "cursor": cursor}})
|
||||
for answer in sys.stdin:
|
||||
a = json.loads(answer)
|
||||
if a.get("id") == "p1":
|
||||
if "error" in a:
|
||||
text(rid, {"error": a["error"]})
|
||||
else:
|
||||
r = a.get("result") or {}
|
||||
es = r.get("entries") or []
|
||||
text(rid, {"keys": [e["key"] for e in es if not e.get("seen-again")],
|
||||
"again": [e["key"] for e in es if e.get("seen-again")], "next": r.get("next", "")})
|
||||
break
|
||||
continue
|
||||
if name == "reach":
|
||||
say({"id": "q1", "method": "mesh/ask", "params": {"key": "seat:node-desk.fresh", "body": {}}})
|
||||
for answer in sys.stdin:
|
||||
|
||||
Reference in New Issue
Block a user