ciris-client-wasm 0.5.186__py3-none-any.whl

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.
@@ -0,0 +1,85 @@
1
+ """The CIRIS client's WebAssembly browser bundle.
2
+
3
+ import ciris_client_wasm
4
+ ciris_client_wasm.bundle_path() # the directory to serve
5
+ ciris_client_wasm.index_html() # its entry point
6
+
7
+ Serve the whole directory: the loader `.js`, the `.wasm` modules it fetches,
8
+ `index.html`, and `composeResources/`. Serving only `index.html` gets a blank
9
+ page, which is why :func:`bundle_path` checks the parts before returning.
10
+
11
+ `ciris_client` resolves this too, when installed —
12
+ `ciris_client.artifact_path("wasm-browser")` — so a consumer holding the
13
+ resolver API does not need to special-case the web bundle.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from pathlib import Path
19
+
20
+ _ARTIFACTS = Path(__file__).resolve().parent / "_artifacts"
21
+
22
+ #: Files the bundle is useless without — a loader with no module is a blank page.
23
+ _REQUIRED = ("index.html", "ciris-shared.js", "ciris-shared.wasm")
24
+
25
+
26
+ class BundleUnavailable(RuntimeError):
27
+ """The package is installed but carries no usable bundle."""
28
+
29
+
30
+ def bundle_path() -> Path:
31
+ """The directory to serve. Raises if it is absent or incomplete.
32
+
33
+ The location comes from the staged manifest rather than a hardcoded
34
+ directory name: the Gradle task's output directory is its business, not
35
+ this package's, and hardcoding it means a rename ships a blank page.
36
+ """
37
+ import json
38
+
39
+ manifest = _ARTIFACTS / "manifest.json"
40
+ if not manifest.is_file():
41
+ raise BundleUnavailable(
42
+ "ciris-client-wasm carries no _artifacts/manifest.json — it was "
43
+ "built without staging the Gradle output."
44
+ )
45
+ data = json.loads(manifest.read_text(encoding="utf-8"))
46
+ if data.get("placeholder"):
47
+ raise BundleUnavailable(
48
+ f"this ciris-client-wasm is a PLACEHOLDER build — no bundle here.\n"
49
+ f" reason: {data.get('placeholder_reason', 'not recorded')}"
50
+ )
51
+ entries = [a for a in data.get("artifacts", []) if a["kind"] == "wasm-browser"]
52
+ if not entries:
53
+ raise BundleUnavailable(
54
+ "the manifest lists no wasm-browser artifact; this wheel carries "
55
+ f"{[a['kind'] for a in data.get('artifacts', [])] or '[]'}"
56
+ )
57
+
58
+ root = _ARTIFACTS / entries[0]["path"]
59
+ missing = [n for n in _REQUIRED if not (root / n).is_file()]
60
+ if missing:
61
+ raise BundleUnavailable(
62
+ f"the wasm bundle at {root} is incomplete: missing {missing}. "
63
+ f"Serving it would give a blank page; refusing to hand back the "
64
+ f"directory."
65
+ )
66
+ return root
67
+
68
+
69
+ def index_html() -> Path:
70
+ """The bundle's entry point."""
71
+ return bundle_path() / "index.html"
72
+
73
+
74
+ def _version() -> str:
75
+ from importlib.metadata import PackageNotFoundError, version
76
+
77
+ try:
78
+ return version("ciris-client-wasm")
79
+ except PackageNotFoundError:
80
+ v = Path(__file__).resolve().parents[2] / "VERSION"
81
+ return v.read_text(encoding="utf-8").strip() if v.is_file() else "0.0.0"
82
+
83
+
84
+ __version__ = _version()
85
+ __all__ = ["BundleUnavailable", "__version__", "bundle_path", "index_html"]
@@ -0,0 +1,25 @@
1
+ {
2
+ "artifacts": [
3
+ {
4
+ "bytes": 28418750,
5
+ "files": 6,
6
+ "kind": "wasm-browser",
7
+ "path": "wasm-browser",
8
+ "sha256": "811c42f3e8e440e3c088654092d47a7c1f4008411212c034a6b94810661e1deb",
9
+ "tree": true
10
+ }
11
+ ],
12
+ "built": {
13
+ "at": "2026-08-22T22:41:37+00:00",
14
+ "github_run": "32602181654",
15
+ "github_sha": "f98cd35f3a04d211e0956309fd5e9a47415a65d3"
16
+ },
17
+ "client_version": "0.5.186",
18
+ "flavor": "agent",
19
+ "has_agent": true,
20
+ "schema": "ciris-client-artifacts/v1",
21
+ "vendored_from": {
22
+ "commit": "1ea2c8b80a8022634d4f57309b0aa7ae8bde5ba9",
23
+ "repo": "CIRISAI/CIRISServer"
24
+ }
25
+ }