anna-app-runtime-local 0.2.0a32__tar.gz → 0.2.0a33__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.
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/PKG-INFO +2 -2
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/pyproject.toml +2 -2
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/__init__.py +1 -1
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/session.py +22 -27
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/store.py +2 -3
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_local_dispatch.py +15 -9
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_reverse_rpc.py +3 -3
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/.gitignore +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/README.md +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/bridge.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/executa.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/jobs.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/token.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/src/anna_app_runtime_local/web_local.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/__init__.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/conftest.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_frame_limits.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_tool_jobs.py +0 -0
- {anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_web_local_images.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: anna-app-runtime-local
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.0a33
|
|
4
4
|
Summary: Local-dev in-memory runtime for Anna Apps. Wraps anna-app-core's dispatcher with an InMemoryWindowStore + WebSocket bridge.
|
|
5
5
|
Author: Talent AI
|
|
6
6
|
License: Proprietary
|
|
7
7
|
Keywords: anna,anna-app,dev,executa,harness
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
|
-
Requires-Dist: anna-app-core<0.
|
|
9
|
+
Requires-Dist: anna-app-core<0.29,>=0.28.0
|
|
10
10
|
Requires-Dist: ddgs<10,>=9.13
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "anna-app-runtime-local"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.0a33"
|
|
4
4
|
description = "Local-dev in-memory runtime for Anna Apps. Wraps anna-app-core's dispatcher with an InMemoryWindowStore + WebSocket bridge."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -36,7 +36,7 @@ keywords = ["anna", "anna-app", "executa", "dev", "harness"]
|
|
|
36
36
|
# (platform-media-generation-music §7) — same bridge-forward / not_implemented
|
|
37
37
|
# contract as video.*.
|
|
38
38
|
dependencies = [
|
|
39
|
-
"anna-app-core>=0.
|
|
39
|
+
"anna-app-core>=0.28.0,<0.29",
|
|
40
40
|
"ddgs>=9.13,<10",
|
|
41
41
|
]
|
|
42
42
|
|
|
@@ -86,9 +86,11 @@ class LocalDispatcherSession:
|
|
|
86
86
|
app_slug: str | None = None,
|
|
87
87
|
store: InMemoryWindowStore | None = None,
|
|
88
88
|
) -> "LocalDispatcherSession":
|
|
89
|
-
from anna_app_core import AppManifest
|
|
89
|
+
from anna_app_core import AppManifest, normalize_legacy_manifest
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
# Harness ingest point (design app-permission-system-removal.md §5.2):
|
|
92
|
+
# schema ≤ 3 manifests are folded to schema 4 exactly like nexus does.
|
|
93
|
+
manifest = AppManifest.model_validate(normalize_legacy_manifest(manifest_dict))
|
|
92
94
|
|
|
93
95
|
if store is None:
|
|
94
96
|
store = InMemoryWindowStore()
|
|
@@ -196,20 +198,18 @@ _REVERSE_RPC_ROUTE: dict[str, tuple[str, str]] = {
|
|
|
196
198
|
"image/generate": ("image", "generate"),
|
|
197
199
|
"image/edit": ("image", "edit"),
|
|
198
200
|
# NOTE: ``host/uploadFile`` is deliberately NOT in this table. It is an
|
|
199
|
-
# executa-originated capability
|
|
200
|
-
# ``
|
|
201
|
-
#
|
|
202
|
-
#
|
|
203
|
-
# :class:`LocalServerRequestHandler` below (see ``_UPLOAD_MODE_TO_HOST``).
|
|
201
|
+
# executa-originated capability authorized by the EXECUTA's own
|
|
202
|
+
# ``upload_token`` in production (matrix → nexus executa_upload_gate). It
|
|
203
|
+
# is handled by the dedicated branch in :class:`LocalServerRequestHandler`
|
|
204
|
+
# below (see ``_UPLOAD_MODE_TO_HOST``).
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
|
|
207
208
|
# APS Files (object storage) reverse-RPC method → nexus storage REST method.
|
|
208
209
|
#
|
|
209
|
-
#
|
|
210
|
-
# production an executa's ``files/*`` calls travel on the executa's OWN
|
|
210
|
+
# In production an executa's ``files/*`` calls travel on the executa's OWN
|
|
211
211
|
# ``storage_token`` (matrix Agent → ``/api/v1/storage/files/*``) and never
|
|
212
|
-
# touch the app
|
|
212
|
+
# touch the hosting app. The local harness mirrors that by forwarding to
|
|
213
213
|
# ``host.storage.files_*`` over the python→node bridge, which the Node
|
|
214
214
|
# ``LlmBridge`` turns into the matching ``/api/v1/storage/files/*`` request
|
|
215
215
|
# using a minted ``storage_token`` — byte-for-byte the same path as
|
|
@@ -217,9 +217,8 @@ _REVERSE_RPC_ROUTE: dict[str, tuple[str, str]] = {
|
|
|
217
217
|
#
|
|
218
218
|
# Previously ``files/upload_begin`` / ``files/upload_complete`` were
|
|
219
219
|
# misrouted onto the host-mediated ``upload.negotiate`` / ``upload.confirm``
|
|
220
|
-
# facade, which
|
|
221
|
-
#
|
|
222
|
-
# Files via executa always failed under ``anna-app dev --storage aps``.
|
|
220
|
+
# facade, which hit a different backend — so APS Files via executa always
|
|
221
|
+
# failed under ``anna-app dev --storage aps``.
|
|
223
222
|
_FILES_REVERSE_RPC: dict[str, str] = {
|
|
224
223
|
"files/upload_begin": "files_init",
|
|
225
224
|
"files/upload_complete": "files_finalize",
|
|
@@ -233,14 +232,11 @@ _FILES_REVERSE_RPC: dict[str, str] = {
|
|
|
233
232
|
# Wire-identical to the matrix host handler (matrix
|
|
234
233
|
# ``src/executa/host_upload.py``): a single JSON-RPC method whose
|
|
235
234
|
# ``params.mode`` selects the sub-operation (default ``inline``). Like
|
|
236
|
-
# ``files/*`` above, this is routed BEFORE the dispatcher route table
|
|
237
|
-
#
|
|
238
|
-
# ``
|
|
239
|
-
#
|
|
240
|
-
#
|
|
241
|
-
# file-upload demo under `anna-app dev` (forum #159), and the old
|
|
242
|
-
# ``("upload", "inline")`` route additionally ignored ``mode`` — silently
|
|
243
|
-
# collapsing negotiate/confirm onto inline.
|
|
235
|
+
# ``files/*`` above, this is routed BEFORE the dispatcher route table — in
|
|
236
|
+
# production an executa's ``host/uploadFile`` is authorized by the executa's
|
|
237
|
+
# OWN ``upload_token`` (nexus ``executa_upload_gate``) and never consults the
|
|
238
|
+
# hosting app's manifest. The old ``("upload", "inline")`` route ignored
|
|
239
|
+
# ``mode`` — silently collapsing negotiate/confirm onto inline.
|
|
244
240
|
_UPLOAD_MODE_TO_HOST: dict[str, str] = {
|
|
245
241
|
"inline": "host.upload.inline",
|
|
246
242
|
"negotiate": "host.upload.negotiate",
|
|
@@ -279,6 +275,7 @@ def _validate_sampling_text_only(args: dict) -> None:
|
|
|
279
275
|
},
|
|
280
276
|
)
|
|
281
277
|
|
|
278
|
+
|
|
282
279
|
# Custom JSON-RPC code for "implemented in production but not in this
|
|
283
280
|
# runtime" — matches the matrix host convention also used for the
|
|
284
281
|
# dispatcher's ``not_implemented`` mapping below.
|
|
@@ -358,9 +355,8 @@ class LocalServerRequestHandler:
|
|
|
358
355
|
args = {k: v for k, v in params.items() if k != "context"}
|
|
359
356
|
|
|
360
357
|
# APS Files (object storage) reverse-RPC. Routed BEFORE the dispatcher
|
|
361
|
-
# route table
|
|
362
|
-
#
|
|
363
|
-
# never touch the hosting app's grants. Forward to the Node-side
|
|
358
|
+
# route table — in production these go out on the executa's own
|
|
359
|
+
# ``storage_token`` and never touch the hosting app. Forward to the Node-side
|
|
364
360
|
# storage_token path when APS forwarding is wired; otherwise surface a
|
|
365
361
|
# clean ``not_implemented`` (the in-memory harness has no object
|
|
366
362
|
# storage backend, mirroring ``executa dev --storage memory``).
|
|
@@ -386,9 +382,8 @@ class LocalServerRequestHandler:
|
|
|
386
382
|
# Host-mediated user-artifact upload. Routed BEFORE the dispatcher
|
|
387
383
|
# route table so it bypasses the app iframe ``ui.host_api`` ACL —
|
|
388
384
|
# see the ``_UPLOAD_MODE_TO_HOST`` comment for the production
|
|
389
|
-
# semantics this mirrors.
|
|
390
|
-
# (nexus rejects with APP_NOT_GRANTED when the dev app
|
|
391
|
-
# ``upload_grant`` is off).
|
|
385
|
+
# semantics this mirrors. Owner enforcement happens server-side
|
|
386
|
+
# (nexus rejects with APP_NOT_GRANTED when the dev app is disabled).
|
|
392
387
|
if method == "host/uploadFile":
|
|
393
388
|
mode = args.get("mode") or "inline"
|
|
394
389
|
host_method = _UPLOAD_MODE_TO_HOST.get(mode)
|
|
@@ -437,8 +437,7 @@ class InMemoryWindowStore:
|
|
|
437
437
|
async def agent_session_catalog(self, *, user_id, window, manifest, args):
|
|
438
438
|
# Pre-create platform-tool discovery (dispatcher 0.18.0). The Node
|
|
439
439
|
# LlmBridge answers locally (mock catalog derived from the manifest's
|
|
440
|
-
# ``agent.tools`` declaration
|
|
441
|
-
# concept, so ``user_granted`` is always true).
|
|
440
|
+
# ``agent.tools`` declaration).
|
|
442
441
|
return await self._delegate(
|
|
443
442
|
"host.agent.session.catalog", args, "agent.session.catalog"
|
|
444
443
|
)
|
|
@@ -513,7 +512,7 @@ class InMemoryWindowStore:
|
|
|
513
512
|
#
|
|
514
513
|
# docs/design/platform-media-generation-video-audio.md §7 / §9 / §10.
|
|
515
514
|
# Same host-mediated shape as image.*: production nexus delegates to
|
|
516
|
-
# ``app_media_facade`` in-process (
|
|
515
|
+
# ``app_media_facade`` in-process (owner check / quota / billing / job state
|
|
517
516
|
# machine). With a bridge we forward ``host.video.*`` / ``host.audio.*`` /
|
|
518
517
|
# ``host.llm.catalog`` so the Node LlmBridge mints and POSTs the matching
|
|
519
518
|
# ``/api/v1/copilot/app/{video,audio,models}`` route; without one we
|
{anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_local_dispatch.py
RENAMED
|
@@ -89,8 +89,7 @@ async def test_window_hello_returns_capabilities_and_view_meta():
|
|
|
89
89
|
out = await sess.call("window", "hello", {})
|
|
90
90
|
assert out["entry_payload"] == {"topic": "ECM"}
|
|
91
91
|
assert out["view_meta"]["name"] == "main"
|
|
92
|
-
assert "
|
|
93
|
-
assert "scopes" in out["capabilities"]
|
|
92
|
+
assert out["capabilities"] == {"host_api_version": "0.1.0"}
|
|
94
93
|
assert out["is_resume"] is False
|
|
95
94
|
# forum #376: app identity from the harness store (slug doubles as name).
|
|
96
95
|
assert out["app"]["id"] == 1
|
|
@@ -191,14 +190,17 @@ async def test_tools_list_reflects_manifest_whitelist():
|
|
|
191
190
|
|
|
192
191
|
|
|
193
192
|
@pytest.mark.asyncio
|
|
194
|
-
async def
|
|
195
|
-
#
|
|
193
|
+
async def test_undeclared_namespace_is_allowed():
|
|
194
|
+
# No method-level ACL (design app-permission-system-removal.md): an
|
|
195
|
+
# installed App may call every Host API method; legacy `host_api`
|
|
196
|
+
# method lists are folded away on ingest.
|
|
196
197
|
sess = LocalDispatcherSession.create(
|
|
197
198
|
user_id=1, manifest_dict=_manifest(host_api={"storage": ["*"]})
|
|
198
199
|
)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
out = await sess.call(
|
|
201
|
+
"chat", "write_message", {"role": "assistant", "content": "hi"}
|
|
202
|
+
)
|
|
203
|
+
assert isinstance(out, dict)
|
|
202
204
|
|
|
203
205
|
|
|
204
206
|
@pytest.mark.asyncio
|
|
@@ -372,8 +374,12 @@ async def test_bridge_session_create_returns_browser_permission_gates():
|
|
|
372
374
|
|
|
373
375
|
async def create(manifest):
|
|
374
376
|
resp = await bridge.handle(
|
|
375
|
-
{
|
|
376
|
-
|
|
377
|
+
{
|
|
378
|
+
"jsonrpc": "2.0",
|
|
379
|
+
"id": 1,
|
|
380
|
+
"method": "session.create",
|
|
381
|
+
"params": {"user_id": 1, "manifest": manifest},
|
|
382
|
+
}
|
|
377
383
|
)
|
|
378
384
|
return resp["result"]
|
|
379
385
|
|
{anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_reverse_rpc.py
RENAMED
|
@@ -701,9 +701,9 @@ async def test_files_legacy_mode_returns_not_implemented() -> None:
|
|
|
701
701
|
|
|
702
702
|
# ---------------------------------------------------------------------------
|
|
703
703
|
# host/uploadFile (host-mediated user-artifact upload) via an executa's
|
|
704
|
-
# reverse-RPC. Must (a)
|
|
705
|
-
# production the executa's OWN ``
|
|
706
|
-
#
|
|
704
|
+
# reverse-RPC. Must (a) never consult the hosting app's manifest — in
|
|
705
|
+
# production the executa's OWN ``upload_token`` authorizes it (forum #159) —
|
|
706
|
+
# and (b) dispatch on ``params.mode``
|
|
707
707
|
# exactly like the matrix host handler, instead of collapsing
|
|
708
708
|
# negotiate/confirm onto inline.
|
|
709
709
|
# ---------------------------------------------------------------------------
|
|
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
|
{anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_frame_limits.py
RENAMED
|
File without changes
|
|
File without changes
|
{anna_app_runtime_local-0.2.0a32 → anna_app_runtime_local-0.2.0a33}/tests/test_web_local_images.py
RENAMED
|
File without changes
|