holon-sh 0.0.1.dev22__tar.gz → 0.0.1.dev23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/PKG-INFO +1 -1
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/pyproject.toml +1 -1
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_events.py +7 -26
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_serve.py +4 -25
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/.gitignore +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/LICENSE +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/README.md +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/client.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/context.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/__init__.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/events/__init__.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/events/_client.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/events/_server.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/events/_wire.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/files/__init__.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/files/_client.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/files/_server.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/ext/files/_wire.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/py.typed +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/holon/serve.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/scripts/verify_distribution.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/fixtures/caller/holon/apps/__init__.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_elicit.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_files.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_package.py +0 -0
- {holon_sh-0.0.1.dev22 → holon_sh-0.0.1.dev23}/tests/test_runtime.py +0 -0
|
@@ -197,9 +197,11 @@ async def test_targeted_events_follow_shared_identity_but_isolate_anonymous_read
|
|
|
197
197
|
)
|
|
198
198
|
async with served(events) as port:
|
|
199
199
|
reader = client(port, user=user)
|
|
200
|
-
async with reader.subscribe("board.changed", {"board": "b1"}) as first:
|
|
200
|
+
async with reader.subscribe("board.changed", {"board": "b1", "n": 1}) as first:
|
|
201
201
|
subscription_id = await subscribed.get()
|
|
202
|
-
async with reader.subscribe(
|
|
202
|
+
async with reader.subscribe(
|
|
203
|
+
"board.changed", {"n": 1, "board": "b1"}
|
|
204
|
+
) as second:
|
|
203
205
|
say(changed, "b1", "private", to=subscription_id)
|
|
204
206
|
say(changed, "b1", "public")
|
|
205
207
|
assert await take(first, 2) == ["private", "public"]
|
|
@@ -207,24 +209,9 @@ async def test_targeted_events_follow_shared_identity_but_isolate_anonymous_read
|
|
|
207
209
|
assert (await anext(second)).event_id == expected
|
|
208
210
|
|
|
209
211
|
|
|
210
|
-
@
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
events, _ = declare(on_subscribe=lambda context, args, id: subscribed.append(args))
|
|
214
|
-
ann = {"x-holon-context": signed_in("ann")}
|
|
215
|
-
async with served(events) as port, httpx2.AsyncClient(headers=ann) as http:
|
|
216
|
-
for arguments in [
|
|
217
|
-
{"board": "b"},
|
|
218
|
-
{"n": 1, "board": "b"},
|
|
219
|
-
{"board": "b", "n": 1},
|
|
220
|
-
]:
|
|
221
|
-
params = {"name": "board.changed", "arguments": arguments}
|
|
222
|
-
assert "result" in await call(http, port, "events/poll", params)
|
|
223
|
-
assert subscribed == [{"board": "b"}, {"n": 1, "board": "b"}]
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
@pytest.mark.parametrize("targeted", [False, True])
|
|
227
|
-
@pytest.mark.parametrize("delivery", ["push", "poll"])
|
|
212
|
+
@pytest.mark.parametrize(
|
|
213
|
+
("delivery", "targeted"), [("push", False), ("poll", False), ("push", True)]
|
|
214
|
+
)
|
|
228
215
|
@asynchronous
|
|
229
216
|
async def test_a_subscription_behind_what_is_kept_is_told_of_the_gap_and_carries_on_but_a_stream_is_sent_all_emitted_to_its_subscription(
|
|
230
217
|
monkeypatch, delivery, targeted
|
|
@@ -370,11 +357,6 @@ async def test_the_messages_on_the_wire_are_the_sketchs():
|
|
|
370
357
|
("events/poll", {"name": "board.moved"}, -32023),
|
|
371
358
|
("events/poll", {"name": "board.changed", "arguments": {}}, INVALID_PARAMS),
|
|
372
359
|
("events/poll", changed_on("b1", 1), INVALID_PARAMS),
|
|
373
|
-
(
|
|
374
|
-
"events/stream",
|
|
375
|
-
{"name": "board.locked", "arguments": {"board": "b1"}},
|
|
376
|
-
-32026,
|
|
377
|
-
),
|
|
378
360
|
(
|
|
379
361
|
"events/poll",
|
|
380
362
|
{"name": "board.locked", "arguments": {"board": "secret"}},
|
|
@@ -519,6 +501,5 @@ async def test_a_subscription_from_the_cursor_read_with_a_snapshot_hears_every_c
|
|
|
519
501
|
) as changes:
|
|
520
502
|
assert changes.delivery == "push"
|
|
521
503
|
tell("once subscribed")
|
|
522
|
-
assert state["said"] == ["in the snapshot"]
|
|
523
504
|
assert await take(changes, 2) == ["after the snapshot", "once subscribed"]
|
|
524
505
|
await stop()
|
|
@@ -16,19 +16,14 @@ from mcp import Client
|
|
|
16
16
|
from mcp.server import MCPServer
|
|
17
17
|
from mcp.server.auth.middleware.auth_context import get_access_token
|
|
18
18
|
from mcp.server.mcpserver import Context
|
|
19
|
-
from mcp.server.streamable_http import CONTENT_TYPE_JSON, CONTENT_TYPE_SSE
|
|
20
19
|
from mcp.shared.exceptions import MCPError
|
|
21
|
-
from mcp.shared.inbound import MCP_METHOD_HEADER, MCP_PROTOCOL_VERSION_HEADER
|
|
22
20
|
from mcp.types import (
|
|
23
|
-
CLIENT_CAPABILITIES_META_KEY,
|
|
24
|
-
CLIENT_INFO_META_KEY,
|
|
25
|
-
JSONRPC_VERSION,
|
|
26
21
|
LATEST_PROTOCOL_VERSION,
|
|
27
|
-
PROTOCOL_VERSION_META_KEY,
|
|
28
22
|
)
|
|
29
23
|
from opentelemetry import propagate
|
|
30
24
|
from starlette.datastructures import Headers
|
|
31
25
|
from starlette.responses import RedirectResponse, Response
|
|
26
|
+
from test_events import request
|
|
32
27
|
|
|
33
28
|
from holon.client import Apps
|
|
34
29
|
from holon.context import Caller, Principal, RequestContext, _request, get_context
|
|
@@ -333,27 +328,12 @@ frontend = "web"
|
|
|
333
328
|
writer.write(b"\r\n")
|
|
334
329
|
assert (await reader.readline()).startswith(b"HTTP/1.1 200")
|
|
335
330
|
writer.close()
|
|
336
|
-
|
|
337
|
-
PROTOCOL_VERSION_META_KEY: LATEST_PROTOCOL_VERSION,
|
|
338
|
-
CLIENT_INFO_META_KEY: {"name": "test", "version": "1"},
|
|
339
|
-
CLIENT_CAPABILITIES_META_KEY: {},
|
|
340
|
-
}
|
|
341
|
-
stream = {
|
|
342
|
-
"jsonrpc": JSONRPC_VERSION,
|
|
343
|
-
"id": 7,
|
|
344
|
-
"method": "events/stream",
|
|
345
|
-
"params": {"name": "ticked", "arguments": {}, "_meta": meta},
|
|
346
|
-
}
|
|
347
|
-
headers = {
|
|
348
|
-
"accept": f"{CONTENT_TYPE_JSON}, {CONTENT_TYPE_SSE}",
|
|
349
|
-
MCP_PROTOCOL_VERSION_HEADER: LATEST_PROTOCOL_VERSION,
|
|
350
|
-
MCP_METHOD_HEADER: "events/stream",
|
|
351
|
-
}
|
|
331
|
+
ticked = request("events/stream", {"name": "ticked", "arguments": {}}, id=7)
|
|
352
332
|
async with (
|
|
353
333
|
Client(origin + "/mcp", mode=LATEST_PROTOCOL_VERSION) as client,
|
|
354
334
|
client.listen(tools_list_changed=True) as subscription,
|
|
355
335
|
httpx2.AsyncClient() as http,
|
|
356
|
-
http.stream("POST", origin + "/mcp",
|
|
336
|
+
http.stream("POST", origin + "/mcp", **ticked) as sent,
|
|
357
337
|
):
|
|
358
338
|
frames = sent.aiter_lines()
|
|
359
339
|
while not (await anext(frames)).startswith("data: "):
|
|
@@ -362,8 +342,7 @@ frontend = "web"
|
|
|
362
342
|
last = [frame async for frame in frames if frame.startswith("data: ")][-1]
|
|
363
343
|
async for _ in subscription:
|
|
364
344
|
pass
|
|
365
|
-
|
|
366
|
-
assert closed["id"] == 7 and "result" in closed
|
|
345
|
+
assert "result" in json.loads(last.removeprefix("data: "))
|
|
367
346
|
|
|
368
347
|
try:
|
|
369
348
|
asyncio.run(asyncio.wait_for(exercise(), timeout=20))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|