aion-server 0.31.0

Aion workflow server library: HTTP, gRPC, WebSocket, and worker endpoints. Run it with the `aion` binary from the aion-cli crate.
Documentation
#!/usr/bin/env python3
"""The ACP agent the assistant session cells spawn.

A conforming stdio agent with exactly the behaviour those cells measure and
nothing the host decides: it answers `initialize` (advertising `loadSession`,
so a resume is ATTEMPTED rather than refused before a spawn, and HTTP MCP
servers, so the Aion tools the registry wires in are not refused at
configuration), opens a session
on `session/new`, refuses every `session/load` by name (no prior conversation
lives in this process, so a resumable dormant session fails its spawn the way
the reload cells pin), answers `session/prompt` with one message chunk and an
`end_turn`, and keeps running until stdin closes, as every real agent does.

It starts in milliseconds on any box with `python3`; the shipped catalogue
entry launches `npx`, and a unit test with a Node launcher on its clock was red
whenever the box was compiling and a refusal wherever `npx` was absent."""
import json
import sys


def send(obj):
    sys.stdout.write(json.dumps(obj) + "\n")
    sys.stdout.flush()


for line in sys.stdin:
    line = line.strip()
    if not line:
        continue
    msg = json.loads(line)
    method = msg.get("method")
    ident = msg.get("id")
    if method == "initialize":
        send({"jsonrpc": "2.0", "id": ident, "result": {
            "protocolVersion": 1,
            "agentCapabilities": {"loadSession": True, "mcpCapabilities": {"http": True}},
            "authMethods": [],
            "agentInfo": {"name": "aion-stub-agent", "version": "0.0.0"}}})
    elif method == "session/new":
        send({"jsonrpc": "2.0", "id": ident, "result": {"sessionId": "stub-session"}})
    elif method == "session/load":
        wanted = (msg.get("params") or {}).get("sessionId")
        send({"jsonrpc": "2.0", "id": ident, "error": {
            "code": -32602,
            "message": "session/load: no conversation named %r lives in this agent" % (wanted,)}})
    elif method == "session/prompt":
        sid = msg["params"]["sessionId"]
        send({"jsonrpc": "2.0", "method": "session/update", "params": {"sessionId": sid, "update": {
            "sessionUpdate": "agent_message_chunk", "messageId": "stub-1",
            "content": {"type": "text", "text": "stub answer"}}}})
        send({"jsonrpc": "2.0", "id": ident, "result": {"stopReason": "end_turn"}})
    elif ident is not None:
        send({"jsonrpc": "2.0", "id": ident, "error": {
            "code": -32601, "message": "method not found: %s" % (method,)}})

sys.stderr.write("aion-stub-agent: stdin closed, exiting\n")
sys.stderr.flush()