Local-dev in-memory runtime for Anna Apps. Wraps anna-app-core's dispatcher with an InMemoryWindowStore + WebSocket bridge.
Project description
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:
- Imports
dispatch,WindowStoreProtocol,HostRpcErrorfromsrc.services.anna_app_rpc_dispatcher(matrix-nexus source). - Provides
InMemoryWindowStore— aWindowStoreProtocolimpl that keeps state in dictionaries and queues SSE events in memory. - 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 todispatch(); returns{ ok, result | error }session.drain_events→ flushes queued SSE eventssession.close→ drops the sessionsession.refresh_token→ re-mints a dev token for an active sessionexecutas.register→ registers{tool_id, project_dir, command?}fortools.invoke; first call lazy-spawnsuv 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anna_app_runtime_local-0.2.0a1.tar.gz.
File metadata
- Download URL: anna_app_runtime_local-0.2.0a1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
130b8c557d0577f35020fcb015b38565a8c1cfed684c91a004ec295f491db5ba
|
|
| MD5 |
6c787b603f5145dd64c7d222894621d3
|
|
| BLAKE2b-256 |
ebec13a5236922bbacacfb1d0778e385792bbdd64fd33a632900fe4092a3b389
|
File details
Details for the file anna_app_runtime_local-0.2.0a1-py3-none-any.whl.
File metadata
- Download URL: anna_app_runtime_local-0.2.0a1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be66670b44a289939e441e45bd76fd0b38bba4ca820f3cc4bde27eb44963b86b
|
|
| MD5 |
b71e7ef68867a934d060870ae37f91d7
|
|
| BLAKE2b-256 |
e9bcfc23b6362c6057550b1953496915fd4a454e05f3feb055391e2b1b333f46
|