Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

anna-app-runtime-local

Local-dev in-memory runtime for Anna Apps. Reuses the production anna_app_rpc_dispatcher through WindowStoreProtocol so harness behaviour is byte-identical to nexus production.

How it shares code with production

This package does not vendor a copy of the dispatcher. Instead it:

  1. Imports dispatch, WindowStoreProtocol, HostRpcError from src.services.anna_app_rpc_dispatcher (matrix-nexus source).
  2. Provides InMemoryWindowStore — a WindowStoreProtocol impl that keeps state in dictionaries and queues SSE events in memory.
  3. Wires the production dispatch(store, …) against in-memory state.

Because the wheel imports src.services.… directly, the bridge process must be launched from a Python environment that has matrix-nexus on PYTHONPATH (typically: cd matrix-nexus && uv run python -m anna_app_runtime_local.bridge).

Public surface

from anna_app_runtime_local import LocalDispatcherSession, mint_dev_token

session = LocalDispatcherSession.create(
    user_id=1,
    app_slug="focus-flow",
    manifest_dict={...},  # parsed manifest.json
    view="main",
    entry_payload={"topic": "ECM"},
)
result = await session.call("storage", "set", {"key": "x", "value": 42})
events = session.drain_events()  # list[dict] for SSE relay

stdio bridge

python -m anna_app_runtime_local.bridge

Speaks JSON-RPC 2.0 over stdin/stdout (one envelope per line). Methods:

  • session.create → { session_id, window_uuid, token, view, view_meta }
  • session.call → forwards to dispatch(); returns { ok, result | error }
  • session.drain_events → flushes queued SSE events
  • session.close → drops the session
  • session.refresh_token → re-mints a dev token for an active session
  • executas.register → registers {tool_id, project_dir, command?} for tools.invoke; first call lazy-spawns uv run --project <dir> <tool_id> and reuses the warm subprocess.

The Node-side harness (anna-app-cli/src/harness/bridge.ts) speaks this protocol over python-shell.

Local HMAC tokens

mint_dev_token / verify_dev_token use a per-user key at ~/.anna-app/dev.key (mode 600, generated on first use). TTL defaults to 30 s — shorter than production's 120 s — to surface SDK refresh bugs early.

These tokens are not interoperable with the production JWT path; production's _is_tool_allowed already rejects tool-dev-… prefixes.

Release files for anna-app-runtime-local 0.2.0a25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anna-app-runtime-local 0.2.0a25
File Size Uploaded
anna_app_runtime_local-0.2.0a25.tar.gz 53.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anna-app-runtime-local 0.2.0a25
File Interpreter ABI Platform
anna_app_runtime_local-0.2.0a25-py3-none-any.whl Python 3 none any Details

Total release size: 98.0 kB

Release files / anna_app_runtime_local-0.2.0a25.tar.gz

Download URL anna_app_runtime_local-0.2.0a25.tar.gz
Size 53.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d963dabdcd7b8f60a38d96fb2852b64bd327502ea3e9c24da235be43aa9d0a30
BLAKE2b-256 checksum
How to use checksums
dcb29e12d2fe57b66c59c9b51231fa23c7f2e709db19d980a4a6f7e50138c8af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / anna_app_runtime_local-0.2.0a25-py3-none-any.whl

Download URL anna_app_runtime_local-0.2.0a25-py3-none-any.whl
Size 44.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8befb294b7435d01a907d4aca5bd949f488fc6338c5b3532313feac55f4ce1d
BLAKE2b-256 checksum
How to use checksums
f3c81924a557c65b4d834c90ad18574549f2f4939a8dd7e02df5343e34e46e25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page