sync: mirror szl-holdings/amaru@fc94ee0
Browse files- .gitignore +8 -0
- AGENTS.md +42 -0
- README.md +113 -71
- deploy/huggingface/Dockerfile +29 -0
- deploy/huggingface/README.md +30 -0
- deploy/huggingface/deploy.sh +62 -0
- deploy/huggingface/serve.py +43 -0
- web/index.html +1 -1
- web/package-lock.json +0 -0
- web/package.json +23 -44
- web/src/_stubs/a11oy-orchestration/index.ts +37 -0
- web/src/_stubs/codex-kernel/index.ts +274 -0
- web/src/_stubs/design-system/tokens.css +1 -0
- web/src/_stubs/ouroboros-react/index.tsx +78 -0
- web/src/_stubs/ouroboros/index.ts +79 -0
- web/src/_stubs/shared-ui/badge.tsx +16 -0
- web/src/_stubs/shared-ui/button.tsx +25 -0
- web/src/_stubs/shared-ui/card.tsx +17 -0
- web/src/_stubs/shared-ui/contact-modal.tsx +41 -0
- web/src/_stubs/shared-ui/skeleton.tsx +5 -0
- web/src/_stubs/szl-doctrine-panels/index.tsx +41 -0
- web/src/_stubs/szl-doctrine/index.ts +83 -0
- web/src/index.css +1 -1
- web/tsconfig.json +9 -3
- web/vite.config.ts +23 -33
.gitignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
| 3 |
+
.pytest_cache/
|
| 4 |
+
.ruff_cache/
|
| 5 |
+
*.egg-info/
|
| 6 |
+
.venv/
|
| 7 |
+
node_modules/
|
| 8 |
+
web/dist/
|
AGENTS.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AGENTS.md
|
| 2 |
+
|
| 3 |
+
## Cursor Cloud specific instructions
|
| 4 |
+
|
| 5 |
+
### Repository overview
|
| 6 |
+
|
| 7 |
+
This workspace contains three repos. Only **amaru** has runnable code; the other two (`carlota-jo`, `counsel`) are documentation/specification-only at alpha stage.
|
| 8 |
+
|
| 9 |
+
### Amaru sidecar (Python FastAPI backend) — the primary service
|
| 10 |
+
|
| 11 |
+
- **Location:** `sidecar/`
|
| 12 |
+
- **Install:** `pip install -e ".[dev]"` from `sidecar/`
|
| 13 |
+
- **Run server:** `python3 -m uvicorn amaru.app:app --host 0.0.0.0 --port 6810` from `sidecar/`
|
| 14 |
+
- **Run tests:** `python3 -m pytest tests/ -v` from `sidecar/`
|
| 15 |
+
- **Lint:** `ruff check src/ tests/` from `sidecar/` (ruff must be installed separately: `pip install ruff`)
|
| 16 |
+
|
| 17 |
+
### Top-level wiring tests
|
| 18 |
+
|
| 19 |
+
- **Location:** `tests/test_chakana_wiring.py`
|
| 20 |
+
- **Run:** `PYTHONPATH=src python3 -m pytest tests/test_chakana_wiring.py -v` from the repo root
|
| 21 |
+
- The test imports `chakana_wiring` from `src/chakana_wiring.py`; you must set `PYTHONPATH=src` or pytest won't find the module.
|
| 22 |
+
|
| 23 |
+
### Web frontend (standalone)
|
| 24 |
+
|
| 25 |
+
- **Location:** `web/`
|
| 26 |
+
- **Install:** `npm install` from `web/`
|
| 27 |
+
- **Run dev server:** `VITE_PORT=5300 BASE_PATH=/ API_TARGET=http://localhost:6810 npx vite --host 0.0.0.0` from `web/`
|
| 28 |
+
- **Build:** `npm run build` from `web/` (outputs to `web/dist/`)
|
| 29 |
+
- The frontend uses stub modules in `web/src/_stubs/` for all workspace packages that originally came from the parent platform monorepo. These stubs provide fully functional implementations.
|
| 30 |
+
- The Vite dev server proxies `/api/amaru/*` to the FastAPI backend at `API_TARGET`.
|
| 31 |
+
|
| 32 |
+
### Hugging Face Spaces deployment
|
| 33 |
+
|
| 34 |
+
- **Deploy script:** `deploy/huggingface/deploy.sh`
|
| 35 |
+
- Requires `HF_TOKEN` env var. Usage: `HF_TOKEN=hf_xxx bash deploy/huggingface/deploy.sh [space-name]`
|
| 36 |
+
- Builds both frontend and backend into a single Docker container serving on port 7860.
|
| 37 |
+
|
| 38 |
+
### Gotchas
|
| 39 |
+
|
| 40 |
+
- `pip install` puts scripts in `~/.local/bin` which may not be on PATH. Either use `python3 -m <tool>` or `export PATH="$HOME/.local/bin:$PATH"`.
|
| 41 |
+
- The `huklla-7` tripwire (bus publish) will always show `warn` when running locally — the yawar-bus (Prism Bus) is a separate external service and is not expected to be available.
|
| 42 |
+
- DCO sign-off (`git commit -s`) is enforced by CI on all commits.
|
README.md
CHANGED
|
@@ -1,106 +1,148 @@
|
|
| 1 |
-
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
---
|
| 17 |
|
| 18 |
-
#
|
| 19 |
|
| 20 |
-
|
| 21 |
-
[](https://github.com/szl-holdings/amaru/blob/main/LICENSE)
|
| 22 |
-
[](https://huggingface.co/SZLHOLDINGS)
|
| 23 |
-
[](https://huggingface.co/SZLHOLDINGS)
|
| 24 |
-
[](https://huggingface.co/datasets/SZLHOLDINGS/amaru-source)
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
-
##
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
| **Snapshot URL** | https://github.com/szl-holdings/amaru/tree/779a0d7e4e695d52a56f8f698383bba12c7a43a2 |
|
| 39 |
-
| **Retrieved** | 2026-05-28T22:54:00Z |
|
| 40 |
-
| **Mirror Agent** | HF GH-MIRROR · Doctrine v6 |
|
| 41 |
-
| **License** | Proprietary |
|
| 42 |
-
| **HF Dataset** | [SZLHOLDINGS/amaru-source](https://huggingface.co/datasets/SZLHOLDINGS/amaru-source) |
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
#
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
-
|
| 50 |
-
|
| 51 |
-
- Binary video/archive artifacts >50 MB (if any)
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
-
##
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
| Ouroboros Thesis | Dataset | [SZLHOLDINGS/ouroboros-thesis-source](https://huggingface.co/datasets/SZLHOLDINGS/ouroboros-thesis-source) |
|
| 62 |
-
| Formal Proofs (Lean 4) | Dataset | [SZLHOLDINGS/thesis-v18-formal-verification](https://huggingface.co/datasets/SZLHOLDINGS/thesis-v18-formal-verification) |
|
| 63 |
-
| UDS Spans + Receipts | Dataset | [SZLHOLDINGS/uds-spans-receipts](https://huggingface.co/datasets/SZLHOLDINGS/uds-spans-receipts) |
|
| 64 |
-
| a11oy v19 Substrate | Model | [SZLHOLDINGS/a11oy-v19-substrate](https://huggingface.co/SZLHOLDINGS/a11oy-v19-substrate) |
|
| 65 |
-
| Showcase Space | Space | [SZLHOLDINGS/szl-showcase](https://huggingface.co/spaces/SZLHOLDINGS/szl-showcase) |
|
| 66 |
-
| Lutar Lean Browser | Space | [SZLHOLDINGS/lutar-lean-browser](https://huggingface.co/spaces/SZLHOLDINGS/lutar-lean-browser) |
|
| 67 |
-
| MCP Receipts Server | Space | [SZLHOLDINGS/mcp-receipts-server](https://huggingface.co/spaces/SZLHOLDINGS/mcp-receipts-server) |
|
| 68 |
|
| 69 |
---
|
| 70 |
|
|
|
|
| 71 |
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
-
# Download the source snapshot
|
| 76 |
-
hf download SZLHOLDINGS/amaru-source \
|
| 77 |
-
--repo-type dataset \
|
| 78 |
-
--local-dir ./amaru-source
|
| 79 |
|
| 80 |
-
#
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
```
|
| 83 |
|
| 84 |
-
|
| 85 |
-
# Clone the canonical GitHub source directly
|
| 86 |
-
git clone https://github.com/szl-holdings/amaru
|
| 87 |
-
```
|
| 88 |
|
| 89 |
---
|
| 90 |
|
| 91 |
-
##
|
| 92 |
|
| 93 |
-
-
|
| 94 |
-
-
|
| 95 |
-
-
|
| 96 |
-
-
|
| 97 |
|
| 98 |
---
|
| 99 |
|
| 100 |
-
##
|
| 101 |
|
| 102 |
-
|
| 103 |
|
| 104 |
-
--
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
|
|
|
| 1 |
+
# amaru — Cardano-Anchored Governance Receipt Minting
|
| 2 |
+
|
| 3 |
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
| 4 |
+
[](https://doi.org/10.5281/zenodo.20434276)
|
| 5 |
+
[](https://github.com/szl-holdings/amaru/actions/workflows/ci.yml)
|
| 6 |
+
[](https://github.com/szl-holdings/amaru/actions/workflows/codeql.yml)
|
| 7 |
+
[](https://github.com/szl-holdings/amaru/actions/workflows/sbom.yml)
|
| 8 |
+
[](https://github.com/szl-holdings/amaru/actions/workflows/slsa.yml)
|
| 9 |
+
[](https://github.com/szl-holdings/amaru/actions/workflows/dco.yml)
|
| 10 |
+
[](https://orcid.org/0009-0001-0110-4173)
|
| 11 |
+
[](https://huggingface.co/spaces/SZLHOLDINGS/amaru-platform)
|
| 12 |
+
|
| 13 |
+
**amaru** encodes every AI decision through a 7-chakra serpentine scheduler, producing byte-identical,
|
| 14 |
+
Cardano-anchored receipts that satisfy Doctrine v6 audit requirements and IETF SCITT
|
| 15 |
+
multi-receipt transparency.
|
| 16 |
+
|
| 17 |
---
|
| 18 |
|
| 19 |
+
## What is real today
|
| 20 |
|
| 21 |
+
All counts are grep-verifiable from this repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
| Metric | Count | How to verify |
|
| 24 |
+
|--------|-------|---------------|
|
| 25 |
+
| Chakra kernel modules | 7 | `find src/chakras -name "kernel.py" \| wc -l` |
|
| 26 |
+
| Python modules (total) | 45 | `find . -name "*.py" -not -path './.git/*' \| wc -l` |
|
| 27 |
+
| Python source lines | 2,883 | `find . -name "*.py" -not -path './.git/*' -exec wc -l {} + \| tail -1` |
|
| 28 |
+
| Test files | 5 | `find . -name "test_*.py" -not -path './.git/*' \| wc -l` |
|
| 29 |
+
| Test assertions | 40 | `grep -r "def test_" . --include="*.py" \| wc -l` |
|
| 30 |
+
| Total source files | 254 | `find . -not -path './.git/*' -type f \| wc -l` |
|
| 31 |
+
| Zenodo DOI | 10.5281/zenodo.20434276 | resolves at https://doi.org/10.5281/zenodo.20434276 |
|
| 32 |
|
| 33 |
+
---
|
| 34 |
|
| 35 |
+
## Architecture
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
INPUT EVENT
|
| 39 |
+
│
|
| 40 |
+
▼
|
| 41 |
+
C1-KALLPA (Root · Sense capacity)
|
| 42 |
+
│
|
| 43 |
+
▼
|
| 44 |
+
C2-YACHAY (Sacral · Retrieve context)
|
| 45 |
+
│
|
| 46 |
+
▼
|
| 47 |
+
C3-RIMAY (Solar · Propose actions)
|
| 48 |
+
│
|
| 49 |
+
▼
|
| 50 |
+
C4-YUYAY (Heart · Score via 9 AXES)
|
| 51 |
+
│
|
| 52 |
+
▼
|
| 53 |
+
C5-RUWAY (Throat · Execute)
|
| 54 |
+
│
|
| 55 |
+
▼
|
| 56 |
+
C6-NAWI (Third-eye · Correlate tool calls)
|
| 57 |
+
│
|
| 58 |
+
▼
|
| 59 |
+
C7-HATUN (Crown · Mint SHA-256 receipt)
|
| 60 |
+
│
|
| 61 |
+
▼
|
| 62 |
+
RECEIPT → Cardano anchor (SCITT multi-receipt)
|
| 63 |
+
|
| 64 |
+
All kernels communicate via the YAWAR event bus (replay buffer · audit fiber)
|
| 65 |
+
```
|
| 66 |
|
| 67 |
---
|
| 68 |
|
| 69 |
+
## How to use
|
| 70 |
|
| 71 |
+
```bash
|
| 72 |
+
# Clone and install
|
| 73 |
+
git clone https://github.com/szl-holdings/amaru.git
|
| 74 |
+
cd amaru
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
# Run the sidecar receipt API
|
| 77 |
+
cd sidecar
|
| 78 |
+
pip install -e .
|
| 79 |
+
python -m amaru.overwatch # starts receipt API on :8080
|
| 80 |
|
| 81 |
+
# Run the chakra pipeline
|
| 82 |
+
cd ..
|
| 83 |
+
python src/amaru_scheduler.py
|
| 84 |
|
| 85 |
+
# Run tests
|
| 86 |
+
python -m pytest tests/ sidecar/tests/ -v
|
| 87 |
+
```
|
|
|
|
| 88 |
|
| 89 |
---
|
| 90 |
|
| 91 |
+
## What this is NOT
|
| 92 |
|
| 93 |
+
- Not a blockchain L1 or validator set — amaru writes receipt hashes on Cardano, does not implement consensus
|
| 94 |
+
- Not a token or DeFi protocol — no token is minted, no economic incentive structure
|
| 95 |
+
- Not production-hardened for high-volume without additional rate limiting and authn hardening
|
| 96 |
+
- Not a general-purpose audit log — receipts carry YUYAY 9-AXES scores and chakra provenance specific to governed AI decisions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
---
|
| 99 |
|
| 100 |
+
## Sibling repositories
|
| 101 |
|
| 102 |
+
| Repo | Role |
|
| 103 |
+
|------|------|
|
| 104 |
+
| [a11oy-platform](https://huggingface.co/spaces/SZLHOLDINGS/a11oy-platform) | Governed agentic execution fabric — calls amaru for receipt minting |
|
| 105 |
+
| [sentra](https://github.com/szl-holdings/sentra) | Threat telemetry adapter — publishes to Yawar bus |
|
| 106 |
+
| [rosie](https://github.com/szl-holdings/rosie) | Khipu receipt DAG — produces byte-strings amaru anchors |
|
| 107 |
+
| [vsp-otel](https://github.com/szl-holdings/vsp-otel) | Lambda-signed OTel spans — receipt hashes registered in amaru chain |
|
| 108 |
+
| [agi-forecast](https://github.com/szl-holdings/agi-forecast) | AI safety gauges — benchmark receipts anchored via amaru |
|
| 109 |
+
| [szl-cookbook](https://github.com/szl-holdings/szl-cookbook) | Patterns and recipes — reference impl for amaru TypeScript bindings |
|
| 110 |
|
| 111 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
## How to cite
|
| 114 |
+
|
| 115 |
+
```bibtex
|
| 116 |
+
@software{lutar_amaru_2025,
|
| 117 |
+
author = {Lutar, Stephen Paul JR},
|
| 118 |
+
title = {amaru — Cardano-Anchored Governance Receipt Minting},
|
| 119 |
+
year = {2025},
|
| 120 |
+
doi = {10.5281/zenodo.20434276},
|
| 121 |
+
url = {https://doi.org/10.5281/zenodo.20434276},
|
| 122 |
+
license = {Apache-2.0}
|
| 123 |
+
}
|
| 124 |
```
|
| 125 |
|
| 126 |
+
See also CITATION.cff in the repository root.
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
---
|
| 129 |
|
| 130 |
+
## References
|
| 131 |
|
| 132 |
+
- IETF SCITT Architecture (draft-ietf-scitt-architecture-22): https://www.ietf.org/archive/id/draft-ietf-scitt-architecture-22.txt
|
| 133 |
+
- Urton, G. (2003). Signs of the Inka Khipu. UT Press. https://doi.org/10.7560/703442
|
| 134 |
+
- SZL Holdings Doctrine v6: https://doi.org/10.5281/zenodo.19944926
|
| 135 |
+
- Bar-Natan, D. (1995). On the Vassiliev knot invariants. Topology 34(2), 423–472. https://doi.org/10.1016/0040-9383(95)93441-4
|
| 136 |
|
| 137 |
---
|
| 138 |
|
| 139 |
+
## License + DCO
|
| 140 |
|
| 141 |
+
Licensed under [Apache License 2.0](./LICENSE).
|
| 142 |
|
| 143 |
+
All commits require Developer Certificate of Origin sign-off (`git commit -s`).
|
| 144 |
+
SLSA provenance level 3, SBOM generation, and CodeQL static analysis are enforced on CI.
|
| 145 |
+
|
| 146 |
+
ORCID: [0009-0001-0110-4173](https://orcid.org/0009-0001-0110-4173) · Doctrine v6 compliant
|
| 147 |
|
| 148 |
+
Signed-off-by: Stephen Paul Lutar JR <stephen@szlholdings.com>
|
deploy/huggingface/Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim AS backend
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
COPY sidecar/ ./sidecar/
|
| 5 |
+
RUN pip install --no-cache-dir ./sidecar
|
| 6 |
+
|
| 7 |
+
FROM node:22-slim AS frontend
|
| 8 |
+
|
| 9 |
+
WORKDIR /build
|
| 10 |
+
COPY web/package.json web/package-lock.json* ./
|
| 11 |
+
RUN npm ci --ignore-scripts
|
| 12 |
+
COPY web/ ./
|
| 13 |
+
RUN npm run build
|
| 14 |
+
|
| 15 |
+
FROM python:3.12-slim
|
| 16 |
+
|
| 17 |
+
WORKDIR /app
|
| 18 |
+
|
| 19 |
+
COPY --from=backend /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
| 20 |
+
COPY --from=backend /usr/local/bin/uvicorn /usr/local/bin/uvicorn
|
| 21 |
+
COPY sidecar/src/amaru /app/amaru
|
| 22 |
+
COPY --from=frontend /build/dist /app/static
|
| 23 |
+
|
| 24 |
+
COPY deploy/huggingface/serve.py /app/serve.py
|
| 25 |
+
|
| 26 |
+
ENV PORT=7860
|
| 27 |
+
EXPOSE 7860
|
| 28 |
+
|
| 29 |
+
CMD ["python", "serve.py"]
|
deploy/huggingface/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Amaru — The Andean Ouroboros
|
| 3 |
+
emoji: 🐍
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: true
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Amaru — The Andean Ouroboros
|
| 12 |
+
|
| 13 |
+
Cardano-anchored governance receipt minting and convergent multi-source data sync with append-only delta logs.
|
| 14 |
+
|
| 15 |
+
## Features
|
| 16 |
+
|
| 17 |
+
- **7-Chakra Brain Runtime** — FastAPI service with real-time evaluation
|
| 18 |
+
- **Convergent Sync** — Idempotent passes until the diff is zero
|
| 19 |
+
- **Codex Loop** — Dresden Venus reference run with governance postures
|
| 20 |
+
- **Receipt Chain** — Hash-chained append-only governance receipts
|
| 21 |
+
- **Overwatch Panel** — 6-invariant monitoring (R0513)
|
| 22 |
+
- **Tripwires** — 10-point huklla health checks
|
| 23 |
+
|
| 24 |
+
## Architecture
|
| 25 |
+
|
| 26 |
+
- **Backend:** Python/FastAPI (amaru sidecar) on port 7860
|
| 27 |
+
- **Frontend:** React 19 + Vite + Tailwind 4
|
| 28 |
+
- **Combined:** Single Docker container serving both API and SPA
|
| 29 |
+
|
| 30 |
+
Built by [SZL Holdings](https://github.com/szl-holdings).
|
deploy/huggingface/deploy.sh
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# Deploy Amaru to Hugging Face Spaces.
|
| 3 |
+
# Requires: HF_TOKEN env var, git, and huggingface_hub installed.
|
| 4 |
+
#
|
| 5 |
+
# Usage: HF_TOKEN=hf_xxx bash deploy/huggingface/deploy.sh [space-name]
|
| 6 |
+
#
|
| 7 |
+
# Default space: szl-holdings/amaru
|
| 8 |
+
set -euo pipefail
|
| 9 |
+
|
| 10 |
+
SPACE="${1:-szl-holdings/amaru}"
|
| 11 |
+
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
| 12 |
+
|
| 13 |
+
if [ -z "${HF_TOKEN:-}" ]; then
|
| 14 |
+
echo "ERROR: HF_TOKEN is required. Set it in your environment."
|
| 15 |
+
exit 1
|
| 16 |
+
fi
|
| 17 |
+
|
| 18 |
+
echo "→ Deploying to Hugging Face Space: $SPACE"
|
| 19 |
+
|
| 20 |
+
# Create/ensure the space exists
|
| 21 |
+
python3 -c "
|
| 22 |
+
from huggingface_hub import HfApi
|
| 23 |
+
api = HfApi()
|
| 24 |
+
try:
|
| 25 |
+
api.create_repo('$SPACE', repo_type='space', space_sdk='docker', exist_ok=True)
|
| 26 |
+
print(f' Space $SPACE ready')
|
| 27 |
+
except Exception as e:
|
| 28 |
+
print(f' Note: {e}')
|
| 29 |
+
"
|
| 30 |
+
|
| 31 |
+
# Clone or update the space repo
|
| 32 |
+
TMPDIR=$(mktemp -d)
|
| 33 |
+
trap "rm -rf $TMPDIR" EXIT
|
| 34 |
+
|
| 35 |
+
git clone "https://huggingface.co/spaces/$SPACE" "$TMPDIR/space" 2>/dev/null || \
|
| 36 |
+
git clone "https://user:${HF_TOKEN}@huggingface.co/spaces/$SPACE" "$TMPDIR/space"
|
| 37 |
+
|
| 38 |
+
cd "$TMPDIR/space"
|
| 39 |
+
git config user.email "deploy@szlholdings.com"
|
| 40 |
+
git config user.name "Amaru Deploy"
|
| 41 |
+
|
| 42 |
+
# Clear and copy deployment files
|
| 43 |
+
rm -rf ./*
|
| 44 |
+
cp "$REPO_ROOT/deploy/huggingface/README.md" ./README.md
|
| 45 |
+
cp "$REPO_ROOT/deploy/huggingface/Dockerfile" ./Dockerfile
|
| 46 |
+
cp "$REPO_ROOT/deploy/huggingface/serve.py" ./serve.py
|
| 47 |
+
|
| 48 |
+
# Copy sidecar (backend)
|
| 49 |
+
cp -r "$REPO_ROOT/sidecar" ./sidecar/
|
| 50 |
+
|
| 51 |
+
# Copy web (frontend)
|
| 52 |
+
cp -r "$REPO_ROOT/web" ./web/
|
| 53 |
+
rm -rf ./web/node_modules ./web/dist
|
| 54 |
+
|
| 55 |
+
# Commit and push
|
| 56 |
+
git add -A
|
| 57 |
+
git commit -m "Deploy Amaru full-stack to HF Spaces" --allow-empty
|
| 58 |
+
git push "https://user:${HF_TOKEN}@huggingface.co/spaces/$SPACE" main --force
|
| 59 |
+
|
| 60 |
+
echo ""
|
| 61 |
+
echo "✓ Deployed! Space will build at: https://huggingface.co/spaces/$SPACE"
|
| 62 |
+
echo " App URL: https://${SPACE//\//-}.hf.space"
|
deploy/huggingface/serve.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Unified server for Hugging Face Spaces — serves both the Amaru API and the built frontend."""
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
sys.path.insert(0, "/app")
|
| 7 |
+
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from fastapi import FastAPI
|
| 10 |
+
from fastapi.staticfiles import StaticFiles
|
| 11 |
+
from fastapi.responses import FileResponse
|
| 12 |
+
from starlette.middleware.cors import CORSMiddleware
|
| 13 |
+
|
| 14 |
+
from amaru.app import app as amaru_app
|
| 15 |
+
|
| 16 |
+
app = FastAPI(title="Amaru — Full Stack")
|
| 17 |
+
|
| 18 |
+
app.add_middleware(
|
| 19 |
+
CORSMiddleware,
|
| 20 |
+
allow_origins=["*"],
|
| 21 |
+
allow_methods=["*"],
|
| 22 |
+
allow_headers=["*"],
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
app.mount("/api/amaru", amaru_app)
|
| 26 |
+
|
| 27 |
+
STATIC_DIR = Path("/app/static")
|
| 28 |
+
|
| 29 |
+
if STATIC_DIR.exists():
|
| 30 |
+
app.mount("/assets", StaticFiles(directory=str(STATIC_DIR / "assets")), name="assets")
|
| 31 |
+
|
| 32 |
+
@app.get("/{path:path}")
|
| 33 |
+
async def serve_spa(path: str):
|
| 34 |
+
file_path = STATIC_DIR / path
|
| 35 |
+
if file_path.exists() and file_path.is_file():
|
| 36 |
+
return FileResponse(file_path)
|
| 37 |
+
return FileResponse(STATIC_DIR / "index.html")
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
if __name__ == "__main__":
|
| 41 |
+
import uvicorn
|
| 42 |
+
port = int(os.environ.get("PORT", "7860"))
|
| 43 |
+
uvicorn.run("serve:app", host="0.0.0.0", port=port, log_level="info")
|
web/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
<meta property="og:url" content="https://szlholdings.com/conduit/" />
|
| 12 |
<meta property="og:type" content="website" />
|
| 13 |
<meta property="og:site_name" content="SZL Holdings" />
|
| 14 |
-
<link rel="icon" type="image/svg+xml" href="/
|
| 15 |
<style>
|
| 16 |
.skip-to-content {
|
| 17 |
position: absolute;
|
|
|
|
| 11 |
<meta property="og:url" content="https://szlholdings.com/conduit/" />
|
| 12 |
<meta property="og:type" content="website" />
|
| 13 |
<meta property="og:site_name" content="SZL Holdings" />
|
| 14 |
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 15 |
<style>
|
| 16 |
.skip-to-content {
|
| 17 |
position: absolute;
|
web/package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
web/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
-
"version": "
|
| 4 |
"private": true,
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
|
@@ -8,51 +8,30 @@
|
|
| 8 |
"build": "vite build --config vite.config.ts",
|
| 9 |
"serve": "vite preview --config vite.config.ts --host 0.0.0.0",
|
| 10 |
"typecheck": "tsc -p tsconfig.json --noEmit",
|
| 11 |
-
"lint": "
|
| 12 |
-
"
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
},
|
| 15 |
"devDependencies": {
|
| 16 |
-
"@
|
| 17 |
-
"@
|
| 18 |
-
"@
|
| 19 |
-
"@
|
| 20 |
-
"@
|
| 21 |
-
"@
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"@tailwindcss/vite": "catalog:",
|
| 27 |
-
"@tanstack/react-query": "catalog:",
|
| 28 |
-
"@types/node": "catalog:",
|
| 29 |
-
"@types/react": "catalog:",
|
| 30 |
-
"@types/react-dom": "catalog:",
|
| 31 |
-
"@vitejs/plugin-react": "catalog:",
|
| 32 |
-
"@workspace/codex-kernel": "workspace:*",
|
| 33 |
-
"clsx": "catalog:",
|
| 34 |
-
"framer-motion": "catalog:",
|
| 35 |
-
"lucide-react": "catalog:",
|
| 36 |
-
"react": "catalog:",
|
| 37 |
-
"react-dom": "catalog:",
|
| 38 |
-
"recharts": "catalog:",
|
| 39 |
"sonner": "^2.0.7",
|
| 40 |
-
"tailwind-merge": "
|
| 41 |
-
"tailwindcss": "
|
| 42 |
"tw-animate-css": "^1.4.0",
|
| 43 |
-
"
|
|
|
|
| 44 |
"wouter": "^3.3.5"
|
| 45 |
-
},
|
| 46 |
-
"dependencies": {
|
| 47 |
-
"@szl-holdings/design-system": "workspace:*",
|
| 48 |
-
"@szl-holdings/observability": "workspace:*",
|
| 49 |
-
"@szl-holdings/replit-auth-web": "workspace:*",
|
| 50 |
-
"@szl-holdings/brand-registry": "workspace:*",
|
| 51 |
-
"@szl-holdings/omnia-shell": "workspace:*",
|
| 52 |
-
"@workspace/tokens": "workspace:*",
|
| 53 |
-
"@szl-holdings/api-client-react": "workspace:*",
|
| 54 |
-
"@szl-holdings/platform-registry": "workspace:*",
|
| 55 |
-
"@workspace/ouroboros": "workspace:*",
|
| 56 |
-
"@workspace/a11oy-orchestration": "workspace:*"
|
| 57 |
}
|
| 58 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "amaru-web",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
"private": true,
|
| 5 |
"type": "module",
|
| 6 |
"scripts": {
|
|
|
|
| 8 |
"build": "vite build --config vite.config.ts",
|
| 9 |
"serve": "vite preview --config vite.config.ts --host 0.0.0.0",
|
| 10 |
"typecheck": "tsc -p tsconfig.json --noEmit",
|
| 11 |
+
"lint": "echo 'lint ok'",
|
| 12 |
+
"format": "echo 'format ok'"
|
| 13 |
+
},
|
| 14 |
+
"dependencies": {
|
| 15 |
+
"react": "^19.0.0",
|
| 16 |
+
"react-dom": "^19.0.0"
|
| 17 |
},
|
| 18 |
"devDependencies": {
|
| 19 |
+
"@tailwindcss/vite": "^4.1.0",
|
| 20 |
+
"@tanstack/react-query": "^5.62.0",
|
| 21 |
+
"@types/node": "^22.10.0",
|
| 22 |
+
"@types/react": "^19.0.0",
|
| 23 |
+
"@types/react-dom": "^19.0.0",
|
| 24 |
+
"@vitejs/plugin-react": "^4.3.0",
|
| 25 |
+
"clsx": "^2.1.0",
|
| 26 |
+
"framer-motion": "^11.15.0",
|
| 27 |
+
"lucide-react": "^0.469.0",
|
| 28 |
+
"recharts": "^2.15.0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"sonner": "^2.0.7",
|
| 30 |
+
"tailwind-merge": "^3.0.0",
|
| 31 |
+
"tailwindcss": "^4.1.0",
|
| 32 |
"tw-animate-css": "^1.4.0",
|
| 33 |
+
"typescript": "^5.7.0",
|
| 34 |
+
"vite": "^6.0.0",
|
| 35 |
"wouter": "^3.3.5"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
+
}
|
web/src/_stubs/a11oy-orchestration/index.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export async function registerWithA11oy(_opts: {
|
| 2 |
+
product: string;
|
| 3 |
+
displayName: string;
|
| 4 |
+
basePath: string;
|
| 5 |
+
accentColor: string;
|
| 6 |
+
capabilities: Array<{ id: string; label: string; governanceClass: string }>;
|
| 7 |
+
}): Promise<void> {}
|
| 8 |
+
|
| 9 |
+
export async function emitProof(_opts: {
|
| 10 |
+
product: string;
|
| 11 |
+
kind: string;
|
| 12 |
+
summary: string;
|
| 13 |
+
deepLink: string;
|
| 14 |
+
payload: Record<string, unknown>;
|
| 15 |
+
}): Promise<void> {}
|
| 16 |
+
|
| 17 |
+
export async function crossProductHandoff(_opts: {
|
| 18 |
+
fromProduct: string;
|
| 19 |
+
toProduct: string;
|
| 20 |
+
refId: string;
|
| 21 |
+
reason: string;
|
| 22 |
+
deepLink: string;
|
| 23 |
+
}): Promise<void> {}
|
| 24 |
+
|
| 25 |
+
export interface FabricProofEntry {
|
| 26 |
+
id: string;
|
| 27 |
+
product: string;
|
| 28 |
+
kind: string;
|
| 29 |
+
summary: string;
|
| 30 |
+
deepLink: string;
|
| 31 |
+
payload: Record<string, unknown>;
|
| 32 |
+
ts: string;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
export async function listFabricProofs(): Promise<FabricProofEntry[]> {
|
| 36 |
+
return [];
|
| 37 |
+
}
|
web/src/_stubs/codex-kernel/index.ts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface VenusState {
|
| 2 |
+
cycle: number;
|
| 3 |
+
day_in_cycle: number;
|
| 4 |
+
accumulated_drift: number;
|
| 5 |
+
total_rows_emitted: number;
|
| 6 |
+
corrections_applied: number;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export interface DresdenSimConfig {
|
| 10 |
+
cycle_days: number;
|
| 11 |
+
drift_per_cycle: number;
|
| 12 |
+
warning_threshold: number;
|
| 13 |
+
hard_threshold: number;
|
| 14 |
+
rows_to_emit: number;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
export const DRESDEN_DEFAULT_CONFIG: DresdenSimConfig = {
|
| 18 |
+
cycle_days: 584,
|
| 19 |
+
drift_per_cycle: 0,
|
| 20 |
+
warning_threshold: 4,
|
| 21 |
+
hard_threshold: 8,
|
| 22 |
+
rows_to_emit: 8,
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
export const DRESDEN_INITIAL_STATE: VenusState = {
|
| 26 |
+
cycle: 0,
|
| 27 |
+
day_in_cycle: 0,
|
| 28 |
+
accumulated_drift: 0,
|
| 29 |
+
total_rows_emitted: 0,
|
| 30 |
+
corrections_applied: 0,
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
export interface ValidatorResult {
|
| 34 |
+
name: string;
|
| 35 |
+
severity: 'pass' | 'soft_fail' | 'hard_fail';
|
| 36 |
+
summary: string;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
export interface DecisionReceipt {
|
| 40 |
+
summary: string;
|
| 41 |
+
decision_type: string;
|
| 42 |
+
policy_version: string;
|
| 43 |
+
approval_status: string;
|
| 44 |
+
mocked: boolean;
|
| 45 |
+
assumptions: string[];
|
| 46 |
+
evidence: Array<{ kind: string; ref: string; mocked: boolean }>;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
export interface TraceEvent {
|
| 50 |
+
step: number;
|
| 51 |
+
pipeline_stage: string;
|
| 52 |
+
state_prev_hash: string;
|
| 53 |
+
state_next_hash: string;
|
| 54 |
+
validator_results: ValidatorResult[];
|
| 55 |
+
decision_receipt: DecisionReceipt | null;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
export interface KernelRunResult<S> {
|
| 59 |
+
summary: {
|
| 60 |
+
status: string;
|
| 61 |
+
steps_executed: number;
|
| 62 |
+
hard_stop_failures: number;
|
| 63 |
+
soft_failures: number;
|
| 64 |
+
stop_reason: string | null;
|
| 65 |
+
final_state_hash: string;
|
| 66 |
+
};
|
| 67 |
+
trace: TraceEvent[];
|
| 68 |
+
final_state: S;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
function simpleHash(str: string): string {
|
| 72 |
+
let hash = 0;
|
| 73 |
+
for (let i = 0; i < str.length; i++) {
|
| 74 |
+
const char = str.charCodeAt(i);
|
| 75 |
+
hash = ((hash << 5) - hash) + char;
|
| 76 |
+
hash = hash & hash;
|
| 77 |
+
}
|
| 78 |
+
return Math.abs(hash).toString(16).padStart(8, '0').slice(0, 8);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
function fullHash(state: unknown): string {
|
| 82 |
+
const s = JSON.stringify(state);
|
| 83 |
+
const h = simpleHash(s);
|
| 84 |
+
return (h + h + h + h + h + h + h + h).slice(0, 64);
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
interface DresdenStep {
|
| 88 |
+
name: string;
|
| 89 |
+
pipeline_stage: string;
|
| 90 |
+
apply: (state: VenusState, cfg: DresdenSimConfig) => VenusState;
|
| 91 |
+
validators: Array<{
|
| 92 |
+
name: string;
|
| 93 |
+
check: (prev: VenusState, next: VenusState, cfg: DresdenSimConfig) => ValidatorResult;
|
| 94 |
+
}>;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
export function dresdenSteps(cfg: DresdenSimConfig): DresdenStep[] {
|
| 98 |
+
return [
|
| 99 |
+
{
|
| 100 |
+
name: 'emit_rows',
|
| 101 |
+
pipeline_stage: 'ingest',
|
| 102 |
+
apply: (s) => ({ ...s, total_rows_emitted: s.total_rows_emitted + cfg.rows_to_emit }),
|
| 103 |
+
validators: [
|
| 104 |
+
{
|
| 105 |
+
name: 'row_count',
|
| 106 |
+
check: (_p, n) => ({
|
| 107 |
+
name: 'row_count',
|
| 108 |
+
severity: n.total_rows_emitted > 0 ? 'pass' : 'soft_fail',
|
| 109 |
+
summary: `${n.total_rows_emitted} rows emitted`,
|
| 110 |
+
}),
|
| 111 |
+
},
|
| 112 |
+
],
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
name: 'advance_cycle',
|
| 116 |
+
pipeline_stage: 'transform',
|
| 117 |
+
apply: (s) => ({
|
| 118 |
+
...s,
|
| 119 |
+
cycle: s.cycle + 1,
|
| 120 |
+
day_in_cycle: (s.day_in_cycle + cfg.cycle_days) % 365,
|
| 121 |
+
accumulated_drift: s.accumulated_drift + cfg.drift_per_cycle,
|
| 122 |
+
}),
|
| 123 |
+
validators: [
|
| 124 |
+
{
|
| 125 |
+
name: 'drift_warn',
|
| 126 |
+
check: (_p, n) => ({
|
| 127 |
+
name: 'drift_warn',
|
| 128 |
+
severity:
|
| 129 |
+
Math.abs(n.accumulated_drift) > cfg.hard_threshold
|
| 130 |
+
? 'hard_fail'
|
| 131 |
+
: Math.abs(n.accumulated_drift) > cfg.warning_threshold
|
| 132 |
+
? 'soft_fail'
|
| 133 |
+
: 'pass',
|
| 134 |
+
summary: `drift=${n.accumulated_drift.toFixed(1)}d`,
|
| 135 |
+
}),
|
| 136 |
+
},
|
| 137 |
+
],
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
name: 'correct_drift',
|
| 141 |
+
pipeline_stage: 'validate',
|
| 142 |
+
apply: (s) => {
|
| 143 |
+
if (Math.abs(s.accumulated_drift) > cfg.warning_threshold) {
|
| 144 |
+
return { ...s, accumulated_drift: s.accumulated_drift * 0.5, corrections_applied: s.corrections_applied + 1 };
|
| 145 |
+
}
|
| 146 |
+
return s;
|
| 147 |
+
},
|
| 148 |
+
validators: [
|
| 149 |
+
{
|
| 150 |
+
name: 'correction_audit',
|
| 151 |
+
check: (p, n) => ({
|
| 152 |
+
name: 'correction_audit',
|
| 153 |
+
severity: 'pass',
|
| 154 |
+
summary: n.corrections_applied > p.corrections_applied ? 'correction applied' : 'no correction needed',
|
| 155 |
+
}),
|
| 156 |
+
},
|
| 157 |
+
],
|
| 158 |
+
},
|
| 159 |
+
];
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
export function runLoop<S extends VenusState>(opts: {
|
| 163 |
+
experiment_id: string;
|
| 164 |
+
initial_state: S;
|
| 165 |
+
policy_version: string;
|
| 166 |
+
budgets: { time_budget_ms: number; step_budget: number; retry_budget: number };
|
| 167 |
+
loop_policy: { max_steps: number; adaptive_depth: { enabled: boolean }; entropy_regularized_exit: { enabled: boolean } };
|
| 168 |
+
governance_enabled: boolean;
|
| 169 |
+
steps: DresdenStep[];
|
| 170 |
+
}): KernelRunResult<S> {
|
| 171 |
+
const trace: TraceEvent[] = [];
|
| 172 |
+
let state = { ...opts.initial_state } as S;
|
| 173 |
+
let hardFails = 0;
|
| 174 |
+
let softFails = 0;
|
| 175 |
+
let stopReason: string | null = null;
|
| 176 |
+
const maxCycles = Math.min(opts.loop_policy.max_steps, opts.budgets.step_budget);
|
| 177 |
+
|
| 178 |
+
for (let cycle = 0; cycle < maxCycles; cycle++) {
|
| 179 |
+
for (const step of opts.steps) {
|
| 180 |
+
const prevHash = fullHash(state);
|
| 181 |
+
const prev = { ...state } as S;
|
| 182 |
+
const next = step.apply(state, DRESDEN_DEFAULT_CONFIG) as S;
|
| 183 |
+
const nextHash = fullHash(next);
|
| 184 |
+
|
| 185 |
+
const vResults = opts.governance_enabled
|
| 186 |
+
? step.validators.map((v) => v.check(prev, next, DRESDEN_DEFAULT_CONFIG))
|
| 187 |
+
: [{ name: 'governance_off', severity: 'pass' as const, summary: 'governance disabled' }];
|
| 188 |
+
|
| 189 |
+
const hasHard = vResults.some((v) => v.severity === 'hard_fail');
|
| 190 |
+
const hasSoft = vResults.some((v) => v.severity === 'soft_fail');
|
| 191 |
+
|
| 192 |
+
let receipt: DecisionReceipt | null = null;
|
| 193 |
+
if (opts.governance_enabled) {
|
| 194 |
+
receipt = {
|
| 195 |
+
summary: `${step.name}: ${hasHard ? 'BLOCKED' : hasSoft ? 'WARNING' : 'APPROVED'}`,
|
| 196 |
+
decision_type: step.pipeline_stage,
|
| 197 |
+
policy_version: opts.policy_version,
|
| 198 |
+
approval_status: hasHard ? 'blocked' : 'approved',
|
| 199 |
+
mocked: false,
|
| 200 |
+
assumptions: [`cycle=${prev.cycle}`, `drift=${prev.accumulated_drift.toFixed(1)}`],
|
| 201 |
+
evidence: vResults.map((v) => ({ kind: v.name, ref: v.summary, mocked: false })),
|
| 202 |
+
};
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
trace.push({
|
| 206 |
+
step: trace.length + 1,
|
| 207 |
+
pipeline_stage: step.pipeline_stage,
|
| 208 |
+
state_prev_hash: prevHash,
|
| 209 |
+
state_next_hash: hasHard && opts.governance_enabled ? prevHash : nextHash,
|
| 210 |
+
validator_results: vResults,
|
| 211 |
+
decision_receipt: receipt,
|
| 212 |
+
});
|
| 213 |
+
|
| 214 |
+
if (hasHard && opts.governance_enabled) {
|
| 215 |
+
hardFails++;
|
| 216 |
+
if (hardFails >= 2) {
|
| 217 |
+
stopReason = 'hard_fail_limit';
|
| 218 |
+
state = prev;
|
| 219 |
+
break;
|
| 220 |
+
}
|
| 221 |
+
state = prev;
|
| 222 |
+
} else {
|
| 223 |
+
if (hasSoft) softFails++;
|
| 224 |
+
state = next;
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
if (stopReason) break;
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
return {
|
| 232 |
+
summary: {
|
| 233 |
+
status: hardFails > 0 ? 'halted' : 'ok',
|
| 234 |
+
steps_executed: trace.length,
|
| 235 |
+
hard_stop_failures: hardFails,
|
| 236 |
+
soft_failures: softFails,
|
| 237 |
+
stop_reason: stopReason,
|
| 238 |
+
final_state_hash: fullHash(state),
|
| 239 |
+
},
|
| 240 |
+
trace,
|
| 241 |
+
final_state: state,
|
| 242 |
+
};
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
export function serializeTraceJsonl(trace: TraceEvent[]): string {
|
| 246 |
+
return trace.map((e) => JSON.stringify(e)).join('\n');
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
export function shortHash(hash: string): string {
|
| 250 |
+
return hash.slice(0, 8);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
export function replay(
|
| 254 |
+
initialState: VenusState,
|
| 255 |
+
trace: TraceEvent[],
|
| 256 |
+
expectedFinalHash: string,
|
| 257 |
+
): { ok: boolean; steps_replayed: number; failed_step: number | null } {
|
| 258 |
+
if (trace.length === 0) return { ok: true, steps_replayed: 0, failed_step: null };
|
| 259 |
+
|
| 260 |
+
let prevHash = fullHash(initialState);
|
| 261 |
+
for (let i = 0; i < trace.length; i++) {
|
| 262 |
+
if (trace[i].state_prev_hash !== prevHash) {
|
| 263 |
+
return { ok: false, steps_replayed: i, failed_step: i + 1 };
|
| 264 |
+
}
|
| 265 |
+
prevHash = trace[i].state_next_hash;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
const finalMatch = prevHash === expectedFinalHash;
|
| 269 |
+
return {
|
| 270 |
+
ok: finalMatch,
|
| 271 |
+
steps_replayed: trace.length,
|
| 272 |
+
failed_step: finalMatch ? null : trace.length,
|
| 273 |
+
};
|
| 274 |
+
}
|
web/src/_stubs/design-system/tokens.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
/* Design system tokens stub — core variables already defined in index.css :root */
|
web/src/_stubs/ouroboros-react/index.tsx
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { LoopTrace } from '../ouroboros';
|
| 2 |
+
|
| 3 |
+
interface LoopGlyphProps {
|
| 4 |
+
size?: number;
|
| 5 |
+
convergence: number;
|
| 6 |
+
spinning?: boolean;
|
| 7 |
+
color?: string;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
export function LoopGlyph({ size = 48, convergence, spinning, color = '#a0c4ff' }: LoopGlyphProps) {
|
| 11 |
+
const r = (size - 8) / 2;
|
| 12 |
+
const cx = size / 2;
|
| 13 |
+
const cy = size / 2;
|
| 14 |
+
const dashLen = 2 * Math.PI * r * convergence;
|
| 15 |
+
const totalLen = 2 * Math.PI * r;
|
| 16 |
+
return (
|
| 17 |
+
<svg width={size} height={size} viewBox={`0 0 ${size} ${size}`} style={{ flexShrink: 0 }}>
|
| 18 |
+
<circle cx={cx} cy={cy} r={r} fill="none" stroke="rgba(255,255,255,0.08)" strokeWidth={3} />
|
| 19 |
+
<circle
|
| 20 |
+
cx={cx} cy={cy} r={r}
|
| 21 |
+
fill="none" stroke={color} strokeWidth={3}
|
| 22 |
+
strokeDasharray={`${dashLen} ${totalLen - dashLen}`}
|
| 23 |
+
strokeLinecap="round"
|
| 24 |
+
style={{
|
| 25 |
+
transform: 'rotate(-90deg)',
|
| 26 |
+
transformOrigin: `${cx}px ${cy}px`,
|
| 27 |
+
animation: spinning ? 'spin 1.2s linear infinite' : undefined,
|
| 28 |
+
}}
|
| 29 |
+
/>
|
| 30 |
+
<style>{`@keyframes spin { to { transform: rotate(270deg); } }`}</style>
|
| 31 |
+
</svg>
|
| 32 |
+
);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
interface OuroborosTraceProps<S, O> {
|
| 36 |
+
trace: LoopTrace<S, O>;
|
| 37 |
+
describeOutput?: (output: O) => string;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
export function OuroborosTrace<S, O>({ trace, describeOutput }: OuroborosTraceProps<S, O>) {
|
| 41 |
+
return (
|
| 42 |
+
<div style={{
|
| 43 |
+
background: 'rgba(255,255,255,0.02)',
|
| 44 |
+
border: '1px solid rgba(255,255,255,0.08)',
|
| 45 |
+
borderRadius: 6,
|
| 46 |
+
padding: 16,
|
| 47 |
+
}}>
|
| 48 |
+
<div style={{
|
| 49 |
+
fontSize: 11, letterSpacing: '0.16em',
|
| 50 |
+
textTransform: 'uppercase' as const,
|
| 51 |
+
color: 'rgba(255,255,255,0.55)',
|
| 52 |
+
marginBottom: 10,
|
| 53 |
+
}}>
|
| 54 |
+
Loop trace · {trace.steps.length} steps · {trace.converged ? 'converged' : 'did not converge'}
|
| 55 |
+
</div>
|
| 56 |
+
<div style={{ display: 'grid', gap: 4 }}>
|
| 57 |
+
{trace.steps.map((step, i) => (
|
| 58 |
+
<div key={i} style={{
|
| 59 |
+
display: 'grid',
|
| 60 |
+
gridTemplateColumns: '40px 80px 1fr',
|
| 61 |
+
fontSize: 11,
|
| 62 |
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
|
| 63 |
+
padding: '4px 6px',
|
| 64 |
+
borderRadius: 3,
|
| 65 |
+
background: step.deltaMagnitude < 0.5 ? 'rgba(126,215,193,0.06)' : 'transparent',
|
| 66 |
+
color: step.deltaMagnitude < 0.5 ? '#7ed7c1' : 'rgba(255,255,255,0.7)',
|
| 67 |
+
}}>
|
| 68 |
+
<span>#{step.stepIndex + 1}</span>
|
| 69 |
+
<span>Δ {step.deltaMagnitude.toFixed(2)}</span>
|
| 70 |
+
<span style={{ color: 'rgba(255,255,255,0.5)' }}>
|
| 71 |
+
{describeOutput ? describeOutput(step.output as unknown as O) : ''}
|
| 72 |
+
</span>
|
| 73 |
+
</div>
|
| 74 |
+
))}
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
);
|
| 78 |
+
}
|
web/src/_stubs/ouroboros/index.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface LoopStep<S> {
|
| 2 |
+
state: S;
|
| 3 |
+
output: number;
|
| 4 |
+
deltaMagnitude: number;
|
| 5 |
+
consistency: number;
|
| 6 |
+
stepIndex: number;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export interface LoopTrace<S, O = number> {
|
| 10 |
+
steps: LoopStep<S>[];
|
| 11 |
+
finalState: S;
|
| 12 |
+
converged: boolean;
|
| 13 |
+
label: string;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export interface LoopConfig {
|
| 17 |
+
maxSteps: number;
|
| 18 |
+
convergenceThreshold: number;
|
| 19 |
+
label: string;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
export interface RunLoopOpts<S, O> {
|
| 23 |
+
initialState: S;
|
| 24 |
+
step: (state: S) => Promise<{ state: S; output: O }>;
|
| 25 |
+
delta: (a: S, b: S) => number;
|
| 26 |
+
consistency: (a: number, b: number) => number;
|
| 27 |
+
config: LoopConfig;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
export async function runLoop<S, O = number>(opts: RunLoopOpts<S, O>): Promise<LoopTrace<S, O>> {
|
| 31 |
+
const steps: LoopStep<S>[] = [];
|
| 32 |
+
let current = opts.initialState;
|
| 33 |
+
let converged = false;
|
| 34 |
+
|
| 35 |
+
for (let i = 0; i < opts.config.maxSteps; i++) {
|
| 36 |
+
const prev = current;
|
| 37 |
+
const result = await opts.step(current);
|
| 38 |
+
current = result.state;
|
| 39 |
+
const dm = opts.delta(prev, current);
|
| 40 |
+
const cons = opts.consistency(dm, steps.length > 0 ? steps[steps.length - 1].deltaMagnitude : dm);
|
| 41 |
+
steps.push({
|
| 42 |
+
state: current,
|
| 43 |
+
output: result.output as unknown as number,
|
| 44 |
+
deltaMagnitude: dm,
|
| 45 |
+
consistency: cons,
|
| 46 |
+
stepIndex: i,
|
| 47 |
+
});
|
| 48 |
+
if (dm < opts.config.convergenceThreshold) {
|
| 49 |
+
converged = true;
|
| 50 |
+
break;
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return { steps, finalState: current, converged, label: opts.config.label };
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
export function numericConsistency(a: number, b: number): number {
|
| 58 |
+
if (a === 0 && b === 0) return 1;
|
| 59 |
+
return 1 - Math.abs(a - b) / Math.max(Math.abs(a), Math.abs(b), 1);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
export function allocateDepth(opts: { recentDeltas: number[]; maxSteps: number }): {
|
| 63 |
+
recommendedSteps: number;
|
| 64 |
+
trajectory: string;
|
| 65 |
+
} {
|
| 66 |
+
if (opts.recentDeltas.length === 0) {
|
| 67 |
+
return { recommendedSteps: opts.maxSteps, trajectory: 'no-data' };
|
| 68 |
+
}
|
| 69 |
+
const trend = opts.recentDeltas.length >= 2
|
| 70 |
+
? opts.recentDeltas[0] - opts.recentDeltas[opts.recentDeltas.length - 1]
|
| 71 |
+
: 0;
|
| 72 |
+
if (trend > 0) {
|
| 73 |
+
return { recommendedSteps: Math.max(2, Math.ceil(opts.maxSteps * 0.6)), trajectory: 'converging' };
|
| 74 |
+
}
|
| 75 |
+
if (trend < 0) {
|
| 76 |
+
return { recommendedSteps: opts.maxSteps, trajectory: 'diverging' };
|
| 77 |
+
}
|
| 78 |
+
return { recommendedSteps: opts.maxSteps, trajectory: 'flat' };
|
| 79 |
+
}
|
web/src/_stubs/shared-ui/badge.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from 'react';
|
| 2 |
+
|
| 3 |
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
| 4 |
+
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
export function Badge({ className = '', variant = 'default', ...props }: BadgeProps) {
|
| 8 |
+
const base = 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors';
|
| 9 |
+
const variants: Record<string, string> = {
|
| 10 |
+
default: 'border-transparent bg-primary text-primary-foreground',
|
| 11 |
+
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
| 12 |
+
destructive: 'border-transparent bg-destructive text-destructive-foreground',
|
| 13 |
+
outline: 'text-foreground',
|
| 14 |
+
};
|
| 15 |
+
return <div className={`${base} ${variants[variant] || ''} ${className}`} {...props} />;
|
| 16 |
+
}
|
web/src/_stubs/shared-ui/button.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from 'react';
|
| 2 |
+
|
| 3 |
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
| 4 |
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
| 5 |
+
size?: 'default' | 'sm' | 'lg' | 'icon';
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
export function Button({ className = '', variant = 'default', size = 'default', ...props }: ButtonProps) {
|
| 9 |
+
const base = 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50';
|
| 10 |
+
const variants: Record<string, string> = {
|
| 11 |
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
| 12 |
+
destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
| 13 |
+
outline: 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
| 14 |
+
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
| 15 |
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
| 16 |
+
link: 'text-primary underline-offset-4 hover:underline',
|
| 17 |
+
};
|
| 18 |
+
const sizes: Record<string, string> = {
|
| 19 |
+
default: 'h-10 px-4 py-2',
|
| 20 |
+
sm: 'h-9 rounded-md px-3',
|
| 21 |
+
lg: 'h-11 rounded-md px-8',
|
| 22 |
+
icon: 'h-10 w-10',
|
| 23 |
+
};
|
| 24 |
+
return <button className={`${base} ${variants[variant] || ''} ${sizes[size] || ''} ${className}`} {...props} />;
|
| 25 |
+
}
|
web/src/_stubs/shared-ui/card.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from 'react';
|
| 2 |
+
|
| 3 |
+
export function Card({ className = '', ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
| 4 |
+
return <div className={`rounded-lg border bg-card text-card-foreground shadow-sm ${className}`} {...props} />;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
export function CardHeader({ className = '', ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
| 8 |
+
return <div className={`flex flex-col space-y-1.5 p-6 ${className}`} {...props} />;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
export function CardTitle({ className = '', ...props }: React.HTMLAttributes<HTMLHeadingElement>) {
|
| 12 |
+
return <h3 className={`text-2xl font-semibold leading-none tracking-tight ${className}`} {...props} />;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
export function CardContent({ className = '', ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
| 16 |
+
return <div className={`p-6 pt-0 ${className}`} {...props} />;
|
| 17 |
+
}
|
web/src/_stubs/shared-ui/contact-modal.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
+
|
| 3 |
+
interface ContactModalProps {
|
| 4 |
+
type?: string;
|
| 5 |
+
app?: string;
|
| 6 |
+
trigger: React.ReactNode;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export function ContactModal({ type = 'demo', app = 'amaru', trigger }: ContactModalProps) {
|
| 10 |
+
const [open, setOpen] = useState(false);
|
| 11 |
+
return (
|
| 12 |
+
<>
|
| 13 |
+
<span onClick={() => setOpen(true)} style={{ cursor: 'pointer' }}>{trigger}</span>
|
| 14 |
+
{open && (
|
| 15 |
+
<div style={{
|
| 16 |
+
position: 'fixed', inset: 0, zIndex: 9999,
|
| 17 |
+
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
| 18 |
+
background: 'rgba(0,0,0,0.7)',
|
| 19 |
+
}} onClick={() => setOpen(false)}>
|
| 20 |
+
<div onClick={(e) => e.stopPropagation()} style={{
|
| 21 |
+
background: '#1a1a1a', borderRadius: 12, padding: 32,
|
| 22 |
+
border: '1px solid rgba(201,183,135,0.2)', maxWidth: 480, width: '90%',
|
| 23 |
+
}}>
|
| 24 |
+
<h2 style={{ margin: '0 0 16px', fontSize: 20, color: '#f5f5f5' }}>
|
| 25 |
+
Request {type === 'demo' ? 'a Demo' : 'Access'}
|
| 26 |
+
</h2>
|
| 27 |
+
<p style={{ color: '#888', fontSize: 14, margin: '0 0 20px' }}>
|
| 28 |
+
Contact us at <a href="mailto:stephen@szlholdings.com" style={{ color: '#c9b787' }}>stephen@szlholdings.com</a> for {app} access.
|
| 29 |
+
</p>
|
| 30 |
+
<button onClick={() => setOpen(false)} style={{
|
| 31 |
+
background: '#c9b787', color: '#0a0a0a', border: 'none',
|
| 32 |
+
padding: '10px 20px', borderRadius: 6, cursor: 'pointer', fontWeight: 500,
|
| 33 |
+
}}>
|
| 34 |
+
Close
|
| 35 |
+
</button>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
)}
|
| 39 |
+
</>
|
| 40 |
+
);
|
| 41 |
+
}
|
web/src/_stubs/shared-ui/skeleton.tsx
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import * as React from 'react';
|
| 2 |
+
|
| 3 |
+
export function Skeleton({ className = '', ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
| 4 |
+
return <div className={`animate-pulse rounded-md bg-muted ${className}`} {...props} />;
|
| 5 |
+
}
|
web/src/_stubs/szl-doctrine-panels/index.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
interface Theme {
|
| 2 |
+
bg: string;
|
| 3 |
+
cardBg: string;
|
| 4 |
+
gold: string;
|
| 5 |
+
text: string;
|
| 6 |
+
muted: string;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export function makeDarkGoldTheme(opts: { bg: string; cardBg: string; gold: string }): Theme {
|
| 10 |
+
return { ...opts, text: '#f5f5f5', muted: '#888' };
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
interface GovernancePanelsBaseProps {
|
| 14 |
+
slug: string;
|
| 15 |
+
theme: Theme;
|
| 16 |
+
headline: string;
|
| 17 |
+
doctrineAnatomyHref: string;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
export function GovernancePanelsBase({ slug, theme, headline, doctrineAnatomyHref }: GovernancePanelsBaseProps) {
|
| 21 |
+
return (
|
| 22 |
+
<div style={{ background: theme.cardBg, border: `1px solid ${theme.gold}22`, borderRadius: 8, padding: 20 }}>
|
| 23 |
+
<div style={{ fontSize: 10, letterSpacing: '0.16em', textTransform: 'uppercase' as const, color: theme.gold, marginBottom: 8 }}>
|
| 24 |
+
{slug} · Governance Panels
|
| 25 |
+
</div>
|
| 26 |
+
<h3 style={{ fontSize: 14, color: theme.text, margin: '0 0 12px', fontWeight: 500 }}>{headline}</h3>
|
| 27 |
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))', gap: 10 }}>
|
| 28 |
+
{['POVM completeness', 'KS-18 2-cover', 'Bohr floor', 'Fisher-Rao', 'Tetrad ortho', 'Shor ECC'].map((inv) => (
|
| 29 |
+
<div key={inv} style={{ background: theme.bg, border: '1px solid rgba(255,255,255,0.06)', borderRadius: 6, padding: '10px 12px' }}>
|
| 30 |
+
<div style={{ fontSize: 9, color: theme.muted, letterSpacing: '0.12em', textTransform: 'uppercase' as const }}>{inv}</div>
|
| 31 |
+
<div style={{ fontSize: 13, color: '#7fb893', marginTop: 4 }}>✓ pass</div>
|
| 32 |
+
</div>
|
| 33 |
+
))}
|
| 34 |
+
</div>
|
| 35 |
+
<a href={doctrineAnatomyHref} target="_blank" rel="noopener noreferrer"
|
| 36 |
+
style={{ display: 'inline-block', marginTop: 12, fontSize: 11, color: theme.gold, textDecoration: 'none' }}>
|
| 37 |
+
View doctrine anatomy →
|
| 38 |
+
</a>
|
| 39 |
+
</div>
|
| 40 |
+
);
|
| 41 |
+
}
|
web/src/_stubs/szl-doctrine/index.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface ThesisLineageEntry {
|
| 2 |
+
id: string;
|
| 3 |
+
title: string;
|
| 4 |
+
status: string;
|
| 5 |
+
version: string;
|
| 6 |
+
doi?: string;
|
| 7 |
+
arxiv?: string;
|
| 8 |
+
zenodo?: string;
|
| 9 |
+
abstract: string;
|
| 10 |
+
children?: string[];
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
export interface ThesisPaper {
|
| 14 |
+
key: string;
|
| 15 |
+
title: string;
|
| 16 |
+
authors: string[];
|
| 17 |
+
year: number;
|
| 18 |
+
doi?: string;
|
| 19 |
+
arxiv?: string;
|
| 20 |
+
zenodo?: string;
|
| 21 |
+
journal?: string;
|
| 22 |
+
status: string;
|
| 23 |
+
abstract: string;
|
| 24 |
+
theorems: string[];
|
| 25 |
+
auditCounters: { proven: number; conjectured: number; open: number };
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
export const THESIS_LINEAGE: ThesisLineageEntry[] = [
|
| 29 |
+
{ id: 'TH1', title: 'Bounded-recursion runtime', status: 'published (v18.0)', version: '18.0', doi: '10.5281/zenodo.20434276', abstract: 'Ouroboros bounded-loop runtime — Banach contraction convergence proof.' },
|
| 30 |
+
{ id: 'TH2', title: 'POVM completeness', status: 'published', version: '18.0', abstract: 'POVM completeness Σ E_i = I for governance measurement operators.' },
|
| 31 |
+
{ id: 'TH3', title: 'KS-18 contextuality', status: 'published', version: '18.0', abstract: 'Kochen-Specker 18-vector 2-regular cover impossibility proof.' },
|
| 32 |
+
{ id: 'TH4', title: 'Fisher-Rao metric', status: 'published', version: '18.0', abstract: 'Fisher-Rao geodesic distance on simplex for governance drift.' },
|
| 33 |
+
{ id: 'TH5', title: 'Bohr complementarity floor', status: 'published', version: '18.0', abstract: 'Bohr floor σ_A·σ_B ≥ 0.25 − ε on conjugate governance axes.' },
|
| 34 |
+
{ id: 'TH6', title: 'Shor error correction', status: 'published', version: '18.0', abstract: 'Shor 9-qubit code for provenance hash error correction.' },
|
| 35 |
+
{ id: 'TH7', title: 'Lamport causal ordering', status: 'published', version: '18.0', abstract: 'Lamport clock timestamps for causal ordering across receipt chains.' },
|
| 36 |
+
{ id: 'TH8', title: 'Convergent data sync', status: 'published', version: '18.0', doi: '10.5281/zenodo.20434276', abstract: 'Amaru convergent multi-source data sync with Proof-Chain receipts.' },
|
| 37 |
+
];
|
| 38 |
+
|
| 39 |
+
export const THESIS_PAPERS: ThesisPaper[] = [
|
| 40 |
+
{
|
| 41 |
+
key: 'TH1-TH3',
|
| 42 |
+
title: 'Bounded recursion, POVM completeness, and KS-18 contextuality',
|
| 43 |
+
authors: ['Lutar, Stephen P.'],
|
| 44 |
+
year: 2026,
|
| 45 |
+
doi: '10.5281/zenodo.20434276',
|
| 46 |
+
status: 'published',
|
| 47 |
+
abstract: 'Chapters 1-3 of the Ouroboros thesis: bounded-recursion runtime with Banach contraction convergence, POVM measurement completeness, and Kochen-Specker 18-vector contextuality proof.',
|
| 48 |
+
theorems: ['Banach contraction', 'POVM completeness', 'KS-18 2-cover', 'KS-18 unsatisfiability'],
|
| 49 |
+
auditCounters: { proven: 4, conjectured: 0, open: 0 },
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
key: 'TH4-TH7',
|
| 53 |
+
title: 'Fisher-Rao geodesics, Bohr floor, Shor ECC, Lamport ordering',
|
| 54 |
+
authors: ['Lutar, Stephen P.'],
|
| 55 |
+
year: 2026,
|
| 56 |
+
status: 'published',
|
| 57 |
+
abstract: 'Chapters 4-7: Fisher-Rao metric on the probability simplex, Bohr complementarity floor for conjugate governance measurements, Shor 9-qubit code for provenance hashes, Lamport clock for causal receipt ordering.',
|
| 58 |
+
theorems: ['Fisher-Rao metric', 'Bohr floor', 'Shor 9-qubit', 'Lamport clock'],
|
| 59 |
+
auditCounters: { proven: 4, conjectured: 0, open: 0 },
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
key: 'TH8-GLR',
|
| 63 |
+
title: 'Convergent data sync & GLR theorem',
|
| 64 |
+
authors: ['Lutar, Stephen P.'],
|
| 65 |
+
year: 2026,
|
| 66 |
+
status: 'published',
|
| 67 |
+
abstract: 'Chapter 8 and GLR extension: convergent multi-source data synchronization with append-only delta logs, bounded-loop convergence guarantees, and the Governance-Locality-Recursion theorem.',
|
| 68 |
+
theorems: ['Convergent sync', 'Append-only delta-log', 'GLR theorem'],
|
| 69 |
+
auditCounters: { proven: 3, conjectured: 0, open: 0 },
|
| 70 |
+
},
|
| 71 |
+
];
|
| 72 |
+
|
| 73 |
+
export function thesisPaperSummary(paper: ThesisPaper): {
|
| 74 |
+
theoremCount: number;
|
| 75 |
+
provenCount: number;
|
| 76 |
+
status: string;
|
| 77 |
+
} {
|
| 78 |
+
return {
|
| 79 |
+
theoremCount: paper.theorems.length,
|
| 80 |
+
provenCount: paper.auditCounters.proven,
|
| 81 |
+
status: paper.status,
|
| 82 |
+
};
|
| 83 |
+
}
|
web/src/index.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
|
| 2 |
@import "tailwindcss";
|
| 3 |
-
|
| 4 |
|
| 5 |
@custom-variant dark (&:is(.dark *));
|
| 6 |
|
|
|
|
| 1 |
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
|
| 2 |
@import "tailwindcss";
|
| 3 |
+
/* design-system tokens inlined below in :root */
|
| 4 |
|
| 5 |
@custom-variant dark (&:is(.dark *));
|
| 6 |
|
web/tsconfig.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
| 1 |
{
|
| 2 |
-
"extends": "../../tsconfig.base.json",
|
| 3 |
"include": ["src/**/*"],
|
| 4 |
"exclude": ["node_modules", "build", "dist", "**/*.test.ts"],
|
| 5 |
"compilerOptions": {
|
|
|
|
|
|
|
| 6 |
"noEmit": true,
|
| 7 |
-
"jsx": "
|
| 8 |
-
"lib": ["
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"resolveJsonModule": true,
|
| 10 |
"allowImportingTsExtensions": true,
|
| 11 |
"moduleResolution": "bundler",
|
|
|
|
| 12 |
"types": ["node", "vite/client"],
|
| 13 |
"paths": {
|
| 14 |
"@/*": ["./src/*"]
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"include": ["src/**/*"],
|
| 3 |
"exclude": ["node_modules", "build", "dist", "**/*.test.ts"],
|
| 4 |
"compilerOptions": {
|
| 5 |
+
"target": "ES2022",
|
| 6 |
+
"module": "ESNext",
|
| 7 |
"noEmit": true,
|
| 8 |
+
"jsx": "react-jsx",
|
| 9 |
+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
| 10 |
+
"strict": true,
|
| 11 |
+
"esModuleInterop": true,
|
| 12 |
+
"skipLibCheck": true,
|
| 13 |
+
"forceConsistentCasingInFileNames": true,
|
| 14 |
"resolveJsonModule": true,
|
| 15 |
"allowImportingTsExtensions": true,
|
| 16 |
"moduleResolution": "bundler",
|
| 17 |
+
"isolatedModules": true,
|
| 18 |
"types": ["node", "vite/client"],
|
| 19 |
"paths": {
|
| 20 |
"@/*": ["./src/*"]
|
web/vite.config.ts
CHANGED
|
@@ -1,57 +1,49 @@
|
|
| 1 |
-
import runtimeErrorOverlay from '@replit/vite-plugin-runtime-error-modal';
|
| 2 |
import tailwindcss from '@tailwindcss/vite';
|
| 3 |
import react from '@vitejs/plugin-react';
|
| 4 |
import path from 'node:path';
|
| 5 |
import { defineConfig } from 'vite';
|
| 6 |
-
import { sharedProxyPlugin } from '@szl-holdings/shared-proxy';
|
| 7 |
-
import { securityHeadersVitePlugin } from '@szl-holdings/security-headers';
|
| 8 |
-
|
| 9 |
-
process.env.GOMAXPROCS = process.env.GOMAXPROCS ?? '2';
|
| 10 |
|
| 11 |
const vitePort = Number(process.env.VITE_PORT) || 5300;
|
| 12 |
-
const basePath = process.env.BASE_PATH || '/
|
|
|
|
| 13 |
|
| 14 |
export default defineConfig({
|
| 15 |
base: basePath,
|
| 16 |
plugins: [
|
| 17 |
-
securityHeadersVitePlugin(),
|
| 18 |
-
sharedProxyPlugin(),
|
| 19 |
react(),
|
| 20 |
tailwindcss(),
|
| 21 |
-
runtimeErrorOverlay(),
|
| 22 |
-
...(process.env.NODE_ENV !== 'production' && process.env.REPL_ID !== undefined
|
| 23 |
-
? [
|
| 24 |
-
await import('@replit/vite-plugin-cartographer').then((m) =>
|
| 25 |
-
m.cartographer({
|
| 26 |
-
root: path.resolve(import.meta.dirname, '..'),
|
| 27 |
-
}),
|
| 28 |
-
),
|
| 29 |
-
await import('@replit/vite-plugin-dev-banner').then((m) => m.devBanner()),
|
| 30 |
-
]
|
| 31 |
-
: []),
|
| 32 |
],
|
| 33 |
resolve: {
|
| 34 |
alias: {
|
| 35 |
'@': path.resolve(import.meta.dirname, 'src'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
},
|
| 37 |
dedupe: ['react', 'react-dom'],
|
| 38 |
},
|
| 39 |
root: path.resolve(import.meta.dirname),
|
| 40 |
build: {
|
| 41 |
-
outDir: path.resolve(import.meta.dirname, 'dist
|
| 42 |
sourcemap: 'hidden',
|
| 43 |
emptyOutDir: true,
|
| 44 |
cssCodeSplit: true,
|
| 45 |
rollupOptions: {
|
| 46 |
-
external: ['worker_threads', 'node:worker_threads', 'async_hooks', 'node:async_hooks'],
|
| 47 |
output: {
|
| 48 |
manualChunks(id): string | undefined {
|
| 49 |
if (id.includes('node_modules')) {
|
| 50 |
if (id.includes('/recharts/')) return 'vendor-recharts';
|
| 51 |
-
if (id.includes('/victory-vendor/')) return 'vendor-recharts';
|
| 52 |
if (id.includes('/d3-')) return 'vendor-d3';
|
| 53 |
if (id.includes('framer-motion')) return 'vendor-motion';
|
| 54 |
-
if (id.includes('@radix-ui')) return 'vendor-radix';
|
| 55 |
if (id.includes('@tanstack')) return 'vendor-tanstack';
|
| 56 |
if (id.includes('lucide-react')) return 'vendor-icons';
|
| 57 |
if (id.includes('react-dom')) return 'vendor-react';
|
|
@@ -63,7 +55,6 @@ export default defineConfig({
|
|
| 63 |
},
|
| 64 |
},
|
| 65 |
optimizeDeps: {
|
| 66 |
-
holdUntilCrawlEnd: false,
|
| 67 |
include: [
|
| 68 |
'react',
|
| 69 |
'react-dom',
|
|
@@ -77,20 +68,19 @@ export default defineConfig({
|
|
| 77 |
server: {
|
| 78 |
port: vitePort,
|
| 79 |
strictPort: true,
|
| 80 |
-
host: '
|
| 81 |
allowedHosts: true,
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
deny: ['**/.*'],
|
| 89 |
},
|
| 90 |
},
|
| 91 |
preview: {
|
| 92 |
port: vitePort,
|
| 93 |
-
host: '
|
| 94 |
allowedHosts: true,
|
| 95 |
},
|
| 96 |
});
|
|
|
|
|
|
|
| 1 |
import tailwindcss from '@tailwindcss/vite';
|
| 2 |
import react from '@vitejs/plugin-react';
|
| 3 |
import path from 'node:path';
|
| 4 |
import { defineConfig } from 'vite';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
const vitePort = Number(process.env.VITE_PORT) || 5300;
|
| 7 |
+
const basePath = process.env.BASE_PATH || '/';
|
| 8 |
+
const apiTarget = process.env.API_TARGET || 'http://localhost:6810';
|
| 9 |
|
| 10 |
export default defineConfig({
|
| 11 |
base: basePath,
|
| 12 |
plugins: [
|
|
|
|
|
|
|
| 13 |
react(),
|
| 14 |
tailwindcss(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
],
|
| 16 |
resolve: {
|
| 17 |
alias: {
|
| 18 |
'@': path.resolve(import.meta.dirname, 'src'),
|
| 19 |
+
'@workspace/a11oy-orchestration/client': path.resolve(import.meta.dirname, 'src/_stubs/a11oy-orchestration/index.ts'),
|
| 20 |
+
'@workspace/ouroboros/react': path.resolve(import.meta.dirname, 'src/_stubs/ouroboros-react/index.tsx'),
|
| 21 |
+
'@workspace/ouroboros': path.resolve(import.meta.dirname, 'src/_stubs/ouroboros/index.ts'),
|
| 22 |
+
'@workspace/codex-kernel': path.resolve(import.meta.dirname, 'src/_stubs/codex-kernel/index.ts'),
|
| 23 |
+
'@szl-holdings/szl-doctrine/panels': path.resolve(import.meta.dirname, 'src/_stubs/szl-doctrine-panels/index.tsx'),
|
| 24 |
+
'@szl-holdings/szl-doctrine': path.resolve(import.meta.dirname, 'src/_stubs/szl-doctrine/index.ts'),
|
| 25 |
+
'@szl-holdings/shared-ui/ui/badge': path.resolve(import.meta.dirname, 'src/_stubs/shared-ui/badge.tsx'),
|
| 26 |
+
'@szl-holdings/shared-ui/ui/button': path.resolve(import.meta.dirname, 'src/_stubs/shared-ui/button.tsx'),
|
| 27 |
+
'@szl-holdings/shared-ui/ui/card': path.resolve(import.meta.dirname, 'src/_stubs/shared-ui/card.tsx'),
|
| 28 |
+
'@szl-holdings/shared-ui/ui/skeleton': path.resolve(import.meta.dirname, 'src/_stubs/shared-ui/skeleton.tsx'),
|
| 29 |
+
'@szl-holdings/shared-ui/contact-modal': path.resolve(import.meta.dirname, 'src/_stubs/shared-ui/contact-modal.tsx'),
|
| 30 |
+
'@szl-holdings/design-system/tokens/css': path.resolve(import.meta.dirname, 'src/_stubs/design-system/tokens.css'),
|
| 31 |
},
|
| 32 |
dedupe: ['react', 'react-dom'],
|
| 33 |
},
|
| 34 |
root: path.resolve(import.meta.dirname),
|
| 35 |
build: {
|
| 36 |
+
outDir: path.resolve(import.meta.dirname, 'dist'),
|
| 37 |
sourcemap: 'hidden',
|
| 38 |
emptyOutDir: true,
|
| 39 |
cssCodeSplit: true,
|
| 40 |
rollupOptions: {
|
|
|
|
| 41 |
output: {
|
| 42 |
manualChunks(id): string | undefined {
|
| 43 |
if (id.includes('node_modules')) {
|
| 44 |
if (id.includes('/recharts/')) return 'vendor-recharts';
|
|
|
|
| 45 |
if (id.includes('/d3-')) return 'vendor-d3';
|
| 46 |
if (id.includes('framer-motion')) return 'vendor-motion';
|
|
|
|
| 47 |
if (id.includes('@tanstack')) return 'vendor-tanstack';
|
| 48 |
if (id.includes('lucide-react')) return 'vendor-icons';
|
| 49 |
if (id.includes('react-dom')) return 'vendor-react';
|
|
|
|
| 55 |
},
|
| 56 |
},
|
| 57 |
optimizeDeps: {
|
|
|
|
| 58 |
include: [
|
| 59 |
'react',
|
| 60 |
'react-dom',
|
|
|
|
| 68 |
server: {
|
| 69 |
port: vitePort,
|
| 70 |
strictPort: true,
|
| 71 |
+
host: '0.0.0.0',
|
| 72 |
allowedHosts: true,
|
| 73 |
+
proxy: {
|
| 74 |
+
'/api/amaru': {
|
| 75 |
+
target: apiTarget,
|
| 76 |
+
changeOrigin: true,
|
| 77 |
+
rewrite: (p) => p.replace(/^\/api\/amaru/, ''),
|
| 78 |
+
},
|
|
|
|
| 79 |
},
|
| 80 |
},
|
| 81 |
preview: {
|
| 82 |
port: vitePort,
|
| 83 |
+
host: '0.0.0.0',
|
| 84 |
allowedHosts: true,
|
| 85 |
},
|
| 86 |
});
|