web-cortex-framework 2.5.2__tar.gz → 2.5.3__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.
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/Cargo.lock +2 -2
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/Cargo.toml +1 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/PKG-INFO +2 -2
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/README.md +1 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/devices.rs +3 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/errors.rs +6 -2
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/pyproject.toml +1 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/__init__.py +1 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/cli.py +6 -5
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/diagnostics.py +24 -4
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/errors.py +1 -1
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/LICENSE +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/Cargo.toml +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/provider.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/registry.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/session.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/vision.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/app.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/audit.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/auth.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/bridge.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/context.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/db.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/files.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/flow.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/http.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/ledger.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/lib.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/manifest.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/mcp.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/middleware.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/openapi.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/router.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/server.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/status.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/templates.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/typegen.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/ws.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/tests/diagnostics.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-py/Cargo.toml +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-py/src/behaviour.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-py/src/lib.rs +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/_bridge.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/app.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/client.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/contextpack.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/media.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/schema.py +0 -0
- {web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/python/webcortex/starters.py +0 -0
|
@@ -2662,7 +2662,7 @@ dependencies = [
|
|
|
2662
2662
|
|
|
2663
2663
|
[[package]]
|
|
2664
2664
|
name = "webcortex-core"
|
|
2665
|
-
version = "2.5.
|
|
2665
|
+
version = "2.5.3"
|
|
2666
2666
|
dependencies = [
|
|
2667
2667
|
"base64 0.23.1",
|
|
2668
2668
|
"bytes",
|
|
@@ -2690,7 +2690,7 @@ dependencies = [
|
|
|
2690
2690
|
|
|
2691
2691
|
[[package]]
|
|
2692
2692
|
name = "webcortex-py"
|
|
2693
|
-
version = "2.5.
|
|
2693
|
+
version = "2.5.3"
|
|
2694
2694
|
dependencies = [
|
|
2695
2695
|
"bytes",
|
|
2696
2696
|
"futures",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: web-cortex-framework
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.3
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -527,7 +527,7 @@ tested, the known limits, and what v2 added to the surface.
|
|
|
527
527
|
|
|
528
528
|
## Status
|
|
529
529
|
|
|
530
|
-
v2.5.
|
|
530
|
+
v2.5.3. Working and tested: the manifest IR, router, native ops (static /
|
|
531
531
|
query / proxy / page / files / flow), the free-threaded Python bridge,
|
|
532
532
|
authentication and scopes, rate limiting, CORS, security headers, graceful
|
|
533
533
|
shutdown, Behaviours with concurrent leaves, the agent runtime with handoffs,
|
|
@@ -499,7 +499,7 @@ tested, the known limits, and what v2 added to the surface.
|
|
|
499
499
|
|
|
500
500
|
## Status
|
|
501
501
|
|
|
502
|
-
v2.5.
|
|
502
|
+
v2.5.3. Working and tested: the manifest IR, router, native ops (static /
|
|
503
503
|
query / proxy / page / files / flow), the free-threaded Python bridge,
|
|
504
504
|
authentication and scopes, rate limiting, CORS, security headers, graceful
|
|
505
505
|
shutdown, Behaviours with concurrent leaves, the agent runtime with handoffs,
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/devices.rs
RENAMED
|
@@ -760,8 +760,10 @@ mod tests {
|
|
|
760
760
|
d.push_frame(Bytes::from_static(PNG)).unwrap();
|
|
761
761
|
std::thread::sleep(Duration::from_millis(20));
|
|
762
762
|
}
|
|
763
|
+
// Sleeps only ever overrun (a loaded CI runner measured 8.6), so bound
|
|
764
|
+
// it loosely: the point is that it is no longer 0.
|
|
763
765
|
let fps = d.recent_fps();
|
|
764
|
-
assert!(fps >
|
|
766
|
+
assert!(fps > 1.0 && fps < 60.0, "fps {fps}");
|
|
765
767
|
}
|
|
766
768
|
|
|
767
769
|
#[test]
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/errors.rs
RENAMED
|
@@ -190,6 +190,10 @@ pub static CATALOGUE: &[ErrorInfo] = &[
|
|
|
190
190
|
"Anonymous callers share one identity, so @principal-scoped data and agent sessions need a real credential."),
|
|
191
191
|
e!("WC608", "auth", None, "No authentication configured",
|
|
192
192
|
"Every route is public. Add app.api_key('WEBCORTEX_API_KEY', id='service', scopes=[...]) before exposing the app beyond localhost."),
|
|
193
|
+
e!("WC609", "auth", Some(401), "Unauthorized (raised by the app)",
|
|
194
|
+
"The app's own code answered 401 (for example a wrong password at login); its message says why. WebCortex's own credential checks answer WC601, WC603 or WC604 instead."),
|
|
195
|
+
e!("WC610", "auth", Some(403), "Forbidden (raised by the app)",
|
|
196
|
+
"The app's own code refused this caller with 403; its message says why. A missing WebCortex scope answers WC602 and a cross-origin refusal WC605 instead."),
|
|
193
197
|
];
|
|
194
198
|
|
|
195
199
|
/// The entry for a code.
|
|
@@ -206,8 +210,8 @@ pub fn hint(code: &str) -> &'static str {
|
|
|
206
210
|
pub fn code_for_status(status: u16) -> &'static str {
|
|
207
211
|
match status {
|
|
208
212
|
400 => "WC205",
|
|
209
|
-
401 => "
|
|
210
|
-
403 => "
|
|
213
|
+
401 => "WC609",
|
|
214
|
+
403 => "WC610",
|
|
211
215
|
404 => "WC207",
|
|
212
216
|
405 => "WC202",
|
|
213
217
|
408 => "WC216",
|
|
@@ -7,7 +7,7 @@ build-backend = "maturin"
|
|
|
7
7
|
# The split is for ergonomics, the same way djangorestframework imports as
|
|
8
8
|
# `rest_framework`.
|
|
9
9
|
name = "web-cortex-framework"
|
|
10
|
-
version = "2.5.
|
|
10
|
+
version = "2.5.3"
|
|
11
11
|
description = "A Rust-cored Python web framework where every route is also an agent tool."
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.12"
|
|
@@ -276,9 +276,10 @@ def _control(app: Any, method: str, path: str, body: dict | None = None,
|
|
|
276
276
|
data = json.dumps(body or {}).encode() if method == "POST" else None
|
|
277
277
|
req = urllib.request.Request(url, data=data, method=method,
|
|
278
278
|
headers={"content-type": "application/json"})
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
from .diagnostics import credential_headers, operator_credential
|
|
280
|
+
|
|
281
|
+
for name, value in credential_headers(operator_credential(key)).items():
|
|
282
|
+
req.add_header(name, value)
|
|
282
283
|
try:
|
|
283
284
|
with urllib.request.urlopen(req, timeout=5) as res:
|
|
284
285
|
return json.loads(res.read() or b"{}")
|
|
@@ -400,7 +401,7 @@ def _parser() -> argparse.ArgumentParser:
|
|
|
400
401
|
p.add_argument("--json", action="store_true", help="emit the raw manifest instead")
|
|
401
402
|
if name in ("halt", "release"):
|
|
402
403
|
p.add_argument("--key", default=None,
|
|
403
|
-
help="admin API key (default: $WEBCORTEX_API_KEY)")
|
|
404
|
+
help="admin API key or JWT bearer token (default: $WEBCORTEX_API_KEY, then $WEBCORTEX_TOKEN)")
|
|
404
405
|
if name == "halt":
|
|
405
406
|
p.add_argument("--reason", "-r", default="", help="recorded in the audit log")
|
|
406
407
|
p.add_argument("--status", action="store_true", help="only report whether it is halted")
|
|
@@ -408,7 +409,7 @@ def _parser() -> argparse.ArgumentParser:
|
|
|
408
409
|
p.add_argument("--json", action="store_true", help="machine-readable output")
|
|
409
410
|
p.add_argument("--url", default=None,
|
|
410
411
|
help="the running app's base URL (default: WEBCORTEX_HOST/PORT or the app's own)")
|
|
411
|
-
p.add_argument("--key", default=None, help="admin API key (default: $WEBCORTEX_API_KEY)")
|
|
412
|
+
p.add_argument("--key", default=None, help="admin API key or JWT bearer token (default: $WEBCORTEX_API_KEY, then $WEBCORTEX_TOKEN)")
|
|
412
413
|
if name == "doctor":
|
|
413
414
|
p.add_argument("--online", action="store_true",
|
|
414
415
|
help="also probe each model provider's endpoint (3 s timeout)")
|
|
@@ -14,6 +14,7 @@ from __future__ import annotations
|
|
|
14
14
|
|
|
15
15
|
import json
|
|
16
16
|
import os
|
|
17
|
+
import re
|
|
17
18
|
import socket
|
|
18
19
|
import sys
|
|
19
20
|
import urllib.error
|
|
@@ -46,10 +47,29 @@ def app_url(app: Any, url: str | None = None) -> str:
|
|
|
46
47
|
return f"http://{host}:{port}"
|
|
47
48
|
|
|
48
49
|
|
|
50
|
+
_JWT_RE = re.compile(r"^eyJ[A-Za-z0-9_-]*\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def credential_headers(key: str | None) -> dict[str, str]:
|
|
54
|
+
"""The header that carries ``key``: an API key goes in ``x-api-key``; a JWT
|
|
55
|
+
(or anything given as ``Bearer …``) goes in ``Authorization: Bearer``."""
|
|
56
|
+
key = (key or "").strip()
|
|
57
|
+
if not key:
|
|
58
|
+
return {}
|
|
59
|
+
if key[:7].lower() == "bearer ":
|
|
60
|
+
return {"authorization": "Bearer " + key[7:].strip()}
|
|
61
|
+
if _JWT_RE.match(key):
|
|
62
|
+
return {"authorization": "Bearer " + key}
|
|
63
|
+
return {"x-api-key": key}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def operator_credential(key: str | None = None) -> str | None:
|
|
67
|
+
"""``key``, else ``$WEBCORTEX_API_KEY``, else ``$WEBCORTEX_TOKEN`` (a JWT)."""
|
|
68
|
+
return key or os.environ.get("WEBCORTEX_API_KEY") or os.environ.get("WEBCORTEX_TOKEN")
|
|
69
|
+
|
|
70
|
+
|
|
49
71
|
def _get_json(url: str, key: str | None, timeout: float) -> tuple[int, Any]:
|
|
50
|
-
req = urllib.request.Request(url, headers={"accept": "application/json"})
|
|
51
|
-
if key:
|
|
52
|
-
req.add_header("x-api-key", key)
|
|
72
|
+
req = urllib.request.Request(url, headers={"accept": "application/json", **credential_headers(key)})
|
|
53
73
|
try:
|
|
54
74
|
with urllib.request.urlopen(req, timeout=timeout) as res:
|
|
55
75
|
try:
|
|
@@ -356,7 +376,7 @@ def fetch_status(app: Any = None, *, url: str | None = None, key: str | None = N
|
|
|
356
376
|
"""GET the running app's live status. Raises ``RuntimeError`` with a code on failure."""
|
|
357
377
|
prefix = getattr(app, "control_prefix", "/_webcortex") if app is not None else "/_webcortex"
|
|
358
378
|
base = app_url(app, url) if app is not None else (url or "http://127.0.0.1:8000").rstrip("/")
|
|
359
|
-
key = key
|
|
379
|
+
key = operator_credential(key)
|
|
360
380
|
target = f"{base}{prefix}/status"
|
|
361
381
|
try:
|
|
362
382
|
status, body = _get_json(target, key, timeout)
|
|
@@ -24,7 +24,7 @@ CODE_RE = re.compile(r"\bWC\d{3}\b")
|
|
|
24
24
|
DOCS_URL = "https://slimboi34.github.io/web_cortex_framework/error-codes/"
|
|
25
25
|
|
|
26
26
|
_STATUS_DEFAULTS = {
|
|
27
|
-
400: "WC205", 401: "
|
|
27
|
+
400: "WC205", 401: "WC609", 403: "WC610", 404: "WC207", 405: "WC202", 408: "WC216", 409: "WC214",
|
|
28
28
|
413: "WC204", 422: "WC206", 423: "WC502", 426: "WC213", 429: "WC401", 500: "WC001",
|
|
29
29
|
502: "WC300", 503: "WC215", 504: "WC203", 508: "WC403",
|
|
30
30
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/session.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent/vision.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/agent.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/audit.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/bridge.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/context.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/files.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/ledger.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/manifest.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/middleware.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/openapi.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/router.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/server.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/status.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/templates.rs
RENAMED
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/src/typegen.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-core/tests/diagnostics.rs
RENAMED
|
File without changes
|
|
File without changes
|
{web_cortex_framework-2.5.2 → web_cortex_framework-2.5.3}/crates/webcortex-py/src/behaviour.rs
RENAMED
|
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
|